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

@@ -145,6 +145,7 @@ plan2code/
| `plan2code-diagnose.md` | diagnose | Find a bug's cause under the find-the-cause-first habit (`references/building-habits.md`) and write it up as `specs/<bug-name>/DIAGNOSIS-<YYYYMMDD>.md` without fixing it, then offer Quick Task to fix it, or Plan when the fix is big. The dashboard scan reports such a folder as spec state `diagnosed` ("Bug diagnosed"), which lights Quick Task (suggested) and Plan. Once Quick Task marks the diagnosis `Fixed` (nothing past it in the folder) the state is `fixed` ("Bug fixed"): no pipeline card lights, the picker never pre-selects it, and Quick Task offers to archive it with `specs.mjs archive` |
| `plan2code-pr-prep.md` | pr-prep | Get a branch ready for review: pick the checks its changes need from the project's `## Test map` (or its config files), let the person trim the plan, run it, give Ready, Ready with notes or Not ready, and write a PR description to copy (following the repo's template) with the create-a-PR link; offers to save `PR-READINESS-<date>.md` into the branch's spec folder; never commits, pushes or opens the PR |
| `plan2code-test.md` | test | Write missing tests: ask where to look, find source files no test covers (matching, plus real coverage when the project already has a coverage tool, offered first), show a plan opening with how this project writes tests, then write and run unit and integration tests; escalates past 8 source files, 8 new test files or 2 runners to a PLAN-DRAFT for Plan, hands a real bug to Diagnose, never changes source code |
| `plan2code-dead-code.md` | dead-code | Find unused code and dead code: use the project's own dead-code tools, one per language that has files (Knip, vulture, cargo check and others), or search by itself, check every item for callers across the project (`references/caller-search.md`), label each Safe to remove, Check first or Warning, remove only what the person picks, then run the tests and build and put back anything that breaks them; never commits, never installs a tool. Scripts: `dead-code.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs` |
| `plan2code-changelog.md` | changelog | Check the CHANGELOG version against the default branch, suggest editable entries for new work, keep `package.json` aligned, offer to commit the result through Git |
| `plan2code-git.md` | git | Branches, pull (with conflict help), push, publish and commits (clear message, suggested splits) on the web console's git board, or plain instructions in the terminal (`switch to main`, `commit and push`); asks before every push, publish and delete |
@@ -17,13 +17,14 @@ Anything a workflow step decides with one correct answer (parsing a spec's check
| `specs.mjs` | plan, revise-plan, document, implement, implement-review, review, quick-task, finalize, handoff, diagnose | `list` / `status` (the dashboard state, Phase Checklist, groups, task markers, numbering, the implement selection verdict, consistency checks) / `check` / `check-draft` / `metrics` / `mark` / `tick` / `archive`. `list` imports `scanProject()` from the bundled `web-console/scan.mjs`, and `status` calls `deriveSpecState()` and `pickPhaseFiles()` from `web-console/spec-files.mjs`, the one rule the scan also uses, so the dashboard and the skills never disagree on a spec's state (a phase with only blocked tasks left stays `building`, and `finalizeReady` lights Finalize once each has a written reason). `mark` writes the phase file's Status line on every move (`--to in-progress` too). `check`'s format rules (no Status line, a checkbox under Notes, a task pointing at a line number, a bare `[!]`) warn, and fail only a spec whose overview.md carries `<!-- plan2code-format: 2 -->`. `archive` that has to copy removes the source only once every file name and size at the target matches (`PLAN2CODE_ARCHIVE_FAULT` is its test seam) |
| `commit-msg.mjs` | implement(-review), review, quick-task, finalize, init-update, git | The `<subject>` / `AI Assisted` commit command (two `-m` flags), with an optional `git add -- <files>` from `--files`. There is no add-everything option: `--add-all` was retired, and `scripts/test-script-git.mjs` fails if it returns anywhere in `src/` |
| `review-scope.mjs` | review, implement(-review), quick-task, finalize, pr-prep, test | Review Mode's git fallback: files, lines, doc share, base branch |
| `glob.mjs` | init, init-update, implement(-review), quick-task, finalize, pr-prep, test | The glob subset (`**`, `*`, `?`, `{a,b}`) as a RegExp, and forward-slash path normalizing; imported by `test-map.mjs` and `test-match.mjs` |
| `test-map.mjs` | init, init-update, implement(-review), quick-task, finalize, pr-prep, test | `read` / `write` the project test map (one `\| Area \| Paths \| Run \| Shared \|` table under `## Test map` in `AGENTS.md`, or behind one link to `.agents-docs/`); every line outside the table stays byte-identical |
| `glob.mjs` | init, init-update, implement(-review), quick-task, finalize, pr-prep, test, dead-code | The glob subset (`**`, `*`, `?`, `{a,b}`) as a RegExp, and forward-slash path normalizing; imported by `test-map.mjs` and `test-match.mjs` |
| `test-map.mjs` | init, init-update, implement(-review), quick-task, finalize, pr-prep, test, dead-code | `read` / `write` the project test map (one `\| Area \| Paths \| Run \| Shared \|` table under `## Test map` in `AGENTS.md`, or behind one link to `.agents-docs/`); every line outside the table stays byte-identical |
| `test-match.mjs` | implement(-review), quick-task, finalize, pr-prep, test | `covers` (changed files to the map rows and tests that cover them, plus shared-ground hints), `gaps` (source files no test covers, ranked by recent change) and `nearest` (existing tests to read for style) |
| `test-commands.mjs` | init, init-update, pr-prep, test | `discover`: the whole-suite command, per-folder runners, lint/types/build checks, coverage commands already present and the language's built-in runner, from config files only |
| `run-check.mjs` | implement(-review), quick-task, finalize, pr-prep, test | Run one command with a timeout, kill its process tree on timeout, and classify it `passed`, `failed`, `timeout` or `not-started` with the output's tail |
| `test-commands.mjs` | init, init-update, pr-prep, test, dead-code | `discover`: the whole-suite command, per-folder runners, lint/types/build checks, coverage commands already present and the language's built-in runner, from config files only |
| `run-check.mjs` | implement(-review), quick-task, finalize, pr-prep, test, dead-code | Run one command with a timeout, kill its process tree on timeout, and classify it `passed`, `failed`, `timeout` or `not-started` with the output's tail |
| `pr-prep.mjs` (own) | pr-prep | `template` (the PR template and its headings), `pr-url` (the create-a-PR link through `git-repo.mjs`) and `spec` (the branch's spec folder for the save offer). Read-only |
| `coverage.mjs` (own) | test | `read --lcov` / `--go-func`: coverage output as per-file lines, hits and percent, plus the total. Read-only, runs no tool |
| `dead-code.mjs` (own) | dead-code | `detect` (the dead-code tools the project already has, languages, file counts), `run --tool` (a tool's output as candidates), `narrow` (folders ranked by candidates), `keep list\|filter\|add\|remove` (the shared keep list, `.plan2code-dead-code/keep.md`; rows matched by file, name and the hash of the item's declaration line, `#n` for the n-th identical line, `file:` for a whole file; `remove` takes `--hash` or `--line` and exits 2 `ambiguous-entry` when two rows share a name), `backup` and `restore --verify` (copies outside the project and a checked put-back), `report write` (`.plan2code-dead-code/reports/DEAD-CODE-<date>.md`; `tool` one id or a list of ids) and `gitignore-check` / `gitignore-add`. Writes only code removals the agent makes, `keep.md` and, on a yes, a report and the `.gitignore` line |
| `agents-md.mjs` | init, init-update | AGENTS.md structure, budget, orphans, broken links, always-inline sections. With no AGENTS.md yet (Init's run, so said once), `notices` warns when `.gitignore` keeps `specs--completed/` out of git, since archived specs are then not backed up |
| `agent-files.mjs` | init, init-update | Detect and replace other agents' config files with AGENTS.md pointers |
| `pathfinder.mjs` (own) | 0-pathfinder | `init` (the map in its Step 5 state from `--destination`, `--scores` and `--fog`; refuses an existing map) and `add` (the next `questions/NN-<slug>.md` plus its map row), with the references' templates kept as the fallback, then `reconcile`, `frontier`, `claim`, `resolve`, `rule-out`, `trail`, `gate` (which also prints the exact PLAN-DRAFT status line `specs.mjs` reads), `lint`, `brief-data`. Writes rows as `[Name](link): tail` with no em dash, and still reads maps written the old way |
@@ -87,6 +87,7 @@ The fast lane is `npm run test:fast` (`scripts/test-fast.mjs`): it runs the file
| One web console area (server routes, chat, git board, workspace, notepad, Implementation Loop...) | that area's `scripts/test-web-console-<area>.mjs` (the loop's is `test-web-console-loop.mjs`), and its `test-web-console-page-<area>.mjs` when the page changed; `node scripts/parse-check.mjs` after editing any browser module under `public/` |
| The launcher (`src/launcher/`) | `node --test scripts/test-launcher.mjs` |
| A skill's script | `npm run build:skills`, then `node --test scripts/test-script-<skill>.mjs` (and `test-skill-scripts.mjs` for the shared plumbing) |
| Dead Code (`src/plan2code-dead-code-scripts/`, `scripts/fixtures/dead-code/`) | `npm run build:skills`, then `node scripts/node-test.mjs scripts/test-script-dead-code.mjs` |
| A workflow prompt (`src/plan2code-*.md`) | `node scripts/validate-char-count.js` and `node scripts/check-skill-table.mjs` |
| A new skill or console workflow | First update the hand-written tables that list every workflow: the `SUBAGENT_WORKFLOWS` count and the meter's `WEIGHTS`, `LAUNCH_LABELS` and `RUN_LABELS` in `test-web-console-logic.mjs`, `notesFor` in `test-web-console-speed.mjs`, the event list in `src/web-console/console-meter.md` (checked by `test-web-console-chat-stress.mjs`) and a `BUDGETS.notes` entry in `test-console-wire-budgets.mjs`. Then run those four suites plus `test-web-console-skills.mjs` and `test-web-console-spec-states.mjs`; the PR Prep and Test build missed all five tables and only the full suite caught them |
| Docs or comments only | `node --test scripts/test-us-english.mjs scripts/test-line-endings.mjs` |
+1 -1
View File
@@ -310,7 +310,7 @@ Built for a mixed product and engineering room reading one screen together.
- **One width variable.** `--card-width` on `:root` in `styles/tokens.css` sets the column the card, the pager and the document tabs share (`max-width: min(var(--card-width), 100%)`, so a narrow window still wins); no fixed `720px` column rule is left outside a media query. Three presets, picked under *Card width* in the looks panel and saved as `looks.width`: `narrow` 720px, `comfortable` 880px (the default, and the variable's own value), `wide` 1080px, applied as `:root[data-width="…"]`. `CARD_WIDTHS` in `palette.js` is the same list for the page's validation and the server's first-paint `data-width`; **`palette.js` and `app.css` must agree**, which is the one place the number is written twice. The dashboard keeps its own 860px layout. Inside the card the `62ch` / `68ch` measure caps come off (`.card .md, .card .prompt { max-width: none; }`) so a wider card is not a narrow column in a wide frame; documents keep `.md`'s 68ch.
- **One box grows.** On the primary card, the answer box that is being typed in — a `text` question's box, a choice's *Something else* box once picked, or the note under a verdict / confirm / recap once shown — is `textarea.grow`, and the card takes the column's full height above the pager (`.card.is-primary.has-grow { flex: 1 1 auto; }`). `fitGrowBox()` in `app.js` writes the card's free height as the box's `min-height`, **never under 160px**; a `ResizeObserver` watches the main column rather than the box, so the box growing can never retrigger it, and it writes only on a change over 1px. `resize: vertical` with that moving floor makes the handle taller-only; past the fill the card scrolls. Every other box keeps its ordinary size, and the notes panel is untouched.
- **A switch per sound.** Every cue is an event in `SOUND_EVENTS` (`palette.js`), each naming its file and rank: `startSkill` (`sounds/sound-01.mp3`, played once the dashboard's **Start** is accepted) 5, `bootup` 4, `sessionStart` / `sessionEnd` (`sounds/sound-02.mp3`) 3, `question` / `skillReady` / `chatReply` (`sounds/sound-03.mp3`) 2, `newTab` (`sounds/sound-04.mp3`) 1, `snore` (`sleeping.mp3`, looped by the wake-up outside the queue) 0. The queue, the held slot and the one-at-a-time rule in `app.js` work on events, one `Audio` per file shared by the events that use it. User Preferences shows a *Play sounds* master (`looks.sound`) over one box per event, saved flat as `sound<Event>` (`soundStartSkill`, …) because `looks.json` only holds flat values; `soundPrefs()` turns any missing or non-boolean switch on, so a file from before the switches keeps every sound. A cue plays only while the master and its own switch are both on; the master off grays the boxes but keeps their ticks, and ticking a box plays it. Seven cues (not `snore` or `bootup`) also keep a pick out of the 19 files in `public/sounds/`, saved flat as `soundFile<Event>` (`soundFileQuestion`); `soundFilePrefs()` validates it against `SOUND_FILES` and a missing or unknown value falls back to the event's default, `sound.js` plays it, and the picker's select and Play button call `previewSound()`, which cuts off what is playing and is dropped behind a still-audible ranked cue.
- **A switch per sound.** Every cue is an event in `SOUND_EVENTS` (`palette.js`), each naming its file and rank: `startSkill` (`sounds/sound-14.mp3`, played once the dashboard's **Start** is accepted) 5, `bootup` 4, `sessionStart` (`sounds/sound-07.mp3`) / `sessionEnd` (`sounds/sound-15.mp3`) 3, `question` (`sounds/sound-14.mp3`) / `skillReady` (`sounds/sound-16.mp3`) / `chatReply` (`sounds/sound-06.mp3`) 2, `newTab` (`sounds/sound-05.mp3`) 1, `snore` (`sleeping.mp3`, looped by the wake-up outside the queue) 0. The queue, the held slot and the one-at-a-time rule in `app.js` work on events, one `Audio` per file shared by the events that use it. User Preferences shows a *Play sounds* master (`looks.sound`) over one box per event, saved flat as `sound<Event>` (`soundStartSkill`, …) because `looks.json` only holds flat values; `soundPrefs()` turns any missing or non-boolean switch on, so a file from before the switches keeps every sound. A cue plays only while the master and its own switch are both on; the master off grays the boxes but keeps their ticks, and ticking a box plays it. Seven cues (not `snore` or `bootup`) also keep a pick out of the 19 files in `public/sounds/`, saved flat as `soundFile<Event>` (`soundFileQuestion`); `soundFilePrefs()` validates it against `SOUND_FILES` and a missing or unknown value falls back to the event's default, `sound.js` plays it, and the picker's select and Play button call `previewSound()`, which cuts off what is playing and is dropped behind a still-audible ranked cue.
- **Send breathes.** `#btn-send:not(:disabled)` runs `send-pulse`, a soft accent ring that spreads and fades every 2.4s; a disabled Send is still, and reduced motion switches it off.
- **Per-tab scroll memory.** An in-memory `Map` keyed by view id holds the scroller's position (the main column on a document or the Overview, the card on the questions view, with the item it belonged to), restored when the tab comes back. Page-local, never persisted, cleared when the session turns into or out of the dashboard.
- **The Overview tab.** Appears only while `GET /overview` returns a file for the session's spec (on the dashboard: the picker's spec; gone for *start from scratch*), fetched with `no-store` on load, on a spec change and on every tab click, so it always shows the file as it is on disk. On the dashboard, a spec with no overview gets a **Map** tab (`?file=map`, `pathfinder/map.md`) and a **Plan draft** tab (`?file=draft`, the live `PLAN-DRAFT-*.md`) in its place, each while its file exists, fetched and drawn the same way; away from the dashboard only the overview is read, since a session's own map or draft is the work already in front of it. Rendered through the same DOM-only markdown path as every doc, captioned read-only. It never becomes a doc: the page is not the record.
+3 -3
View File
@@ -55,7 +55,7 @@ Scroll down for the utilities. Outside a git repository the **Git** card says so
<picture>
<source media="(prefers-color-scheme: dark)" srcset="../docs/screenshots/dashboard-utilities-dark.webp">
<img src="../docs/screenshots/dashboard-utilities-light.webp" alt="The utility cards: Quick task, Review, Handoff and Git, which notes that the folder is not a git repository yet and offers to start one.">
<img src="../docs/screenshots/dashboard-utilities-light.webp" alt="The utility cards: Get a PR ready, Write missing tests, Clear out dead code, Changelog, Git, which notes that the folder is not a git repository yet and offers to start one, and Handoff.">
</picture>
---
@@ -322,8 +322,8 @@ command and the app use, so all three agree):
system are listed, each with a Copy button, beside an **Install page** link.
**Check again** re-runs the lookup without restarting anything, so an agent you just installed
turns up. Under the list are four starter templates (GitHub Copilot CLI, OpenCode, Gemini CLI,
Pi): starting setups for agent CLIs Plan2Code does not ship, which fill in the same form as adding
turns up. Under the list are five starter templates (GitHub Copilot CLI, OpenCode, Gemini CLI,
Pi, Cursor CLI): starting setups for agent CLIs Plan2Code does not ship, which fill in the same form as adding
an agent by hand and save as custom agents. The page's Help has a *Setting up an agent* topic, and
signing in to the agent itself is always your own step.
+2 -2
View File
@@ -4,7 +4,7 @@ This file provides guidance to AI coding agents working with code in this reposi
## Project Overview
Plan2Code is a structured 4-step workflow methodology for AI-assisted software development. It provides prompt templates (skills) that the `skills` CLI installs globally or per-project into any agent it supports (README's "Supported tools" lists them). The `plan2code` command and the desktop app launch the dashboard directly in the built-in agents of `src/launcher/agents.json` (Claude Code, Devin, Codex); Copilot CLI, OpenCode, Gemini CLI and Pi are starter templates there, and any other agent CLI can be added as a custom agent.
Plan2Code is a structured 4-step workflow methodology for AI-assisted software development. It provides prompt templates (skills) that the `skills` CLI installs globally or per-project into any agent it supports (README's "Supported tools" lists them). The `plan2code` command and the desktop app launch the dashboard directly in the built-in agents of `src/launcher/agents.json` (Claude Code, Devin, Codex); Copilot CLI, OpenCode, Gemini CLI, Pi and Cursor CLI are starter templates there, and any other agent CLI can be added as a custom agent.
**Version:** Check `version.json` for current version
**Author:** Justin Parker
@@ -36,7 +36,7 @@ Details: [Status line](./.agents-docs/AGENTS-architecture-statusline.md)
## Web Console
Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) installed once under `~/.plan2code/console/<version>/` (`installSharedConsole` in `install.js`) and reached from every skill through a forwarding stub, `src/web-console-stub/console.mjs`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (thirteen small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest<Id>` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-<id>.js`, and keeps a best per course, `activityBestGolf<Course>`), and one number a game may keep between sessions in `activityMemo<Id>` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run, Flock Dash's furthest stage), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, Finalize, Changelog, Git and Handoff) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the twelve helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill facts live inLine truncated
Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) installed once under `~/.plan2code/console/<version>/` (`installSharedConsole` in `install.js`) and reached from every skill through a forwarding stub, `src/web-console-stub/console.mjs`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (thirteen small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest<Id>` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-<id>.js`, and keeps a best per course, `activityBestGolf<Course>`), and one number a game may keep between sessions in `activityMemo<Id>` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run, Flock Dash's furthest stage), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, Finalize, Changelog, Git and Handoff) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the sixteen helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill facts live iLine truncated
One agent list and one lookup rule serve the launcher, the console and the app: `src/launcher/agents.json` (the built-ins and starter templates with per-OS install data) and `src/web-console/agent-lookup.mjs` (`loadAgentList()` and `findAgent()`, both copied by `install.js` into `~/.plan2code/bin/`); the app carries a Rust twin held to the same cases by `scripts/fixtures/agent-lookup-cases.json`.
Building or changing an Activities game: follow the game rules in [Activities](./.agents-docs/AGENTS-architecture-activities.md) ("Building an Activities game": lives in the solid lives pill, the endless-lives code (`cheat(on)`) in every game with lives, banners placed away from the player and see-through over what matters, pausing left to the window).
+1
View File
@@ -49,6 +49,7 @@ Every command below is what a dashboard card runs. Typed on its own, each one as
| diagnose | /plan2code-diagnose | A bug, or none | `DIAGNOSIS-<date>.md` with the cause and its evidence, then Quick Task (or Plan for a big fix) to fix it |
| pr-prep | /plan2code-pr-prep | Your branch | A readiness verdict (Ready, Ready with notes, Not ready) and a PR description to copy; no commits, no push |
| test | /plan2code-test | An area, or none | New unit and integration tests in the project's style, run; a bug handed to Diagnose; no source changes |
| dead-code | /plan2code-dead-code | A folder, or none | Findings labeled Safe, Check first or Warning, then only the removals you pick, checked by the tests and build; no commits, no installs |
| changelog | /plan2code-changelog | Your branch | `CHANGELOG.md` entries and the `package.json` version, from the default branch's latest version |
| git | /plan2code-git | Your repo | Commits (`<subject>` / `AI Assisted`), branches, pull with conflict help, push, publish |
+5 -3
View File
@@ -101,8 +101,8 @@ Devin or Codex, and no working custom agent),
The page lists each agent as **Found**, **Found outside PATH** or **Not found**, with its install
commands for your system, a Copy button per command and an **Install page** link. Install one and
press **Check again**: no restart needed. An agent found outside `PATH` gets **Use it from here**,
which saves where it was found so you never touch `PATH` yourself. Below the list sit four starter
templates (GitHub Copilot CLI, OpenCode, Gemini CLI and Pi) for agents Plan2Code does not ship.
which saves where it was found so you never touch `PATH` yourself. Below the list sit five starter
templates (GitHub Copilot CLI, OpenCode, Gemini CLI, Pi and Cursor CLI) for agents Plan2Code does not ship.
**Start with this agent** carries the run straight on in the same tab, onto the new agent's
dashboard. Naming a built-in that is missing with `--cli <name>` opens the same page on that agent
(a missing custom agent prints its own steps and exits 127). In the
@@ -147,7 +147,7 @@ plain `plan2code` command above, without the app, asks instead, with prompts off
GitHub Copilot · Windsurf · Codex · Continue · Codeium · Zed · Amp · OpenCode · Devin · Crush · Pi ·
Gemini CLI · Cline · Roo · Kilo · Goose · Trae · Qwen Code.
**Launched by `plan2code`:** the `plan2code` command and the desktop app open the dashboard directly in Claude Code, Devin and Codex (the built-ins in `src/launcher/agents.json`). GitHub Copilot CLI, OpenCode, Gemini CLI and Pi come as starter templates, and you can add any other agent CLI as a custom agent in User Preferences → Agents & models.
**Launched by `plan2code`:** the `plan2code` command and the desktop app open the dashboard directly in Claude Code, Devin and Codex (the built-ins in `src/launcher/agents.json`). GitHub Copilot CLI, OpenCode, Gemini CLI, Pi and Cursor CLI come as starter templates, and you can add any other agent CLI as a custom agent in User Preferences → Agents & models.
The installer keeps one canonical copy of each skill under `~/.agents/skills/` and links it into
agents that maintain their own directory. To update, run `plan2code update` (or re-run the install command); to remove it all, run `plan2code uninstall`.
@@ -257,6 +257,7 @@ The dashboard's cards, and when each one lights up for the spec you pick:
| Diagnose a bug | Find a bug's cause and write it up, without fixing it. | Always |
| Get a PR ready | Runs the checks your branch needs, says if it is ready, and writes the PR description to copy. Never commits, pushes or opens the PR. | Always |
| Write missing tests | Finds code with no tests and writes unit and integration tests in your project's own style. Never changes source code. | Always |
| Clear out dead code | Finds code nothing uses, says how safe each piece is to remove, and removes only what you pick. Uses the dead-code tools your project already has, and never commits. | Always |
| Changelog | Checks the CHANGELOG version against the main branch and suggests entries for what is new. | Always |
| Git | Branches, pull, push and commits on one board, asking before anything leaves your machine. | Always (offers to start a repository outside one) |
@@ -429,6 +430,7 @@ console or the terminal; add `--web` to skip the question and go straight to the
| `/plan2code-diagnose` | Find a bug's cause and write it up as `specs/<bug-name>/DIAGNOSIS-<date>.md` without fixing it, then offer `/plan2code-quick-task` to fix it, or `/plan2code-1-plan` when the fix is big |
| `/plan2code-pr-prep` | Before you open a pull request. Picks the checks the branch's changes need from the project's `## Test map` (or its config files), runs the ones you keep, says Ready, Ready with notes or Not ready, and writes a PR description to copy with the create-a-PR link; never commits, pushes or opens the PR |
| `/plan2code-test` | Parts of the code have no tests. Asks where to look, finds the untested files (plus real coverage when the project already has a coverage tool), shows a plan in the project's own style, then writes and runs unit and integration tests; never changes source code, hands a real bug to `/plan2code-diagnose` |
| `/plan2code-dead-code` | Code nothing calls anymore. Uses the project's own dead-code tools, one per language (Knip, vulture, cargo check and others), or searches by itself, checks every item for callers across the project, labels each Safe to remove, Check first or Warning, removes only what you pick, then runs the tests and build and puts back anything that breaks them; never commits, never installs anything |
| `/plan2code-changelog` | Check the CHANGELOG version against the default branch, suggest entries for new work you can edit, keep `package.json` aligned, then hand off to Git to commit |
| `/plan2code-git` | Branches, pull, push and commits on one board (or plain instructions in the terminal); asks before every push, publish and delete |
Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 127 KiB

+17
View File
@@ -388,6 +388,22 @@ const SOURCE_PROMPTS = [
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }
]
},
{
source: 'plan2code-dead-code.md',
stepNumber: 'dead-code',
name: 'dead-code',
displayName: 'Dead Code Mode',
description: 'Find unused code and dead code, show how safe each is to remove, and remove only what you pick',
// Shown to the agent in place of the generic header text: when the skill fits and its command.
skillDescription: "Use when you want unused code paths and dead code in your project found, labeled by how safe each is to remove, and removed only where you pick. Run it as /plan2code-dead-code.",
isUtility: true,
scripts: ['test-map.mjs', 'glob.mjs', 'test-commands.mjs', 'run-check.mjs'],
additionalReferences: [
{ source: 'web-console', target: 'web-console' },
{ source: 'plan2code-dead-code-references/caller-search.md', target: 'caller-search.md' },
{ source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }
]
},
{
source: 'plan2code-changelog.md',
stepNumber: 'changelog',
@@ -440,6 +456,7 @@ function generateStepLabel(prompt) {
if (prompt.stepNumber === 'diagnose') return 'Diagnose';
if (prompt.stepNumber === 'pr-prep') return 'PR Prep';
if (prompt.stepNumber === 'test') return 'Test';
if (prompt.stepNumber === 'dead-code') return 'Dead Code';
if (prompt.stepNumber === 'changelog') return 'Changelog';
if (prompt.stepNumber === 'quick') return 'Quick Task';
return `Step ${prompt.stepNumber}`;
+1 -1
View File
@@ -12,7 +12,7 @@
"play": "node scripts/play.mjs",
"pretest": "node scripts/fix-line-endings.mjs",
"test:fast": "node scripts/test-fast.mjs",
"test": "node scripts/check-test-lanes.mjs && node scripts/validate-char-count.js && node install.js --build-skills && node scripts/check-versions.mjs && node scripts/check-doc-size.mjs && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node scripts/check-prompt-wording.mjs && node scripts/check-console-openings.mjs && node scripts/node-test.mjs scripts/test-line-endings.mjs scripts/test-us-english.mjs scripts/test-script-git.mjs scripts/test-git-repo.mjs scripts/test-skill-scripts.mjs scripts/test-script-test-map.mjs scripts/test-script-test-match.mjs scripts/test-script-test-commands.mjs scripts/test-script-run-check.mjs scripts/test-script-pr-prep.mjs scripts/test-script-coverage.mjs scripts/test-script-changelog.mjs scripts/test-web-console-git.mjs scripts/test-web-console-git-board.mjs scripts/test-web-console-chat.mjs scripts/test-web-console-subagents.mjs scripts/test-web-console-pointers.mjs scripts/test-console-wire-budgets.mjs scripts/test-web-console-speed.mjs scripts/test-web-console-qa.mjs scripts/test-web-console-concurrency.mjs scripts/test-web-console-workspace.mjs scripts/test-web-console-lifecycle.mjs scripts/test-web-console-chat-stress.mjs scripts/test-web-console-server.mjs scripts/test-web-console-session.mjs scripts/test-web-console-logic.mjs scripts/test-web-console-agents-doc.mjs scripts/test-web-console-activities.mjs scripts/test-web-console-activities-rapids.mjs scripts/test-web-console-activities-flock.mjs scripts/test-web-console-activities-bounce.mjs scripts/test-web-console-activities-bounce-game.mjs scripts/test-web-console-activities-ghoul.mjs scripts/test-web-console-activities-ghoul-graveyard.mjs scripts/test-web-console-activities-ghoul-grounds.mjs scripts/test-web-console-activities-ghoul-chapel.mjs scripts/test-web-console-activities-ghoul-sanatorium.mjs scripts/test-web-console-activities-ghoul-village.mjs scripts/test-web-console-activities-ghoul-mine.mjs scripts/test-web-console-activities-ghoul-carnival.mjs scripts/test-web-console-activities-ghoul-frozen.mjs scripts/test-web-console-activities-ghoul-bog.mjs scripts/test-web-console-activities-ghoul-lantern.mjs scripts/test-web-console-activities-ghoul-marrow.mjs scripts/test-web-console-activities-ghoul-mat.mjs scripts/test-web-console-activities-ghoul-eye.mjs scripts/test-web-console-activities-ghoul-bonestair.mjs scripts/test-web-console-activities-ghoul-heart.mjs scripts/test-web-console-activities-ghoul-ending.mjs scripts/test-web-console-activities-ghoul-ride.mjs scripts/test-web-console-activities-ghoul-cart.mjs scripts/test-web-console-activities-ghoul-sled.mjs scripts/test-web-console-activities-ghoul-banister.mjs scripts/test-web-console-activities-ghoul-gurney.mjs scripts/test-web-console-activities-ghoul-hearse.mjs scripts/test-web-console-activities-ghoul-wagon.mjs scripts/test-web-console-activities-ghoul-pew.mjs scripts/test-web-console-activities-ghoul-mower.mjs scripts/test-web-console-activities-ghoul-tray.mjs scripts/test-web-console-activities-ghoul-arms.mjs scripts/test-web-console-activities-ghoul-dice.mjs scripts/test-web-console-activities-ghoul-gameover.mjs scripts/test-web-console-activities-ghoul-intro.mjs scripts/test-web-console-activities-ghoul-bossintro.mjs scripts/test-web-console-activities-ghoul-story.mjs scripts/test-web-console-activities-ghoul-bones.mjs scripts/test-web-console-activities-ghoul-retry.mjs scripts/test-web-console-activities-bounce-cars.mjs scripts/test-web-console-tones.mjs scripts/test-web-console-skills.mjs scripts/test-web-console-spec-states.mjs scripts/test-web-console-state.mjs scripts/test-web-console-send-state.mjs scripts/test-web-console-strengths.mjs scripts/test-web-console-shape.mjs scripts/test-script-pathfinder.mjs scripts/test-skill-test-runs.mjs scripts/test-launcher.mjs scripts/test-agents-file.mjs scripts/test-agent-lookup.mjs scripts/test-web-console-source.mjs scripts/test-web-console-hardening.mjs scripts/test-web-console-embed.mjs scripts/test-web-console-in-app.mjs scripts/test-web-console-loop.mjs scripts/test-web-console-handoffs.mjs scripts/test-web-console-notepad.mjs scripts/test-script-xray.mjs scripts/test-script-finalize.mjs scripts/test-getting-started.mjs scripts/test-install-update.mjs scripts/test-browser-helper.mjs scripts/test-web-console-page-cards.mjs scripts/test-web-console-page-dashboard.mjs scripts/test-web-console-page-session.mjs scripts/test-web-console-page-ask.mjs scripts/test-web-console-page-workspace.mjs scripts/test-web-console-page-help.mjs scripts/test-web-console-page-prefs.mjs scripts/test-web-console-page-git.mjs scripts/test-web-console-page-notepad.mjs scripts/test-web-console-page-send.mjs scripts/test-web-console-page-loop.mjs scripts/test-web-console-page-activities.mjs scripts/test-web-console-page-setup.mjs scripts/test-standalone-check.mjs scripts/test-check-versions.mjs scripts/test-app-meter.mjs scripts/test-check-test-lanes.mjs scripts/test-check-doc-size.mjs scripts/tLine truncated
"test": "node scripts/check-test-lanes.mjs && node scripts/validate-char-count.js && node install.js --build-skills && node scripts/check-versions.mjs && node scripts/check-doc-size.mjs && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node scripts/check-prompt-wording.mjs && node scripts/check-console-openings.mjs && node scripts/node-test.mjs scripts/test-line-endings.mjs scripts/test-us-english.mjs scripts/test-script-git.mjs scripts/test-git-repo.mjs scripts/test-skill-scripts.mjs scripts/test-script-test-map.mjs scripts/test-script-test-match.mjs scripts/test-script-test-commands.mjs scripts/test-script-run-check.mjs scripts/test-script-pr-prep.mjs scripts/test-script-dead-code.mjs scripts/test-script-coverage.mjs scripts/test-script-changelog.mjs scripts/test-web-console-git.mjs scripts/test-web-console-git-board.mjs scripts/test-web-console-chat.mjs scripts/test-web-console-subagents.mjs scripts/test-web-console-pointers.mjs scripts/test-console-wire-budgets.mjs scripts/test-web-console-speed.mjs scripts/test-web-console-qa.mjs scripts/test-web-console-concurrency.mjs scripts/test-web-console-workspace.mjs scripts/test-web-console-lifecycle.mjs scripts/test-web-console-chat-stress.mjs scripts/test-web-console-server.mjs scripts/test-web-console-session.mjs scripts/test-web-console-logic.mjs scripts/test-web-console-agents-doc.mjs scripts/test-web-console-activities.mjs scripts/test-web-console-activities-rapids.mjs scripts/test-web-console-activities-flock.mjs scripts/test-web-console-activities-bounce.mjs scripts/test-web-console-activities-bounce-game.mjs scripts/test-web-console-activities-ghoul.mjs scripts/test-web-console-activities-ghoul-graveyard.mjs scripts/test-web-console-activities-ghoul-grounds.mjs scripts/test-web-console-activities-ghoul-chapel.mjs scripts/test-web-console-activities-ghoul-sanatorium.mjs scripts/test-web-console-activities-ghoul-village.mjs scripts/test-web-console-activities-ghoul-mine.mjs scripts/test-web-console-activities-ghoul-carnival.mjs scripts/test-web-console-activities-ghoul-frozen.mjs scripts/test-web-console-activities-ghoul-bog.mjs scripts/test-web-console-activities-ghoul-lantern.mjs scripts/test-web-console-activities-ghoul-marrow.mjs scripts/test-web-console-activities-ghoul-mat.mjs scripts/test-web-console-activities-ghoul-eye.mjs scripts/test-web-console-activities-ghoul-bonestair.mjs scripts/test-web-console-activities-ghoul-heart.mjs scripts/test-web-console-activities-ghoul-ending.mjs scripts/test-web-console-activities-ghoul-ride.mjs scripts/test-web-console-activities-ghoul-cart.mjs scripts/test-web-console-activities-ghoul-sled.mjs scripts/test-web-console-activities-ghoul-banister.mjs scripts/test-web-console-activities-ghoul-gurney.mjs scripts/test-web-console-activities-ghoul-hearse.mjs scripts/test-web-console-activities-ghoul-wagon.mjs scripts/test-web-console-activities-ghoul-pew.mjs scripts/test-web-console-activities-ghoul-mower.mjs scripts/test-web-console-activities-ghoul-tray.mjs scripts/test-web-console-activities-ghoul-arms.mjs scripts/test-web-console-activities-ghoul-dice.mjs scripts/test-web-console-activities-ghoul-gameover.mjs scripts/test-web-console-activities-ghoul-intro.mjs scripts/test-web-console-activities-ghoul-bossintro.mjs scripts/test-web-console-activities-ghoul-story.mjs scripts/test-web-console-activities-ghoul-bones.mjs scripts/test-web-console-activities-ghoul-retry.mjs scripts/test-web-console-activities-bounce-cars.mjs scripts/test-web-console-tones.mjs scripts/test-web-console-skills.mjs scripts/test-web-console-spec-states.mjs scripts/test-spec-carry.mjs scripts/test-spec-carry-page.mjs scripts/test-web-console-state.mjs scripts/test-web-console-send-state.mjs scripts/test-web-console-strengths.mjs scripts/test-web-console-shape.mjs scripts/test-script-pathfinder.mjs scripts/test-skill-test-runs.mjs scripts/test-launcher.mjs scripts/test-agents-file.mjs scripts/test-agent-lookup.mjs scripts/test-web-console-source.mjs scripts/test-web-console-hardening.mjs scripts/test-web-console-embed.mjs scripts/test-web-console-in-app.mjs scripts/test-web-console-loop.mjs scripts/test-web-console-handoffs.mjs scripts/test-web-console-notepad.mjs scripts/test-script-xray.mjs scripts/test-script-finalize.mjs scripts/test-getting-started.mjs scripts/test-install-update.mjs scripts/test-browser-helper.mjs scripts/test-web-console-page-cards.mjs scripts/test-web-console-page-dashboard.mjs scripts/test-web-console-page-session.mjs scripts/test-web-console-page-ask.mjs scripts/test-web-console-page-workspace.mjs scripts/test-web-console-page-help.mjs scripts/test-web-console-page-prefs.mjs scripts/test-web-console-page-git.mjs scripts/test-web-console-page-notepad.mjs scripts/test-web-console-page-send.mjs scripts/test-web-console-page-loop.mjs scripts/test-web-console-page-activities.mjs scripts/test-web-console-page-setup.mjs scripts/test-standalone-check.mjs scripts/test-check-versions.mjs scriptsLine truncated
},
"devDependencies": {
"gpt-tokenizer": "2.9.0",
+2 -2
View File
@@ -76,7 +76,7 @@ export function check(srcDir) {
if (!note) problems.push(`${file}: names no <D>/notes/<workflow>.md file`);
else if (!fs.existsSync(path.join(notesDir, `${note[1]}.md`))) problems.push(`${file}: notes file ${note[1]}.md is not in src/web-console/notes/`);
}
if (seen !== 18) problems.push(`expected 18 skills with a console opening, found ${seen}`);
if (seen !== 19) problems.push(`expected 19 skills with a console opening, found ${seen}`);
return problems;
}
@@ -87,5 +87,5 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
for (const p of problems) console.error(` FAIL ${p}`);
process.exit(1);
}
console.log("All 18 console openings share their sentences.");
console.log("All 19 console openings share their sentences.");
}
+10
View File
@@ -0,0 +1,10 @@
{"reason":"compiler-artifact","package_id":"demo 0.1.0","target":{"name":"demo"}}
{"reason":"compiler-message","package_id":"demo 0.1.0","message":{"code":{"code":"dead_code","explanation":null},"level":"warning","message":"function `old_helper` is never used","spans":[{"file_name":"src/lib.rs","line_start":8,"line_end":8,"is_primary":true}]}}
{"reason":"compiler-message","package_id":"demo 0.1.0","message":{"code":{"code":"dead_code","explanation":null},"level":"warning","message":"function `old_helper` is never used","spans":[{"file_name":"src/lib.rs","line_start":8,"line_end":8,"is_primary":true}]}}
{"reason":"compiler-message","package_id":"demo 0.1.0","message":{"code":{"code":"unused_imports","explanation":null},"level":"warning","message":"unused import: `std::io`","spans":[{"file_name":"src/main.rs","line_start":1,"line_end":1,"is_primary":true}]}}
{"reason":"compiler-message","package_id":"demo 0.1.0","message":{"code":{"code":"E0425","explanation":"..."},"level":"error","message":"cannot find value `x` in this scope","spans":[{"file_name":"src/main.rs","line_start":5,"line_end":5,"is_primary":true}]}}
{"reason":"compiler-message","package_id":"demo 0.1.0","message":{"code":null,"level":"warning","message":"1 warning emitted","spans":[]}}
{"reason":"build-finished","success":true}
{"reason":"compiler-message","package_id":"demo 0.1.0","message":{"code":{"code":"unused_imports","explanation":null},"level":"warning","message":"unused imports: `fmt` and `io`","spans":[{"file_name":"src/net.rs","line_start":2,"line_end":2,"column_start":11,"column_end":14,"is_primary":true,"text":[{"text":"use std::{fmt, io};","highlight_start":11,"highlight_end":14}]},{"file_name":"src/net.rs","line_start":2,"line_end":2,"column_start":16,"column_end":18,"is_primary":true,"text":[{"text":"use std::{fmt, io};","highlight_start":16,"highlight_end":18}]}]}}
{"reason":"compiler-message","package_id":"demo 0.1.0","message":{"code":{"code":"dead_code","explanation":null},"level":"warning","message":"multiple fields are never read","spans":[{"file_name":"src/model.rs","line_start":3,"line_end":3,"column_start":5,"column_end":9,"is_primary":false,"text":[{"text":"pub struct Model {","highlight_start":12,"highlight_end":17}]},{"file_name":"src/model.rs","line_start":4,"line_end":4,"column_start":5,"column_end":9,"is_primary":true,"text":[{"text":" name: String,","highlight_start":5,"highlight_end":9}]},{"file_name":"src/model.rs","line_start":5,"line_end":5,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" age: u32,","highlight_start":5,"highlight_end":8}]}]}}
{"reason":"compiler-message", broken
@@ -0,0 +1,3 @@
internal/report/format.go:12:6: unreachable func: formatLegacy
cmd/tool/main.go:40:6: unreachable func: (*server).shutdownOld
not a deadcode line
+1
View File
@@ -0,0 +1 @@
{"files":["src/old.ts"],"issues":[{"file":"src/utils.ts","dependencies":[],"devDependencies":[],"files":[],"exports":[{"name":"formatDate","line":12,"col":17,"pos":250}],"types":[{"name":"Options","line":3,"col":13,"pos":40}],"enumMembers":{"Color":[{"name":"Purple","line":20,"col":3,"pos":400}]},"classMembers":{"Cache":[{"name":"flush","line":31,"col":3,"pos":600}]},"duplicates":[[{"name":"parse","line":40,"col":17},{"name":"default","line":44,"col":1}]]},{"file":"src/dead.ts","files":true,"exports":[],"types":[]},{"file":"src/broken.ts","exports":[{"line":2}]}]}
+30
View File
@@ -0,0 +1,30 @@
{
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
"version": "2.1.0",
"runs": [
{
"tool": { "driver": { "name": "PMD", "version": "7.29.0" } },
"results": [
{
"ruleId": "UnusedPrivateMethod",
"message": { "text": "Avoid unused private methods such as 'helper(String)'." },
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "src/main/java/app/Service.java" }, "region": { "startLine": 42 } } }]
},
{
"ruleId": "UnusedPrivateField",
"message": { "text": "Avoid unused private fields such as 'cache'." },
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "src/main/java/app/Store.java" }, "region": { "startLine": 7 } } }]
},
{
"ruleId": "UseUtilityClass",
"message": { "text": "This utility class has a non-private constructor" },
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "src/main/java/app/Util.java" }, "region": { "startLine": 3 } } }]
},
{
"ruleId": "UnusedLocalVariable",
"message": { "text": "Avoid unused local variables such as 'tmp'." }
}
]
}
]
}
+25
View File
@@ -0,0 +1,25 @@
{
"version": "2.1.0",
"runs": [
{
"tool": { "driver": { "name": "Psalm", "version": "7.2.0" } },
"results": [
{
"ruleId": "PossiblyUnusedMethod",
"message": { "text": "Cannot find any calls to method App\\Mailer::sendLater" },
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "file:///ROOT/src/Mailer.php" }, "region": { "startLine": 18 } } }]
},
{
"ruleId": "UnusedClass",
"message": { "text": "Class `App\\Legacy` is never used" },
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "src/Legacy.php" }, "region": { "startLine": 5 } } }]
},
{
"ruleId": "UnreachableCode",
"message": { "text": "Unreachable code" },
"locations": [{ "physicalLocation": { "artifactLocation": { "uri": "src/Flow.php" }, "region": { "startLine": 30 } } }]
}
]
}
]
}
+5
View File
@@ -0,0 +1,5 @@
app/models.py:3: unused import 'os' (90% confidence)
app/models.py:14: unused function 'legacy_total' (60% confidence)
app/views.py:22: unused variable 'retries' (60% confidence, 1 line)
app/views.py:40: unreachable code after 'return' (100% confidence)
this line is mangled
+2 -1
View File
@@ -58,7 +58,7 @@ test("a wrong workflow name or a missing notes file is reported", () => {
test("a skill that loses its opening is caught by the count", () => {
const dir = copySrc();
fs.rmSync(path.join(dir, "plan2code-pr-prep.md"));
assert.match(check(dir).join("\n"), /expected 18 skills with a console opening, found 17/);
assert.match(check(dir).join("\n"), /expected 19 skills with a console opening, found 18/);
});
test("helpers", () => {
@@ -66,6 +66,7 @@ test("helpers", () => {
assert.equal(workflowOf("plan2code-1b-revise-plan"), "revise-plan");
assert.equal(workflowOf("plan2code-3-implement-review"), "implement-review");
assert.equal(workflowOf("plan2code-pr-prep"), "pr-prep");
assert.equal(workflowOf("plan2code-dead-code"), "dead-code");
});
test("the CLI exits 1 on drift", () => {
+1
View File
@@ -29,6 +29,7 @@ export const BUDGETS = {
// Each topic file under notes/, read when its workflow starts.
notes: {
"changelog.md": 1400,
"dead-code.md": 4250,
"diagnose.md": 2700,
"document.md": 400,
"finalize.md": 2000,
+3
View File
@@ -15,6 +15,7 @@
"test-line-endings.mjs",
"test-script-changelog.mjs",
"test-script-coverage.mjs",
"test-script-dead-code.mjs",
"test-script-finalize.mjs",
"test-script-git.mjs",
"test-script-pathfinder.mjs",
@@ -27,6 +28,8 @@
"test-set-version.mjs",
"test-skill-scripts.mjs",
"test-skill-test-runs.mjs",
"test-spec-carry-page.mjs",
"test-spec-carry.mjs",
"test-us-english.mjs",
"test-web-console-agents-doc.mjs",
"test-web-console-git-board.mjs",
File diff suppressed because it is too large. Load diff
+6 -2
View File
@@ -70,11 +70,15 @@ test("every script a SKILL.md (or a reference it ships) runs exists beside it, a
});
test("scripts are self-contained: built-ins and siblings only", () => {
for (const dir of [path.join(ROOT, "src", "skill-scripts"), ...fs.readdirSync(path.join(ROOT, "src")).filter((n) => n.endsWith("-scripts")).map((n) => path.join(ROOT, "src", n))]) {
const shared = path.join(ROOT, "src", "skill-scripts");
for (const dir of [shared, ...fs.readdirSync(path.join(ROOT, "src")).filter((n) => n.endsWith("-scripts")).map((n) => path.join(ROOT, "src", n))]) {
for (const f of fs.readdirSync(dir).filter((n) => n.endsWith(".mjs"))) {
const t = fs.readFileSync(path.join(dir, f), "utf8");
for (const m of t.matchAll(/^import .* from "([^"]+)";$/gm)) {
const sibling = /^\.\/[\w-]+\.mjs$/.test(m[1]) && fs.existsSync(path.join(dir, m[1]));
// A skill's own script may import a shared script too: the build lays
// both in one scripts/ folder, and the check below holds the skill to
// shipping it.
const sibling = /^\.\/[\w-]+\.mjs$/.test(m[1]) && (fs.existsSync(path.join(dir, m[1])) || fs.existsSync(path.join(shared, m[1])));
assert.ok(m[1].startsWith("node:") || m[1] === "./common.mjs" || sibling, `${f} imports ${m[1]}`);
}
assert.ok(!/[\u0000-\u0008]/.test(t), `${f} contains a control character (an escape lost in an edit?)`);
+6 -6
View File
@@ -2085,8 +2085,8 @@ test("workspace cursor never moves backwards, and only changes past it are pendi
}
});
test("subagents: only the fifteen opted-in workflows offer the switch", () => {
for (const w of ["init", "init-update", "pathfinder", "plan", "revise-plan", "document", "implement", "implement-review", "quick-task", "review", "finalize", "xray", "diagnose", "pr-prep", "test"]) {
test("subagents: only the sixteen opted-in workflows offer the switch", () => {
for (const w of ["init", "init-update", "pathfinder", "plan", "revise-plan", "document", "implement", "implement-review", "quick-task", "review", "finalize", "xray", "diagnose", "pr-prep", "test", "dead-code"]) {
assert.equal(offered(w), true, w);
assert.ok(defaultInstruction(w).length > 0, `${w} has a default instruction`);
}
@@ -2094,7 +2094,7 @@ test("subagents: only the fifteen opted-in workflows offer the switch", () => {
assert.equal(offered(w), false, String(w));
assert.equal(defaultInstruction(w), "");
}
assert.equal(Object.keys(SUBAGENT_WORKFLOWS).length, 15);
assert.equal(Object.keys(SUBAGENT_WORKFLOWS).length, 16);
assert.deepEqual(defaultSetting("review"), { workflow: "review", on: true, instruction: null, max: 3, strength: "balanced" });
assert.equal(defaultSetting("changelog").on, false, "a skill without the switch is never on");
assert.equal(effectiveInstruction({ workflow: "review", instruction: " " }), defaultInstruction("review"));
@@ -2384,14 +2384,14 @@ test("meter: the weights and labels built from the skill list are the ones writt
"pathfinder-chart": 2, "pathfinder-question": 0, "pathfinder-research": 1,
plan: 2, "revise-plan": 1, document: 2, "implement-phase": 2, "implement-review-phase": 3,
review: 2, "quick-task": 1, init: 2, "init-update": 2, finalize: 1, handoff: 0, git: 1,
"git-commits": 0, "git-conflict": 1, changelog: 1, xray: 1, diagnose: 1, "pr-prep": 1, test: 1,
"git-commits": 0, "git-conflict": 1, changelog: 1, xray: 1, diagnose: 1, "pr-prep": 1, test: 1, "dead-code": 1,
});
assert.deepEqual({ ...LAUNCH_LABELS }, {
plan: "Plan started", "revise-plan": "Revise plan started", document: "Document started",
review: "Review started", "quick-task": "Quick task started", init: "Init started",
"init-update": "Init update started", finalize: "Finalize started", git: "Git started",
changelog: "Changelog started", xray: "X-ray started", diagnose: "Diagnose started",
"pr-prep": "PR Prep started", test: "Test started",
"pr-prep": "PR Prep started", test: "Test started", "dead-code": "Dead Code started",
});
assert.deepEqual({ ...RUN_LABELS }, {
"pathfinder-chart": "Pathfinder map written", "pathfinder-question": "Pathfinder question settled",
@@ -2401,7 +2401,7 @@ test("meter: the weights and labels built from the skill list are the ones writt
"quick-task": "Quick task built", init: "Init run", "init-update": "Init update run",
finalize: "Finalize run", handoff: "Handoff written", git: "Git run", "git-commits": "Commits in Git",
"git-conflict": "Git conflict help", changelog: "Changelog run", xray: "X-ray run", diagnose: "Diagnose run",
"pr-prep": "PR Prep run", test: "Test run",
"pr-prep": "PR Prep run", test: "Test run", "dead-code": "Dead Code run",
});
for (const t of [WEIGHTS, LAUNCH_LABELS, RUN_LABELS]) assert.ok(Object.isFrozen(t));
});
@@ -212,11 +212,15 @@ test("picking Start from scratch instead of a spec grays Document, and a launch
const document = lightOf(main, "/plan2code-2-document");
await pickedChip(main, "demo").waitFor();
assert.equal(await document.isEnabled(), true, "Document is lit for the drafted spec");
// The top bar names the picked spec beside the meter, and drops it from scratch.
const specTag = main.page().locator("#spec-tag");
assert.ok(await until(async () => (await specTag.isVisible()) && (await specTag.textContent()) === "demo"), "the top bar names the spec demo");
// From scratch there is no draft to document: the card grays.
await chipFor(main, "Start from scratch").click();
await pickedChip(main, "Start from scratch").waitFor();
assert.equal(await document.isDisabled(), true, "Document is grayed with no spec picked");
assert.ok(await until(() => specTag.isHidden()), "the top bar's spec name goes from scratch");
assert.equal(await chipFor(main, "demo").getAttribute("aria-current"), "false");
// Back on the spec it is lit again; then from scratch once more to launch.
@@ -232,6 +236,40 @@ test("picking Start from scratch instead of a spec grays Document, and a launch
assert.ok(!launch.spec, `a launch from scratch names no spec: ${JSON.stringify(launch)}`);
});
// What a person would see break: the Dead Code card missing from Useful any
// time, drawn without its skull, grayed for want of a spec it never takes, or
// launching with the picked spec riding along.
test("the Dead Code card sits in Useful any time with its skull, is lit with or without a spec, and launches with no spec", async (t) => {
const s = await openSession(await suite.browser(), { t, workflow: "dashboard", payload: MENU, project: tempProject(DRAFT_PROJECT) });
const main = await toTheMenu(s);
await hideUnavailable(main, false);
const card = lightOf(main, "/plan2code-dead-code");
await card.waitFor();
const group = main.locator("section.dash-group").filter({ has: s.page.locator("h3", { hasText: /^Useful any time$/ }) });
assert.equal(await group.locator("code", { hasText: /^\/plan2code-dead-code$/ }).count(), 1, "the card is in the Useful any time group");
assert.match(await textOf(card), /Utility/i, "it wears the Utility chip (drawn in capitals)");
assert.match(await textOf(card), /Clear out dead code/, "it has its title");
assert.equal(await card.locator("use").getAttribute("href"), "#ci-dead-code", "its icon is the skull");
assert.equal(await s.page.locator("symbol#ci-dead-code").count(), 1, "the skull symbol is drawn in the icon sheet");
// Lit with no spec picked, and with one.
await chipFor(main, "Start from scratch").click();
await pickedChip(main, "Start from scratch").waitFor();
assert.equal(await card.isEnabled(), true, "lit with no spec picked");
await chipFor(main, "demo").click();
await pickedChip(main, "demo").waitFor();
assert.equal(await card.isEnabled(), true, "lit with a spec picked");
// A launch with the spec still picked names no spec: Dead Code takes none.
await card.click();
await main.getByRole("button", { name: "Start Clear out dead code" }).click();
const launch = collect(s).actions.find((a) => a.i === "__launch");
assert.ok(launch, "the send carries a launch");
assert.deepEqual({ skill: launch.skill, workflow: launch.workflow }, { skill: "plan2code-dead-code", workflow: "dead-code" });
assert.ok(!launch.spec, `a Dead Code launch names no spec: ${JSON.stringify(launch)}`);
});
// What a person would see break: a spec not documented yet offers nothing to
// read, or its Map and Plan draft tabs stay up for a spec that has an
// overview (or for no spec at all).
+10 -10
View File
@@ -947,13 +947,13 @@ test("the Subagents dialog looks as it did before Preferences moved to tabs", as
// seven pickable cues, Planny's snoring and waking keeping plain boxes.
const PICK_EVENTS = ["startSkill", "sessionStart", "skillReady", "sessionEnd", "question", "chatReply", "newTab"];
const PICK_DEFAULTS = {
startSkill: "sound-01",
sessionStart: "sound-02",
skillReady: "sound-03",
sessionEnd: "sound-02",
question: "sound-03",
chatReply: "sound-03",
newTab: "sound-04",
startSkill: "sound-14",
sessionStart: "sound-07",
skillReady: "sound-16",
sessionEnd: "sound-15",
question: "sound-14",
chatReply: "sound-06",
newTab: "sound-05",
};
const pickSelect = (s, event) => s.page.locator(`select[data-sound-file="${event}"]`);
@@ -1017,7 +1017,7 @@ test("the sound picker: a pick plays once and persists across a reload, and Play
await drawn(s.page);
await openSoundsTab(s);
assert.equal(await pickSelect(s, "question").inputValue(), "sound-07", "the pick did not survive a reload");
assert.equal(await pickSelect(s, "newTab").inputValue(), "sound-04", "an untouched cue kept its default");
assert.equal(await pickSelect(s, "newTab").inputValue(), "sound-05", "an untouched cue kept its default");
});
test("the sound picker: Play sounds off disables the selects and play buttons, and Back to default restores the defaults", async (t) => {
@@ -1039,7 +1039,7 @@ test("the sound picker: Play sounds off disables the selects and play buttons, a
assert.equal(await pickSelect(s, "newTab").isDisabled(), false, "switching sounds on enables the select again");
await s.page.click("#looks-reset");
await s.page.waitForFunction(() => document.querySelector('select[data-sound-file="newTab"]').value === "sound-04");
await s.page.waitForFunction(() => document.querySelector('select[data-sound-file="newTab"]').value === "sound-05");
for (const event of PICK_EVENTS) {
assert.equal(await pickSelect(s, event).inputValue(), PICK_DEFAULTS[event], `${event} is back on its default`);
}
@@ -1078,7 +1078,7 @@ test("the sound picker: a preview is dropped behind a ranked cue that is still p
await s.page.evaluate(() => (window.__audible = false));
await s.page.locator('[data-sound-play="newTab"]').click();
await s.page.waitForFunction(() => window.__played.length === 2);
assert.match((await played(s))[1], /\/sounds\/sound-04\.mp3$/, "the preview played once the cue had stopped");
assert.match((await played(s))[1], /\/sounds\/sound-05\.mp3$/, "the preview played once the cue had stopped");
});
test("the sound picker: Tab reaches Play from the select, and a row stacks inside the dialog at a narrow width", async (t) => {
+48 -1
View File
@@ -614,7 +614,7 @@ test("the chime files are served as audio", async () => {
// names a real event, and every event's file is served. A box with no event
// saves a setting nothing reads; an event with no box can never be muted.
test("every sound event has a preference box and a served file", async () => {
assert.equal(SOUND_EVENTS.startSkill.file, "sounds/sound-01", "starting a skill has its own sound");
assert.equal(SOUND_EVENTS.startSkill.file, "sounds/sound-14", "starting a skill has its own default sound");
const html = fs.readFileSync(path.join(ROOT, "src", "web-console", "public", "index.html"), "utf8");
const boxes = [...html.matchAll(/data-sound="(\w+)"/g)].map((m) => m[1]);
assert.deepEqual([...boxes].sort(), Object.keys(SOUND_EVENTS).sort());
@@ -1574,6 +1574,53 @@ test("the page reads older { from, md } thread entries", () => {
assert.equal(threadText({ who: "agent" }), "");
});
/* --------------------------------- the Dead Code findings page (notes/dead-code.md) */
test("Dead Code's findings page: one multi in three groups with All Safe and None presets is accepted, two recommended stay refused", () => {
const opened = cli(["open", "--file", payload("dead-code-open.json", BASE), "--no-open"]);
const s = opened.json;
try {
const findings = {
id: "findings",
kind: "multi",
title: "What to remove",
required: false,
body: "- Safe to remove: 2\n- Check first: 1\n- Warning: 1\n\nNothing 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"] }, { label: "None", ks: [] }],
};
const ok = cli(["post", "--session", s.sid, "--file", payload("dead-code-findings.json", { items: [findings] })]);
assert.equal(ok.status, 0, ok.stderr);
const item = readState(s.session).items.find((i) => i.id === "findings");
assert.ok(item, "the findings card is on the page");
assert.deepEqual(item.options.map((o) => o.k), ["1", "2", "3", "4"], "Safe, Check first, Warning, in order");
assert.deepEqual(item.presets, findings.presets, "both presets are kept for the page");
assert.ok(!item.answer, "nothing starts ticked");
const twice = cli(
["post", "--session", s.sid, "--file", payload("dead-code-twice.json", {
items: [{ id: "method", kind: "choice", title: "How to look", body: "Which?", options: [{ text: "Knip", recommended: true }, { text: "Own search", recommended: true }] }],
})],
{ expectFail: true }
);
assert.equal(twice.status, 3, "a second recommended option is still refused");
assert.match(twice.stderr, /recommended/);
} finally {
cli(["stop", "--session", s.sid, "--force"]);
}
// The budget is read as text: importing the budgets suite would run its tests here too.
const budgets = fs.readFileSync(path.join(ROOT, "scripts", "test-console-wire-budgets.mjs"), "utf8");
const budget = Number((budgets.match(/"dead-code\.md": (\d+)/) || [])[1]);
assert.ok(budget > 0, "notes/dead-code.md has a byte budget");
const bytes = fs.statSync(path.join(ROOT, "src", "web-console", "notes", "dead-code.md")).size;
assert.ok(bytes <= budget, `notes/dead-code.md is ${bytes} bytes, over its ${budget} budget`);
});
/* --------------------------------- output shape at each exit code (FR-1 to FR-3) */
test("the shape of every exit: 0 for an answer and a launch, 10, 30, 3 and 2", async (t) => {
+2 -1
View File
@@ -399,7 +399,7 @@ test("Implement's card launches Implement + Review when Review is ticked", () =>
assert.equal(launchVariant(quick, true), quick, "a card with no Review box is unchanged");
});
test("helper-strength.md ships in the fifteen skills that start helpers, and in no other", () => {
test("helper-strength.md ships in the sixteen skills that start helpers, and in no other", () => {
// npm test has just built skills/; a direct run builds it so the check never reads a stale tree.
if (process.env.npm_lifecycle_event !== "test") {
execFileSync(process.execPath, [path.join(ROOT, "install.js"), "--build-skills"], { stdio: "ignore" });
@@ -414,6 +414,7 @@ test("helper-strength.md ships in the fifteen skills that start helpers, and in
"plan2code-3-implement",
"plan2code-3-implement-review",
"plan2code-4-finalize",
"plan2code-dead-code",
"plan2code-diagnose",
"plan2code-init",
"plan2code-init-update",
+12
View File
@@ -302,6 +302,18 @@ const CARDS = {
built: { on: true },
unrecognized: { on: true },
},
"plan2code-dead-code": {
"none": { on: true },
diagnosed: { on: true },
fixed: { on: true },
exploring: { on: true },
mapped: { on: true },
planned: { on: true },
documented: { on: true },
building: { on: true },
built: { on: true },
unrecognized: { on: true },
},
"plan2code-changelog": {
"none": { on: true },
diagnosed: { on: true },
+1 -1
View File
@@ -498,7 +498,7 @@ test("every console workflow has its notes, and its skill's Interface reads them
init: "init", "init-update": "init", pathfinder: "pathfinder", plan: "plan", "revise-plan": "revise-plan",
document: "document", implement: "implement", "implement-review": "implement", "quick-task": "quick-task",
review: "review", finalize: "finalize", handoff: "handoff", changelog: "changelog", git: "git", xray: "xray",
diagnose: "diagnose", "pr-prep": "pr-prep", test: "test",
diagnose: "diagnose", "pr-prep": "pr-prep", test: "test", "dead-code": "dead-code",
};
const skills = fs.readdirSync(path.join(ROOT, "src")).filter((f) => /^plan2code(-.*)?\.md$/.test(f));
for (const f of skills) {
@@ -0,0 +1,73 @@
# Caller Search
> Part of plan2code-dead-code: read in Step 4 before the caller search, and given to every helper that searches. Never invoked as a skill.
A candidate is dead only when nothing in the whole project reaches it. Search the whole project, never only the folder the run covers, and search for more than the plain name: the lists below are what else can reach an item in each language group. Include tests, scripts, config files, docs that act as config (an OpenAPI file, a route table, a cron file) and generated glue (bindings, stubs, registration files).
## Every language
- The plain name, as a whole word, in every text file, not only in source files of the same language.
- The name inside strings and templates: config keys, JSON and YAML values, SQL, HTML attributes, environment files.
- Build files, CI configs, `Dockerfile`, `Makefile`, package scripts and shell scripts that call a file or a function by name.
- A file candidate: its path and its file name without the extension, anywhere.
- Record what each search found in `callers`, even when it found nothing ("no match outside its own file").
## JavaScript and TypeScript
- Re-exports: `export * from`, `export { x } from`, and the barrel files (`index.js`, `index.ts`) that pass a name on.
- Dynamic `import()` with a string or template path, and `require()` with a computed path.
- `package.json` `exports`, `main`, `module`, `bin` and `types`; a workspace's other packages that import this one.
- Framework conventions that load by file name: route folders (`pages/`, `app/`, `routes/`), `*.config.*` files, test setup files.
- Names reached by string: `obj[name]`, event names, `customElements.define`, decorators.
## Python
- `__all__` lists, and `from module import *` that brings them in.
- `getattr`, `importlib.import_module`, `__import__` and string paths such as `"package.module:func"`.
- Decorators that register a function (routes, CLI commands, signal handlers, pytest fixtures used by name).
- Entry points in `pyproject.toml`, `setup.cfg` and `setup.py` (`console_scripts`, plugin groups), and `manage.py` or framework settings that name a module.
## Rust
- `pub use` re-exports and the crate's public API in `lib.rs`.
- Macros that expand to a call (`macro_rules!` bodies, derive and attribute macros).
- `#[cfg(...)]` and feature flags: an item used only under a feature or a target is still used.
- `mod` declarations, `#[path]` attributes, `build.rs`, and binaries under `src/bin/` or `[[bin]]` in `Cargo.toml`.
## Go
- Exported names (capitalized) used from another package or module in the workspace.
- Interface satisfaction: a method with no direct caller may make a type meet an interface used elsewhere.
- `init()` functions, blank imports (`import _ "pkg"`) that run them, and `//go:generate` lines.
- Build tags and file-name suffixes (`_linux.go`, `_test.go`), and reflection (`reflect`, `MethodByName`, struct tags read at runtime).
## Java and Kotlin
- Reflection: `Class.forName`, `getMethod`, `getDeclaredField`, and names in strings.
- Annotations that register or call: `@Bean`, `@Component`, `@Controller`, `@RequestMapping`, `@Test`, `@JsonCreator`, `@Subscribe`, `main` methods.
- Spring and other dependency injection: XML configs, `application.properties` and `application.yml`, component scanning by package.
- `META-INF/services` files, `AndroidManifest.xml`, Gradle and Maven files that name a class, and Kotlin `@JvmStatic` or `companion object` members called from Java.
## C#
- Reflection: `Type.GetType`, `GetMethod`, `Activator.CreateInstance`, `nameof` used as a key.
- Attributes that register or call: `[HttpGet]`, `[Route]`, `[Fact]`, `[Test]`, `[JsonConstructor]`, `[DllImport]`.
- Dependency injection registration (`AddScoped`, `AddTransient`, `AddSingleton`, assembly scanning) and `appsettings.json`.
- Serialization: properties set only by a serializer, and `.csproj`, `.xaml` and `.razor` files that name a type or handler.
## Ruby
- `send`, `public_send`, `method`, `define_method` and `respond_to?` with a symbol or string.
- `constantize`, `const_get` and class names built from strings.
- Rails autoloading and conventions: controllers and actions reached through `config/routes.rb`, callbacks (`before_action`, `after_save`), helpers, jobs, mailers, views that call a helper, and concerns.
- Rake tasks, `Gemfile` and gemspec `executables`, and initializers.
## PHP
- Composer autoload (`psr-4`, `classmap`, `files`) and `bin` entries in `composer.json`.
- `class_exists`, `method_exists`, `call_user_func`, variable functions (`$fn()`) and `new $class`.
- Routes and container config: framework route files, service container definitions (YAML, XML, PHP arrays), event listeners and middleware lists.
- Templates (Blade, Twig) that call a function or helper by name, and attributes such as `#[Route]`.
## Any other language
Search the plain name, strings and config as in "Every language", say which of the language's dynamic features you could not cover, and leave the finding at Check first.
File diff suppressed because it is too large. Load diff
+157
View File
@@ -0,0 +1,157 @@
# 💀 DEAD CODE MODE
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).
## Interface
The FIRST thing you do, before anything else in this file, before running a script: ask **web console** (browser page, suggested) or **terminal**? Console → run `node "<D>/console.mjs" open --workflow dead-code` before reading (<D>: references/web-console/ beside this SKILL.md (~/.agents/skills/plan2code-dead-code/references/web-console/ globally) or the dir in ~/.plan2code/console/console-dir), then read <D>/console.md and <D>/notes/dead-code.md. The start questions, the findings list, the checks, the report and the save offers all go through it. Switchable anytime. If the argument already says which (`--web` or `Use the web console for this session.`), take it and do not ask; drop the flag. Launched by the dashboard? Its session is already open: resume it (console-launches.md), then Project Context.
## Project Context
Read `./AGENTS.md` when it exists: its commands, its `## Test map` and anything it says about slow suites or code reached by name. Dead Code still works without one, but the test map is what tells it which tests and build to run after a removal; without it the scripts read the project's config files, and the person confirms the commands.
## Scripts
`<S>` is `scripts/` beside this SKILL.md (`~/.agents/skills/plan2code-dead-code/scripts/` globally). Run from the project root. Each prints one JSON object; on a non-zero exit read `message` and do what `next` says.
- `node "<S>/dead-code.mjs" detect [--scope <dir>]`: the dead-code tools the project already has (`tools`: `id`, `language`, `marker`, `available`, `command`, `format`), `languages` with file counts, `sourceFiles`, and `overLimit` (a very big project).
- `node "<S>/dead-code.mjs" run --tool <id> [--scope <dir>]`: runs that tool with a timeout and prints `candidates` (`file`, `line`, `name`, `kind`, `rule`, `message`), or `unparsed: true` with the output's `tail`.
- `node "<S>/dead-code.mjs" narrow --candidates <file>`: `folders` ranked by candidate count.
- `node "<S>/dead-code.mjs" keep list|filter|add|remove`: the shared keep list, `.plan2code-dead-code/keep.md`. `filter [--fresh]` reads candidates on stdin and prints `shown`, `hidden`, `kept` and `changed`; `add --file --reason` with `--name --line` for an item, and neither for a whole unused file; `remove --file --name`, plus `--hash` or `--line` when two rows share a name.
- `node "<S>/dead-code.mjs" backup <files...> [--run <id>]` and `restore --run <id> [--files <f>...] [--verify]`: copies outside the project and a checked put-back.
- `node "<S>/dead-code.mjs" report write --findings <file>`: saves `.plan2code-dead-code/reports/DEAD-CODE-<date>.md`, only on a yes.
- `node "<S>/dead-code.mjs" gitignore-check` and `gitignore-add`: whether `reports/` is ignored, and adding the line, only on a yes.
- `node "<S>/test-map.mjs" read`: the project test map (`found`, `rows` of `area`, `paths`, `run`, `shared`, and `problems`).
- `node "<S>/test-commands.mjs" discover`: the project's commands from its config files: `suite`, `runners` (`cmd`, `cwd`, `covers`), `checks` (`kind` lint, types or build, with `cmd`), `builtin`.
- `node "<S>/run-check.mjs" --cmd <c> --cwd <d> --timeout <s> --log <file>`: runs one check and prints `outcome` (`passed`, `failed`, `timeout`, `not-started` with a `reason`), `exit`, `seconds` and `tail`.
## References
- `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.
## 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.
- **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.
- **Record honestly.** A check that did not run is never reported as passed.
- US English. No em dashes in any text you write (report, keep reasons, page text). Plain words: name the file, the item and the command.
## Helpers
When your tool can start helpers (subagents) and they are not switched off for this run (on the web console a `Subagents:` block says which, console-subagents.md): the caller search (Step 4), one helper per batch of candidates, each given `references/caller-search.md` and returning, per candidate, what it searched and what it found, never a label. Light strength, low effort, per references/helper-strength.md. Keep the labels, the Safe call, the removals, the checks and every question with you. No helpers? Do the same work yourself.
## Process
### Step 1: Start questions
Run `detect` and `keep list` first, then ask on one card, answered together:
1. **Method.** A tool counts only when its `language` has files in `detect`'s `languages`. Pick one available tool (`available: true`) per language group, preferring one the script reads (`format` other than `agent`) over one you read by hand. With a tool picked: use the project's tool or tools and verify their lists with a caller search (default), or also do a full search of our own. Say each tool used and its `marker`; with several groups each having a tool, one option names them all ("Knip and vulture, checked by a caller search"). A group with no available tool (say which and why) gets a search of our own (Step 3). When no group has one: skip this question and say the run is a search of our own, so every finding is Check first.
2. **Scope.** The whole project (default) or a folder the person names. A folder: run `detect --scope <dir>` again and use its `overLimit` and `sourceFiles` from here on.
3. **Keep list.** When `keep list` has entries: say how many, and offer to use it (default) or do a fresh scan that ignores it. Leave this out when it has none.
4. **Size.** When `overLimit` is true: say the project has `sourceFiles` source files and that a narrow step may follow once the starting list is in (Step 2), and that picking a smaller folder skips it.
The answers are final for the run. A this-branch-only mode is not offered yet.
### Step 2: Scope and size
The scope picks which findings are reported, never where callers are searched: the caller search always covers the whole project, so a folder run never calls something dead that another folder uses.
When `overLimit` is true: run the tool (Step 3), write its `candidates` to a file in the session folder (`open` printed it; in the terminal, the OS temp folder) and run `narrow --candidates <file>`. Ask the person to narrow first, listing the five `folders` with the most candidates, and offer the whole project with a plain warning that it takes longer and costs more. With no tool, list the five biggest top-level source folders instead. Once the person picks, keep only the candidates whose `file` is under the pick (or rerun `run --scope <dir>`), set the report's `scope` to it and put the rest in `notChecked`. Helpers split the work inside what the person picks. Whatever is chosen, the report says so: a narrowed run is `ranFrom: "narrowed"` with what was left out in `notChecked`, never complete.
### Step 3: The starting list
**With a tool:** `run --tool <id>` (add `--scope <dir>` for a folder run), once per chosen tool. Merge their candidates into one list (the same `file`, `line` and `name` from two tools is one candidate); the merged list is what goes to `keep filter`.
- `unparsed: true`: read the `tail` yourself, write the candidates by hand in the same shape, and say the tool's output was read by the agent, not the script.
- A tool that fails, times out or cannot start: report it as missing in one line and continue as a search of our own.
- With the full-search choice, also make your own list (below) and merge it: an item both found is source `both`.
**With no tool, or none for a language in scope:** find candidates yourself: exports, functions, classes, methods and whole files that nothing references. Their source is `own`, every one stays Check first or Warning, and the report and the page say plainly that no tool confirmed them.
Never install, `npm install`, `pip install` or fetch a tool to get a list.
**The keep list, for every candidate.** Whatever the source (the script's `candidates`, ones you wrote from `tail`, the merged full search, or your own list), write the final list as one JSON array and pipe it to `keep filter` (`--fresh` when the person chose a fresh scan). Work on `shown`; the number of `hidden` entries is the hidden count. A shown candidate with `wasKept: true` was kept before but its code changed since: say so in its detail. A `kept` entry marked `gone` is offered for removal from the list in Step 8.
### Step 4: Verify with a caller search
Read `references/caller-search.md`. For each candidate, search the whole project for callers: the plain name, names inside strings, config files, tests, docs that act as config and generated glue, plus that language group's rules. Record what was found in `callers`.
- **A caller found:** the item is live. Drop it from the list and count it ("12 dropped: a caller was found").
- **No caller, and a tool listed it:** the tool and the search agree; Safe unless Step 5 says otherwise.
- **No caller, found only by our own search:** Check first.
A tool's silence about an item is never proof that it is live or dead. On a big list, helpers search in batches (Helpers).
### Step 5: Labels
Every finding gets one label, with its reason:
- **Safe to remove:** a tool listed it and the caller search found nothing.
- **Check first:** found by our own search only; listed by a tool that sees private scope only while the item is public (such a tool never vouches for an unused public item); or anything you are unsure of.
- **Warning:** always for these six kinds, with which one and why shown:
1. called by name from a string or config
2. a plugin or framework hook
3. a public library export
4. a CLI entry point or script
5. a test helper
6. code only tests call
A Warning is never in the quick-removal list (the All Safe preset). The person may still remove one by picking it by hand.
### Step 6: The findings page
Post one `multi` item (`notes/dead-code.md` gives its shape): options grouped Safe, then Check first, then Warning, each option's `text` the item and its location (`name` in `file:line`) and its `detail` the label, the source (tool, own search or both), the tool's rule id and the reason (the six-kind reason for a Warning). Preset: `All Safe` (ticks the Safe group). Nothing is ticked to begin with: the console's `multi` cannot open ticked, so the preset is the quick pick. Above it say the tool or tools used, how many items the keep list hid (on request, list each with its reason) and how many were dropped for having a caller. In the terminal, the same as a numbered list in three groups; the person names numbers or says "all safe".
Nothing picked → skip to Step 8.
### Step 7: Removal and checks
1. **Find the checks.** Run `test-map.mjs read`. With a map, every row's `run`, plus the `build` entries of `test-commands.mjs discover`'s `checks`. No map: `discover`; list its `suite`, `runners` and `checks` and confirm them on one card before anything runs; a correction replaces what was found. None at all: ask the person for the command. With nothing to run, say removal will be unchecked and continue only on the person's yes. The checks run project-wide, even on a folder run.
2. **Back up.** `backup <every file the picks change>`; keep its `run` id.
3. **Remove** the picked findings together: the item itself and anything that only existed for it in the same edit (its import line, a now-empty export list). A whole-file finding deletes the file.
4. **Check once.** Run every check through `run-check.mjs` (`--timeout 600` by default, longer when `AGENTS.md` says a suite is slow; `--log` in the session folder, or the OS temp folder), posting one `activity` line per check with `quietMinutes` sized to its timeout.
5. **All pass:** done; every pick's outcome is `removed`.
6. **Any fail** (any `outcome` other than `passed`: `failed`, `timeout` or `not-started`, with its `reason` or `tail` as the failure text): `restore --run <id>`, then `restore --run <id> --verify`. Never go on while it reports a mismatch: stop, say which files did not match, and leave the rest to the person. Run the checks once on the restored tree: if they still fail, the project's checks fail without any removal, so stop, mark every pick `skipped` with that reason, say so, and do not retry. Otherwise retry the picks one at a time: for each, `backup` the files it touches as a new run, remove it, run the checks; a pass keeps it, a fail restores that run and records `failed: <the end of the failing check's tail>` as its outcome. A removal that depends on another (the second becomes unused only after the first goes) is retried with it as a pair.
Nothing is staged or committed at any point.
### 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.
Offer three things, each acted on only on a yes:
- **Save the report.** Write the findings JSON (`scope`, `mode` of `verify`, `full` (also when any language group had no tool) or `own`, `tool` (an id, a list of ids when several ran, or null), `ranFrom`, `findings`, `hidden` as a number, `notChecked`) to the session folder, each finding `{ file, line, name, kind, source (tool, own or both), rule, label (safe, check or warning), warningKind (which of the six kinds, and why), callers, outcome }`, and run `report write --findings <file>`. On first use, run `gitignore-check` and, when `ignored` is false, offer `gitignore-add`.
- **Keep findings.** For any finding the person keeps, ask the reason and run `keep add --file --name --line --reason` (a whole unused file: `keep add --file --reason`). It is hidden next run, shown as a count.
- **Take entries off.** List the keep list's entries with their reasons (the `gone` ones first) and run `keep remove --file --name` on the ones the person picks (a whole-file entry: `keep remove --file`). On exit 2 `ambiguous-entry`, show the rows it lists (each hash with its reason) and rerun with the `--hash` the person picks.
## Abort
On "stop", "cancel" or similar during a run: confirm. With removals on disk and the checks not yet passed, `restore --run <id>` and `--verify` first, and say so. Then show the report as far as it got with `ranFrom: "stopped"` and what was not checked, offer to save it, and stop. Never call a stopped run complete.
## 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`).
**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."
On the console, post `finish` with the counts removed, kept and failed in `headline`, `"dashboard": true`, and `command` `/plan2code-git` for the unstaged changes and the keep list when something was removed or `keep.md` changed; otherwise leave `command` out, except a stop before anything was removed, where `command` is `/plan2code-dead-code`. Never a `commit` field: the Git skill commits.
```
⋅
╭───╮
╲│ ★ │╱
│ ◡ │ Swept clean!
╰┬─┬╯
```
+2
View File
@@ -69,6 +69,7 @@ Ground truth for menu notes and Ask-tab answers. For anything beyond this table,
| diagnose | the bug, the codebase, `references/building-habits.md` | `DIAGNOSIS-<date>.md`; no code changes |
| pr-prep | git diff and status, the `AGENTS.md` test map, the project's config files, the PR template | the page report and description; `PR-READINESS-<date>.md` on a yes; the `AGENTS.md` test map on a yes; no commits, no push |
| test | the codebase, the `AGENTS.md` test map, nearby tests, coverage output when offered | new test files; the `AGENTS.md` test map on a yes; `PLAN-DRAFT-<date>.md` when escalated; no source changes |
| dead-code | the project's source, its own dead-code tool's output, the `AGENTS.md` test map, `.plan2code-dead-code/keep.md` | code removals the person picks; `.plan2code-dead-code/keep.md`; `.plan2code-dead-code/reports/DEAD-CODE-<date>.md` and the `.gitignore` line on a yes; no commits, no staging |
## A pick arrives
@@ -105,6 +106,7 @@ If `skill` is not in the table below, say so on the page and stay the dashboard.
| plan2code-git | git | | plan2code-changelog | changelog |
| plan2code-xray | xray | | plan2code-diagnose | diagnose |
| plan2code-pr-prep | pr-prep | | plan2code-test | test |
| plan2code-dead-code | dead-code | | | |
## A pick-up arrives
+1 -1
View File
@@ -1,5 +1,5 @@
# Helper Strength
> Shared by the skills that start helpers (subagents): Init, Init Update, Pathfinder, Plan, Revise Plan, Document, Quick Task, Implement, Implement + Review, Review, Finalize, X-ray and Diagnose. Read it when you first start a helper in a session. Never invoked as a skill.
> Shared by the skills that start helpers (subagents): Init, Init Update, Pathfinder, Plan, Revise Plan, Document, Quick Task, Implement, Implement + Review, Review, Finalize, X-ray, Diagnose, PR Prep, Test and Dead Code. Read it when you first start a helper in a session. Never invoked as a skill.
## The words
+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; }