Skip to content

feat(cli): expose review and comment commands - #326

Merged
gregberge merged 10 commits into
mainfrom
feat/cli-review-comment-commands
Jun 28, 2026
Merged

gregberge merged 10 commits into
mainfrom
feat/cli-review-comment-commands

Conversation

@gregberge

Copy link
Copy Markdown
Member

What

Brings the @argos-ci/cli up to date with the review + commenting surface exposed in the v2 REST API (argos-ci/argos#2287), and refactors the build-scoped commands into a generic, low-maintenance structure.

New commands (all 14 newly-exposed endpoints)

  • Reviews — argos review list|create|dismiss
  • Comments — argos comment list|create|get|edit|delete|resolve|unresolve|react|unreact|subscribe|unsubscribe

review create uses --event approve|reject|comment with an optional Markdown --body/--body-file. comment create supports --reply-to, --diff + --anchor-point/--anchor-lines, and --draft (attach to a pending review).

Refactor

One file per command under src/commands/{build,review,comment}/, with shared logic in src/lib/:

  • build-reference / project — reference & slug parsing
  • anchor / body — option parsing for comments
  • api — client factory + unwrap (surfaces HTTP <status> even on bodyless error responses)
  • target — build-target resolution with two auth modes (project token for build reads; personal access token for review/comment actions)
  • run — the command runner, error handling, and JSON/text output
  • format — pure formatters

Adding a future endpoint is now a ~15-line file. The typed openapi-fetch client guarantees request shapes at compile time.

Auth model

  • build get / build snapshots — project token (ARGOS_TOKEN/--token), project resolved from /project when not given.
  • review * / comment * — personal access token (--token / ARGOS_TOKEN / argos login); project from the build URL or --project.

Breaking change

argos build review --conclusion <approve|request-changes> → argos review create --event <approve|reject|comment> [--body].

Also

  • Regenerate api-client schema.ts from the v2 spec; remove the unused legacy api.ts.
  • Slim the argos-cli and argos-pr-review skills; the PR-review skill now frames posting specific, anchored comments as the highest-value output of an agent review.
  • Vendor the skill-creator dev skill (used to review the project's skills).

Testing

  • 44 new unit tests on the shared utils (pnpm --filter @argos-ci/cli test).
  • New review/comment e2e suites (run in CI with live tokens).
  • Verified: typecheck, lint, prettier, unit tests, error-path smoke tests, and a repo-wide turbo typecheck (core/gitlab/cli). An adversarial review cross-checked all 16 endpoint calls against the schema.

🤖 Generated with Claude Code

gregberge and others added 4 commits June 28, 2026 18:12
Regenerate schema.ts from the v2 OpenAPI spec, adding the review and
comment endpoints exposed in argos-ci/argos#2287. Remove the unused
legacy swagger-generated api.ts, which nothing imports.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add CLI coverage for the review and commenting surface exposed in the v2
REST API (argos-ci/argos#2287):

- argos review list|create|dismiss
- argos comment list|create|get|edit|delete|resolve|unresolve|react|unreact|subscribe|unsubscribe

Refactor build-scoped commands into a generic, low-maintenance structure:
one file per command under commands/{build,review,comment}/, with shared
helpers in src/lib/ (build-reference parsing, project-path parsing,
anchor/body resolution, the API client + unwrap, build-target auth
resolution, the command runner, and pure formatters). Adding a new
endpoint is now a ~15-line file. Includes 44 unit tests for the shared
utils and review/comment e2e suites.

BREAKING CHANGE: argos build review --conclusion <approve|request-changes>
is replaced by argos review create --event <approve|reject|comment> [--body].

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Trim both skills to the minimum an agent needs. argos-cli defers flag
detail to `argos --help` and keeps only the token model and command map
(its stale per-command references are removed). argos-pr-review becomes a
tight overview plus an efficient review workflow, and now frames posting
specific, anchored comments as the highest-value output of an agent
review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Vendor the skill-creator skill (from anthropics/skills) used to author
and review the project's agent skills, tracked via skills-lock.json.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
argos-js-sdk-reference Ready Ready Preview, Comment Jun 28, 2026 7:46pm

Request Review

gregberge and others added 2 commits June 28, 2026 18:18
Convert every file under packages/cli/e2e from .js to .ts, including the
shared utils, which now export a typed run() and a CommandError class so
failure assertions get real types under strict mode.

Fix the failing "requires a body to create a comment" test: it passed a
build number without --project, so the command failed on project
resolution ("--project is required") before reaching the body check. Use
the build URL (which carries the project) so resolution succeeds and the
"A comment body is required" validation is exercised.

Update the e2e-oidc/e2e-tokenless scripts and the vitest include glob to
the .ts paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gregberge and others added 3 commits June 28, 2026 21:30
Deep links like `.../builds/5014/347549006` (build number followed by a
diff id, query, or hash) failed to parse because the URL regexp required
the build number to be the last path segment. Treat anything after the
build number as ignorable so any URL matching `.../builds/<number>`
resolves to that build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Project-auth commands (e.g. `argos build get`) only looked at `--token`
and `ARGOS_TOKEN`, so a user logged in via `argos login` got "No Argos
project token found" even with a valid personal access token on disk.
Fall back to the stored token, requiring an explicit one only when none
is configured. The project and user token resolvers are now identical, so
merge them into a single `resolveToken`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Each command lives in its own file, but `login.ts` defined both `login`
and `logout`. Extract `logout` into `commands/logout.ts` and register it
from the entrypoint. No behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The token resolver now emits a single "No Argos token found" message for
both project- and user-auth commands; the build e2e tests still asserted
the old "No Argos project token found" text.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gregberge
gregberge merged commit 78acd1a into main Jun 28, 2026
68 checks passed
@gregberge
gregberge deleted the feat/cli-review-comment-commands branch June 28, 2026 19:55

This branch was successfully deployed

1 active deployment
Preview — 37a0d0ac Deployed Jun 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant