-
Notifications
You must be signed in to change notification settings - Fork 8
fix(from-plan): verbatim pass-through for external spec formats (release 0.5.1) #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,9 +176,32 @@ export function slugify(s) { | |
| return cleaned.slice(0, 50) || 'plan'; | ||
| } | ||
|
|
||
| // Hints are ordered most- to least-specific per intent. The tail of each list | ||
| // covers common spec-driven formats from other plan/spec tooling (Superpowers, | ||
| // GSD, hand-written specs), not just Claude Code's plan-mode shape. (#16) | ||
| const SECTION_HINTS = { | ||
| context: ['context', 'background', 'why', 'motivation'], | ||
| approach: ['approach', 'plan', 'implementation', 'solution', 'design'], | ||
| context: [ | ||
| 'context', | ||
| 'background', | ||
| 'why', | ||
| 'motivation', | ||
| 'problem statement', | ||
| 'problem', | ||
| 'overview', | ||
| 'summary', | ||
| ], | ||
| approach: [ | ||
| 'approach', | ||
| 'plan', | ||
| 'implementation', | ||
| 'solution', | ||
| 'design', | ||
| 'requirements', | ||
| 'specification', | ||
| 'spec', | ||
| 'tasks', | ||
| 'steps', | ||
| ], | ||
| files: [ | ||
| 'file-by-file change list', | ||
| 'files to touch', | ||
|
|
@@ -188,7 +211,16 @@ const SECTION_HINTS = { | |
| 'critical files to modify', | ||
| 'files', | ||
| ], | ||
| verification: ['verification', 'how to verify', 'test plan', 'tests', 'acceptance criteria'], | ||
| verification: [ | ||
| 'verification', | ||
| 'how to verify', | ||
| 'test plan', | ||
| 'tests', | ||
| 'acceptance criteria', | ||
| 'testing', | ||
| 'validation', | ||
| 'success criteria', | ||
| ], | ||
| }; | ||
|
|
||
| /** | ||
|
|
@@ -231,6 +263,36 @@ export function buildTaskContent(plan) { | |
| lines.push(''); | ||
| lines.push(`> Generated from Claude Code plan: \`${plan.path}\``); | ||
| lines.push(''); | ||
|
|
||
| // Pass-through fallback: a plan/spec in a shape we don't recognise (another | ||
| // spec plugin's format, a hand-written doc) must never be reduced to four | ||
| // placeholder sections — that silently discards the entire plan body. | ||
| // Embed the document verbatim instead and let Cursor follow it as written. | ||
| if (!context && !approach && !files && !verification) { | ||
| const rawBody = String(plan.raw ?? '') | ||
| .replace(/^\s*#\s[^\n]*\n/, '') // drop the leading H1 — already emitted above | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MINOR] In the new pass-through fallback, the regex
|
||
| .trim(); | ||
| lines.push('## Task specification'); | ||
| lines.push(''); | ||
| lines.push( | ||
| '_The source plan uses its own structure (not the Claude plan-mode shape); it is included verbatim below — follow it as written._', | ||
| ); | ||
| lines.push(''); | ||
| lines.push(rawBody || '(the source plan file is empty)'); | ||
| lines.push(''); | ||
| lines.push('## How to verify'); | ||
| lines.push(''); | ||
| lines.push( | ||
| 'Follow any verification steps in the specification above; otherwise:\n\n' + | ||
| "- Run the project's test suite (`npm test`, `pnpm test`, `task test`, etc.).\n" + | ||
| '- Run the type-check / lint if the project has one.\n' + | ||
| '- Manual spot-check of the changed behaviour.', | ||
| ); | ||
| lines.push(''); | ||
| pushConstraints(lines); | ||
| return lines.join('\n'); | ||
| } | ||
|
|
||
| lines.push('## Goal'); | ||
| lines.push(''); | ||
| lines.push(plan.title ? plan.title : '(see Context below)'); | ||
|
|
@@ -258,6 +320,14 @@ export function buildTaskContent(plan) { | |
| '- Manual spot-check of the changed behaviour.', | ||
| ); | ||
| lines.push(''); | ||
| pushConstraints(lines); | ||
| return lines.join('\n'); | ||
| } | ||
|
|
||
| /** | ||
| * @param {string[]} lines | ||
| */ | ||
| function pushConstraints(lines) { | ||
| lines.push('## Constraints'); | ||
| lines.push(''); | ||
| lines.push( | ||
|
|
@@ -269,5 +339,4 @@ export function buildTaskContent(plan) { | |
| '- Do not modify lockfiles (`package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`) unless dependencies are part of the task.', | ||
| ); | ||
| lines.push(''); | ||
| return lines.join('\n'); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[SUGGESTION] The new
verificationhint'testing'matches viakey.startsWith('testing '), so a heading like## Testing infrastructure notes(developer commentary about test setup, not verification steps for the task) would be pulled into the '## How to verify' section. This is a broad generic hint added alongside more specific ones, and could occasionally pull in dev-notes rather than actual acceptance/verification steps.