fix(cli): CLI-MCP-8/9/11 — --env passthrough, deploy stub label, resource unauth exit 3#17
Merged
Merged
Conversation
…urce unauth exit 3
Closes three CLI gaps surfaced by BugBash QA round 2 (see backlog
`fix/cli-hygiene-env-passthrough`):
CLI-MCP-8 — all seven provisioning verbs (db / cache / nosql / queue /
storage / webhook / vector) now accept `--env <name>`. Empty == server
default (development, CLAUDE.md rule 11); a non-empty value is forwarded
verbatim in the request body. The human output surfaces the resolved env
plus, when present, the server's env_override_reason so a downgrade
(e.g. anon caller asking for production demoted to development) is
visible.
CLI-MCP-9 — `instant deploy` parent cobra.Short is now explicitly
labeled as a stub and points at the canonical alternative
(MCP `create_deploy` / POST /deploy/new) so the root command list row
carries the pointer.
CLI-MCP-11 — `instant resource <token>` and `instant resource delete
<token>` short-circuit with errAuthRequired (exit 3) when the caller is
unauthenticated, BEFORE any side effects. Matches the contract that
`instant resources` (list) already honors. Tests updated to set up auth
where they previously relied on the anonymous path-token bypass.
README — adds a Multi-service stacks pointer (MCP `create_stack` /
POST /stacks/new) plus `--env` usage examples.
Tests:
* cmd/cli_mcp_gaps_test.go — 3 new regression test groups covering
env-flag forwarding (per verb, table-driven across all seven),
deploy stub Short label, and unauth exit code on both resource verbs.
* Existing TestExtras_Resource* tests updated to call authSetupForTest()
so the auth gate fires before the unrelated assertion.
* resetProvisionFlags() clears the new resourceEnv global between cases
and now covers all seven provisioning groups.
`make ci` green; coverage 95.2% (above 95% floor).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes three QA-found CLI gaps from BugBash round 2 (see `/tmp/qa-session/shared/BACKLOG.md`).
CLI-MCP-8 — `--env` passthrough on all provisioning verbs (P1)
Before: every `instant new` command dropped the `env` parameter on the floor. The API has honored `env` since migration 026 (default `development`, CLAUDE.md rule 11), but agents had no surface to choose a non-default env without falling back to curl.
After: `db / cache / nosql / queue / storage / webhook / vector` each accept `--env `. Empty == server default; non-empty forwards verbatim in the request body. Output prints the resolved `env` and, when the server downgrades the request, `env_override_reason` so the user sees WHY their requested env didn't stick.
CLI-MCP-9 — deploy parent help labels as stub (P1)
`instant deploy` parent `cobra.Short` is now `[stub — current MCP/API path: POST /deploy/new or create_deploy via MCP. CLI deploy verbs not yet implemented]`. That one-liner is what surfaces in `instant --help`, so an agent's first contact with the deploy surface carries the canonical pointer.
CLI-MCP-11 — resource detail/delete exit 3 on unauth (P2)
`instant resource ` and `instant resource delete ` now short-circuit with `errAuthRequired` (exit 3) when the caller is unauthenticated, BEFORE any side effects. Matches the contract `instant resources` (list) already honors.
README
Adds a Multi-service stacks pointer (MCP `create_stack` / `POST /stacks/new`) plus `--env` usage examples.
Tests
Verification
🤖 Generated with Claude Code