Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions schemas/spec-driven/templates/design.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Design

## Context

<!-- Background and current state -->
Expand Down
2 changes: 2 additions & 0 deletions schemas/spec-driven/templates/proposal.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Proposal

## Why

<!-- Explain the motivation for this change. What problem does this solve? Why now? -->
Expand Down
2 changes: 2 additions & 0 deletions schemas/spec-driven/templates/spec.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Specifications

## ADDED Requirements

### Requirement: <!-- requirement name -->
Expand Down
2 changes: 2 additions & 0 deletions schemas/spec-driven/templates/tasks.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Tasks

## 1. <!-- Task Group Name -->

- [ ] 1.1 <!-- Task description -->
Expand Down
2 changes: 2 additions & 0 deletions schemas/workspace-planning/templates/design.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Design

## Context

Summarize the workspace planning context, relevant linked areas, and constraints.
Expand Down
2 changes: 2 additions & 0 deletions schemas/workspace-planning/templates/proposal.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Proposal

## Why

Describe the shared product goal, problem, or opportunity that makes this workspace-level change worth planning.
Expand Down
2 changes: 2 additions & 0 deletions schemas/workspace-planning/templates/spec.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Specifications

## ADDED Requirements

### Requirement: <workspace requirement name>
Expand Down
2 changes: 2 additions & 0 deletions schemas/workspace-planning/templates/tasks.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Tasks

## 1. Workspace Planning

- [ ] 1.1 Confirm the shared product goal and unresolved scope questions.
Expand Down
18 changes: 13 additions & 5 deletions src/commands/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,9 @@ export function registerSchemaCommand(program: Command): void {
function createDefaultTemplate(artifactId: string): string {
switch (artifactId) {
case 'proposal':
return `## Why
return `# Proposal

## Why

<!-- Describe the motivation for this change -->

Expand All @@ -950,7 +952,9 @@ function createDefaultTemplate(artifactId: string): string {
`;

case 'specs':
return `## ADDED Requirements
return `# Specifications

## ADDED Requirements

### Requirement: Example requirement

Expand All @@ -962,7 +966,9 @@ Description of the requirement.
`;

case 'design':
return `## Context
return `# Design

## Context

<!-- Background and context -->

Expand All @@ -989,15 +995,17 @@ Description and rationale.
`;

case 'tasks':
return `## Implementation Tasks
return `# Tasks

## Implementation Tasks

- [ ] Task 1
- [ ] Task 2
- [ ] Task 3
`;

default:
return `## ${artifactId}
return `# ${artifactId}

<!-- Add content here -->
`;
Expand Down
16 changes: 16 additions & 0 deletions test/core/artifact-graph/instruction-loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading