specweave 0.22.13 → 0.22.14

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 (188) hide show
  1. package/.claude-plugin/README.md +2 -2
  2. package/CLAUDE.md +269 -51
  3. package/README.md +33 -10
  4. package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.d.ts +1 -1
  5. package/dist/plugins/specweave-github/lib/ThreeLayerSyncManager.js +1 -1
  6. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js +1 -1
  7. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js.map +1 -1
  8. package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
  9. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +4 -1
  10. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
  11. package/dist/plugins/specweave-github/lib/github-spec-sync.d.ts +1 -1
  12. package/dist/plugins/specweave-github/lib/github-spec-sync.js +1 -1
  13. package/dist/plugins/specweave-github/lib/github-sync-bidirectional.d.ts +9 -0
  14. package/dist/plugins/specweave-github/lib/github-sync-bidirectional.d.ts.map +1 -1
  15. package/dist/plugins/specweave-github/lib/github-sync-bidirectional.js +10 -1
  16. package/dist/plugins/specweave-github/lib/github-sync-bidirectional.js.map +1 -1
  17. package/dist/plugins/specweave-github/lib/progress-comment-builder.js +2 -2
  18. package/dist/plugins/specweave-github/lib/progress-comment-builder.js.map +1 -1
  19. package/dist/plugins/specweave-github/lib/types.d.ts +1 -1
  20. package/dist/src/cli/commands/init.d.ts.map +1 -1
  21. package/dist/src/cli/commands/init.js +313 -1
  22. package/dist/src/cli/commands/init.js.map +1 -1
  23. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  24. package/dist/src/cli/helpers/issue-tracker/index.js +41 -24
  25. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  26. package/dist/src/config/import-config.d.ts +69 -0
  27. package/dist/src/config/import-config.d.ts.map +1 -0
  28. package/dist/src/config/import-config.js +136 -0
  29. package/dist/src/config/import-config.js.map +1 -0
  30. package/dist/src/config/types.d.ts +10 -10
  31. package/dist/src/core/living-docs/living-docs-sync.d.ts +2 -0
  32. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  33. package/dist/src/core/living-docs/living-docs-sync.js +10 -1
  34. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  35. package/dist/src/core/living-docs/task-project-specific-generator.d.ts +2 -2
  36. package/dist/src/core/living-docs/task-project-specific-generator.js +2 -2
  37. package/dist/src/core/repo-structure/prompt-consolidator.d.ts +2 -2
  38. package/dist/src/core/repo-structure/prompt-consolidator.d.ts.map +1 -1
  39. package/dist/src/core/repo-structure/prompt-consolidator.js +3 -15
  40. package/dist/src/core/repo-structure/prompt-consolidator.js.map +1 -1
  41. package/dist/src/core/repo-structure/repo-structure-manager.d.ts +1 -1
  42. package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
  43. package/dist/src/core/repo-structure/repo-structure-manager.js +3 -6
  44. package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
  45. package/dist/src/core/spec-content-sync.d.ts +4 -1
  46. package/dist/src/core/spec-content-sync.d.ts.map +1 -1
  47. package/dist/src/core/spec-content-sync.js +139 -4
  48. package/dist/src/core/spec-content-sync.js.map +1 -1
  49. package/dist/src/core/spec-task-mapper.d.ts.map +1 -1
  50. package/dist/src/core/spec-task-mapper.js +9 -8
  51. package/dist/src/core/spec-task-mapper.js.map +1 -1
  52. package/dist/src/core/status-line-validator.d.ts +63 -0
  53. package/dist/src/core/status-line-validator.d.ts.map +1 -0
  54. package/dist/src/core/status-line-validator.js +253 -0
  55. package/dist/src/core/status-line-validator.js.map +1 -0
  56. package/dist/src/core/sync/bidirectional-engine.d.ts +10 -1
  57. package/dist/src/core/sync/bidirectional-engine.d.ts.map +1 -1
  58. package/dist/src/core/sync/bidirectional-engine.js +10 -1
  59. package/dist/src/core/sync/bidirectional-engine.js.map +1 -1
  60. package/dist/src/core/sync/profile-manager.d.ts.map +1 -1
  61. package/dist/src/core/sync/profile-manager.js +3 -0
  62. package/dist/src/core/sync/profile-manager.js.map +1 -1
  63. package/dist/src/core/sync/project-context.d.ts.map +1 -1
  64. package/dist/src/core/sync/project-context.js +3 -0
  65. package/dist/src/core/sync/project-context.js.map +1 -1
  66. package/dist/src/core/sync/status-sync-engine.d.ts +1 -1
  67. package/dist/src/core/sync/status-sync-engine.js +1 -1
  68. package/dist/src/core/types/origin-metadata.d.ts +153 -0
  69. package/dist/src/core/types/origin-metadata.d.ts.map +1 -0
  70. package/dist/src/core/types/origin-metadata.js +166 -0
  71. package/dist/src/core/types/origin-metadata.js.map +1 -0
  72. package/dist/src/core/types/sync-profile.d.ts +8 -2
  73. package/dist/src/core/types/sync-profile.d.ts.map +1 -1
  74. package/dist/src/core/types/sync-profile.js.map +1 -1
  75. package/dist/src/core/types/sync-settings.d.ts +73 -0
  76. package/dist/src/core/types/sync-settings.d.ts.map +1 -0
  77. package/dist/src/core/types/sync-settings.js +90 -0
  78. package/dist/src/core/types/sync-settings.js.map +1 -0
  79. package/dist/src/core/utils/permission-checker.d.ts +100 -0
  80. package/dist/src/core/utils/permission-checker.d.ts.map +1 -0
  81. package/dist/src/core/utils/permission-checker.js +166 -0
  82. package/dist/src/core/utils/permission-checker.js.map +1 -0
  83. package/dist/src/generators/spec/spec-parser.js +3 -3
  84. package/dist/src/generators/spec/spec-parser.js.map +1 -1
  85. package/dist/src/generators/spec/task-parser.js +4 -4
  86. package/dist/src/generators/spec/task-parser.js.map +1 -1
  87. package/dist/src/id-generators/task-id-generator.d.ts +96 -0
  88. package/dist/src/id-generators/task-id-generator.d.ts.map +1 -0
  89. package/dist/src/id-generators/task-id-generator.js +143 -0
  90. package/dist/src/id-generators/task-id-generator.js.map +1 -0
  91. package/dist/src/id-generators/us-id-generator.d.ts +96 -0
  92. package/dist/src/id-generators/us-id-generator.d.ts.map +1 -0
  93. package/dist/src/id-generators/us-id-generator.js +143 -0
  94. package/dist/src/id-generators/us-id-generator.js.map +1 -0
  95. package/dist/src/importers/ado-importer.d.ts +43 -0
  96. package/dist/src/importers/ado-importer.d.ts.map +1 -0
  97. package/dist/src/importers/ado-importer.js +234 -0
  98. package/dist/src/importers/ado-importer.js.map +1 -0
  99. package/dist/src/importers/external-importer.d.ts +96 -0
  100. package/dist/src/importers/external-importer.d.ts.map +1 -0
  101. package/dist/src/importers/external-importer.js +13 -0
  102. package/dist/src/importers/external-importer.js.map +1 -0
  103. package/dist/src/importers/github-importer.d.ts +37 -0
  104. package/dist/src/importers/github-importer.d.ts.map +1 -0
  105. package/dist/src/importers/github-importer.js +161 -0
  106. package/dist/src/importers/github-importer.js.map +1 -0
  107. package/dist/src/importers/import-coordinator.d.ts +90 -0
  108. package/dist/src/importers/import-coordinator.d.ts.map +1 -0
  109. package/dist/src/importers/import-coordinator.js +182 -0
  110. package/dist/src/importers/import-coordinator.js.map +1 -0
  111. package/dist/src/importers/item-converter.d.ts +91 -0
  112. package/dist/src/importers/item-converter.d.ts.map +1 -0
  113. package/dist/src/importers/item-converter.js +221 -0
  114. package/dist/src/importers/item-converter.js.map +1 -0
  115. package/dist/src/importers/jira-importer.d.ts +42 -0
  116. package/dist/src/importers/jira-importer.d.ts.map +1 -0
  117. package/dist/src/importers/jira-importer.js +221 -0
  118. package/dist/src/importers/jira-importer.js.map +1 -0
  119. package/dist/src/init/repo/types.d.ts +2 -2
  120. package/dist/src/integrations/jira/jira-mapper.d.ts +1 -1
  121. package/dist/src/integrations/jira/jira-mapper.js +1 -1
  122. package/dist/src/living-docs/fs-id-allocator.d.ts +149 -0
  123. package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -0
  124. package/dist/src/living-docs/fs-id-allocator.js +325 -0
  125. package/dist/src/living-docs/fs-id-allocator.js.map +1 -0
  126. package/dist/src/living-docs/id-registry.d.ts +124 -0
  127. package/dist/src/living-docs/id-registry.d.ts.map +1 -0
  128. package/dist/src/living-docs/id-registry.js +230 -0
  129. package/dist/src/living-docs/id-registry.js.map +1 -0
  130. package/dist/src/progress/us-progress-tracker.d.ts +68 -0
  131. package/dist/src/progress/us-progress-tracker.d.ts.map +1 -0
  132. package/dist/src/progress/us-progress-tracker.js +120 -0
  133. package/dist/src/progress/us-progress-tracker.js.map +1 -0
  134. package/package.json +1 -1
  135. package/plugins/specweave/.claude-plugin/plugin.json +16 -2
  136. package/plugins/specweave/agents/architect/AGENT.md +11 -2
  137. package/plugins/specweave/agents/test-aware-planner/AGENT.md +81 -25
  138. package/plugins/specweave/commands/specweave-import-docs.md +278 -88
  139. package/plugins/specweave/commands/specweave-progress.md +45 -97
  140. package/plugins/specweave/hooks/post-increment-completion.sh +168 -26
  141. package/plugins/specweave/hooks/post-increment-planning.sh +148 -4
  142. package/plugins/specweave/hooks/post-task-completion.sh +64 -4
  143. package/plugins/specweave/lib/hooks/sync-cache.js +294 -0
  144. package/plugins/specweave/lib/hooks/sync-living-docs.js +32 -1
  145. package/plugins/specweave/lib/hooks/sync-us-tasks.js +23 -13
  146. package/plugins/specweave-ado/.claude-plugin/plugin.json +1 -1
  147. package/plugins/specweave-ado/lib/conflict-resolver.ts +1 -1
  148. package/plugins/specweave-alternatives/.claude-plugin/plugin.json +1 -1
  149. package/plugins/specweave-backend/.claude-plugin/plugin.json +1 -1
  150. package/plugins/specweave-confluent/.claude-plugin/plugin.json +1 -1
  151. package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +1 -1
  152. package/plugins/specweave-diagrams/.claude-plugin/plugin.json +1 -1
  153. package/plugins/specweave-docs/.claude-plugin/plugin.json +1 -1
  154. package/plugins/specweave-docs-preview/.claude-plugin/plugin.json +1 -1
  155. package/plugins/specweave-figma/.claude-plugin/plugin.json +1 -1
  156. package/plugins/specweave-frontend/.claude-plugin/plugin.json +1 -1
  157. package/plugins/specweave-github/.claude-plugin/plugin.json +1 -1
  158. package/plugins/specweave-github/hooks/post-task-completion.sh +37 -22
  159. package/plugins/specweave-github/lib/ThreeLayerSyncManager.ts +1 -1
  160. package/plugins/specweave-github/lib/enhanced-github-sync.js +1 -1
  161. package/plugins/specweave-github/lib/enhanced-github-sync.ts +1 -1
  162. package/plugins/specweave-github/lib/github-spec-content-sync.js +2 -1
  163. package/plugins/specweave-github/lib/github-spec-content-sync.ts +4 -1
  164. package/plugins/specweave-github/lib/github-spec-sync.js +1 -1
  165. package/plugins/specweave-github/lib/github-spec-sync.ts +1 -1
  166. package/plugins/specweave-github/lib/github-sync-bidirectional.js +1 -1
  167. package/plugins/specweave-github/lib/github-sync-bidirectional.ts +10 -1
  168. package/plugins/specweave-github/lib/progress-comment-builder.js +1 -1
  169. package/plugins/specweave-github/lib/progress-comment-builder.ts +2 -2
  170. package/plugins/specweave-github/lib/types.ts +1 -1
  171. package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +1 -1
  172. package/plugins/specweave-jira/.claude-plugin/plugin.json +1 -1
  173. package/plugins/specweave-kafka/.claude-plugin/plugin.json +1 -1
  174. package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +1 -1
  175. package/plugins/specweave-kubernetes/.claude-plugin/plugin.json +1 -1
  176. package/plugins/specweave-ml/.claude-plugin/plugin.json +1 -1
  177. package/plugins/specweave-mobile/.claude-plugin/plugin.json +1 -1
  178. package/plugins/specweave-n8n/.claude-plugin/plugin.json +1 -1
  179. package/plugins/specweave-payments/.claude-plugin/plugin.json +1 -1
  180. package/plugins/specweave-release/.claude-plugin/plugin.json +1 -1
  181. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +252 -0
  182. package/plugins/specweave-testing/.claude-plugin/plugin.json +1 -1
  183. package/plugins/specweave-tooling/.claude-plugin/plugin.json +1 -1
  184. package/plugins/specweave-ui/.claude-plugin/plugin.json +1 -1
  185. package/src/templates/.env.example +5 -0
  186. package/src/templates/config-permissions-guide.md +413 -0
  187. package/src/templates/config.json.template +68 -0
  188. package/src/templates/tasks.md.template +180 -201
@@ -0,0 +1,161 @@
1
+ /**
2
+ * GitHub Importer
3
+ *
4
+ * Imports GitHub issues as External Items with pagination support.
5
+ * Handles rate limiting and converts GitHub-specific data to platform-agnostic format.
6
+ */
7
+ import { Octokit } from '@octokit/rest';
8
+ /**
9
+ * GitHub Importer Implementation
10
+ */
11
+ export class GitHubImporter {
12
+ constructor(owner, repo, token) {
13
+ this.platform = 'github';
14
+ this.owner = owner;
15
+ this.repo = repo;
16
+ this.octokit = new Octokit({
17
+ auth: token || process.env.GITHUB_TOKEN,
18
+ });
19
+ }
20
+ /**
21
+ * Import all issues matching config
22
+ */
23
+ async import(config = {}) {
24
+ const items = [];
25
+ for await (const page of this.paginate(config)) {
26
+ items.push(...page);
27
+ }
28
+ return items;
29
+ }
30
+ /**
31
+ * Paginate through issues (100 per page)
32
+ */
33
+ async *paginate(config = {}) {
34
+ const { timeRangeMonths = 3, includeClosed = false, labels = [], milestone, maxItems = Infinity, } = config;
35
+ // Calculate since date
36
+ const since = new Date();
37
+ since.setMonth(since.getMonth() - timeRangeMonths);
38
+ let page = 1;
39
+ let totalFetched = 0;
40
+ while (totalFetched < maxItems) {
41
+ try {
42
+ // Fetch page from GitHub API
43
+ const response = await this.octokit.issues.listForRepo({
44
+ owner: this.owner,
45
+ repo: this.repo,
46
+ state: includeClosed ? 'all' : 'open',
47
+ since: since.toISOString(),
48
+ labels: labels.join(','),
49
+ milestone: milestone,
50
+ per_page: 100,
51
+ page,
52
+ });
53
+ // Check rate limiting
54
+ const remaining = parseInt(response.headers['x-ratelimit-remaining'] || '0', 10);
55
+ if (remaining < 10) {
56
+ const resetTime = parseInt(response.headers['x-ratelimit-reset'] || '0', 10);
57
+ const resetDate = new Date(resetTime * 1000);
58
+ throw new Error(`GitHub rate limit approaching (${remaining} requests remaining). Resets at ${resetDate.toLocaleString()}`);
59
+ }
60
+ // Convert GitHub issues to ExternalItems
61
+ const items = response.data
62
+ .filter((issue) => !issue.pull_request) // Exclude pull requests
63
+ .map((issue) => this.convertToExternalItem(issue));
64
+ // Yield page
65
+ if (items.length > 0) {
66
+ yield items.slice(0, maxItems - totalFetched);
67
+ totalFetched += items.length;
68
+ }
69
+ // Check if we've reached the end
70
+ if (response.data.length < 100) {
71
+ break;
72
+ }
73
+ page++;
74
+ }
75
+ catch (error) {
76
+ if (error.status === 403 && error.message.includes('rate limit')) {
77
+ throw new Error(`GitHub rate limit exceeded: ${error.message}`);
78
+ }
79
+ throw error;
80
+ }
81
+ }
82
+ }
83
+ /**
84
+ * Convert GitHub issue to ExternalItem
85
+ */
86
+ convertToExternalItem(issue) {
87
+ // Extract type from labels
88
+ let type = 'task';
89
+ const labelNames = issue.labels.map((l) => l.name.toLowerCase());
90
+ if (labelNames.includes('user-story') || labelNames.includes('story')) {
91
+ type = 'user-story';
92
+ }
93
+ else if (labelNames.includes('epic')) {
94
+ type = 'epic';
95
+ }
96
+ else if (labelNames.includes('bug')) {
97
+ type = 'bug';
98
+ }
99
+ else if (labelNames.includes('feature')) {
100
+ type = 'feature';
101
+ }
102
+ // Extract priority from labels (P0, P1, P2, P3, P4)
103
+ const priorityLabel = labelNames.find((l) => /^p[0-4]$/i.test(l));
104
+ const priority = priorityLabel ? priorityLabel.toUpperCase() : undefined;
105
+ // Extract acceptance criteria from body
106
+ const acceptanceCriteria = this.extractAcceptanceCriteria(issue.body || '');
107
+ // Map GitHub state to ExternalItem status
108
+ let status = 'open';
109
+ if (issue.state === 'closed') {
110
+ status = 'completed';
111
+ }
112
+ else if (labelNames.includes('in-progress') || labelNames.includes('in progress')) {
113
+ status = 'in-progress';
114
+ }
115
+ return {
116
+ id: `github#${issue.number}`,
117
+ type,
118
+ title: issue.title,
119
+ description: issue.body || '',
120
+ status,
121
+ priority,
122
+ createdAt: new Date(issue.created_at),
123
+ updatedAt: new Date(issue.updated_at),
124
+ url: issue.html_url,
125
+ labels: issue.labels.map((l) => l.name),
126
+ acceptanceCriteria: acceptanceCriteria.length > 0 ? acceptanceCriteria : undefined,
127
+ platform: 'github',
128
+ };
129
+ }
130
+ /**
131
+ * Extract acceptance criteria from issue body
132
+ * Looks for patterns like:
133
+ * - [ ] AC-001: ...
134
+ * - Acceptance Criteria: ...
135
+ */
136
+ extractAcceptanceCriteria(body) {
137
+ const criteria = [];
138
+ // Pattern 1: Checkbox list items starting with "AC"
139
+ const acPattern = /^[\s-]*\[[ x]\]\s+(AC[-:]?\s*\d+:?\s*.+)$/gim;
140
+ const acMatches = body.matchAll(acPattern);
141
+ for (const match of acMatches) {
142
+ criteria.push(match[1].trim());
143
+ }
144
+ // Pattern 2: "Acceptance Criteria" section
145
+ const sectionPattern = /(?:^|\n)##?\s*Acceptance Criteria\s*\n([\s\S]*?)(?=\n##|\n---|\z)/i;
146
+ const sectionMatch = body.match(sectionPattern);
147
+ if (sectionMatch) {
148
+ const section = sectionMatch[1];
149
+ const itemPattern = /^[\s-]*[•*-]\s*(.+)$/gm;
150
+ const itemMatches = section.matchAll(itemPattern);
151
+ for (const match of itemMatches) {
152
+ const item = match[1].trim();
153
+ if (!criteria.some((c) => c.includes(item))) {
154
+ criteria.push(item);
155
+ }
156
+ }
157
+ }
158
+ return criteria;
159
+ }
160
+ }
161
+ //# sourceMappingURL=github-importer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-importer.js","sourceRoot":"","sources":["../../../src/importers/github-importer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAgBxC;;GAEG;AACH,MAAM,OAAO,cAAc;IAMzB,YAAY,KAAa,EAAE,IAAY,EAAE,KAAc;QAL9C,aAAQ,GAAG,QAAiB,CAAC;QAMpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC;YACzB,IAAI,EAAE,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY;SACxC,CAAC,CAAC;IACL,CAAC;IAED;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AI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChD,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAChC,MAAM,WAAW,GAAG,wBAAwB,CAAC;YAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YAClD,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;gBAChC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;oBAC5C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Import Coordinator
3
+ *
4
+ * Orchestrates multi-platform imports from GitHub, JIRA, and Azure DevOps.
5
+ * Handles parallel execution, progress tracking, and result aggregation.
6
+ */
7
+ import type { ExternalItem, ImportConfig, ImportResult } from './external-importer.js';
8
+ export interface CoordinatorConfig {
9
+ /** Import from GitHub */
10
+ github?: {
11
+ owner: string;
12
+ repo: string;
13
+ token?: string;
14
+ };
15
+ /** Import from JIRA */
16
+ jira?: {
17
+ host: string;
18
+ email?: string;
19
+ apiToken?: string;
20
+ };
21
+ /** Import from Azure DevOps */
22
+ ado?: {
23
+ orgUrl: string;
24
+ project: string;
25
+ pat?: string;
26
+ };
27
+ /** Common import configuration */
28
+ importConfig?: ImportConfig;
29
+ /** Run imports in parallel (default: true) */
30
+ parallel?: boolean;
31
+ /** Progress callback */
32
+ onProgress?: (platform: string, count: number, total?: number) => void;
33
+ }
34
+ export interface CoordinatorResult {
35
+ /** Combined results from all platforms */
36
+ results: ImportResult[];
37
+ /** Total items imported across all platforms */
38
+ totalCount: number;
39
+ /** All imported items */
40
+ allItems: ExternalItem[];
41
+ /** Errors by platform */
42
+ errors: Record<string, string[]>;
43
+ /** Platforms that were imported from */
44
+ platforms: Array<'github' | 'jira' | 'ado'>;
45
+ }
46
+ /**
47
+ * Import Coordinator
48
+ */
49
+ export declare class ImportCoordinator {
50
+ private importers;
51
+ private config;
52
+ constructor(config: CoordinatorConfig);
53
+ /**
54
+ * Initialize importers based on configuration
55
+ */
56
+ private initializeImporters;
57
+ /**
58
+ * Import from all configured platforms
59
+ */
60
+ importAll(): Promise<CoordinatorResult>;
61
+ /**
62
+ * Import from platforms in parallel
63
+ */
64
+ private importParallel;
65
+ /**
66
+ * Import from platforms sequentially
67
+ */
68
+ private importSequential;
69
+ /**
70
+ * Import from a single platform with progress tracking
71
+ */
72
+ private importFromPlatform;
73
+ /**
74
+ * Aggregate results from all platforms
75
+ */
76
+ private aggregateResults;
77
+ /**
78
+ * Import from a specific platform only
79
+ */
80
+ importFrom(platform: 'github' | 'jira' | 'ado'): Promise<ImportResult>;
81
+ /**
82
+ * Get list of configured platforms
83
+ */
84
+ getConfiguredPlatforms(): Array<'github' | 'jira' | 'ado'>;
85
+ /**
86
+ * Check if a platform is configured
87
+ */
88
+ isPlatformConfigured(platform: 'github' | 'jira' | 'ado'): boolean;
89
+ }
90
+ //# sourceMappingURL=import-coordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-coordinator.d.ts","sourceRoot":"","sources":["../../../src/importers/import-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAY,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKjG,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAA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OAEG;IACH,OAAO,CAAC,gBAAgB;IAyCxB;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC;IAU5E;;OAEG;IACH,sBAAsB,IAAI,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;IAI1D;;OAEG;IACH,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO;CAGnE"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Import Coordinator
3
+ *
4
+ * Orchestrates multi-platform imports from GitHub, JIRA, and Azure DevOps.
5
+ * Handles parallel execution, progress tracking, and result aggregation.
6
+ */
7
+ import { GitHubImporter } from './github-importer.js';
8
+ import { JiraImporter } from './jira-importer.js';
9
+ import { ADOImporter } from './ado-importer.js';
10
+ /**
11
+ * Import Coordinator
12
+ */
13
+ export class ImportCoordinator {
14
+ constructor(config) {
15
+ this.importers = new Map();
16
+ this.config = config;
17
+ this.initializeImporters();
18
+ }
19
+ /**
20
+ * Initialize importers based on configuration
21
+ */
22
+ initializeImporters() {
23
+ // GitHub importer
24
+ if (this.config.github) {
25
+ try {
26
+ const importer = new GitHubImporter(this.config.github.owner, this.config.github.repo, this.config.github.token);
27
+ this.importers.set('github', importer);
28
+ }
29
+ catch (error) {
30
+ console.warn(`Failed to initialize GitHub importer: ${error.message}`);
31
+ }
32
+ }
33
+ // JIRA importer
34
+ if (this.config.jira) {
35
+ try {
36
+ const importer = new JiraImporter(this.config.jira.host, this.config.jira.email, this.config.jira.apiToken);
37
+ this.importers.set('jira', importer);
38
+ }
39
+ catch (error) {
40
+ console.warn(`Failed to initialize JIRA importer: ${error.message}`);
41
+ }
42
+ }
43
+ // Azure DevOps importer
44
+ if (this.config.ado) {
45
+ try {
46
+ const importer = new ADOImporter(this.config.ado.orgUrl, this.config.ado.project, this.config.ado.pat);
47
+ this.importers.set('ado', importer);
48
+ }
49
+ catch (error) {
50
+ console.warn(`Failed to initialize ADO importer: ${error.message}`);
51
+ }
52
+ }
53
+ if (this.importers.size === 0) {
54
+ throw new Error('No importers configured. Provide at least one platform configuration.');
55
+ }
56
+ }
57
+ /**
58
+ * Import from all configured platforms
59
+ */
60
+ async importAll() {
61
+ const parallel = this.config.parallel !== false; // Default to true
62
+ if (parallel) {
63
+ return this.importParallel();
64
+ }
65
+ else {
66
+ return this.importSequential();
67
+ }
68
+ }
69
+ /**
70
+ * Import from platforms in parallel
71
+ */
72
+ async importParallel() {
73
+ const promises = Array.from(this.importers.entries()).map(([platform, importer]) => this.importFromPlatform(platform, importer));
74
+ const results = await Promise.allSettled(promises);
75
+ return this.aggregateResults(results);
76
+ }
77
+ /**
78
+ * Import from platforms sequentially
79
+ */
80
+ async importSequential() {
81
+ const results = [];
82
+ for (const [platform, importer] of this.importers.entries()) {
83
+ try {
84
+ const result = await this.importFromPlatform(platform, importer);
85
+ results.push({ status: 'fulfilled', value: result });
86
+ }
87
+ catch (error) {
88
+ results.push({
89
+ status: 'rejected',
90
+ reason: error,
91
+ });
92
+ }
93
+ }
94
+ return this.aggregateResults(results);
95
+ }
96
+ /**
97
+ * Import from a single platform with progress tracking
98
+ */
99
+ async importFromPlatform(platform, importer) {
100
+ const errors = [];
101
+ const items = [];
102
+ try {
103
+ // Use pagination for progress tracking
104
+ for await (const page of importer.paginate(this.config.importConfig)) {
105
+ items.push(...page);
106
+ // Report progress
107
+ if (this.config.onProgress) {
108
+ this.config.onProgress(platform, items.length);
109
+ }
110
+ }
111
+ }
112
+ catch (error) {
113
+ errors.push(error.message || String(error));
114
+ }
115
+ return {
116
+ count: items.length,
117
+ items,
118
+ errors,
119
+ platform: importer.platform,
120
+ };
121
+ }
122
+ /**
123
+ * Aggregate results from all platforms
124
+ */
125
+ aggregateResults(results) {
126
+ const allResults = [];
127
+ const allItems = [];
128
+ const errors = {};
129
+ const platforms = [];
130
+ for (const result of results) {
131
+ if (result.status === 'fulfilled') {
132
+ const importResult = result.value;
133
+ allResults.push(importResult);
134
+ allItems.push(...importResult.items);
135
+ platforms.push(importResult.platform);
136
+ if (importResult.errors.length > 0) {
137
+ errors[importResult.platform] = importResult.errors;
138
+ }
139
+ }
140
+ else {
141
+ // Rejected promise
142
+ const error = result.reason;
143
+ const errorMsg = error?.message || String(error);
144
+ // Try to determine which platform failed
145
+ const platformMatch = errorMsg.match(/(GitHub|JIRA|ADO)/i);
146
+ const platform = platformMatch ? platformMatch[1].toLowerCase() : 'unknown';
147
+ errors[platform] = errors[platform] || [];
148
+ errors[platform].push(errorMsg);
149
+ }
150
+ }
151
+ return {
152
+ results: allResults,
153
+ totalCount: allItems.length,
154
+ allItems,
155
+ errors,
156
+ platforms,
157
+ };
158
+ }
159
+ /**
160
+ * Import from a specific platform only
161
+ */
162
+ async importFrom(platform) {
163
+ const importer = this.importers.get(platform);
164
+ if (!importer) {
165
+ throw new Error(`${platform} importer not configured`);
166
+ }
167
+ return this.importFromPlatform(platform, importer);
168
+ }
169
+ /**
170
+ * Get list of configured platforms
171
+ */
172
+ getConfiguredPlatforms() {
173
+ return Array.from(this.importers.keys());
174
+ }
175
+ /**
176
+ * Check if a platform is configured
177
+ */
178
+ isPlatformConfigured(platform) {
179
+ return this.importers.has(platform);
180
+ }
181
+ }
182
+ //# sourceMappingURL=import-coordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-coordinator.js","sourceRoot":"","sources":["../../../src/importers/import-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmDhD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI5B,YAAY,MAAyB;QAH7B,cAAS,GAA0B,IAAI,GAAG,EAAE,CAAC;QAInD,IAAI,CAAC,MAAM,GAA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,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,QAAQ;YACR,MAAM;YACN,SAAS;SACV,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,QAAmC;QAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE9C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,0BAA0B,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,sBAAsB;QACpB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAqC,CAAC;IAC/E,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,QAAmC;QACtD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Item Converter
3
+ *
4
+ * Converts external items (GitHub/JIRA/ADO) to SpecWeave living docs User Stories.
5
+ * CRITICAL: Does NOT create increments - only creates living docs.
6
+ */
7
+ import type { ExternalItem } from './external-importer.js';
8
+ export interface ConvertedUserStory {
9
+ /** User Story ID with E suffix (e.g., US-001E) */
10
+ id: string;
11
+ /** User Story title */
12
+ title: string;
13
+ /** User Story description */
14
+ description: string;
15
+ /** Acceptance criteria */
16
+ acceptanceCriteria: string[];
17
+ /** Priority (P0-P4) */
18
+ priority?: string;
19
+ /** Status (open, in-progress, completed) */
20
+ status: string;
21
+ /** External metadata */
22
+ metadata: {
23
+ externalId: string;
24
+ externalUrl: string;
25
+ externalPlatform: 'github' | 'jira' | 'ado';
26
+ importedAt: string;
27
+ createdAt: string;
28
+ updatedAt: string;
29
+ labels: string[];
30
+ };
31
+ /** Living docs file path */
32
+ filePath: string;
33
+ /** Living docs markdown content */
34
+ markdown: string;
35
+ }
36
+ export interface ItemConverterOptions {
37
+ /** Base directory for living docs (e.g., .specweave/docs/internal/specs) */
38
+ specsDir: string;
39
+ /** Starting US-ID number for imported items (default: 1) */
40
+ startingId?: number;
41
+ /** Project root for FS-ID allocator and ID registry */
42
+ projectRoot?: string;
43
+ /** Enable feature-level organization with FS-ID allocation */
44
+ enableFeatureAllocation?: boolean;
45
+ }
46
+ /**
47
+ * Convert external items to living docs User Stories
48
+ *
49
+ * CRITICAL: This function ONLY creates living docs files.
50
+ * It does NOT create increments or populate .specweave/increments/.
51
+ */
52
+ export declare class ItemConverter {
53
+ private options;
54
+ constructor(options: ItemConverterOptions);
55
+ /**
56
+ * Convert a single external item to a User Story with E suffix
57
+ */
58
+ convertItem(item: ExternalItem, usId: number): ConvertedUserStory;
59
+ /**
60
+ * Convert multiple external items to User Stories
61
+ *
62
+ * CRITICAL: This method ONLY creates living docs files.
63
+ * It does NOT create increments.
64
+ */
65
+ convertItems(items: ExternalItem[]): Promise<ConvertedUserStory[]>;
66
+ /**
67
+ * Map external status to SpecWeave status
68
+ */
69
+ private mapStatus;
70
+ /**
71
+ * Generate origin badge for living docs
72
+ */
73
+ private generateOriginBadge;
74
+ /**
75
+ * Generate markdown content for living docs User Story
76
+ */
77
+ private generateMarkdown;
78
+ /**
79
+ * Generate file name for living docs User Story
80
+ *
81
+ * Format: us-001e-title-here.md
82
+ */
83
+ private generateFileName;
84
+ /**
85
+ * Validate that no increments were created
86
+ *
87
+ * CRITICAL: This validation ensures we're not auto-creating increments.
88
+ */
89
+ static validateNoIncrementsCreated(projectRoot: string): void;
90
+ }
91
+ //# sourceMappingURL=item-converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-converter.d.ts","sourceRoot":"","sources":["../../../src/importers/item-converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO3D,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IAEX,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IAEpB,0BAA0B;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAE7B,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IAEf,wBAAwB;IACxB,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;QAC5C,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;IAEF,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IAEjB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IAEjB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,8DAA8D;IAC9D,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAuB;gBAE1B,OAAO,EAAE,oBAAo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