diff --git a/.agents-docs/AGENTS-architecture-install.md b/.agents-docs/AGENTS-architecture-install.md index 6207850..acf75c4 100644 --- a/.agents-docs/AGENTS-architecture-install.md +++ b/.agents-docs/AGENTS-architecture-install.md @@ -155,7 +155,7 @@ plan2code/ | `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-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, then offer a final review of the removals in the same session (Step 7.5, recommended yes; ships `review.md`, `review-in-build.md`, `test-runs.md` and the review references, as Finalize does); never commits, never installs a tool. Scripts: `dead-code.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs`, `specs.mjs`, `commit-msg.mjs`, `review-scope.mjs`, `lessons.mjs` | -| `plan2code-deps.md` | deps | Update dependencies: scan every manifest (the npm family, Cargo, pip and uv, Go, .NET), label each available update Safe, Check first or Warning with a reason, show a pick list, apply the picks in batches, run the project's install and checks after each batch and put back whatever breaks (narrowing a failed batch to the breaking pick); a ticked Warning writes `specs/-upgrade/UPGRADE-.md` instead. The dashboard scan reports such a folder as spec state `upgrade` ("Upgrade ready"), which lights Quick Task (suggested) and Plan; once Quick Task applies it and marks the brief `Done` the state is `upgraded` ("Upgrade done"), finished like `fixed`. Never commits, installs a tool, edits source code or updates anything not picked. Scripts: `deps.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs` | +| `plan2code-deps.md` | deps | Update dependencies: scan every manifest (the npm family, Cargo, pip and uv, Go, .NET), label each available update Safe, Check first or Warning with a reason, show a pick list, apply the picks in batches, run the project's install and checks after each batch and put back whatever breaks (narrowing a failed batch to the breaking pick); a ticked Warning writes `specs/-upgrade/UPGRADE-.md` instead. The dashboard scan reports such a folder as spec state `upgrade` ("Upgrade ready"), which lights Quick Task (suggested) and Plan; once Quick Task applies it and marks the brief `Done` the state is `upgraded` ("Upgrade done"), finished like `fixed`. Never commits or updates anything not picked; installs a scanner or fixes a small break in project code only after the person approves that exact change, and puts the fix back if it fails. Scripts: `deps.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs` | | `plan2code-ui-prototype.md` | ui-prototype | Draw several versions of a screen or flow on one page with live dials (drafts under `~/.plan2code/prototypes/`), bring the pick back by Copy and paste for the next round, and save the pair into `specs//prototypes/` only on a yes; never changes 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 | diff --git a/README.md b/README.md index e8cce18..03d3a90 100644 --- a/README.md +++ b/README.md @@ -439,7 +439,7 @@ console or the terminal; add `--web` to skip the question and go straight to the | `/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-deps` | Clear a dependency backlog in one sitting. Scans every manifest (npm, pnpm, Yarn, Cargo, pip, uv, Go, .NET), labels each update Safe, Check first or Warning with a reason, applies the ones you pick in batches, runs the install and your checks after each batch and puts back whatever breaks; a ticked Warning writes `specs/-upgrade/UPGRADE-.md`, which the dashboard shows as *Upgrade ready* for `/plan2code-quick-task` or `/plan2code-1-plan`; never commits, never installs a tool, never edits source code | +| `/plan2code-deps` | Clear a dependency backlog in one sitting. Scans every manifest (npm, pnpm, Yarn, Cargo, pip, uv, Go, .NET), labels each update Safe, Check first or Warning with a reason, applies the ones you pick in batches, runs the install and your checks after each batch and puts back whatever breaks; a ticked Warning writes `specs/-upgrade/UPGRADE-.md`, which the dashboard shows as *Upgrade ready* for `/plan2code-quick-task` or `/plan2code-1-plan`; never commits; installs a scanner or fixes a small break in your code only after you approve that exact change | | `/plan2code-ui-prototype` | See a screen before it gets built. Draws several versions of a screen or flow on one page that opens in your browser, with live dials for fonts, colors, spacing and feel; Copy and paste brings your pick back for the next round, and a yes saves it as `specs//prototypes/.html` and `.md`; never changes your code | | `/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/scripts/test-script-deps.mjs b/scripts/test-script-deps.mjs index 1a3ee9b..b08db4d 100644 --- a/scripts/test-script-deps.mjs +++ b/scripts/test-script-deps.mjs @@ -2644,6 +2644,16 @@ test("failedTests reads each runner's failing tests; TODO and SKIP lines are no assert.deepEqual(deps.failedTests("\x1b[31m--- FAIL: TestColor (0.00s)\x1b[0m\n"), { names: ["TestColor"], known: true }, "color codes are dropped"); }); +test("baseline without --outcome reads a bare FAIL line as a failure, and a TODO line as none", () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "deps-bare-")); + const jestDefault = path.join(dir, "jest-default.txt"); + fs.writeFileSync(jestDefault, "PASS src/a.test.js\nFAIL src/b.test.js\n"); + const todo = path.join(dir, "todo.txt"); + fs.writeFileSync(todo, "ok 1 - adds\nnot ok 2 - later # TODO\n"); + assert.deepEqual(deps.readCheckLog(jestDefault), { names: [], known: false, outcome: "failed" }); + assert.equal(deps.readCheckLog(todo).outcome, "passed"); +}); + test("judgeCheck and compareCheck: red before, flaky and new failures by name; a whole command when the log is unknown", () => { const log = (names, outcome = names.length ? "failed" : "passed", known = true) => ({ names, known, outcome }); const base = (first, retry) => { diff --git a/src/plan2code-deps-scripts/deps.mjs b/src/plan2code-deps-scripts/deps.mjs index 5defef2..b5cd1f1 100644 --- a/src/plan2code-deps-scripts/deps.mjs +++ b/src/plan2code-deps-scripts/deps.mjs @@ -4113,7 +4113,7 @@ const OUTCOMES = new Set(["passed", "failed", "timeout", "not-started"]); * timeout, are judged as a whole command (known false); a passing run names * none. */ -function readCheckLog(file, outcome, flag) { +export function readCheckLog(file, outcome, flag) { let text; try { text = fs.readFileSync(path.resolve(file), "utf8"); @@ -4122,7 +4122,9 @@ function readCheckLog(file, outcome, flag) { } if (outcome && !OUTCOMES.has(outcome)) fail(EXIT.USAGE, "bad-outcome", `${flag} must be passed, failed, timeout or not-started.`, "Pass run-check's outcome."); const parsed = failedTests(text); - const result = outcome || (parsed.names.length ? "failed" : parsed.known ? "passed" : null); + // Without run-check's outcome, a bare FAIL or not ok line (Jest's default output, Go's package line) is a failure even when it names no test. + const bareFail = text.split(/\r?\n/).some((l) => /^\s*(?:FAIL\b|not ok\b)/.test(l) && !/#\s*(?:TODO|SKIP)\b/i.test(l)); + const result = outcome || (parsed.names.length || bareFail ? "failed" : parsed.known ? "passed" : null); if (!result) fail(EXIT.USAGE, "missing-outcome", `${file} is in a format I cannot read, so its result is unknown.`, `Pass ${flag} with run-check's outcome.`); const names = result === "passed" ? [] : parsed.names; return { names, known: parsed.known && result !== "timeout" && (result === "passed" || names.length > 0), outcome: result }; diff --git a/src/plan2code-deps.md b/src/plan2code-deps.md index 6a89856..aea8e83 100644 --- a/src/plan2code-deps.md +++ b/src/plan2code-deps.md @@ -131,7 +131,7 @@ Post progress as `notes/deps.md` says (time left after the first group), with th **Packages that need your code changed.** One card listing every Warning row, every Check first big change that broke and was undone, and every `needs a bigger change` pick, all unticked, each with what blocks it. For the rows the person ticks, run `handoff --ids ` and name each upgrade brief written. None to list: skip the card. -**Report.** On the page (in the terminal, as a table): the headline says what happened first, in a sentence ("Nothing was changed. 1 update broke the tests and was undone; 3 were not tried"); folders looked at; then each row with its label, `reasonsPlain` and outcome: updated, `not applied: ` as "not updated: ", `failed: ` as "broke the checks and was undone: ", `skipped` as "left out: ", `not tried` as "not tried: an earlier problem stopped the run", not picked, held back as "locked in place: ", `not scanned` as "not looked at: "; tests that were failing before the run; `stillOpen` security problems; missing tools with install lines; folders the test map lacks (point to `/plan2code-pr-prep` or `/plan2code-test`); changes already there before the run, marked as such; and any upgrade brief written. +**Report.** On the page (in the terminal, as a table): the headline says what happened first, in a sentence ("Nothing was changed. 1 update broke the tests and was undone; 3 were not tried"); folders looked at; then each row with its label, `reasonsPlain` and outcome: updated, `not applied: ` as "not updated: ", `failed: ` as "broke the checks and was undone: ", `skipped` as "left out: ", `not tried` as "not tried: an earlier problem stopped the run", not picked, held back as "locked in place: ", `not scanned` as "not looked at: "; tests that were failing before the run; `stillOpen` security problems; missing tools with install lines; folders the test map lacks (point to `/plan2code-pr-prep` or `/plan2code-test`); changes already there before the run, marked as such; each small fix kept (file and the one-line change, from `fixes.json` or `restore`'s `fixed`; none: leave it out); and any upgrade brief written. Then `cleanup --run ` (not after an unfinished put-back) and the finish. @@ -145,7 +145,7 @@ Every finish, early or not (no lockfiles, a Stop on the start screen, the no-reg Work summary: folders looked at, rows by label, what was updated, what broke and why, what was undone, left out or not tried, the checks that ran, any upgrade brief, and any tool to install for a fuller scan. -**Next step**, as the closing line: "Look over the changes to the package list and version list (they are not staged) and save them with `/plan2code-git`." Nothing changed: "Nothing to save." A brief written: also "Run `/plan2code-quick-task` or `/plan2code-1-plan` on `specs/-upgrade/`." After an undo that did not finish: "Restore the files from `/backups//files/` (or run the reinstall) before you save anything." +**Next step**, as the closing line: "Look over the changes to the package list, the version list and any file I fixed (they are not staged) and save them with `/plan2code-git`." Nothing changed: "Nothing to save." A brief written: also "Run `/plan2code-quick-task` or `/plan2code-1-plan` on `specs/-upgrade/`." After an undo that did not finish: "Restore the files from `/backups//files/` (or run the reinstall) before you save anything." On the console, post `finish` with a `headline` that says what happened first in a sentence (counts updated, broke and not tried), `"dashboard": true`, and `command` `/plan2code-git` when something changed (none after an undo that did not finish); never a `commit` field. A stop before any apply: the body says nothing was changed, `command` `/plan2code-deps`.