Skip to content

Add depends_on / related frontmatter to product-spec.md; surface in list#64

Merged
4nkur merged 3 commits intomainfrom
feat/product-frontmatter
Apr 30, 2026
Merged

Add depends_on / related frontmatter to product-spec.md; surface in list#64
4nkur merged 3 commits intomainfrom
feat/product-frontmatter

Conversation

@4nkur
Copy link
Copy Markdown
Owner

@4nkur 4nkur commented Apr 30, 2026

Summary

  • draftwise new's instruction now tells the host coding agent to write an optional YAML frontmatter block (depends_on: [<slug>...], related: [<slug>...]) at the top of product-spec.md. The agent is told to list .draftwise/specs/ first and reference only slugs that exist; if no other specs exist yet, the block is skipped. Both brownfield and greenfield phase-3 instructions updated.
  • draftwise list grew a fourth column — DEPENDS ON — between STATUS and TITLE.
  • New src/utils/frontmatter.js (small wrapper over yaml); handles CRLF, malformed YAML, and non-object roots by falling back to empty data so a broken spec file doesn't break the whole list.

Stacking

Stacked on feat/constitution (PR #63). Merge that one first; this branch will rebase onto main once it lands.

Test plan

  • npx vitest run — 241 tests pass (12 new across test/utils/frontmatter.test.js + test/commands/list.test.js)
  • npm run lint clean
  • Manual: write ---\ndepends_on: [auth]\n---\n\n# Profile\n to a seeded spec; confirm draftwise list shows auth in the DEPENDS ON column

4nkur added 2 commits April 30, 2026 09:44
… rules

`draftwise init` now writes `.draftwise/constitution.md` on both the brownfield and greenfield paths. Five stable section headings — Voice, Spec language, Edge case discipline, Project conventions, Domain glossary — that every drafting prompt (`new`, `tech`, `tasks`, `scan`, `explain`, greenfield Phase 3) tells the host coding agent to read before drafting and apply by name. `scan` and the greenfield Phase 3 additionally instruct the agent to refine the **Project conventions** section from observed code / chosen stack, replacing the placeholder.

This replaces the role that `src/ai/prompts/principles.js` and `src/ai/prompts/spec-quality.js` used to play before the api-mode drop. Those modules injected collaboration + spec-language rules into every system prompt; with synthesis moved entirely into the host coding agent, the rules now live in the user's repo as a markdown file the agent reads on each call. The file is user-editable and version-controlled, so changes are reviewable and travel with the repo.

Reader utility at `src/utils/constitution.js` (`readConstitution(cwd)` returns null on ENOENT, propagates other errors); template at `src/utils/constitution-template.js`. Every prompt that references the file says "skip silently if absent" — back-compat for projects that ran `init` before this feature landed.

CLAUDE.md and README.md updated end-to-end (key design principles, src/utils list, "What gets installed" tree). CHANGELOG.md `[Unreleased] ### Added` entry documents the rationale and the section structure.
…ce in `list`

`draftwise new`'s instruction now tells the host coding agent to open `product-spec.md` with an optional YAML frontmatter block — `depends_on: [<slug>...]` for specs that must ship before this one, `related: [<slug>...]` for same-area specs that aren't a hard dependency. The agent is told to list `.draftwise/specs/` first and reference only slugs that exist on disk; if there are no other specs yet, the block is skipped. This applies on both the brownfield and greenfield phase-3 instructions.

`draftwise list` grew a fourth column — DEPENDS ON — between STATUS and TITLE. Specs without frontmatter or without a `depends_on` key show blank.

Frontmatter parsing lives in a new `src/utils/frontmatter.js` (small wrapper over the `yaml` package — handles CRLF, malformed YAML, and non-object roots by returning empty data so a broken spec doesn't break the whole list).

Why: cross-spec dependencies were a deferred-for-later item in CLAUDE.md, but the cheap version — declarative in the spec, surfaced in `list` — answers the actual PM question ("which specs are ready to start?") without the heavier machinery (drift detection, ripple analysis, graph traversal). Living in a frontmatter block keeps it out of the rendered spec body and lets the agent regenerate it on `refine` later.

CLAUDE.md gets a "Cross-spec dependencies live in product-spec frontmatter" key principle and an updated `src/utils/` listing. README.md's "Product spec sections" section gets the frontmatter example block. CHANGELOG.md `[Unreleased] ### Added` documents the rationale.
Base automatically changed from feat/constitution to main April 30, 2026 04:17
@4nkur 4nkur merged commit 59ad0bf into main Apr 30, 2026
2 checks passed
@4nkur 4nkur deleted the feat/product-frontmatter branch April 30, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant