8000 Add `min destroy all` command · Issue #805 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

Add min destroy all command #805

Closed
Closed

Description

@norrietaylor

Motivation

min destroy today destroys a single session (resource) at a time — DestroyArgs takes exactly one session identifier (UUID or name), see the Destroy(DestroyArgs) subcommand in crates/minimal/src/lib.rs. When you have several sessions running, tearing them all down means invoking min destroy once per session, which is tedious and error-prone.

Current workaround

The only way to destroy everything in one go is a shell loop over min ls:

min ls --raw | while read line; do min destroy $line; done;

This works but is clunky: it depends on the exact --raw output format, has no confirmation or dry-run, and offers no clean error handling if one destroy fails partway through.

Proposed behavior

Add a first-class min destroy all that destroys all current sessions in one step.

Suggested shape:

  • min destroy all enumerates every session using the same source of truth as min ls — the ListSessions RPC (minimald-rpc) that backs Ls(LsArgs) — and issues a DestroySession for each, rather than relying on parsing CLI text output.
  • Because this is destructive across all resources, prompt for confirmation by default and support a --force / -f flag to skip the prompt (non-interactive use). This mirrors the existing precedent on StopArgs, which already exposes a --force/-f flag ("Force shutdown even if active sessions exist").
  • Report per-session results and continue past individual failures where possible, exiting non-zero if any destroy failed, so a single bad session does not silently abort the rest.
  • No-op cleanly (and print a friendly message unless --raw/quiet) when there are no sessions, matching min ls's empty-list handling.

Relevant code

  • crates/minimal/src/lib.rs — CLI subcommand enum (Ls, Activate, Attach, Destroy, Stop), DestroyArgs, LsArgs (--raw), and StopArgs (--force/-f).
  • crates/minimald-rpc/src/lib.rs — ListSessions and DestroySession RPCs to enumerate and remove sessions.

Reported via Slack; filing as a feature request.

