diff --git a/scripts/test-script-finalize.mjs b/scripts/test-script-finalize.mjs index 32a6f3b..1a6fe96 100644 --- a/scripts/test-script-finalize.mjs +++ b/scripts/test-script-finalize.mjs @@ -1,4 +1,5 @@ -// Tests for plan2code-4-finalize's scripts/feedback-payload.mjs. +// Tests for plan2code-4-finalize's scripts/feedback-payload.mjs and Step 5's +// opening question. // // See skill-script-helpers.mjs for how these run. @@ -172,3 +173,25 @@ test("feedback-payload: submit refuses an oversize URL when gh fails, and dry-ru assert.match(j.next, /--truncate/); assert.match(j.next, /gh/); }); + +/* ===================================================== Step 5's opening question */ + +// What a person sees break: Finalize posts the rating and reason cards straight +// away, and opting out takes a scroll to Skip on every one of them. +test("Step 5 asks one question first, with a No thank you, on the page and in the terminal", () => { + const notes = fs.readFileSync(path.join(ROOT, "src/web-console/notes/finalize.md"), "utf8"); + const row = notes.split("\n").find((line) => line.startsWith("| 5, Feedback")); + assert.ok(row, "the notes have a row for Step 5"); + const opening = row.indexOf('`confirm` "Rate this run"'); + assert.ok(opening !== -1, "the row opens on the Rate this run card"); + assert.match(row, /`noLabel` "No thank you"/); + assert.ok(opening < row.indexOf("rating as `choice`"), "the opening card comes before the rating card"); + assert.ok(row.indexOf("No thank you") < row.indexOf("rating as `choice`"), "the way out comes before the rating card"); + assert.match(row, /No: Step 6, no more cards/, "No thank you ends the questions on the page"); + + const prompt = fs.readFileSync(path.join(ROOT, "src/plan2code-4-finalize.md"), "utf8"); + const step = prompt.slice(prompt.indexOf("### STEP 5:"), prompt.indexOf("### STEP 6:")); + assert.match(step, /on its own/, "the prompt asks the opening question alone"); + assert.ok(step.indexOf("on its own") < step.indexOf("**Rating**"), "the opening question comes before the rating"); + assert.match(step, /On no, skip to Step 6 and ask nothing more/, "no ends the questions in the terminal"); +}); diff --git a/src/plan2code-4-finalize.md b/src/plan2code-4-finalize.md index ca8331a..782eec9 100644 --- a/src/plan2code-4-finalize.md +++ b/src/plan2code-4-finalize.md @@ -240,7 +240,7 @@ Do NOT make documentation changes without user approval. **Objective:** Collect optional feedback before archival. -Ask the user: "Would you like to provide feedback on this run? (optional)" If no, skip to Step 6. +Ask this one question on its own, before any of the others: "Would you like to rate this run? (yes / no thank you)" On no, skip to Step 6 and ask nothing more about feedback. If yes, collect: 1. **Rating** (1-10): "How would you rate this workflow run overall?" diff --git a/src/web-console/notes/finalize.md b/src/web-console/notes/finalize.md index 229346f..5912530 100644 --- a/src/web-console/notes/finalize.md +++ b/src/web-console/notes/finalize.md @@ -7,7 +7,7 @@ | 2.5, Final review | Always: `confirm` "Run a final review" (`yesLabel` "Review it", `noLabel` "Skip it", files and ~lines in `body`). Yes: `building-review.md`, the `finalize` door. | | 3, Summary | Written to `overview.md`; mirror it as a doc (`saved`, `file` block). | | 4, Docs review | Proposed-updates table as a doc, plus a `multi` of documents (ticked = approved, `required:false` so Skip means no doc changes); a `review` if all-or-nothing. | -| 5, Feedback | `required:false`: rating as `choice` 1 to 10 or `text`, three reasons as `text`, maintainer consent as `confirm`. | +| 5, Feedback | Alone first: `confirm` "Rate this run" (`yesLabel` "Rate it", `noLabel` "No thank you"). No: Step 6, no more cards. Yes, `required:false`: rating as `choice` 1 to 10 or `text`, three reasons as `text`, maintainer consent as `confirm`. | | 6, Cleanup | `review` (`doc` Step 3's summary), verdicts `yes` ("Archive it"), `show` (token `show me`), `no`; archive paths in `body`, and a line that remembered workspace folders are forgotten too (`console.mjs forget --spec specs/` after the move). On `show`, see `notes/implement.md`, then reopen without `show`. | Post `activity` as each step starts. Pass `--spec specs/` or post `specDir`.