Skip to content

feat(cli): add projects, runs and env set commands - #4934

Closed
claude[bot] wants to merge 1 commit into
mainfrom
claude/cli-projects-runs-env-commands
Closed

claude[bot] wants to merge 1 commit into
mainfrom
claude/cli-projects-runs-env-commands

Conversation

@claude

@claude claude Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

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|cancel and trigger env set are available. runs list prints a table of ID, task, status, version, created time and duration with --limit, --status, --task, --tag and --cursor filters; runs get prints one run's timings, cost and error. projects delete confirms interactively and takes -y/--yes to skip that (and refuses to run in a non-TTY without it). env set NAME VALUE creates the variable or overwrites it, with --secret for values that shouldn't be readable back.

How: This is CLI-package-only — no new endpoints and no server changes. projects commands go through the existing PAT-scoped CliApiClient; two client methods were added for the already-implemented PATCH (rename) and DELETE (soft delete) on /api/v1/projects/:projectRef. runs commands use the core ApiClient's existing listRuns/retrieveRun/replayRun/cancelRun rather than duplicating those endpoints onto CliApiClient; a new getProjectEnvApiClient helper in utilities/session.ts builds that client on top of the existing getProjectClient (PAT → project env → environment secret key), which is the same auth path env list already uses. Every command follows the neighbouring commands' commonOptions + zod options schema + wrapCommandAction shape and the existing logger.table / clack intro/outro output style; no --json flag was added.

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

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-existing lefthook configuration hint is unchanged on main).
  • pnpm --filter trigger.dev test -- --run — 19 files, 213 tests passing.
  • Ran --help against the built CLI for projects, projects create|get|rename|delete, runs, runs list|get|replay|cancel, env and env set to confirm every command registers and every flag appears.
  • Not exercised against a live server: the commands were not run end-to-end against a webapp instance, so a maintainer may want to smoke-test them against local dev.

Changelog

New CLI commands: projects create/get/rename/delete, runs list/get/replay/cancel, and env set.

Notes for review:

  • Replay, not "replace". The request said runs replace; there is no replace operation, but there is a replayRun endpoint, so the command is named replay. Nothing was dropped — all nine requested subcommands are implemented, since every endpoint they need already exists.
  • env set <name> <value>, not NAME=VALUE. Chosen to match env get <name>, which already takes a bare name.
  • Upsert via the import endpoint. env set posts to /envvars/:slug/import with override: true, which is the only true upsert available — createEnvVar fails on an existing key and updateEnvVar fails on a missing one. deploy already uses the same endpoint the same way.
  • Explicit refs for projects get|rename|delete. These take the project ref as a positional argument rather than falling back to trigger.config.ts, so a destructive command can never act on an implicitly-resolved project. runs and env set do use the config file, matching env list.
  • Changeset is patch. AGENTS.md says minor needs maintainer confirmation, which this PR does not have; these are new features, so you may want to bump it.
  • Docs cover only the new commands. projects list and env list/get/pull were already undocumented, and this PR does not change that; docs/cli-env-commands.mdx is therefore scoped to env 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

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

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: a4fbb85f-5b95-45b4-8462-e04cff520d0b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f28bf5d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
trigger.dev Patch
@internal/dashboard-agent Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@trigger.dev/python Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/sdk Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
@trigger.dev/rbac Patch
@trigger.dev/sso Patch
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@internal/metrics-pipeline Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/run-store Patch
@internal/schedule-engine Patch
@internal/tracing Patch
@internal/webhook-engine Patch
@internal/webhook-sources Patch
@internal/testcontainers Patch
@internal/cache Patch

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

@claude

claude Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review


Generated by Claude Code

@claude

claude Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

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

@claude claude Bot closed this Sep 15, 2026
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