specweave 0.18.1 → 0.20.1

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 (389) hide show
  1. package/CLAUDE.md +229 -1817
  2. package/README.md +68 -0
  3. package/bin/specweave.js +62 -6
  4. package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
  5. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +3 -0
  6. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
  7. package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts +21 -0
  8. package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts.map +1 -0
  9. package/dist/plugins/specweave/lib/hooks/update-ac-status.js +162 -0
  10. package/dist/plugins/specweave/lib/hooks/update-ac-status.js.map +1 -0
  11. package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.d.ts.map +1 -1
  12. package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js +65 -6
  13. package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js.map +1 -1
  14. package/dist/plugins/specweave-github/lib/completion-calculator.d.ts +112 -0
  15. package/dist/plugins/specweave-github/lib/completion-calculator.d.ts.map +1 -0
  16. package/dist/plugins/specweave-github/lib/completion-calculator.js +301 -0
  17. package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -0
  18. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +3 -3
  19. package/dist/plugins/specweave-github/lib/duplicate-detector.js +3 -3
  20. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +7 -0
  21. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +1 -1
  22. package/dist/plugins/specweave-github/lib/epic-content-builder.js +42 -0
  23. package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +1 -1
  24. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +14 -0
  25. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
  26. package/dist/plugins/specweave-github/lib/github-client-v2.js +51 -0
  27. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  28. package/dist/plugins/specweave-github/lib/github-epic-sync.js +1 -1
  29. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -1
  30. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +87 -0
  31. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -0
  32. package/dist/plugins/specweave-github/lib/github-feature-sync.js +412 -0
  33. package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -0
  34. package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
  35. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +64 -13
  36. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
  37. package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts +78 -0
  38. package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts.map +1 -0
  39. package/dist/plugins/specweave-github/lib/progress-comment-builder.js +237 -0
  40. package/dist/plugins/specweave-github/lib/progress-comment-builder.js.map +1 -0
  41. package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts +97 -0
  42. package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts.map +1 -0
  43. package/dist/plugins/specweave-github/lib/user-story-content-builder.js +301 -0
  44. package/dist/plugins/specweave-github/lib/user-story-content-builder.js.map +1 -0
  45. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts +83 -0
  46. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -0
  47. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +386 -0
  48. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -0
  49. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts +8 -6
  50. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts.map +1 -1
  51. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js +78 -117
  52. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js.map +1 -1
  53. package/dist/src/cli/commands/import-docs.js +4 -4
  54. package/dist/src/cli/commands/import-docs.js.map +1 -1
  55. package/dist/src/cli/commands/init-multiproject.d.ts.map +1 -1
  56. package/dist/src/cli/commands/init-multiproject.js +17 -18
  57. package/dist/src/cli/commands/init-multiproject.js.map +1 -1
  58. package/dist/src/cli/commands/migrate-to-multiproject.d.ts.map +1 -1
  59. package/dist/src/cli/commands/migrate-to-multiproject.js +8 -4
  60. package/dist/src/cli/commands/migrate-to-multiproject.js.map +1 -1
  61. package/dist/src/cli/commands/switch-project.d.ts.map +1 -1
  62. package/dist/src/cli/commands/switch-project.js +9 -26
  63. package/dist/src/cli/commands/switch-project.js.map +1 -1
  64. package/dist/src/cli/commands/sync-spec-content.js +3 -0
  65. package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
  66. package/dist/src/core/deduplication/command-deduplicator.d.ts +166 -0
  67. package/dist/src/core/deduplication/command-deduplicator.d.ts.map +1 -0
  68. package/dist/src/core/deduplication/command-deduplicator.js +254 -0
  69. package/dist/src/core/deduplication/command-deduplicator.js.map +1 -0
  70. package/dist/src/core/increment/active-increment-manager.d.ts +42 -15
  71. package/dist/src/core/increment/active-increment-manager.d.ts.map +1 -1
  72. package/dist/src/core/increment/active-increment-manager.js +113 -46
  73. package/dist/src/core/increment/active-increment-manager.js.map +1 -1
  74. package/dist/src/core/increment/conflict-resolver.d.ts +40 -0
  75. package/dist/src/core/increment/conflict-resolver.d.ts.map +1 -0
  76. package/dist/src/core/increment/conflict-resolver.js +219 -0
  77. package/dist/src/core/increment/conflict-resolver.js.map +1 -0
  78. package/dist/src/core/increment/discipline-checker.d.ts.map +1 -1
  79. package/dist/src/core/increment/discipline-checker.js +7 -1
  80. package/dist/src/core/increment/discipline-checker.js.map +1 -1
  81. package/dist/src/core/increment/duplicate-detector.d.ts +52 -0
  82. package/dist/src/core/increment/duplicate-detector.d.ts.map +1 -0
  83. package/dist/src/core/increment/duplicate-detector.js +276 -0
  84. package/dist/src/core/increment/duplicate-detector.js.map +1 -0
  85. package/dist/src/core/increment/increment-archiver.d.ts +90 -0
  86. package/dist/src/core/increment/increment-archiver.d.ts.map +1 -0
  87. package/dist/src/core/increment/increment-archiver.js +368 -0
  88. package/dist/src/core/increment/increment-archiver.js.map +1 -0
  89. package/dist/src/core/increment/increment-reopener.d.ts +165 -0
  90. package/dist/src/core/increment/increment-reopener.d.ts.map +1 -0
  91. package/dist/src/core/increment/increment-reopener.js +390 -0
  92. package/dist/src/core/increment/increment-reopener.js.map +1 -0
  93. package/dist/src/core/increment/metadata-manager.d.ts +26 -1
  94. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  95. package/dist/src/core/increment/metadata-manager.js +143 -5
  96. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  97. package/dist/src/core/increment/recent-work-scanner.d.ts +121 -0
  98. package/dist/src/core/increment/recent-work-scanner.d.ts.map +1 -0
  99. package/dist/src/core/increment/recent-work-scanner.js +303 -0
  100. package/dist/src/core/increment/recent-work-scanner.js.map +1 -0
  101. package/dist/src/core/increment/types.d.ts +1 -0
  102. package/dist/src/core/increment/types.d.ts.map +1 -1
  103. package/dist/src/core/increment-utils.d.ts +112 -0
  104. package/dist/src/core/increment-utils.d.ts.map +1 -0
  105. package/dist/src/core/increment-utils.js +210 -0
  106. package/dist/src/core/increment-utils.js.map +1 -0
  107. package/dist/src/core/living-docs/ac-project-specific-generator.d.ts +65 -0
  108. package/dist/src/core/living-docs/ac-project-specific-generator.d.ts.map +1 -0
  109. package/dist/src/core/living-docs/ac-project-specific-generator.js +175 -0
  110. package/dist/src/core/living-docs/ac-project-specific-generator.js.map +1 -0
  111. package/dist/src/core/living-docs/feature-archiver.d.ts +130 -0
  112. package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -0
  113. package/dist/src/core/living-docs/feature-archiver.js +549 -0
  114. package/dist/src/core/living-docs/feature-archiver.js.map +1 -0
  115. package/dist/src/core/living-docs/feature-id-manager.d.ts +81 -0
  116. package/dist/src/core/living-docs/feature-id-manager.d.ts.map +1 -0
  117. package/dist/src/core/living-docs/feature-id-manager.js +339 -0
  118. package/dist/src/core/living-docs/feature-id-manager.js.map +1 -0
  119. package/dist/src/core/living-docs/hierarchy-mapper.d.ts +144 -83
  120. package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -1
  121. package/dist/src/core/living-docs/hierarchy-mapper.js +488 -270
  122. package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
  123. package/dist/src/core/living-docs/index.d.ts +6 -0
  124. package/dist/src/core/living-docs/index.d.ts.map +1 -1
  125. package/dist/src/core/living-docs/index.js +6 -0
  126. package/dist/src/core/living-docs/index.js.map +1 -1
  127. package/dist/src/core/living-docs/project-detector.d.ts +6 -0
  128. package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
  129. package/dist/src/core/living-docs/project-detector.js +35 -1
  130. package/dist/src/core/living-docs/project-detector.js.map +1 -1
  131. package/dist/src/core/living-docs/spec-distributor.d.ts +100 -26
  132. package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -1
  133. package/dist/src/core/living-docs/spec-distributor.js +1275 -258
  134. package/dist/src/core/living-docs/spec-distributor.js.map +1 -1
  135. package/dist/src/core/living-docs/task-project-specific-generator.d.ts +109 -0
  136. package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -0
  137. package/dist/src/core/living-docs/task-project-specific-generator.js +221 -0
  138. package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -0
  139. package/dist/src/core/living-docs/types.d.ts +143 -0
  140. package/dist/src/core/living-docs/types.d.ts.map +1 -1
  141. package/dist/src/core/project-manager.d.ts +2 -17
  142. package/dist/src/core/project-manager.d.ts.map +1 -1
  143. package/dist/src/core/project-manager.js +68 -48
  144. package/dist/src/core/project-manager.js.map +1 -1
  145. package/dist/src/core/spec-content-sync.d.ts +1 -1
  146. package/dist/src/core/spec-content-sync.d.ts.map +1 -1
  147. package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -1
  148. package/dist/src/core/sync/enhanced-content-builder.js +2 -1
  149. package/dist/src/core/sync/enhanced-content-builder.js.map +1 -1
  150. package/dist/src/core/sync/performance-optimizer.d.ts +153 -0
  151. package/dist/src/core/sync/performance-optimizer.d.ts.map +1 -0
  152. package/dist/src/core/sync/performance-optimizer.js +220 -0
  153. package/dist/src/core/sync/performance-optimizer.js.map +1 -0
  154. package/dist/src/core/sync/retry-handler.d.ts +98 -0
  155. package/dist/src/core/sync/retry-handler.d.ts.map +1 -0
  156. package/dist/src/core/sync/retry-handler.js +196 -0
  157. package/dist/src/core/sync/retry-handler.js.map +1 -0
  158. package/dist/src/core/types/config.d.ts +94 -0
  159. package/dist/src/core/types/config.d.ts.map +1 -1
  160. package/dist/src/core/types/config.js +16 -0
  161. package/dist/src/core/types/config.js.map +1 -1
  162. package/dist/src/core/types/increment-metadata.d.ts +6 -0
  163. package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
  164. package/dist/src/core/types/increment-metadata.js +10 -1
  165. package/dist/src/core/types/increment-metadata.js.map +1 -1
  166. package/dist/src/integrations/jira/jira-incremental-mapper.d.ts.map +1 -1
  167. package/dist/src/integrations/jira/jira-incremental-mapper.js +4 -8
  168. package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
  169. package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
  170. package/dist/src/integrations/jira/jira-mapper.js +4 -8
  171. package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
  172. package/package.json +1 -1
  173. package/plugins/specweave/COMMANDS.md +13 -4
  174. package/plugins/specweave/commands/specweave-abandon.md +22 -20
  175. package/plugins/specweave/commands/specweave-archive-features.md +121 -0
  176. package/plugins/specweave/commands/specweave-archive-increments.md +82 -0
  177. package/plugins/specweave/commands/specweave-archive.md +363 -0
  178. package/plugins/specweave/commands/specweave-backlog.md +211 -0
  179. package/plugins/specweave/commands/specweave-fix-duplicates.md +517 -0
  180. package/plugins/specweave/commands/specweave-increment.md +4 -3
  181. package/plugins/specweave/commands/specweave-progress.md +176 -27
  182. package/plugins/specweave/commands/specweave-reopen.md +391 -0
  183. package/plugins/specweave/commands/specweave-restore-feature.md +90 -0
  184. package/plugins/specweave/commands/specweave-restore.md +309 -0
  185. package/plugins/specweave/commands/specweave-resume.md +51 -23
  186. package/plugins/specweave/commands/specweave-status.md +41 -7
  187. package/plugins/specweave/commands/specweave-sync-specs.md +425 -0
  188. package/plugins/specweave/hooks/hooks.json +4 -0
  189. package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
  190. package/plugins/specweave/hooks/post-task-completion.sh +39 -0
  191. package/plugins/specweave/hooks/pre-command-deduplication.sh +83 -0
  192. package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
  193. package/plugins/specweave/lib/hooks/sync-living-docs.js +2 -0
  194. package/plugins/specweave/lib/hooks/sync-living-docs.ts +4 -0
  195. package/plugins/specweave/lib/hooks/update-ac-status.js +102 -0
  196. package/plugins/specweave/lib/hooks/update-ac-status.ts +192 -0
  197. package/plugins/specweave/skills/archive-increments/SKILL.md +198 -0
  198. package/plugins/specweave/skills/increment-planner/scripts/feature-utils.js +14 -0
  199. package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +244 -0
  200. package/plugins/specweave-ado/lib/ado-spec-content-sync.js +49 -5
  201. package/plugins/specweave-ado/lib/ado-spec-content-sync.ts +72 -6
  202. package/plugins/specweave-confluent/.claude-plugin/plugin.json +23 -0
  203. package/plugins/specweave-confluent/README.md +375 -0
  204. package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +306 -0
  205. package/plugins/specweave-confluent/skills/confluent-kafka-connect/SKILL.md +453 -0
  206. package/plugins/specweave-confluent/skills/confluent-ksqldb/SKILL.md +470 -0
  207. package/plugins/specweave-confluent/skills/confluent-schema-registry/SKILL.md +316 -0
  208. package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +2 -2
  209. package/plugins/specweave-github/agents/user-story-updater/AGENT.md +148 -0
  210. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +1 -1
  211. package/plugins/specweave-github/commands/specweave-github-update-user-story.md +156 -0
  212. package/plugins/specweave-github/hooks/post-task-completion.sh +10 -9
  213. package/plugins/specweave-github/lib/completion-calculator.js +262 -0
  214. package/plugins/specweave-github/lib/completion-calculator.ts +434 -0
  215. package/plugins/specweave-github/lib/duplicate-detector.js +3 -3
  216. package/plugins/specweave-github/lib/duplicate-detector.ts +4 -4
  217. package/plugins/specweave-github/lib/epic-content-builder.js +38 -0
  218. package/plugins/specweave-github/lib/epic-content-builder.ts +59 -0
  219. package/plugins/specweave-github/lib/github-client-v2.js +49 -0
  220. package/plugins/specweave-github/lib/github-client-v2.ts +59 -0
  221. package/plugins/specweave-github/lib/github-epic-sync.ts +1 -1
  222. package/plugins/specweave-github/lib/github-feature-sync.js +381 -0
  223. package/plugins/specweave-github/lib/github-feature-sync.ts +568 -0
  224. package/plugins/specweave-github/lib/github-spec-content-sync.js +40 -10
  225. package/plugins/specweave-github/lib/github-spec-content-sync.ts +82 -14
  226. package/plugins/specweave-github/lib/progress-comment-builder.js +229 -0
  227. package/plugins/specweave-github/lib/progress-comment-builder.ts +324 -0
  228. package/plugins/specweave-github/lib/user-story-content-builder.js +299 -0
  229. package/plugins/specweave-github/lib/user-story-content-builder.ts +413 -0
  230. package/plugins/specweave-github/lib/user-story-issue-builder.js +344 -0
  231. package/plugins/specweave-github/lib/user-story-issue-builder.ts +543 -0
  232. package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +189 -0
  233. package/plugins/{specweave-ado/lib/enhanced-ado-sync.js → specweave-jira/lib/enhanced-jira-sync.js} +25 -61
  234. package/plugins/specweave-jira/lib/{enhanced-jira-sync.ts.disabled → enhanced-jira-sync.ts} +26 -52
  235. package/plugins/specweave-kafka/.claude-plugin/plugin.json +26 -0
  236. package/plugins/specweave-kafka/IMPLEMENTATION-COMPLETE.md +483 -0
  237. package/plugins/specweave-kafka/README.md +242 -0
  238. package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +235 -0
  239. package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +209 -0
  240. package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +266 -0
  241. package/plugins/specweave-kafka/commands/deploy.md +99 -0
  242. package/plugins/specweave-kafka/commands/dev-env.md +176 -0
  243. package/plugins/specweave-kafka/commands/mcp-configure.md +101 -0
  244. package/plugins/specweave-kafka/commands/monitor-setup.md +96 -0
  245. package/plugins/specweave-kafka/docker/kafka-local/docker-compose.yml +187 -0
  246. package/plugins/specweave-kafka/docker/redpanda/docker-compose.yml +199 -0
  247. package/plugins/specweave-kafka/docker/templates/consumer-nodejs.js +225 -0
  248. package/plugins/specweave-kafka/docker/templates/consumer-python.py +220 -0
  249. package/plugins/specweave-kafka/docker/templates/producer-nodejs.js +168 -0
  250. package/plugins/specweave-kafka/docker/templates/producer-python.py +167 -0
  251. package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.js +438 -0
  252. package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.ts +541 -0
  253. package/plugins/specweave-kafka/lib/adapters/platform-adapter.js +47 -0
  254. package/plugins/specweave-kafka/lib/adapters/platform-adapter.ts +343 -0
  255. package/plugins/specweave-kafka/lib/cli/kcat-wrapper.js +258 -0
  256. package/plugins/specweave-kafka/lib/cli/kcat-wrapper.ts +298 -0
  257. package/plugins/specweave-kafka/lib/cli/types.js +10 -0
  258. package/plugins/specweave-kafka/lib/cli/types.ts +92 -0
  259. package/plugins/specweave-kafka/lib/connectors/connector-catalog.js +305 -0
  260. package/plugins/specweave-kafka/lib/connectors/connector-catalog.ts +528 -0
  261. package/plugins/specweave-kafka/lib/documentation/diagram-generator.js +114 -0
  262. package/plugins/specweave-kafka/lib/documentation/diagram-generator.ts +195 -0
  263. package/plugins/specweave-kafka/lib/documentation/exporter.js +210 -0
  264. package/plugins/specweave-kafka/lib/documentation/exporter.ts +338 -0
  265. package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.js +60 -0
  266. package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.ts +130 -0
  267. package/plugins/specweave-kafka/lib/documentation/topology-generator.js +143 -0
  268. package/plugins/specweave-kafka/lib/documentation/topology-generator.ts +290 -0
  269. package/plugins/specweave-kafka/lib/mcp/detector.js +298 -0
  270. package/plugins/specweave-kafka/lib/mcp/detector.ts +352 -0
  271. package/plugins/specweave-kafka/lib/mcp/types.js +21 -0
  272. package/plugins/specweave-kafka/lib/mcp/types.ts +77 -0
  273. package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.js +193 -0
  274. package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.ts +362 -0
  275. package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.js +188 -0
  276. package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.ts +359 -0
  277. package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.js +195 -0
  278. package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.ts +380 -0
  279. package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.js +209 -0
  280. package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.ts +358 -0
  281. package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.js +354 -0
  282. package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.ts +563 -0
  283. package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.js +259 -0
  284. package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.ts +516 -0
  285. package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.js +233 -0
  286. package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.ts +423 -0
  287. package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.js +266 -0
  288. package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.ts +445 -0
  289. package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.js +312 -0
  290. package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.ts +561 -0
  291. package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.js +289 -0
  292. package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.ts +607 -0
  293. package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.js +264 -0
  294. package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.ts +498 -0
  295. package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.js +263 -0
  296. package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.ts +549 -0
  297. package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.js +205 -0
  298. package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.ts +399 -0
  299. package/plugins/specweave-kafka/lib/performance/performance-optimizer.js +249 -0
  300. package/plugins/specweave-kafka/lib/performance/performance-optimizer.ts +427 -0
  301. package/plugins/specweave-kafka/lib/security/kafka-security.js +252 -0
  302. package/plugins/specweave-kafka/lib/security/kafka-security.ts +494 -0
  303. package/plugins/specweave-kafka/lib/utils/capacity-planner.js +203 -0
  304. package/plugins/specweave-kafka/lib/utils/capacity-planner.ts +469 -0
  305. package/plugins/specweave-kafka/lib/utils/config-validator.js +419 -0
  306. package/plugins/specweave-kafka/lib/utils/config-validator.ts +564 -0
  307. package/plugins/specweave-kafka/lib/utils/partitioning.js +329 -0
  308. package/plugins/specweave-kafka/lib/utils/partitioning.ts +473 -0
  309. package/plugins/specweave-kafka/lib/utils/sizing.js +221 -0
  310. package/plugins/specweave-kafka/lib/utils/sizing.ts +374 -0
  311. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-broker-metrics.json +628 -0
  312. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-cluster-overview.json +564 -0
  313. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-consumer-lag.json +509 -0
  314. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-jvm-metrics.json +674 -0
  315. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-topic-metrics.json +578 -0
  316. package/plugins/specweave-kafka/monitoring/grafana/provisioning/dashboards/kafka.yml +17 -0
  317. package/plugins/specweave-kafka/monitoring/grafana/provisioning/datasources/prometheus.yml +17 -0
  318. package/plugins/specweave-kafka/monitoring/prometheus/kafka-alerts.yml +415 -0
  319. package/plugins/specweave-kafka/monitoring/prometheus/kafka-jmx-exporter.yml +256 -0
  320. package/plugins/specweave-kafka/package.json +41 -0
  321. package/plugins/specweave-kafka/skills/kafka-architecture/SKILL.md +647 -0
  322. package/plugins/specweave-kafka/skills/kafka-cli-tools/SKILL.md +433 -0
  323. package/plugins/specweave-kafka/skills/kafka-iac-deployment/SKILL.md +449 -0
  324. package/plugins/specweave-kafka/skills/kafka-kubernetes/SKILL.md +667 -0
  325. package/plugins/specweave-kafka/skills/kafka-mcp-integration/SKILL.md +273 -0
  326. package/plugins/specweave-kafka/skills/kafka-observability/SKILL.md +576 -0
  327. package/plugins/specweave-kafka/templates/config/broker-production.properties +254 -0
  328. package/plugins/specweave-kafka/templates/config/consumer-low-latency.properties +112 -0
  329. package/plugins/specweave-kafka/templates/config/producer-high-throughput.properties +120 -0
  330. package/plugins/specweave-kafka/templates/migration/mirrormaker2-config.properties +234 -0
  331. package/plugins/specweave-kafka/templates/monitoring/grafana/multi-cluster-dashboard.json +686 -0
  332. package/plugins/specweave-kafka/terraform/apache-kafka/main.tf +347 -0
  333. package/plugins/specweave-kafka/terraform/apache-kafka/outputs.tf +107 -0
  334. package/plugins/specweave-kafka/terraform/apache-kafka/templates/kafka-broker-init.sh.tpl +216 -0
  335. package/plugins/specweave-kafka/terraform/apache-kafka/variables.tf +156 -0
  336. package/plugins/specweave-kafka/terraform/aws-msk/main.tf +362 -0
  337. package/plugins/specweave-kafka/terraform/aws-msk/outputs.tf +93 -0
  338. package/plugins/specweave-kafka/terraform/aws-msk/templates/server.properties.tpl +32 -0
  339. package/plugins/specweave-kafka/terraform/aws-msk/variables.tf +235 -0
  340. package/plugins/specweave-kafka/terraform/azure-event-hubs/main.tf +281 -0
  341. package/plugins/specweave-kafka/terraform/azure-event-hubs/outputs.tf +118 -0
  342. package/plugins/specweave-kafka/terraform/azure-event-hubs/variables.tf +148 -0
  343. package/plugins/specweave-kafka/tsconfig.json +21 -0
  344. package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +23 -0
  345. package/plugins/specweave-kafka-streams/README.md +310 -0
  346. package/plugins/specweave-kafka-streams/skills/kafka-streams-topology/SKILL.md +539 -0
  347. package/plugins/specweave-n8n/.claude-plugin/plugin.json +22 -0
  348. package/plugins/specweave-n8n/README.md +354 -0
  349. package/plugins/specweave-n8n/skills/n8n-kafka-workflows/SKILL.md +504 -0
  350. package/plugins/specweave-release/commands/specweave-release-platform.md +1 -1
  351. package/plugins/specweave-release/hooks/post-task-completion.sh +2 -2
  352. package/src/templates/AGENTS.md.template +601 -7
  353. package/src/templates/CLAUDE.md.template +188 -88
  354. package/dist/locales/de/.gitkeep +0 -0
  355. package/dist/locales/de/cli.json +0 -108
  356. package/dist/locales/en/cli.json +0 -287
  357. package/dist/locales/en/errors.json +0 -7
  358. package/dist/locales/en/templates.json +0 -6
  359. package/dist/locales/es/.gitkeep +0 -0
  360. package/dist/locales/es/cli.json +0 -41
  361. package/dist/locales/fr/.gitkeep +0 -0
  362. package/dist/locales/fr/cli.json +0 -108
  363. package/dist/locales/ja/.gitkeep +0 -0
  364. package/dist/locales/ja/cli.json +0 -108
  365. package/dist/locales/ko/.gitkeep +0 -0
  366. package/dist/locales/ko/cli.json +0 -108
  367. package/dist/locales/pt/.gitkeep +0 -0
  368. package/dist/locales/pt/cli.json +0 -108
  369. package/dist/locales/ru/.gitkeep +0 -0
  370. package/dist/locales/ru/cli.json +0 -269
  371. package/dist/locales/zh/.gitkeep +0 -0
  372. package/dist/locales/zh/cli.json +0 -108
  373. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts +0 -25
  374. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts.map +0 -1
  375. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -191
  376. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js.map +0 -1
  377. package/dist/spec-parser.js +0 -629
  378. package/dist/src/core/sync/spec-content-sync.d.ts +0 -88
  379. package/dist/src/core/sync/spec-content-sync.d.ts.map +0 -1
  380. package/dist/src/core/sync/spec-content-sync.js +0 -5
  381. package/dist/src/core/sync/spec-content-sync.js.map +0 -1
  382. package/dist/tsconfig.tsbuildinfo +0 -1
  383. package/plugins/specweave-ado/commands/specweave-ado-sync-spec.md +0 -255
  384. package/plugins/specweave-github/commands/specweave-github-sync-epic.md +0 -248
  385. package/plugins/specweave-github/commands/specweave-github-sync-from.md +0 -147
  386. package/plugins/specweave-github/commands/specweave-github-sync-spec.md +0 -208
  387. package/plugins/specweave-github/commands/specweave-github-sync-tasks.md +0 -530
  388. package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +0 -267
  389. package/plugins/specweave-jira/commands/specweave-jira-sync-spec.md +0 -240
@@ -0,0 +1,339 @@
1
+ /**
2
+ * Feature ID Manager - Manages FS-XXX ID assignment based on creation date
3
+ * Ensures no duplicate IDs and maintains consistent ordering
4
+ */
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+ import yaml from 'yaml';
8
+ export class FeatureIDManager {
9
+ constructor(projectRoot) {
10
+ this.specsBaseDir = path.join(projectRoot, '.specweave/docs/internal/specs');
11
+ this.incrementsDir = path.join(projectRoot, '.specweave/increments');
12
+ this.registry = {
13
+ features: new Map(),
14
+ nextId: 1
15
+ };
16
+ }
17
+ /**
18
+ * Build registry by scanning all increments and existing features
19
+ */
20
+ async buildRegistry() {
21
+ console.log('🔍 Building feature registry...');
22
+ // Step 1: Scan all increments to find features
23
+ const incrementFeatures = await this.scanIncrements();
24
+ // Step 2: Scan existing _features folder (if any)
25
+ const existingFeatures = await this.scanExistingFeatures();
26
+ // Step 3: Merge and sort by creation date
27
+ const allFeatures = this.mergeFeatures(incrementFeatures, existingFeatures);
28
+ // Step 4: Assign FS-XXX IDs based on creation date order
29
+ this.assignFeatureIds(allFeatures);
30
+ console.log(`✅ Registry built with ${this.registry.features.size} features`);
31
+ }
32
+ /**
33
+ * Scan all increments to extract feature information
34
+ */
35
+ async scanIncrements() {
36
+ const features = [];
37
+ if (!await fs.pathExists(this.incrementsDir)) {
38
+ return features;
39
+ }
40
+ const increments = await fs.readdir(this.incrementsDir);
41
+ for (const incrementId of increments) {
42
+ if (!incrementId.match(/^\d{4}-/))
43
+ continue;
44
+ const specPath = path.join(this.incrementsDir, incrementId, 'spec.md');
45
+ const metadataPath = path.join(this.incrementsDir, incrementId, 'metadata.json');
46
+ if (!await fs.pathExists(specPath))
47
+ continue;
48
+ try {
49
+ const specContent = await fs.readFile(specPath, 'utf-8');
50
+ const frontmatter = this.extractFrontmatter(specContent);
51
+ // Get creation date from metadata or frontmatter
52
+ let created = new Date();
53
+ if (await fs.pathExists(metadataPath)) {
54
+ const metadata = await fs.readJson(metadataPath);
55
+ created = new Date(metadata.created || created);
56
+ }
57
+ else if (frontmatter.created) {
58
+ created = new Date(frontmatter.created);
59
+ }
60
+ else {
61
+ // Fallback: use file modification time
62
+ const stats = await fs.stat(specPath);
63
+ created = stats.birthtime || stats.mtime;
64
+ }
65
+ // Extract feature ID - CRITICAL LOGIC for greenfield vs brownfield
66
+ const match = incrementId.match(/^(\d{4})-(.+)$/);
67
+ let featureId = '';
68
+ if (match) {
69
+ const num = parseInt(match[1], 10);
70
+ // Check if brownfield (imported from external tool)
71
+ const isBrownfield = frontmatter.source === 'external' ||
72
+ frontmatter.imported === true;
73
+ if (isBrownfield) {
74
+ // Brownfield: Honor explicit feature ID from frontmatter
75
+ featureId = frontmatter.feature || frontmatter.epic || '';
76
+ // If still no feature ID, generate date-based one
77
+ if (!featureId) {
78
+ const yy = String(created.getFullYear()).slice(-2);
79
+ const mm = String(created.getMonth() + 1).padStart(2, '0');
80
+ const dd = String(created.getDate()).padStart(2, '0');
81
+ featureId = `FS-${yy}-${mm}-${dd}-${match[2]}`;
82
+ }
83
+ }
84
+ else {
85
+ // Greenfield: ALWAYS use increment number (ignore frontmatter)
86
+ // This ensures 0031 → FS-031 even if frontmatter says FS-25-11-12
87
+ featureId = `FS-${String(num).padStart(3, '0')}`;
88
+ }
89
+ }
90
+ if (featureId && !featureId.startsWith('EPIC')) {
91
+ // Normalize feature ID format
92
+ const normalizedId = this.normalizeFeatureId(featureId);
93
+ features.push({
94
+ originalId: normalizedId,
95
+ assignedId: '', // Will be assigned later
96
+ title: frontmatter.title || incrementId,
97
+ created,
98
+ incrementId,
99
+ projects: frontmatter.projects || ['default']
100
+ });
101
+ }
102
+ }
103
+ catch (error) {
104
+ console.warn(` ⚠️ Error processing ${incrementId}: ${error}`);
105
+ }
106
+ }
107
+ return features;
108
+ }
109
+ /**
110
+ * Scan existing _features folder
111
+ */
112
+ async scanExistingFeatures() {
113
+ const features = [];
114
+ const featuresDir = path.join(this.specsBaseDir, '_features');
115
+ if (!await fs.pathExists(featuresDir)) {
116
+ return features;
117
+ }
118
+ const folders = await fs.readdir(featuresDir);
119
+ for (const folder of folders) {
120
+ const featurePath = path.join(featuresDir, folder, 'FEATURE.md');
121
+ if (!await fs.pathExists(featurePath))
122
+ continue;
123
+ try {
124
+ const content = await fs.readFile(featurePath, 'utf-8');
125
+ const frontmatter = this.extractFrontmatter(content);
126
+ const created = frontmatter.created
127
+ ? new Date(frontmatter.created)
128
+ : new Date();
129
+ features.push({
130
+ originalId: folder,
131
+ assignedId: '', // Will be assigned later
132
+ title: frontmatter.title || folder,
133
+ created,
134
+ projects: frontmatter.projects || ['default']
135
+ });
136
+ }
137
+ catch (error) {
138
+ console.warn(` ⚠️ Error processing feature ${folder}: ${error}`);
139
+ }
140
+ }
141
+ return features;
142
+ }
143
+ /**
144
+ * Merge features and remove duplicates
145
+ */
146
+ mergeFeatures(incrementFeatures, existingFeatures) {
147
+ const merged = new Map();
148
+ // Add increment features first (they have more complete info)
149
+ for (const feature of incrementFeatures) {
150
+ const key = this.getFeatureKey(feature.originalId);
151
+ if (!merged.has(key)) {
152
+ merged.set(key, feature);
153
+ }
154
+ }
155
+ // Add existing features if not already present
156
+ for (const feature of existingFeatures) {
157
+ const key = this.getFeatureKey(feature.originalId);
158
+ if (!merged.has(key)) {
159
+ merged.set(key, feature);
160
+ }
161
+ }
162
+ // Sort by creation date
163
+ return Array.from(merged.values()).sort((a, b) => a.created.getTime() - b.created.getTime());
164
+ }
165
+ /**
166
+ * Assign FS-XXX IDs based on strategy
167
+ *
168
+ * CRITICAL: For greenfield (FS-XXX), assigned ID = original ID
169
+ * For brownfield (FS-YY-MM-DD-name), assigned ID = sequential
170
+ */
171
+ assignFeatureIds(features) {
172
+ let nextId = 1;
173
+ for (const feature of features) {
174
+ // Check if this is a greenfield feature (FS-XXX format)
175
+ const isGreenfield = /^FS-\d{3}$/.test(feature.originalId);
176
+ if (isGreenfield) {
177
+ // Greenfield: Use the increment number as-is
178
+ feature.assignedId = feature.originalId; // FS-030 stays FS-030
179
+ }
180
+ else {
181
+ // Brownfield: Assign sequential ID
182
+ feature.assignedId = `FS-${String(nextId).padStart(3, '0')}`;
183
+ nextId++;
184
+ }
185
+ this.registry.features.set(feature.originalId, feature);
186
+ }
187
+ this.registry.nextId = nextId;
188
+ }
189
+ /**
190
+ * Get assigned ID for a feature
191
+ */
192
+ getAssignedId(originalId) {
193
+ const normalized = this.normalizeFeatureId(originalId);
194
+ const feature = this.registry.features.get(normalized);
195
+ if (feature) {
196
+ return feature.assignedId;
197
+ }
198
+ // Feature not in registry - assign new ID
199
+ console.log(` 📝 Assigning new ID for feature: ${originalId}`);
200
+ const assignedId = `FS-${String(this.registry.nextId).padStart(3, '0')}`;
201
+ this.registry.features.set(normalized, {
202
+ originalId: normalized,
203
+ assignedId,
204
+ title: originalId,
205
+ created: new Date(),
206
+ projects: ['default']
207
+ });
208
+ this.registry.nextId++;
209
+ return assignedId;
210
+ }
211
+ /**
212
+ * Check if a feature ID already exists
213
+ */
214
+ hasFeature(originalId) {
215
+ const normalized = this.normalizeFeatureId(originalId);
216
+ return this.registry.features.has(normalized);
217
+ }
218
+ /**
219
+ * Get all registered features
220
+ */
221
+ getAllFeatures() {
222
+ return Array.from(this.registry.features.values());
223
+ }
224
+ /**
225
+ * Normalize feature ID to consistent format
226
+ *
227
+ * CRITICAL: For greenfield, we use FS-XXX (sequential numbers)
228
+ * For brownfield, we use FS-YY-MM-DD-name (date-based)
229
+ */
230
+ normalizeFeatureId(id) {
231
+ // Remove any leading/trailing whitespace
232
+ id = id.trim();
233
+ // KEEP numeric IDs as-is for greenfield (FS-001, FS-030, FS-031, etc.)
234
+ // These come directly from increment numbers and should NOT be converted
235
+ const simpleNumMatch = id.match(/^FS-(\d{3})$/);
236
+ if (simpleNumMatch) {
237
+ return id; // Return as-is: FS-030, FS-031, etc.
238
+ }
239
+ // If it's already in date format (FS-YY-MM-DD-*), keep as-is
240
+ const dateMatch = id.match(/^FS-\d{2}-\d{2}-\d{2}-.+$/);
241
+ if (dateMatch) {
242
+ return id;
243
+ }
244
+ // Legacy: If it has a suffix (FS-031-feature-name), it's date-based
245
+ // This handles old IDs that need migration
246
+ const numMatchWithSuffix = id.match(/^FS-(\d+)-.+$/);
247
+ if (numMatchWithSuffix) {
248
+ // This is likely a date-based ID, keep as-is
249
+ return id;
250
+ }
251
+ return id;
252
+ }
253
+ /**
254
+ * Get a consistent key for feature deduplication
255
+ */
256
+ getFeatureKey(id) {
257
+ // Extract the core part of the ID for comparison
258
+ // FS-25-11-12-external-tool-sync -> external-tool-sync
259
+ const parts = id.split('-');
260
+ if (parts[0] === 'FS' && parts.length > 4) {
261
+ return parts.slice(4).join('-');
262
+ }
263
+ return id;
264
+ }
265
+ /**
266
+ * Extract frontmatter from markdown content
267
+ */
268
+ extractFrontmatter(content) {
269
+ const lines = content.split('\n');
270
+ if (lines[0] !== '---')
271
+ return {};
272
+ let endIndex = -1;
273
+ for (let i = 1; i < lines.length; i++) {
274
+ if (lines[i] === '---') {
275
+ endIndex = i;
276
+ break;
277
+ }
278
+ }
279
+ if (endIndex === -1)
280
+ return {};
281
+ try {
282
+ const yamlContent = lines.slice(1, endIndex).join('\n');
283
+ return yaml.parse(yamlContent) || {};
284
+ }
285
+ catch {
286
+ return {};
287
+ }
288
+ }
289
+ /**
290
+ * Save registry to disk for persistence
291
+ */
292
+ async saveRegistry() {
293
+ const registryPath = path.join(this.specsBaseDir, '.feature-registry.json');
294
+ const data = {
295
+ version: '1.0',
296
+ lastUpdated: new Date().toISOString(),
297
+ nextId: this.registry.nextId,
298
+ features: Array.from(this.registry.features.entries()).map(([key, value]) => ({
299
+ key,
300
+ ...value,
301
+ created: value.created.toISOString()
302
+ }))
303
+ };
304
+ await fs.ensureDir(path.dirname(registryPath));
305
+ await fs.writeJson(registryPath, data, { spaces: 2 });
306
+ console.log(` 💾 Registry saved to ${registryPath}`);
307
+ }
308
+ /**
309
+ * Load registry from disk
310
+ */
311
+ async loadRegistry() {
312
+ const registryPath = path.join(this.specsBaseDir, '.feature-registry.json');
313
+ if (!await fs.pathExists(registryPath)) {
314
+ await this.buildRegistry();
315
+ return;
316
+ }
317
+ try {
318
+ const data = await fs.readJson(registryPath);
319
+ this.registry.nextId = data.nextId || 1;
320
+ this.registry.features.clear();
321
+ for (const feature of data.features || []) {
322
+ this.registry.features.set(feature.key || feature.originalId, {
323
+ originalId: feature.originalId,
324
+ assignedId: feature.assignedId,
325
+ title: feature.title,
326
+ created: new Date(feature.created),
327
+ incrementId: feature.incrementId,
328
+ projects: feature.projects
329
+ });
330
+ }
331
+ console.log(` 📂 Registry loaded with ${this.registry.features.size} features`);
332
+ }
333
+ catch (error) {
334
+ console.warn(' ⚠️ Failed to load registry, rebuilding...');
335
+ await this.buildRegistry();
336
+ }
337
+ }
338
+ }
339
+ //# sourceMappingURL=feature-id-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-id-manager.js","sourceRoot":"","sources":["../../../../src/core/living-docs/feature-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)
3
3
  *
