feat(cli): add projects, runs and env set commands - #4934
claude[bot] wants to merge 1 commit into
Conversation
Adds `projects create/get/rename/delete`, `runs list/get/replay/cancel` and `env set` to the CLI, all on top of endpoints that already exist. `projects` uses the personal access token client. `runs` uses the core `ApiClient` scoped to the project environment's secret key, via a new `getProjectEnvApiClient` helper that builds on `getProjectClient`. `env set` upserts through the env var import endpoint with `override: true`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018FdBUQs2td6uAPB4KGQxFB
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🦋 Changeset detectedLatest commit: f28bf5d The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@coderabbitai review Generated by Claude Code |
|
Moved to the private monorepo: triggerdotdev/chonk#203. This change belongs there, so it is being tracked in that PR instead and this one is closed. Generated by Claude Code |
Requested by Chris Arderne · Slack thread
Before: The CLI could only list projects (
trigger projects list) and read environment variables (env list/get/pull). Creating a project, renaming or deleting one, looking at runs, replaying a failed run, cancelling a run, or setting an environment variable all meant leaving the terminal for the dashboard — even though the API endpoints for all of it already exist and the MCP server already drives several of them.After:
trigger projects create|get|rename|delete,trigger runs list|get|replay|cancelandtrigger env setare available.runs listprints a table of ID, task, status, version, created time and duration with--limit,--status,--task,--tagand--cursorfilters;runs getprints one run's timings, cost and error.projects deleteconfirms interactively and takes-y/--yesto skip that (and refuses to run in a non-TTY without it).env set NAME VALUEcreates the variable or overwrites it, with--secretfor values that shouldn't be readable back.How: This is CLI-package-only — no new endpoints and no server changes.
projectscommands go through the existing PAT-scopedCliApiClient; two client methods were added for the already-implementedPATCH(rename) andDELETE(soft delete) on/api/v1/projects/:projectRef.runscommands use the coreApiClient's existinglistRuns/retrieveRun/replayRun/cancelRunrather than duplicating those endpoints ontoCliApiClient; a newgetProjectEnvApiClienthelper inutilities/session.tsbuilds that client on top of the existinggetProjectClient(PAT → project env → environment secret key), which is the same auth pathenv listalready uses. Every command follows the neighbouring commands'commonOptions+ zod options schema +wrapCommandActionshape and the existinglogger.table/ clackintro/outrooutput style; no--jsonflag was added.✅ Checklist
Testing
pnpm run build --filter trigger.dev— passes.pnpm run format,pnpm run lint:fix,pnpm run lint— clean; formatting touched only the new files.pnpm run knip— no new findings (the one pre-existinglefthookconfiguration hint is unchanged onmain).pnpm --filter trigger.dev test -- --run— 19 files, 213 tests passing.--helpagainst the built CLI forprojects,projects create|get|rename|delete,runs,runs list|get|replay|cancel,envandenv setto confirm every command registers and every flag appears.Changelog
New CLI commands:
projects create/get/rename/delete,runs list/get/replay/cancel, andenv set.Notes for review:
runs replace; there is no replace operation, but there is areplayRunendpoint, so the command is namedreplay. Nothing was dropped — all nine requested subcommands are implemented, since every endpoint they need already exists.env set <name> <value>, notNAME=VALUE. Chosen to matchenv get <name>, which already takes a bare name.env setposts to/envvars/:slug/importwithoverride: true, which is the only true upsert available —createEnvVarfails on an existing key andupdateEnvVarfails on a missing one.deployalready uses the same endpoint the same way.projects get|rename|delete. These take the project ref as a positional argument rather than falling back totrigger.config.ts, so a destructive command can never act on an implicitly-resolved project.runsandenv setdo use the config file, matchingenv list.patch. AGENTS.md saysminorneeds maintainer confirmation, which this PR does not have; these are new features, so you may want to bump it.projects listandenv list/get/pullwere already undocumented, and this PR does not change that;docs/cli-env-commands.mdxis therefore scoped toenv set. Happy to fill in the rest of the group in a follow-up.Screenshots
n/a — terminal output only.
💯
🤖 Generated with Claude Code
https://claude.ai/code/session_018FdBUQs2td6uAPB4KGQxFB
Generated by Claude Code