feat(ultraplan-local): teach ultraplan-local to consume type:ultrareview

This commit is contained in:
Kjell Tore Guttormsen 2026-05-01 16:58:32 +02:00
commit 7dc643ec52
2 changed files with 56 additions and 0 deletions

View file

@ -168,6 +168,46 @@ Project: {project_dir or "-"}
Research: {N local briefs, M extra via --research}
```
### When the input is type:ultrareview (Handover 6)
The brief input may be a `review.md` produced by `/ultrareview-local`
instead of a `brief.md` produced by `/ultrabrief-local`. Both files
share the same handover slot — `type` is the discriminator.
If `fm.type === 'ultrareview'`:
1. Skip the `research_status` gate above (review.md has no
`research_topics` and no Research Plan section).
2. Extract the `findings` array from the frontmatter — this is the
list of 40-char hex finding-IDs the review surfaced.
3. Read the body's last fenced ```json``` block to recover the full
finding objects (the frontmatter only has IDs; the JSON has the
`severity`, `file`, `line`, `rule_key`, `title`, `detail`,
`recommended_action` payload).
4. Filter findings to severity ∈ `{BLOCKER, MAJOR}`. MINOR and
SUGGESTION are skipped for v1.0 plan-input — they are advisory
only and would inflate the plan with low-priority churn.
5. Treat each remaining finding as a plan goal:
- `recommended_action` → step intent
- `file` → primary `Files:` target
- `id` → goes into the plan's `source_findings:` frontmatter list
6. When writing `plan.md`, populate the frontmatter field
`source_findings: [<id1>, <id2>, ...]` containing exactly the IDs
of the BLOCKER + MAJOR findings consumed. The list provides the
audit trail back to `review.md`.
7. Use **block-style YAML** for the `source_findings:` list. The
frontmatter parser at `lib/util/frontmatter.mjs` does not support
flow-style arrays; `source_findings: [a, b]` is broken — use:
```yaml
source_findings:
- 0123456789abcdef0123456789abcdef01234567
- fedcba9876543210fedcba9876543210fedcba98
```
`source_findings:` is **additive and optional** — plans produced from a
`type: brief` input simply omit the field. No `plan_version` bump is
required for this addition (backwards compatible).
## Phase 1.5 — Export (runs only when mode = export)
**Skip this phase entirely unless mode = export.**

View file

@ -1,3 +1,19 @@
<!--
Optional YAML frontmatter — include ONLY when the plan was generated from a
`type: ultrareview` input (Handover 6). Lists the 40-char hex IDs of the
BLOCKER + MAJOR findings consumed from `review.md`. Use block-style YAML;
the frontmatter parser does not support flow-style arrays.
Plans generated from a `type: brief` input omit this block entirely. No
plan_version bump — the field is additive and backwards compatible.
---
source_findings:
- 0123456789abcdef0123456789abcdef01234567
- fedcba9876543210fedcba9876543210fedcba98
---
-->
# {Task Title}
> **Plan quality: {grade}** ({score}/100) — {APPROVE | APPROVE_WITH_NOTES | REVISE | REPLAN}