Activity

  1. gominimal-aw-bot commented on Jul 17, 2026

    @gominimal-aw-bot
    Contributor

    Routing triage — #805

    Kind: feature · Route: sdd · Target: gominimal/minimal · Confidence: 0.88

    A Slack-filed request to add min destroy all — a first-class CLI subcommand that tears down all active sessions in one step, with a confirmation prompt and a --force/-f bypass for non-interactive use.


    Verdict

    Field Value
    Kind feature
    Route sdd
    Target gominimal/minimal
    Confidence 0.88

    The existing min destroy accepts exactly one session identifier. This request adds a bulk-destroy variant. The RPCs required (ListSessions, DestroySession) already exist in the repo; the work is adding the new CLI subcommand, the confirmation-prompt UX, per-session error handling, and tests. Classified sdd rather than patch because the new command involves UX design decisions (interactive confirmation behaviour, partial-failure exit code semantics) that benefit from a spec before implementation.

    Launch: a maintainer comments /spec on the work issue to start the SDD pipeline.


    Evidence

    • Repository code (direct match):
      • crates/minimal/src/lib.rs — Destroy(DestroyArgs) subcommand variant, DestroyArgs struct (single session field), cmd_ls/LsArgs (the --raw pattern), and StopArgs with --force/-f (the confirmation-prompt precedent) all confirmed present by code search.
      • crates/minimald-rpc/src/lib.rs — ListSessions and DestroySession RPC structs exist and are ready to call.
      • crates/minimald/src/rpc.rs and crates/sessions/docs/COMPOSITION.md — both RPCs plumbed through the daemon handler.
      • crates/minimal/tests/cli.rs — existing DestroyArgs integration tests establish the test-harness shape the new DestroyAll tests would follow.
    • Similar issues:
      • gominimal/inbox: no prior issue for destroy all found (only this issue itself and closed epic gominimal/inbox#159 "Define the minimal client interface", which is unrelated completed work).
      • gominimal/minimal: zero hits for destroy all in open or closed issues.
    • Distillery enrichment: Merged PR feat(minimald): implement session destroy + RPC #462 (feat(minimald): implement session destroy + RPC) and merged PR [#159] Implement the minimal client interface (ls, activate, attach, destroy) #434 (Implement the minimal client interface — ls, activate, attach, destroy) confirm the single-session destroy surface is shipped. No existing entry for a bulk destroy variant.
    • Routing precedents: Two routing-outcome entries retrieved (informed by routing-outcome inbox-route/I_kwDOSUhdos8AAAABH4dWDA and routing-outcome inbox-route/I_kwDOSUhdos8AAAABH4daBw). Both record sdd routes to gominimal/minimal confirmed as correct target; neither carries a correction pointing elsewhere. The F4 outcomes in those records reflect scope rejections by the team, not routing errors — the target assignment was validated.
    • Manifest: gominimal/minimal owns the end-user CLI subcommands; sdd: true; route: allow.

    [inbox-route:decision]

    {"schema":"inbox-route/v1","issue":306,"issue_node_id":"I_kwDOSUhdos8AAAABJM2sxA","dry_run":false,"kind":"feature","route":"sdd","confidence":0.88,"targets":[{"repo":"gominimal/minimal","reason":"all referenced code (DestroyArgs, ListSessions, DestroySession, cmd_ls pattern) lives in this repo"}],"labels":["kind:feature","priority:should-have"],"patch":null,"work_issue":{"title":"feature: add `min destroy all` command","body":"## Summary\n\nAdd a `min destroy all` subcommand to the minimal CLI that tears down every active session in one step, with a confirmation prompt and a `--force`/`-f` bypass for non-interactive use.\n\n## Problem\n\nDestroying multiple sessions today requires invoking `min destroy` once per session identifier, or piping `min ls --raw` through a shell loop. The loop approach relies on `--raw` output format stability and provides no confirmation, no dry-run, and brittle error handling if a destroy fails partway through.\n\n## Desired outcome\n\nA first-class `min destroy all` command that:\n- Enumerates sessions via the `ListSessions` RPC (same source as `min ls`) rather than parsing CLI text output.\n- Prompts for confirmation by default; skips the prompt with `--force`/`-f` (matching the precedent on `StopArgs`).\n- Issues a `DestroySession` RPC for each session, reports per-session results, continues past individual failures, and exits non-zero if any destroy failed.\n- No-ops cleanly (with a friendly message unless `--raw`/quiet) when no sessions exist, matching `min ls` empty-list handling.\n\n## Scope notes\n\nRelevant files the implementation is expected to touch:\n- `crates/minimal/src/lib.rs` — add `DestroyAll(DestroyAllArgs)` to the `Subcommand` enum, `DestroyAllArgs` struct with `--force`/`-f`, and `cmd_destroy_all` function.\n- Command dispatch entry point — new match arm for `DestroyAll`.\n- `crates/minimal/tests/cli.rs` — integration tests covering the happy path, no-sessions no-op, partial failure, and `--force` bypass.\n\nThe `ListSessions` and `DestroySession` RPCs in `crates/minimald-rpc/src/lib.rs` already exist and should not require changes.\n\n---\n<!-- SDD command vocabulary. Do not edit this footer. -->\n\nThis issue is the tracking issue for this work. A maintainer with write\naccess starts the SDD pipeline by commenting `/spec` on this issue or by\nflipping the `sdd:spec` label.\n\nSteer the pipeline with these comment commands. Each is gated to commenters\nwith write access to the repository.\n\n| Command | Where | Effect |\n|---|---|---|\n| `/spec` | this tracking issue | re-run `sdd-spec` to draft or revise the spec |\n| `/fastpath` | this tracking issue | confirm a single-session change; `sdd-spec` produces a stub spec PR and an execution plan comment in one run (ADR 0012) |\n| `/triage` | this tracking issue, after the spec PR is merged | start `sdd-triage` phase A (architecture) |\n| `/approve` | this tracking issue | full path: confirm the proposed plan so `sdd-triage` creates the Unit and task sub-issues. Fast path: dispatch the execution plan against `sdd-execute-{tier}` |\n| `/dispatch` | this tracking issue (full path only) | arm the cascade across the task tree |\n| `/revise <note>` | a spec, architecture, or implementation PR, or this tracking issue | re-run the owning agent with the note as an added instruction |\n| `/execute` | a task sub-issue | run `sdd-execute` for that task ahead of the schedule |\n\nMerging the spec PR advances to the architecture phase; merging the\narchitecture PR advances to a plan-comment phase, where `sdd-triage` posts\nthe proposed plan as one comment on this tracking issue. When an agent needs\na human decision it applies the `needs-human` label and posts one comment;\nclear the label once you have answered and the agent resumes."},"related":[],"rationale":"Issue gominimal/minimal#805 requests a new min destroy all CLI subcommand for the minimal daemon client. All referenced code lives in gominimal/minimal: DestroyArgs in crates/minimal/src/lib.rs, ListSessions and DestroySession RPCs in crates/minimald-rpc/src/lib.rs confirmed by code search, and cmd_ls pattern plus session resolution helpers in the same crate. No prior or duplicate issue found in gominimal/inbox (only the issue itself and an unrelated closed epic) or in gominimal/minimal (zero hits for destroy all). Two routing-outcome precedents retrieved (informed by routing-outcome inbox-route/I_kwDOSUhdos8AAAABH4dWDA and routing-outcome inbox-route/I_kwDOSUhdos8AAAABH4daBw) both confirm gominimal/minimal as the correct target for minimal CLI work and carry no correction pointing elsewhere. Classified sdd rather than patch because adding a new user-facing command involves UX design decisions — confirmation prompt behavior, error handling across partial failures, exit code semantics — that benefit from a spec before implementation."}

    Generated by inbox-route for issue #805 · ◷

  2. added
    kind:featureA new feature or capability. Applied by the inbox-route classifier.
    on Jul 17, 2026
  3. gominimal-aw-bot commented on Jul 17, 2026

    @gominimal-aw-bot
    Contributor

    [inbox-route:ledger]
    Routed from #805 by inbox-route (https://github.com/gominimal/inbox/actions/runs/29590079024)
    Routing-Key: inbox-route/I_kwDOSUhdos8AAAABJM2sxA
    Route: sdd
    Work-Issue: #805 (in-place — the transferred issue is the deliverable)

  4. transferred this issue fromon Jul 17, 2026
  5. jtnkminimal commented on Jul 17, 2026

    @jtnkminimal
    Contributor

    Implemented and pushed on amp-codex-5.5-test-805-destroy-all at ae0bfa88.

    This uses min destroy --all rather than positional min destroy all, preserving the ability to destroy a session literally named all. Behavior:

    • asks for interactive confirmation, defaulting to no;
    • requires --force for non-interactive bulk destruction;
    • cleanly succeeds with no active sessions;
    • continues through per-session failures and exits non-zero afterward if any failed;
    • preserves UUID/name-based single-session destruction.

    Verification:

    • cargo check -p minimal --lib
    • cargo clippy -p minimal --lib --no-deps -- -D warnings
    • CLI help and invalid argument combinations checked
    • cargo fmt
    • git diff --check

    The daemon-backed integration tests were added but cannot run on this macOS host because the existing minimald dev-dependency reaches Linux-only procfs; they require the Linux CI lane.

    (amp-codex-5.5-test-805-destroy-all)

  6. jtnkminimal commented on Jul 17, 2026

    @jtnkminimal
    Contributor

    Resolved with #811

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:featureA new feature or capability. Applied by the inbox-route classifier.priority:should-haveShould be done. Applied by the inbox-route classifier or a human.routed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0