specweave 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CLAUDE.md +307 -11
  2. package/README.md +41 -3
  3. package/dist/cli/commands/import-docs.d.ts +21 -0
  4. package/dist/cli/commands/import-docs.d.ts.map +1 -0
  5. package/dist/cli/commands/import-docs.js +146 -0
  6. package/dist/cli/commands/import-docs.js.map +1 -0
  7. package/dist/cli/commands/init-multiproject.d.ts +11 -0
  8. package/dist/cli/commands/init-multiproject.d.ts.map +1 -0
  9. package/dist/cli/commands/init-multiproject.js +202 -0
  10. package/dist/cli/commands/init-multiproject.js.map +1 -0
  11. package/dist/cli/commands/init.d.ts.map +1 -1
  12. package/dist/cli/commands/init.js +7 -3
  13. package/dist/cli/commands/init.js.map +1 -1
  14. package/dist/cli/commands/migrate-to-multiproject.d.ts +37 -0
  15. package/dist/cli/commands/migrate-to-multiproject.d.ts.map +1 -0
  16. package/dist/cli/commands/migrate-to-multiproject.js +189 -0
  17. package/dist/cli/commands/migrate-to-multiproject.js.map +1 -0
  18. package/dist/cli/commands/migrate-to-profiles.d.ts +25 -0
  19. package/dist/cli/commands/migrate-to-profiles.d.ts.map +1 -0
  20. package/dist/cli/commands/migrate-to-profiles.js +350 -0
  21. package/dist/cli/commands/migrate-to-profiles.js.map +1 -0
  22. package/dist/cli/commands/switch-project.d.ts +13 -0
  23. package/dist/cli/commands/switch-project.d.ts.map +1 -0
  24. package/dist/cli/commands/switch-project.js +91 -0
  25. package/dist/cli/commands/switch-project.js.map +1 -0
  26. package/dist/cli/helpers/issue-tracker/index.js +4 -4
  27. package/dist/cli/helpers/issue-tracker/index.js.map +1 -1
  28. package/dist/cli/helpers/issue-tracker/utils.d.ts +6 -3
  29. package/dist/cli/helpers/issue-tracker/utils.d.ts.map +1 -1
  30. package/dist/cli/helpers/issue-tracker/utils.js +9 -7
  31. package/dist/cli/helpers/issue-tracker/utils.js.map +1 -1
  32. package/dist/core/brownfield/analyzer.d.ts +86 -0
  33. package/dist/core/brownfield/analyzer.d.ts.map +1 -0
  34. package/dist/core/brownfield/analyzer.js +365 -0
  35. package/dist/core/brownfield/analyzer.js.map +1 -0
  36. package/dist/core/brownfield/importer.d.ts +76 -0
  37. package/dist/core/brownfield/importer.d.ts.map +1 -0
  38. package/dist/core/brownfield/importer.js +287 -0
  39. package/dist/core/brownfield/importer.js.map +1 -0
  40. package/dist/core/config-manager.d.ts +47 -0
  41. package/dist/core/config-manager.d.ts.map +1 -0
  42. package/dist/core/config-manager.js +136 -0
  43. package/dist/core/config-manager.js.map +1 -0
  44. package/dist/core/project-manager.d.ts +127 -0
  45. package/dist/core/project-manager.d.ts.map +1 -0
  46. package/dist/core/project-manager.js +524 -0
  47. package/dist/core/project-manager.js.map +1 -0
  48. package/dist/core/sync/profile-manager.d.ts +72 -0
  49. package/dist/core/sync/profile-manager.d.ts.map +1 -0
  50. package/dist/core/sync/profile-manager.js +338 -0
  51. package/dist/core/sync/profile-manager.js.map +1 -0
  52. package/dist/core/sync/profile-selector.d.ts +52 -0
  53. package/dist/core/sync/profile-selector.d.ts.map +1 -0
  54. package/dist/core/sync/profile-selector.js +179 -0
  55. package/dist/core/sync/profile-selector.js.map +1 -0
  56. package/dist/core/sync/project-context.d.ts +81 -0
  57. package/dist/core/sync/project-context.d.ts.map +1 -0
  58. package/dist/core/sync/project-context.js +354 -0
  59. package/dist/core/sync/project-context.js.map +1 -0
  60. package/dist/core/sync/rate-limiter.d.ts +116 -0
  61. package/dist/core/sync/rate-limiter.d.ts.map +1 -0
  62. package/dist/core/sync/rate-limiter.js +308 -0
  63. package/dist/core/sync/rate-limiter.js.map +1 -0
  64. package/dist/core/sync/time-range-selector.d.ts +48 -0
  65. package/dist/core/sync/time-range-selector.d.ts.map +1 -0
  66. package/dist/core/sync/time-range-selector.js +224 -0
  67. package/dist/core/sync/time-range-selector.js.map +1 -0
  68. package/dist/core/types/config.d.ts +4 -0
  69. package/dist/core/types/config.d.ts.map +1 -1
  70. package/dist/core/types/config.js.map +1 -1
  71. package/dist/core/types/sync-profile.d.ts +205 -0
  72. package/dist/core/types/sync-profile.d.ts.map +1 -0
  73. package/dist/core/types/sync-profile.js +8 -0
  74. package/dist/core/types/sync-profile.js.map +1 -0
  75. package/dist/utils/project-detection.d.ts +141 -0
  76. package/dist/utils/project-detection.d.ts.map +1 -0
  77. package/dist/utils/project-detection.js +321 -0
  78. package/dist/utils/project-detection.js.map +1 -0
  79. package/package.json +2 -1
  80. package/plugins/specweave/agents/pm/AGENT.md +7 -4
  81. package/plugins/specweave/commands/specweave-abandon.md +17 -17
  82. package/plugins/specweave/commands/specweave-check-tests.md +14 -14
  83. package/plugins/specweave/commands/specweave-costs.md +1 -1
  84. package/plugins/specweave/commands/specweave-do.md +12 -12
  85. package/plugins/specweave/commands/specweave-done.md +28 -15
  86. package/plugins/specweave/commands/specweave-import-docs.md +212 -0
  87. package/plugins/specweave/commands/specweave-increment.md +10 -10
  88. package/plugins/specweave/commands/specweave-init-multiproject.md +146 -0
  89. package/plugins/specweave/commands/specweave-next.md +16 -16
  90. package/plugins/specweave/commands/specweave-pause.md +17 -17
  91. package/plugins/specweave/commands/specweave-progress.md +10 -10
  92. package/plugins/specweave/commands/specweave-qa.md +11 -11
  93. package/plugins/specweave/commands/specweave-resume.md +22 -22
  94. package/plugins/specweave/commands/specweave-status.md +18 -18
  95. package/plugins/specweave/commands/specweave-switch-project.md +168 -0
  96. package/plugins/specweave/commands/specweave-sync-docs.md +1 -1
  97. package/plugins/specweave/commands/specweave-sync-tasks.md +9 -9
  98. package/plugins/specweave/commands/specweave-tdd-cycle.md +7 -0
  99. package/plugins/specweave/commands/specweave-tdd-green.md +7 -0
  100. package/plugins/specweave/commands/specweave-tdd-red.md +7 -0
  101. package/plugins/specweave/commands/specweave-tdd-refactor.md +7 -0
  102. package/plugins/specweave/commands/specweave-translate.md +1 -1
  103. package/plugins/specweave/commands/specweave-update-scope.md +8 -8
  104. package/plugins/specweave/commands/specweave-validate.md +18 -20
  105. package/plugins/specweave/commands/specweave.md +5 -5
  106. package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
  107. package/plugins/specweave/skills/increment-planner/SKILL.md +40 -4
  108. package/plugins/specweave/skills/increment-quality-judge/SKILL.md +5 -5
  109. package/plugins/specweave/skills/increment-quality-judge-v2/SKILL.md +5 -5
  110. package/plugins/specweave/skills/specweave-detector/SKILL.md +3 -3
  111. package/plugins/specweave-ado/commands/{close-workitem.md → specweave-ado-close-workitem.md} +1 -1
  112. package/plugins/specweave-ado/commands/{create-workitem.md → specweave-ado-create-workitem.md} +1 -1
  113. package/plugins/specweave-ado/commands/{status.md → specweave-ado-status.md} +1 -1
  114. package/plugins/specweave-ado/commands/{sync.md → specweave-ado-sync.md} +1 -1
  115. package/plugins/specweave-ado/lib/ado-client-v2.ts +547 -0
  116. package/plugins/specweave-github/commands/{close-issue.md → specweave-github-close-issue.md} +1 -1
  117. package/plugins/specweave-github/commands/{create-issue.md → specweave-github-create-issue.md} +1 -1
  118. package/plugins/specweave-github/commands/{status.md → specweave-github-status.md} +1 -1
  119. package/plugins/specweave-github/commands/{sync-tasks.md → specweave-github-sync-tasks.md} +1 -1
  120. package/plugins/specweave-github/commands/specweave-github-sync.md +568 -0
  121. package/plugins/specweave-github/lib/github-client-v2.ts +555 -0
  122. package/plugins/specweave-infrastructure/commands/{monitor-setup.md → specweave-infrastructure-monitor-setup.md} +1 -1
  123. package/plugins/specweave-infrastructure/commands/{slo-implement.md → specweave-infrastructure-slo-implement.md} +1 -1
  124. package/plugins/specweave-jira/commands/{sync.md → specweave-jira-sync.md} +1 -1
  125. package/plugins/specweave-jira/lib/jira-client-v2.ts +529 -0
  126. package/plugins/specweave-ml/commands/{ml-deploy.md → specweave-ml-deploy.md} +1 -1
  127. package/plugins/specweave-ml/commands/{ml-evaluate.md → specweave-ml-evaluate.md} +1 -1
  128. package/plugins/specweave-ml/commands/{ml-explain.md → specweave-ml-explain.md} +1 -1
  129. package/plugins/specweave-ml/commands/{ml-pipeline.md → specweave-ml-pipeline.md} +1 -1
  130. package/src/templates/AGENTS.md.template +1 -0
  131. package/src/templates/CLAUDE.md.template +1 -0
  132. package/plugins/specweave-github/commands/sync.md +0 -443
  133. /package/plugins/specweave/{commands/README.md → COMMANDS.md} +0 -0
@@ -0,0 +1,287 @@
1
+ /**
2
+ * Brownfield Importer - Import External Documentation
3
+ *
4
+ * Imports brownfield documentation from Notion, Confluence, Wiki, etc.
5
+ * Classifies files and copies to appropriate destinations
6
+ */
7
+ import path from 'path';
8
+ import fs from 'fs-extra';
9
+ import { BrownfieldAnalyzer } from './analyzer';
10
+ import { ProjectManager } from '../project-manager';
11
+ import { ConfigManager } from '../config-manager';
12
+ export class BrownfieldImporter {
13
+ constructor(projectRoot) {
14
+ this.projectRoot = projectRoot;
15
+ this.analyzer = new BrownfieldAnalyzer();
16
+ this.projectManager = new ProjectManager(projectRoot);
17
+ this.configManager = new ConfigManager(projectRoot);
18
+ }
19
+ /**
20
+ * Import brownfield docs
21
+ *
22
+ * @param options - Import options
23
+ * @returns ImportReport
24
+ */
25
+ async import(options) {
26
+ console.log(`\n🔍 Analyzing ${options.sourcePath}...`);
27
+ // Validate source path
28
+ if (!(await fs.pathExists(options.sourcePath))) {
29
+ throw new Error(`Source path does not exist: ${options.sourcePath}`);
30
+ }
31
+ // Validate project exists
32
+ const project = this.projectManager.getProjectById(options.project);
33
+ if (!project) {
34
+ throw new Error(`Project '${options.project}' not found. Create it first with /specweave:init-multiproject`);
35
+ }
36
+ // 1. Analyze files
37
+ const analysis = await this.analyzer.analyze(options.sourcePath);
38
+ if (analysis.totalFiles === 0) {
39
+ throw new Error('No markdown files found in source directory');
40
+ }
41
+ console.log(`\n📊 Analysis Results:`);
42
+ console.log(` Total files: ${analysis.totalFiles}`);
43
+ console.log(` - Specs: ${analysis.specs.length} (${(analysis.statistics.specsConfidence * 100).toFixed(0)}% avg confidence)`);
44
+ console.log(` - Modules: ${analysis.modules.length} (${(analysis.statistics.modulesConfidence * 100).toFixed(0)}% avg confidence)`);
45
+ console.log(` - Team docs: ${analysis.team.length} (${(analysis.statistics.teamConfidence * 100).toFixed(0)}% avg confidence)`);
46
+ console.log(` - Legacy: ${analysis.legacy.length}\n`);
47
+ // Dry run mode - just show analysis
48
+ if (options.dryRun) {
49
+ console.log('🔍 Dry run mode - no files will be imported\n');
50
+ const report = this.analyzer.generateSummaryReport(analysis);
51
+ console.log(report);
52
+ return {
53
+ totalFiles: analysis.totalFiles,
54
+ specsImported: 0,
55
+ modulesImported: 0,
56
+ teamImported: 0,
57
+ legacyImported: 0,
58
+ destination: this.projectManager.getLegacyPath(options.source, options.project),
59
+ timestamp: new Date().toISOString(),
60
+ classifications: {
61
+ specs: analysis.specs,
62
+ modules: analysis.modules,
63
+ team: analysis.team,
64
+ legacy: analysis.legacy
65
+ }
66
+ };
67
+ }
68
+ // 2. Confirm with user (in real usage, this would be an interactive prompt)
69
+ console.log('📦 Importing files...\n');
70
+ // 3. Import specs
71
+ const specsPath = this.projectManager.getSpecsPath(options.project);
72
+ await this.importFiles(analysis.specs, specsPath, options.preserveStructure, options.sourcePath);
73
+ console.log(`✅ Imported ${analysis.specs.length} spec(s) to specs/`);
74
+ // 4. Import modules
75
+ const modulesPath = this.projectManager.getModulesPath(options.project);
76
+ await this.importFiles(analysis.modules, modulesPath, options.preserveStructure, options.sourcePath);
77
+ console.log(`✅ Imported ${analysis.modules.length} module doc(s) to modules/`);
78
+ // 5. Import team docs
79
+ const teamPath = this.projectManager.getTeamPath(options.project);
80
+ await this.importFiles(analysis.team, teamPath, options.preserveStructure, options.sourcePath);
81
+ console.log(`✅ Imported ${analysis.team.length} team doc(s) to team/`);
82
+ // 6. Import legacy
83
+ const legacyPath = this.projectManager.getLegacyPath(options.source, options.project);
84
+ await this.importFiles(analysis.legacy, legacyPath, options.preserveStructure, options.sourcePath);
85
+ console.log(`✅ Imported ${analysis.legacy.length} legacy doc(s) to legacy/${options.source}/`);
86
+ // 7. Create migration report
87
+ const report = {
88
+ totalFiles: analysis.totalFiles,
89
+ specsImported: analysis.specs.length,
90
+ modulesImported: analysis.modules.length,
91
+ teamImported: analysis.team.length,
92
+ legacyImported: analysis.legacy.length,
93
+ destination: this.projectManager.getLegacyPath(options.source, options.project),
94
+ timestamp: new Date().toISOString(),
95
+ classifications: {
96
+ specs: analysis.specs,
97
+ modules: analysis.modules,
98
+ team: analysis.team,
99
+ legacy: analysis.legacy
100
+ }
101
+ };
102
+ await this.createMigrationReport(options, report, analysis);
103
+ // 8. Update config
104
+ await this.updateConfig(options, report);
105
+ console.log('\n✅ Import complete!\n');
106
+ console.log(`📄 Migration report: ${path.join(legacyPath, '../README.md')}\n`);
107
+ return report;
108
+ }
109
+ /**
110
+ * Import files to destination
111
+ *
112
+ * @param files - Files to import
113
+ * @param destination - Destination directory
114
+ * @param preserveStructure - Preserve original folder structure
115
+ * @param basePath - Base path for relative path calculation
116
+ */
117
+ async importFiles(files, destination, preserveStructure = false, basePath) {
118
+ await fs.ensureDir(destination);
119
+ for (const file of files) {
120
+ let destPath;
121
+ if (preserveStructure) {
122
+ // Preserve folder structure
123
+ const relativePath = path.relative(basePath, file.path);
124
+ destPath = path.join(destination, relativePath);
125
+ // Ensure parent directory exists
126
+ await fs.ensureDir(path.dirname(destPath));
127
+ }
128
+ else {
129
+ // Flatten structure - just use filename
130
+ const fileName = path.basename(file.path);
131
+ destPath = path.join(destination, fileName);
132
+ // Handle duplicate filenames
133
+ if (await fs.pathExists(destPath)) {
134
+ const ext = path.extname(fileName);
135
+ const base = path.basename(fileName, ext);
136
+ const timestamp = Date.now();
137
+ destPath = path.join(destination, `${base}-${timestamp}${ext}`);
138
+ }
139
+ }
140
+ await fs.copy(file.path, destPath);
141
+ }
142
+ }
143
+ /**
144
+ * Create migration report in legacy/ folder
145
+ *
146
+ * @param options - Import options
147
+ * @param report - Import report
148
+ * @param analysis - Analysis result
149
+ */
150
+ async createMigrationReport(options, report, analysis) {
151
+ const legacyBasePath = this.projectManager.getLegacyPath(undefined, options.project);
152
+ const legacyREADME = path.join(legacyBasePath, 'README.md');
153
+ // Generate analysis summary
154
+ const analysisReport = this.analyzer.generateSummaryReport(analysis);
155
+ const content = `# Brownfield Migration Report
156
+
157
+ **Source**: ${options.source}
158
+ **Source Path**: ${options.sourcePath}
159
+ **Imported**: ${report.timestamp}
160
+ **Total Files**: ${report.totalFiles}
161
+
162
+ ## Import Summary
163
+
164
+ - **Specs**: ${report.specsImported} files → \`specs/\`
165
+ - **Modules**: ${report.modulesImported} files → \`modules/\`
166
+ - **Team Docs**: ${report.teamImported} files → \`team/\`
167
+ - **Legacy**: ${report.legacyImported} files → \`legacy/${options.source}/\`
168
+
169
+ ## Classification Analysis
170
+
171
+ ${analysisReport}
172
+
173
+ ## Next Steps
174
+
175
+ 1. **Review imported files** for accuracy
176
+ 2. **Manually move misclassified files** if needed:
177
+ - Use file manager or git to move files between folders
178
+ - Update references in other docs if needed
179
+ 3. **Update spec numbers** to follow SpecWeave conventions:
180
+ - Specs should be numbered: \`spec-001-feature-name.md\`
181
+ - Current files may have different naming
182
+ 4. **Clean up legacy folder** when migration is complete:
183
+ - Move useful docs to appropriate folders
184
+ - Delete obsolete or duplicate content
185
+ 5. **Update team docs** to match SpecWeave templates:
186
+ - See \`team/README.md\` for template guidance
187
+
188
+ ## Migration Notes
189
+
190
+ ### Structure Preservation
191
+ ${options.preserveStructure ?
192
+ '✅ Original folder structure preserved' :
193
+ '📁 Files flattened to destination folders (no subdirectories)'}
194
+
195
+ ### Confidence Scores
196
+
197
+ Files were classified with confidence scores (0-100%):
198
+ - **70%+**: High confidence (likely correct)
199
+ - **50-70%**: Medium confidence (review recommended)
200
+ - **30-50%**: Low confidence (likely legacy)
201
+ - **<30%**: No match (moved to legacy)
202
+
203
+ ### Common Issues
204
+
205
+ **Misclassified files?**
206
+ - Check confidence scores in analysis above
207
+ - Files with low confidence may be in wrong folder
208
+ - Manually move files as needed
209
+
210
+ **Duplicate content?**
211
+ - Compare imported files with existing docs
212
+ - Merge duplicates or mark for deletion
213
+ - Update cross-references
214
+
215
+ **Outdated information?**
216
+ - Review dates and version numbers
217
+ - Mark obsolete docs for deletion
218
+ - Update references to current systems
219
+
220
+ ## Source Information
221
+
222
+ - **Type**: ${options.source}
223
+ - **Source Path**: \`${options.sourcePath}\`
224
+ - **Destination**: \`${report.destination}\`
225
+ - **Project**: ${options.project}
226
+
227
+ ## Import History
228
+
229
+ See \`.specweave/config.json\` → \`brownfield.importHistory\` for complete import history.
230
+
231
+ ---
232
+
233
+ **Generated**: ${new Date().toISOString()}
234
+ **Tool**: SpecWeave Brownfield Importer
235
+ `;
236
+ await fs.writeFile(legacyREADME, content);
237
+ }
238
+ /**
239
+ * Update config with import history
240
+ *
241
+ * @param options - Import options
242
+ * @param report - Import report
243
+ */
244
+ async updateConfig(options, report) {
245
+ const config = this.configManager.load();
246
+ if (!config.brownfield) {
247
+ config.brownfield = { importHistory: [] };
248
+ }
249
+ config.brownfield.importHistory.push({
250
+ source: options.source,
251
+ workspace: path.basename(options.sourcePath),
252
+ importedAt: report.timestamp,
253
+ project: options.project,
254
+ filesImported: report.totalFiles,
255
+ destination: report.destination
256
+ });
257
+ await this.configManager.save(config);
258
+ }
259
+ /**
260
+ * Preview import (dry run)
261
+ *
262
+ * @param options - Import options
263
+ * @returns Analysis result as string
264
+ */
265
+ async preview(options) {
266
+ const dryRunOptions = { ...options, dryRun: true };
267
+ const report = await this.import(dryRunOptions);
268
+ return this.analyzer.generateSummaryReport({
269
+ totalFiles: report.totalFiles,
270
+ specs: report.classifications.specs,
271
+ modules: report.classifications.modules,
272
+ team: report.classifications.team,
273
+ legacy: report.classifications.legacy,
274
+ statistics: {
275
+ specsConfidence: this.calculateAvgConfidence(report.classifications.specs),
276
+ modulesConfidence: this.calculateAvgConfidence(report.classifications.modules),
277
+ teamConfidence: this.calculateAvgConfidence(report.classifications.team)
278
+ }
279
+ });
280
+ }
281
+ calculateAvgConfidence(files) {
282
+ if (files.length === 0)
283
+ return 0;
284
+ return files.reduce((sum, file) => sum + file.confidence, 0) / files.length;
285
+ }
286
+ }
287
+ //# sourceMappingURL=importer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importer.js","sourceRoot":"","sources":["../../../src/core/brownfield/importer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAsB,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA0BlD,MAAM,OAAO,kBAAkB;IAM7B,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,OAAsB;QACjC,OAAO,CAAC,GAAG,CAAC,kBAAkB,OAAO,CAAC,UAAU,KAAK,CAAC,CAAC;QAEvD,uBAAuB;QACvB,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,0BAA0B;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,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IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;YACzC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC,KAAK;YACnC,OAAO,EAAE,MAAM,CAAC,eAAe,CAAC,OAAO;YACvC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,IAAI;YACjC,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,MAAM;YACrC,UAAU,EAAE;gBACV,eAAe,EAAE,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC;gBAC1E,iBAAiB,EAAE,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC;gBAC9E,cAAc,EAAE,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC;aACzE;SACF,CAAC,CAAC;IACL,CAAC;IAEO,sBAAsB,CAAC,KAA2B;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QACjC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAC9E,CAAC;CACF"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * ConfigManager - Load and save SpecWeave configuration
3
+ *
4
+ * Central manager for .specweave/config.json file operations.
5
+ * Provides type-safe access to configuration with defaults.
6
+ */
7
+ import { SpecweaveConfig } from './types/config.js';
8
+ export declare class ConfigManager {
9
+ private projectRoot;
10
+ private configPath;
11
+ private cachedConfig;
12
+ constructor(projectRoot: string);
13
+ /**
14
+ * Load configuration from .specweave/config.json
15
+ * Returns default config if file doesn't exist
16
+ */
17
+ load(): SpecweaveConfig;
18
+ /**
19
+ * Load configuration asynchronously
20
+ */
21
+ loadAsync(): Promise<SpecweaveConfig>;
22
+ /**
23
+ * Save configuration to .specweave/config.json
24
+ */
25
+ save(config: SpecweaveConfig): Promise<void>;
26
+ /**
27
+ * Save configuration synchronously
28
+ */
29
+ saveSync(config: SpecweaveConfig): void;
30
+ /**
31
+ * Get config path
32
+ */
33
+ getConfigPath(): string;
34
+ /**
35
+ * Clear cached config (force reload on next load())
36
+ */
37
+ clearCache(): void;
38
+ /**
39
+ * Check if config file exists
40
+ */
41
+ exists(): boolean;
42
+ /**
43
+ * Check if config file exists (async)
44
+ */
45
+ existsAsync(): Promise<boolean>;
46
+ }
47
+ //# sourceMappingURL=config-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/core/config-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAC;AAEpE,qBAAa,aAAa;IACxB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAgC;gBAExC,WAAW,EAAE,MAAM;IAK/B;;;OAGG;IACH,IAAI,IAAI,eAAe;IAgCvB;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;IAgC3C;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAelD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAevC;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAGtC"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * ConfigManager - Load and save SpecWeave configuration
3
+ *
4
+ * Central manager for .specweave/config.json file operations.
5
+ * Provides type-safe access to configuration with defaults.
6
+ */
7
+ import fs from 'fs-extra';
8
+ import path from 'path';
9
+ import { DEFAULT_CONFIG } from './types/config.js';
10
+ export class ConfigManager {
11
+ constructor(projectRoot) {
12
+ this.cachedConfig = null;
13
+ this.projectRoot = projectRoot;
14
+ this.configPath = path.join(projectRoot, '.specweave', 'config.json');
15
+ }
16
+ /**
17
+ * Load configuration from .specweave/config.json
18
+ * Returns default config if file doesn't exist
19
+ */
20
+ load() {
21
+ // Return cached config if available
22
+ if (this.cachedConfig) {
23
+ return this.cachedConfig;
24
+ }
25
+ // Check if config file exists
26
+ if (!fs.existsSync(this.configPath)) {
27
+ // Return default config
28
+ this.cachedConfig = { ...DEFAULT_CONFIG };
29
+ return this.cachedConfig;
30
+ }
31
+ try {
32
+ // Read and parse config file
33
+ const data = fs.readJSONSync(this.configPath);
34
+ // Merge with defaults to ensure all required fields exist
35
+ this.cachedConfig = {
36
+ ...DEFAULT_CONFIG,
37
+ ...data,
38
+ };
39
+ return this.cachedConfig;
40
+ }
41
+ catch (error) {
42
+ console.error(`⚠️ Failed to load config from ${this.configPath}:`, error);
43
+ // Return default config on error
44
+ this.cachedConfig = { ...DEFAULT_CONFIG };
45
+ return this.cachedConfig;
46
+ }
47
+ }
48
+ /**
49
+ * Load configuration asynchronously
50
+ */
51
+ async loadAsync() {
52
+ // Return cached config if available
53
+ if (this.cachedConfig) {
54
+ return this.cachedConfig;
55
+ }
56
+ // Check if config file exists
57
+ if (!(await fs.pathExists(this.configPath))) {
58
+ // Return default config
59
+ this.cachedConfig = { ...DEFAULT_CONFIG };
60
+ return this.cachedConfig;
61
+ }
62
+ try {
63
+ // Read and parse config file
64
+ const data = await fs.readJSON(this.configPath);
65
+ // Merge with defaults to ensure all required fields exist
66
+ this.cachedConfig = {
67
+ ...DEFAULT_CONFIG,
68
+ ...data,
69
+ };
70
+ return this.cachedConfig;
71
+ }
72
+ catch (error) {
73
+ console.error(`⚠️ Failed to load config from ${this.configPath}:`, error);
74
+ // Return default config on error
75
+ this.cachedConfig = { ...DEFAULT_CONFIG };
76
+ return this.cachedConfig;
77
+ }
78
+ }
79
+ /**
80
+ * Save configuration to .specweave/config.json
81
+ */
82
+ async save(config) {
83
+ try {
84
+ // Ensure .specweave directory exists
85
+ await fs.ensureDir(path.dirname(this.configPath));
86
+ // Write config to file
87
+ await fs.writeJSON(this.configPath, config, { spaces: 2 });
88
+ // Update cache
89
+ this.cachedConfig = config;
90
+ }
91
+ catch (error) {
92
+ throw new Error(`Failed to save config to ${this.configPath}: ${error instanceof Error ? error.message : String(error)}`);
93
+ }
94
+ }
95
+ /**
96
+ * Save configuration synchronously
97
+ */
98
+ saveSync(config) {
99
+ try {
100
+ // Ensure .specweave directory exists
101
+ fs.ensureDirSync(path.dirname(this.configPath));
102
+ // Write config to file
103
+ fs.writeJSONSync(this.configPath, config, { spaces: 2 });
104
+ // Update cache
105
+ this.cachedConfig = config;
106
+ }
107
+ catch (error) {
108
+ throw new Error(`Failed to save config to ${this.configPath}: ${error instanceof Error ? error.message : String(error)}`);
109
+ }
110
+ }
111
+ /**
112
+ * Get config path
113
+ */
114
+ getConfigPath() {
115
+ return this.configPath;
116
+ }
117
+ /**
118
+ * Clear cached config (force reload on next load())
119
+ */
120
+ clearCache() {
121
+ this.cachedConfig = null;
122
+ }
123
+ /**
124
+ * Check if config file exists
125
+ */
126
+ exists() {
127
+ return fs.existsSync(this.configPath);
128
+ }
129
+ /**
130
+ * Check if config file exists (async)
131
+ */
132
+ async existsAsync() {
133
+ return fs.pathExists(this.configPath);
134
+ }
135
+ }
136
+ //# sourceMappingURL=config-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../../src/core/config-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAmB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,OAAO,aAAa;IAKxB,Y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O,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5H,CAAC;IACH,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,MAAuB;QAC9B,IAAI,CAAC;YACH,qCAAqC;YACrC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;YAEhD,uBAAuB;YACvB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;YAEzD,eAAe;YACf,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,CAAC,UAAU,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5H,CAAC;IACH,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * ProjectManager - Multi-project support for SpecWeave
3
+ *
4
+ * Handles project context, path resolution, and project switching.
5
+ * Key principle: Single project = multi-project with 1 project (no special cases)
6
+ */
7
+ export interface ProjectContext {
8
+ id: string;
9
+ name: string;
10
+ description: string;
11
+ techStack: string[];
12
+ team: string;
13
+ contacts?: {
14
+ lead?: string;
15
+ pm?: string;
16
+ };
17
+ syncProfiles?: string[];
18
+ }
19
+ export interface MultiProjectConfig {
20
+ enabled: boolean;
21
+ activeProject: string;
22
+ projects: ProjectContext[];
23
+ }
24
+ export declare class ProjectManager {
25
+ private configManager;
26
+ private projectRoot;
27
+ private cachedProject;
28
+ constructor(projectRoot: string);
29
+ /**
30
+ * Get current active project
31
+ * Auto-detects project ID from git remote or sync config
32
+ *
33
+ * @returns ProjectContext
34
+ */
35
+ getActiveProject(): ProjectContext;
36
+ /**
37
+ * Get all projects
38
+ *
39
+ * @returns ProjectContext[]
40
+ */
41
+ getAllProjects(): ProjectContext[];
42
+ /**
43
+ * Get project by ID
44
+ *
45
+ * @param projectId - Project identifier
46
+ * @returns ProjectContext or null
47
+ */
48
+ getProjectById(projectId: string): ProjectContext | null;
49
+ /**
50
+ * Get base path for active project
51
+ * Example: .specweave/docs/internal/projects/default/
52
+ *
53
+ * @returns string
54
+ */
55
+ getProjectBasePath(projectId?: string): string;
56
+ /**
57
+ * Get specs path for active project
58
+ * Example: .specweave/docs/internal/projects/default/specs/
59
+ *
60
+ * @returns string
61
+ */
62
+ getSpecsPath(projectId?: string): string;
63
+ /**
64
+ * Get modules path for active project
65
+ * Example: .specweave/docs/internal/projects/default/modules/
66
+ *
67
+ * @returns string
68
+ */
69
+ getModulesPath(projectId?: string): string;
70
+ /**
71
+ * Get team docs path for active project
72
+ * Example: .specweave/docs/internal/projects/default/team/
73
+ *
74
+ * @returns string
75
+ */
76
+ getTeamPath(projectId?: string): string;
77
+ /**
78
+ * Get architecture path for active project
79
+ * Example: .specweave/docs/internal/projects/default/architecture/
80
+ *
81
+ * @returns string
82
+ */
83
+ getArchitecturePath(projectId?: string): string;
84
+ /**
85
+ * Get legacy docs path for active project
86
+ * Example: .specweave/docs/internal/projects/default/legacy/
87
+ * Or with source: .specweave/docs/internal/projects/default/legacy/notion/
88
+ *
89
+ * @param source - Optional source type (notion, confluence, wiki, custom)
90
+ * @returns string
91
+ */
92
+ getLegacyPath(source?: string, projectId?: string): string;
93
+ /**
94
+ * Switch active project
95
+ *
96
+ * @param projectId - Project identifier
97
+ */
98
+ switchProject(projectId: string): Promise<void>;
99
+ /**
100
+ * Create project structure with all folders
101
+ *
102
+ * @param projectId - Project identifier
103
+ */
104
+ createProjectStructure(projectId: string): Promise<void>;
105
+ /**
106
+ * Add new project to config
107
+ *
108
+ * @param project - Project context
109
+ */
110
+ addProject(project: ProjectContext): Promise<void>;
111
+ /**
112
+ * Remove project from config
113
+ *
114
+ * @param projectId - Project identifier
115
+ */
116
+ removeProject(projectId: string): Promise<void>;
117
+ /**
118
+ * Clear cached project (force reload)
119
+ */
120
+ clearCache(): void;
121
+ private createProjectREADME;
122
+ private createModulesREADME;
123
+ private createTeamREADME;
124
+ private createArchitectureREADME;
125
+ private createLegacyREADME;
126
+ }
127
+ //# sourceMappingURL=project-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-manager.d.ts","sourceRoot":"","sources":["../../src/core/project-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,W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