diff --git a/.agents-docs/AGENTS-architecture.md b/.agents-docs/AGENTS-architecture.md index f4bd210..8e7da3e 100644 --- a/.agents-docs/AGENTS-architecture.md +++ b/.agents-docs/AGENTS-architecture.md @@ -5,7 +5,7 @@ ``` plan2code/ -├── src/ # Source workflow prompts (17 markdown files) +├── src/ # Source workflow prompts (19 markdown files) │ ├── plan2code-0-pathfinder-references/ # Reference files for pathfinder skill │ │ ├── brief.md # Dated plain-English decision briefs │ │ ├── chart.md # MODE A: destination + frontier grills, templates @@ -16,9 +16,9 @@ plan2code/ │ │ ├── handoff.md # Clearing gate + PLAN-DRAFT handoff │ │ └── trail.md # Every-response map visual + pathed resume command │ ├── shared-references/ # Reference files shared across skills -│ │ ├── building-habits.md # Find the cause, test first, pin behavior (quick-task, implement, implement-review) -│ │ ├── helper-strength.md # How strong a model and how much effort each helper gets (init, init-update, pathfinder, plan, revise-plan, document, quick-task, implement, implement-review, review, finalize, xray, diagnose) -│ │ └── test-runs.md # Choosing what tests to run: targeted per task and phase, full suite only where the plan puts it (document, implement, implement-review, quick-task, review, finalize) +│ │ ├── building-habits.md # Find the cause, test first, pin behavior (quick-task, implement, implement-review, test) +│ │ ├── helper-strength.md # How strong a model and how much effort each helper gets (init, init-update, pathfinder, plan, revise-plan, document, quick-task, implement, implement-review, review, finalize, xray, diagnose, pr-prep, test) +│ │ └── test-runs.md # Choosing what tests to run: targeted per task and phase, full suite only where the plan puts it (document, implement, implement-review, quick-task, review, finalize, pr-prep, test) │ ├── plan2code-review-references/ # Reference files for review skill │ │ ├── verification-protocol.md # Deep verification + confidence calibration │ │ ├── dimensions.md # 11 dimensions with detailed checklists @@ -29,8 +29,8 @@ plan2code/ │ │ └── ai-agent-file-sync.md # Step 7: replace AI configs with AGENTS.md refs │ ├── plan2code-4-finalize-references/ # Reference files for finalize skill │ │ └── community-feedback-submission.md # STEP 6.5 payload schema + submission tiers -│ ├── skill-scripts/ # Scripts shared across skills: install.js copies the ones a skill lists into skills//scripts/ (specs, commit-msg, review-scope, agents-md, agent-files, common) -│ └── plan2code--scripts/ # A skill's own scripts, same copy rule (pathfinder, finalize, changelog, git and xray each have one) +│ ├── skill-scripts/ # Scripts shared across skills: install.js copies the ones a skill lists into skills//scripts/ (specs, commit-msg, review-scope, agents-md, agent-files, glob, test-map, test-match, test-commands, run-check, common) +│ └── plan2code--scripts/ # A skill's own scripts, same copy rule (pathfinder, finalize, changelog, git, xray, pr-prep and test each have one) ├── plan2code-bot/ # Autonomous end-to-end workflow test runner (TypeScript, tsup, Claude Agent SDK, vitest); user docs in .readme/test-bot.md ├── plan2code-metrics/ # Recursive self-improvement toolchain │ ├── src/ # TypeScript source @@ -142,6 +142,8 @@ plan2code/ | `plan2code-handoff.md` | handoff | Compact the conversation into a self-contained handoff document for a fresh session | | `plan2code-xray.md` | xray | Explain how and why an area works (files, commits, PRs via `gh` when present), or rank the rough spots worth fixing into `ARCHITECTURE-BRIEF-.md` for Pathfinder or Plan; never edits code | | `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//DIAGNOSIS-.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-.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-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 | @@ -182,7 +184,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` (Phase Checklist, groups, task markers, numbering, the implement selection verdict, consistency checks) / `metrics` / `mark` / `archive`. Imports `scanProject()` from the bundled `web-console/scan.mjs`, so the dashboard and the skills share one spec classifier | | `commit-msg.mjs` | implement(-review), review, quick-task, finalize, init-update, git | The `` / `AI Assisted` commit command (two `-m` flags), with optional `git add` | -| `review-scope.mjs` | review, implement(-review), quick-task, finalize | Review Mode's git fallback: files, lines, doc share, base branch | +| `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, 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, 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 | +| `test-match.mjs` | 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` | 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 | +| `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 | | `agents-md.mjs` | init, init-update | AGENTS.md structure, budget, orphans, broken links, always-inline sections | | `agent-files.mjs` | init, init-update | Detect and replace other agents' config files with AGENTS.md pointers | | `pathfinder.mjs` (own) | 0-pathfinder | `reconcile`, `frontier`, `claim`, `resolve`, `rule-out`, `trail`, `gate`, `lint`, `brief-data` | @@ -193,7 +202,7 @@ Anything a workflow step decides with one correct answer (parsing a spec's check **Conventions** (`common.mjs`): Node 18+ built-ins only; one JSON object on stdout (`ok: false` plus `error`, `message`, `next` on a handled failure, the same line on stderr); exit 0 ok, 1 crash, 2 bad arguments, 3 not found, 4 invalid or check failed, 5 refused; `--help` documents commands and exit codes; writes take `--dry-run`; `PLAN2CODE_NOW` pins the clock for tests. A SKILL.md names a script as `node "/.mjs"`, where `` is `scripts/` beside it. -**Tests:** `scripts/test-skill-scripts.mjs` (installer plumbing and the shared scripts), `scripts/test-script-.mjs` (a skill's own), with fixtures from `scripts/skill-script-helpers.mjs`. Importing that module rebuilds `skills/` unless `npm_lifecycle_event` is `test` (`npm test` has just built it). Git fixtures go through `copyFixture()` (`scripts/fixture-helpers.mjs`): built once per test file, copied per test, since every `git` process costs a few hundred milliseconds on Windows; a remote inside the fixture is added with `slashed()` so the copy's `.git/config` can be pointed at its own origin. They run the built `skills/` tree, and one test fails if any SKILL.md or shipped reference names a `/.mjs` that skill does not ship. The per-skill scripts import `./common.mjs`, which only sits beside them in the built tree, so run them from `skills/`, not `src/`. +**Tests:** `scripts/test-skill-scripts.mjs` (installer plumbing and the shared scripts), `scripts/test-script-.mjs` (a skill's own, and the newer shared scripts: `test-script-test-map.mjs`, `test-script-test-match.mjs`, `test-script-test-commands.mjs`, `test-script-run-check.mjs`, `test-script-pr-prep.mjs`, `test-script-coverage.mjs`), with fixtures from `scripts/skill-script-helpers.mjs`. Importing that module rebuilds `skills/` unless `npm_lifecycle_event` is `test` (`npm test` has just built it). Git fixtures go through `copyFixture()` (`scripts/fixture-helpers.mjs`): built once per test file, copied per test, since every `git` process costs a few hundred milliseconds on Windows; a remote inside the fixture is added with `slashed()` so the copy's `.git/config` can be pointed at its own origin. They run the built `skills/` tree, and one test fails if any SKILL.md or shipped reference names a `/.mjs` that skill does not ship. The per-skill scripts import `./common.mjs`, which only sits beside them in the built tree, so run them from `skills/`, not `src/`. ## Repo-Local Skills (`.claude/skills/`) @@ -511,7 +520,7 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web | `public/boot.js` | `playWake()`: the dashboard's first-open wake-up. Self-contained (it owns its timers, the listeners that swallow input mid-run and the one measured glide transform; the page's `stir()` callback times the nudge between the click and the boot, which `screens/dashboard.js` fills with one snore; `skipEl` — the muted Skip button, and Escape — ends the run early with `onSkip` as the cue to silence queued sounds) and free of module-scope DOM access, so it can be imported by the tests and kept out of the screens' render paths; `GLIDE_AT_MS` / `DONE_AT_MS` are its timings | | `console.md` | the core of the agent-facing contract, read once per conversation (every skill ships the same copy, so a dashboard hop never re-reads it): starting, the turn (`post --wait`, the exit codes, handling a send, `settle`), posting, the payload and its kinds, documents (including `file` blocks), the house rules, and an index of the topic files below with the moment each is read. A test caps it at 24,000 characters | | `console-finish.md` · `console-stop.md` · `console-chat.md` · `console-workspace.md` · `console-subagents.md` · `console-launches.md` · `console-meter.md` · `console-attachments.md` · `console-trouble.md` | topic files, each read only when its moment first comes: finishing (the finish and its buttons), stop requests (the way home mid-workflow, `stopWarning`, resuming a pause), Quick questions, the Workspace, standing instructions and helper reports, dashboard launches and the menu payload, the session meter's `run` events (read only when a `run` is refused: the notes inline every `run`), keeping a cited note attachment, and recovery | -| `notes/.md` | per-workflow notes (`init` for both inits, `pathfinder` with Briefs, `plan`, `revise-plan`, `document`, `implement` for both builds, `loop` for a build the desktop app's Implementation Loop runs with `--loop` (where it reports a `loopOutcome` instead of asking for sign-off), `quick-task`, `review`, `finalize`, `handoff`, `changelog`, `git`, `xray`, `diagnose`). Each skill's Interface line reads `/console.md` and its own notes file right after `open`; a test checks every skill names one that exists | +| `notes/.md` | per-workflow notes (`init` for both inits, `pathfinder` with Briefs, `plan`, `revise-plan`, `document`, `implement` for both builds, `loop` for a build the desktop app's Implementation Loop runs with `--loop` (where it reports a `loopOutcome` instead of asking for sign-off), `quick-task`, `review`, `finalize`, `handoff`, `changelog`, `git`, `xray`, `diagnose`, `pr-prep`, `test`). Each skill's Interface line reads `/console.md` and its own notes file right after `open`; a test checks every skill names one that exists | | `building.md` · `building-review.md` | the build half of the contract, for `implement`, `implement-review` and `quick-task`: progress posts (`agent.activity`, `agent.quietMinutes`, `file` blocks re-read with `refresh`), the chat check between tasks, questions mid-build and stop requests; `building-review.md` is the review run on the page (the sign-off's `review` verdict, **Review it now**, Implement + Review's Stage 2, Finalize's Step 2.5), read only when asked for | Key design points: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b99752..64ce6cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,10 @@ All notable changes to Plan2Code will be documented in this file. - **custom agents**: add your own agent CLIs in the web console under **User Preferences → Agents & models** (name, command, arguments with `{prompt}` and `{model}` tokens, start prompt, bypass arguments, models) with a **Test** button that shows where the command is found. They are saved in `~/.plan2code/agents.json`, listed after Claude Code, Devin and Codex by both the `plan2code` command (`--cli ` picks one) and the desktop app, and New Session reuses the same agent. A broken file or entry is skipped with a warning and never stops anything. `/plan2code` only works in an agent that loads the installed Plan2Code skills; a blank start prompt starts the agent with nothing typed. - **desktop app**: when no agent CLI is installed, the first-run checklist and the launch card explain what to install, with each agent's install command, an **Install page** link, and a **Check again** button that finds a newly installed agent (or a custom one) without restarting the app. - **desktop app**: the taskbar entry now shows when Plan2Code needs you, mirroring the console's tab icon. Windows: a green dot on your move (a finished screen too, while it still offers a button to press, such as back to the dashboard or a review), a red dot on needs attention (or a finished screen whose press was never collected), none while busy or once nothing is left to press, and one short burst of flashes when the window is not focused (the button stays lit until focused). macOS: a red `!` dock badge on needs attention and one bounce (the system badge cannot be green). Linux: a count badge where the desktop supports it, plus the urgency hint. The dot clears when the agent ends, the page reloads or the page stops answering. **User Preferences → System → Desktop app** (inside the app only) has the switch **Show on the taskbar when Plan2Code needs me**, on by default and saved in the app's own `app.json`. +- **pr-prep**: a new dashboard utility, **Get a PR ready** (`/plan2code-pr-prep`), for the moment before you open a pull request. It reads what changed on the branch, asks first whether to include uncommitted work, and picks the checks that cover the changes from the project's test map (or, with no map, from commands it finds in the project's config files and confirms with you), each with a reason, plus the full suite when shared ground was touched. You untick what to skip; it runs the rest with a timeout per check and says **Ready**, **Ready with notes** (something trimmed, timed out, could not start, or a changed file no test covers) or **Not ready**. It writes a PR description to copy, following the repo's pull-request template when there is one, with the create-a-PR link (no `gh` needed), and offers to save the report as `PR-READINESS-.md` in the branch's spec folder. It never commits, pushes or opens the PR. +- **test**: a new dashboard utility, **Write missing tests** (`/plan2code-test`). It asks where to look (the branch's changes, a folder or the whole project), finds the source files no test covers by matching them to tests by name, folder and imports, and offers a real coverage run on top when the project already has a coverage tool (Node's test runner, Jest, Go, or Vitest, pytest-cov and Coverlet when installed), never running it silently. The plan opens with **How this project writes tests** for each runner (folder, file naming, command, helpers, assertion style), so the new tests match the old ones; on your approval it writes and runs unit and integration tests. It never changes source code: a test that exposes a real bug is kept, on a yes, as the reproduction for `/plan2code-diagnose`. A project with no runner is offered its language's built-in one (`node --test`, `unittest`, `go test`, `cargo test`), and a job past 8 source files, 8 new test files or 2 runners can **Continue** with the top 8 gaps or **Escalate** to a PLAN-DRAFT that `/plan2code-1-plan` resumes at Phase 2. +- **test map**: projects can describe their tests in one Markdown table under `## Test map` in `AGENTS.md` (or behind one link to `.agents-docs/AGENTS-test-map.md`), with the columns `Area`, `Paths` (globs), `Run` (the command for that area) and `Shared` (`yes` when a change there reaches everything). PR Prep and Test read it to pick checks and runners, and offer to write or update it at the end of a run. **Init** proposes one when it finds test commands, and **Init Update** checks an existing map's paths and commands still match the project and offers one when tests exist but no map does; nothing is written without a yes. +- **git**: after a push or publish, or when the branch is pushed with nothing left to commit, the git skill now names `/plan2code-pr-prep` as the likely next step: run the checks and write the PR description. - **web console**: a one-answer question (a pick-one list, or a menu) now has a **Clear** button under its options that takes the card back to how it arrived: no pick, and nothing in **Something else**. A radio pick cannot be unticked by clicking it again, so before this a stray pick could only be swapped for another. The button shows only while the answer has not been sent. - **contributors**: `npm run play` opens the web console straight from `src/` with the server reading each page file fresh, so a change to an Activities game shows on the next page reload, without `npm run build:skills` or a reinstall. diff --git a/QUICK-REFERENCE.md b/QUICK-REFERENCE.md index 899ac7d..c64de1b 100644 --- a/QUICK-REFERENCE.md +++ b/QUICK-REFERENCE.md @@ -46,6 +46,8 @@ Every command below is what a dashboard card runs. Typed on its own, each one as | handoff | /plan2code-handoff | Conversation | Self-contained handoff doc (OS temp dir by default, or a folder you pick such as `handoffs/`) | | xray | /plan2code-xray | An area, or none | An explanation citing files and commits, or `ARCHITECTURE-BRIEF-.md` with the rough spots you picked | | diagnose | /plan2code-diagnose | A bug, or none | `DIAGNOSIS-.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 | | 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 (`` / `AI Assisted`), branches, pull with conflict help, push, publish | diff --git a/README.md b/README.md index a513766..5913c3d 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,8 @@ The dashboard's cards, and when each one lights up for the spec you pick: | Handoff | Pack this conversation into a document a fresh session can pick up cold. Any skill's **Stop with a handoff** writes one too, and the dashboard lists them to pick up. | Always | | Codebase X-ray | Explain how and why an area works, or find the rough spots worth fixing. | Always | | 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 | | 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) | @@ -420,6 +422,8 @@ console or the terminal; add `--web` to skip the question and go straight to the | `/plan2code-handoff` | Compact this conversation into a doc the next one resumes from, saved in `~/.plan2code/handoffs/` and listed on the dashboard to pick up | | `/plan2code-xray` | Explain how and why an area of the code works (citing files, commits and PRs), or rank the rough spots worth fixing into a brief for Pathfinder or Plan; never edits code | | `/plan2code-diagnose` | Find a bug's cause and write it up as `specs//DIAGNOSIS-.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-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 | diff --git a/install.js b/install.js index 0297cef..69aed11 100644 --- a/install.js +++ b/install.js @@ -346,6 +346,21 @@ const SOURCE_PROMPTS = [ { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' } ] }, + { + source: 'plan2code-test.md', + stepNumber: 'test', + name: 'test', + displayName: 'Test Mode', + description: 'Find untested code and write unit and integration tests in the project\'s own style', + isUtility: true, + scripts: ['review-scope.mjs', 'glob.mjs', 'test-map.mjs', 'test-match.mjs', 'test-commands.mjs', 'run-check.mjs'], + additionalReferences: [ + { source: 'web-console', target: 'web-console' }, + { source: 'shared-references/test-runs.md', target: 'test-runs.md' }, + { source: 'shared-references/building-habits.md', target: 'building-habits.md' }, + { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' } + ] + }, { source: 'plan2code-changelog.md', stepNumber: 'changelog', @@ -395,6 +410,7 @@ function generateStepLabel(prompt) { if (prompt.stepNumber === 'xray') return 'X-ray'; if (prompt.stepNumber === 'diagnose') return 'Diagnose'; if (prompt.stepNumber === 'pr-prep') return 'PR Prep'; + if (prompt.stepNumber === 'test') return 'Test'; if (prompt.stepNumber === 'changelog') return 'Changelog'; if (prompt.stepNumber === 'quick') return 'Quick Task'; return `Step ${prompt.stepNumber}`; diff --git a/package.json b/package.json index c733ce2..691b628 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "fix:eol": "node scripts/fix-line-endings.mjs", "play": "node scripts/play.mjs", "pretest": "node scripts/fix-line-endings.mjs", - "test": "node scripts/validate-char-count.js && node install.js --build-skills && node scripts/parse-check.mjs && node scripts/check-skill-table.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-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-activities.mjs scripts/test-web-console-activities-rapids.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-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" + "test": "node scripts/validate-char-count.js && node install.js --build-skills && node scripts/parse-check.mjs && node scripts/check-skill-table.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-activities.mjs scripts/test-web-console-activities-rapids.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-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" }, "devDependencies": { "gpt-tokenizer": "2.9.0", diff --git a/scripts/test-script-coverage.mjs b/scripts/test-script-coverage.mjs new file mode 100644 index 0000000..bbbef5f --- /dev/null +++ b/scripts/test-script-coverage.mjs @@ -0,0 +1,160 @@ +// Tests for plan2code-test's scripts/coverage.mjs: lcov and go tool cover -func +// output read into per-file numbers. See skill-script-helpers.mjs for how these +// run. + +import { test, after } from "node:test"; +import assert from "node:assert/strict"; +import { runScript, tmp, write, fixtureCleanup } from "./skill-script-helpers.mjs"; + +after(fixtureCleanup); + +const C = (cwd, ...a) => runScript("plan2code-test", "coverage.mjs", a, { cwd }); + +// What `node --test --experimental-test-coverage --test-reporter=lcov` writes: +// FN/FNDA/BRDA lines around the DA lines, relative paths, one file never run. +const NODE_LCOV = `TN: +SF:src/math.js +FN:1,add +FNDA:3,add +FNF:1 +FNH:1 +BRDA:2,0,0,1 +BRF:1 +BRH:1 +DA:1,1 +DA:2,3 +DA:3,3 +DA:4,1 +LH:4 +LF:4 +end_of_record +TN: +SF:src/unused.js +FN:1,never +FNDA:0,never +FNF:1 +FNH:0 +DA:1,0 +DA:2,0 +DA:3,0 +LH:0 +LF:3 +end_of_record +`; + +test("coverage read --lcov: Node's lcov reporter, two files, one at 0 hits", () => { + const dir = tmp("cov-node"); + write(dir, "lcov.info", NODE_LCOV); + const r = C(dir, "read", "--lcov", "lcov.info"); + assert.equal(r.code, 0, r.stderr); + assert.deepEqual(r.json, { + ok: true, + format: "lcov", + files: [ + { file: "src/math.js", lines: 4, hit: 4, pct: 100 }, + { file: "src/unused.js", lines: 3, hit: 0, pct: 0 }, + ], + total: { lines: 7, hit: 4, pct: 57.1 }, + }); +}); + +test("coverage read --lcov: Jest's absolute Windows paths under the root become relative", () => { + const dir = tmp("cov-jest"); + const lcov = [ + "TN:", + "SF:C:\\work\\app\\src\\b\\view.ts", + "DA:1,1", + "DA:2,0", + "DA:3,1", + "LF:3", + "LH:2", + "end_of_record", + "TN:", + "SF:c:\\work\\app\\src\\a.ts", + "DA:1,1", + "LF:1", + "LH:1", + "end_of_record", + "TN:", + "SF:D:\\other\\lib.ts", + "DA:1,0", + "LF:1", + "LH:0", + "end_of_record", + "", + ].join("\r\n"); + write(dir, "coverage/lcov.info", lcov); + const r = C(dir, "read", "--lcov", "coverage/lcov.info", "--root", "C:\\work\\app"); + assert.equal(r.code, 0, r.stderr); + assert.deepEqual( + r.json.files.map((f) => [f.file, f.pct]), + [ + ["D:\\other\\lib.ts", 0], + ["src/a.ts", 100], + ["src/b/view.ts", 66.7], + ] + ); +}); + +test("coverage read --lcov: a record without LF or LH counts its DA lines", () => { + const dir = tmp("cov-nolf"); + write(dir, "lcov.info", "SF:lib/x.py\nDA:1,2\nDA:2,0\nDA:5,1\nend_of_record\nSF:lib/empty.py\nend_of_record\n"); + const r = C(dir, "read", "--lcov", "lcov.info"); + assert.equal(r.code, 0, r.stderr); + assert.deepEqual(r.json.files, [ + { file: "lib/empty.py", lines: 0, hit: 0, pct: null }, + { file: "lib/x.py", lines: 3, hit: 2, pct: 66.7 }, + ]); + assert.deepEqual(r.json.total, { lines: 3, hit: 2, pct: 66.7 }); +}); + +test("coverage read --go-func: functions grouped by file, the module path dropped, total reported", () => { + const dir = tmp("cov-go"); + write(dir, "go.mod", "module example.com/shop\n\ngo 1.22\n"); + write( + dir, + "cover.txt", + [ + "example.com/shop/cart/cart.go:12:\t\tAdd\t\t100.0%", + "example.com/shop/cart/cart.go:30:\t\tRemove\t\t33.4%", + "example.com/shop/pay/pay.go:8:\t\tCharge\t\t0.0%", + "total:\t\t\t\t(statements)\t\t52.6%", + "", + ].join("\n") + ); + const r = C(dir, "read", "--go-func", "cover.txt"); + assert.equal(r.code, 0, r.stderr); + assert.deepEqual(r.json, { + ok: true, + format: "go-func", + files: [ + { file: "cart/cart.go", lines: null, hit: null, pct: 66.7 }, + { file: "pay/pay.go", lines: null, hit: null, pct: 0 }, + ], + total: { lines: null, hit: null, pct: 52.6 }, + }); +}); + +test("coverage read: a missing file is exit 3", () => { + const dir = tmp("cov-missing"); + const r = C(dir, "read", "--lcov", "nope.info"); + assert.equal(r.code, 3); + assert.equal(r.json.error, "no-file"); +}); + +test("coverage read: a file in neither format is exit 4", () => { + const dir = tmp("cov-garbage"); + write(dir, "junk.txt", "PASS src/a.test.js\nAll files | 80 | 70 |\n"); + for (const flag of ["--lcov", "--go-func"]) { + const r = C(dir, "read", flag, "junk.txt"); + assert.equal(r.code, 4, flag); + assert.equal(r.json.error, "unreadable-format", flag); + } +}); + +test("coverage read: exactly one format flag is required", () => { + const dir = tmp("cov-usage"); + assert.equal(C(dir, "read").code, 2); + assert.equal(C(dir, "read", "--lcov", "a", "--go-func", "b").code, 2); + assert.equal(C(dir).code, 2); +}); diff --git a/scripts/test-skill-scripts.mjs b/scripts/test-skill-scripts.mjs index f3b6ba8..52709cf 100644 --- a/scripts/test-skill-scripts.mjs +++ b/scripts/test-skill-scripts.mjs @@ -719,6 +719,23 @@ test("specs check-draft: a pathfinder draft at Resume at Phase 4 is checked ligh assert.deepEqual(bad.json.problems.map((p) => p.code).sort(), ["loop-token", "metric-word"]); }); +test("specs check-draft: a Test escalation draft passes like a Quick Task one", () => { + const root = specFixture(); + for (const from of ["Quick Task", "Test"]) { + write(root, "specs/idea-only/PLAN-DRAFT-20260801.md", `# PLAN-DRAFT: Tests\n\n**Status:** Escalated from ${from} - Resume at Phase 2\n**Source:** ${from} escalation\n\n## 1. Executive Summary\n\nWrite the tests.\n`); + const r = runScript("plan2code-1-plan", "specs.mjs", ["check-draft", "idea-only", "--root", root]); + assert.equal(r.code, 0, r.stdout); + assert.equal(r.json.status, `Escalated from ${from} - Resume at Phase 2`); + } +}); + +test("the skills that run test-match.mjs ship glob.mjs and test-map.mjs beside it", () => { + for (const s of ["plan2code-pr-prep", "plan2code-test"]) { + for (const f of ["test-match.mjs", "glob.mjs", "test-map.mjs"]) assert.ok(fs.existsSync(path.join(SKILLS, s, "scripts", f)), `${s}/scripts/${f}`); + } + assert.ok(fs.existsSync(path.join(SKILLS, "plan2code-test", "scripts", "coverage.mjs")), "plan2code-test ships its own coverage.mjs"); +}); + test("common.mjs exports the shared loop-token and scrape patterns", async () => { const common = await import(new URL(`file:///${path.join(SKILLS, "plan2code-2-document", "scripts", "common.mjs").replace(/\\/g, "/")}`).href); assert.ok(common.LOOP_TOKENS instanceof RegExp); diff --git a/scripts/test-skill-test-runs.mjs b/scripts/test-skill-test-runs.mjs index 046aa0e..a53207a 100644 --- a/scripts/test-skill-test-runs.mjs +++ b/scripts/test-skill-test-runs.mjs @@ -47,7 +47,7 @@ test("Document writes Targeted, Quick checks and Full suite lines and reads test assert.match(doc, /no Full Suite row: ask/); }); -test("test-runs.md ships in the seven skills that run, write or offer tests, and in no other", () => { +test("test-runs.md ships in the eight skills that run, write or offer tests, 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" }); @@ -62,6 +62,7 @@ test("test-runs.md ships in the seven skills that run, write or offer tests, and "plan2code-pr-prep", "plan2code-quick-task", "plan2code-review", + "plan2code-test", ]); }); diff --git a/scripts/test-web-console-skills.mjs b/scripts/test-web-console-skills.mjs index 5870eb7..2c085c7 100644 --- a/scripts/test-web-console-skills.mjs +++ b/scripts/test-web-console-skills.mjs @@ -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 fourteen skills that start helpers, and in no other", () => { +test("helper-strength.md ships in the fifteen 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" }); @@ -420,6 +420,7 @@ test("helper-strength.md ships in the fourteen skills that start helpers, and in "plan2code-pr-prep", "plan2code-quick-task", "plan2code-review", + "plan2code-test", "plan2code-xray", ]); }); diff --git a/scripts/test-web-console-spec-states.mjs b/scripts/test-web-console-spec-states.mjs index 3d3ab71..d780ed3 100644 --- a/scripts/test-web-console-spec-states.mjs +++ b/scripts/test-web-console-spec-states.mjs @@ -287,6 +287,18 @@ const CARDS = { built: { on: true }, unrecognized: { on: true }, }, + "plan2code-test": { + "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 }, diff --git a/src/plan2code-1-plan.md b/src/plan2code-1-plan.md index 6b15c9b..49258e3 100644 --- a/src/plan2code-1-plan.md +++ b/src/plan2code-1-plan.md @@ -59,7 +59,7 @@ Keep with you: every question, confidence score, decision and sign-off, Phases 3 Before Phase 1, run `node "/specs.mjs" list` from the project root (``: `scripts/` beside this SKILL.md, `~/.agents/skills/plan2code-1-plan/scripts/` globally). It reads gitignored `specs/` (Glob silently finds nothing there) and gives each spec's `planDrafts` with its **Status:** line (`-prev` copies are `archived`; ignore them). Route on that status: - Status "Phase 3 Complete - Resume at Phase 4": Resume at Phase 4 -- Status "Escalated from Quick Task - Resume at Phase 2": Acknowledge, verify requirements, skip to Phase 2 +- Status "Escalated from Quick Task - Resume at Phase 2" or "Escalated from Test - Resume at Phase 2": Acknowledge, verify requirements, skip to Phase 2 - Status "Draft" or "Complete": Ask user how to proceed - Before going on with any existing draft (a Pathfinder handoff, a Quick Task escalation, a Draft or Complete one), read its 2.4: `| Status | Deferred to Plan |`, empty or `Not discussed` means ask the Phase 1 testing question now and write the answer into 2.4; a cadence with no `Full Suite` row means ask only the full-suite part. - A spec folder holding a `DIAGNOSIS-*.md` (Diagnose's write-up of a bug): read it first, as the Phase 1 brief (the bug, its cause, the suggested fix); that folder's name is the feature name (do not ask for one), so the PLAN-DRAFT lands beside the diagnosis diff --git a/src/plan2code-test-scripts/coverage.mjs b/src/plan2code-test-scripts/coverage.mjs new file mode 100644 index 0000000..46563cb --- /dev/null +++ b/src/plan2code-test-scripts/coverage.mjs @@ -0,0 +1,155 @@ +#!/usr/bin/env node +// coverage.mjs: coverage output read into per-file numbers, for the Test skill. +// +// Reads what a project's own coverage tool already wrote: an lcov file (Node's +// test runner with the lcov reporter, Jest, Vitest, pytest-cov's lcov export) +// or the text `go tool cover -func` prints. It never runs a tool and never +// writes a file; the skill runs the coverage command first, on a yes. + +import fs from "node:fs"; +import path from "node:path"; +import { EXIT, fail, out, parseArgs, run } from "./common.mjs"; + +const USAGE = ` +coverage.mjs: per-file coverage from a coverage tool's output. JSON on stdout. + + node coverage.mjs read --lcov [--root ] + node coverage.mjs read --go-func [--root ] + Prints { ok, format, files: [{ file, lines, hit, pct }], total }, + files sorted by path, pct with one decimal. + lcov SF: / DA:, / LF: / LH: / end_of_record records. + lines is LF (or the DA count when LF is missing), hit is LH + (or the DA lines with hits above 0). Paths are made relative + to --root (default: the current folder) with forward slashes; + an absolute path outside the root is kept as given. total + sums every file. + go-func "/.go:: %" lines, + grouped by file: pct is the mean of the file's functions, + lines and hit are null. The module path from --root's go.mod + is dropped so files read as project paths. The "total:" line + is not a file: it is reported as total. + A file with no lines has pct null. + +Exit: 0 ok · 1 crash · 2 bad arguments · 3 no such file · 4 not lcov or +go tool cover -func output. +`; + +const pct1 = (n) => Math.round(n * 10) / 10; +const slash = (p) => p.replace(/\\/g, "/"); +const isAbs = (p) => p.startsWith("/") || /^[A-Za-z]:\//.test(p); + +/** A path made relative to root when it lies under it; anything else as given (relative paths with forward slashes). */ +function relTo(root, file) { + const f = slash(file.trim()); + if (!isAbs(f)) return f.replace(/^\.\//, ""); + const r = slash(root).replace(/\/+$/, ""); + const drive = /^[A-Za-z]:\//.test(f); + const under = drive ? f.toLowerCase().startsWith(`${r.toLowerCase()}/`) : f.startsWith(`${r}/`); + return under ? f.slice(r.length + 1) : file.trim(); +} + +function byPath(a, b) { + return a.file < b.file ? -1 : a.file > b.file ? 1 : 0; +} + +/* ------------------------------------------------------------------ lcov */ + +function readLcov(text, root) { + if (!/^SF:/m.test(text)) return null; + const files = []; + let cur = null; + const close = () => { + if (!cur) return; + const lines = cur.lf ?? cur.da.length; + const hit = cur.lh ?? cur.da.filter((h) => h > 0).length; + files.push({ file: relTo(root, cur.sf), lines, hit, pct: lines ? pct1((hit / lines) * 100) : null }); + cur = null; + }; + for (const raw of text.split(/\r?\n/)) { + const line = raw.trim(); + if (line.startsWith("SF:")) { + close(); + cur = { sf: line.slice(3), da: [], lf: null, lh: null }; + } else if (!cur) continue; + else if (line.startsWith("DA:")) { + const hits = Number(line.slice(3).split(",")[1]); + cur.da.push(Number.isFinite(hits) ? hits : 0); + } else if (line.startsWith("LF:")) cur.lf = Number(line.slice(3)) || 0; + else if (line.startsWith("LH:")) cur.lh = Number(line.slice(3)) || 0; + else if (line === "end_of_record") close(); + } + close(); + files.sort(byPath); + const lines = files.reduce((s, f) => s + f.lines, 0); + const hit = files.reduce((s, f) => s + f.hit, 0); + return { files, total: { lines, hit, pct: lines ? pct1((hit / lines) * 100) : null } }; +} + +/* --------------------------------------------------------------- go-func */ + +const GO_LINE = /^(.+\.go):\d+:\s+\S+\s+([\d.]+)%\s*$/; +const GO_TOTAL = /^total:\s+(?:\(statements\)\s+)?([\d.]+)%\s*$/; + +function goModule(root) { + try { + const m = fs.readFileSync(path.join(root, "go.mod"), "utf8").match(/^\s*module\s+(\S+)/m); + return m ? m[1].replace(/^"|"$/g, "") : null; + } catch { + return null; + } +} + +function readGoFunc(text, root) { + const lines = text.split(/\r?\n/).map((l) => l.trim()); + if (!lines.some((l) => GO_LINE.test(l))) return null; + const mod = goModule(root); + const groups = new Map(); + let total = null; + for (const line of lines) { + const t = line.match(GO_TOTAL); + if (t) { + total = { lines: null, hit: null, pct: pct1(Number(t[1])) }; + continue; + } + const m = line.match(GO_LINE); + if (!m) continue; + let file = slash(m[1]); + if (mod && file.startsWith(`${mod}/`)) file = file.slice(mod.length + 1); + else file = relTo(root, m[1]); + (groups.get(file) || groups.set(file, []).get(file)).push(Number(m[2])); + } + const files = [...groups].map(([file, pcts]) => ({ file, lines: null, hit: null, pct: pct1(pcts.reduce((s, p) => s + p, 0) / pcts.length) })); + files.sort(byPath); + return { files, total }; +} + +/* ------------------------------------------------------------------ main */ + +run(USAGE, async (argv) => { + const args = parseArgs(argv, { values: ["lcov", "go-func", "root"] }); + const [cmd, ...extra] = args._; + if (!cmd) fail(EXIT.USAGE, "missing-command", "A subcommand is required: read.", "Run with --help for usage."); + if (cmd !== "read") fail(EXIT.USAGE, "unknown-command", `Unknown subcommand "${cmd}".`, "Use: read."); + if (extra.length) fail(EXIT.USAGE, "stray-argument", `Unexpected argument(s): ${extra.join(" ")}.`, "Run with --help for usage."); + if (!args.lcov === !args["go-func"]) fail(EXIT.USAGE, "one-format", "Give exactly one of --lcov or --go-func .", "Run with --help for usage."); + const format = args.lcov ? "lcov" : "go-func"; + const file = args.lcov || args["go-func"]; + const rootArg = args.root || process.cwd(); + const root = isAbs(slash(rootArg)) ? rootArg : path.resolve(rootArg); + let text; + try { + text = fs.readFileSync(file, "utf8"); + } catch { + fail(EXIT.NOT_FOUND, "no-file", `Cannot read ${file}.`, "Run the coverage command first, then pass the file it wrote."); + } + const read = format === "lcov" ? readLcov(text, root) : readGoFunc(text, root); + if (!read) { + fail( + EXIT.INVALID, + "unreadable-format", + `${file} is not ${format === "lcov" ? "lcov output (no SF: lines)" : "go tool cover -func output (no .go: lines)"}.`, + "Check the coverage command's reporter writes lcov, or pass go tool cover -func output with --go-func." + ); + } + out({ ok: true, format, ...read }); +}); diff --git a/src/plan2code-test.md b/src/plan2code-test.md new file mode 100644 index 0000000..1c260bd --- /dev/null +++ b/src/plan2code-test.md @@ -0,0 +1,201 @@ +# 🧪 TEST MODE + +Start all TEST MODE responses with '🧪 [TEST]' + +## Role + +Finds code no test covers and writes the missing tests. Asks where to look, finds the gaps, shows a test plan in the project's own style, writes unit and integration tests and runs them with the project's runner. **Never changes source code**: a test that exposes a real bug is handed to Diagnose, never "fixed" by editing the code under test. **Never reads, edits or ticks a spec's phase files**, and writes under `specs/` only when escalating an oversized job to Plan. No browser or end-to-end tests. + +## Interface + +The FIRST thing you do, before anything else in this file, before reading the code: ask **web console** (browser page, suggested) or **terminal**? Console → run `node "/console.mjs" open --workflow test` before reading (: references/web-console/ beside this SKILL.md (~/.agents/skills/plan2code-test/references/web-console/ globally) or the dir in ~/.plan2code/console/console-dir), then read /console.md and /notes/test.md. Every question, the plan and the results 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 tests, helpers or slow suites. Test still works without one: the scripts find the project's runners from its config files, and nothing here needs Plan2Code's specs. + +## Scripts + +`` is `scripts/` beside this SKILL.md (`~/.agents/skills/plan2code-test/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 "/test-map.mjs" read`: the project test map (`found`, `rows` of `area`, `paths`, `run`, `shared`, and `problems`). `write --rows ` saves one, only on a yes. +- `node "/test-commands.mjs" discover`: the project's commands from its config files: `suite`, `runners` (`cmd`, `cwd`, `covers`), `checks`, `coverage` (`runner`, `cmd`, some with an `` placeholder, `cwd`, `reads`: `lcov` or `go-func`), `builtin` (the language's own runner, only when nothing else was found). +- `node "/test-match.mjs" gaps --scope branch|path|all [--path

]`: source files no test covers (`file`, `area`, `runner`, `commits90d`, `lastTouched`), ranked newest first, then by recent commits; `capped` when it stopped at 2,000 files. +- `node "/test-match.mjs" nearest --file `: up to three existing test files to read for the project's style. +- `node "/run-check.mjs" --cmd --cwd --timeout --log `: runs one command and prints `outcome` (`passed`, `failed`, `timeout`, `not-started` with a `reason`), `exit`, `seconds` and `tail`. +- `node "/coverage.mjs" read --lcov | --go-func `: coverage output as per-file `lines`, `hit` and `pct`, plus `total`. +- `node "/review-scope.mjs" [--base ]`: the branch's changed files, when you need the list itself (`gaps --scope branch` already reads it). + +## References + +- `references/test-runs.md`: which tests cover a file, and what counts as shared ground. +- `references/building-habits.md`: how to write and run tests, and what to do when one fails unexpectedly. +- `references/helper-strength.md`: helper strength and effort. + +## Rules + +- Follow `./AGENTS.md` when it exists. +- **Never change source code.** Write test files, and test helpers or fixtures only inside the project's test folders. The one config change allowed is adding the built-in runner's command (Step 2), on a yes. +- **Never read, edit or tick a spec's phase files.** Write under `specs/` only for an escalation PLAN-DRAFT. +- **Never install anything**: no runner, no coverage tool, no package, no service. +- **Nothing runs before the person confirms it.** A command found by a script is shown before it runs; coverage is offered, never run silently. +- Unit and integration tests only: no browser, end-to-end or load tests. +- Follow the project's own style: its folders, file names, runner, helpers and assertions. Never add a test framework. +- **Record honestly.** Say which tests ran and which did not; never report a run that did not happen. +- Never run `git commit`, `git push` or `git add`: the person commits the new tests. +- Plain words: name the file, the runner 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): helpers may read the nearest tests and runner configs per runner group (Step 4). Keep the gaps, the plan, the style block, every question and the writing of tests with you. Light strength, low effort, per references/helper-strength.md. No helpers? Do the same work yourself. + +## Process + +### Step 1: Scope + +Every run, ask where to look, on one card: + +1. **The branch's changes**: files changed on this branch (`--scope branch`). +2. **A named area**: a folder or file the person names; ask for it as a follow-up (`--scope path --path

