specweave 0.18.0 → 0.20.0

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 (428) hide show
  1. package/CLAUDE.md +229 -1817
  2. package/README.md +68 -0
  3. package/bin/specweave.js +62 -6
  4. package/dist/locales/de/.gitkeep +0 -0
  5. package/dist/locales/de/cli.json +108 -0
  6. package/dist/locales/en/cli.json +287 -0
  7. package/dist/locales/en/errors.json +7 -0
  8. package/dist/locales/en/templates.json +6 -0
  9. package/dist/locales/es/.gitkeep +0 -0
  10. package/dist/locales/es/cli.json +41 -0
  11. package/dist/locales/fr/.gitkeep +0 -0
  12. package/dist/locales/fr/cli.json +108 -0
  13. package/dist/locales/ja/.gitkeep +0 -0
  14. package/dist/locales/ja/cli.json +108 -0
  15. package/dist/locales/ko/.gitkeep +0 -0
  16. package/dist/locales/ko/cli.json +108 -0
  17. package/dist/locales/pt/.gitkeep +0 -0
  18. package/dist/locales/pt/cli.json +108 -0
  19. package/dist/locales/ru/.gitkeep +0 -0
  20. package/dist/locales/ru/cli.json +269 -0
  21. package/dist/locales/zh/.gitkeep +0 -0
  22. package/dist/locales/zh/cli.json +108 -0
  23. package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
  24. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +3 -0
  25. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
  26. package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts +21 -0
  27. package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts.map +1 -0
  28. package/dist/plugins/specweave/lib/hooks/update-ac-status.js +162 -0
  29. package/dist/plugins/specweave/lib/hooks/update-ac-status.js.map +1 -0
  30. package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.d.ts.map +1 -1
  31. package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js +65 -6
  32. package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js.map +1 -1
  33. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts +25 -0
  34. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts.map +1 -0
  35. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js +191 -0
  36. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js.map +1 -0
  37. package/dist/plugins/specweave-github/lib/completion-calculator.d.ts +112 -0
  38. package/dist/plugins/specweave-github/lib/completion-calculator.d.ts.map +1 -0
  39. package/dist/plugins/specweave-github/lib/completion-calculator.js +301 -0
  40. package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -0
  41. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +3 -3
  42. package/dist/plugins/specweave-github/lib/duplicate-detector.js +3 -3
  43. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +70 -0
  44. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +1 -0
  45. package/dist/plugins/specweave-github/lib/epic-content-builder.js +258 -0
  46. package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +1 -0
  47. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +14 -0
  48. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
  49. package/dist/plugins/specweave-github/lib/github-client-v2.js +51 -0
  50. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  51. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +2 -2
  52. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +1 -1
  53. package/dist/plugins/specweave-github/lib/github-epic-sync.js +20 -5
  54. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -1
  55. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +87 -0
  56. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -0
  57. package/dist/plugins/specweave-github/lib/github-feature-sync.js +412 -0
  58. package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -0
  59. package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
  60. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +64 -13
  61. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
  62. package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts +78 -0
  63. package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts.map +1 -0
  64. package/dist/plugins/specweave-github/lib/progress-comment-builder.js +237 -0
  65. package/dist/plugins/specweave-github/lib/progress-comment-builder.js.map +1 -0
  66. package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts +97 -0
  67. package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts.map +1 -0
  68. package/dist/plugins/specweave-github/lib/user-story-content-builder.js +301 -0
  69. package/dist/plugins/specweave-github/lib/user-story-content-builder.js.map +1 -0
  70. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts +83 -0
  71. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -0
  72. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +386 -0
  73. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -0
  74. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts +28 -0
  75. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts.map +1 -0
  76. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js +156 -0
  77. package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js.map +1 -0
  78. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.d.ts +57 -0
  79. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.d.ts.map +1 -0
  80. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.js +248 -0
  81. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.js.map +1 -0
  82. package/dist/plugins/specweave-kafka/lib/cli/types.d.ts +82 -0
  83. package/dist/plugins/specweave-kafka/lib/cli/types.d.ts.map +1 -0
  84. package/dist/plugins/specweave-kafka/lib/cli/types.js +13 -0
  85. package/dist/plugins/specweave-kafka/lib/cli/types.js.map +1 -0
  86. package/dist/plugins/specweave-kafka/lib/mcp/detector.d.ts +49 -0
  87. package/dist/plugins/specweave-kafka/lib/mcp/detector.d.ts.map +1 -0
  88. package/dist/plugins/specweave-kafka/lib/mcp/detector.js +316 -0
  89. package/dist/plugins/specweave-kafka/lib/mcp/detector.js.map +1 -0
  90. package/dist/plugins/specweave-kafka/lib/mcp/types.d.ts +70 -0
  91. package/dist/plugins/specweave-kafka/lib/mcp/types.d.ts.map +1 -0
  92. package/dist/plugins/specweave-kafka/lib/mcp/types.js +23 -0
  93. package/dist/plugins/specweave-kafka/lib/mcp/types.js.map +1 -0
  94. package/dist/plugins/specweave-kafka/lib/utils/partitioning.d.ts +85 -0
  95. package/dist/plugins/specweave-kafka/lib/utils/partitioning.d.ts.map +1 -0
  96. package/dist/plugins/specweave-kafka/lib/utils/partitioning.js +281 -0
  97. package/dist/plugins/specweave-kafka/lib/utils/partitioning.js.map +1 -0
  98. package/dist/plugins/specweave-kafka/lib/utils/sizing.d.ts +75 -0
  99. package/dist/plugins/specweave-kafka/lib/utils/sizing.d.ts.map +1 -0
  100. package/dist/plugins/specweave-kafka/lib/utils/sizing.js +238 -0
  101. package/dist/plugins/specweave-kafka/lib/utils/sizing.js.map +1 -0
  102. package/dist/spec-parser.js +629 -0
  103. package/dist/src/cli/commands/import-docs.js +4 -4
  104. package/dist/src/cli/commands/import-docs.js.map +1 -1
  105. package/dist/src/cli/commands/init-multiproject.d.ts.map +1 -1
  106. package/dist/src/cli/commands/init-multiproject.js +17 -18
  107. package/dist/src/cli/commands/init-multiproject.js.map +1 -1
  108. package/dist/src/cli/commands/init.d.ts.map +1 -1
  109. package/dist/src/cli/commands/init.js +107 -3
  110. package/dist/src/cli/commands/init.js.map +1 -1
  111. package/dist/src/cli/commands/migrate-to-multiproject.d.ts.map +1 -1
  112. package/dist/src/cli/commands/migrate-to-multiproject.js +8 -4
  113. package/dist/src/cli/commands/migrate-to-multiproject.js.map +1 -1
  114. package/dist/src/cli/commands/switch-project.d.ts.map +1 -1
  115. package/dist/src/cli/commands/switch-project.js +9 -26
  116. package/dist/src/cli/commands/switch-project.js.map +1 -1
  117. package/dist/src/cli/commands/sync-spec-content.js +3 -0
  118. package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
  119. package/dist/src/core/deduplication/command-deduplicator.d.ts +166 -0
  120. package/dist/src/core/deduplication/command-deduplicator.d.ts.map +1 -0
  121. package/dist/src/core/deduplication/command-deduplicator.js +254 -0
  122. package/dist/src/core/deduplication/command-deduplicator.js.map +1 -0
  123. package/dist/src/core/increment/active-increment-manager.d.ts +42 -15
  124. package/dist/src/core/increment/active-increment-manager.d.ts.map +1 -1
  125. package/dist/src/core/increment/active-increment-manager.js +113 -46
  126. package/dist/src/core/increment/active-increment-manager.js.map +1 -1
  127. package/dist/src/core/increment/conflict-resolver.d.ts +40 -0
  128. package/dist/src/core/increment/conflict-resolver.d.ts.map +1 -0
  129. package/dist/src/core/increment/conflict-resolver.js +219 -0
  130. package/dist/src/core/increment/conflict-resolver.js.map +1 -0
  131. package/dist/src/core/increment/discipline-checker.d.ts.map +1 -1
  132. package/dist/src/core/increment/discipline-checker.js +7 -1
  133. package/dist/src/core/increment/discipline-checker.js.map +1 -1
  134. package/dist/src/core/increment/duplicate-detector.d.ts +52 -0
  135. package/dist/src/core/increment/duplicate-detector.d.ts.map +1 -0
  136. package/dist/src/core/increment/duplicate-detector.js +276 -0
  137. package/dist/src/core/increment/duplicate-detector.js.map +1 -0
  138. package/dist/src/core/increment/increment-archiver.d.ts +90 -0
  139. package/dist/src/core/increment/increment-archiver.d.ts.map +1 -0
  140. package/dist/src/core/increment/increment-archiver.js +368 -0
  141. package/dist/src/core/increment/increment-archiver.js.map +1 -0
  142. package/dist/src/core/increment/increment-reopener.d.ts +165 -0
  143. package/dist/src/core/increment/increment-reopener.d.ts.map +1 -0
  144. package/dist/src/core/increment/increment-reopener.js +390 -0
  145. package/dist/src/core/increment/increment-reopener.js.map +1 -0
  146. package/dist/src/core/increment/metadata-manager.d.ts +26 -1
  147. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  148. package/dist/src/core/increment/metadata-manager.js +143 -5
  149. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  150. package/dist/src/core/increment/recent-work-scanner.d.ts +121 -0
  151. package/dist/src/core/increment/recent-work-scanner.d.ts.map +1 -0
  152. package/dist/src/core/increment/recent-work-scanner.js +303 -0
  153. package/dist/src/core/increment/recent-work-scanner.js.map +1 -0
  154. package/dist/src/core/increment/types.d.ts +1 -0
  155. package/dist/src/core/increment/types.d.ts.map +1 -1
  156. package/dist/src/core/increment-utils.d.ts +112 -0
  157. package/dist/src/core/increment-utils.d.ts.map +1 -0
  158. package/dist/src/core/increment-utils.js +210 -0
  159. package/dist/src/core/increment-utils.js.map +1 -0
  160. package/dist/src/core/living-docs/ac-project-specific-generator.d.ts +65 -0
  161. package/dist/src/core/living-docs/ac-project-specific-generator.d.ts.map +1 -0
  162. package/dist/src/core/living-docs/ac-project-specific-generator.js +175 -0
  163. package/dist/src/core/living-docs/ac-project-specific-generator.js.map +1 -0
  164. package/dist/src/core/living-docs/feature-archiver.d.ts +130 -0
  165. package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -0
  166. package/dist/src/core/living-docs/feature-archiver.js +549 -0
  167. package/dist/src/core/living-docs/feature-archiver.js.map +1 -0
  168. package/dist/src/core/living-docs/feature-id-manager.d.ts +81 -0
  169. package/dist/src/core/living-docs/feature-id-manager.d.ts.map +1 -0
  170. package/dist/src/core/living-docs/feature-id-manager.js +339 -0
  171. package/dist/src/core/living-docs/feature-id-manager.js.map +1 -0
  172. package/dist/src/core/living-docs/hierarchy-mapper.d.ts +144 -83
  173. package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -1
  174. package/dist/src/core/living-docs/hierarchy-mapper.js +488 -270
  175. package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
  176. package/dist/src/core/living-docs/index.d.ts +6 -0
  177. package/dist/src/core/living-docs/index.d.ts.map +1 -1
  178. package/dist/src/core/living-docs/index.js +6 -0
  179. package/dist/src/core/living-docs/index.js.map +1 -1
  180. package/dist/src/core/living-docs/project-detector.d.ts +6 -0
  181. package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
  182. package/dist/src/core/living-docs/project-detector.js +35 -1
  183. package/dist/src/core/living-docs/project-detector.js.map +1 -1
  184. package/dist/src/core/living-docs/spec-distributor.d.ts +100 -26
  185. package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -1
  186. package/dist/src/core/living-docs/spec-distributor.js +1275 -258
  187. package/dist/src/core/living-docs/spec-distributor.js.map +1 -1
  188. package/dist/src/core/living-docs/task-project-specific-generator.d.ts +109 -0
  189. package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -0
  190. package/dist/src/core/living-docs/task-project-specific-generator.js +221 -0
  191. package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -0
  192. package/dist/src/core/living-docs/types.d.ts +143 -0
  193. package/dist/src/core/living-docs/types.d.ts.map +1 -1
  194. package/dist/src/core/project-manager.d.ts +2 -17
  195. package/dist/src/core/project-manager.d.ts.map +1 -1
  196. package/dist/src/core/project-manager.js +68 -48
  197. package/dist/src/core/project-manager.js.map +1 -1
  198. package/dist/src/core/spec-content-sync.d.ts +1 -1
  199. package/dist/src/core/spec-content-sync.d.ts.map +1 -1
  200. package/dist/src/core/sync/enhanced-content-builder.d.ts +32 -54
  201. package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -1
  202. package/dist/src/core/sync/enhanced-content-builder.js +142 -138
  203. package/dist/src/core/sync/enhanced-content-builder.js.map +1 -1
  204. package/dist/src/core/sync/performance-optimizer.d.ts +153 -0
  205. package/dist/src/core/sync/performance-optimizer.d.ts.map +1 -0
  206. package/dist/src/core/sync/performance-optimizer.js +220 -0
  207. package/dist/src/core/sync/performance-optimizer.js.map +1 -0
  208. package/dist/src/core/sync/retry-handler.d.ts +98 -0
  209. package/dist/src/core/sync/retry-handler.d.ts.map +1 -0
  210. package/dist/src/core/sync/retry-handler.js +196 -0
  211. package/dist/src/core/sync/retry-handler.js.map +1 -0
  212. package/dist/src/core/sync/spec-content-sync.d.ts +88 -0
  213. package/dist/src/core/sync/spec-content-sync.d.ts.map +1 -0
  214. package/dist/src/core/sync/spec-content-sync.js +5 -0
  215. package/dist/src/core/sync/spec-content-sync.js.map +1 -0
  216. package/dist/src/core/sync/types.d.ts +52 -0
  217. package/dist/src/core/sync/types.d.ts.map +1 -0
  218. package/dist/src/core/sync/types.js +5 -0
  219. package/dist/src/core/sync/types.js.map +1 -0
  220. package/dist/src/core/types/config.d.ts +125 -0
  221. package/dist/src/core/types/config.d.ts.map +1 -1
  222. package/dist/src/core/types/config.js +25 -0
  223. package/dist/src/core/types/config.js.map +1 -1
  224. package/dist/src/core/types/increment-metadata.d.ts +10 -0
  225. package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
  226. package/dist/src/core/types/increment-metadata.js +10 -1
  227. package/dist/src/core/types/increment-metadata.js.map +1 -1
  228. package/dist/src/integrations/jira/jira-incremental-mapper.d.ts.map +1 -1
  229. package/dist/src/integrations/jira/jira-incremental-mapper.js +4 -8
  230. package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
  231. package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
  232. package/dist/src/integrations/jira/jira-mapper.js +4 -8
  233. package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
  234. package/dist/tsconfig.tsbuildinfo +1 -0
  235. package/package.json +1 -1
  236. package/plugins/specweave/COMMANDS.md +13 -4
  237. package/plugins/specweave/agents/pm/AGENT.md +159 -12
  238. package/plugins/specweave/commands/specweave-abandon.md +22 -20
  239. package/plugins/specweave/commands/specweave-archive-features.md +121 -0
  240. package/plugins/specweave/commands/specweave-archive-increments.md +82 -0
  241. package/plugins/specweave/commands/specweave-archive.md +363 -0
  242. package/plugins/specweave/commands/specweave-backlog.md +211 -0
  243. package/plugins/specweave/commands/specweave-fix-duplicates.md +517 -0
  244. package/plugins/specweave/commands/specweave-increment.md +4 -3
  245. package/plugins/specweave/commands/specweave-progress.md +176 -27
  246. package/plugins/specweave/commands/specweave-reopen.md +391 -0
  247. package/plugins/specweave/commands/specweave-restore-feature.md +90 -0
  248. package/plugins/specweave/commands/specweave-restore.md +309 -0
  249. package/plugins/specweave/commands/specweave-resume.md +51 -23
  250. package/plugins/specweave/commands/specweave-status.md +41 -7
  251. package/plugins/specweave/commands/specweave-sync-specs.md +425 -0
  252. package/plugins/specweave/commands/specweave.md +70 -405
  253. package/plugins/specweave/hooks/hooks.json +4 -0
  254. package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
  255. package/plugins/specweave/hooks/post-increment-planning.sh +26 -2
  256. package/plugins/specweave/hooks/post-task-completion.sh +39 -0
  257. package/plugins/specweave/hooks/pre-command-deduplication.sh +83 -0
  258. package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
  259. package/plugins/specweave/lib/hooks/sync-living-docs.js +2 -0
  260. package/plugins/specweave/lib/hooks/sync-living-docs.ts +4 -0
  261. package/plugins/specweave/lib/hooks/update-ac-status.js +102 -0
  262. package/plugins/specweave/lib/hooks/update-ac-status.ts +192 -0
  263. package/plugins/specweave/skills/archive-increments/SKILL.md +198 -0
  264. package/plugins/specweave/skills/increment-planner/scripts/feature-utils.js +14 -0
  265. package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +244 -0
  266. package/plugins/specweave-ado/lib/ado-spec-content-sync.js +49 -5
  267. package/plugins/specweave-ado/lib/ado-spec-content-sync.ts +72 -6
  268. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
  269. package/plugins/specweave-confluent/.claude-plugin/plugin.json +23 -0
  270. package/plugins/specweave-confluent/README.md +375 -0
  271. package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +306 -0
  272. package/plugins/specweave-confluent/skills/confluent-kafka-connect/SKILL.md +453 -0
  273. package/plugins/specweave-confluent/skills/confluent-ksqldb/SKILL.md +470 -0
  274. package/plugins/specweave-confluent/skills/confluent-schema-registry/SKILL.md +316 -0
  275. package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +2 -2
  276. package/plugins/specweave-github/agents/user-story-updater/AGENT.md +148 -0
  277. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +1 -1
  278. package/plugins/specweave-github/commands/specweave-github-update-user-story.md +156 -0
  279. package/plugins/specweave-github/hooks/post-task-completion.sh +42 -9
  280. package/plugins/specweave-github/lib/completion-calculator.js +262 -0
  281. package/plugins/specweave-github/lib/completion-calculator.ts +434 -0
  282. package/plugins/specweave-github/lib/duplicate-detector.js +3 -3
  283. package/plugins/specweave-github/lib/duplicate-detector.ts +4 -4
  284. package/plugins/specweave-github/lib/epic-content-builder.js +265 -0
  285. package/plugins/specweave-github/lib/epic-content-builder.ts +376 -0
  286. package/plugins/specweave-github/lib/github-client-v2.js +49 -0
  287. package/plugins/specweave-github/lib/github-client-v2.ts +59 -0
  288. package/plugins/specweave-github/lib/github-epic-sync.js +23 -24
  289. package/plugins/specweave-github/lib/github-epic-sync.ts +30 -5
  290. package/plugins/specweave-github/lib/github-feature-sync.js +381 -0
  291. package/plugins/specweave-github/lib/github-feature-sync.ts +568 -0
  292. package/plugins/specweave-github/lib/github-spec-content-sync.js +40 -10
  293. package/plugins/specweave-github/lib/github-spec-content-sync.ts +82 -14
  294. package/plugins/specweave-github/lib/progress-comment-builder.js +229 -0
  295. package/plugins/specweave-github/lib/progress-comment-builder.ts +324 -0
  296. package/plugins/specweave-github/lib/user-story-content-builder.js +299 -0
  297. package/plugins/specweave-github/lib/user-story-content-builder.ts +413 -0
  298. package/plugins/specweave-github/lib/user-story-issue-builder.js +344 -0
  299. package/plugins/specweave-github/lib/user-story-issue-builder.ts +543 -0
  300. package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +189 -0
  301. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +134 -0
  302. package/plugins/specweave-jira/lib/{enhanced-jira-sync.ts.disabled → enhanced-jira-sync.ts} +26 -52
  303. package/plugins/specweave-kafka/.claude-plugin/plugin.json +26 -0
  304. package/plugins/specweave-kafka/IMPLEMENTATION-COMPLETE.md +483 -0
  305. package/plugins/specweave-kafka/README.md +242 -0
  306. package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +235 -0
  307. package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +209 -0
  308. package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +266 -0
  309. package/plugins/specweave-kafka/commands/deploy.md +99 -0
  310. package/plugins/specweave-kafka/commands/dev-env.md +176 -0
  311. package/plugins/specweave-kafka/commands/mcp-configure.md +101 -0
  312. package/plugins/specweave-kafka/commands/monitor-setup.md +96 -0
  313. package/plugins/specweave-kafka/docker/kafka-local/docker-compose.yml +187 -0
  314. package/plugins/specweave-kafka/docker/redpanda/docker-compose.yml +199 -0
  315. package/plugins/specweave-kafka/docker/templates/consumer-nodejs.js +225 -0
  316. package/plugins/specweave-kafka/docker/templates/consumer-python.py +220 -0
  317. package/plugins/specweave-kafka/docker/templates/producer-nodejs.js +168 -0
  318. package/plugins/specweave-kafka/docker/templates/producer-python.py +167 -0
  319. package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.js +438 -0
  320. package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.ts +541 -0
  321. package/plugins/specweave-kafka/lib/adapters/platform-adapter.js +47 -0
  322. package/plugins/specweave-kafka/lib/adapters/platform-adapter.ts +343 -0
  323. package/plugins/specweave-kafka/lib/cli/kcat-wrapper.js +258 -0
  324. package/plugins/specweave-kafka/lib/cli/kcat-wrapper.ts +298 -0
  325. package/plugins/specweave-kafka/lib/cli/types.js +10 -0
  326. package/plugins/specweave-kafka/lib/cli/types.ts +92 -0
  327. package/plugins/specweave-kafka/lib/connectors/connector-catalog.js +305 -0
  328. package/plugins/specweave-kafka/lib/connectors/connector-catalog.ts +528 -0
  329. package/plugins/specweave-kafka/lib/documentation/diagram-generator.js +114 -0
  330. package/plugins/specweave-kafka/lib/documentation/diagram-generator.ts +195 -0
  331. package/plugins/specweave-kafka/lib/documentation/exporter.js +210 -0
  332. package/plugins/specweave-kafka/lib/documentation/exporter.ts +338 -0
  333. package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.js +60 -0
  334. package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.ts +130 -0
  335. package/plugins/specweave-kafka/lib/documentation/topology-generator.js +143 -0
  336. package/plugins/specweave-kafka/lib/documentation/topology-generator.ts +290 -0
  337. package/plugins/specweave-kafka/lib/mcp/detector.js +298 -0
  338. package/plugins/specweave-kafka/lib/mcp/detector.ts +352 -0
  339. package/plugins/specweave-kafka/lib/mcp/types.js +21 -0
  340. package/plugins/specweave-kafka/lib/mcp/types.ts +77 -0
  341. package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.js +193 -0
  342. package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.ts +362 -0
  343. package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.js +188 -0
  344. package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.ts +359 -0
  345. package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.js +195 -0
  346. package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.ts +380 -0
  347. package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.js +209 -0
  348. package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.ts +358 -0
  349. package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.js +354 -0
  350. package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.ts +563 -0
  351. package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.js +259 -0
  352. package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.ts +516 -0
  353. package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.js +233 -0
  354. package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.ts +423 -0
  355. package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.js +266 -0
  356. package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.ts +445 -0
  357. package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.js +312 -0
  358. package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.ts +561 -0
  359. package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.js +289 -0
  360. package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.ts +607 -0
  361. package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.js +264 -0
  362. package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.ts +498 -0
  363. package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.js +263 -0
  364. package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.ts +549 -0
  365. package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.js +205 -0
  366. package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.ts +399 -0
  367. package/plugins/specweave-kafka/lib/performance/performance-optimizer.js +249 -0
  368. package/plugins/specweave-kafka/lib/performance/performance-optimizer.ts +427 -0
  369. package/plugins/specweave-kafka/lib/security/kafka-security.js +252 -0
  370. package/plugins/specweave-kafka/lib/security/kafka-security.ts +494 -0
  371. package/plugins/specweave-kafka/lib/utils/capacity-planner.js +203 -0
  372. package/plugins/specweave-kafka/lib/utils/capacity-planner.ts +469 -0
  373. package/plugins/specweave-kafka/lib/utils/config-validator.js +419 -0
  374. package/plugins/specweave-kafka/lib/utils/config-validator.ts +564 -0
  375. package/plugins/specweave-kafka/lib/utils/partitioning.js +329 -0
  376. package/plugins/specweave-kafka/lib/utils/partitioning.ts +473 -0
  377. package/plugins/specweave-kafka/lib/utils/sizing.js +221 -0
  378. package/plugins/specweave-kafka/lib/utils/sizing.ts +374 -0
  379. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-broker-metrics.json +628 -0
  380. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-cluster-overview.json +564 -0
  381. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-consumer-lag.json +509 -0
  382. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-jvm-metrics.json +674 -0
  383. package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-topic-metrics.json +578 -0
  384. package/plugins/specweave-kafka/monitoring/grafana/provisioning/dashboards/kafka.yml +17 -0
  385. package/plugins/specweave-kafka/monitoring/grafana/provisioning/datasources/prometheus.yml +17 -0
  386. package/plugins/specweave-kafka/monitoring/prometheus/kafka-alerts.yml +415 -0
  387. package/plugins/specweave-kafka/monitoring/prometheus/kafka-jmx-exporter.yml +256 -0
  388. package/plugins/specweave-kafka/package.json +41 -0
  389. package/plugins/specweave-kafka/skills/kafka-architecture/SKILL.md +647 -0
  390. package/plugins/specweave-kafka/skills/kafka-cli-tools/SKILL.md +433 -0
  391. package/plugins/specweave-kafka/skills/kafka-iac-deployment/SKILL.md +449 -0
  392. package/plugins/specweave-kafka/skills/kafka-kubernetes/SKILL.md +667 -0
  393. package/plugins/specweave-kafka/skills/kafka-mcp-integration/SKILL.md +273 -0
  394. package/plugins/specweave-kafka/skills/kafka-observability/SKILL.md +576 -0
  395. package/plugins/specweave-kafka/templates/config/broker-production.properties +254 -0
  396. package/plugins/specweave-kafka/templates/config/consumer-low-latency.properties +112 -0
  397. package/plugins/specweave-kafka/templates/config/producer-high-throughput.properties +120 -0
  398. package/plugins/specweave-kafka/templates/migration/mirrormaker2-config.properties +234 -0
  399. package/plugins/specweave-kafka/templates/monitoring/grafana/multi-cluster-dashboard.json +686 -0
  400. package/plugins/specweave-kafka/terraform/apache-kafka/main.tf +347 -0
  401. package/plugins/specweave-kafka/terraform/apache-kafka/outputs.tf +107 -0
  402. package/plugins/specweave-kafka/terraform/apache-kafka/templates/kafka-broker-init.sh.tpl +216 -0
  403. package/plugins/specweave-kafka/terraform/apache-kafka/variables.tf +156 -0
  404. package/plugins/specweave-kafka/terraform/aws-msk/main.tf +362 -0
  405. package/plugins/specweave-kafka/terraform/aws-msk/outputs.tf +93 -0
  406. package/plugins/specweave-kafka/terraform/aws-msk/templates/server.properties.tpl +32 -0
  407. package/plugins/specweave-kafka/terraform/aws-msk/variables.tf +235 -0
  408. package/plugins/specweave-kafka/terraform/azure-event-hubs/main.tf +281 -0
  409. package/plugins/specweave-kafka/terraform/azure-event-hubs/outputs.tf +118 -0
  410. package/plugins/specweave-kafka/terraform/azure-event-hubs/variables.tf +148 -0
  411. package/plugins/specweave-kafka/tsconfig.json +21 -0
  412. package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +23 -0
  413. package/plugins/specweave-kafka-streams/README.md +310 -0
  414. package/plugins/specweave-kafka-streams/skills/kafka-streams-topology/SKILL.md +539 -0
  415. package/plugins/specweave-n8n/.claude-plugin/plugin.json +22 -0
  416. package/plugins/specweave-n8n/README.md +354 -0
  417. package/plugins/specweave-n8n/skills/n8n-kafka-workflows/SKILL.md +504 -0
  418. package/plugins/specweave-release/commands/specweave-release-platform.md +1 -1
  419. package/plugins/specweave-release/hooks/post-task-completion.sh +2 -2
  420. package/src/templates/AGENTS.md.template +601 -7
  421. package/src/templates/CLAUDE.md.template +188 -88
  422. package/plugins/specweave-ado/commands/specweave-ado-sync-spec.md +0 -255
  423. package/plugins/specweave-github/commands/specweave-github-sync-epic.md +0 -248
  424. package/plugins/specweave-github/commands/specweave-github-sync-from.md +0 -147
  425. package/plugins/specweave-github/commands/specweave-github-sync-spec.md +0 -208
  426. package/plugins/specweave-github/commands/specweave-github-sync-tasks.md +0 -530
  427. package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +0 -267
  428. package/plugins/specweave-jira/commands/specweave-jira-sync-spec.md +0 -240
