You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements a delete subcommand for environments (aliased as mass env delete),
rounding out the environment CRUD lifecycle alongside create, get, list,
and update.
What's new
mass environment delete <environment> — permanently deletes an environment
via the SDK's Environments.Delete.
--force, -f flag to skip the confirmation prompt (for automation/CI).
Type-to-confirm safety prompt: by default the user must type the environment
ID to confirm, mirroring the existing mass project delete pattern. The
environment is fetched first so the prompt shows the real ID and fails cleanly
if it doesn't exist.
Behavior notes
Deleting an environment does not tear down its running infrastructure. The
help doc calls this out and points users to mass environment decommission
first if they want the underlying resources removed.
Compare against existing mass project delete pattern for consistency
Post review feedback
Reviewed the diff (git diff origin/main...HEAD) covering cmd/environment.go, the generated docs, and the new helpdoc.
Summary
The implementation is clean and follows the existing mass project delete convention (cmd/project.go:339) closely: fetch-then-confirm-then-delete, with a type-to-confirm prompt and a --force bypass. No correctness issues found.
Observations (non-blocking)
Confirmation-prompt duplication (cmd/environment.go:463-473) — This exact type-to-confirm block (bufio reader, trim, compare) is now duplicated nearly verbatim across 5 files: project.go, instance.go, repository.go, resource_type.go, and now environment.go. Since this PR adds a 5th copy, it might be worth a follow-up to extract a shared confirmDeletion(prompt, expected string) (bool, error) helper — not a blocker for this PR since it matches established repo convention, but the duplication is growing. Fix this →
Get call always runs, even with --force (cmd/environment.go:456-459) — In automation contexts using --force, this still does a network round-trip to fetch the environment before deleting, purely to populate the confirmation message. This is intentional per the PR description (fail cleanly if the environment doesn't exist) and mirrors project delete's behavior exactly, so it's consistent — just noting the extra API call for CI-heavy use of --force.
No test coverage — There's no test file for environment.go (or project.go) in the repo currently, so this isn't a regression introduced by this PR, just flagging that the new runEnvironmentDelete path (confirm/cancel/force branches) is untested, consistent with the rest of the file.
Nice touch: the generated help doc correctly states the prompt requires typing the environment ID (docs/helpdocs/environment/delete.md:33) — this is actually more accurate than docs/helpdocs/project/delete.md, whose doc text says the prompt requires typing "yes" even though the code requires the project ID. Not something to fix here, just worth being aware of for a future doc pass on project delete.
Verification notes
I was not able to run go build/go vet/go test in this sandboxed environment (network/toolchain access was blocked), so this review is based on static reading of the diff and cross-referencing the SDK usage patterns already established in cmd/project.go. The import additions (bufio) are correct and os/strings were already imported in this file.
Verdict
Looks good — matches established patterns, docs are consistent and correct, behavior notes about non-destructive infra are clearly called out. Nothing blocking.
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
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.
Implements a
deletesubcommand for environments (aliased asmass env delete),rounding out the environment CRUD lifecycle alongside
create,get,list,and
update.What's new
mass environment delete <environment>— permanently deletes an environmentvia the SDK's
Environments.Delete.--force, -fflag to skip the confirmation prompt (for automation/CI).ID to confirm, mirroring the existing
mass project deletepattern. Theenvironment is fetched first so the prompt shows the real ID and fails cleanly
if it doesn't exist.
Behavior notes
help doc calls this out and points users to
mass environment decommissionfirst if they want the underlying resources removed.