Add the Dead Code skill with hash-matched keep rows and one tool per language

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-09 22:09:05 -08:00
1 parent 7891c06642
commit a584c45dfd
43 files changed
+3398 -49

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ The meter is advice and never blocks. The console scores these launches itself w
Per-unit work is yours: `{"run":{"event":"implement-phase","id":"phase-2","tasks":9}}`, one `run` per post, never reaching the page state.
- `event`: `pathfinder-chart`, `pathfinder-question` (scores nothing now), `pathfinder-research`, `plan`, `revise-plan`, `document`, `implement-phase`, `implement-review-phase`, `review`, `quick-task`, `init`, `init-update`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`, `git-commits`, `git-conflict`. An unknown event is exit 3. Post only the events your notes name: a launch the console scores already has its points.
- `event`: `pathfinder-chart`, `pathfinder-question` (scores nothing now), `pathfinder-research`, `plan`, `revise-plan`, `document`, `implement-phase`, `implement-review-phase`, `review`, `quick-task`, `init`, `init-update`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`, `git-commits`, `git-conflict`. An unknown event is exit 3. Post only the events your notes name: a launch the console scores already has its points.
- `id`: the unit (a question's slug, `phase-N`, `map`), non-empty. The same id in the same skill run is ignored.
- `tasks`: only with `implement-phase` and `implement-review-phase`; the tasks completed (`[x]`, not blocked), a whole number 1 to 999. A phase scores one point per 3 tasks rounded up (Implement + Review one more for the review); without it, a flat 2 (or 3). It takes over the count from `headline.cleared`, never adding to it.
- `commits`: only with `git-commits`; commits made, 1 to 999, one point per 2 rounded down.
+1 -1
View File
@@ -1,6 +1,6 @@
# Helpers (Subagents)
The console points here when a `Subagents:` block reaches you. On the skills that offer it (`init`, `init-update`, `pathfinder`, `plan`, `revise-plan`, `document`, `implement`, `implement-review`, `quick-task`, `review`, `finalize`, `xray`, `diagnose`, `pr-prep`, `test`) the person turns helpers on or off from the top bar's Subagents button, per project and skill. It reaches you as a standing instruction, only when it changes.
The console points here when a `Subagents:` block reaches you. On the skills that offer it (`init`, `init-update`, `pathfinder`, `plan`, `revise-plan`, `document`, `implement`, `implement-review`, `quick-task`, `review`, `finalize`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`) the person turns helpers on or off from the top bar's Subagents button, per project and skill. It reaches you as a standing instruction, only when it changes.
## What arrives
+1 -1
View File
@@ -6,7 +6,7 @@ A local page where the person answers your questions, reads your drafts and appr
## Start
`node "<CONSOLE>" open --workflow <w>` (add `--spec specs/<idea>` when known). `<w>` is one of `dashboard`, `init`, `init-update`, `pathfinder`, `quick-task`, `plan`, `revise-plan`, `document`, `implement`, `implement-review`, `review`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`. Launched from the dashboard? The session is open: run the `resume` command the launch carried instead.
`node "<CONSOLE>" open --workflow <w>` (add `--spec specs/<idea>` when known). `<w>` is one of `dashboard`, `init`, `init-update`, `pathfinder`, `quick-task`, `plan`, `revise-plan`, `document`, `implement`, `implement-review`, `review`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`. Launched from the dashboard? The session is open: run the `resume` command the launch carried instead.
Keep `sid`: every later command takes `--session <sid>`. `open` failing: carry on in the terminal. When `open` adds `remote` and a `note`, give the link, ask whether it opened, and move to the terminal if not. Tell the person the link (with `"inApp":true`, never print it: only how many questions are waiting) and end every terminal message with the latest `terminalLine`, verbatim.
+37
View File
@@ -0,0 +1,37 @@
# Dead Code
## Start questions
One `--wait` batch, after `detect` and `keep list`. Only the first card is required; leave out any the prompt says to skip (no method card with no tool, no keep card with an empty list):
```jsonc
{"title":"Clear out dead code","headline":{"stage":"Start","cleared":0,"total":5},"items":[{"id":"method","kind":"choice","title":"How to look","allowOther":false,"body":"This project has Knip (`knip.json`).","options":[{"text":"Knip, checked by a caller search","recommended":true},{"text":"Knip plus a full search of my own","detail":"Slower; finds what Knip cannot see."}]},{"id":"scope","kind":"choice","title":"Where to look","required":false,"body":"Callers are always searched across the whole project.","options":[{"text":"The whole project","recommended":true},{"text":"One folder","detail":"Name it in the note."}]},{"id":"keep","kind":"choice","title":"The keep list","required":false,"allowOther":false,"body":"3 findings were kept on earlier runs.","options":[{"text":"Hide them again","recommended":true},{"text":"A fresh scan that ignores them"}]}]}
```
## Narrow first
Only when `overLimit` is true. One `choice`, `--wait`: the five folders from `narrow` (or the biggest top-level folders with no tool), each with its count in `detail`, then the whole project with the time and cost warning in its `detail`.
## The findings
One `multi`, `--wait`, `required:false`. Options in three groups, in this order: Safe, Check first, Warning. Each option's `text` is `name` in `file:line`; its `detail` starts with the label, then the source (tool, own search or both), the rule id and the reason (the six-kind reason for a Warning). The `body` gives each group's count, how many the keep list hid and how many were dropped for a caller. Nothing starts ticked: the quick pick is the preset `All Safe` (the Safe group's keys). Leave out a preset with no keys (no Safe findings, or a `None`): the page drops it, and a pressed preset clears when pressed again.
```jsonc
{"headline":{"stage":"Findings","cleared":2},"items":[{"id":"findings","kind":"multi","title":"What to remove","required":false,"body":"- Safe to remove: 2\n- Check first: 1\n- Warning: 1\n\n4 hidden by the keep list; 9 dropped: a caller was found. Nothing is removed until you send.","options":[{"k":"1","text":"formatDate in src/dates.js:14","detail":"Safe. Knip (exports): no caller found."},{"k":"2","text":"src/old/legacy.js","detail":"Safe. Knip (files): no caller found."},{"k":"3","text":"parseRow in src/csv.js:40","detail":"Check first. Own search only."},{"k":"4","text":"onLoad in src/plugin.js:8","detail":"Warning. A framework hook: the host calls it by name."}],"presets":[{"label":"All Safe","ks":["1","2"]}]}]}
```
## Checks
With no test map: one `confirm` listing each command and the folder it runs in, `--wait`, `"yesLabel":"Use these","noLabel":"Not right"`, before anything runs. A "Not right" note replaces what was found; with none, ask for the commands as a `text` card.
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.
## 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".
Helpers are reported as `helpers`, each `done` or `failed` before the findings page goes up. Labels, picks and questions stay with you.
## The finish
`headline` the counts removed, kept and failed; `body` the summary and any file written; `"dashboard":true`; `command` `/plan2code-git` when something was removed or `keep.md` changed, otherwise none; never `commit`. A stop before removal: `body` says nothing was removed, `"command":"/plan2code-dead-code"`.
+7 -7
View File
@@ -259,13 +259,13 @@ export const PICKABLE_SOUNDS = ["startSkill", "sessionStart", "skillReady", "ses
// The file each pickable cue plays until a person picks another.
export const DEFAULT_SOUND_FILE = {
startSkill: "sound-01",
sessionStart: "sound-02",
sessionEnd: "sound-02",
question: "sound-03",
skillReady: "sound-03",
chatReply: "sound-03",
newTab: "sound-04",
startSkill: "sound-14",
sessionStart: "sound-07",
sessionEnd: "sound-15",
question: "sound-14",
skillReady: "sound-16",
chatReply: "sound-06",
newTab: "sound-05",
};
// Every moment the page makes a noise, each switchable on its own in User
+22
View File
@@ -426,6 +426,28 @@ export const SKILLS = Object.freeze([
"When parts of the code have no tests. Test asks where to look (the branch's changes, one folder or the whole project) and finds the files no test covers, and offers a real coverage run when the project already has a coverage tool. It shows a plan that opens with how this project writes tests, so the new tests match the old ones, then writes and runs unit and integration tests. It never changes source code: a test that finds a real bug is handed to Diagnose.",
},
}),
skill({
skill: "plan2code-dead-code",
workflow: "dead-code",
label: "Dead code",
name: "Dead Code",
pose: "dead-code",
builds: false, phased: false, metered: true, templates: false,
weight: 1, started: "Dead Code started", ran: "Dead Code run", resume: null,
subagents: "Use helpers for the caller search, one batch of candidates each, returning what each searched and found, never a label. Keep the labels, the Safe call, the removals, the checks and every question with you. Light strength, low effort.",
states: "any",
greyed: null,
card: {
group: "extra",
chip: "Utility",
title: "Clear out dead code",
icon: "dead-code",
blurb: "Finds code nothing uses, says how safe each piece is to remove, and removes only what you pick.",
help: "Finds unused code, labels each piece Safe, Check first or Warning, removes only what you pick, then runs the tests and build.",
about:
"For code nothing calls anymore. Dead Code uses the project's own dead-code tool when there is one (Knip, vulture, cargo check and others), or searches by itself when there is not, then checks every item for callers across the whole project. Each one gets a label: Safe to remove, Check first or Warning, with the reason. It removes only what you pick, runs the tests and build, and puts back anything that breaks them. It never commits and never installs anything.",
},
}),
skill({
skill: "plan2code-changelog",
workflow: "changelog",
+15
View File
@@ -473,6 +473,21 @@
60%, 85% { transform: translate(4px, -4px); }
}
/* Dead code -- the skull's jaw chatters a few times, then rests; his star
glances over at it while it talks. */
.pose .dd-bone { fill: var(--panel-2); stroke: var(--ink-2); stroke-width: 4; stroke-linejoin: round; }
.pose .dd-jaw { animation: dd-jaw 3.6s ease-in-out infinite; }
@keyframes dd-jaw {
0%, 10%, 60%, 100% { transform: translateY(0); }
18%, 34%, 50% { transform: translateY(4px); }
26%, 42% { transform: translateY(1px); }
}
.pose .dd-look { animation: dd-look 3.6s ease-in-out infinite; }
@keyframes dd-look {
0%, 70%, 100% { transform: translate(2px, 0); }
14%, 56% { transform: translate(5px, -2px); }
}
@media (max-width: 720px) {
.dash { padding-top: 0; }
.launch-stage { height: 140px; }