diff --git a/schemas/spec-driven/templates/design.md b/schemas/spec-driven/templates/design.md index 4ab5bd839..763f7eb25 100644 --- a/schemas/spec-driven/templates/design.md +++ b/schemas/spec-driven/templates/design.md @@ -1,3 +1,5 @@ +# Design + ## Context diff --git a/schemas/spec-driven/templates/proposal.md b/schemas/spec-driven/templates/proposal.md index c79b85d44..e0b27a2db 100644 --- a/schemas/spec-driven/templates/proposal.md +++ b/schemas/spec-driven/templates/proposal.md @@ -1,3 +1,5 @@ +# Proposal + ## Why diff --git a/schemas/spec-driven/templates/spec.md b/schemas/spec-driven/templates/spec.md index 095d711c8..36052ed2f 100644 --- a/schemas/spec-driven/templates/spec.md +++ b/schemas/spec-driven/templates/spec.md @@ -1,3 +1,5 @@ +# Specifications + ## ADDED Requirements ### Requirement: diff --git a/schemas/spec-driven/templates/tasks.md b/schemas/spec-driven/templates/tasks.md index 88ce51ef7..148874e6f 100644 --- a/schemas/spec-driven/templates/tasks.md +++ b/schemas/spec-driven/templates/tasks.md @@ -1,3 +1,5 @@ +# Tasks + ## 1. - [ ] 1.1 diff --git a/schemas/workspace-planning/templates/design.md b/schemas/workspace-planning/templates/design.md index 2a6194648..de198eea7 100644 --- a/schemas/workspace-planning/templates/design.md +++ b/schemas/workspace-planning/templates/design.md @@ -1,3 +1,5 @@ +# Design + ## Context Summarize the workspace planning context, relevant linked areas, and constraints. diff --git a/schemas/workspace-planning/templates/proposal.md b/schemas/workspace-planning/templates/proposal.md index d79448883..ea49f5d64 100644 --- a/schemas/workspace-planning/templates/proposal.md +++ b/schemas/workspace-planning/templates/proposal.md @@ -1,3 +1,5 @@ +# Proposal + ## Why Describe the shared product goal, problem, or opportunity that makes this workspace-level change worth planning. diff --git a/schemas/workspace-planning/templates/spec.md b/schemas/workspace-planning/templates/spec.md index 2826b3f07..7c80accf3 100644 --- a/schemas/workspace-planning/templates/spec.md +++ b/schemas/workspace-planning/templates/spec.md @@ -1,3 +1,5 @@ +# Specifications + ## ADDED Requirements ### Requirement: diff --git a/schemas/workspace-planning/templates/tasks.md b/schemas/workspace-planning/templates/tasks.md index c24ee7155..d1e57dc9c 100644 --- a/schemas/workspace-planning/templates/tasks.md +++ b/schemas/workspace-planning/templates/tasks.md @@ -1,3 +1,5 @@ +# Tasks + ## 1. Workspace Planning - [ ] 1.1 Confirm the shared product goal and unresolved scope questions. diff --git a/src/commands/schema.ts b/src/commands/schema.ts index 7f8d0b788..a6e0417c9 100644 --- a/src/commands/schema.ts +++ b/src/commands/schema.ts @@ -928,7 +928,9 @@ export function registerSchemaCommand(program: Command): void { function createDefaultTemplate(artifactId: string): string { switch (artifactId) { case 'proposal': - return `## Why + return `# Proposal + +## Why @@ -950,7 +952,9 @@ function createDefaultTemplate(artifactId: string): string { `; case 'specs': - return `## ADDED Requirements + return `# Specifications + +## ADDED Requirements ### Requirement: Example requirement @@ -962,7 +966,9 @@ Description of the requirement. `; case 'design': - return `## Context + return `# Design + +## Context @@ -989,7 +995,9 @@ Description and rationale. `; case 'tasks': - return `## Implementation Tasks + return `# Tasks + +## Implementation Tasks - [ ] Task 1 - [ ] Task 2 @@ -997,7 +1005,7 @@ Description and rationale. `; default: - return `## ${artifactId} + return `# ${artifactId} `; diff --git a/test/core/artifact-graph/instruction-loader.test.ts b/test/core/artifact-graph/instruction-loader.test.ts index 9d8f612cd..2efb1ca50 100644 --- a/test/core/artifact-graph/instruction-loader.test.ts +++ b/test/core/artifact-graph/instruction-loader.test.ts @@ -20,6 +20,22 @@ describe('instruction-loader', () => { expect(template).toContain('## What Changes'); }); + it('should start built-in generated markdown templates with top-level headings', () => { + const expectedHeadings = [ + ['proposal.md', '# Proposal'], + ['spec.md', '# Specifications'], + ['design.md', '# Design'], + ['tasks.md', '# Tasks'], + ] as const; + + for (const schemaName of ['spec-driven', 'workspace-planning']) { + for (const [templatePath, heading] of expectedHeadings) { + const template = loadTemplate(schemaName, templatePath); + expect(template.split(/\r?\n/, 1)[0], `${schemaName}/${templatePath}`).toBe(heading); + } + } + }); + it('should throw TemplateLoadError for non-existent template', () => { expect(() => loadTemplate('spec-driven', 'nonexistent.md')).toThrow( TemplateLoadError