feat(plan): read Files by the 1.9 grammar, warn on unticked paths below it [skip-docs]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-12 16:09:25 +02:00
commit 3e1a811c60
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
6 changed files with 330 additions and 16 deletions

View file

@ -2,6 +2,12 @@
// Builds plan_version 1.8 plans for the plan-contract tests (K3 gate, K4 step
// fields, the design part, the scope sweep). One builder, many variants, so a
// test states only the difference it is about.
//
// Raw options on step() write a field the generated form cannot (the
// plan_version 1.9 grammar tests): `filesRaw` is the `Files:` value written
// verbatim after `- **Files:** `; `testFirstRaw` is the whole `Test first:`
// `File:` line written verbatim in place of ` - File: `<test>` (new)`. Without
// them the output is unchanged.
function manifest(paths) {
return [
@ -25,7 +31,7 @@ export function step(n, opts = {}) {
const lines = [
`### Step ${n}: ${opts.title ?? `Build module ${n}`}`,
'',
`- **Files:** \`${file}\``,
opts.filesRaw !== undefined ? `- **Files:** ${opts.filesRaw}` : `- **Files:** \`${file}\``,
`- **Changes:** Add \`run${n}()\` to \`${file}\`. (new file)`,
];
if (opts.interfaceIn !== undefined) lines.push(`- **Interface in:** ${opts.interfaceIn}`);
@ -34,7 +40,7 @@ export function step(n, opts = {}) {
if (opts.testFirst !== false) {
lines.push(
'- **Test first:**',
` - File: \`${test}\` (new)`,
opts.testFirstRaw !== undefined ? opts.testFirstRaw : ` - File: \`${test}\` (new)`,
` - Verifies: run${n}() returns the value the next step reads`,
' - Pattern: `tests/lib/plan-schema.test.mjs`',
);