specweave 0.22.11 → 0.22.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CLAUDE.md +77 -0
  2. package/dist/src/cli/commands/init.d.ts.map +1 -1
  3. package/dist/src/cli/commands/init.js +42 -0
  4. package/dist/src/cli/commands/init.js.map +1 -1
  5. package/dist/src/cli/helpers/init/initial-increment-generator.d.ts +26 -0
  6. package/dist/src/cli/helpers/init/initial-increment-generator.d.ts.map +1 -0
  7. package/dist/src/cli/helpers/init/initial-increment-generator.js +240 -0
  8. package/dist/src/cli/helpers/init/initial-increment-generator.js.map +1 -0
  9. package/dist/src/generators/spec/spec-parser.d.ts +79 -0
  10. package/dist/src/generators/spec/spec-parser.d.ts.map +1 -0
  11. package/dist/src/generators/spec/spec-parser.js +185 -0
  12. package/dist/src/generators/spec/spec-parser.js.map +1 -0
  13. package/dist/src/generators/spec/task-parser.d.ts +95 -0
  14. package/dist/src/generators/spec/task-parser.d.ts.map +1 -0
  15. package/dist/src/generators/spec/task-parser.js +301 -0
  16. package/dist/src/generators/spec/task-parser.js.map +1 -0
  17. package/dist/src/validators/ac-coverage-validator.d.ts +106 -0
  18. package/dist/src/validators/ac-coverage-validator.d.ts.map +1 -0
  19. package/dist/src/validators/ac-coverage-validator.js +250 -0
  20. package/dist/src/validators/ac-coverage-validator.js.map +1 -0
  21. package/package.json +1 -1
  22. package/plugins/specweave/commands/specweave-done.md +58 -0
  23. package/plugins/specweave/commands/specweave-validate.md +36 -6
  24. package/plugins/specweave/lib/hooks/sync-living-docs.js +21 -0
  25. package/plugins/specweave/lib/hooks/sync-us-tasks.js +290 -0
  26. package/src/templates/AGENTS.md.template +16 -0
  27. package/src/templates/CLAUDE.md.template +18 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ac-coverage-validator.js","sourceRoot":"","sources":["../../../src/validators/ac-coverage-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;G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"description": "Spec-driven development framework for Claude Code. AI-native workflow with living documentation, intelligent agents, and multilingual support (9 languages). Enterprise-grade traceability with permanent specs and temporary increments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -80,6 +80,8 @@ if (!validation.isValid) {
80
80
 
81
81
  • 17 acceptance criteria still open
82
82
  • 13 tasks still pending
83
+ • 4 ACs uncovered by tasks (NEW - v0.23.0)
84
+ • 2 orphan tasks detected (NEW - v0.23.0)
83
85
 
84
86
  Fix these issues before running /specweave:done again
85
87
  ```
@@ -89,6 +91,8 @@ Fix these issues before running /specweave:done again
89
91
  ✅ Automated validation passed
90
92
  • All acceptance criteria completed
91
93
  • All tasks completed
94
+ • 100% AC coverage (29/29 ACs) (NEW - v0.23.0)
95
+ • 0 orphan tasks (NEW - v0.23.0)
92
96
 
93
97
  Proceeding to PM validation...
94
98
  ```
@@ -98,6 +102,10 @@ Proceeding to PM validation...
98
102
  - [ ] All tasks are completed in **tasks.md** (`**Status**: [x] completed`)
99
103
  - [ ] Required files exist (`spec.md`, `tasks.md`)
100
104
  - [ ] **NEW**: Tasks count in frontmatter matches checked tasks (source of truth validation)
105
+ - [ ] **NEW (v0.23.0)**: AC coverage validation (US-Task Linkage Architecture)
106
+ - [ ] All ACs covered by at least one task (0% uncovered)
107
+ - [ ] No orphan tasks (all tasks have **Satisfies ACs** field)
108
+ - [ ] All US linkage valid (**User Story** field references exist in spec.md)
101
109
 
