mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-18 13:01:18 -08:00
Offer a final review of the removals at the end of the Dead Code skill, run in the same session
AI Assisted
This commit is contained in:
1 parent
b3768b47a3
commit
7f32c351b1
12 files changed
+65
-17
No files matched your search
@@ -4,7 +4,7 @@ Start all DEAD CODE MODE responses with '💀 [DEAD CODE]'
|
||||
|
||||
## Role
|
||||
|
||||
Finds unused code paths and dead code in the person's own project. Shows each finding with its evidence and a label that says how safe it is to remove, removes only the findings the person picks, then runs the project's tests and build. **Never commits, pushes or stages**, never installs an outside tool, and does no code review of its own (that is the Review skill's job).
|
||||
Finds unused code paths and dead code in the person's own project. Shows each finding with its evidence and a label that says how safe it is to remove, removes only the findings the person picks, then runs the project's tests and build and offers a final review of the removals (Step 7.5, the Review skill's own prompt, run in this session). **Never commits, pushes or stages**, and never installs an outside tool.
|
||||
|
||||
## Interface
|
||||
|
||||
@@ -33,13 +33,14 @@ Read `./AGENTS.md` when it exists: its commands, its `## Test map` and anything
|
||||
|
||||
- `references/caller-search.md`: what to search besides the plain name, per language group. Read it before Step 4.
|
||||
- `references/helper-strength.md`: helper strength and effort.
|
||||
- `references/review.md` and `references/review-in-build.md`: the Review skill and how it runs inside this session. Read them only on a yes to Step 7.5.
|
||||
|
||||
## Rules
|
||||
|
||||
- Follow `./AGENTS.md` when it exists.
|
||||
- **Never** run `git commit`, `git push`, `git add` or `git stash`. Read-only git is fine. The changes stay unstaged for the person to look at.
|
||||
- **Never install anything**: no `npm install`, `pip install`, `cargo install`, `go install` or download of a tool. A tool the project already has may be run.
|
||||
- **Write only** code removals, `.plan2code-dead-code/keep.md`, and, on a yes, the saved report and the `.gitignore` line.
|
||||
- **Write only** code removals, the Step 7.5 review fixes the person picks, `.plan2code-dead-code/keep.md`, and, on a yes, the saved report and the `.gitignore` line.
|
||||
- **Nothing is removed before the person picks it.** Nothing is pre-ticked.
|
||||
- **Silence is not proof.** A finding reaches Safe only when a tool listed it and the caller search agrees.
|
||||
- **Never partial without saying so.** A narrowed or stopped run says what was and was not checked, and is never called complete.
|
||||
@@ -126,9 +127,25 @@ Nothing picked → skip to Step 8.
|
||||
|
||||
Nothing is staged or committed at any point.
|
||||
|
||||
### Step 7.5: Final review (offered)
|
||||
|
||||
**Objective:** an independent safety pass over what was just removed, before the report. A caller search can miss a use, and a removal can leave a dangling import, a stale comment or docs that still name the item.
|
||||
|
||||
When at least one pick ended `removed`, always offer it: "Run a final review of the removals before the report? (yes / no)", with its size (files, ~lines removed). **Recommend yes**, and say why in one line: the removals have passed the checks, and this is the last look before you commit. The person may skip. Nothing removed: no offer. Skipped: record `skipped (your choice)` and go to Step 8.
|
||||
|
||||
On yes, read `references/review.md` and run it as `references/review-in-build.md` says, with these overrides:
|
||||
|
||||
- Skip Review Mode's Interface section: this session's console or terminal choice stands.
|
||||
- **Scope (decided, never asked):** the files this run changed or deleted (every `backup` run's files whose pick ended `removed`), plus the files that imported or named a removed item. Other working-tree changes stay out.
|
||||
- **Focus:** what removal breaks: a remaining caller (by name, in a string, config, test or doc), a dangling import or export, a now-unused helper the removal exposed, and comments or docs that still name the item. Never re-litigate a pick: a finding that the code was live is a fix (put it back), not a debate.
|
||||
- **Putting back:** `restore --run <id> --files <f>`, then `--verify`, puts back the whole file as it was before the run, so every other removal and fix in that file goes too: name them to the person first, and mark each such pick `kept` (put back by the review).
|
||||
- The helper rule, the fix choice (`H` / `A` / `S 1,3`, or none) and the Post-Fix Flow are Review Mode's. Before applying fixes, `backup` the files they touch as a new run. After fixes, rerun Step 7's checks once through `run-check.mjs`; on a fail, `restore` that run (`--verify`), rerun the checks, and record the fixes as open.
|
||||
|
||||
Record one outcome for Step 8: `N found, M fixed, K open`, `skipped (your choice)` or `not offered (nothing removed)`. Zero findings: say so with the dimension coverage. An open Critical: say so plainly and offer the put-back above.
|
||||
|
||||
### Step 8: Report, keep list and finish
|
||||
|
||||
**Report.** Always show it on the page (in the terminal, as a table): the headline says complete or narrowed (or stopped), the scope, the method and tool or tools, how many the keep list hid, how many were dropped, then each finding with its label, source, rule id, the reason for any Warning and its outcome (`removed`, `kept`, `skipped`, `failed: ...`), and whether removal was unchecked.
|
||||
**Report.** Always show it on the page (in the terminal, as a table): the headline says complete or narrowed (or stopped), the scope, the method and tool or tools, how many the keep list hid, how many were dropped, then each finding with its label, source, rule id, the reason for any Warning and its outcome (`removed`, `kept`, `skipped`, `failed: ...`), whether removal was unchecked, and the final review's outcome (Step 7.5) with any open finding and its file.
|
||||
|
||||
Offer three things, each acted on only on a yes:
|
||||
|
||||
@@ -142,7 +159,7 @@ On "stop", "cancel" or similar during a run: confirm. With removals on disk and
|
||||
|
||||
## Session End
|
||||
|
||||
Work summary: the scope and whether it was narrowed, the method and tool or tools, how many findings by label, how many were hidden by the keep list or dropped for a caller, what was removed, put back (with why) or left, whether removal was checked, and any file written (the report, `keep.md`, `.gitignore`).
|
||||
Work summary: the scope and whether it was narrowed, the method and tool or tools, how many findings by label, how many were hidden by the keep list or dropped for a caller, what was removed, put back (with why) or left, whether removal was checked, the final review's outcome (or that it was skipped), and any file written (the report, `keep.md`, `.gitignore`).
|
||||
|
||||
**Next step**, as the closing line: "Review the unstaged changes and commit them, with `keep.md`, using `/plan2code-git`." Nothing removed and no keep-list change: "Nothing to commit."
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Review Inside a Build
|
||||
> Read by Review, Implement, Implement + Review and Quick Task when a review runs inside a build: before a phase is signed off, or after a quick task is built. Never invoked as a skill. The web console's `building-review.md` adds only what the page does differently.
|
||||
> Read by Review, Implement, Implement + Review, Quick Task, Finalize and Dead Code when a review runs inside a session: before a phase is signed off, after a quick task is built, or as a final review (Finalize's Step 2.5, Dead Code's Step 7.5, whose own steps replace "Back to the build"). Never invoked as a skill. The web console's `building-review.md` adds only what the page does differently.
|
||||
|
||||
Run Review Mode (`references/review.md`, or this skill's own SKILL.md in Review) with these rules. They win over Review Mode's own scope questions, completion and session-end steps.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Choosing what to run
|
||||
> Read by Document, Implement, Implement + Review, Quick Task, Review, Finalize, PR Prep and Test before they write, run or offer tests. Never invoked as a skill.
|
||||
> Read by Document, Implement, Implement + Review, Quick Task, Review, Finalize, PR Prep, Test and Dead Code (its final review's fixes) before they write, run or offer tests. Never invoked as a skill.
|
||||
|
||||
## Three tiers
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# The Review, Mid-Session
|
||||
|
||||
The console points here on `__review`, or on a `review` card answered with a verdict. Part of the build contract (`building.md`). The same focused review runs from four doors:
|
||||
The console points here on `__review`, or on a `review` card answered with a verdict. Part of the build contract (`building.md`). The same focused review runs from five doors:
|
||||
|
||||
- **`implement`:** the `review` verdict on the sign-off card, before anything is approved. A note sent with it is focus for the review. Settle the card in the post that goes back to work: `{"settle":true,"headline":{"stage":"Reviewing Phase 3","cleared":0,"total":0},"run":{"event":"review","id":"review"},"agent":{"status":"working","activity":"Reviewing the 7 files this phase changed","quietMinutes":15}}`
|
||||
- **`quick-task`:** the **Review it now** button on the finished screen (`finish.review`), arriving as `__review`. Take it up with the same post minus `settle`, plus `"finish":null`.
|
||||
- **`implement-review`:** Stage 2 (`notes/implement.md`).
|
||||
- **`finalize`:** a yes on Step 2.5's "Run a final review" card (`notes/finalize.md`). Settle the card in the post that takes the review up, as for `implement`, with `"stage":"Final review"`. Scope is the whole feature's change set (Step 2.5), not one phase.
|
||||
- **`dead-code`:** a yes on Step 7.5's "Run a final review" card (`notes/dead-code.md`). Settle it as for `finalize`, with `"stage":"Final review"`. Scope is the removals and the files that named a removed item (Step 7.5).
|
||||
|
||||
Either way the post that takes the review up carries `"run":{"event":"review","id":"review"}`: the review runs inside this session, so no launch scores it. Never also resume under `--workflow review`, or it counts twice.
|
||||
|
||||
@@ -50,6 +51,8 @@ In loop mode the way out is the `loopOutcome` post, not a sign-off.
|
||||
|
||||
**`finalize`: the closing gate, then Step 3.** With fixes made, post the same "Check the fixes" `review` item as Quick Task (below). When it clears (or with nothing fixed), settle it in the post that starts Step 3, which carries the review outcome into the summary and every open finding into Known Limitations. No finish here; the `review` doc stays as a tab.
|
||||
|
||||
**`dead-code`: the same closing gate, then Step 8.** As `finalize`, but the post that settles it starts Step 8's report, which carries the review outcome and every open finding.
|
||||
|
||||
**`quick-task`: the closing gate, then the finish.** Post a `review` item "Check the fixes": `doc:"review"`, `"nothingYet":false`, verdicts `approve` ("The fixes look right") and `changes`, token `approved` / `needs changes`. When it clears, settle it in the same post as the new finish, posted without `review` and with `dashboard:true`; keep waiting for its buttons, `stop` only on `__done`. The finish:
|
||||
|
||||
- `headline`: "The review is done"
|
||||
|
||||
@@ -26,6 +26,10 @@ With no test map: one `confirm` listing each command and the folder it runs in,
|
||||
|
||||
One progress post per check, no `--wait`, its `activity` naming the check and `quietMinutes` sized to its timeout (600 s is 10 minutes, plus a margin). Run the `chat` check between checks, as a build does.
|
||||
|
||||
## Final review
|
||||
|
||||
Once Step 7 ends with at least one pick `removed` (Step 7.5): `confirm` "Run a final review", `--wait`, `"yesLabel":"Review it","noLabel":"Skip it"`, files and ~lines removed in `body` with the one-line reason to say yes. Yes: read `<D>/building-review.md`, the `dead-code` door.
|
||||
|
||||
## The report and the offers
|
||||
|
||||
Doc `report`: one `md` block, the headline first (Complete, Narrowed or Stopped), then scope, method and tools, the hidden and dropped counts, and the findings table with each outcome. Then each offer as a `confirm`, `--wait`, `"doc":"report"`: "Save the report" (naming `.plan2code-dead-code/reports/DEAD-CODE-<date>.md`), "Keep these findings" (the reasons asked as a `text` card after a yes), and on first save ".gitignore line".
|
||||
|
||||
Reference in new issue
Block a user