specweave 0.17.7 → 0.17.9
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.
- package/CLAUDE.md +365 -9
- package/dist/locales/de/.gitkeep +0 -0
- package/dist/locales/de/cli.json +108 -0
- package/dist/locales/en/cli.json +287 -0
- package/dist/locales/en/errors.json +7 -0
- package/dist/locales/en/templates.json +6 -0
- package/dist/locales/es/.gitkeep +0 -0
- package/dist/locales/es/cli.json +41 -0
- package/dist/locales/fr/.gitkeep +0 -0
- package/dist/locales/fr/cli.json +108 -0
- package/dist/locales/ja/.gitkeep +0 -0
- package/dist/locales/ja/cli.json +108 -0
- package/dist/locales/ko/.gitkeep +0 -0
- package/dist/locales/ko/cli.json +108 -0
- package/dist/locales/pt/.gitkeep +0 -0
- package/dist/locales/pt/cli.json +108 -0
- package/dist/locales/ru/.gitkeep +0 -0
- package/dist/locales/ru/cli.json +269 -0
- package/dist/locales/zh/.gitkeep +0 -0
- package/dist/locales/zh/cli.json +108 -0
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts +9 -4
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +82 -12
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts +2 -2
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +69 -10
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/src/cli/commands/detect-project.d.ts +9 -0
- package/dist/src/cli/commands/detect-project.d.ts.map +1 -0
- package/dist/src/cli/commands/detect-project.js +85 -0
- package/dist/src/cli/commands/detect-project.js.map +1 -0
- package/dist/src/cli/commands/detect-specs.d.ts +9 -0
- package/dist/src/cli/commands/detect-specs.d.ts.map +1 -0
- package/dist/src/cli/commands/detect-specs.js +73 -0
- package/dist/src/cli/commands/detect-specs.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +8 -15
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/core/living-docs/content-classifier.d.ts +83 -0
- package/dist/src/core/living-docs/content-classifier.d.ts.map +1 -0
- package/dist/src/core/living-docs/content-classifier.js +393 -0
- package/dist/src/core/living-docs/content-classifier.js.map +1 -0
- package/dist/src/core/living-docs/content-distributor.d.ts +126 -0
- package/dist/src/core/living-docs/content-distributor.d.ts.map +1 -0
- package/dist/src/core/living-docs/content-distributor.js +339 -0
- package/dist/src/core/living-docs/content-distributor.js.map +1 -0
- package/dist/src/core/living-docs/content-parser.d.ts +140 -0
- package/dist/src/core/living-docs/content-parser.d.ts.map +1 -0
- package/dist/src/core/living-docs/content-parser.js +316 -0
- package/dist/src/core/living-docs/content-parser.js.map +1 -0
- package/dist/src/core/living-docs/cross-linker.d.ts +126 -0
- package/dist/src/core/living-docs/cross-linker.d.ts.map +1 -0
- package/dist/src/core/living-docs/cross-linker.js +374 -0
- package/dist/src/core/living-docs/cross-linker.js.map +1 -0
- package/dist/src/core/living-docs/index.d.ts +89 -0
- package/dist/src/core/living-docs/index.d.ts.map +1 -0
- package/dist/src/core/living-docs/index.js +169 -0
- package/dist/src/core/living-docs/index.js.map +1 -0
- package/dist/src/core/living-docs/project-detector.d.ts +103 -0
- package/dist/src/core/living-docs/project-detector.d.ts.map +1 -0
- package/dist/src/core/living-docs/project-detector.js +314 -0
- package/dist/src/core/living-docs/project-detector.js.map +1 -0
- package/dist/src/core/repo-structure/prompt-consolidator.d.ts +1 -1
- package/dist/src/core/repo-structure/prompt-consolidator.d.ts.map +1 -1
- package/dist/src/core/repo-structure/prompt-consolidator.js +51 -22
- package/dist/src/core/repo-structure/prompt-consolidator.js.map +1 -1
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts +2 -0
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
- package/dist/src/core/repo-structure/repo-structure-manager.js +126 -62
- package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
- package/dist/src/core/spec-content-sync.d.ts +6 -0
- package/dist/src/core/spec-content-sync.d.ts.map +1 -1
- package/dist/src/core/spec-content-sync.js +25 -7
- package/dist/src/core/spec-content-sync.js.map +1 -1
- package/dist/src/core/spec-detector.d.ts +54 -0
- package/dist/src/core/spec-detector.d.ts.map +1 -0
- package/dist/src/core/spec-detector.js +197 -0
- package/dist/src/core/spec-detector.js.map +1 -0
- package/dist/src/core/spec-identifier-detector.d.ts +49 -0
- package/dist/src/core/spec-identifier-detector.d.ts.map +1 -0
- package/dist/src/core/spec-identifier-detector.js +198 -0
- package/dist/src/core/spec-identifier-detector.js.map +1 -0
- package/dist/src/core/types/spec-identifier.d.ts +67 -0
- package/dist/src/core/types/spec-identifier.d.ts.map +1 -0
- package/dist/src/core/types/spec-identifier.js +23 -0
- package/dist/src/core/types/spec-identifier.js.map +1 -0
- package/dist/src/utils/docs-preview/config-generator.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/config-generator.js +11 -0
- package/dist/src/utils/docs-preview/config-generator.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave/lib/hooks/sync-living-docs.js +61 -5
- package/plugins/specweave/lib/hooks/sync-living-docs.ts +102 -13
- package/plugins/specweave-ado/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-docs-preview/commands/preview.md +11 -11
- package/plugins/specweave-github/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-github/hooks/post-task-completion.sh +59 -30
- package/plugins/specweave-github/lib/github-spec-content-sync.js +55 -6
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +84 -12
- package/plugins/specweave-jira/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-mobile/.claude-plugin/plugin.json +1 -4
- package/plugins/specweave-release/.claude-plugin/plugin.json +3 -15
- package/src/templates/AGENTS.md.template +297 -0
- package/plugins/specweave/plugin.json +0 -22
- package/plugins/specweave-ado/plugin.json +0 -20
- package/plugins/specweave-github/plugin.json +0 -19
- package/plugins/specweave-jira/plugin.json +0 -20
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Distributor for Intelligent Living Docs Sync
|
|
3
|
+
*
|
|
4
|
+
* Distributes classified spec sections to appropriate folders with proper formatting.
|
|
5
|
+
*
|
|
6
|
+
* @module living-docs/content-distributor
|
|
7
|
+
*/
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { ContentCategory } from './content-classifier.js';
|
|
11
|
+
/**
|
|
12
|
+
* Content Distributor class
|
|
13
|
+
*/
|
|
14
|
+
export class ContentDistributor {
|
|
15
|
+
constructor(options = {}) {
|
|
16
|
+
this.options = {
|
|
17
|
+
basePath: options.basePath || path.join(process.cwd(), '.specweave', 'docs', 'internal'),
|
|
18
|
+
generateFrontmatter: options.generateFrontmatter ?? true,
|
|
19
|
+
preserveOriginal: options.preserveOriginal ?? true,
|
|
20
|
+
dryRun: options.dryRun ?? false,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Distribute parsed spec to appropriate locations
|
|
25
|
+
*/
|
|
26
|
+
async distribute(incrementId, spec, classifications, project) {
|
|
27
|
+
const result = {
|
|
28
|
+
created: [],
|
|
29
|
+
updated: [],
|
|
30
|
+
skipped: [],
|
|
31
|
+
errors: [],
|
|
32
|
+
summary: {
|
|
33
|
+
totalSections: classifications.length,
|
|
34
|
+
filesCreated: 0,
|
|
35
|
+
filesUpdated: 0,
|
|
36
|
+
filesSkipped: 0,
|
|
37
|
+
errors: 0,
|
|
38
|
+
byCategory: {},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
// Pair sections with classifications
|
|
42
|
+
const classifiedSections = [];
|
|
43
|
+
const flatSections = this.flattenSections(spec.sections);
|
|
44
|
+
for (let i = 0; i < Math.min(flatSections.length, classifications.length); i++) {
|
|
45
|
+
classifiedSections.push({
|
|
46
|
+
section: flatSections[i],
|
|
47
|
+
classification: classifications[i],
|
|
48
|
+
});
|
|
49
|
+
// Count by category
|
|
50
|
+
const category = classifications[i].category;
|
|
51
|
+
result.summary.byCategory[category] = (result.summary.byCategory[category] || 0) + 1;
|
|
52
|
+
}
|
|
53
|
+
// Group sections by category and file
|
|
54
|
+
const fileGroups = this.groupByFile(classifiedSections, project);
|
|
55
|
+
// Write each file group
|
|
56
|
+
for (const [filePath, group] of fileGroups.entries()) {
|
|
57
|
+
try {
|
|
58
|
+
const fileResult = await this.writeFile(incrementId, filePath, group, spec, project);
|
|
59
|
+
if (fileResult.status === 'created') {
|
|
60
|
+
result.created.push(fileResult.file);
|
|
61
|
+
result.summary.filesCreated++;
|
|
62
|
+
}
|
|
63
|
+
else if (fileResult.status === 'updated') {
|
|
64
|
+
result.updated.push(fileResult.file);
|
|
65
|
+
result.summary.filesUpdated++;
|
|
66
|
+
}
|
|
67
|
+
else if (fileResult.status === 'skipped') {
|
|
68
|
+
result.skipped.push(fileResult.file);
|
|
69
|
+
result.summary.filesSkipped++;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
result.errors.push({
|
|
74
|
+
section: group.sections.map((s) => s.section.heading).join(', '),
|
|
75
|
+
category: group.category,
|
|
76
|
+
error: String(error),
|
|
77
|
+
path: filePath,
|
|
78
|
+
});
|
|
79
|
+
result.summary.errors++;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Preserve original spec if requested
|
|
83
|
+
if (this.options.preserveOriginal) {
|
|
84
|
+
await this.archiveOriginalSpec(incrementId, spec, project);
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Flatten nested sections
|
|
90
|
+
*/
|
|
91
|
+
flattenSections(sections) {
|
|
92
|
+
const result = [];
|
|
93
|
+
for (const section of sections) {
|
|
94
|
+
result.push(section);
|
|
95
|
+
if (section.children.length > 0) {
|
|
96
|
+
result.push(...this.flattenSections(section.children));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Group sections by destination file
|
|
103
|
+
*/
|
|
104
|
+
groupByFile(classifiedSections, project) {
|
|
105
|
+
const groups = new Map();
|
|
106
|
+
for (const item of classifiedSections) {
|
|
107
|
+
const { classification } = item;
|
|
108
|
+
// Skip unknown categories
|
|
109
|
+
if (classification.category === ContentCategory.Unknown) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
// Resolve path with project
|
|
113
|
+
const filePath = this.resolvePath(classification.suggestedPath, classification.suggestedFilename, project);
|
|
114
|
+
if (!groups.has(filePath)) {
|
|
115
|
+
groups.set(filePath, {
|
|
116
|
+
category: classification.category,
|
|
117
|
+
sections: [],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
groups.get(filePath).sections.push(item);
|
|
121
|
+
}
|
|
122
|
+
return groups;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolve file path with project
|
|
126
|
+
*/
|
|
127
|
+
resolvePath(suggestedPath, filename, project) {
|
|
128
|
+
// Replace {project} placeholder
|
|
129
|
+
const pathWithProject = suggestedPath.replace('{project}', project.id);
|
|
130
|
+
return path.join(this.options.basePath, pathWithProject, filename);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Write a file with grouped sections
|
|
134
|
+
*/
|
|
135
|
+
async writeFile(incrementId, filePath, group, spec, project) {
|
|
136
|
+
// Generate content
|
|
137
|
+
const content = this.generateFileContent(incrementId, group, spec, project);
|
|
138
|
+
// Check if file exists
|
|
139
|
+
const exists = fs.existsSync(filePath);
|
|
140
|
+
// In dry run mode, just return what would happen
|
|
141
|
+
if (this.options.dryRun) {
|
|
142
|
+
return {
|
|
143
|
+
status: exists ? 'updated' : 'created',
|
|
144
|
+
file: {
|
|
145
|
+
path: filePath,
|
|
146
|
+
category: group.category,
|
|
147
|
+
size: content.length,
|
|
148
|
+
sections: group.sections.length,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
// Check if content changed
|
|
153
|
+
if (exists) {
|
|
154
|
+
const existingContent = await fs.readFile(filePath, 'utf-8');
|
|
155
|
+
if (existingContent === content) {
|
|
156
|
+
return {
|
|
157
|
+
status: 'skipped',
|
|
158
|
+
file: {
|
|
159
|
+
path: filePath,
|
|
160
|
+
category: group.category,
|
|
161
|
+
size: content.length,
|
|
162
|
+
sections: group.sections.length,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Ensure directory exists
|
|
168
|
+
await fs.ensureDir(path.dirname(filePath));
|
|
169
|
+
// Write file
|
|
170
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
171
|
+
return {
|
|
172
|
+
status: exists ? 'updated' : 'created',
|
|
173
|
+
file: {
|
|
174
|
+
path: filePath,
|
|
175
|
+
category: group.category,
|
|
176
|
+
size: content.length,
|
|
177
|
+
sections: group.sections.length,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Generate file content with frontmatter and sections
|
|
183
|
+
*/
|
|
184
|
+
generateFileContent(incrementId, group, spec, project) {
|
|
185
|
+
let content = '';
|
|
186
|
+
// Generate frontmatter
|
|
187
|
+
if (this.options.generateFrontmatter) {
|
|
188
|
+
content += this.generateFrontmatter(incrementId, group, spec, project);
|
|
189
|
+
content += '\n\n';
|
|
190
|
+
}
|
|
191
|
+
// Add sections
|
|
192
|
+
for (const item of group.sections) {
|
|
193
|
+
const { section } = item;
|
|
194
|
+
// Add heading
|
|
195
|
+
content += `${'#'.repeat(section.level)} ${section.heading}\n\n`;
|
|
196
|
+
// Add content
|
|
197
|
+
content += section.content;
|
|
198
|
+
// Add spacing between sections
|
|
199
|
+
content += '\n\n';
|
|
200
|
+
}
|
|
201
|
+
// Add footer
|
|
202
|
+
content += `---\n\n`;
|
|
203
|
+
content += `**Source**: [Increment ${incrementId}](../../../increments/${incrementId}/spec.md)\n`;
|
|
204
|
+
content += `**Project**: ${project.name}\n`;
|
|
205
|
+
content += `**Last Updated**: ${new Date().toISOString().split('T')[0]}\n`;
|
|
206
|
+
return content.trim() + '\n';
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Generate Docusaurus frontmatter
|
|
210
|
+
*/
|
|
211
|
+
generateFrontmatter(incrementId, group, spec, project) {
|
|
212
|
+
const firstSection = group.sections[0].section;
|
|
213
|
+
const title = firstSection.heading;
|
|
214
|
+
const category = group.category;
|
|
215
|
+
const frontmatter = {
|
|
216
|
+
id: firstSection.id,
|
|
217
|
+
title,
|
|
218
|
+
sidebar_label: title,
|
|
219
|
+
description: this.generateDescription(group.sections),
|
|
220
|
+
tags: [category, project.id, incrementId],
|
|
221
|
+
increment: incrementId,
|
|
222
|
+
project: project.id,
|
|
223
|
+
category,
|
|
224
|
+
last_updated: new Date().toISOString().split('T')[0],
|
|
225
|
+
};
|
|
226
|
+
// Add spec-specific fields
|
|
227
|
+
if (spec.frontmatter.priority) {
|
|
228
|
+
frontmatter.priority = spec.frontmatter.priority;
|
|
229
|
+
}
|
|
230
|
+
if (spec.frontmatter.status) {
|
|
231
|
+
frontmatter.status = spec.frontmatter.status;
|
|
232
|
+
}
|
|
233
|
+
// Convert to YAML
|
|
234
|
+
const yaml = Object.entries(frontmatter)
|
|
235
|
+
.map(([key, value]) => {
|
|
236
|
+
if (Array.isArray(value)) {
|
|
237
|
+
return `${key}: [${value.map((v) => `"${v}"`).join(', ')}]`;
|
|
238
|
+
}
|
|
239
|
+
else if (typeof value === 'string') {
|
|
240
|
+
return `${key}: "${value}"`;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
return `${key}: ${value}`;
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
.join('\n');
|
|
247
|
+
return `---\n${yaml}\n---`;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Generate description from sections
|
|
251
|
+
*/
|
|
252
|
+
generateDescription(sections) {
|
|
253
|
+
const firstSection = sections[0].section;
|
|
254
|
+
const contentWithoutCode = firstSection.content.replace(/```[\s\S]*?```/g, '');
|
|
255
|
+
const firstParagraph = contentWithoutCode.split('\n\n')[0];
|
|
256
|
+
return firstParagraph.substring(0, 160).trim();
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Archive original spec for reference
|
|
260
|
+
*/
|
|
261
|
+
async archiveOriginalSpec(incrementId, spec, project) {
|
|
262
|
+
if (this.options.dryRun) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const archivePath = path.join(this.options.basePath, 'specs', project.id, '_archive', `spec-${incrementId}.md`);
|
|
266
|
+
await fs.ensureDir(path.dirname(archivePath));
|
|
267
|
+
await fs.writeFile(archivePath, spec.raw, 'utf-8');
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Generate index file for a category
|
|
271
|
+
*/
|
|
272
|
+
async generateIndex(category, projectId, files) {
|
|
273
|
+
if (this.options.dryRun) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const categoryPath = path.join(this.options.basePath, category === ContentCategory.UserStory || category === ContentCategory.NFR ? 'specs' : category, projectId);
|
|
277
|
+
const indexPath = path.join(categoryPath, 'README.md');
|
|
278
|
+
let content = `# ${this.getCategoryTitle(category)}\n\n`;
|
|
279
|
+
content += `**Project**: ${projectId}\n`;
|
|
280
|
+
content += `**Category**: ${category}\n`;
|
|
281
|
+
content += `**Files**: ${files.length}\n\n`;
|
|
282
|
+
content += `## Files\n\n`;
|
|
283
|
+
for (const file of files.sort((a, b) => a.path.localeCompare(b.path))) {
|
|
284
|
+
const filename = path.basename(file.path);
|
|
285
|
+
const title = filename.replace(/\.md$/, '').replace(/-/g, ' ');
|
|
286
|
+
content += `- [${title}](./${filename})\n`;
|
|
287
|
+
}
|
|
288
|
+
content += `\n---\n\n`;
|
|
289
|
+
content += `Generated by SpecWeave Intelligent Living Docs Sync\n`;
|
|
290
|
+
await fs.ensureDir(path.dirname(indexPath));
|
|
291
|
+
await fs.writeFile(indexPath, content, 'utf-8');
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Get category display title
|
|
295
|
+
*/
|
|
296
|
+
getCategoryTitle(category) {
|
|
297
|
+
const titles = {
|
|
298
|
+
[ContentCategory.UserStory]: 'User Stories',
|
|
299
|
+
[ContentCategory.NFR]: 'Non-Functional Requirements',
|
|
300
|
+
[ContentCategory.Architecture]: 'Architecture',
|
|
301
|
+
[ContentCategory.ADR]: 'Architecture Decision Records',
|
|
302
|
+
[ContentCategory.Operations]: 'Operations',
|
|
303
|
+
[ContentCategory.Delivery]: 'Delivery',
|
|
304
|
+
[ContentCategory.Strategy]: 'Strategy',
|
|
305
|
+
[ContentCategory.Governance]: 'Governance',
|
|
306
|
+
[ContentCategory.Overview]: 'Overview',
|
|
307
|
+
[ContentCategory.Unknown]: 'Uncategorized',
|
|
308
|
+
};
|
|
309
|
+
return titles[category] || category;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Get distribution statistics
|
|
313
|
+
*/
|
|
314
|
+
getStatistics(result) {
|
|
315
|
+
const allFiles = [...result.created, ...result.updated, ...result.skipped];
|
|
316
|
+
const totalSize = allFiles.reduce((sum, f) => sum + f.size, 0);
|
|
317
|
+
const byCategory = {};
|
|
318
|
+
for (const file of allFiles) {
|
|
319
|
+
if (!byCategory[file.category]) {
|
|
320
|
+
byCategory[file.category] = { files: 0, size: 0 };
|
|
321
|
+
}
|
|
322
|
+
byCategory[file.category].files++;
|
|
323
|
+
byCategory[file.category].size += file.size;
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
totalFiles: allFiles.length,
|
|
327
|
+
totalSize,
|
|
328
|
+
averageSize: totalSize / allFiles.length || 0,
|
|
329
|
+
byCategory,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Factory function to create distributor
|
|
335
|
+
*/
|
|
336
|
+
export function createContentDistributor(options) {
|
|
337
|
+
return new ContentDistributor(options);
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=content-distributor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-distributor.js","sourceRoot":"","sources":["../../../../src/core/living-docs/content-distributor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAwB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAgEhF;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAG7B,YAAY,UAA8B,EAAE;QAC1C,IAAI,CAAC,OAAO,GAAG;YACb,QAAQ,EACN,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC;YAChF,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,IAAI;YACxD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,IAAI;YAClD,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;SAChC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CACd,WAAmB,EACnB,IAAgB,EAChB,eAAuC,EACvC,OAAuB;QAEvB,MAAM,MAAM,GAAuB;YACjC,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;YACV,OAAO,EAAE;gBACP,aAAa,EAAE,eAAe,CAAC,MAAM;gBACrC,YAAY,EAAE,CAAC;gBACf,YAAY,EAAE,CAAC;gBACf,YAAY,EAAE,CAAC;gB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C3E,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAE/D,MAAM,UAAU,GAA6D,EAAS,CAAC;QAEvF,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/B,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YACpD,CAAC;YACD,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;YAClC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;QAC9C,CAAC;QAED,OAAO;YACL,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,SAAS;YACT,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC;YAC7C,UAAU;SACX,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAA4B;IACnE,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Parser for Intelligent Living Docs Sync
|
|
3
|
+
*
|
|
4
|
+
* Parses increment spec.md into structured sections for classification and distribution.
|
|
5
|
+
*
|
|
6
|
+
* @module living-docs/content-parser
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Represents a code block in the markdown
|
|
10
|
+
*/
|
|
11
|
+
export interface CodeBlock {
|
|
12
|
+
language: string;
|
|
13
|
+
content: string;
|
|
14
|
+
startLine: number;
|
|
15
|
+
endLine: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents a link in the markdown
|
|
19
|
+
*/
|
|
20
|
+
export interface Link {
|
|
21
|
+
text: string;
|
|
22
|
+
url: string;
|
|
23
|
+
type: 'internal' | 'external' | 'anchor';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents an image reference
|
|
27
|
+
*/
|
|
28
|
+
export interface Image {
|
|
29
|
+
alt: string;
|
|
30
|
+
url: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Represents a parsed section of the spec
|
|
35
|
+
*/
|
|
36
|
+
export interface ParsedSection {
|
|
37
|
+
id: string;
|
|
38
|
+
heading: string;
|
|
39
|
+
level: number;
|
|
40
|
+
content: string;
|
|
41
|
+
rawContent: string;
|
|
42
|
+
codeBlocks: CodeBlock[];
|
|
43
|
+
links: Link[];
|
|
44
|
+
images: Image[];
|
|
45
|
+
metadata?: Record<string, any>;
|
|
46
|
+
startLine: number;
|
|
47
|
+
endLine: number;
|
|
48
|
+
children: ParsedSection[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Represents the complete parsed specification
|
|
52
|
+
*/
|
|
53
|
+
export interface ParsedSpec {
|
|
54
|
+
frontmatter: Record<string, any>;
|
|
55
|
+
sections: ParsedSection[];
|
|
56
|
+
raw: string;
|
|
57
|
+
filePath?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Parser options
|
|
61
|
+
*/
|
|
62
|
+
export interface ParserOptions {
|
|
63
|
+
preserveCodeBlocks?: boolean;
|
|
64
|
+
preserveLinks?: boolean;
|
|
65
|
+
preserveImages?: boolean;
|
|
66
|
+
maxDepth?: number;
|
|
67
|
+
includeRawContent?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Content Parser class
|
|
71
|
+
*/
|
|
72
|
+
export declare class ContentParser {
|
|
73
|
+
private options;
|
|
74
|
+
constructor(options?: ParserOptions);
|
|
75
|
+
/**
|
|
76
|
+
* Parse markdown content into structured sections
|
|
77
|
+
*/
|
|
78
|
+
parse(markdown: string, filePath?: string): ParsedSpec;
|
|
79
|
+
/**
|
|
80
|
+
* Parse sections from lines array (recursive for nested sections)
|
|
81
|
+
*/
|
|
82
|
+
private parseSections;
|
|
83
|
+
/**
|
|
84
|
+
* Build section hierarchy (nest sub-sections under parent sections)
|
|
85
|
+
*/
|
|
86
|
+
private buildHierarchy;
|
|
87
|
+
/**
|
|
88
|
+
* Set raw content for sections (including nested children)
|
|
89
|
+
*/
|
|
90
|
+
private setRawContent;
|
|
91
|
+
/**
|
|
92
|
+
* Generate raw content for a section (including nested children)
|
|
93
|
+
*/
|
|
94
|
+
private generateRawContent;
|
|
95
|
+
/**
|
|
96
|
+
* Extract code blocks from content
|
|
97
|
+
*/
|
|
98
|
+
private extractCodeBlocks;
|
|
99
|
+
/**
|
|
100
|
+
* Extract links from content
|
|
101
|
+
*/
|
|
102
|
+
private extractLinks;
|
|
103
|
+
/**
|
|
104
|
+
* Extract images from content
|
|
105
|
+
*/
|
|
106
|
+
private extractImages;
|
|
107
|
+
/**
|
|
108
|
+
* Determine link type (internal/external/anchor)
|
|
109
|
+
*/
|
|
110
|
+
private determineLinkType;
|
|
111
|
+
/**
|
|
112
|
+
* Convert heading to URL-safe slug
|
|
113
|
+
*/
|
|
114
|
+
private slugify;
|
|
115
|
+
/**
|
|
116
|
+
* Find section by ID (recursive search)
|
|
117
|
+
*/
|
|
118
|
+
findSection(sections: ParsedSection[], id: string): ParsedSection | null;
|
|
119
|
+
/**
|
|
120
|
+
* Get all sections flattened (no hierarchy)
|
|
121
|
+
*/
|
|
122
|
+
flattenSections(sections: ParsedSection[]): ParsedSection[];
|
|
123
|
+
/**
|
|
124
|
+
* Get sections by level
|
|
125
|
+
*/
|
|
126
|
+
getSectionsByLevel(sections: ParsedSection[], level: number): ParsedSection[];
|
|
127
|
+
/**
|
|
128
|
+
* Get section content without code blocks
|
|
129
|
+
*/
|
|
130
|
+
getContentWithoutCode(section: ParsedSection): string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Factory function to create parser
|
|
134
|
+
*/
|
|
135
|
+
export declare function createContentParser(options?: ParserOptions): ContentParser;
|
|
136
|
+
/**
|
|
137
|
+
* Convenience function to parse markdown
|
|
138
|
+
*/
|
|
139
|
+
export declare function parseMarkdown(markdown: string, options?: ParserOptions): ParsedSpec;
|
|
140
|
+
//# sourceMappingURL=content-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-parser.d.ts","sourceRoot":"","sources":["../../../../src/core/living-docs/content-parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,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