Fix 3 post-QA issues on api command#330
Conversation
MSYS/Git Bash on Windows converts /projects.json to C:\msys64\projects.json before Go sees it. The SDK's accountPath and buildURL both prepend a slash, so parsePath doesn't need one — strip it instead of ensuring it. Update all api command examples to use bare paths (projects.json instead of /projects.json) so they work directly on Windows.
The global transformArgError rewrites Cobra's generic missing-arg message to "ID required". The api command's argument is <path>, not <id>, so use a custom validator that emits "path required" directly.
emitAgentHelp was dumping all inherited flags unfiltered, leaking --todolist, --verbose, etc. into --agent --help output. Extract curatedInheritedFlags from filterInheritedFlags so both text and agent help share the same logic: salientRootFlags allowlist, root pointer-identity check, and --project suppression for <id|url> commands.
Review carefully before merging. Consider a major version bump. |
There was a problem hiding this comment.
2 issues found across 5 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/commands/api.go">
<violation number="1" location="internal/commands/api.go:205">
P2: The URL branch still returns a path with a leading slash (e.g. `/projects.json`), contradicting the new comment and the fix applied to the relative-path branch. If the SDK prepends its own slash, full-URL inputs will still double-slash.</violation>
<violation number="2" location="internal/commands/api.go:215">
P2: `apiBreadcrumbs` patterns all expect a leading `/` (e.g. `HasSuffix(path, "/projects.json")`, regex `/buckets/(\d+)`). Since `parsePath` no longer prepends one for relative paths, breadcrumbs will never match for bare-path inputs like `projects.json` or `buckets/123/todos/456.json`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Pull request overview
Addresses QA-found issues in the basecamp api command and agent help output, with a focus on Windows path handling and consistent help flag curation.
Changes:
- Updates
apicommand examples and path parsing/arg validation to improve Windows compatibility and error messaging. - Introduces shared inherited-flag curation for both text help and
--agent --helpJSON output. - Adds unit tests for
parsePath,apiPathArgs, and agent-help inherited-flag filtering behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/commands/api.go | Updates examples, switches to custom arg validator, and changes parsePath behavior. |
| internal/commands/api_test.go | Adds unit tests for parsePath and apiPathArgs. |
| internal/cli/root.go | Uses curated inherited flags when emitting agent JSON help. |
| internal/cli/help.go | Extracts shared curatedInheritedFlags used by both text and agent help. |
| internal/cli/help_test.go | Adds tests asserting agent help inherited-flag filtering/suppression. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a0e936faf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
parsePath now returns bare paths (no leading slash) for relative inputs, but apiBreadcrumbs patterns expected a leading slash. Normalize the path inside apiBreadcrumbs for pattern matching. Also update breadcrumb Cmd strings to use bare paths matching the new convention.
There was a problem hiding this comment.
💡 Codex Review
basecamp-cli/internal/cli/help.go
Lines 403 to 405 in 682ea48
This root-only filter drops every parent-scoped persistent flag from curatedInheritedFlags, and emitAgentHelp now uses this filtered set directly, so --agent --help can omit valid options entirely because agent help has no equivalent of text-help’s parent-flag promotion into flags. That breaks machine discovery for leaf commands that rely on parent flags (for example, messages list can use parent --message-board from internal/commands/messages.go:37), which now appears in neither flags nor inherited_flags. Fresh evidence: this commit changed emitAgentHelp to call curatedInheritedFlags(cmd) at internal/cli/root.go:731, so the drop now affects agent JSON output directly.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
emitAgentHelp now calls parentScopedFlags to promote non-root inherited flags (e.g. --room on chat subcommands) into the flags section, matching the text help promotion path. Without this, leaf commands lost valid options entirely in --agent --help JSON output. Also assert cmd.Execute() return value in agent help tests.
There was a problem hiding this comment.
Pull request overview
Fixes QA-reported Windows and help-output issues for the basecamp api command by normalizing path handling, improving missing-arg validation, and aligning agent JSON help flag curation with text help.
Changes:
- Updated
apicommand examples andparsePathbehavior to avoid leading-slash MSYS/Git Bash path mangling on Windows. - Added a custom positional-arg validator (
apiPathArgs) so missing args report “path required” (instead of being rewritten to “ID required”). - Refactored inherited-flag filtering into
curatedInheritedFlagsand applied it to agent JSON help; also promotes parent-scoped flags into agent helpflagsto match text help behavior, with tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/commands/api.go | Normalizes API path handling, updates examples, adds apiPathArgs, and fixes breadcrumbs matching for bare paths. |
| internal/commands/api_test.go | Adds unit tests for parsePath and apiPathArgs behavior. |
| internal/cli/help.go | Extracts inherited-flag curation into curatedInheritedFlags for shared use between text and agent help. |
| internal/cli/root.go | Updates agent JSON help to promote parent-scoped flags and use curated inherited flags. |
| internal/cli/help_test.go | Adds tests ensuring agent help filters inherited flags and promotes parent-scoped flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…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)
Summary
Fixes 3 issues found during QA of the
apicommand on Windows (v0.4.1):Leading slash breaks on Windows:
parsePathnow strips a leading slash instead of ensuring one. The SDK'saccountPathandbuildURLboth prepend a slash, so keeping it inparsePathdouble-slashes — and on Windows, MSYS/Git Bash converts/pathtoC:\...\pathbefore Go sees it. All 5 command examples updated to use bare paths (projects.jsonnot/projects.json)."ID required" instead of "path required":
basecamp api get(no args) hit the globaltransformArgErrorwhich rewrites Cobra's generic missing-arg message to "ID required". CustomapiPathArgsvalidator emits "path required" directly.--todolistleaks into agent help:emitAgentHelpdumped all inherited flags unfiltered. ExtractedcuratedInheritedFlagsfromfilterInheritedFlagsso both text and agent help share the same filtering:salientRootFlagsallowlist, root pointer-identity check, and--projectsuppression for<id|url>commands.Card: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9660578055
Test plan
bin/cipasses (lint, unit tests, e2e, surface snapshot, skill drift)bin/basecamp api get --help— examples showprojects.jsonnot/projects.jsonbin/basecamp api get— error says "path required"bin/basecamp api --agent --help | jq .inherited_flags— notodolistbin/basecamp subscriptions show --agent --help | jq .inherited_flags— noprojectbasecamp api get projects.jsonworks without MSYS path mangling