specweave 0.17.15 → 0.17.17

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 (200) hide show
  1. package/CLAUDE.md +405 -2495
  2. package/README.md +92 -2
  3. package/dist/locales/de/.gitkeep +0 -0
  4. package/dist/locales/de/cli.json +108 -0
  5. package/dist/locales/en/cli.json +287 -0
  6. package/dist/locales/en/errors.json +7 -0
  7. package/dist/locales/en/templates.json +6 -0
  8. package/dist/locales/es/.gitkeep +0 -0
  9. package/dist/locales/es/cli.json +41 -0
  10. package/dist/locales/fr/.gitkeep +0 -0
  11. package/dist/locales/fr/cli.json +108 -0
  12. package/dist/locales/ja/.gitkeep +0 -0
  13. package/dist/locales/ja/cli.json +108 -0
  14. package/dist/locales/ko/.gitkeep +0 -0
  15. package/dist/locales/ko/cli.json +108 -0
  16. package/dist/locales/pt/.gitkeep +0 -0
  17. package/dist/locales/pt/cli.json +108 -0
  18. package/dist/locales/ru/.gitkeep +0 -0
  19. package/dist/locales/ru/cli.json +269 -0
  20. package/dist/locales/zh/.gitkeep +0 -0
  21. package/dist/locales/zh/cli.json +108 -0
  22. package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
  23. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +188 -36
  24. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
  25. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts +54 -0
  26. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts.map +1 -0
  27. package/dist/plugins/specweave-ado/lib/ado-status-sync.js +86 -0
  28. package/dist/plugins/specweave-ado/lib/ado-status-sync.js.map +1 -0
  29. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts +25 -0
  30. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts.map +1 -0
  31. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js +191 -0
  32. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js.map +1 -0
  33. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +139 -0
  34. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts.map +1 -0
  35. package/dist/plugins/specweave-github/lib/duplicate-detector.js +389 -0
  36. package/dist/plugins/specweave-github/lib/duplicate-detector.js.map +1 -0
  37. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts +26 -0
  38. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts.map +1 -0
  39. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js +249 -0
  40. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js.map +1 -0
  41. package/dist/plugins/specweave-github/lib/github-client.d.ts +1 -1
  42. package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -1
  43. package/dist/plugins/specweave-github/lib/github-client.js +25 -13
  44. package/dist/plugins/specweave-github/lib/github-client.js.map +1 -1
  45. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +83 -0
  46. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +1 -0
  47. package/dist/plugins/specweave-github/lib/github-epic-sync.js +451 -0
  48. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -0
  49. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts +43 -0
  50. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts.map +1 -0
  51. package/dist/plugins/specweave-github/lib/github-status-sync.js +82 -0
  52. package/dist/plugins/specweave-github/lib/github-status-sync.js.map +1 -0
  53. package/dist/plugins/specweave-github/lib/task-sync.d.ts +5 -0
  54. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
  55. package/dist/plugins/specweave-github/lib/task-sync.js +38 -2
  56. package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
  57. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts +26 -0
  58. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts.map +1 -0
  59. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js +195 -0
  60. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js.map +1 -0
  61. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts +66 -0
  62. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts.map +1 -0
  63. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js +274 -0
  64. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js.map +1 -0
  65. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts +56 -0
  66. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts.map +1 -0
  67. package/dist/plugins/specweave-jira/lib/jira-status-sync.js +93 -0
  68. package/dist/plugins/specweave-jira/lib/jira-status-sync.js.map +1 -0
  69. package/dist/spec-parser.js +629 -0
  70. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  71. package/dist/src/cli/helpers/issue-tracker/index.js +48 -3
  72. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  73. package/dist/src/core/living-docs/hierarchy-mapper.d.ts +142 -0
  74. package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -0
  75. package/dist/src/core/living-docs/hierarchy-mapper.js +453 -0
  76. package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -0
  77. package/dist/src/core/living-docs/index.d.ts +10 -84
  78. package/dist/src/core/living-docs/index.d.ts.map +1 -1
  79. package/dist/src/core/living-docs/index.js +10 -164
  80. package/dist/src/core/living-docs/index.js.map +1 -1
  81. package/dist/src/core/living-docs/spec-distributor.d.ts +106 -0
  82. package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -0
  83. package/dist/src/core/living-docs/spec-distributor.js +823 -0
  84. package/dist/src/core/living-docs/spec-distributor.js.map +1 -0
  85. package/dist/src/core/living-docs/types.d.ts +201 -0
  86. package/dist/src/core/living-docs/types.d.ts.map +1 -0
  87. package/dist/src/core/living-docs/types.js +15 -0
  88. package/dist/src/core/living-docs/types.js.map +1 -0
  89. package/dist/src/core/logging/prompt-logger.d.ts +70 -0
  90. package/dist/src/core/logging/prompt-logger.d.ts.map +1 -0
  91. package/dist/src/core/logging/prompt-logger.js +247 -0
  92. package/dist/src/core/logging/prompt-logger.js.map +1 -0
  93. package/dist/src/core/status-line/status-line-manager.d.ts +15 -24
  94. package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
  95. package/dist/src/core/status-line/status-line-manager.js +33 -70
  96. package/dist/src/core/status-line/status-line-manager.js.map +1 -1
  97. package/dist/src/core/status-line/types.d.ts +19 -31
  98. package/dist/src/core/status-line/types.d.ts.map +1 -1
  99. package/dist/src/core/status-line/types.js +5 -9
  100. package/dist/src/core/status-line/types.js.map +1 -1
  101. package/dist/src/core/sync/conflict-resolver.d.ts +66 -0
  102. package/dist/src/core/sync/conflict-resolver.d.ts.map +1 -0
  103. package/dist/src/core/sync/conflict-resolver.js +108 -0
  104. package/dist/src/core/sync/conflict-resolver.js.map +1 -0
  105. package/dist/src/core/sync/enhanced-content-builder.d.ts +77 -0
  106. package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -0
  107. package/dist/src/core/sync/enhanced-content-builder.js +199 -0
  108. package/dist/src/core/sync/enhanced-content-builder.js.map +1 -0
  109. package/dist/src/core/sync/label-detector.d.ts +66 -0
  110. package/dist/src/core/sync/label-detector.d.ts.map +1 -0
  111. package/dist/src/core/sync/label-detector.js +211 -0
  112. package/dist/src/core/sync/label-detector.js.map +1 -0
  113. package/dist/src/core/sync/retry-logic.d.ts +64 -0
  114. package/dist/src/core/sync/retry-logic.d.ts.map +1 -0
  115. package/dist/src/core/sync/retry-logic.js +165 -0
  116. package/dist/src/core/sync/retry-logic.js.map +1 -0
  117. package/dist/src/core/sync/spec-content-sync.d.ts +88 -0
  118. package/dist/src/core/sync/spec-content-sync.d.ts.map +1 -0
  119. package/dist/src/core/sync/spec-content-sync.js +5 -0
  120. package/dist/src/core/sync/spec-content-sync.js.map +1 -0
  121. package/dist/src/core/sync/spec-increment-mapper.d.ts +100 -0
  122. package/dist/src/core/sync/spec-increment-mapper.d.ts.map +1 -0
  123. package/dist/src/core/sync/spec-increment-mapper.js +424 -0
  124. package/dist/src/core/sync/spec-increment-mapper.js.map +1 -0
  125. package/dist/src/core/sync/status-cache.d.ts +91 -0
  126. package/dist/src/core/sync/status-cache.d.ts.map +1 -0
  127. package/dist/src/core/sync/status-cache.js +140 -0
  128. package/dist/src/core/sync/status-cache.js.map +1 -0
  129. package/dist/src/core/sync/status-mapper.d.ts +69 -0
  130. package/dist/src/core/sync/status-mapper.d.ts.map +1 -0
  131. package/dist/src/core/sync/status-mapper.js +90 -0
  132. package/dist/src/core/sync/status-mapper.js.map +1 -0
  133. package/dist/src/core/sync/status-sync-engine.d.ts +162 -0
  134. package/dist/src/core/sync/status-sync-engine.d.ts.map +1 -0
  135. package/dist/src/core/sync/status-sync-engine.js +347 -0
  136. package/dist/src/core/sync/status-sync-engine.js.map +1 -0
  137. package/dist/src/core/sync/sync-event-logger.d.ts +99 -0
  138. package/dist/src/core/sync/sync-event-logger.d.ts.map +1 -0
  139. package/dist/src/core/sync/sync-event-logger.js +103 -0
  140. package/dist/src/core/sync/sync-event-logger.js.map +1 -0
  141. package/dist/src/core/sync/workflow-detector.d.ts +95 -0
  142. package/dist/src/core/sync/workflow-detector.d.ts.map +1 -0
  143. package/dist/src/core/sync/workflow-detector.js +175 -0
  144. package/dist/src/core/sync/workflow-detector.js.map +1 -0
  145. package/dist/src/core/types/config.d.ts.map +1 -1
  146. package/dist/src/core/types/config.js +31 -0
  147. package/dist/src/core/types/config.js.map +1 -1
  148. package/dist/src/utils/github-url.d.ts +53 -0
  149. package/dist/src/utils/github-url.d.ts.map +1 -0
  150. package/dist/src/utils/github-url.js +90 -0
  151. package/dist/src/utils/github-url.js.map +1 -0
  152. package/dist/src/utils/plugin-validator.d.ts +9 -0
  153. package/dist/src/utils/plugin-validator.d.ts.map +1 -1
  154. package/dist/src/utils/plugin-validator.js +86 -19
  155. package/dist/src/utils/plugin-validator.js.map +1 -1
  156. package/dist/src/utils/spec-parser.d.ts +145 -0
  157. package/dist/src/utils/spec-parser.d.ts.map +1 -0
  158. package/dist/src/utils/spec-parser.js +640 -0
  159. package/dist/src/utils/spec-parser.js.map +1 -0
  160. package/dist/tsconfig.tsbuildinfo +1 -0
  161. package/package.json +1 -1
  162. package/plugins/specweave/agents/pm/AGENT.md +1 -1
  163. package/plugins/specweave/agents/pm/templates/increment-spec.md +158 -0
  164. package/plugins/specweave/agents/pm/templates/living-docs-spec.md +113 -0
  165. package/plugins/specweave/commands/specweave-done.md +163 -0
  166. package/plugins/specweave/hooks/lib/update-status-line.sh +79 -111
  167. package/plugins/specweave/hooks/post-increment-planning.sh +107 -35
  168. package/plugins/specweave/lib/hooks/sync-living-docs.js +139 -34
  169. package/plugins/specweave/lib/hooks/sync-living-docs.ts +234 -38
  170. package/plugins/specweave/skills/SKILLS-INDEX.md +4 -24
  171. package/plugins/specweave/skills/increment-planner/SKILL.md +94 -0
  172. package/plugins/specweave/skills/increment-work-router/SKILL.md +466 -0
  173. package/plugins/specweave/skills/plugin-validator/SKILL.md +16 -13
  174. package/plugins/specweave-ado/lib/ado-status-sync.js +80 -0
  175. package/plugins/specweave-ado/lib/ado-status-sync.ts +121 -0
  176. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
  177. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +205 -0
  178. package/plugins/specweave-github/commands/specweave-github-sync-epic.md +248 -0
  179. package/plugins/specweave-github/lib/duplicate-detector.js +370 -0
  180. package/plugins/specweave-github/lib/duplicate-detector.ts +525 -0
  181. package/plugins/specweave-github/lib/enhanced-github-sync.js +220 -0
  182. package/plugins/specweave-github/lib/enhanced-github-sync.ts +322 -0
  183. package/plugins/specweave-github/lib/github-client.js +21 -10
  184. package/plugins/specweave-github/lib/github-client.ts +27 -16
  185. package/plugins/specweave-github/lib/github-epic-sync.js +489 -0
  186. package/plugins/specweave-github/lib/github-epic-sync.ts +690 -0
  187. package/plugins/specweave-github/lib/github-status-sync.js +71 -0
  188. package/plugins/specweave-github/lib/github-status-sync.ts +107 -0
  189. package/plugins/specweave-github/lib/task-sync.js +33 -2
  190. package/plugins/specweave-github/lib/task-sync.ts +44 -2
  191. package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +267 -0
  192. package/plugins/specweave-jira/lib/enhanced-jira-sync.ts.disabled +222 -0
  193. package/plugins/specweave-jira/lib/jira-epic-sync.js +304 -0
  194. package/plugins/specweave-jira/lib/jira-epic-sync.ts +459 -0
  195. package/plugins/specweave-jira/lib/jira-status-sync.js +79 -0
  196. package/plugins/specweave-jira/lib/jira-status-sync.ts +139 -0
  197. package/src/templates/AGENTS.md.template +88 -1
  198. package/src/templates/CLAUDE.md.template +49 -0
  199. package/plugins/specweave/skills/increment-quality-judge/SKILL.md +0 -524
  200. package/plugins/specweave/skills/plugin-installer/SKILL.md +0 -353
@@ -0,0 +1,453 @@
1
+ /**
2
+ * SpecWeave Hierarchy Mapper
3
+ *
4
+ * Maps increments to Feature Spec (FS-*) folders following Universal Hierarchy architecture.
5
+ *
6
+ * Supports three complexity levels:
7
+ * 1. Simple: Increment → Issue/Epic/Feature (flat)
8
+ * 2. Standard: FS-* (Epic) → US-* (User Stories) → T-* (Tasks)
9
+ * 3. Enterprise: Domain → FS-* (Epic) → US-* → T-*
10
+ *
11
+ * @author SpecWeave Team
12
+ * @version 3.0.0
13
+ */
14
+ import fs from 'fs-extra';
15
+ import path from 'path';
16
+ /**
17
+ * HierarchyMapper - Maps increments to feature folders (named by concept, not increment number)
18
+ *
19
+ * NEW ARCHITECTURE (v0.18.0+):
20
+ * - Features are PERMANENT (named by concept: "release-management", "external-tool-sync")
21
+ * - Increments are TEMPORARY (named by execution: "0023-release-management-enhancements")
22
+ * - Multiple increments can contribute to same feature
23
+ * - No FS-### prefix (features aren't numbered)
24
+ */
25
+ export class HierarchyMapper {
26
+ constructor(projectRoot, config) {
27
+ this.projectRoot = projectRoot;
28
+ const projectId = config?.projectId || 'default';
29
+ this.config = {
30
+ level: 'standard', // SpecWeave uses Standard level by default
31
+ specsBaseDir: path.join(projectRoot, '.specweave', 'docs', 'internal', 'specs', projectId),
32
+ projectId,
33
+ featureFolderPattern: '{name}', // Feature-based naming (no FS- prefix)
34
+ userStoriesSubdir: '', // User stories go directly in feature folder, not subfolder
35
+ detectFeatureFrom: ['frontmatter', 'increment-name', 'config'],
36
+ fallbackFeature: undefined,
37
+ ...config,
38
+ };
39
+ }
40
+ /**
41
+ * Detect which feature folder this increment belongs to
42
+ *
43
+ * NEW: Features are named by CONCEPT (release-management), not INCREMENT NUMBER (FS-023)
44
+ */
45
+ async detectFeatureMapping(incrementId) {
46
+ const specPath = path.join(this.projectRoot, '.specweave', 'increments', incrementId, 'spec.md');
47
+ if (!fs.existsSync(specPath)) {
48
+ throw new Error(`Increment spec not found: ${specPath}`);
49
+ }
50
+ const content = await fs.readFile(specPath, 'utf-8');
51
+ // Try each detection method in order
52
+ for (const method of this.config.detectFeatureFrom) {
53
+ let mapping = null;
54
+ switch (method) {
55
+ case 'frontmatter':
56
+ mapping = await this.detectFromFrontmatter(content, incrementId);
57
+ break;
58
+ case 'increment-name':
59
+ mapping = await this.detectFromIncrementName(incrementId);
60
+ break;
61
+ case 'config':
62
+ mapping = await this.detectFromConfig(incrementId);
63
+ break;
64
+ }
65
+ if (mapping && mapping.confidence >= 80) {
66
+ return mapping;
67
+ }
68
+ }
69
+ // Fallback: Extract feature name from increment ID
70
+ return await this.createFallbackMapping(incrementId);
71
+ }
72
+ /**
73
+ * Legacy alias for backward compatibility
74
+ */
75
+ async detectEpicMapping(incrementId) {
76
+ return this.detectFeatureMapping(incrementId);
77
+ }
78
+ /**
79
+ * Detect feature from frontmatter (epic: feature-name)
80
+ *
81
+ * FORMAT (v0.18.1+): Accepts simple feature names (external-tool-status-sync)
82
+ * LEGACY: Also accepts old FS-### format (FS-001) - extracts from increment name instead
83
+ */
84
+ async detectFromFrontmatter(content, incrementId) {
85
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
86
+ if (!frontmatterMatch)
87
+ return null;
88
+ try {
89
+ const yaml = await import('yaml');
90
+ const frontmatter = yaml.parse(frontmatterMatch[1]);
91
+ // Check for explicit epic field
92
+ if (frontmatter.epic && typeof frontmatter.epic === 'string') {
93
+ const epicValue = frontmatter.epic;
94
+ // Handle LEGACY numeric format (FS-001, FS-031) → extract from increment name
95
+ if (epicValue.match(/^FS-\d+$/)) {
96
+ console.log(` ⚠️ Legacy FS-### format detected (${epicValue}), extracting feature name from increment...`);
97
+ return await this.detectFromIncrementName(incrementId);
98
+ }
99
+ // NEW FORMAT: FS-25-11-14-feature-name (date-based) OR plain feature-name
100
+ const featureFolder = await this.findFeatureFolder(epicValue);
101
+ if (featureFolder) {
102
+ return {
103
+ featureId: featureFolder, // ID = folder name
104
+ featureFolder,
105
+ featurePath: path.join(this.config.specsBaseDir, featureFolder),
106
+ userStoriesPath: path.join(this.config.specsBaseDir, featureFolder, this.config.userStoriesSubdir),
107
+ confidence: 100,
108
+ detectionMethod: 'frontmatter',
109
+ };
110
+ }
111
+ }
112
+ }
113
+ catch (error) {
114
+ console.warn(` ⚠️ Failed to parse frontmatter: ${error}`);
115
+ }
116
+ return null;
117
+ }
118
+ /**
119
+ * Detect feature from increment NAME
120
+ *
121
+ * FORMAT (v0.18.1+): Simple descriptive names (no date prefixes)
122
+ *
123
+ * Extracts the descriptive part of increment ID and normalizes it to feature name
124
+ * Examples:
125
+ * 0023-release-management-enhancements → release-management (new or existing)
126
+ * 0031-external-tool-status-sync → external-tool-status-sync
127
+ */
128
+ async detectFromIncrementName(incrementId) {
129
+ // Extract name part (after number: 0023-release-management-enhancements → release-management-enhancements)
130
+ const nameMatch = incrementId.match(/^\d+-(.+)/);
131
+ if (!nameMatch)
132
+ return null;
133
+ const fullName = nameMatch[1]; // release-management-enhancements
134
+ // Extract core feature name (remove suffixes like -enhancements, -improvements, -fixes)
135
+ const suffixesToRemove = ['-enhancements', '-improvements', '-fixes', '-updates', '-v2', '-v3'];
136
+ let featureName = fullName;
137
+ for (const suffix of suffixesToRemove) {
138
+ if (featureName.endsWith(suffix)) {
139
+ featureName = featureName.slice(0, -suffix.length);
140
+ break;
141
+ }
142
+ }
143
+ // Try to find existing feature folder (legacy or new format)
144
+ let featureFolder = await this.findFeatureFolder(featureName);
145
+ // If not found, try with full name
146
+ if (!featureFolder) {
147
+ featureFolder = await this.findFeatureFolder(fullName);
148
+ }
149
+ // If not found, use simple feature name (no date prefix, no FS- prefix)
150
+ if (!featureFolder) {
151
+ featureFolder = featureName; // Simple: external-tool-status-sync
152
+ console.log(` ✨ Creating new feature folder: ${featureFolder}`);
153
+ }
154
+ return {
155
+ featureId: featureFolder, // ID = folder name (for consistency)
156
+ featureFolder,
157
+ featurePath: path.join(this.config.specsBaseDir, featureFolder),
158
+ userStoriesPath: path.join(this.config.specsBaseDir, featureFolder, this.config.userStoriesSubdir),
159
+ confidence: 90,
160
+ detectionMethod: 'increment-name',
161
+ };
162
+ }
163
+ /**
164
+ * Detect feature from config mapping (explicit increment → feature mapping)
165
+ */
166
+ async detectFromConfig(incrementId) {
167
+ // Load config to check for explicit mapping
168
+ const configPath = path.join(this.projectRoot, '.specweave', 'config.json');
169
+ if (!fs.existsSync(configPath))
170
+ return null;
171
+ try {
172
+ const config = JSON.parse(await fs.readFile(configPath, 'utf-8'));
173
+ const featureMapping = config.livingDocs?.hierarchyMapping?.incrementToFeature?.[incrementId];
174
+ if (featureMapping && typeof featureMapping === 'string') {
175
+ const featureFolder = await this.findFeatureFolder(featureMapping);
176
+ if (featureFolder) {
177
+ return {
178
+ featureId: featureMapping,
179
+ featureFolder,
180
+ featurePath: path.join(this.config.specsBaseDir, featureFolder),
181
+ userStoriesPath: path.join(this.config.specsBaseDir, featureFolder, this.config.userStoriesSubdir),
182
+ confidence: 100,
183
+ detectionMethod: 'config',
184
+ };
185
+ }
186
+ }
187
+ }
188
+ catch (error) {
189
+ console.warn(` ⚠️ Failed to load config: ${error}`);
190
+ }
191
+ return null;
192
+ }
193
+ /**
194
+ * Create fallback mapping (extract feature name from increment ID)
195
+ *
196
+ * FORMAT (v0.18.1+): Simple descriptive names (no prefixes)
197
+ * - Uses core feature name extracted from increment ID
198
+ * - No date prefixes (removed to prevent duplicates)
199
+ * - No FS- prefixes (features are not numbered)
200
+ *
201
+ * Example: 0023-release-management-enhancements → release-management
202
+ */
203
+ async createFallbackMapping(incrementId) {
204
+ // Extract name from increment ID
205
+ const nameMatch = incrementId.match(/^\d+-(.+)/);
206
+ const fullName = nameMatch ? nameMatch[1] : 'unknown';
207
+ // Remove common suffixes to get core feature name
208
+ const suffixesToRemove = ['-enhancements', '-improvements', '-fixes', '-updates', '-v2', '-v3'];
209
+ let featureName = fullName;
210
+ for (const suffix of suffixesToRemove) {
211
+ if (featureName.endsWith(suffix)) {
212
+ featureName = featureName.slice(0, -suffix.length);
213
+ break;
214
+ }
215
+ }
216
+ // Use simple feature name (no date prefix, no FS- prefix)
217
+ const featureFolder = featureName; // Simple: external-tool-status-sync
218
+ const featurePath = path.join(this.config.specsBaseDir, featureFolder);
219
+ const userStoriesPath = path.join(featurePath, this.config.userStoriesSubdir);
220
+ // Create folder if it doesn't exist
221
+ if (!fs.existsSync(featurePath)) {
222
+ console.log(` 📁 Creating new feature folder: ${featureFolder}`);
223
+ await fs.ensureDir(featurePath);
224
+ }
225
+ return {
226
+ featureId: featureFolder, // ID = folder name (external-tool-status-sync)
227
+ featureFolder,
228
+ featurePath,
229
+ userStoriesPath,
230
+ confidence: 80,
231
+ detectionMethod: 'fallback',
232
+ };
233
+ }
234
+ /**
235
+ * Get increment creation date in yy-mm-dd format
236
+ * Tries: metadata.json → spec.md frontmatter → current date
237
+ */
238
+ async getIncrementCreationDate(incrementId) {
239
+ // Try metadata.json
240
+ const metadataPath = path.join(this.projectRoot, '.specweave', 'increments', incrementId, 'metadata.json');
241
+ if (fs.existsSync(metadataPath)) {
242
+ try {
243
+ const metadata = JSON.parse(await fs.readFile(metadataPath, 'utf-8'));
244
+ if (metadata.created) {
245
+ return this.formatDateShort(metadata.created);
246
+ }
247
+ }
248
+ catch (error) {
249
+ // Fall through to next method
250
+ }
251
+ }
252
+ // Try spec.md frontmatter
253
+ const specPath = path.join(this.projectRoot, '.specweave', 'increments', incrementId, 'spec.md');
254
+ if (fs.existsSync(specPath)) {
255
+ try {
256
+ const content = await fs.readFile(specPath, 'utf-8');
257
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
258
+ if (frontmatterMatch) {
259
+ const yaml = await import('yaml');
260
+ const frontmatter = yaml.parse(frontmatterMatch[1]);
261
+ if (frontmatter.created) {
262
+ return this.formatDateShort(frontmatter.created);
263
+ }
264
+ }
265
+ }
266
+ catch (error) {
267
+ // Fall through to current date
268
+ }
269
+ }
270
+ // Fallback: current date
271
+ return this.formatDateShort(new Date().toISOString());
272
+ }
273
+ /**
274
+ * Format date as yy-mm-dd
275
+ * Input: "2025-11-14" or "2025-11-14T12:00:00Z"
276
+ * Output: "25-11-14"
277
+ */
278
+ formatDateShort(dateString) {
279
+ const date = new Date(dateString);
280
+ const yy = String(date.getFullYear()).slice(-2);
281
+ const mm = String(date.getMonth() + 1).padStart(2, '0');
282
+ const dd = String(date.getDate()).padStart(2, '0');
283
+ return `${yy}-${mm}-${dd}`;
284
+ }
285
+ /**
286
+ * NEW: Find feature folder by name (exact match or fuzzy match)
287
+ *
288
+ * Examples:
289
+ * release-management → release-management/
290
+ * external-tool-sync → external-tool-status-sync/ (fuzzy match)
291
+ */
292
+ async findFeatureFolder(featureName) {
293
+ try {
294
+ const folders = await fs.readdir(this.config.specsBaseDir);
295
+ // First: Try exact match
296
+ if (folders.includes(featureName)) {
297
+ const folderPath = path.join(this.config.specsBaseDir, featureName);
298
+ const stats = await fs.stat(folderPath);
299
+ if (stats.isDirectory()) {
300
+ return featureName;
301
+ }
302
+ }
303
+ // Second: Try fuzzy match (feature name is substring of folder name)
304
+ for (const folder of folders) {
305
+ if (folder.startsWith(featureName) || folder.includes(featureName)) {
306
+ const folderPath = path.join(this.config.specsBaseDir, folder);
307
+ const stats = await fs.stat(folderPath);
308
+ if (stats.isDirectory() && folder !== 'README.md') {
309
+ return folder;
310
+ }
311
+ }
312
+ }
313
+ }
314
+ catch (error) {
315
+ console.warn(` ⚠️ Failed to find feature folder for ${featureName}: ${error}`);
316
+ }
317
+ return null;
318
+ }
319
+ /**
320
+ * LEGACY: Find FS-* epic folder (for backward compatibility)
321
+ */
322
+ async findEpicFolder(epicId) {
323
+ return this.findFeatureFolder(epicId);
324
+ }
325
+ /**
326
+ * Get all feature folders (NEW: no FS- prefix filtering)
327
+ */
328
+ async getAllFeatureFolders() {
329
+ try {
330
+ const folders = await fs.readdir(this.config.specsBaseDir);
331
+ const featureFolders = [];
332
+ for (const folder of folders) {
333
+ // Skip special files/folders
334
+ if (folder === 'README.md' || folder.startsWith('.') || folder.startsWith('_')) {
335
+ continue;
336
+ }
337
+ const folderPath = path.join(this.config.specsBaseDir, folder);
338
+ const stats = await fs.stat(folderPath);
339
+ if (stats.isDirectory()) {
340
+ featureFolders.push(folder);
341
+ }
342
+ }
343
+ return featureFolders.sort();
344
+ }
345
+ catch (error) {
346
+ console.warn(` ⚠️ Failed to get feature folders: ${error}`);
347
+ return [];
348
+ }
349
+ }
350
+ /**
351
+ * LEGACY: Get all epic folders (for backward compatibility)
352
+ */
353
+ async getAllEpicFolders() {
354
+ return this.getAllFeatureFolders();
355
+ }
356
+ /**
357
+ * Validate feature folder structure (NEW: checks for FEATURE.md)
358
+ */
359
+ async validateFeatureFolder(featureFolder) {
360
+ const featurePath = path.join(this.config.specsBaseDir, featureFolder);
361
+ const missing = [];
362
+ // Check FEATURE.md exists (feature overview)
363
+ if (!fs.existsSync(path.join(featurePath, 'FEATURE.md'))) {
364
+ missing.push('FEATURE.md');
365
+ }
366
+ // Note: User stories (us-*.md) go directly in feature folder, no validation needed here
367
+ return {
368
+ valid: missing.length === 0,
369
+ missing,
370
+ };
371
+ }
372
+ /**
373
+ * LEGACY: Validate epic folder structure (for backward compatibility)
374
+ */
375
+ async validateEpicFolder(epicFolder) {
376
+ return this.validateFeatureFolder(epicFolder);
377
+ }
378
+ /**
379
+ * Create feature folder structure if missing (NEW: creates FEATURE.md)
380
+ */
381
+ async createFeatureFolderStructure(featureFolder, title) {
382
+ const featurePath = path.join(this.config.specsBaseDir, featureFolder);
383
+ // Create feature directory (user stories go directly here, no subfolder)
384
+ await fs.ensureDir(featurePath);
385
+ // Create FEATURE.md if missing (feature overview - high-level summary)
386
+ const featureFilePath = path.join(featurePath, 'FEATURE.md');
387
+ if (!fs.existsSync(featureFilePath)) {
388
+ // ID = folder name (e.g., FS-25-11-14-release-management)
389
+ const featureContent = `---
390
+ id: ${featureFolder}
391
+ title: "${title}"
392
+ type: feature
393
+ status: in-progress
394
+ priority: P1
395
+ created: ${new Date().toISOString().split('T')[0]}
396
+ last_updated: ${new Date().toISOString().split('T')[0]}
397
+ # External Tool Mapping
398
+ external_tools:
399
+ github:
400
+ type: project
401
+ id: null
402
+ url: null
403
+ jira:
404
+ type: epic
405
+ key: null
406
+ url: null
407
+ ado:
408
+ type: epic
409
+ id: null
410
+ url: null
411
+ ---
412
+
413
+ # ${featureFolder}: ${title}
414
+
415
+ ## Overview
416
+
417
+ [High-level description of this feature - what it does and why it matters]
418
+
419
+ ## Business Value
420
+
421
+ [Add business value and impact]
422
+
423
+ ## User Stories
424
+
425
+ User stories are in this folder as \`us-*.md\` files:
426
+ - us-001-*.md
427
+ - us-002-*.md
428
+ - ...
429
+
430
+ ## Implementation History
431
+
432
+ | Increment | Stories Implemented | Status | Completion Date |
433
+ |-----------|-------------------|--------|----------------|
434
+ | [TBD]() | TBD | 🚧 In Progress | TBD |
435
+
436
+ ## External Tool Integration
437
+
438
+ **GitHub Project**: Not yet synced
439
+ **Jira Epic**: Not yet synced
440
+ **Azure DevOps Epic**: Not yet synced
441
+ `;
442
+ await fs.writeFile(featureFilePath, featureContent, 'utf-8');
443
+ console.log(` ✅ Created FEATURE.md for ${featureFolder}`);
444
+ }
445
+ }
446
+ /**
447
+ * LEGACY: Create epic folder structure (for backward compatibility)
448
+ */
449
+ async createEpicFolderStructure(epicFolder, title) {
450
+ return this.createFeatureFolderStructure(epicFolder, title);
451
+ }
452
+ }
453
+ //# sourceMappingURL=hierarchy-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hierarchy-mapper.js","sourceRoot":"","sources":["../../../../src/core/living-docs/hierarchy-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAwBxB;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IAI1B,YAAY,WAAmB,EAAE,MAAiC;QAChE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,IAAI,SAAS,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG;YACZ,KAAK,EAAE,UAAU,EAAE,2CAA2C;YAC9D,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC;YAC1F,SAAS;YACT,oBAAoB,EAAE,QAAQ,EAAE,uCAAuC;YACvE,iBAAiB,EAAE,EAAE,EAAE,4DAA4D;YACnF,iBAAiB,EAAE,CAAC,aAAa,EAAE,gBAAgB,EAAE,QAAQ,CAAC;YAC9D,eAAe,EAAE,SAAS;YAC1B,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,oBAAoB,CAAC,WAAmB;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAEjG,IAAI,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AI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,4BAA4B,CAAC,aAAqB,EAAE,KAAa;QACrE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;QAEvE,yEAAyE;QACzE,MAAM,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAEhC,uEAAuE;QACvE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC7D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACpC,0DAA0D;YAC1D,MAAM,cAAc,GAAG;MACvB,aAAa;UACT,KAAK;;;;WAIJ,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACjC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;IAiBlD,aAAa,KAAK,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B1B,CAAC;YAEI,MAAM,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,+BAA+B,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,yBAAyB,CAAC,UAAkB,EAAE,KAAa;QAC/D,OAAO,IAAI,CAAC,4BAA4B,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -1,89 +1,15 @@
1
1
  /**
2
- * Intelligent Living Docs Sync - Main Orchestrator
2
+ * Living Docs Distribution Module
3
3
  *
4
- * Coordinates all components for intelligent spec distribution.
4
+ * Exports:
5
+ * - SpecDistributor: Distributes increment specs into hierarchical living docs
6
+ * - HierarchyMapper: Maps increments to FS-* epic folders (Universal Hierarchy)
7
+ * - Types: TypeScript interfaces for living docs structure
5
8
  *
6
- * @module living-docs
9
+ * @author SpecWeave Team
10
+ * @version 3.0.0
7
11
  */
8
- import { ContentParser, ParsedSpec, ParserOptions } from './content-parser.js';
9
- import { ContentClassifier, ClassificationResult } from './content-classifier.js';
10
- import { ProjectDetector, ProjectContext, DetectorOptions } from './project-detector.js';
11
- import { ContentDistributor, DistributionResult, DistributorOptions } from './content-distributor.js';
12
- import { CrossLinker, CrossLink, LinkerOptions } from './cross-linker.js';
13
- /**
14
- * Intelligent Sync options
15
- */
16
- export interface IntelligentSyncOptions {
17
- parser?: ParserOptions;
18
- detector?: DetectorOptions;
19
- distributor?: DistributorOptions;
20
- linker?: LinkerOptions;
21
- dryRun?: boolean;
22
- verbose?: boolean;
23
- }
24
- /**
25
- * Complete sync result
26
- */
27
- export interface IntelligentSyncResult {
28
- incrementId: string;
29
- project: ProjectContext;
30
- spec: ParsedSpec;
31
- classifications: ClassificationResult[];
32
- distribution: DistributionResult;
33
- links: CrossLink[];
34
- duration: number;
35
- success: boolean;
36
- errors: string[];
37
- }
38
- /**
39
- * Intelligent Living Docs Sync Orchestrator
40
- */
41
- export declare class IntelligentLivingDocsSync {
42
- private parser;
43
- private classifier;
44
- private detector;
45
- private distributor;
46
- private linker;
47
- private options;
48
- constructor(options?: IntelligentSyncOptions);
49
- /**
50
- * Sync increment spec to living docs
51
- */
52
- syncIncrement(incrementId: string): Promise<IntelligentSyncResult>;
53
- /**
54
- * Load and parse increment spec
55
- */
56
- private loadAndParseSpec;
57
- /**
58
- * Generate index files for categories
59
- */
60
- private generateIndexFiles;
61
- /**
62
- * Logging helper
63
- */
64
- private log;
65
- /**
66
- * Get component instances (for testing/advanced usage)
67
- */
68
- getComponents(): {
69
- parser: ContentParser;
70
- classifier: ContentClassifier;
71
- detector: ProjectDetector;
72
- distributor: ContentDistributor;
73
- linker: CrossLinker;
74
- };
75
- }
76
- /**
77
- * Factory function to create sync orchestrator
78
- */
79
- export declare function createIntelligentSync(options?: IntelligentSyncOptions): IntelligentLivingDocsSync;
80
- /**
81
- * Convenience function to sync an increment
82
- */
83
- export declare function syncIncrement(incrementId: string, options?: IntelligentSyncOptions): Promise<IntelligentSyncResult>;
84
- export * from './content-parser.js';
85
- export * from './content-classifier.js';
86
- export * from './project-detector.js';
87
- export * from './content-distributor.js';
88
- export * from './cross-linker.js';
12
+ export { SpecDistributor } from './spec-distributor.js';
13
+ export { HierarchyMapper } from './hierarchy-mapper.js';
14
+ export * from './types.js';
89
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/living-docs/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EACL,aAAa,EACb,UAAU,EAEV,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,cAAc,EAEd,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAElB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,WAAW,EACX,SAAS,EAET,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE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