Skip to content

Make --in optional for all tools commands#340

Open
robzolkos wants to merge 2 commits intomainfrom
tools-optional-project
Open

Make --in optional for all tools commands#340
robzolkos wants to merge 2 commits intomainfrom
tools-optional-project

Conversation

@robzolkos
Copy link
Collaborator

@robzolkos robzolkos commented Mar 17, 2026

Summary

  • Every tools subcommand (show, create, update, trash, enable, disable, reposition)
    required --in <project> and fell back to interactive project selection when omitted.
    The project ID is never passed to any SDK call — the API is account-scoped — so this
    was unnecessary friction.
  • --in is now optional. If provided, it's used for breadcrumb hints. If omitted,
    breadcrumbs skip --in and the "View project" link. Config defaults still enrich
    breadcrumbs on a best-effort basis.
  • Explicit --in with a bad value still surfaces an error (not silently swallowed).

Summary by cubic

--in is now optional for all tools commands. Commands no longer prompt for a project and only use the project for breadcrumbs and hints.

  • Refactors
    • Added resolveToolsProject() to optionally resolve projects for breadcrumbs; explicit bad --in/--project still errors, config defaults failing are ignored.
    • Removed interactive project selection (ensureProject()) from all tools subcommands.
    • Breadcrumbs add --in <id> only when a project resolves and skip the "View project" link when none.
    • Updated flag help: --project says "Project ID or name (for breadcrumbs)"; --in says "Project ID or name (alias for --project)".
    • Added tests for no-project flows, explicit-project error without calling the tools API (transport-backed), config-default handling, breadcrumb content, and case-insensitive assertions.

Written for commit 0c37474. Summary will update on new commits.

…crumbs

Every tools subcommand (show, create, update, trash, enable, disable,
reposition) required --in <project> and fell back to interactive project
selection when omitted. The project ID was never passed to any SDK call —
the API is account-scoped — so this was unnecessary friction.

- Remove ensureProject() from all tools subcommands
- Extract resolveToolsProject() helper that optionally resolves a project
  for breadcrumb display without blocking the command
- Explicit --in with a bad value still surfaces an error; config defaults
  that fail resolution are silently ignored (best-effort breadcrumbs)
- Add tests for no-project, explicit-project-error, config-default, and
  transport-backed breadcrumb content assertions
@robzolkos robzolkos requested a review from a team as a code owner March 17, 2026 16:44
Copilot AI review requested due to automatic review settings March 17, 2026 16:44
@github-actions github-actions bot added commands CLI command implementations tests Tests (unit and e2e) enhancement New feature or request labels Mar 17, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the hard requirement for specifying a project (--in/--project) across all tools subcommands by making project resolution optional and using it only to enrich breadcrumbs when available.

Changes:

  • Introduces optional project resolution (resolveToolsProject) used solely for breadcrumb generation, with “explicit flag” failures surfacing errors and config defaults treated as best-effort.
  • Updates tools subcommands (show/create/update/trash/enable/disable/reposition) to avoid interactive project selection when no project is provided.
  • Adds tests covering “no project required” behavior and breadcrumb rendering with/without an explicit project.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
internal/commands/tools.go Makes project resolution optional for tools commands and conditionally emits --in / “View project” breadcrumbs.
internal/commands/tools_test.go Adds regression tests for running tools commands without --in and for breadcrumb output with/without a project.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

…ions, transport-backed error test

- Update --in flag help to say "Project ID or name" matching --project
- Use strings.ToLower for case-insensitive project error assertions
- Replace setupTestApp with mockToolProjectFailTransport in explicit
  project error test to prove tools API is never called when project
  resolution fails
@robzolkos robzolkos requested a review from jeremy March 17, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands CLI command implementations enhancement New feature or request tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants