Skip to content

feat(cli): undo / uninstall a scaffold (cleanly remove what agent-init added) #63

Description

@Lillevang

Status: needs technical refinement. This is a UX-focused design sketch. It has a genuine open design question (how undo knows what to remove) that must be settled before implementation — see "Open questions."

Problem

If a user scaffolds the wrong flavor, or decides they don't want the agentic envelope after all, there is no way to cleanly reverse it. They must manually hunt down and delete .agent/, the symlink trio (AGENTS.md, CLAUDE.md, .agent/CLAUDE.md), .devcontainer/, Justfile, .pre-commit-config.yaml, the .gitignore block (once the visibility feature lands), and any fresh-project files — and do it without nuking their own content. That's error-prone and makes trying agent-init feel risky: there's no easy exit. A tool that's easy to undo is a tool people are willing to experiment with.

Goal

One command to cleanly remove what agent-init added — e.g. agent-init uninstall [target] (name TBD: uninstall / undo / remove / clean). Seamless, safe, and previewable. Removing a scaffold should feel as routine as creating one.

Proposed UX (illustrative — exact shape is a refinement item)

agent-init: uninstall scaffold from ./myapp

  remove   .agent/                  (created by agent-init)
  remove   .devcontainer/
  remove   Justfile
  remove   AGENTS.md, CLAUDE.md     (symlinks)
  keep     .agent/AGENTS.md         (modified since scaffold — left in place)   <- safety
  remove   .gitignore block         (agent-init fenced block; file kept)

Remove 11 items, keep 1 modified. Proceed? [y/N]

Design principles:

Provisional acceptance criteria (pending refinement)

Open questions (need technical refinement) — the core one is load-bearing

  1. How does undo know what to remove without nuking user content? This is the central design decision:
    • Option A — install manifest. Write a small manifest at init time (e.g. .agent/.install-manifest listing created paths + a content hash per file). Undo removes exactly those paths and detects user-modified files via hash mismatch (keep + warn). Precise and safe, but adds a file and couples init/uninstall.
    • Option B — derive from the flavor registry at undo time. Reconstruct the created set from the flavor definition. No extra file, but requires knowing/recording which flavor was used, and is fragile if templates changed between versions.
    • Option C — hybrid. Prefer the manifest; fall back to registry-derivation when no manifest exists (e.g. scaffolds created before this feature).
    • Leaning Option A (manifest) for safety/precision, but this is explicitly a refinement decision.
  2. Scope: full envelope only, or also remove fresh-project files (cmd/, go.mod, …)? The latter is much more dangerous — likely envelope-only by default, with the project files left alone.
  3. Naming: uninstall vs undo vs remove vs clean.
  4. Handling already-committed scaffold files: remove from the working tree only, or also git rm? (Probably remove files and let the user commit the deletion; don't auto-commit.)
  5. Symlink-trio removal order and broken-symlink edge cases.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:bootstrapInit/bootstrap flow and onboarding UXarea:cliCLI surface, flags, help outputenhancementNew feature or requestneeds-refinementDesign/feature needs further technical refinement before implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions