Skip to content

Fix tools create to use the BC5 create-by-type API (#471)#553

Merged
jeremy merged 3 commits into
mainfrom
fix/tools-create
Jul 22, 2026
Merged

Fix tools create to use the BC5 create-by-type API (#471)#553
jeremy merged 3 commits into
mainfrom
fix/tools-create

Conversation

@jeremy

@jeremy jeremy commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

basecamp tools create returned a 404 (#471). It was modeled on the removed account-scoped clone endpoint (POST /dock/tools.json with source_recording_id). bc3's BC5 lineage replaced dock-tool creation with a bucket-scoped create-by-type call: POST /buckets/{bucket_id}/dock/tools.json with {tool_type, title?}.

This is the CLI follow-up to basecamp-sdk#327, which already reshaped the Go SDK to the new contract.

Changes

  • SDK bump to f2086f5e (PR Replace "pending" with "incomplete" in todos output; omit from default view #327 merge, v0.7.4-0.20260722082856-f2086f5e57f6). Pinned explicitly to Replace "pending" with "incomplete" in todos output; omit from default view #327 rather than SDK main, which has since added an uncovered operation (Campfires.UpdateLine) that would trip the completeness bar. ToolsService.Create is now (ctx, bucketID, toolType, *CreateToolOptions).
  • Remove --source/--clone (they only ever 404'd); the removal is recorded in .surface-breaking.
  • Add --type/-t (required), normalized against the CLI's existing dock vocabulary and tolerant of degenerate spellings (message-board, messages, Message::BoardMessage::Board). A single ordered toolTypes slice is the source of truth for normalization, --type shell completion, and the unknown-type error listing — so the three can't drift. Bare board is rejected as ambiguous (message vs kanban).
  • Resolve and send a real destination bucket — the 404 root cause was that --in/--project was breadcrumb-only and never reached the API. New resolveToolBucketID mirrors resolveColumnBucketID (flag > global flag > config > interactive).
  • cobra.MaximumNArgs(1) guards a stray second positional instead of silently dropping it.
  • Fix stale "clone" prose in the parent/create help and agent_notes.

Types accepted

chat, inbox, kanban_board, message_board, questionnaire, schedule, todoset, vault (plus canonical class-names and common aliases).

Testing

  • bin/ci green (fmt/vet/lint, unit + e2e, surface, skill-drift, provenance, tidy).
  • New unit tests cover: --type required (no request issued), unknown-type rejection with ordered friendly list (no request), full 8-type normalization table + board rejection, extra-positional rejection, explicit-project-wins-and-is-sent (asserts /{account}/buckets/{bucket}/dock/tools.json), missing-project, title propagation, happy-path 201, and completion ordering.
  • e2e smoke updated to --type message_board; ensure_messageboard precondition removed (create-by-type must succeed with no preexisting Message Board).

Notes

  • Create-by-type is BC5-only. Against a BC4 account the API rejects it; the error surfaces via convertSDKError. The SDK api-gaps registry tracks the BC4/BC5 split.

Closes #471


Summary by cubic

Fixes basecamp tools create by switching to the BC5 bucket-scoped create-by-type API and sending the resolved project bucket. Adds an ambiguity-specific error for --type board, and derives --type help and agent notes from the same type table used for validation.

  • Bug Fixes

    • Use POST /buckets/{bucket_id}/dock/tools.json with {tool_type, title?}; resolve the bucket from --project/flags/config and send it.
    • Validate unknown types with a friendly, ordered list; reject extra positionals; help and agent notes list accepted types from the same table used for validation and --type completion.
    • Treat --type board as ambiguous and prompt to use message_board or kanban_board.
    • Bump github.com/basecamp/basecamp-sdk/go to include create-by-type support (ToolsService.Create(ctx, bucketID, toolType, opts)); update API-COVERAGE.md to add the dock_tools row and reflect the BC5 create-by-type reshape.
  • Migration

    • Replace --source/--clone with required --type/-t. Accepted: chat, inbox, kanban_board, message_board, questionnaire, schedule, todoset, vault.
    • Ensure a project is set via -p/--project, global flag, or config. Create-by-type is BC5-only (BC4 will error).

Written for commit fd3835e. Summary will update on new commits.

Review in cubic

`basecamp tools create` 404'd: it was modeled on the removed account-scoped
clone endpoint (`POST /dock/tools.json` with `source_recording_id`). bc3's
BC5 lineage replaced dock-tool creation with a bucket-scoped create-by-type
call, `POST /buckets/{bucket_id}/dock/tools.json` with `{tool_type, title?}`.

- Bump the SDK to f2086f5e (basecamp-sdk#327), which reshapes ToolsService.Create
  to (bucketID, toolType, *CreateToolOptions) and posts to the bucket dock.
- Remove `--source`/`--clone` (they only ever 404'd); record the removal in
  `.surface-breaking`.
- Add `--type`/`-t` (required), normalized against the CLI's existing dock
  vocabulary and tolerant of degenerate spellings. A single ordered `toolTypes`
  slice is the source of truth for normalization, `--type` completion, and the
  unknown-type error listing. `board` is rejected as ambiguous.
- Resolve and send a real destination bucket (the 404 root cause: `--in` was
  breadcrumb-only). New `resolveToolBucketID` mirrors `resolveColumnBucketID`.
- Guard a stray second positional with `cobra.MaximumNArgs(1)`.
- Fix stale "clone" prose in the parent and create help and agent_notes.

Create-by-type is BC5-only; against BC4 the API rejects it and the error
surfaces via convertSDKError.

Closes #471
Copilot AI review requested due to automatic review settings July 22, 2026 09:25
@github-actions github-actions Bot added commands CLI command implementations sdk SDK wrapper and provenance tests Tests (unit and e2e) deps breaking Breaking change bug Something isn't working labels Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

⚠️ Potential breaking changes detected:

  • The tools create command changed from requiring --source or --clone to requiring --type. This removes support for the previous method of creating tools by cloning an existing tool, which may break scripts or workflows depending on the old flags.
  • The --source and --clone flags have been removed from the tools create command, representing a breaking change for users depending on these flags.
  • The new required --type flag changes the behavior of the tools create command. Scripts not updated to include this flag will fail.
  • Errors related to invalid --type values now return detailed error messages, which could alter the output format scripts are parsing.
  • The help text, usage descriptions, and error messages for the tools create command have changed, which may impact automated help parsing or expectations.

Review carefully before merging. Consider a major version bump.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes basecamp tools create (previously returning 404) by switching from the removed account-scoped clone endpoint to the BC5 bucket-scoped create-by-type API, and ensuring the resolved project bucket ID is actually sent to the SDK/API.

Changes:

  • Update tools create to require --type/-t, normalize accepted type spellings, and call ToolsService.Create(ctx, bucketID, toolType, opts) against /buckets/{bucket_id}/dock/tools.json.
  • Resolve a real destination bucket ID (flag > global flag > config > interactive), and reject extra positionals via cobra.MaximumNArgs(1).
  • Update unit/e2e coverage and CLI surface artifacts to reflect the flag contract change; bump the SDK revision + provenance.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/version/sdk-provenance.json Records the bumped SDK revision and updated API sync metadata.
internal/commands/tools.go Implements create-by-type with type normalization + real bucket resolution.
internal/commands/tools_test.go Adds targeted unit tests for type validation, normalization, bucket selection, request shape, and completion ordering.
go.mod Bumps github.com/basecamp/basecamp-sdk/go to the revision that supports create-by-type.
go.sum Updates module checksums for the SDK bump.
e2e/smoke/smoke_tools.bats Updates smoke test to use --type message_board and removes clone precondition.
.surface-breaking Records removal of --source/--clone as breaking surface changes.
.surface Updates the CLI surface snapshot to remove --source/--clone and add --type.

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

Comment thread internal/commands/tools.go
@jeremy jeremy added this to the v0.8.0 milestone Jul 22, 2026
Bare "board" (and separator variants) is intentionally rejected — it's
ambiguous between message_board and kanban_board. Report that specifically
instead of the generic "Unknown --type" wording, while still listing the
accepted values. Addresses Copilot review feedback on #553.
Copilot AI review requested due to automatic review settings July 22, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread internal/commands/tools.go Outdated
Comment thread internal/commands/tools.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e42b77d66

ℹ️ 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".

Comment thread internal/version/sdk-provenance.json

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread internal/commands/tools.go Outdated
- Build the create --type help text and the parent agent_notes accepted-type
  list from toolTypeFriendlyNames() instead of hard-coding them, so help stays
  in sync with validation and completion (Copilot + cubic review feedback).
- API-COVERAGE.md: correct the stale "v0.7.3 / no new methods" line to reflect
  the f2086f5e bump and the BC5 create-by-type reshape, and add the previously
  uncounted dock_tools row (Codex P2 feedback).
Copilot AI review requested due to automatic review settings July 22, 2026 09:51
@github-actions github-actions Bot added the docs label Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

@jeremy
jeremy merged commit edf63e5 into main Jul 22, 2026
27 checks passed
@jeremy
jeremy deleted the fix/tools-create branch July 22, 2026 09:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd3835e9a2

ℹ️ 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".

Comment thread API-COVERAGE.md
| todolists | 8 | `todolists` | ✅ | BC4 | - | list, show, create, update |
| todosets | 3 | `todosets` | ✅ | BC4 | - | Container for todolists, accessed via project dock (BC5: `todos_count`, `completed_loose_todos_count`, `todos_url`, `app_todos_url`) |
| todolist_groups | 8 | `todolistgroups` | ✅ | BC4 | - | list, show, create, update, position |
| dock_tools | 7 | `tools` | ✅ | BC4 | - | Dock tool management: show, update, trash, enable, disable, reposition. `create` is BC5-only (create-by-type: `POST /buckets/{id}/dock/tools.json`), replacing the removed clone call |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Split the BC5 tools create coverage row

The coverage guide above says BC5 endpoints added to an existing BC4 section should be split into a separate BC5 row, but this new dock_tools row counts all 7 endpoints as BC4 while also noting that create is BC5-only. That makes the BC4/BC5 parity matrix ambiguous because the BC4 row now includes a BC5-only endpoint; please split create-by-type into a BC5 dock_tools row or keep the BC4 count limited to the BC4 endpoints.

Useful? React with 👍 / 👎.


cmd.Flags().StringVarP(&sourceID, "source", "s", "", "Source tool ID to clone (required)")
cmd.Flags().StringVar(&sourceID, "clone", "", "Source tool ID (alias for --source)")
cmd.Flags().StringVarP(&toolType, "type", "t", "", "Tool type to create (required)")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update the Basecamp skill for the new tool flag

Adding required --type and removing --source/--clone changes the command surface, but skills/basecamp/SKILL.md was not updated and still advertises Full CLI coverage: 155 endpoints with no tools-create guidance. Agents that rely on the skill can keep using stale coverage/syntax after this change; update the skill alongside the surface change.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change bug Something isn't working commands CLI command implementations deps docs sdk SDK wrapper and provenance tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools create returns a 404 instead of creating a new tool in the project

2 participants