Skip to content

Add personal access token commands#157

Merged
robzolkos merged 5 commits into
masterfrom
add-token-commands
Apr 30, 2026
Merged

Add personal access token commands#157
robzolkos merged 5 commits into
masterfrom
add-token-commands

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented Apr 29, 2026

Summary

  • Adds fizzy token list|create|delete backed by AccessTokensService on the root SDK client.
  • Closes the last gap in CLI coverage of the SDK methods that ship in v0.1.2/v0.1.3 — CreateAccessToken, ListAccessTokens, and DeleteAccessToken previously had no command surface.
  • Adds an e2e CRUD test mirroring the webhook pattern and regenerates SURFACE.txt.

Notes

  • Create returns the raw token value once; the command surfaces a notice that it won't be shown again.
  • permission is passed through as a free string (the spec doesn't constrain it to an enum).

Summary by cubic

Adds fizzy token list|create|delete to manage personal access tokens from the CLI using the root AccessTokensService (no account needed). Improves command discoverability and help, and adds e2e CRUD coverage.

  • New Features

    • Create: requires --description and --permission; returns the raw token once with a save notice.
    • List: shows ID, description, permission, and created columns.
    • Delete: removes a token by ID and returns {deleted: true, id}.
    • Discoverability/help: token appears in the command catalog and root help; ls/rm aliases supported.
  • Bug Fixes

    • Auth scope: use requireAuth + requireSDK to match the root /my/access_tokens endpoint (no account required).
    • Validation and UX: list/create reject positional args; delete requires an ID and the breadcrumb is gated on a non-empty id; add token to CORE in root help; register e2e cleanup earlier to avoid stranded tokens.

Written for commit f73886c. Summary will update on new commits. Review in cubic

Copilot AI review requested due to automatic review settings April 29, 2026 20:27
@github-actions github-actions Bot added the enhancement New feature or request label Apr 29, 2026
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.

2 issues found across 4 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="e2e/cli_tests/token_test.go">

<violation number="1" location="e2e/cli_tests/token_test.go:19">
P2: Register cleanup before assertions that can `t.Fatal` after resource creation, otherwise a failing token-value check can skip deletion of the created token.</violation>
</file>

<file name="internal/commands/token.go">

<violation number="1" location="internal/commands/token.go:21">
P2: `token` subcommands incorrectly require an account for root-client access token APIs; this can fail for valid authenticated users without a configured profile/account.</violation>
</file>

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

Comment thread e2e/cli_tests/token_test.go Outdated
Comment thread internal/commands/token.go Outdated
Copy link
Copy Markdown
Contributor

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 CLI support for managing personal access tokens (fizzy token list|create|delete) backed by the root SDK client’s AccessTokensService, plus an e2e CRUD test and regenerated command surface docs.

Changes:

  • Introduces token root command with list, create, and delete subcommands.
  • Adds token table column definitions for human-readable list output.
  • Adds an e2e CRUD test for tokens and updates SURFACE.txt accordingly.

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/token.go Adds fizzy token command implementation (list/create/delete) using the SDK AccessTokens service.
internal/commands/columns.go Adds tokenColumns for rendering token lists in styled/markdown outputs.
e2e/cli_tests/token_test.go Adds end-to-end CRUD coverage for token commands.
SURFACE.txt Regenerates command/flag surface to include the new token commands.

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

Comment thread internal/commands/token.go
Comment thread internal/commands/token.go
Adds `fizzy token list|create|delete` backed by AccessTokensService on
the root SDK client. Covers the three SDK methods that previously had no
CLI surface (CreateAccessToken, ListAccessTokens, DeleteAccessToken).

Includes an e2e CRUD test mirroring the webhook pattern, and the
regenerated SURFACE.txt snapshot.
- Use requireAuth + requireSDK instead of requireAuthAndAccount: the
  /my/access_tokens endpoint is on the root SDK client (not
  account-scoped), so requiring an account blocks valid users who
  haven't selected one (matches the pattern used by `identity show`).
- Gate the "delete" breadcrumb on a non-empty id so we don't render
  `fizzy token delete ` when the API response has no id.
- E2e: register the cleanup hook before the second t.Fatal check so a
  missing-token-value failure can't strand the created token.
Copilot AI review requested due to automatic review settings April 30, 2026 01:25
@robzolkos robzolkos force-pushed the add-token-commands branch from 2c5d971 to 9b86152 Compare April 30, 2026 01:25
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread internal/commands/token.go
Copilot AI review requested due to automatic review settings April 30, 2026 02:04
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread internal/commands/token.go
Comment thread internal/commands/token.go
Comment thread e2e/cli_tests/token_test.go Outdated
@robzolkos robzolkos merged commit b15efd1 into master Apr 30, 2026
20 checks passed
@robzolkos robzolkos deleted the add-token-commands branch April 30, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants