Skip to content

Add --by flag to filter answers by person#444

Draft
robzolkos wants to merge 2 commits into
mainfrom
feature/checkins-answers-by-person
Draft

Add --by flag to filter answers by person#444
robzolkos wants to merge 2 commits into
mainfrom
feature/checkins-answers-by-person

Conversation

@robzolkos

@robzolkos robzolkos commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #443

Adds a --by <person> flag to basecamp checkins answers to filter results to a single person's answers, using the BC3 API's native per-person endpoint (GET /questions/{id}/answers/by/{personId}.json) rather than fetching all answers and filtering client-side.

The flag accepts a person name, email address, numeric ID, or the special value "me" (resolves to the authenticated user):

basecamp checkins answers <question_id> --by me --in <project>
basecamp checkins answers <question_id> --by "Alice Smith" --in <project>
basecamp checkins answers <question_id> --by alice@example.com --in <project>
basecamp checkins answers <question_id> --by 1049715914 --in <project>

All existing flags (--limit, --all, --page) work with --by and apply against the already-filtered result set.

Changes

  • internal/commands/checkins.go--by flag on newCheckinsAnswersCmd; routes to ListAnswersByUser when set
  • internal/commands/checkins_test.goTestCheckinsAnswersByPersonFlag verifying the correct API path is called
  • skills/basecamp/SKILL.md — documented --by usage examples
  • .surface — snapshot updated for the new flag

Dependencies

Depends on basecamp/basecamp-sdk#276 adding ListAnswersByUser to the Go SDK. Once that PR is merged and the SDK is tagged, this PR needs make bump-sdk before merging.


Summary by cubic

Adds a --by flag to basecamp checkins answers to fetch a single person’s answers via the BC3 per-person endpoint. Accepts name, email, numeric ID, or "me", works with pagination, and trims whitespace with validation for blank values.

  • New Features

    • Filter answers by person with --by; uses GET /questions/{id}/answers/by/{personId}.json.
    • Trims whitespace and rejects blank --by values; resolves names/emails to IDs.
    • Docs updated and a test verifies the correct API path.
  • Dependencies

    • Depends on basecamp/basecamp-sdk#276 for ListAnswersByUser. After it’s tagged, run make bump-sdk before merging.

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

Copilot AI review requested due to automatic review settings April 21, 2026 13:58
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) skills Agent skills labels Apr 21, 2026

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

No issues found across 4 files

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

Adds a --by <person> flag to basecamp checkins answers so callers can fetch a single person’s check-in answers via the API’s native per-person endpoint (instead of fetching all answers and filtering client-side).

Changes:

  • Add --by flag to checkins answers and route to ListAnswersByUser when set.
  • Add a command test asserting the per-person answers endpoint path is used.
  • Update skill docs and CLI surface snapshot to reflect the new flag.

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 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/commands/checkins.go Implements --by flag and switches API call to the per-person answers endpoint.
internal/commands/checkins_test.go Adds coverage ensuring the expected per-person API route is invoked.
skills/basecamp/SKILL.md Documents --by usage examples for check-in answers.
.surface Updates snapshot to include the new --by flag in surfaced CLI metadata.

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

Comment thread internal/commands/checkins.go Outdated
Comment thread internal/commands/checkins.go
@robzolkos robzolkos changed the title feat(checkins): add --by flag to filter answers by person Add --by flag to filter answers by person Apr 21, 2026

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

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

<violation number="1" location="internal/commands/checkins.go:607">
P2: Treat explicitly empty `--by` values as invalid; this condition currently misses `--by=` and falls back to the unfiltered endpoint.</violation>
</file>

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

if err != nil {
return convertSDKError(err)
trimmedBy := strings.TrimSpace(by)
if by != "" && trimmedBy == "" {

@cubic-dev-ai cubic-dev-ai Bot Apr 21, 2026

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.

P2: Treat explicitly empty --by values as invalid; this condition currently misses --by= and falls back to the unfiltered endpoint.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/commands/checkins.go, line 607:

<comment>Treat explicitly empty `--by` values as invalid; this condition currently misses `--by=` and falls back to the unfiltered endpoint.</comment>

<file context>
@@ -603,9 +603,14 @@ Use --by to filter answers by a specific person (name, email, ID, or "me"):
 			}
 
+			trimmedBy := strings.TrimSpace(by)
+			if by != "" && trimmedBy == "" {
+				return output.ErrUsage("--by value cannot be blank")
+			}
</file context>
Fix with Cubic

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

Labels

commands CLI command implementations sdk-update-required skills Agent skills tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: basecamp checkins answers --by filter

2 participants