4
- * Maps increments to Feature Spec (FS-*) folders following Universal Hierarchy architecture.
4
+ * Maps increments to universal hierarchy following work item type matrix:
5
+ * - Epic (EPIC-{id}) -> Cross-project strategic themes (_epics/)
6
+ * - Feature (FS-XXX) -> Cross-project features (_features/ + project folders)
7
+ * - User Story (us-{id}) -> Project-specific requirements (project/FS-XXX/us-{id}.md)
8
+ * - Task (T-{id}) -> Increment-specific implementation (increments/{id}/tasks.md)
5
9
  *
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
+ * Key Principles:
11
+ * - NO HARDCODED PROJECT NAMES (backend, frontend are examples)
12
+ * - Projects are DYNAMIC from config.json -> multiProject.projects
13
+ * - Single-project mode: ['default'] (always)
14
+ * - Multi-project mode: User-configured project names
15
+ * - Feature IDs assigned by creation date (FS-001, FS-002, etc.)
16
+ * - NO DUPLICATE FEATURE IDS (enforced by FeatureIDManager)
10
17
  *
11
18
  * @author SpecWeave Team
12
- * @version 3.0.0
19
+ * @version 4.0.0 (Universal Hierarchy with FS-XXX)
20
+ */
21
+ import { SpecweaveConfig } from '../types/config.js';
22
+ import { EpicMapping, FeatureMapping, ProjectContext } from './types.js';
23
+ /**
24
+ * Hierarchy Configuration
13
25
  */
