Visitar URL original
ate-env: fail on unknown commands and reject reserved environment ids by KR-Ravindra · Pull Request #126 · agent-substrate/env · GitHub
Skip to content

ate-env: fail on unknown commands and reject reserved environment ids - #126

Open
KR Ravindra (KR-Ravindra) wants to merge 1 commit into
agent-substrate:mainfrom
KR-Ravindra:fix/cli-root-dispatch
Open

KR Ravindra (KR-Ravindra) wants to merge 1 commit into
agent-substrate:mainfrom
KR-Ravindra:fix/cli-root-dispatch

Conversation

@KR-Ravindra

Copy link
Copy Markdown

Problem

ate-env list (or any word that is not a built-in) is registered as an environment command. With no subcommand after it, Cobra prints Manage environment list help and exits 0, so typos look like success in scripts. ate-env create delete is accepted, but that environment can never be addressed because the built-in wins at dispatch.

Part of #117 (the CLI side). Global flags before <id> are not changed here; that needs --api/--atespace moved to the root command.

Fix

The per-environment command now fails with unknown command "list"; to address environment "list", follow it with read, write or shell (exit 1), and an unknown subcommand after an id is reported as such. The check runs in Args, before the client is created. create rejects ids that match a built-in command (create, delete, suspend, manifest, help, completion) before dialing.

How tested

TestUnknownCommandFails and TestCreateRejectsReservedIDs fail on main and pass with the change; go test ./cmd/ate-env, go vet, make verify-gofmt verify-boilerplate clean.

Experimented and verified with an AI agent.

Signed-off-by: KR Ravindra <42912207+KR-Ravindra@users.noreply.github.com>
@KR-Ravindra
KR Ravindra (KR-Ravindra) marked this pull request as ready for review November 12, 2026 18:16
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