T-NFSM-project-cleanup-port
Status: closed/done · Impact: medium · Complexity: large
project_cleanup.ts (1625 lines, the largest composite) gathers and
classifies branches, worktrees, remote branches, and task linkage —
read-only — and the skill executes actions only after sub-agent
investigation and human approval. Port it as ONE op, sdlc project cleanup: the granularity rule cuts only at the LLM-judgment seam, which
already lives in the skill.
| Location | Role today |
|---|---|
plugin/scripts/project_cleanup.ts | gather → classify → emit markdown/JSON report; zero mutations |
plugin/skills/project-cleanup/SKILL.md | consumes the report; dispatches investigation; executes after approval |
Proposed
Section titled “Proposed”services/project/ops/cleanup.ts — a flat verb on the project noun (one
op, no singleton subgroup), report output locked by golden, read-only
property proven. The skill flow is unchanged until T-QL5F-skill-prose-codemod repoints
its invocation line.
Approach
Section titled “Approach”- Golden-snapshot the report (markdown + JSON modes) against a fixture repo state with known branch/worktree/task conditions.
- Port as a single composite op; worktree/git helpers via
util/git. - Render hook for the markdown mode;
--jsoncanonical. - Read-only proof: run against a dirty fixture, assert zero filesystem/git mutations.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/lib/services/project/ops/cleanup.ts | new | the composite op |
plugin/scripts/project_cleanup.ts | modify | thins to forwarder until deletion |
plugin/lib/services/project/ | modify | tests for report parity + read-only proof |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: report golden parity (markdown and JSON) on the fixture repo state.
- AC-2: a test proves zero mutations: repo state hash identical before/after the op on a dirty fixture.
- AC-3:
sdlc project cleanupvisible insdlc project --help; dispatches via the registry. - AC-4: full
bun testgreen.
Out of scope
Section titled “Out of scope”- Executing cleanup actions (stays in the skill, after human approval).
- Skill prose (T-QL5F-skill-prose-codemod).
- Changing classification heuristics.
Dependencies
Section titled “Dependencies”- T-NV49-op-path-substrate.
- Sequencing: last of the
project-noun chain (T-6FBO-project-plugin-ports scaffolds the noun, T-IDW6-task-inflight-project-scans adds the scan group).
Discovery context
Section titled “Discovery context”- D-0007 §4 granularity rule — “coarse, deterministic composites are legitimate”; docs/plans/op-substrate-full-sweep.md T10.