feat: add agent sandbox variable commands#7
Merged
Conversation
Wire up the public /v1 sandbox environment variable endpoints added on the backend (GET/PUT/DELETE /v1/sandboxes/variables): agent sandbox variable list # GET — names + timestamps (values write-only) agent sandbox variable set K V # PUT — single upsert agent sandbox variable set --from-file .env # PUT — batch from a .env file agent sandbox variable rm K # DELETE These are customer-scoped variables an agent pulls into its sandbox when its config names them. Values are write-only — the API never returns them, so list output shows only names + timestamps. Name validation is left to the server (one source of truth). Adds ApiClient methods, typed request/response mirrors, a .env parser with tests, and README usage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Change `sandbox variable set` to take variadic `KEY=VALUE` arguments (`set A=1 B=2`) instead of a single space-separated name/value pair, and allow combining inline pairs with `--from-file` (file first, inline overrides). Factor the shared `KEY=VALUE` parsing into `parseAssignment`, reused by both the inline args and the .env file parser. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`--from-file` now picks the format by extension: a `.json` file is parsed as a flat object of name → value, anything else stays .env-style KEY=VALUE. JSON values must be strings — a nested object, array, or non-string value is rejected rather than silently coerced. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts: # src/cli.tsx # src/lib/api.ts # test/api.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
agent sandbox variablecommands that drive the public/v1sandbox environment variable endpoints (GET/PUT/DELETE /v1/sandboxes/variables) shipped on the backend.Why
These are customer-scoped variables an agent pulls into its sandbox when its config names them (
sandbox.variables) — the way a config brings in the credentials/config a custom CLI needs. Until now they could only be managed from the dashboard; this exposes them to scripts and the CLI.Notes
list(and the echo after a mutation) shows onlyNAME / CREATED / UPDATED. Thesetconfirmation says(values hidden).^[A-Za-z_][A-Za-z0-9_]*$, 500-var cap). The CLI surfaces the server'sdetailmessage via the existingApiErrorpath.--from-fileparses a.env-style file (KEY=VALUE,#comments, optionalexport, quote stripping, split on first=).ApiClientmethods + typed request/response mirrors of the backend models;.envparser unit-tested; README usage updated.Test plan
bun run typecheck✓bun run test— 62 passing (3 new API-client cases, 6parseEnvFilecases) ✓bun run build✓agent --version✓agent sandbox variable --helprenders the command tree🤖 Generated with Claude Code