Skip to content

Add --assignee flag to card creation#300

Merged
jeremy merged 5 commits intomainfrom
bc-9664042852
Mar 16, 2026
Merged

Add --assignee flag to card creation#300
jeremy merged 5 commits intomainfrom
bc-9664042852

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 15, 2026

Summary

  • Add --assignee and --to flags to basecamp card and basecamp cards create for assigning a person during card creation
  • Extract resolveAssigneeID helper that accepts numeric IDs or names, rejects non-positive IDs
  • Post-create Cards().Update() assigns the person (SDK's CreateCardRequest lacks AssigneeIDs)
  • Pre-resolve assignee before creation to fail early on bad input
  • Assignment failure preserves structured SDK error metadata (code/hint/retryable) while noting the card was already created
  • Refactor cards update to use the shared resolveAssigneeID helper

Test plan

  • TestCardsCreateHasAssigneeFlag — flag presence on cards create
  • TestCardShortcutHasAssigneeFlag — flag presence on card
  • TestCardsCreateWithAssigneeSendsUpdate — mock transport verifies create→update flow sends assignee_ids and output includes assignee
  • TestResolveAssigneeIDRejectsZero — zero ID rejected
  • TestResolveAssigneeIDRejectsNegative — negative ID rejected
  • TestResolveAssigneeIDAcceptsPositive — positive ID accepted
  • bin/ci passes (lint, vet, unit tests, e2e, surface snapshot, skill drift, bare groups)

Summary by cubic

Add --assignee/--to to basecamp card and basecamp cards create to assign a person at creation. The assignee is resolved before content processing and applied via a post-create Cards().Update().

  • New Features

    • --assignee/--to on basecamp card and basecamp cards create (accepts ID or name).
    • People name autocompletion for assignee flags.
  • Bug Fixes

    • Guard with Flags().Changed to catch explicit empty --assignee/--to; trim input and require resolved IDs > 0 in resolveAssigneeID.
    • Resolve assignee before content/attachment pipeline to fail fast without side effects.
    • Save card ID before Update() to avoid nil-pointer on assignment failure.
    • Centralize validation: cards update and resolveAssigneeIDs delegate to resolveAssigneeID; cards update no-changes check uses Flags().Changed("assignee") so empty values are validated.
    • Preserve structured SDK error metadata on assignment failure and wrap fallback errors for consistent CLI formatting; report the card was created.

Written for commit 458eeac. Summary will update on new commits.

@jeremy jeremy requested a review from a team as a code owner March 15, 2026 19:46
Copilot AI review requested due to automatic review settings March 15, 2026 19:46
@github-actions github-actions bot added commands CLI command implementations tests Tests (unit and e2e) enhancement New feature or request labels Mar 15, 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

Adds assignee support when creating cards via both basecamp cards create and the basecamp card shortcut, including flag aliases, completion, and tests.

Changes:

  • Introduces --assignee and --to (alias) flags for card creation commands, with pre-resolution of assignee input.
  • Performs a follow-up card update to set assignee_ids after card creation (and improves failure messaging on partial success).
  • Adds unit/integration-style tests and updates the CLI surface snapshot for the new flags.

Reviewed changes

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

File Description
internal/commands/cards.go Adds assignee flag handling, ID/name resolution helper, and post-create assignment update logic.
internal/commands/cards_test.go Adds tests for new flags, resolution validation, and that assignment triggers an update request.
.surface Updates CLI surface snapshot to include the new flags on relevant commands.

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

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 3 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/cards.go">

<violation number="1" location="internal/commands/cards.go:424">
P1: Nil pointer dereference: `card` is reassigned by `Update()`, so if it returns `(nil, err)`, accessing `card.ID` in the error path panics. Save the card ID before the `Update` call. This same bug exists in both `newCardsCreateCmd` and `NewCardCmd`.</violation>
</file>

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

Copy link
Copy Markdown

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

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: 9528348cb1

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

Copilot AI review requested due to automatic review settings March 15, 2026 21:48
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

Adds assignee support to card creation flows in the Basecamp CLI, allowing users to specify an assignee by ID or name during cards create and the card shortcut.

Changes:

  • Introduces resolveAssigneeID helper and reuses it across card update/assignee parsing.
  • Adds --assignee (and --to alias) to cards create and card shortcut, implementing a post-create assignment update call.
  • Extends command tests and updates .surface to reflect the new flags.

Reviewed changes

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

File Description
internal/commands/cards.go Adds assignee resolution helper, new --assignee/--to flags for create/shortcut, and assignment-on-create behavior.
internal/commands/cards_test.go Adds tests for new flags, assignment-on-create request behavior, and resolveAssigneeID validation.
.surface Updates surface snapshot with new flags for card and cards create.

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

Copilot AI review requested due to automatic review settings March 16, 2026 01:20
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

Adds first-class assignee support to card creation commands, including early validation/name resolution and shell completion, with accompanying surface snapshot and tests.

Changes:

  • Introduces resolveAssigneeID helper to validate/resolve assignees (ID or person name).
  • Adds --assignee (and --to alias) to cards create and card (shortcut) and performs a post-create update to apply the assignment.
  • Updates .surface and adds tests covering flag presence, assignment update behavior, and assignee ID validation.

Reviewed changes

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

File Description
internal/commands/cards.go Adds assignee resolution helper and wires --assignee/--to into card create flows (plus reuse in assignee list parsing).
internal/commands/cards_test.go Adds tests for new flags and verifies assignment triggers an update request; adds validation tests for assignee IDs.
.surface Records new public CLI flags for surface snapshot testing.

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

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 1 file (changes from recent commits).

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/cards.go">

<violation number="1" location="internal/commands/cards.go:555">
P2: The no-changes guard at line 527 still checks `assignee == ""`, which short-circuits before the new `cmd.Flags().Changed("assignee")` check can run. When only `--assignee ""` is passed, the user gets a confusing "no changes specified" error instead of "Assignee cannot be empty". Update the guard to also consider `cmd.Flags().Changed("assignee")`.</violation>
</file>

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

jeremy added 3 commits March 15, 2026 18:48
Support assigning a person during card creation via --assignee/--to
flags on both `basecamp card` and `basecamp cards create`. Since the
SDK's CreateCardRequest lacks AssigneeIDs, assignment is a post-create
Cards().Update() call. The assignee is pre-resolved before creation to
fail early on bad input, and the error on update failure preserves
structured SDK error metadata (code/hint/retryable) while noting the
card was already created.

Extract resolveAssigneeID helper (rejects non-positive IDs) and refactor
the inline resolve in cards update to use it.
- Save card ID before Update() call to prevent nil-pointer dereference
  on assignment failure (cubic, codex)
- TrimSpace flag input in resolveAssigneeID (copilot)
- Validate resolved ID > 0 after ResolvePerson (copilot)
- Refactor resolveAssigneeIDs (plural) to delegate to resolveAssigneeID
  so validation logic stays in one place (copilot)
Copilot AI review requested due to automatic review settings March 16, 2026 01:50
- Assignment failure fallback now wraps sdkErr (not raw err) for
  consistent CLI error formatting
- Update command's noChanges guard uses Flags().Changed("assignee")
  so --assignee "" reaches resolveAssigneeID validation
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

Adds first-class assignee support when creating cards (both basecamp cards create and the basecamp card shortcut) by introducing --assignee (and --to alias), validating/normalizing assignee input, and exercising the behavior in tests.

Changes:

  • Add --assignee and --to flags for card creation, plus shell completion for people names.
  • Introduce resolveAssigneeID helper and reuse it for step assignee resolution and card update assignee parsing.
  • Add tests covering the new flags and the “create then assign via update” request flow; update .surface for the new flags.

Reviewed changes

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

File Description
internal/commands/cards.go Adds assignee flags + helper resolver; performs post-create assignment via an update call; reuses resolver in other assignee parsing paths.
internal/commands/cards_test.go Adds tests for flag presence, request behavior (PUT with assignee_ids), and resolveAssigneeID validation.
.surface Records the newly added CLI flags for basecamp card and basecamp cards create.

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

Copy link
Copy Markdown

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

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: 98a26cba75

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

Resolve assignee before resolveLocalImages (which uploads attachments)
so a bad --assignee fails before any uploads happen.
@jeremy jeremy merged commit 7e08489 into main Mar 16, 2026
26 checks passed
@jeremy jeremy deleted the bc-9664042852 branch March 16, 2026 02:07
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