102
110
  **⚠️ SOURCE OF TRUTH ENFORCEMENT (CRITICAL)**:
103
111
 
@@ -128,6 +136,56 @@ if (tasksInFile < total_tasks) {
128
136
  - ❌ Marking work "done" without updating acceptance criteria
129
137
  - ❌ The critical violation from increment 0044 (2025-11-19)
130
138
 
139
+ **⚠️ AC COVERAGE VALIDATION (NEW - v0.23.0)**:
140
+
141
+ Gate 0 now validates AC coverage to ensure all Acceptance Criteria have implementing tasks:
142
+
143
+ ```typescript
144
+ import { validateACCoverage } from '../../../src/validators/ac-coverage-validator.js';
145
+
146
+ // Validate AC coverage
147
+ const coverageReport = validateACCoverage(incrementPath, {
148
+ minCoveragePercentage: 100, // Require 100% coverage
149
+ allowOrphans: false, // Block if orphan tasks exist
150
+ logger: consoleLogger
151
+ });
152
+
153
+ // BLOCK if coverage fails
154
+ if (coverageReport.uncoveredACs.length > 0) {
155
+ throw new ValidationError(
156
+ `CRITICAL: AC Coverage validation failed!\n` +
157
+ `\n` +
158
+ `Uncovered Acceptance Criteria (${coverageReport.uncoveredACs.length}):\n` +
159
+ coverageReport.uncoveredACs.map(acId => ` • ${acId}`).join('\n') +
160
+ `\n\n` +
161
+ `All ACs MUST have at least one implementing task.\n` +
162
+ `Create tasks with **Satisfies ACs** field linking to these ACs.\n` +
163
+ `\n` +
164
+ `Run: /specweave:validate ${incrementId} to see detailed coverage report.`
165
+ );
166
+ }
167
+
168
+ if (coverageReport.orphanTasks.length > 0) {
169
+ throw new ValidationError(
170
+ `CRITICAL: Orphan tasks detected!\n` +
171
+ `\n` +
172
+ `Tasks without AC linkage (${coverageReport.orphanTasks.length}):\n` +
173
+ coverageReport.orphanTasks.map(taskId => ` • ${taskId}`).join('\n') +
174
+ `\n\n` +
175
+ `All tasks MUST have **Satisfies ACs** field linking to acceptance criteria.\n` +
176
+ `Add AC references to these tasks.\n` +
177
+ `\n` +
178
+ `Run: /specweave:validate ${incrementId} to see detailed validation report.`
179
+ );
180
+ }
181
+ ```
182
+
183
+ **This ensures**:
184
+ - ✅ All ACs covered by at least one task (100% coverage required)
185
+ - ✅ No orphan tasks (all tasks link to valid ACs)
186
+ - ✅ Traceability maintained (AC → Task mapping complete)
187
+ - ✅ Living docs accuracy (sync depends on task-AC linkage)
188
+
131
189
  **Why Gate 0 matters**:
132
190
  - **Prevents false completion**: Can't mark increment "completed" with open work
133
191
  - **Fast feedback**: Fails immediately (< 1s) vs waiting for PM agent (30s+)
@@ -57,7 +57,7 @@ Usage: /specweave:validate-increment <id> [--quality] [--export] [--fix] [--alwa
57
57
 
58
58
  ### Step 2: Run Rule-Based Validation (Always)
59
59
 
60
- Run 130+ validation rules across 6 categories:
60
+ Run 130+ validation rules across 7 categories:
61
61
 
62
62
  **CRITICAL: Always run structure validation FIRST to prevent duplicate task files**
63
63
 
@@ -104,19 +104,31 @@ Run 130+ validation rules across 6 categories:
104
104
  - ADR references exist
105
105
  - Diagram references valid
106
106
 
107
+ 7. **AC Coverage & Traceability (NEW - v0.23.0)**:
108
+ - All Acceptance Criteria have implementing tasks (0% uncovered)
109
+ - All tasks link to valid User Stories (**User Story**: US-XXX)
110
+ - All tasks link to valid Acceptance Criteria (**Satisfies ACs**: AC-USXX-YY)
111
+ - No orphan tasks (tasks without AC linkage)
112
+ - AC-Task traceability matrix builds successfully
113
+ - Per-User Story coverage calculated
114
+
107
115
  **Display results**:
108
116
  ```
109
117
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
110
118
  VALIDATION RESULTS: Increment 0001-authentication
111
119
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
112
120
 
113
- ✅ Rule-Based Validation: PASSED (135/135 checks)
121
+ ✅ Rule-Based Validation: PASSED (141/141 checks)
114
122
  ✓ Structure (5/5)
115
123
  ✓ Three-File Canonical (10/10) [ADR-0047]
116
124
  ✓ Consistency (47/47)
117
125
  ✓ Completeness (23/23)
118
126
  ✓ Quality (31/31)
119
127
  ✓ Traceability (19/19)
128
+ ✓ AC Coverage & Traceability (6/6) [NEW - v0.23.0]
129
+ • 100% AC coverage (15/15 ACs covered)
130
+ • 0 orphan tasks
131
+ • All tasks linked to valid User Stories
120
132
 
121
133
  Files validated:
122
134
  • spec.md (250 lines, 6 user stories)
@@ -129,13 +141,17 @@ Files validated:
129
141
 
130
142
  **If errors found**:
131
143
  ```
132
- ❌ Rule-Based Validation: FAILED (122/135 checks)
144
+ ❌ Rule-Based Validation: FAILED (128/141 checks)
133
145
  ❌ Structure (3/5) - 2 CRITICAL ERRORS
134
146
  ❌ Three-File Canonical (7/10) - 3 CRITICAL ERRORS [ADR-0047]
135
147
  ✓ Consistency (45/47) - 2 errors
136
148
  ✓ Completeness (23/23)
137
149
  ⚠️ Quality (28/31) - 3 warnings
138
150
  ✓ Traceability (19/19)
151
+ ❌ AC Coverage & Traceability (3/6) - 3 ERRORS [NEW - v0.23.0]
152
+ • 73% AC coverage (11/15 ACs covered) - 4 uncovered
153
+ • 2 orphan tasks detected
154
+ • All US linkage valid
139
155
 
140
156
  CRITICAL STRUCTURE ERRORS (MUST FIX FIRST):
141
157
  ❌ Duplicate task files detected: tasks.md, tasks-detailed.md
@@ -153,6 +169,16 @@ CRITICAL THREE-FILE VIOLATIONS (ADR-0047):
153
169
  🚨 spec.md:102 - Contains task ID reference "T-001"
154
170
  → Tasks belong in tasks.md, use AC-IDs to link instead
155
171
 
172
+ AC COVERAGE ERRORS (3) [NEW - v0.23.0]:
173
+ 🔴 4 Acceptance Criteria uncovered by tasks:
174
+ → AC-US2-03: Real-time notification delivery (no implementing tasks)
175
+ → AC-US3-01: API rate limiting (no implementing tasks)
176
+ → AC-US3-05: Error handling for network failures (no implementing tasks)
177
+ → AC-US4-02: Audit logging for security events (no implementing tasks)
178
+ 🔴 2 Orphan tasks (no AC linkage):
179
+ → T-008: Refactor authentication module (no **Satisfies ACs** field)
180
+ → T-015: Update documentation (no **Satisfies ACs** field)
181
+
156
182
  ERRORS (2):
157
183
  🔴 spec.md:45 - Missing acceptance criteria for US-003
158
184
  🔴 Inconsistency: spec.md mentions "real-time updates" but plan.md doesn't address it
@@ -168,9 +194,13 @@ Action required:
168
194
  - Run refactoring script: .specweave/increments/XXXX/scripts/refactor-tasks-ac-to-implementation.sh
169
195
  - Or manually replace "**Acceptance Criteria**:" with "**Implementation**:"
170
196
  - Add "**AC-IDs**: AC-US-XX-YY" references to link tasks to spec.md
171
- 3. Fix missing acceptance criteria for US-003
172
- 4. Address "real-time updates" in plan.md or remove from spec.md
173
- 5. Consider breaking down T012 into smaller tasks
197
+ 3. 🔴 FIX AC COVERAGE ERRORS (v0.23.0 - US-Task Linkage):
198
+ - Create tasks for 4 uncovered ACs (AC-US2-03, AC-US3-01, AC-US3-05, AC-US4-02)
199
+ - Add **Satisfies ACs** field to 2 orphan tasks (T-008, T-015)
200
+ - Run: /specweave:validate 0001 to verify 100% coverage
201
+ 4. Fix missing acceptance criteria for US-003
202
+ 5. Address "real-time updates" in plan.md or remove from spec.md
203
+ 6. Consider breaking down T012 into smaller tasks
174
204
 
175
205
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
176
206
  ```
@@ -103,6 +103,27 @@ async function hierarchicalDistribution(incrementId) {
103
103
  console.log(` Files created/updated: ${result.filesCreated.length + result.filesUpdated.length}`);
104
104
 
105
105
  const changedFiles = [...result.filesCreated, ...result.filesUpdated];
106
+
107
+ // NEW (v0.23.0): Sync tasks from tasks.md to living docs US files
108
+ // Part of increment 0047-us-task-linkage implementation
109
+ try {
110
+ const { syncUSTasksToLivingDocs } = await import("./sync-us-tasks.js");
111
+ const taskSyncResult = await syncUSTasksToLivingDocs(
112
+ incrementId,
113
+ projectRoot,
114
+ result.featureId,
115
+ {}
116
+ );
117
+
118
+ if (taskSyncResult.success && taskSyncResult.updatedFiles.length > 0) {
119
+ changedFiles.push(...taskSyncResult.updatedFiles);
120
+ }
121
+ } catch (error) {
122
+ // Don't fail entire sync if US-Task sync fails (graceful degradation)
123
+ console.log(` \u26A0\uFE0F US-Task sync failed (non-fatal):`, error.message);
124
+ console.log(` \u{1F4A1} Tip: This is a new feature (v0.23.0) - may need task parser build`);
125
+ }
126
+
106
127
  return {
107
128
  success: true,
108
129
  changedFiles
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * US-Task Synchronization Module
4
+ *
5
+ * Syncs task completion status from tasks.md to living docs User Story files.
6
+ * Updates:
7
+ * - Task lists in US files (replaces "No tasks defined")
8
+ * - AC checkboxes based on task completion
9
+ *
10
+ * Part of increment 0047-us-task-linkage implementation.
11
+ */
12
+
13
+ import fs from 'fs-extra';
14
+ import path from 'path';
15
+ import { parseTasksWithUSLinks, getAllTasks } from '../../../../dist/src/generators/spec/task-parser.js';
16
+ import { glob } from 'glob';
17
+
18
+ /**
19
+ * Sync tasks from tasks.md to living docs User Story files
20
+ *
21
+ * @param {string} incrementId - Increment ID (e.g., "0047-us-task-linkage")
22
+ * @param {string} projectRoot - Project root directory
23
+ * @param {string} featureId - Feature ID (e.g., "FS-047")
24
+ * @param {object} options - Sync options
25
+ * @returns {Promise<SyncResult>} Sync result
26
+ */
27
+ export async function syncUSTasksToLivingDocs(incrementId, projectRoot, featureId, options = {}) {
28
+ try {
29
+ console.log(` 📋 Syncing tasks to living docs User Stories...`);
30
+
31
+ const tasksPath = path.join(projectRoot, '.specweave', 'increments', incrementId, 'tasks.md');
32
+
33
+ // Check if tasks.md exists
34
+ if (!fs.existsSync(tasksPath)) {
35
+ console.log(` ⚠️ tasks.md not found, skipping task sync`);
36
+ return { success: true, updatedFiles: [], errors: [] };
37
+ }
38
+
39
+ // Parse tasks with US linkage
40
+ let tasksByUS;
41
+ try {
42
+ tasksByUS = parseTasksWithUSLinks(tasksPath);
43
+ } catch (error) {
44
+ console.error(` ❌ Failed to parse tasks.md:`, error.message);
45
+ return { success: false, updatedFiles: [], errors: [error.message] };
46
+ }
47
+
48
+ const allTasks = getAllTasks(tasksByUS);
49
+ console.log(` ✓ Parsed ${allTasks.length} tasks from tasks.md`);
50
+
51
+ // Check for tasks without US linkage (backward compatibility)
52
+ const unassignedTasks = tasksByUS['unassigned'] || [];
53
+ if (unassignedTasks.length > 0) {
54
+ console.log(` ⚠️ ${unassignedTasks.length} tasks without User Story linkage (old format)`);
55
+ }
56
+
57
+ // Get project ID (default to "specweave" for now, can be enhanced later)
58
+ const projectId = getProjectId(projectRoot, incrementId) || 'specweave';
59
+
60
+ const updatedFiles = [];
61
+ const errors = [];
62
+
63
+ // For each User Story with tasks, update its living docs file
64
+ for (const [usId, tasks] of Object.entries(tasksByUS)) {
65
+ if (usId === 'unassigned') continue; // Skip unassigned tasks
66
+
67
+ try {
68
+ // Find US file in living docs
69
+ const usFilePath = await findUSFile(projectRoot, projectId, featureId, usId);
70
+
71
+ if (!usFilePath) {
72
+ console.log(` ⚠️ Living docs file not found for ${usId}, skipping`);
73
+ continue;
74
+ }
75
+
76
+ // Update US file with task list
77
+ const updated = await updateUSFile(usFilePath, tasks, incrementId);
78
+
79
+ if (updated) {
80
+ updatedFiles.push(usFilePath);
81
+ console.log(` ✓ Updated ${usId} with ${tasks.length} tasks`);
82
+ }
83
+ } catch (error) {
84
+ console.error(` ❌ Error updating ${usId}:`, error.message);
85
+ errors.push(`${usId}: ${error.message}`);
86
+ }
87
+ }
88
+
89
+ if (updatedFiles.length > 0) {
90
+ console.log(` ✅ Updated ${updatedFiles.length} User Story file(s)`);
91
+ } else {
92
+ console.log(` ℹ️ No User Story files updated`);
93
+ }
94
+
95
+ return {
96
+ success: errors.length === 0,
97
+ updatedFiles,
98
+ errors
99
+ };
100
+ } catch (error) {
101
+ console.error(` ❌ US-Task sync failed:`, error);
102
+ return { success: false, updatedFiles: [], errors: [error.message] };
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Find User Story file in living docs
108
+ *
109
+ * @param {string} projectRoot - Project root
110
+ * @param {string} projectId - Project ID (e.g., "specweave")
111
+ * @param {string} featureId - Feature ID (e.g., "FS-047")
112
+ * @param {string} usId - User Story ID (e.g., "US-001")
113
+ * @returns {Promise<string|null>} Path to US file or null if not found
114
+ */
115
+ async function findUSFile(projectRoot, projectId, featureId, usId) {
116
+ // Pattern: .specweave/docs/internal/specs/{project}/{feature}/us-{id}-*.md
117
+ const pattern = path.join(
118
+ projectRoot,
119
+ '.specweave',
120
+ 'docs',
121
+ 'internal',
122
+ 'specs',
123
+ projectId,
124
+ featureId,
125
+ `${usId.toLowerCase()}-*.md`
126
+ );
127
+
128
+ const files = await glob(pattern);
129
+
130
+ if (files.length === 0) {
131
+ return null;
132
+ }
133
+
134
+ if (files.length > 1) {
135
+ console.log(` ⚠️ Multiple files found for ${usId}, using first: ${path.basename(files[0])}`);
136
+ }
137
+
138
+ return files[0];
139
+ }
140
+
141
+ /**
142
+ * Update User Story file with task list and AC checkboxes
143
+ *
144
+ * @param {string} usFilePath - Path to US markdown file
145
+ * @param {Array} tasks - Tasks linked to this US
146
+ * @param {string} incrementId - Increment ID
147
+ * @returns {Promise<boolean>} True if file was updated
148
+ */
149
+ async function updateUSFile(usFilePath, tasks, incrementId) {
150
+ let content = await fs.readFile(usFilePath, 'utf-8');
151
+ let updated = false;
152
+
153
+ // 1. Update task list section
154
+ const taskList = generateTaskList(tasks, incrementId);
155
+ const newTasksSection = `## Tasks\n\n${taskList}`;
156
+
157
+ // Replace existing tasks section
158
+ if (content.includes('## Tasks')) {
159
+ // Replace everything from "## Tasks" to next "##" or end of file
160
+ const tasksRegex = /(## Tasks\n\n)(?:.*?)(?=\n## |\n---\n|$)/s;
161
+ const newContent = content.replace(tasksRegex, newTasksSection);
162
+
163
+ if (newContent !== content) {
164
+ content = newContent;
165
+ updated = true;
166
+ }
167
+ }
168
+
169
+ // 2. Update AC checkboxes based on task completion
170
+ const updatedACs = updateACCheckboxes(content, tasks);
171
+ if (updatedACs !== content) {
172
+ content = updatedACs;
173
+ updated = true;
174
+ }
175
+
176
+ // Write updated content
177
+ if (updated) {
178
+ await fs.writeFile(usFilePath, content, 'utf-8');
179
+ }
180
+
181
+ return updated;
182
+ }
183
+
184
+ /**
185
+ * Generate task list markdown
186
+ *
187
+ * @param {Array} tasks - Tasks to list
188
+ * @param {string} incrementId - Increment ID
189
+ * @returns {string} Markdown task list
190
+ */
191
+ function generateTaskList(tasks, incrementId) {
192
+ if (tasks.length === 0) {
193
+ return '_No tasks defined for this user story_';
194
+ }
195
+
196
+ return tasks.map(task => {
197
+ const checkbox = task.status === 'completed' ? 'x' : ' ';
198
+ const link = `../../../../increments/${incrementId}/tasks.md#${task.id}`;
199
+ return `- [${checkbox}] [${task.id}](${link}): ${task.title}`;
200
+ }).join('\n');
201
+ }
202
+
203
+ /**
204
+ * Update AC checkboxes based on task completion
205
+ *
206
+ * @param {string} content - US file content
207
+ * @param {Array} tasks - Tasks linked to this US
208
+ * @returns {string} Updated content
209
+ */
210
+ function updateACCheckboxes(content, tasks) {
211
+ // Collect all AC-IDs satisfied by completed tasks
212
+ const satisfiedACs = new Set();
213
+
214
+ tasks.forEach(task => {
215
+ if (task.status === 'completed' && task.satisfiesACs) {
216
+ task.satisfiesACs.forEach(acId => satisfiedACs.add(acId));
217
+ }
218
+ });
219
+
220
+ // Update AC checkboxes
221
+ let updatedContent = content;
222
+
223
+ satisfiedACs.forEach(acId => {
224
+ // Replace: - [ ] **AC-US1-01** with - [x] **AC-US1-01**
225
+ const uncheckedRegex = new RegExp(`- \\[ \\] \\*\\*${escapeRegex(acId)}\\*\\*`, 'g');
226
+ updatedContent = updatedContent.replace(uncheckedRegex, `- [x] **${acId}**`);
227
+ });
228
+
229
+ // Also uncheck ACs that are no longer satisfied (tasks incomplete/pending)
230
+ // Extract all AC-IDs from content
231
+ const acPattern = /- \[[x ]\] \*\*(AC-US\d+-\d{2})\*\*/g;
232
+ let match;
233
+ const allACs = [];
234
+
235
+ while ((match = acPattern.exec(content)) !== null) {
236
+ allACs.push(match[1]);
237
+ }
238
+
239
+ // Uncheck ACs not in satisfiedACs set
240
+ allACs.forEach(acId => {
241
+ if (!satisfiedACs.has(acId)) {
242
+ const checkedRegex = new RegExp(`- \\[x\\] \\*\\*${escapeRegex(acId)}\\*\\*`, 'g');
243
+ updatedContent = updatedContent.replace(checkedRegex, `- [ ] **${acId}**`);
244
+ }
245
+ });
246
+
247
+ return updatedContent;
248
+ }
249
+
250
+ /**
251
+ * Escape special regex characters
252
+ */
253
+ function escapeRegex(str) {
254
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
255
+ }
256
+
257
+ /**
258
+ * Get project ID from metadata or config
259
+ *
260
+ * @param {string} projectRoot - Project root
261
+ * @param {string} incrementId - Increment ID
262
+ * @returns {string|null} Project ID or null
263
+ */
264
+ function getProjectId(projectRoot, incrementId) {
265
+ try {
266
+ // Try to get from metadata.json
267
+ const metadataPath = path.join(projectRoot, '.specweave', 'increments', incrementId, 'metadata.json');
268
+ if (fs.existsSync(metadataPath)) {
269
+ const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf-8'));
270
+ if (metadata.project) {
271
+ return metadata.project;
272
+ }
273
+ }
274
+
275
+ // Try to get from config.json
276
+ const configPath = path.join(projectRoot, '.specweave', 'config.json');
277
+ if (fs.existsSync(configPath)) {
278
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
279
+ if (config.defaultProject) {
280
+ return config.defaultProject;
281
+ }
282
+ }
283
+
284
+ // Default to "specweave" (single-project mode)
285
+ return 'specweave';
286
+ } catch (error) {
287
+ console.log(` ⚠️ Could not determine project ID, using default: "specweave"`);
288
+ return 'specweave';
289
+ }
290
+ }
@@ -5,6 +5,22 @@
5
5
 
6
6
  ---
7
7
 
8
+ ## 🎯 Getting Started
9
+
10
+ **Initial Increment Created**: `0001-project-setup` (`.specweave/increments/0001-project-setup/`)
11
+
12
+ This increment was auto-generated by `specweave init` to give you a starting point.
13
+
14
+ **Your Options**:
15
+ 1. **Start Fresh** (Recommended): Delete it and create your first real feature
16
+ - Delete the increment folder manually
17
+ - Ask user to run `/specweave:increment "your-feature-name"` (if in Claude Code) or create new increment via this file's commands
18
+ 2. **Customize It**: Edit the spec.md in the increment folder and use it for initial setup tasks
19
+
20
+ **Note**: SpecWeave works best when each increment represents a single, focused feature or bugfix.
21
+
22
+ ---
23
+
8
24
  ## 🚨 CRITICAL: How to Use This File (Non-Claude Code Tools)
9
25
 
10
26
  **You're using Cursor, GitHub Copilot, or another AI tool - NOT Claude Code.**
@@ -4,6 +4,24 @@ This project uses **SpecWeave** - a specification-first AI development framework
4
4
 
5
5
  ---
6
6
 
7
+ ## 🎯 Getting Started
8
+
9
+ **Initial Increment Created**: `0001-project-setup` (`.specweave/increments/0001-project-setup/`)
10
+
11
+ This increment was auto-generated by `specweave init` to give you a starting point.
12
+
13
+ **Your Options**:
14
+ 1. **Start Fresh** (Recommended): Delete it and create your first real feature
15
+ ```bash
16
+ rm -rf .specweave/increments/0001-project-setup
17
+ /specweave:increment "your-feature-name"
18
+ ```
19
+ 2. **Customize It**: Edit the spec.md and use this increment for initial setup tasks
20
+
21
+ **Note**: SpecWeave works best when each increment represents a single, focused feature or bugfix.
22
+
23
+ ---
24
+
7
25
  ## 🚨 CRITICAL: NEVER POLLUTE PROJECT ROOT!
8
26
 
9
27
  **⛔ THIS IS THE #1 RULE - ALL AI-GENERATED FILES GO IN INCREMENT FOLDERS ⛔**