specweave 0.28.17 → 0.28.20

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 (204) hide show
  1. package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts +94 -0
  2. package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts.map +1 -0
  3. package/dist/plugins/specweave-ado/lib/ado-board-resolver.js +219 -0
  4. package/dist/plugins/specweave-ado/lib/ado-board-resolver.js.map +1 -0
  5. package/dist/plugins/specweave-ado/lib/ado-spec-sync.d.ts +16 -0
  6. package/dist/plugins/specweave-ado/lib/ado-spec-sync.d.ts.map +1 -1
  7. package/dist/plugins/specweave-ado/lib/ado-spec-sync.js +63 -3
  8. package/dist/plugins/specweave-ado/lib/ado-spec-sync.js.map +1 -1
  9. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts +12 -3
  10. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts.map +1 -1
  11. package/dist/plugins/specweave-ado/lib/ado-status-sync.js +37 -3
  12. package/dist/plugins/specweave-ado/lib/ado-status-sync.js.map +1 -1
  13. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +6 -11
  14. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
  15. package/dist/plugins/specweave-github/lib/github-feature-sync.js +6 -11
  16. package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
  17. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts +21 -0
  18. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts.map +1 -0
  19. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js +445 -0
  20. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js.map +1 -0
  21. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts +10 -0
  22. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts.map +1 -1
  23. package/dist/plugins/specweave-github/lib/github-status-sync.js +40 -2
  24. package/dist/plugins/specweave-github/lib/github-status-sync.js.map +1 -1
  25. package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts +94 -0
  26. package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts.map +1 -0
  27. package/dist/plugins/specweave-github/lib/increment-issue-builder.js +369 -0
  28. package/dist/plugins/specweave-github/lib/increment-issue-builder.js.map +1 -0
  29. package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts +50 -0
  30. package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts.map +1 -0
  31. package/dist/plugins/specweave-jira/lib/jira-board-resolver.js +84 -0
  32. package/dist/plugins/specweave-jira/lib/jira-board-resolver.js.map +1 -0
  33. package/dist/plugins/specweave-jira/lib/jira-spec-sync.d.ts +12 -0
  34. package/dist/plugins/specweave-jira/lib/jira-spec-sync.d.ts.map +1 -1
  35. package/dist/plugins/specweave-jira/lib/jira-spec-sync.js +57 -5
  36. package/dist/plugins/specweave-jira/lib/jira-spec-sync.js.map +1 -1
  37. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts +5 -1
  38. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts.map +1 -1
  39. package/dist/plugins/specweave-jira/lib/jira-status-sync.js +12 -4
  40. package/dist/plugins/specweave-jira/lib/jira-status-sync.js.map +1 -1
  41. package/dist/src/cli/commands/import-external.d.ts.map +1 -1
  42. package/dist/src/cli/commands/import-external.js +12 -7
  43. package/dist/src/cli/commands/import-external.js.map +1 -1
  44. package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
  45. package/dist/src/cli/helpers/init/external-import.js +308 -36
  46. package/dist/src/cli/helpers/init/external-import.js.map +1 -1
  47. package/dist/src/cli/helpers/init/jira-ado-auto-detect.d.ts +115 -0
  48. package/dist/src/cli/helpers/init/jira-ado-auto-detect.d.ts.map +1 -0
  49. package/dist/src/cli/helpers/init/jira-ado-auto-detect.js +590 -0
  50. package/dist/src/cli/helpers/init/jira-ado-auto-detect.js.map +1 -0
  51. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts +65 -0
  52. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts.map +1 -0
  53. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js +278 -0
  54. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js.map +1 -0
  55. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts +64 -0
  56. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts.map +1 -0
  57. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js +251 -0
  58. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js.map +1 -0
  59. package/dist/src/config/types.d.ts +6 -6
  60. package/dist/src/core/ac-test-validator-cli.js +4 -1
  61. package/dist/src/core/ac-test-validator-cli.js.map +1 -1
  62. package/dist/src/core/ac-test-validator.d.ts.map +1 -1
  63. package/dist/src/core/ac-test-validator.js +4 -1
  64. package/dist/src/core/ac-test-validator.js.map +1 -1
  65. package/dist/src/core/background/index.d.ts +11 -0
  66. package/dist/src/core/background/index.d.ts.map +1 -0
  67. package/dist/src/core/background/index.js +11 -0
  68. package/dist/src/core/background/index.js.map +1 -0
  69. package/dist/src/core/background/job-manager.d.ts +65 -0
  70. package/dist/src/core/background/job-manager.d.ts.map +1 -0
  71. package/dist/src/core/background/job-manager.js +192 -0
  72. package/dist/src/core/background/job-manager.js.map +1 -0
  73. package/dist/src/core/background/types.d.ts +59 -0
  74. package/dist/src/core/background/types.d.ts.map +1 -0
  75. package/dist/src/core/background/types.js +8 -0
  76. package/dist/src/core/background/types.js.map +1 -0
  77. package/dist/src/core/repo-structure/multi-repo-configurator.d.ts +25 -0
  78. package/dist/src/core/repo-structure/multi-repo-configurator.d.ts.map +1 -0
  79. package/dist/src/core/repo-structure/multi-repo-configurator.js +614 -0
  80. package/dist/src/core/repo-structure/multi-repo-configurator.js.map +1 -0
  81. package/dist/src/core/repo-structure/repo-initializer.d.ts +40 -0
  82. package/dist/src/core/repo-structure/repo-initializer.d.ts.map +1 -0
  83. package/dist/src/core/repo-structure/repo-initializer.js +252 -0
  84. package/dist/src/core/repo-structure/repo-initializer.js.map +1 -0
  85. package/dist/src/core/repo-structure/repo-structure-manager.d.ts +3 -37
  86. package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
  87. package/dist/src/core/repo-structure/repo-structure-manager.js +23 -803
  88. package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
  89. package/dist/src/core/types/increment-metadata.d.ts +75 -0
  90. package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
  91. package/dist/src/core/types/spec-metadata.d.ts +2 -0
  92. package/dist/src/core/types/spec-metadata.d.ts.map +1 -1
  93. package/dist/src/core/types/sync-profile.d.ts +137 -5
  94. package/dist/src/core/types/sync-profile.d.ts.map +1 -1
  95. package/dist/src/core/types/sync-profile.js +63 -0
  96. package/dist/src/core/types/sync-profile.js.map +1 -1
  97. package/dist/src/importers/external-importer.d.ts +25 -0
  98. package/dist/src/importers/external-importer.d.ts.map +1 -1
  99. package/dist/src/importers/github-importer.d.ts.map +1 -1
  100. package/dist/src/importers/github-importer.js +5 -3
  101. package/dist/src/importers/github-importer.js.map +1 -1
  102. package/dist/src/importers/import-coordinator.d.ts +20 -0
  103. package/dist/src/importers/import-coordinator.d.ts.map +1 -1
  104. package/dist/src/importers/import-coordinator.js.map +1 -1
  105. package/dist/src/importers/item-converter.d.ts +51 -0
  106. package/dist/src/importers/item-converter.d.ts.map +1 -1
  107. package/dist/src/importers/item-converter.js +39 -12
  108. package/dist/src/importers/item-converter.js.map +1 -1
  109. package/dist/src/init/architecture/types.d.ts +2 -2
  110. package/dist/src/init/compliance/types.d.ts +1 -1
  111. package/dist/src/init/repo/types.d.ts +1 -1
  112. package/dist/src/living-docs/fs-id-allocator.d.ts +72 -3
  113. package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -1
  114. package/dist/src/living-docs/fs-id-allocator.js +142 -16
  115. package/dist/src/living-docs/fs-id-allocator.js.map +1 -1
  116. package/dist/src/locales/de/cli.json +14 -0
  117. package/dist/src/locales/es/cli.json +14 -0
  118. package/dist/src/locales/fr/cli.json +14 -0
  119. package/dist/src/locales/ja/cli.json +14 -0
  120. package/dist/src/locales/ko/cli.json +14 -0
  121. package/dist/src/locales/pt/cli.json +14 -0
  122. package/dist/src/locales/ru/cli.json +14 -0
  123. package/dist/src/locales/zh/cli.json +14 -0
  124. package/dist/src/utils/chalk-fallback.d.ts +38 -0
  125. package/dist/src/utils/chalk-fallback.d.ts.map +1 -0
  126. package/dist/src/utils/chalk-fallback.js +118 -0
  127. package/dist/src/utils/chalk-fallback.js.map +1 -0
  128. package/dist/src/utils/project-id-generator.d.ts +127 -0
  129. package/dist/src/utils/project-id-generator.d.ts.map +1 -0
  130. package/dist/src/utils/project-id-generator.js +228 -0
  131. package/dist/src/utils/project-id-generator.js.map +1 -0
  132. package/package.json +1 -1
  133. package/plugins/specweave/agents/pm/AGENT.md +202 -0
  134. package/plugins/specweave/commands/specweave-import-external.md +5 -3
  135. package/plugins/specweave/commands/specweave-jobs.md +160 -0
  136. package/plugins/specweave/commands/specweave-sync-docs.md +6 -2
  137. package/plugins/specweave/hooks/pre-task-completion.sh +35 -17
  138. package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.d.ts +16 -0
  139. package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js +121 -0
  140. package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js.map +1 -0
  141. package/plugins/specweave/lib/vendor/core/ac-test-validator.d.ts +111 -0
  142. package/plugins/specweave/lib/vendor/core/ac-test-validator.js +295 -0
  143. package/plugins/specweave/lib/vendor/core/ac-test-validator.js.map +1 -0
  144. package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +75 -0
  145. package/plugins/specweave/lib/vendor/utils/chalk-fallback.d.ts +38 -0
  146. package/plugins/specweave/lib/vendor/utils/chalk-fallback.js +118 -0
  147. package/plugins/specweave/lib/vendor/utils/chalk-fallback.js.map +1 -0
  148. package/plugins/specweave/lib/vendor/utils/fs-native.d.ts +179 -0
  149. package/plugins/specweave/lib/vendor/utils/fs-native.js +319 -0
  150. package/plugins/specweave/lib/vendor/utils/fs-native.js.map +1 -0
  151. package/plugins/specweave/skills/code-reviewer/SKILL.md +1 -1
  152. package/plugins/specweave/skills/docs-updater/SKILL.md +61 -0
  153. package/plugins/specweave/skills/increment-planner/SKILL.md +10 -335
  154. package/plugins/specweave/skills/increment-planner/templates/metadata.json +13 -0
  155. package/plugins/specweave/skills/increment-planner/templates/plan.md +50 -0
  156. package/plugins/specweave/skills/increment-planner/templates/spec-multi-project.md +86 -0
  157. package/plugins/specweave/skills/increment-planner/templates/spec-single-project.md +50 -0
  158. package/plugins/specweave/skills/increment-planner/templates/tasks-multi-project.md +86 -0
  159. package/plugins/specweave/skills/increment-planner/templates/tasks-single-project.md +48 -0
  160. package/plugins/specweave-ado/commands/specweave-ado-import-areas.md +358 -0
  161. package/plugins/specweave-ado/lib/ado-spec-sync.js +59 -3
  162. package/plugins/specweave-ado/lib/ado-spec-sync.ts +72 -3
  163. package/plugins/specweave-ado/lib/ado-status-sync.js +35 -3
  164. package/plugins/specweave-ado/lib/ado-status-sync.ts +48 -4
  165. package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +1 -0
  166. package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +1 -0
  167. package/plugins/specweave-core/skills/code-quality/SKILL.md +1 -0
  168. package/plugins/specweave-core/skills/design-patterns/SKILL.md +1 -0
  169. package/plugins/specweave-core/skills/software-architecture/SKILL.md +1 -0
  170. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +14 -10
  171. package/plugins/specweave-github/commands/specweave-github-sync.md +57 -0
  172. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +74 -0
  173. package/plugins/specweave-github/lib/github-feature-sync.ts +6 -11
  174. package/plugins/specweave-github/lib/github-increment-sync-cli.js +456 -0
  175. package/plugins/specweave-github/lib/github-increment-sync-cli.ts +588 -0
  176. package/plugins/specweave-github/lib/github-status-sync.js +37 -1
  177. package/plugins/specweave-github/lib/github-status-sync.ts +60 -4
  178. package/plugins/specweave-github/lib/increment-issue-builder.js +389 -0
  179. package/plugins/specweave-github/lib/increment-issue-builder.ts +502 -0
  180. package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +19 -24
  181. package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +15 -23
  182. package/plugins/specweave-jira/commands/specweave-jira-import-boards.md +331 -0
  183. package/plugins/specweave-jira/lib/jira-spec-sync.js +53 -5
  184. package/plugins/specweave-jira/lib/jira-spec-sync.ts +87 -7
  185. package/plugins/specweave-jira/lib/jira-status-sync.js +9 -3
  186. package/plugins/specweave-jira/lib/jira-status-sync.ts +15 -6
  187. package/plugins/specweave-ml/agents/data-scientist/AGENT.md +16 -20
  188. package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +18 -19
  189. package/plugins/specweave-ml/skills/{ml-pipeline-workflow → mlops-dag-builder}/SKILL.md +18 -14
  190. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +111 -0
  191. package/plugins/specweave-ui/skills/browser-automation/SKILL.md +1 -1
  192. package/plugins/specweave-ui/skills/ui-testing/SKILL.md +10 -122
  193. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +0 -70
  194. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +0 -1
  195. package/dist/plugins/specweave-github/lib/epic-content-builder.js +0 -258
  196. package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +0 -1
  197. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +0 -83
  198. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +0 -1
  199. package/dist/plugins/specweave-github/lib/github-epic-sync.js +0 -466
  200. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +0 -1
  201. package/plugins/specweave-github/lib/epic-content-builder.js +0 -265
  202. package/plugins/specweave-github/lib/epic-content-builder.ts +0 -376
  203. package/plugins/specweave-github/lib/github-epic-sync.js +0 -488
  204. package/plugins/specweave-github/lib/github-epic-sync.ts +0 -715