14
26
  export interface HierarchyConfig {
15
27
  level: 'simple' | 'standard' | 'enterprise' | 'auto';
16
28
  specsBaseDir: string;
17
- projectId: string;
18
- featureFolderPattern: '{name}';
19
- userStoriesSubdir: string;
29
+ detectEpicFrom: ('frontmatter' | 'config')[];
20
30
  detectFeatureFrom: ('frontmatter' | 'increment-name' | 'config')[];
21
- fallbackFeature?: string;
22
- }
23
- export interface FeatureMapping {
24
- featureId: string;
25
- featureFolder: string;
26
- featurePath: string;
27
- userStoriesPath: string;
28
- confidence: number;
29
- detectionMethod: 'frontmatter' | 'increment-name' | 'config' | 'fallback';
31
+ detectProjectFrom: ('frontmatter' | 'increment-name' | 'config')[];
32
+ fallbackEpic?: string;
30
33
  }
31
- export type EpicMapping = FeatureMapping;
32
34
  /**
33
- * HierarchyMapper - Maps increments to feature folders (named by concept, not increment number)
35
+ * HierarchyMapper - Maps increments to universal hierarchy
34
36
  *
35
- * NEW ARCHITECTURE (v0.18.0+):
36
- * - Features are PERMANENT (named by concept: "release-management", "external-tool-sync")
37
- * - Increments are TEMPORARY (named by execution: "0023-release-management-enhancements")
38
- * - Multiple increments can contribute to same feature
39
- * - No FS-### prefix (features aren't numbered)
37
+ * Universal Hierarchy (v4.0.0):
38
+ * 1. Epic (EPIC-YYYY-QN-{name}) -> _epics/EPIC-{id}/EPIC.md
39
+ * 2. Feature (FS-XXX) -> _features/FS-XXX/FEATURE.md + {project}/FS-XXX/
40
+ * 3. User Story (us-NNN-{name}) -> {project}/FS-XXX/us-{id}.md
41
+ * 4. Task (T-NNN) -> increments/{id}/tasks.md
40
42
  */