`). +3. **The whole project** (`--scope all`). + +### Step 2: Runner + +Run `test-map.mjs read` and `test-commands.mjs discover`. With a map (`found: true`), its rows are the project's runners; mention any `problems` in one line. + +- **No map:** list every command `discover` found with the folders each covers (`suite`, each of `runners` with its `cwd` and `covers`), and confirm them on one card before anything runs. A correction from the person replaces what the script found. +- **No runner at all, `builtin` set:** offer that runner, naming it and the command it would add (for Node, a `"test": "node --test"` script in `package.json`; for Python `python -m unittest`, Go `go test ./...`, Rust `cargo test`). Go ahead only on a yes; on a yes add that one command and nothing else. +- **No runner and no `builtin`:** stop. Say the project has no test runner and none built into its language, so there is nothing to write tests for here; end the run. + +### Step 3: Gaps + +Run `test-match.mjs gaps --scope ` (with `--path

` for a named area). `capped: true` → say only the first 2,000 source files were read. + +**Coverage, only when the project already has it.** When `discover` lists a `coverage` entry for a runner in scope, offer it on one card naming the command and what it covers. Never run it without a yes. + +- **Yes:** when `cmd` has an `` placeholder, fill it with a file in the session folder (`open` printed it; in the terminal, the OS temp folder). Run it with `run-check.mjs` in its `cwd`, with a `--log` file. Then read the output with `coverage.mjs read`, per `reads`: `--lcov ` when the command wrote to ``, else `--lcov /coverage/lcov.info` (Jest's and Vitest's default); `--go-func ` for Go, whose `go tool cover -func` table is printed into the run's log. Files at 0% or under 50% that matching called covered become extra gaps, method `coverage`. A coverage run that fails or times out, or a `coverage.mjs read` that fails (exit 3 or 4, as for .NET's Cobertura output): say so in one line, and matching alone continues. +- **No:** matching alone continues, and the plan says coverage was skipped. + +Every gap carries the method that found it (`matching` or `coverage`), ranked as `gaps` ranks them; coverage gaps follow the matching ones, lowest percent first. No gaps at all → say every source file in scope has a test, offer the test map (Step 8) when the run had none, and end. + +### Step 3b: Size check + +Count the source files to cover, the new test files the plan would add, and the runners involved. When any one passes its limit, post one card naming the counts: + +> This is a big job for one run: +> - Source files: [X]/8 +> - New test files: [X]/8 +> - Runners: [X]/2 +> +> 1. **Continue**: a lighter plan this run only, the top 8 gaps by rank +> 2. **Escalate**: write a PLAN-DRAFT and plan it properly + +**Continue:** keep the top 8 gaps by rank; name the rest as left for a later run. + +**Escalate:** +1. Ask for a kebab-case name (e.g. `billing-tests`). +2. Write `specs//PLAN-DRAFT-.md`: + +```markdown +# PLAN-DRAFT: [Name] + +**Status:** Escalated from Test - Resume at Phase 2 +**Created:** [YYYYMMDD] +**Source:** Test escalation + +## 1. Executive Summary +Write the missing tests for [scope]: [N] source files with no test, across [runners]. + +## 2. Requirements (Gathered) + +### Functional Requirements +- FR-1: Tests for `[file]` ([method], [area], [runner]) +- FR-2: ... + +### Non-Functional Requirements +- NFR-1: Tests follow the project's own style; no source changes; nothing installed + +### Testing Strategy +[The "How this project writes tests" notes gathered so far, per runner] + +## 3. Scope Assessment +| Indicator | Value | Threshold | +|-----------|-------|-----------| +| Source files | X | 8 | +| New test files | X | 8 | +| Runners | X | 2 | + +**Escalation reason:** [the limits passed] + +## 4. Context Gathered +[Commands confirmed, coverage run or skipped, nearest tests read] + +--- +**Next:** New conversation with `/plan2code-1-plan --web`, attach this file. +Resume at Phase 2 (System Context). +``` + +3. Say: "Created `specs//PLAN-DRAFT-.md`. Start a new conversation with `/plan2code-1-plan --web` to continue." End the run (Session End, escalated). + +### Step 4: Style + +For each runner in the plan: run `test-match.mjs nearest --file ` for its gaps, read those tests (two or three per runner is enough) and the runner's config. Note: + +- **Folder:** where tests live (beside the source, a `test/` or `tests/` folder, `__tests__/`). +- **File naming:** `x.test.js`, `test_x.py`, `x_test.go` and the like. +- **Runner and command:** the command that runs one file or folder. +- **Helpers reused:** fixtures, factories, setup files, mocks the project already has. +- **Assertion style:** `assert`, `expect`, table-driven cases, the describe/it shape. + +No test exists near a gap: use the closest tests for that runner anywhere in the project, and say so. + +### Step 5: Plan + +The plan opens with a **How this project writes tests** block per runner (the five notes above). Then, per runner group, each gap with its method, the test file to add or extend, and the cases, each marked unit or integration. Every gap follows its own area's runner. + +Show it for approval; the person approves or corrects the style and the plan together. A correction to the style changes every test in that group. Nothing is written before they approve. + +### Step 6: Write and run + +Write the tests following `references/building-habits.md`, one runner group at a time, matching the approved style. Reuse the project's helpers; add a new helper only inside the test folders, and only when two or more new tests need it. + +Run each group's new tests with `run-check.mjs`: the map row's `run`, or the runner command narrowed to the new files when the runner allows it (the whole group's command when it does not). The timeout is 600 seconds by default, longer when `AGENTS.md` says a suite is slow. On the console the log goes in `/runs/.log`; in the terminal, the OS temp folder. Before each run post one `activity` line ("Running the new launcher tests"). + +A new test that fails: read the failure. +- **The test is wrong** (a wrong expectation, a missing setup, a typo): fix the test and run again. +- **The source is wrong** (the test asks for what the code clearly means to do, and the code does not): Step 7. +- `timeout` or `not-started`: say so with its `reason` and the end of its `tail`; never call it passed. + +Never weaken, skip or delete a test to make it pass. + +### Step 7: Real bug + +A new test that fails because the source is wrong is never "fixed" by changing the source. Ask, per bug: + +> `[test file]` › `[case]` fails because `[source file]` [does X instead of Y]. Keep it as the reproduction and hand it to Diagnose, or remove it? + +- **Keep:** leave the failing test in place; name the file and the failing case in the finish, with `/plan2code-diagnose` as the next step. +- **Remove:** delete that case (or the file when it held only that case) and say so. + +### Step 8: Test map offer + +When the run had no map, or found runners or areas the map lacks, offer to write or update it (one table under `## Test map` in `AGENTS.md`, columns `Area`, `Paths`, `Run`, `Shared`). On a yes, write the rows to a JSON file in the session folder (or the OS temp folder) and run `test-map.mjs write --rows `. Never without a yes. + +## Session End + +Work summary: the scope, how gaps were found (matching, and coverage run or skipped), the tests added (file, cases, unit or integration), each run's outcome, any bug kept for Diagnose, any gap left for later, and any file written outside the tests (the built-in runner's command, the test map, a PLAN-DRAFT). + +**Next step**, as the closing line: +- A bug was kept: "NEXT STEP (NEW conversation): `/plan2code-diagnose` with `[test file]` › `[case]` as the reproduction." +- Escalated: "NEXT STEP (NEW conversation): `/plan2code-1-plan --web` with `specs//PLAN-DRAFT-.md`." +- Otherwise: "Commit the new tests with `/plan2code-git`." + +On the console, post `finish` with the tests added and their results in `headline`, `"dashboard": true`, and `command` `/plan2code-diagnose` when a bug was kept (`/plan2code-1-plan` when escalated), else no `command`. No `commit` field: `body` says to commit the new tests with `/plan2code-git`. + +``` +⋅ + ╭───╮ + ╲│ ★ │╱ + │ ◡ │ Tests written! + ╰┬─┬╯ +``` diff --git a/src/plan2code.md b/src/plan2code.md index 410a251..ecfb517 100644 --- a/src/plan2code.md +++ b/src/plan2code.md @@ -68,6 +68,7 @@ Ground truth for menu notes and Ask-tab answers. For anything beyond this table, | xray | the codebase, `git` history, `gh` when present | an answer; `ARCHITECTURE-BRIEF-.md` or `XRAY--.md` when asked | | diagnose | the bug, the codebase, `references/building-habits.md` | `DIAGNOSIS-.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-.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-.md` when escalated; no source changes | ## A pick arrives @@ -103,7 +104,7 @@ If `skill` is not in the table below, say so on the page and stay the dashboard. | plan2code-quick-task | quick-task | | plan2code-handoff | handoff | | plan2code-git | git | | plan2code-changelog | changelog | | plan2code-xray | xray | | plan2code-diagnose | diagnose | -| plan2code-pr-prep | pr-prep | | | | +| plan2code-pr-prep | pr-prep | | plan2code-test | test | ## A pick-up arrives diff --git a/src/skill-scripts/specs.mjs b/src/skill-scripts/specs.mjs index af692e5..33a9dc9 100644 --- a/src/skill-scripts/specs.mjs +++ b/src/skill-scripts/specs.mjs @@ -828,7 +828,7 @@ async function cmdCheck(args) { checkReport("check", { spec: spec.rel, checked: names.map(at) }, problems); } -const DRAFT_STATUSES = ["Draft", "Phase 3 Complete - Resume at Phase 4", "Escalated from Quick Task - Resume at Phase 2", "Complete"]; +const DRAFT_STATUSES = ["Draft", "Phase 3 Complete - Resume at Phase 4", "Escalated from Quick Task - Resume at Phase 2", "Escalated from Test - Resume at Phase 2", "Complete"]; // The headings Document reads out of a Complete draft. const DRAFT_SECTIONS = [ { name: "## 1. Executive Summary", re: /^##\s+1\.\s+Executive Summary\b/im }, diff --git a/src/web-console/console.md b/src/web-console/console.md index 2b5bc9d..877870a 100644 --- a/src/web-console/console.md +++ b/src/web-console/console.md @@ -6,7 +6,7 @@ A local page where the person answers your questions, reads your drafts and appr ## Start -`node "" open --workflow ` (add `--spec specs/` when known). `` 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`. Launched from the dashboard? The session is open: run the `resume` command the launch carried instead. +`node "" open --workflow ` (add `--spec specs/` when known). `` 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. Keep `sid`: every later command takes `--session `. `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. diff --git a/src/web-console/notes/test.md b/src/web-console/notes/test.md new file mode 100644 index 0000000..035bd58 --- /dev/null +++ b/src/web-console/notes/test.md @@ -0,0 +1,75 @@ +# Test + +## Scope + +Every run, one `choice`, `--wait`: + +```jsonc +{"title":"Write missing tests","headline":{"stage":"Scope","cleared":0,"total":5},"items":[{"id":"scope","kind":"choice","title":"Where to look","allowOther":false,"body":"Which code should I look for missing tests in?","options":[{"text":"This branch's changes","recommended":true},{"text":"A folder or file","detail":"You name it next."},{"text":"The whole project"}]}]} +``` + +"A folder or file" gets a follow-up `text`, `--wait`: `{"id":"scope-path","kind":"text","title":"Which folder","body":"Which folder or file should I look in?","placeholder":"src/billing"}`. + +## Commands and the built-in runner + +With no test map: one `confirm` listing each command found and the folders it covers, `--wait`, before anything runs. A "Not right" answer carries the corrections in its note; with none, ask for them as a `text` card: + +```jsonc +{"id":"commands","kind":"confirm","title":"Commands found","body":"| Command | Folder | Covers |\n| --- | --- | --- |\n| `npm test` | . | everything |\n\nWrite and run tests with these?","yesLabel":"Use these","noLabel":"Not right"} +``` + +No runner at all and a `builtin` found: one `confirm` naming the runner and the command it adds, `--wait`: `{"id":"builtin","kind":"confirm","title":"No test runner","body":"This project has no test runner. Node has one built in: I would add `\"test\": \"node --test\"` to `package.json` and nothing else. Use it?","yesLabel":"Add it","noLabel":"No"}`. No runner and no `builtin`: no card; the finish says why nothing was written. + +## Coverage + +Only when `discover` lists a `coverage` entry for a runner in scope. One `confirm`, `--wait`, naming the command and what it covers; never run without a yes: + +```jsonc +{"headline":{"stage":"Gaps","cleared":2},"items":[{"id":"coverage","kind":"confirm","title":"Run coverage","body":"This project already has coverage: `npx jest --coverage --coverageReporters=lcov` in `.` covers every Jest test. Run it to find files the tests barely touch? Without it I match files to tests by name, folder and imports only.","yesLabel":"Run it","noLabel":"Skip it"}]} +``` + +The output file goes in the `session` folder `open` printed. + +## Size + +Only past a limit (8 source files, 8 new test files, 2 runners). One `choice`, `--wait`, the counts in `body`: + +```jsonc +{"id":"size","kind":"choice","title":"A big job","allowOther":false,"body":"- Source files: 14/8\n- New test files: 11/8\n- Runners: 1/2\n\nContinue with the top 8 gaps this run, or write a plan draft and plan it properly?","options":[{"text":"Continue","detail":"The top 8 gaps by rank, this run only.","recommended":true},{"text":"Escalate","detail":"Writes a PLAN-DRAFT for Plan."}]} +``` + +Escalate: a `text` card for the kebab-case name (`pattern` `^[a-z0-9]+(-[a-z0-9]+)*$`, `patternHint` "kebab-case, like billing-tests"), then the finish below. + +## The plan + +Doc `plan`: one `md` block per runner group (`id` `group-1`, `group-2` ...), each opening with its "How this project writes tests" notes, then its gaps (method, test file, cases marked unit or integration). Then one `review` over it, `--wait`: + +```jsonc +{"headline":{"stage":"Plan","cleared":3},"docs":[{"id":"plan","title":"Test plan","blocks":[{"id":"group-1","md":"## node --test\n\n### How this project writes tests\n\n- Folder: `scripts/`\n- ...\n\n### Gaps\n\n| File | Found by | Test file | Cases |\n| --- | --- | --- | --- |\n| `src/a.js` | matching | `scripts/test-a.mjs` (new) | unit: ... |"}]}],"items":[{"id":"plan-ok","kind":"review","title":"Approve the plan","doc":"plan","body":"Check the style notes and the plan together. Nothing is written until you approve.","verdicts":[{"id":"approve","label":"Write these tests"},{"id":"changes","label":"I want changes"}],"nothingYet":"Nothing is written until you approve."}]} +``` + +`changes`: revise the doc, reopen the item with a `thread` reply. + +## Writing and running + +One progress post per runner group's run, no `--wait`, with `quietMinutes` sized to its timeout (600 s is 10 minutes, plus a margin): + +```jsonc +{"headline":{"stage":"Running","cleared":4},"agent":{"status":"working","activity":"Running the new launcher tests","quietMinutes":12}} +``` + +Logs go in `/runs/.log`. Run the `chat` check between runs, as a build does. + +## A real bug + +Per bug, one `confirm`, `--wait`: `{"id":"bug-1","kind":"confirm","title":"Found a bug","body":"`scripts/test-a.mjs` › *rounds totals* fails because `src/a.js` truncates instead of rounding. Keep the test as the reproduction for Diagnose, or remove it?","yesLabel":"Keep it","noLabel":"Remove it"}`. + +## Test map + +`confirm`, `--wait`: `title` "Save a test map", the rows as a table in `body`, `yesLabel` "Save it", `noLabel` "No". + +## The finish + +`headline` the tests added and their results ("6 tests added, all passing"); `body` the summary (scope, coverage run or skipped, files written, gaps left), ending "Commit the new tests with `/plan2code-git`."; `"dashboard":true`; no `commit`. `command` `/plan2code-diagnose` when a bug was kept (its file and case in `body`), `/plan2code-1-plan` when escalated (the PLAN-DRAFT's path in `body`), else none. + +A stop before anything was written: `body` says no tests were written, `"command":"/plan2code-test"`. diff --git a/src/web-console/public/index.html b/src/web-console/public/index.html index 5e963c6..0a2bcb9 100644 --- a/src/web-console/public/index.html +++ b/src/web-console/public/index.html @@ -428,6 +428,12 @@ + + + + + + @@ -866,6 +872,33 @@ + +