feat(cli): X7 (part) — workspace destroy teardown (spec 13) - #56
Merged
Conversation
Implements the workspace-scoped teardown verb (the safe, data-preserving core of spec-13 teardown): - `compose down`s every project stack (never `-v` — named volumes survive); - drops this workspace's `service_ref` + `port_alloc` ledger rows under the flock; - warm-stops any shared service now at zero refs via the existing tested `Manager.GC(stop=true)` — only services no OTHER workspace references, volumes intact; - removes generated `.devstack/` artifacts (workspace shared + per project). Machine-global state (shared network, local CA, alias symlinks) is left for other workspaces. Data loss is gated by confirmation (`--yes` to skip; `--json` requires `--yes` and fails fast before touching Docker). Best-effort: a failure on one project is recorded and the rest proceed, then a non-zero exit reports the count. The teardown mechanics live in `destroyWorkspace(...)` so they unit-test with injected mocks (compose down per project, ref/port rows cleared, orphaned shared warm-stopped, artifacts removed) without a daemon. Removed the `workspace` stub. Deferred (remaining X7): `--purge-data` (shared per-service named-volume removal needs a `docker volume rm` capability not in the read-only client) and `uninstall` (machine-global incl. CA removal across host/Firefox/Windows stores). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 29, 2026
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
Implements
workspace destroy— the workspace-scoped, data-preserving core of spec-13 teardown.How (
destroyWorkspace)compose downs every project stack (never-v— named volumes survive).service_ref+port_allocledger rows under the flock.Manager.GC(stop=true)— only services no other workspace references; volumes intact..devstack/artifacts (workspace shared + per project).Machine-global state (shared network, local CA, alias symlinks) is left for other workspaces (spec 13 §destroy).
Safety
--yesskips the prompt;--jsonrequires--yesand fails fast before touching Docker.destroyWorkspace(...)so they unit-test with injected mocks (no daemon).Tests
internal/cli/destroy_test.go: command registration;--jsonrequires--yes; full teardown (compose down per project & never--volumes, ref + port rows cleared, orphaned shared warm-stopped ondevstack-shared,.devstack/removed).make cigreen.Spec acceptance (spec 13)
workspace destroyremoves this workspace's stacks + ref/port rows while leaving the shared network + CA intact.--yesskips;--jsonemits a machine-readable result.🤖 Generated with Claude Code