@@ -0,0 +1,549 @@
1
+ /**
2
+ * Feature & Epic Archiver - Smart archiving system for features and epics
3
+ *
4
+ * Works in tandem with IncrementArchiver to maintain consistency between
5
+ * increments, features, and epics. When an increment is archived, its
6
+ * associated feature is automatically archived if all increments for
7
+ * that feature are archived.
8
+ */
9
+ import fs from 'fs-extra';
10
+ import * as path from 'path';
11
+ import { glob } from 'glob';
12
+ import { IncrementArchiver } from '../increment/increment-archiver.js';
13
+ import { HierarchyMapper } from './hierarchy-mapper.js';
14
+ import { FeatureIDManager } from './feature-id-manager.js';
15
+ export class FeatureArchiver {
16
+ constructor(rootDir) {
17
+ this.rootDir = rootDir;
18
+ this.specsDir = path.join(rootDir, '.specweave', 'docs', 'internal', 'specs');
19
+ this.featuresDir = path.join(this.specsDir, '_features');
20
+ this.epicsDir = path.join(this.specsDir, '_epics');
21
+ this.incrementArchiver = new IncrementArchiver(rootDir);
22
+ this.hierarchyMapper = new HierarchyMapper(rootDir);
23
+ this.featureIdManager = new FeatureIDManager(rootDir);
24
+ }
25
+ /**
26
+ * Archive features and epics based on increment archive status
27
+ */
28
+ async archiveFeatures(options = {}) {
29
+ const result = {
30
+ archivedFeatures: [],
31
+ archivedEpics: [],
32
+ updatedLinks: [],
33
+ errors: []
34
+ };
35
+ try {
36
+ // Ensure archive directories exist
37
+ if (!options.dryRun) {
38
+ await this.ensureArchiveDirectories();
39
+ }
40
+ // Get all archived increments
41
+ const archivedIncrements = await this.incrementArchiver.listArchived();
42
+ // Process features
43
+ const featuresToArchive = await this.identifyFeaturesToArchive(archivedIncrements, options);
44
+ for (const operation of featuresToArchive) {
45
+ await this.executeArchiveOperation(operation, result, options);
46
+ }
47
+ // Process epics (separate logic, not tied to features)
48
+ const epicsToArchive = await this.identifyEpicsToArchive(options);
49
+ for (const operation of epicsToArchive) {
50
+ await this.executeArchiveOperation(operation, result, options);
51
+ }
52
+ // Update all links if requested
53
+ if (options.updateLinks && !options.dryRun) {
54
+ await this.updateAllLinks(result);
55
+ }
56
+ }
57
+ catch (error) {
58
+ result.errors.push(`Archive operation failed: ${error}`);
59
+ console.error('❌ Archive operation failed:', error);
60
+ }
61
+ return result;
62
+ }
63
+ /**
64
+ * Identify features that should be archived
65
+ */
66
+ async identifyFeaturesToArchive(archivedIncrements, options) {
67
+ const operations = [];
68
+ const features = await this.getAllFeatures();
69
+ for (const featureId of features) {
70
+ const featurePath = path.join(this.featuresDir, featureId);
71
+ const archivePath = path.join(this.featuresDir, '_archive', featureId);
72
+ // Skip if already archived
73
+ if (await fs.pathExists(archivePath)) {
74
+ continue;
75
+ }
76
+ // Get all increments linked to this feature
77
+ const linkedIncrements = await this.getLinkedIncrements(featureId);
78
+ // Check if all linked increments are archived
79
+ const allIncrementsArchived = linkedIncrements.every(inc => archivedIncrements.some(archived => archived.includes(inc)));
80
+ // Archive orphaned features if option is set
81
+ const isOrphaned = linkedIncrements.length === 0 && options.archiveOrphanedFeatures;
82
+ if (allIncrementsArchived || isOrphaned) {
83
+ // Check if feature is still active in any project
84
+ if (options.preserveActiveFeatures) {
85
+ const hasActiveProjects = await this.hasActiveProjects(featureId);
86
+ if (hasActiveProjects) {
87
+ continue;
88
+ }
89
+ }
90
+ operations.push({
91
+ type: 'feature',
92
+ id: featureId,
93
+ sourcePath: featurePath,
94
+ targetPath: archivePath,
95
+ reason: isOrphaned ? 'orphaned' : 'all-increments-archived',
96
+ linkedIncrements
97
+ });
98
+ }
99
+ }
100
+ return operations;
101
+ }
102
+ /**
103
+ * Identify epics that should be archived
104
+ */
105
+ async identifyEpicsToArchive(options) {
106
+ const operations = [];
107
+ // Ensure epics directory exists
108
+ if (!await fs.pathExists(this.epicsDir)) {
109
+ return operations;
110
+ }
111
+ const epics = await this.getAllEpics();
112
+ for (const epicId of epics) {
113
+ const epicPath = path.join(this.epicsDir, epicId);
114
+ const archivePath = path.join(this.epicsDir, '_archive', epicId);
115
+ // Skip if already archived
116
+ if (await fs.pathExists(archivePath)) {
117
+ continue;
118
+ }
119
+ // Get all features linked to this epic
120
+ const linkedFeatures = await this.getLinkedFeatures(epicId);
121
+ // Check if all linked features are archived
122
+ const allFeaturesArchived = await this.areAllFeaturesArchived(linkedFeatures);
123
+ // Archive orphaned epics if option is set
124
+ const isOrphaned = linkedFeatures.length === 0 && options.archiveOrphanedEpics;
125
+ if (allFeaturesArchived || isOrphaned) {
126
+ operations.push({
127
+ type: 'epic',
128
+ id: epicId,
129
+ sourcePath: epicPath,
130
+ targetPath: archivePath,
131
+ reason: isOrphaned ? 'orphaned' : 'all-features-archived'
132
+ });
133
+ }
134
+ }
135
+ return operations;
136
+ }
137
+ /**
138
+ * Execute an archive operation
139
+ */
140
+ async executeArchiveOperation(operation, result, options) {
141
+ try {
142
+ if (options.dryRun) {
143
+ console.log(`[DRY RUN] Would archive ${operation.type}: ${operation.id}`);
144
+ console.log(` Source: ${operation.sourcePath}`);
145
+ console.log(` Target: ${operation.targetPath}`);
146
+ console.log(` Reason: ${operation.reason}`);
147
+ if (operation.type === 'feature') {
148
+ result.archivedFeatures.push(operation.id);
149
+ }
150
+ else {
151
+ result.archivedEpics.push(operation.id);
152
+ }
153
+ }
154
+ else {
155
+ // Move to archive
156
+ await fs.ensureDir(path.dirname(operation.targetPath));
157
+ await fs.move(operation.sourcePath, operation.targetPath, { overwrite: false });
158
+ // Also archive project-specific folders
159
+ if (operation.type === 'feature') {
160
+ await this.archiveProjectSpecificFolders(operation.id);
161
+ result.archivedFeatures.push(operation.id);
162
+ }
163
+ else {
164
+ result.archivedEpics.push(operation.id);
165
+ }
166
+ console.log(`✅ Archived ${operation.type}: ${operation.id} (${operation.reason})`);
167
+ }
168
+ }
169
+ catch (error) {
170
+ result.errors.push(`Failed to archive ${operation.type} ${operation.id}: ${error}`);
171
+ console.error(`❌ Failed to archive ${operation.type} ${operation.id}:`, error);
172
+ }
173
+ }
174
+ /**
175
+ * Archive project-specific folders for a feature
176
+ */
177
+ async archiveProjectSpecificFolders(featureId) {
178
+ // Get all project folders
179
+ const projectPattern = path.join(this.specsDir, '*', featureId);
180
+ const projectFolders = await glob(projectPattern, {
181
+ ignore: ['**/node_modules/**', '**/_features/**', '**/_epics/**', '**/_archive/**']
182
+ });
183
+ for (const folder of projectFolders) {
184
+ const projectId = path.basename(path.dirname(folder));
185
+ const archivePath = path.join(this.specsDir, projectId, '_archive', featureId);
186
+ await fs.ensureDir(path.dirname(archivePath));
187
+ await fs.move(folder, archivePath, { overwrite: false });
188
+ console.log(` ✅ Archived ${projectId}/${featureId}`);
189
+ }
190
+ }
191
+ /**
192
+ * Update all links to archived items
193
+ */
194
+ async updateAllLinks(result) {
195
+ console.log('🔄 Updating links to archived items...');
196
+ // Find all markdown files in the repository
197
+ const pattern = path.join(this.rootDir, '**/*.md');
198
+ const files = await glob(pattern, {
199
+ ignore: ['**/node_modules/**', '**/dist/**', '**/build/**']
200
+ });
201
+ for (const file of files) {
202
+ const updates = await this.updateLinksInFile(file, result.archivedFeatures, result.archivedEpics);
203
+ if (updates.length > 0) {
204
+ result.updatedLinks.push(...updates);
205
+ }
206
+ }
207
+ console.log(`✅ Updated ${result.updatedLinks.length} links in ${new Set(result.updatedLinks.map(u => u.file)).size} files`);
208
+ }
209
+ /**
210
+ * Update links in a single file
211
+ */
212
+ async updateLinksInFile(filePath, archivedFeatures, archivedEpics) {
213
+ const updates = [];
214
+ const content = await fs.readFile(filePath, 'utf-8');
215
+ const lines = content.split('\n');
216
+ let modified = false;
217
+ for (let i = 0; i < lines.length; i++) {
218
+ const line = lines[i];
219
+ // Check for feature links
220
+ for (const featureId of archivedFeatures) {
221
+ const patterns = [
222
+ new RegExp(`(\\[.*?\\]\\()([^)]*\/_features\/${featureId}\/[^)]*)\\)`, 'g'),
223
+ new RegExp(`(\\[.*?\\]\\()([^)]*\/specs\/[^/]+\/${featureId}\/[^)]*)\\)`, 'g')
224
+ ];
225
+ for (const pattern of patterns) {
226
+ const matches = [...line.matchAll(pattern)];
227
+ for (const match of matches) {
228
+ const oldPath = match[2];
229
+ const newPath = oldPath.replace(new RegExp(`(\/_features|\/specs\/[^/]+)\/${featureId}\/`), `$1/_archive/${featureId}/`);
230
+ lines[i] = lines[i].replace(oldPath, newPath);
231
+ modified = true;
232
+ updates.push({
233
+ file: filePath,
234
+ oldLink: oldPath,
235
+ newLink: newPath,
236
+ lineNumber: i + 1
237
+ });
238
+ }
239
+ }
240
+ }
241
+ // Check for epic links
242
+ for (const epicId of archivedEpics) {
243
+ const pattern = new RegExp(`(\\[.*?\\]\\()([^)]*\/_epics\/${epicId}\/[^)]*)\\)`, 'g');
244
+ const matches = [...line.matchAll(pattern)];
245
+ for (const match of matches) {
246
+ const oldPath = match[2];
247
+ const newPath = oldPath.replace(`/_epics/${epicId}/`, `/_epics/_archive/${epicId}/`);
248
+ lines[i] = lines[i].replace(oldPath, newPath);
249
+ modified = true;
250
+ updates.push({
251
+ file: filePath,
252
+ oldLink: oldPath,
253
+ newLink: newPath,
254
+ lineNumber: i + 1
255
+ });
256
+ }
257
+ }
258
+ }
259
+ // Save the file if modified
260
+ if (modified) {
261
+ await fs.writeFile(filePath, lines.join('\n'), 'utf-8');
262
+ }
263
+ return updates;
264
+ }
265
+ /**
266
+ * Get all features
267
+ */
268
+ async getAllFeatures() {
269
+ if (!await fs.pathExists(this.featuresDir)) {
270
+ return [];
271
+ }
272
+ const pattern = path.join(this.featuresDir, 'FS-*');
273
+ const folders = await glob(pattern);
274
+ const features = [];
275
+ for (const folder of folders) {
276
+ const stats = await fs.stat(folder);
277
+ if (stats.isDirectory() && !folder.includes('_archive')) {
278
+ features.push(path.basename(folder));
279
+ }
280
+ }
281
+ return features;
282
+ }
283
+ /**
284
+ * Get all epics
285
+ */
286
+ async getAllEpics() {
287
+ if (!await fs.pathExists(this.epicsDir)) {
288
+ return [];
289
+ }
290
+ const pattern = path.join(this.epicsDir, 'EPIC-*');
291
+ const folders = await glob(pattern);
292
+ const epics = [];
293
+ for (const folder of folders) {
294
+ const stats = await fs.stat(folder);
295
+ if (stats.isDirectory() && !folder.includes('_archive')) {
296
+ epics.push(path.basename(folder));
297
+ }
298
+ }
299
+ return epics;
300
+ }
301
+ /**
302
+ * Get increments linked to a feature
303
+ */
304
+ async getLinkedIncrements(featureId) {
305
+ const increments = [];
306
+ // Check active increments
307
+ const activePattern = path.join(this.rootDir, '.specweave', 'increments', '[0-9]*-*', 'spec.md');
308
+ const activeFiles = await glob(activePattern);
309
+ for (const file of activeFiles) {
310
+ const content = await fs.readFile(file, 'utf-8');
311
+ if (content.includes(featureId)) {
312
+ const incrementDir = path.basename(path.dirname(file));
313
+ increments.push(incrementDir);
314
+ }
315
+ }
316
+ // Check archived increments
317
+ const archivedPattern = path.join(this.rootDir, '.specweave', 'increments', '_archive', '[0-9]*-*', 'spec.md');
318
+ const archivedFiles = await glob(archivedPattern);
319
+ for (const file of archivedFiles) {
320
+ const content = await fs.readFile(file, 'utf-8');
321
+ if (content.includes(featureId)) {
322
+ const incrementDir = path.basename(path.dirname(file));
323
+ increments.push(incrementDir);
324
+ }
325
+ }
326
+ return increments;
327
+ }
328
+ /**
329
+ * Get features linked to an epic
330
+ */
331
+ async getLinkedFeatures(epicId) {
332
+ const features = [];
333
+ const allFeatures = await this.getAllFeatures();
334
+ for (const featureId of allFeatures) {
335
+ const featurePath = path.join(this.featuresDir, featureId, 'FEATURE.md');
336
+ if (await fs.pathExists(featurePath)) {
337
+ const content = await fs.readFile(featurePath, 'utf-8');
338
+ // Check if feature references the epic
339
+ if (content.includes(epicId)) {
340
+ features.push(featureId);
341
+ }
342
+ }
343
+ }
344
+ // Also check archived features
345
+ const archivedPattern = path.join(this.featuresDir, '_archive', 'FS-*', 'FEATURE.md');
346
+ const archivedFiles = await glob(archivedPattern);
347
+ for (const file of archivedFiles) {
348
+ const content = await fs.readFile(file, 'utf-8');
349
+ if (content.includes(epicId)) {
350
+ const featureId = path.basename(path.dirname(file));
351
+ features.push(featureId);
352
+ }
353
+ }
354
+ return features;
355
+ }
356
+ /**
357
+ * Check if all features are archived
358
+ */
359
+ async areAllFeaturesArchived(featureIds) {
360
+ if (featureIds.length === 0) {
361
+ return false;
362
+ }
363
+ for (const featureId of featureIds) {
364
+ const archivePath = path.join(this.featuresDir, '_archive', featureId);
365
+ const activePath = path.join(this.featuresDir, featureId);
366
+ // If feature exists in active location, it's not archived
367
+ if (await fs.pathExists(activePath) && !await fs.pathExists(archivePath)) {
368
+ return false;
369
+ }
370
+ }
371
+ return true;
372
+ }
373
+ /**
374
+ * Check if feature has active projects
375
+ */
376
+ async hasActiveProjects(featureId) {
377
+ // Check all project folders for this feature
378
+ const projectPattern = path.join(this.specsDir, '*', featureId);
379
+ const projectFolders = await glob(projectPattern, {
380
+ ignore: ['**/node_modules/**', '**/_features/**', '**/_epics/**', '**/_archive/**']
381
+ });
382
+ for (const folder of projectFolders) {
383
+ // Check if any user stories have active status
384
+ const usPattern = path.join(folder, 'us-*.md');
385
+ const usFiles = await glob(usPattern);
386
+ for (const file of usFiles) {
387
+ const content = await fs.readFile(file, 'utf-8');
388
+ // Simple check for active status indicators
389
+ if (!content.includes('status: completed') && !content.includes('status: cancelled')) {
390
+ return true;
391
+ }
392
+ }
393
+ }
394
+ return false;
395
+ }
396
+ /**
397
+ * Ensure archive directories exist
398
+ */
399
+ async ensureArchiveDirectories() {
400
+ await fs.ensureDir(path.join(this.featuresDir, '_archive'));
401
+ await fs.ensureDir(path.join(this.epicsDir, '_archive'));
402
+ // Ensure project-specific archive directories
403
+ const projectDirs = await glob(path.join(this.specsDir, '*'));
404
+ for (const dir of projectDirs) {
405
+ const stats = await fs.stat(dir);
406
+ if (stats.isDirectory()) {
407
+ const dirName = path.basename(dir);
408
+ if (!dirName.startsWith('_')) {
409
+ await fs.ensureDir(path.join(dir, '_archive'));
410
+ }
411
+ }
412
+ }
413
+ }
414
+ /**
415
+ * Restore an epic from archive
416
+ */
417
+ async restoreEpic(epicId) {
418
+ const archivePath = path.join(this.epicsDir, '_archive', epicId);
419
+ const targetPath = path.join(this.epicsDir, epicId);
420
+ if (!await fs.pathExists(archivePath)) {
421
+ throw new Error(`Epic ${epicId} not found in archive`);
422
+ }
423
+ if (await fs.pathExists(targetPath)) {
424
+ throw new Error(`Epic ${epicId} already exists in active location`);
425
+ }
426
+ // Restore epic
427
+ await fs.move(archivePath, targetPath);
428
+ console.log(`✅ Restored epic ${epicId} from archive`);
429
+ // Update links
430
+ await this.updateLinksForRestoredEpic(epicId);
431
+ }
432
+ /**
433
+ * Update links for restored epic
434
+ */
435
+ async updateLinksForRestoredEpic(epicId) {
436
+ const pattern = path.join(this.rootDir, '**/*.md');
437
+ const files = await glob(pattern, {
438
+ ignore: ['**/node_modules/**', '**/dist/**', '**/build/**']
439
+ });
440
+ let updatedFiles = 0;
441
+ for (const file of files) {
442
+ const content = await fs.readFile(file, 'utf-8');
443
+ // Update archive links back to active
444
+ const updatedContent = content
445
+ .replace(new RegExp(`(\/_epics\/_archive\/${epicId}\/)`, 'g'), `/_epics/${epicId}/`);
446
+ if (content !== updatedContent) {
447
+ await fs.writeFile(file, updatedContent, 'utf-8');
448
+ updatedFiles++;
449
+ }
450
+ }
451
+ if (updatedFiles > 0) {
452
+ console.log(`✅ Updated links in ${updatedFiles} files`);
453
+ }
454
+ }
455
+ /**
456
+ * Restore a feature from archive
457
+ */
458
+ async restoreFeature(featureId) {
459
+ const archivePath = path.join(this.featuresDir, '_archive', featureId);
460
+ const targetPath = path.join(this.featuresDir, featureId);
461
+ if (!await fs.pathExists(archivePath)) {
462
+ throw new Error(`Feature ${featureId} not found in archive`);
463
+ }
464
+ if (await fs.pathExists(targetPath)) {
465
+ throw new Error(`Feature ${featureId} already exists in active location`);
466
+ }
467
+ // Restore feature
468
+ await fs.move(archivePath, targetPath);
469
+ // Restore project-specific folders
470
+ const projectPattern = path.join(this.specsDir, '*', '_archive', featureId);
471
+ const archivedFolders = await glob(projectPattern);
472
+ for (const folder of archivedFolders) {
473
+ const projectId = path.basename(path.dirname(path.dirname(folder)));
474
+ const targetProjectPath = path.join(this.specsDir, projectId, featureId);
475
+ await fs.move(folder, targetProjectPath);
476
+ console.log(` ✅ Restored ${projectId}/${featureId}`);
477
+ }
478
+ console.log(`✅ Restored feature ${featureId} from archive`);
479
+ // Update links
480
+ await this.updateLinksForRestoredFeature(featureId);
481
+ }
482
+ /**
483
+ * Update links for restored feature
484
+ */
485
+ async updateLinksForRestoredFeature(featureId) {
486
+ const pattern = path.join(this.rootDir, '**/*.md');
487
+ const files = await glob(pattern, {
488
+ ignore: ['**/node_modules/**', '**/dist/**', '**/build/**']
489
+ });
490
+ let updatedFiles = 0;
491
+ for (const file of files) {
492
+ const content = await fs.readFile(file, 'utf-8');
493
+ // Update archive links back to active
494
+ const updatedContent = content
495
+ .replace(new RegExp(`(\/_features\/_archive\/${featureId}\/)`, 'g'), `/_features/${featureId}/`)
496
+ .replace(new RegExp(`(\/specs\/[^/]+\/_archive\/${featureId}\/)`, 'g'), (match, p1) => {
497
+ return match.replace('/_archive/', '/');
498
+ });
499
+ if (content !== updatedContent) {
500
+ await fs.writeFile(file, updatedContent, 'utf-8');
501
+ updatedFiles++;
502
+ }
503
+ }
504
+ if (updatedFiles > 0) {
505
+ console.log(`✅ Updated links in ${updatedFiles} files`);
506
+ }
507
+ }
508
+ /**
509
+ * Get archive statistics
510
+ */
511
+ async getArchiveStats() {
512
+ const stats = {
513
+ features: { active: 0, archived: 0 },
514
+ epics: { active: 0, archived: 0 },
515
+ projects: {}
516
+ };
517
+ // Count features
518
+ const activeFeatures = await this.getAllFeatures();
519
+ stats.features.active = activeFeatures.length;
520
+ if (await fs.pathExists(path.join(this.featuresDir, '_archive'))) {
521
+ const archivedFeatures = await glob(path.join(this.featuresDir, '_archive', 'FS-*'));
522
+ stats.features.archived = archivedFeatures.length;
523
+ }
524
+ // Count epics
525
+ const activeEpics = await this.getAllEpics();
526
+ stats.epics.active = activeEpics.length;
527
+ if (await fs.pathExists(path.join(this.epicsDir, '_archive'))) {
528
+ const archivedEpics = await glob(path.join(this.epicsDir, '_archive', 'EPIC-*'));
529
+ stats.epics.archived = archivedEpics.length;
530
+ }
531
+ // Count per project
532
+ const projectDirs = await glob(path.join(this.specsDir, '*'));
533
+ for (const dir of projectDirs) {
534
+ const dirStats = await fs.stat(dir);
535
+ if (!dirStats.isDirectory())
536
+ continue;
537
+ const projectId = path.basename(dir);
538
+ if (!projectId.startsWith('_')) {
539
+ const activePattern = path.join(dir, 'FS-*');
540
+ const archivedPattern = path.join(dir, '_archive', 'FS-*');
541
+ const active = (await glob(activePattern)).length;
542
+ const archived = (await glob(archivedPattern)).length;
543
+ stats.projects[projectId] = { active, archived };
544
+ }
545
+ }
546
+ return stats;
547
+ }
548
+ }
549
+ //# sourceMappingURL=feature-archiver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-archiver.js","sourceRoot":"","sources":["../../../../src/core/living-docs/feature-archiver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAiC3D,MAAM,OAAO,eAAe;IAS1B,YAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACp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D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;gBAClD,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC;gBAEtD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;YACnD,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,81 @@
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
+ export interface FeatureInfo {
6
+ originalId: string;
7
+ assignedId: string;
8
+ title: string;
9
+ created: Date;
10
+ incrementId?: string;
11
+ projects?: string[];
12
+ }
13
+ export interface FeatureRegistry {
14
+ features: Map<string, FeatureInfo>;
15
+ nextId: number;
16
+ }
17
+ export declare class FeatureIDManager {
18
+ private registry;
19
+ private specsBaseDir;
20
+ private incrementsDir;
21
+ constructor(projectRoot: string);
22
+ /**
23
+ * Build registry by scanning all increments and existing features
24
+ */
25
+ buildRegistry(): Promise<void>;
26
+ /**
27
+ * Scan all increments to extract feature information
28
+ */
29
+ private scanIncrements;
30
+ /**
31
+ * Scan existing _features folder
32
+ */
33
+ private scanExistingFeatures;
34
+ /**
35
+ * Merge features and remove duplicates
36
+ */
37
+ private mergeFeatures;
38
+ /**
39
+ * Assign FS-XXX IDs based on strategy
40
+ *
41
+ * CRITICAL: For greenfield (FS-XXX), assigned ID = original ID
42
+ * For brownfield (FS-YY-MM-DD-name), assigned ID = sequential
43
+ */
44
+ private assignFeatureIds;
45
+ /**
46
+ * Get assigned ID for a feature
47
+ */
48
+ getAssignedId(originalId: string): string;
49
+ /**
50
+ * Check if a feature ID already exists
51
+ */
52
+ hasFeature(originalId: string): boolean;
53
+ /**
54
+ * Get all registered features
55
+ */
56
+ getAllFeatures(): FeatureInfo[];
57
+ /**
58
+ * Normalize feature ID to consistent format
59
+ *
60
+ * CRITICAL: For greenfield, we use FS-XXX (sequential numbers)
61
+ * For brownfield, we use FS-YY-MM-DD-name (date-based)
62
+ */
63
+ private normalizeFeatureId;
64
+ /**
65
+ * Get a consistent key for feature deduplication
66
+ */
67
+ private getFeatureKey;
68
+ /**
69
+ * Extract frontmatter from markdown content
70
+ */
71
+ private extractFrontmatter;
72
+ /**
73
+ * Save registry to disk for persistence
74
+ */
75
+ saveRegistry(): Promise<void>;
76
+ /**
77
+ * Load registry from disk
78
+ */
79
+ loadRegistry(): Promise<void>;
80
+ }
81
+ //# sourceMappingURL=feature-id-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-id-manager.d.ts","sourceRoot":"","sources":["../../../../src/core/living-docs/feature-id-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAS;gBAElB,WAAW,EAAE,MAAM;IAS/B;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB3C;;OAEG;YACW,cAAc;IAoF5B;;OAEG;YACW,oBAAoB;IAsClC;;OAEG;IACH,OAAO,CAAC,aAAa;IA4BrB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAwBhD;;OAEG;IACI,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK9C;;OAEG;IACI,cAAc,IAAI,WAAW,EAAE;IAItC;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IA4B1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAUrB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsB1B;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB1C;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CA+B3C"}