41
43
  export declare class HierarchyMapper {
42
44
  private config;
43
45
  private projectRoot;
46
+ private featureIdManager;
47
+ private configManager;
48
+ private specweaveConfig;
44
49
  constructor(projectRoot: string, config?: Partial<HierarchyConfig>);
45
50
  /**
46
- * Detect which feature folder this increment belongs to
51
+ * Load SpecWeave config (cached)
52
+ */
53
+ getSpecweaveConfig(): Promise<SpecweaveConfig>;
54
+ /**
55
+ * Get list of configured projects
47
56
  *
48
- * NEW: Features are named by CONCEPT (release-management), not INCREMENT NUMBER (FS-023)
57
+ * Returns:
58
+ * - Single-project mode: ['default']
59
+ * - Multi-project mode: User-configured project names (dynamic, no hardcodes)
49
60
  */
50
- detectFeatureMapping(incrementId: string): Promise<FeatureMapping>;
61
+ getConfiguredProjects(): Promise<string[]>;
51
62
  /**
52
- * Legacy alias for backward compatibility
63
+ * Check if a feature is archived
53
64
  */
54
- detectEpicMapping(incrementId: string): Promise<EpicMapping>;
65
+ isFeatureArchived(featureId: string): Promise<boolean>;
55
66
  /**
56
- * Detect feature from frontmatter (epic: feature-name)
57
- *
58
- * FORMAT (v0.18.1+): Accepts simple feature names (external-tool-status-sync)
59
- * LEGACY: Also accepts old FS-### format (FS-001) - extracts from increment name instead
67
+ * Check if an epic is archived
68
+ */
69
+ isEpicArchived(epicId: string): Promise<boolean>;
70
+ /**
71
+ * Filter out archived items from mappings
60
72
  */
61
- private detectFromFrontmatter;
73
+ filterArchivedItems<T extends {
74
+ id: string;
75
+ }>(items: T[], type: 'feature' | 'epic'): Promise<T[]>;
62
76
  /**
63
- * Detect feature from increment NAME
77
+ * Get project context for a specific project ID
78
+ */
79
+ getProjectContext(projectId: string): Promise<ProjectContext | null>;
80
+ /**
81
+ * Detect which epic this increment belongs to (OPTIONAL)
64
82
  *
65
- * FORMAT (v0.18.1+): Simple descriptive names (no date prefixes)
83
+ * Epic Format: EPIC-YYYY-QN-{name}
84
+ * Example: EPIC-2025-Q4-platform
66
85
  *
67
- * Extracts the descriptive part of increment ID and normalizes it to feature name
68
- * Examples:
69
- * 0023-release-management-enhancements release-management (new or existing)
70
- * 0031-external-tool-status-sync external-tool-status-sync
86
+ * Detection Methods:
87
+ * 1. Frontmatter: epic: EPIC-2025-Q4-platform
88
+ * 2. Config: livingDocs.hierarchyMapping.incrementToEpic
89
+ * 3. Fallback: null (no epic required)
71
90
  */
72
- private detectFromIncrementName;
91
+ detectEpicMapping(incrementId: string): Promise<EpicMapping | null>;
73
92
  /**
74
- * Detect feature from config mapping (explicit increment feature mapping)
93
+ * Detect which feature this increment belongs to (REQUIRED)
94
+ *
95
+ * Feature Format (Greenfield): FS-XXX (matches increment number)
96
+ * Feature Format (Brownfield): FS-YY-MM-DD-{feature-name} (date-based)
97
+ * Examples:
98
+ * - Greenfield: 0031-external-tool-sync → FS-031
99
+ * - Brownfield: Imported from JIRA → FS-25-11-14-external-tool-sync
100
+ *
101
+ * Detection Methods:
102
+ * 1. Frontmatter: feature: FS-031 (greenfield) or feature: FS-25-11-14-name (brownfield)
103
+ * 2. Increment Name: 0031-external-tool-status-sync → FS-031 (auto-extract number)
104
+ * 3. Config: livingDocs.hierarchyMapping.incrementToFeature
105
+ * 4. Fallback: Auto-create feature from increment number (FS-XXX format)
75
106
  */
76
- private detectFromConfig;
107
+ detectFeatureMapping(incrementId: string): Promise<FeatureMapping>;
77
108
  /**
78
- * Create fallback mapping (extract feature name from increment ID)
109
+ * Detect which projects this increment/feature affects (REQUIRED)
79
110
  *
80
- * FORMAT (v0.18.1+): Simple descriptive names (no prefixes)
81
- * - Uses core feature name extracted from increment ID
82
- * - No date prefixes (removed to prevent duplicates)
83
- * - No FS- prefixes (features are not numbered)
111
+ * Returns array of project IDs (dynamic, from config)
84
112
  *
85
- * Example: 0023-release-management-enhancements → release-management
113
+ * Detection Methods:
114
+ * 1. Frontmatter: project: backend OR projects: [backend, frontend]
115
+ * 2. Increment Name: Contains project keyword (0031-backend-api-sync)
116
+ * 3. Config: livingDocs.hierarchyMapping.incrementToProjects
117
+ * 4. Fallback: ['default'] (single-project mode)
86
118
  */
87
- private createFallbackMapping;
119
+ detectProjects(incrementId: string): Promise<string[]>;
88
120
  /**
89
- * Get increment creation date in yy-mm-dd format
90
- * Tries: metadata.json → spec.md frontmatter → current date
121
+ * Detect epic from frontmatter
91
122
  */
92
- private getIncrementCreationDate;
123
+ private detectEpicFromFrontmatter;
93
124
  /**
94
- * Format date as yy-mm-dd
95
- * Input: "2025-11-14" or "2025-11-14T12:00:00Z"
96
- * Output: "25-11-14"
125
+ * Detect epic from config
97
126
  */
98
- private formatDateShort;
127
+ private detectEpicFromConfig;
128
+ /**
129
+ * Detect feature from frontmatter
130
+ *
131
+ * CRITICAL: For greenfield projects, ALWAYS use increment number (FS-XXX)
132
+ * even if frontmatter says FS-YY-MM-DD-name (date-based format)
133
+ */
134
+ private detectFeatureFromFrontmatter;
99
135
  /**
100
- * NEW: Find feature folder by name (exact match or fuzzy match)
136
+ * Detect feature from increment name
101
137
  *
102
138
  * Examples:
103
- * release-managementrelease-management/
104
- * external-tool-syncexternal-tool-status-sync/ (fuzzy match)
139
+ * - 0031-external-tool-status-sync FS-031
140
+ * - 0032-user-authenticationFS-032
141
+ * - 0001-core-framework → FS-001
105
142
  */
106
- private findFeatureFolder;
143
+ private detectFeatureFromIncrementName;
107
144
  /**
108
- * LEGACY: Find FS-* epic folder (for backward compatibility)
145
+ * Detect feature from config
109
146
  */
110
- private findEpicFolder;
147
+ private detectFeatureFromConfig;
111
148
  /**
112
- * Get all feature folders (NEW: no FS- prefix filtering)
149
+ * Create fallback feature mapping
113
150
  */
114
- getAllFeatureFolders(): Promise<string[]>;
151
+ private createFallbackFeatureMapping;
152
+ /**
153
+ * Build FeatureMapping object
154
+ *
155
+ * CRITICAL: For greenfield (FS-XXX format), use the feature ID directly.
156
+ * The feature ID manager is only used for brownfield (date-based) IDs.
157
+ */
158
+ private buildFeatureMapping;
115
159
  /**
116
- * LEGACY: Get all epic folders (for backward compatibility)
160
+ * Detect projects from frontmatter
117
161
  */
118
- getAllEpicFolders(): Promise<string[]>;
162
+ private detectProjectsFromFrontmatter;
119
163
  /**
120
- * Validate feature folder structure (NEW: checks for FEATURE.md)
164
+ * Detect projects from increment name (keyword matching)
121
165
  */
122
- validateFeatureFolder(featureFolder: string): Promise<{
123
- valid: boolean;
124
- missing: string[];
125
- }>;
166
+ private detectProjectsFromIncrementName;
126
167
  /**
127
- * LEGACY: Validate epic folder structure (for backward compatibility)
168
+ * Detect projects from config
128
169
  */
129
- validateEpicFolder(epicFolder: string): Promise<{
130
- valid: boolean;
131
- missing: string[];
132
- }>;
170
+ private detectProjectsFromConfig;
133
171
  /**
134
- * Create feature folder structure if missing (NEW: creates FEATURE.md)
172
+ * Get increment creation date in YY-MM-DD format
173
+ *
174
+ * Tries: metadata.json → spec.md frontmatter → current date
135
175
  */
136
- createFeatureFolderStructure(featureFolder: string, title: string): Promise<void>;
176
+ private getIncrementCreationDate;
177
+ /**
178
+ * Format date as YY-MM-DD
179
+ * Input: "2025-11-14" or "2025-11-14T12:00:00Z"
180
+ * Output: "25-11-14"
181
+ */
182
+ private formatDateShort;
183
+ /**
184
+ * Find existing feature folder (exact or fuzzy match)
185
+ *
186
+ * CRITICAL: For greenfield (FS-XXX), only exact match.
187
+ * For brownfield (FS-YY-MM-DD-name), fuzzy match allowed.
188
+ */
189
+ private findExistingFeatureFolder;
190
+ /**
191
+ * Get all feature folders
192
+ */
193
+ getAllFeatureFolders(): Promise<string[]>;
194
+ /**
195
+ * Get all epic folders
196
+ */
197
+ getAllEpicFolders(): Promise<string[]>;
137
198
  /**
138
- * LEGACY: Create epic folder structure (for backward compatibility)
199
+ * LEGACY: Backward compatibility alias for detectFeatureMapping
139
200
  */
140
- createEpicFolderStructure(epicFolder: string, title: string): Promise<void>;
201
+ detectEpicMapping_LEGACY(incrementId: string): Promise<FeatureMapping>;
141
202
  }
142
203
  //# sourceMappingURL=hierarchy-mapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hierarchy-mapper.d.ts","sourceRoot":"","sources":["../../../../src/core/living-docs/hierarchy-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,QAAQ,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,CAAC,aAAa,GAAG,gBAAgB,GAAG,QAAQ,CAAC,EAAE,CAAC;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,E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