Skip to content

Add --in as global alias for --project#334

Merged
jeremy merged 5 commits intomainfrom
add-global-in-flag-alias
Mar 16, 2026
Merged

Add --in as global alias for --project#334
jeremy merged 5 commits intomainfrom
add-global-in-flag-alias

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented Mar 16, 2026

Summary

  • Promotes --in from per-command local flag to a root-level persistent flag, aliasing --project
  • Fixes basecamp show todo <id> --in <project> returning "Unknown option: --in"
  • Commands that define their own local --in continue to shadow the global one, no behavior change

Fixes the inconsistency described in the Figuring it out card: most commands accepted --in but show only accepted --project.


Summary by cubic

Promotes --in to a global alias for --project across the CLI and makes people subcommands accept it. Fixes unknown/ignored --in cases and aligns behavior with docs.

  • Bug Fixes
    • Register project name completion for --in; use projectFlagChanged() so config project honors --project or --in.
    • Make people list/add/remove accept --in by adding a local alias, validating either flag, and registering completion for both.
    • Fall back to root --project/--in in people list/add/remove when local flags are unset, so basecamp --in 55555 people ... works.

Written for commit 85de871. Summary will update on new commits.

Most commands defined --in locally as a project scope alias, but
commands like `show` only inherited the root --project flag. This
caused "Unknown option: --in" for `basecamp show todo <id> --in <project>`
while --project worked fine. Promoting --in to the root command makes
it available everywhere, consistent with what agents and docs teach.
@robzolkos robzolkos requested a review from a team as a code owner March 16, 2026 12:56
Copilot AI review requested due to automatic review settings March 16, 2026 12:56
Copy link
Copy Markdown
Contributor

@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.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/cli/root.go">

<violation number="1" location="internal/cli/root.go:187">
P2: Missing tab-completion registration for `--in`. The `--project` flag has `RegisterFlagCompletionFunc` wired up, but the new `--in` alias does not, so `--in <TAB>` won't offer project-name completions.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread internal/cli/root.go
Copy link
Copy Markdown

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 promotes --in to a root-level persistent flag so it works consistently across commands (notably basecamp show ...), aligning it as an alias for --project.

Changes:

  • Add a new root persistent --in flag wired to the same underlying project flag value.
  • Update the CLI surface snapshot (.surface) to include --in across commands.

Reviewed changes

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

File Description
internal/cli/root.go Adds root-level --in flag intended to alias --project.
.surface Updates the surface snapshot to reflect the new --in flag availability.

💡 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.

Comment thread internal/cli/root.go
Comment thread internal/cli/root.go
Register the same ProjectNameCompletion for --in so shell tab
completion works. Add projectFlagChanged() helper that checks both
--project and --in, used in config project where Changed gating
would miss the alias.
@github-actions github-actions bot added commands CLI command implementations bug Something isn't working labels Mar 16, 2026
@robzolkos robzolkos requested a review from jeremy March 16, 2026 14:00
jeremy added 2 commits March 16, 2026 12:00
The global --in persistent flag was shadowed by local --project flags on
people subcommands, so --in was silently ignored. Additionally, add and
remove used MarkFlagRequired("project") which rejected --in outright.

Fix by adding local --in aliases (bound to the same variable as --project),
replacing MarkFlagRequired with manual validation that accepts either flag,
and registering tab completion for both flags on all three subcommands.
Register the --in persistent flag in the test helper (matching root.go)
and add a test that verifies config project --in resolves and persists
the project ID correctly.
Copilot AI review requested due to automatic review settings March 16, 2026 19:01
@github-actions github-actions bot added the tests Tests (unit and e2e) label Mar 16, 2026
Copy link
Copy Markdown

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 promotes --in to a root-level persistent flag as a global alias for --project, aiming to make project scoping consistent across commands (notably fixing basecamp show todo <id> --in <project>). It also updates completion and ensures config project detects either flag.

Changes:

  • Adds --in as a persistent root flag bound to the same value as --project, plus shell completion.
  • Updates config project to treat --project and --in as equivalent for “explicit flag provided” detection.
  • Extends people command tests and flags to accept --in as an alias in list/add/remove.

Reviewed changes

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

Show a summary per file
File Description
internal/cli/root.go Adds global persistent --in and registers project-name completion for it.
internal/commands/helpers.go Introduces projectFlagChanged() helper for alias-aware .Changed detection.
internal/commands/config.go Uses projectFlagChanged() so config project recognizes --in as explicit input.
internal/commands/config_test.go Adds test coverage ensuring config project --in ... works and persists config.
internal/commands/people.go Adds per-subcommand --in flags (aliasing local --project) and completion; adjusts required-flag behavior for add/remove.
internal/commands/people_test.go Adds mock-server-based tests verifying people list/add/remove behavior with --in.
.surface Updates CLI surface snapshot to include the new global flag everywhere.

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

Comment thread internal/commands/people.go
Comment thread internal/commands/people.go
Comment thread internal/commands/people.go
Comment thread internal/commands/people_test.go
Comment thread internal/commands/config_test.go Outdated
Local --project/--in flags on people list/add/remove shadow the root
persistent flags. When the global flag is placed before the subcommand
(e.g. `basecamp --in 55555 people list`), the local variable stays
empty. Fall back to app.Flags.Project, matching the pattern used by
schedule, todos, and other commands with local project flags.

Also hardens mock server decode/assertion in people tests and uses
require.NoError for EvalSymlinks/Getwd in config_test.
@jeremy jeremy merged commit 177f6f6 into main Mar 16, 2026
26 checks passed
@jeremy jeremy deleted the add-global-in-flag-alias branch March 16, 2026 19:52
jeremy added a commit to brianevanmiller/basecamp-cli that referenced this pull request Mar 18, 2026
…evanmiller/feature-gap-analysis

* origin/main:
  Show full content in detail views instead of truncating at 40 chars (basecamp#338)
  Switch CODEOWNERS from sip to cli team (basecamp#346)
  Fix dock ordering and add --all flag to `projects show` (basecamp#333)
  Add file upload command to SKILL.md (basecamp#343)
  Replace "pending" with "incomplete" in todos output; omit from default view (basecamp#327)
  Add `--in` as global alias for `--project` (basecamp#334)
  Fix 3 post-QA issues on api command (basecamp#330)
  deps: bump the go-dependencies group with 2 updates (basecamp#331)
  Improve tool instance disambiguation format (basecamp#329)
  Fix emoji/CJK alignment in search results (basecamp#328)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working commands CLI command implementations tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants