diff --git a/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs b/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs index c8626766c..c3ddc3989 100755 --- a/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs +++ b/harness/pstack/claude-code/skills/poteto-mode/scripts/check-plan.mjs @@ -72,7 +72,7 @@ for (let i = start; i < raw.length; i++) { lines.push({ n, text, code }); if (code) continue; const prose = text - .replace(/`[^`]*`/g, "`") + .replace(/(? { const result = runPlan("```markdown `invalid`\n## Example only\n```\n", 1); expect(result.stderr).toContain('"## Example only" after Close the program is not an appendix'); }); + +test("ignores prose punctuation inside matching multi-backtick code spans", () => { + for (const count of [2, 3, 4]) { + const delimiter = "`".repeat(count); + runPlan(`Use ${delimiter}echo \`x\`: “quoted” — example${delimiter}.\n`, 0); + } +}); + +test("checks prose following a multi-backtick span and unmatched delimiters", () => { + const outside = runPlan("Use ``echo `x`: y``. Bad: prose.\n", 1); + expect(outside.stderr).toContain("mid-sentence colon"); + const unmatched = runPlan("Use ``unclosed: bad` here.\n", 1); + expect(unmatched.stderr).toContain("mid-sentence colon"); +}); diff --git a/pstack/skills/poteto-mode/scripts/check-plan.mjs b/pstack/skills/poteto-mode/scripts/check-plan.mjs index c8626766c..c3ddc3989 100755 --- a/pstack/skills/poteto-mode/scripts/check-plan.mjs +++ b/pstack/skills/poteto-mode/scripts/check-plan.mjs @@ -72,7 +72,7 @@ for (let i = start; i < raw.length; i++) { lines.push({ n, text, code }); if (code) continue; const prose = text - .replace(/`[^`]*`/g, "`") + .replace(/(? { const result = runPlan("```markdown `invalid`\n## Example only\n```\n", 1); expect(result.stderr).toContain('"## Example only" after Close the program is not an appendix'); }); + +test("ignores prose punctuation inside matching multi-backtick code spans", () => { + for (const count of [2, 3, 4]) { + const delimiter = "`".repeat(count); + runPlan(`Use ${delimiter}echo \`x\`: “quoted” — example${delimiter}.\n`, 0); + } +}); + +test("checks prose following a multi-backtick span and unmatched delimiters", () => { + const outside = runPlan("Use ``echo `x`: y``. Bad: prose.\n", 1); + expect(outside.stderr).toContain("mid-sentence colon"); + const unmatched = runPlan("Use ``unclosed: bad` here.\n", 1); + expect(unmatched.stderr).toContain("mid-sentence colon"); +});