@@ -18,6 +18,7 @@ import axios, { AxiosInstance } from 'axios';
18
18
  */
19
19
  export interface ExternalStatus {
20
20
  state: string; // e.g., "New", "Active", "Closed"
21
+ tags?: string[]; // Status tags from config (e.g., ["Planning"], ["In Progress"])
21
22
  }
22
23
 
23
24
  /**
@@ -69,16 +70,17 @@ export class AdoStatusSync {
69
70
  }
70
71
 
71
72
  /**
72
- * Update ADO work item state
73
+ * Update ADO work item state and tags
73
74
  *
74
- * Uses JSON Patch format to update System.State field.
75
+ * Uses JSON Patch format to update System.State and System.Tags fields.
76
+ * Tags are appended to existing tags, not replaced.
75
77
  *
76
78
  * @param workItemId - ADO work item ID (e.g., 123)
77
- * @param status - Desired status
79
+ * @param status - Desired status with state and optional tags
78
80
  */
79
81
  async updateStatus(workItemId: number, status: ExternalStatus): Promise<void> {
80
82
  // ADO uses JSON Patch format for updates
81
- const patch = [
83
+ const patch: Array<{ op: string; path: string; value: string }> = [
82
84
  {
83
85
  op: 'add',
84
86
  path: '/fields/System.State',
@@ -86,12 +88,54 @@ export class AdoStatusSync {
86
88
  }
87
89
  ];
88
90
 
91
+ // Add status tags if provided
92
+ if (status.tags && status.tags.length > 0) {
93
+ // Fetch current tags to preserve them
94
+ const currentTags = await this.getCurrentTags(workItemId);
95
+
96
+ // Remove old status tags (tags that match known status patterns)
97
+ const statusTagPatterns = ['Planning', 'In Progress', 'Paused', 'Completed', 'Abandoned', 'On Hold'];
98
+ const preservedTags = currentTags.filter(
99
+ tag => !statusTagPatterns.some(pattern => tag.toLowerCase() === pattern.toLowerCase())
100
+ );
101
+
102
+ // Combine preserved tags with new status tags
103
+ const allTags = [...new Set([...preservedTags, ...status.tags])];
104
+
105
+ patch.push({
106
+ op: 'add',
107
+ path: '/fields/System.Tags',
108
+ value: allTags.join('; ')
109
+ });
110
+ }
111
+
89
112
  await this.client.patch(
90
113
  `/wit/workitems/${workItemId}?api-version=7.0`,
91
114
  patch
92
115
  );
93
116
  }
94
117
 
118
+ /**
119
+ * Get current tags from ADO work item
120
+ *
121
+ * @param workItemId - ADO work item ID
122
+ * @returns Array of current tags
123
+ */
124
+ private async getCurrentTags(workItemId: number): Promise<string[]> {
125
+ try {
126
+ const response = await this.client.get(
127
+ `/wit/workitems/${workItemId}?api-version=7.0&$select=System.Tags`
128
+ );
129
+
130
+ const tagsString = response.data.fields?.['System.Tags'] || '';
131
+ if (!tagsString) return [];
132
+
133
+ return tagsString.split(';').map((tag: string) => tag.trim()).filter(Boolean);
134
+ } catch {
135
+ return [];
136
+ }
137
+ }
138
+
95
139
  /**
96
140
  * Post comment about status change to ADO work item
97
141
  *
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: architecture-alternatives
3
3
  description: Software architecture patterns and alternatives expert. Covers monolith vs microservices, serverless, event-driven, CQRS, hexagonal architecture, clean architecture, DDD, and architecture decision frameworks. Activates for architecture patterns, monolith, microservices, serverless, event-driven, CQRS, hexagonal architecture, clean architecture, DDD, architecture decisions, system design, scalability patterns.
4
+ allowed-tools: Read, Grep, Glob
4
5
  ---
5
6
 
6
7
  # Architecture Alternatives Expert Skill
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: bmad-method
3
3
  description: BMAD (Best, Most Appropriate, Design) technology decision framework expert. Helps evaluate technology alternatives, analyze tradeoffs, calculate TCO, assess vendor lock-in, and make data-driven architecture decisions. Activates for technology choices, stack decisions, database selection, cloud provider comparison, framework evaluation, architecture decisions, BMAD, best practices, most appropriate, design decisions, technology tradeoffs.
4
+ allowed-tools: Read, Grep, Glob
4
5
  ---
5
6
 
6
7
  # BMAD Method Expert Skill
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: code-quality
3
3
  description: Expert code quality engineering covering clean code principles, SOLID, DRY, KISS, YAGNI, code smells, refactoring patterns, static analysis, linting, code coverage, mutation testing, and software craftsmanship. Activates for code quality, clean code, SOLID principles, code smells, refactoring, technical debt, code review, linting, eslint, prettier, static analysis, code coverage.
4
+ allowed-tools: Read, Grep, Glob
4
5
  ---
5
6
 
6
7
  # Code Quality Expert
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: design-patterns
3
3
  description: Expert knowledge of Gang of Four (GoF) design patterns including creational (Singleton, Factory, Builder, Prototype), structural (Adapter, Decorator, Proxy, Facade), and behavioral (Strategy, Observer, Command, Template Method, Chain of Responsibility). Modern TypeScript/JavaScript implementations with real-world use cases. Activates for design patterns, factory pattern, singleton, strategy pattern, observer pattern, decorator pattern, adapter pattern, builder pattern, proxy pattern, facade pattern, template method.
4
+ allowed-tools: Read, Grep, Glob
4
5
  ---
5
6
 
6
7
  # Design Patterns Expert
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: software-architecture
3
3
  description: Expert software architecture covering architectural patterns (microservices, monolith, event-driven, CQRS), scalability, distributed systems, CAP theorem, database architecture, API design, system design, domain-driven design (DDD), hexagonal architecture, and architecture decision records (ADRs). Activates for software architecture, system design, microservices, monolith, event-driven, CQRS, scalability, distributed systems, CAP theorem, DDD, hexagonal architecture, ADR.
4
+ allowed-tools: Read, Grep, Glob
4
5
  ---
5
6
 
6
7
  # Software Architecture Expert
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: specweave-github:cleanup-duplicates
3
- description: Clean up duplicate GitHub issues for an Epic. Finds issues with duplicate titles and closes all except the first created issue.
3
+ description: Clean up duplicate GitHub issues for a Feature. Finds issues with duplicate titles and closes all except the first created issue.
4
4
  justification: |
5
5
  CRITICAL INCIDENT RESPONSE TOOL - DO NOT DELETE!
6
6
 
@@ -193,33 +193,37 @@ The original issue (#250) contains the same content and should be used for track
193
193
 
194
194
  ## Related Commands
195
195
 
196
- - `/specweave-github:sync-epic` - Sync Epic (now with duplicate detection!)
196
+ - `/specweave-github:sync` - Sync Feature to GitHub (with duplicate detection)
197
197
  - `/specweave:validate` - Validate increment completeness
198
198
  - `gh issue list` - View all issues (GitHub CLI)
199
199
 
200
200
  ## Implementation
201
201
 
202
- **File**: `plugins/specweave-github/lib/github-epic-sync.ts`
202
+ **File**: `plugins/specweave-github/lib/duplicate-detector.ts`
203
203
 
204
- **Method**: `cleanupDuplicates(epicId: string, dryRun: boolean)`
204
+ **Class**: `DuplicateDetector`
205
205
 
206
- **Algorithm**:
207
- 1. Search GitHub for all issues with Epic ID
206
+ **Algorithm** (3-phase protection):
207
+ 1. **Detection**: Search GitHub for existing issues matching pattern
208
+ 2. **Verification**: Count check to detect duplicates after creation
209
+ 3. **Reflection**: Auto-close duplicates automatically
210
+
211
+ For manual cleanup:
212
+ 1. Search GitHub for all issues with Feature ID
208
213
  2. Group by title (Map<string, number[]>)
209
214
  3. Filter groups with >1 issue (duplicates)
210
215
  4. For each duplicate group:
211
216
  - Keep first issue (lowest number)
212
217
  - Close others with gh CLI
213
- 5. Update Epic README frontmatter
214
218
 
215
219
  ## Next Steps
216
220
 
217
221
  After cleanup:
218
222
 
219
223
  1. **Verify cleanup**: `gh issue list --search "[FS-031]"`
220
- 2. **Check Epic README**: Verify frontmatter has correct issue numbers
221
- 3. **Re-run sync**: `/specweave-github:sync-epic FS-031` (should show no duplicates)
222
- 4. **Enable duplicate detection**: Already enabled in v0.18.0+
224
+ 2. **Check Feature FEATURE.md**: Verify frontmatter has correct issue numbers
225
+ 3. **Re-run sync**: `/specweave-github:sync` (should show no duplicates)
226
+ 4. **Duplicate detection**: Automatically enabled via DuplicateDetector
223
227
 
224
228
  ---
225
229
 
@@ -5,6 +5,63 @@ description: Synchronize SpecWeave increment with GitHub issue (Multi-Project Su
5
5
 
6
6
  # Sync Increment with GitHub Issue (Multi-Project)
7
7
 
8
+ ## ⚠️ CRITICAL: Sync Routing (Read First!)
9
+
10
+ **Before executing ANY sync, you MUST determine the correct sync path:**
11
+
12
+ ### Step 0: Detect Project Structure
13
+
14
+ ```bash
15
+ # Check for living docs structure
16
+ if [ -d ".specweave/docs/internal/specs" ] && [ -n "$(ls -A .specweave/docs/internal/specs/*/FEATURE.md 2>/dev/null)" ]; then
17
+ echo "✅ Living docs found → Use Feature Sync"
18
+ else
19
+ echo "⚠️ No living docs → Use Increment Sync (brownfield)"
20
+ fi
21
+ ```
22
+
23
+ ### Sync Path Decision:
24
+
25
+ | Structure | Command | Issue Format |
26
+ |-----------|---------|--------------|
27
+ | **Living docs exist** (`.specweave/docs/internal/specs/FS-XXX/`) | Use `github-feature-sync-cli.ts` | `[FS-XXX][US-YYY] Title` |
28
+ | **Increment only** (brownfield, no living docs) | Use `github-increment-sync-cli.ts` | `[FS-XXX] Title` with ACs |
29
+
30
+ ### For Brownfield Projects (No Living Docs):
31
+
32
+ Use the Increment Sync CLI directly:
33
+
34
+ ```bash
35
+ # Set token
36
+ export GITHUB_TOKEN=$(grep GITHUB_TOKEN .env | cut -d'=' -f2)
37
+
38
+ # Run increment sync
39
+ node dist/plugins/specweave-github/lib/github-increment-sync-cli.js <increment-id>
40
+
41
+ # Example
42
+ node dist/plugins/specweave-github/lib/github-increment-sync-cli.js 0002
43
+ ```
44
+
45
+ This creates issues with:
46
+ - ✅ Proper format: `[FS-002] Increment Title`
47
+ - ✅ User Stories listed with checkbox headers
48
+ - ✅ All ACs as checkable items
49
+ - ✅ Links to increment files
50
+
51
+ ### For Projects with Living Docs:
52
+
53
+ Use the Feature Sync CLI:
54
+
55
+ ```bash
56
+ # Run feature sync
57
+ node dist/plugins/specweave-github/lib/github-feature-sync-cli.js <feature-id>
58
+
59
+ # Example
60
+ node dist/plugins/specweave-github/lib/github-feature-sync-cli.js FS-062
61
+ ```
62
+
63
+ ---
64
+
8
65
  Synchronize the current state of a SpecWeave increment with its GitHub issue across multiple repositories. Supports multi-profile management, time range filtering, and rate limit protection.
9
66
 
10
67
  ## Usage
@@ -1162,3 +1162,77 @@
1162
1162
  [Wed Nov 26 01:29:07 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1163
1163
  [Wed Nov 26 01:29:07 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1164
1164
  [Wed Nov 26 01:29:07 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1165
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1166
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1167
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1168
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1169
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1170
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1171
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1172
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1173
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1174
+ [Wed Nov 26 02:36:06 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1175
+ [Wed Nov 26 03:25:15 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1176
+ [Wed Nov 26 03:25:15 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1177
+ [Wed Nov 26 03:25:15 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1178
+ [Wed Nov 26 03:25:15 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1179
+ [Wed Nov 26 03:25:16 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1180
+ [Wed Nov 26 03:25:16 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1181
+ [Wed Nov 26 03:27:50 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1182
+ [Wed Nov 26 03:27:50 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1183
+ [Wed Nov 26 03:27:50 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1184
+ [Wed Nov 26 03:27:50 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1185
+ [Wed Nov 26 03:27:50 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1186
+ [Wed Nov 26 03:27:50 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1187
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1188
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1189
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1190
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1191
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1192
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1193
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1194
+ [Wed Nov 26 03:47:12 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1195
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1196
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1197
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1198
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1199
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1200
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1201
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1202
+ [Wed Nov 26 03:47:13 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1203
+ [Wed Nov 26 03:47:22 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1204
+ [Wed Nov 26 03:47:22 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1205
+ [Wed Nov 26 03:47:22 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1206
+ [Wed Nov 26 03:47:22 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1207
+ [Wed Nov 26 03:47:22 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1208
+ [Wed Nov 26 03:47:22 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1209
+ [Wed Nov 26 03:52:20 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1210
+ [Wed Nov 26 03:52:20 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1211
+ [Wed Nov 26 03:52:20 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1212
+ [Wed Nov 26 03:52:20 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1213
+ [Wed Nov 26 03:52:20 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1214
+ [Wed Nov 26 03:52:20 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1215
+ [Wed Nov 26 08:47:37 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1216
+ [Wed Nov 26 08:47:37 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1217
+ [Wed Nov 26 08:47:37 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1218
+ [Wed Nov 26 08:47:37 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1219
+ [Wed Nov 26 08:47:37 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1220
+ [Wed Nov 26 08:47:37 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1221
+ [Wed Nov 26 08:50:09 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1222
+ [Wed Nov 26 08:50:09 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1223
+ [Wed Nov 26 08:50:09 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1224
+ [Wed Nov 26 08:50:09 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1225
+ [Wed Nov 26 08:50:09 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1226
+ [Wed Nov 26 08:50:09 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1227
+ [Wed Nov 26 08:52:35 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1228
+ [Wed Nov 26 08:52:35 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1229
+ [Wed Nov 26 08:52:35 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1230
+ [Wed Nov 26 08:52:35 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1231
+ [Wed Nov 26 08:52:36 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1232
+ [Wed Nov 26 08:52:36 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1233
+ [Wed Nov 26 12:29:20 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1234
+ [Wed Nov 26 12:29:20 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1235
+ [Wed Nov 26 12:29:21 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1236
+ [Wed Nov 26 12:29:21 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
1237
+ [Wed Nov 26 12:29:21 EST 2025] [GitHub] 🔗 GitHub sync hook fired
1238
+ [Wed Nov 26 12:29:21 EST 2025] [GitHub] ⚠️ sync-spec-content CLI not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-github/hooks/dist/src/cli/commands/sync-spec-content.js, skipping sync
@@ -1,18 +1,13 @@
1
1
  /**
2
2
  * GitHub Feature Sync - Universal Hierarchy Implementation
3
3
  *
4
- * Architecture (CORRECT):
5
- * - Feature (FS-033) → GitHub Milestone (Container)
6
- * - User Story (US-001, US-002, etc.) → GitHub Issue (Trackable item)
7
- * - Tasks (T-001, T-002, etc.) → Checkboxes in User Story issue body
4
+ * Architecture:
5
+ * - Feature (FS-XXX) → GitHub Milestone (Container)
6
+ * - User Story (US-XXX) → GitHub Issue with format [FS-XXX][US-YYY] Title
7
+ * - Tasks (T-XXX) → Checkboxes in User Story issue body
8
8
  *
9
- * This implements the TRUE Universal Hierarchy architecture for GitHub.
10
- *
11
- * Key Differences from old github-epic-sync.ts:
12
- * - ❌ OLD: Feature/Increment → GitHub Issue (WRONG!)
13
- * - ✅ NEW: User Story → GitHub Issue (CORRECT!)
14
- * - ✅ Creates ONE issue PER user story file (not one per increment)
15
- * - ✅ Reads us-*.md files from specs/{project}/FS-XXX/
9
+ * This implements the Universal Hierarchy architecture for GitHub sync.
10
+ * Creates ONE issue PER user story file from specs/{project}/FS-XXX/us-*.md
16
11
  */
17
12
 
18
13
  import { readdir, readFile, writeFile } from 'fs/promises';