@weavelogic/knowledge-graph-agent 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +203 -4
- package/dist/cli/commands/analyze.d.ts +12 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +269 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/convert.d.ts +15 -0
- package/dist/cli/commands/convert.d.ts.map +1 -0
- package/dist/cli/commands/convert.js +203 -0
- package/dist/cli/commands/convert.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +13 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/docs-analyzer.d.ts +75 -0
- package/dist/generators/docs-analyzer.d.ts.map +1 -0
- package/dist/generators/docs-analyzer.js +567 -0
- package/dist/generators/docs-analyzer.js.map +1 -0
- package/dist/generators/docs-convert.d.ts +91 -0
- package/dist/generators/docs-convert.d.ts.map +1 -0
- package/dist/generators/docs-convert.js +474 -0
- package/dist/generators/docs-convert.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs Converter
|
|
3
|
+
*
|
|
4
|
+
* Converts existing documentation to weave-nn structure with proper
|
|
5
|
+
* frontmatter and directory organization.
|
|
6
|
+
*/
|
|
7
|
+
import type { NodeType, NodeStatus } from '../core/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Conversion options
|
|
10
|
+
*/
|
|
11
|
+
export interface ConvertOptions {
|
|
12
|
+
/** Source directory with existing docs */
|
|
13
|
+
sourceDir: string;
|
|
14
|
+
/** Target directory (default: docs-nn) */
|
|
15
|
+
targetDir?: string;
|
|
16
|
+
/** Project root for path resolution */
|
|
17
|
+
projectRoot: string;
|
|
18
|
+
/** Preserve original files (copy instead of move) */
|
|
19
|
+
preserveOriginal?: boolean;
|
|
20
|
+
/** Overwrite existing files in target */
|
|
21
|
+
force?: boolean;
|
|
22
|
+
/** Auto-categorize based on content analysis */
|
|
23
|
+
autoCategory?: boolean;
|
|
24
|
+
/** Dry run - show what would be done */
|
|
25
|
+
dryRun?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Frontmatter options
|
|
29
|
+
*/
|
|
30
|
+
export interface FrontmatterOptions {
|
|
31
|
+
/** Target file or directory */
|
|
32
|
+
target: string;
|
|
33
|
+
/** Project root */
|
|
34
|
+
projectRoot: string;
|
|
35
|
+
/** Override type detection */
|
|
36
|
+
type?: NodeType;
|
|
37
|
+
/** Override status */
|
|
38
|
+
status?: NodeStatus;
|
|
39
|
+
/** Additional tags to add */
|
|
40
|
+
tags?: string[];
|
|
41
|
+
/** Force overwrite existing frontmatter */
|
|
42
|
+
force?: boolean;
|
|
43
|
+
/** Dry run */
|
|
44
|
+
dryRun?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Conversion result
|
|
48
|
+
*/
|
|
49
|
+
export interface ConvertResult {
|
|
50
|
+
success: boolean;
|
|
51
|
+
filesProcessed: number;
|
|
52
|
+
filesConverted: number;
|
|
53
|
+
filesSkipped: number;
|
|
54
|
+
errors: string[];
|
|
55
|
+
converted: Array<{
|
|
56
|
+
source: string;
|
|
57
|
+
target: string;
|
|
58
|
+
type: NodeType;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Frontmatter result
|
|
63
|
+
*/
|
|
64
|
+
export interface FrontmatterResult {
|
|
65
|
+
success: boolean;
|
|
66
|
+
filesProcessed: number;
|
|
67
|
+
filesUpdated: number;
|
|
68
|
+
filesSkipped: number;
|
|
69
|
+
errors: string[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Convert existing docs to weave-nn structure
|
|
73
|
+
*/
|
|
74
|
+
export declare function convertDocs(options: ConvertOptions): Promise<ConvertResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Add or update frontmatter in existing files
|
|
77
|
+
*/
|
|
78
|
+
export declare function addFrontmatter(options: FrontmatterOptions): Promise<FrontmatterResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Validate frontmatter in files
|
|
81
|
+
*/
|
|
82
|
+
export declare function validateFrontmatter(target: string, projectRoot: string): Promise<{
|
|
83
|
+
valid: number;
|
|
84
|
+
invalid: number;
|
|
85
|
+
missing: number;
|
|
86
|
+
issues: Array<{
|
|
87
|
+
file: string;
|
|
88
|
+
issues: string[];
|
|
89
|
+
}>;
|
|
90
|
+
}>;
|
|
91
|
+
//# sourceMappingURL=docs-convert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-convert.d.ts","sourceRoot":"","sources":["../../src/generators/docs-convert.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yCAAyC;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gDAAgD;IAChD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,QAAQ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KAAE,CAAC,CAAC;CACnD,CAAC,CA6DD"}
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { existsSync, readFileSync, mkdirSync, writeFileSync } from "fs";
|
|
2
|
+
import { join, basename, dirname, relative } from "path";
|
|
3
|
+
import fg from "fast-glob";
|
|
4
|
+
import matter from "gray-matter";
|
|
5
|
+
const CATEGORY_DIRS = {
|
|
6
|
+
concept: "concepts",
|
|
7
|
+
technical: "components",
|
|
8
|
+
feature: "features",
|
|
9
|
+
primitive: "integrations",
|
|
10
|
+
service: "services",
|
|
11
|
+
guide: "guides",
|
|
12
|
+
standard: "standards",
|
|
13
|
+
integration: "integrations"
|
|
14
|
+
};
|
|
15
|
+
const CATEGORY_KEYWORDS = {
|
|
16
|
+
concept: [
|
|
17
|
+
"overview",
|
|
18
|
+
"introduction",
|
|
19
|
+
"theory",
|
|
20
|
+
"principle",
|
|
21
|
+
"concept",
|
|
22
|
+
"philosophy",
|
|
23
|
+
"approach",
|
|
24
|
+
"methodology",
|
|
25
|
+
"paradigm",
|
|
26
|
+
"model"
|
|
27
|
+
],
|
|
28
|
+
technical: [
|
|
29
|
+
"component",
|
|
30
|
+
"implementation",
|
|
31
|
+
"class",
|
|
32
|
+
"function",
|
|
33
|
+
"module",
|
|
34
|
+
"algorithm",
|
|
35
|
+
"data structure",
|
|
36
|
+
"interface",
|
|
37
|
+
"abstract",
|
|
38
|
+
"utility"
|
|
39
|
+
],
|
|
40
|
+
feature: [
|
|
41
|
+
"feature",
|
|
42
|
+
"capability",
|
|
43
|
+
"functionality",
|
|
44
|
+
"use case",
|
|
45
|
+
"user story",
|
|
46
|
+
"requirement",
|
|
47
|
+
"specification",
|
|
48
|
+
"product",
|
|
49
|
+
"roadmap"
|
|
50
|
+
],
|
|
51
|
+
primitive: [
|
|
52
|
+
"library",
|
|
53
|
+
"framework",
|
|
54
|
+
"dependency",
|
|
55
|
+
"package",
|
|
56
|
+
"tool",
|
|
57
|
+
"sdk",
|
|
58
|
+
"runtime",
|
|
59
|
+
"platform",
|
|
60
|
+
"language"
|
|
61
|
+
],
|
|
62
|
+
service: [
|
|
63
|
+
"api",
|
|
64
|
+
"endpoint",
|
|
65
|
+
"service",
|
|
66
|
+
"server",
|
|
67
|
+
"backend",
|
|
68
|
+
"microservice",
|
|
69
|
+
"rest",
|
|
70
|
+
"graphql",
|
|
71
|
+
"webhook",
|
|
72
|
+
"worker",
|
|
73
|
+
"queue"
|
|
74
|
+
],
|
|
75
|
+
guide: [
|
|
76
|
+
"how to",
|
|
77
|
+
"tutorial",
|
|
78
|
+
"guide",
|
|
79
|
+
"walkthrough",
|
|
80
|
+
"step by step",
|
|
81
|
+
"getting started",
|
|
82
|
+
"setup",
|
|
83
|
+
"installation",
|
|
84
|
+
"configuration"
|
|
85
|
+
],
|
|
86
|
+
standard: [
|
|
87
|
+
"standard",
|
|
88
|
+
"convention",
|
|
89
|
+
"best practice",
|
|
90
|
+
"rule",
|
|
91
|
+
"policy",
|
|
92
|
+
"guideline",
|
|
93
|
+
"coding style",
|
|
94
|
+
"lint",
|
|
95
|
+
"format"
|
|
96
|
+
],
|
|
97
|
+
integration: [
|
|
98
|
+
"integration",
|
|
99
|
+
"connect",
|
|
100
|
+
"plugin",
|
|
101
|
+
"adapter",
|
|
102
|
+
"bridge",
|
|
103
|
+
"sync",
|
|
104
|
+
"import",
|
|
105
|
+
"export",
|
|
106
|
+
"webhook"
|
|
107
|
+
]
|
|
108
|
+
};
|
|
109
|
+
const PATH_PATTERNS = [
|
|
110
|
+
{ pattern: /\/(api|endpoints?|routes?)\//i, type: "service" },
|
|
111
|
+
{ pattern: /\/(guide|tutorial|howto|getting-started)\//i, type: "guide" },
|
|
112
|
+
{ pattern: /\/(component|ui|widget)\//i, type: "technical" },
|
|
113
|
+
{ pattern: /\/(feature|capability)\//i, type: "feature" },
|
|
114
|
+
{ pattern: /\/(standard|convention|style)\//i, type: "standard" },
|
|
115
|
+
{ pattern: /\/(integration|plugin|adapter)\//i, type: "integration" },
|
|
116
|
+
{ pattern: /\/(service|worker|job)\//i, type: "service" },
|
|
117
|
+
{ pattern: /\/(concept|architecture|design)\//i, type: "concept" }
|
|
118
|
+
];
|
|
119
|
+
async function convertDocs(options) {
|
|
120
|
+
const {
|
|
121
|
+
sourceDir,
|
|
122
|
+
targetDir = "docs-nn",
|
|
123
|
+
projectRoot,
|
|
124
|
+
preserveOriginal = true,
|
|
125
|
+
force = false,
|
|
126
|
+
autoCategory = true,
|
|
127
|
+
dryRun = false
|
|
128
|
+
} = options;
|
|
129
|
+
const result = {
|
|
130
|
+
success: true,
|
|
131
|
+
filesProcessed: 0,
|
|
132
|
+
filesConverted: 0,
|
|
133
|
+
filesSkipped: 0,
|
|
134
|
+
errors: [],
|
|
135
|
+
converted: []
|
|
136
|
+
};
|
|
137
|
+
const sourcePath = join(projectRoot, sourceDir);
|
|
138
|
+
const targetPath = join(projectRoot, targetDir);
|
|
139
|
+
if (!existsSync(sourcePath)) {
|
|
140
|
+
result.success = false;
|
|
141
|
+
result.errors.push(`Source directory not found: ${sourcePath}`);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
if (!dryRun) {
|
|
145
|
+
createTargetStructure(targetPath);
|
|
146
|
+
}
|
|
147
|
+
const files = await fg("**/*.md", {
|
|
148
|
+
cwd: sourcePath,
|
|
149
|
+
ignore: ["node_modules/**", ".git/**", "_templates/**"]
|
|
150
|
+
});
|
|
151
|
+
for (const file of files) {
|
|
152
|
+
result.filesProcessed++;
|
|
153
|
+
const sourceFile = join(sourcePath, file);
|
|
154
|
+
try {
|
|
155
|
+
const content = readFileSync(sourceFile, "utf-8");
|
|
156
|
+
const { data: existingFrontmatter, content: body } = matter(content);
|
|
157
|
+
const nodeType = autoCategory ? detectNodeType(file, body, existingFrontmatter) : existingFrontmatter.type || "concept";
|
|
158
|
+
const targetSubdir = CATEGORY_DIRS[nodeType];
|
|
159
|
+
const targetFile = join(targetPath, targetSubdir, basename(file));
|
|
160
|
+
if (existsSync(targetFile) && !force) {
|
|
161
|
+
result.filesSkipped++;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const frontmatter = generateFrontmatter(file, body, nodeType, existingFrontmatter);
|
|
165
|
+
const newContent = buildMarkdownWithFrontmatter(frontmatter, body);
|
|
166
|
+
if (!dryRun) {
|
|
167
|
+
mkdirSync(dirname(targetFile), { recursive: true });
|
|
168
|
+
writeFileSync(targetFile, newContent, "utf-8");
|
|
169
|
+
}
|
|
170
|
+
result.filesConverted++;
|
|
171
|
+
result.converted.push({
|
|
172
|
+
source: file,
|
|
173
|
+
target: relative(projectRoot, targetFile),
|
|
174
|
+
type: nodeType
|
|
175
|
+
});
|
|
176
|
+
} catch (error) {
|
|
177
|
+
result.errors.push(`Failed to convert ${file}: ${error}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
result.success = result.errors.length === 0;
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
async function addFrontmatter(options) {
|
|
184
|
+
const {
|
|
185
|
+
target,
|
|
186
|
+
projectRoot,
|
|
187
|
+
type,
|
|
188
|
+
status = "active",
|
|
189
|
+
tags = [],
|
|
190
|
+
force = false,
|
|
191
|
+
dryRun = false
|
|
192
|
+
} = options;
|
|
193
|
+
const result = {
|
|
194
|
+
success: true,
|
|
195
|
+
filesProcessed: 0,
|
|
196
|
+
filesUpdated: 0,
|
|
197
|
+
filesSkipped: 0,
|
|
198
|
+
errors: []
|
|
199
|
+
};
|
|
200
|
+
const targetPath = join(projectRoot, target);
|
|
201
|
+
let files;
|
|
202
|
+
if (existsSync(targetPath) && !targetPath.endsWith(".md")) {
|
|
203
|
+
files = await fg("**/*.md", {
|
|
204
|
+
cwd: targetPath,
|
|
205
|
+
ignore: ["node_modules/**", ".git/**", "_templates/**"],
|
|
206
|
+
absolute: true
|
|
207
|
+
});
|
|
208
|
+
} else if (existsSync(targetPath)) {
|
|
209
|
+
files = [targetPath];
|
|
210
|
+
} else {
|
|
211
|
+
result.success = false;
|
|
212
|
+
result.errors.push(`Target not found: ${targetPath}`);
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
for (const file of files) {
|
|
216
|
+
result.filesProcessed++;
|
|
217
|
+
try {
|
|
218
|
+
const content = readFileSync(file, "utf-8");
|
|
219
|
+
const { data: existingFrontmatter, content: body } = matter(content);
|
|
220
|
+
if (Object.keys(existingFrontmatter).length > 0 && !force) {
|
|
221
|
+
result.filesSkipped++;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const relPath = relative(projectRoot, file);
|
|
225
|
+
const nodeType = type || detectNodeType(relPath, body, existingFrontmatter);
|
|
226
|
+
const frontmatter = generateFrontmatter(
|
|
227
|
+
relPath,
|
|
228
|
+
body,
|
|
229
|
+
nodeType,
|
|
230
|
+
force ? {} : existingFrontmatter,
|
|
231
|
+
status,
|
|
232
|
+
tags
|
|
233
|
+
);
|
|
234
|
+
const newContent = buildMarkdownWithFrontmatter(frontmatter, body);
|
|
235
|
+
if (!dryRun) {
|
|
236
|
+
writeFileSync(file, newContent, "utf-8");
|
|
237
|
+
}
|
|
238
|
+
result.filesUpdated++;
|
|
239
|
+
} catch (error) {
|
|
240
|
+
result.errors.push(`Failed to update ${file}: ${error}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
result.success = result.errors.length === 0;
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
async function validateFrontmatter(target, projectRoot) {
|
|
247
|
+
const result = {
|
|
248
|
+
valid: 0,
|
|
249
|
+
invalid: 0,
|
|
250
|
+
missing: 0,
|
|
251
|
+
issues: []
|
|
252
|
+
};
|
|
253
|
+
const targetPath = join(projectRoot, target);
|
|
254
|
+
const files = await fg("**/*.md", {
|
|
255
|
+
cwd: targetPath,
|
|
256
|
+
ignore: ["node_modules/**", ".git/**", "_templates/**"],
|
|
257
|
+
absolute: true
|
|
258
|
+
});
|
|
259
|
+
const validTypes = [
|
|
260
|
+
"concept",
|
|
261
|
+
"technical",
|
|
262
|
+
"feature",
|
|
263
|
+
"primitive",
|
|
264
|
+
"service",
|
|
265
|
+
"guide",
|
|
266
|
+
"standard",
|
|
267
|
+
"integration"
|
|
268
|
+
];
|
|
269
|
+
const validStatuses = ["draft", "active", "deprecated", "archived"];
|
|
270
|
+
for (const file of files) {
|
|
271
|
+
const content = readFileSync(file, "utf-8");
|
|
272
|
+
const { data: frontmatter } = matter(content);
|
|
273
|
+
const fileIssues = [];
|
|
274
|
+
if (Object.keys(frontmatter).length === 0) {
|
|
275
|
+
result.missing++;
|
|
276
|
+
fileIssues.push("Missing frontmatter");
|
|
277
|
+
} else {
|
|
278
|
+
if (!frontmatter.title) {
|
|
279
|
+
fileIssues.push("Missing title");
|
|
280
|
+
}
|
|
281
|
+
if (!frontmatter.type) {
|
|
282
|
+
fileIssues.push("Missing type");
|
|
283
|
+
} else if (!validTypes.includes(frontmatter.type)) {
|
|
284
|
+
fileIssues.push(`Invalid type: ${frontmatter.type}`);
|
|
285
|
+
}
|
|
286
|
+
if (frontmatter.status && !validStatuses.includes(frontmatter.status)) {
|
|
287
|
+
fileIssues.push(`Invalid status: ${frontmatter.status}`);
|
|
288
|
+
}
|
|
289
|
+
if (!frontmatter.created) {
|
|
290
|
+
fileIssues.push("Missing created date");
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (fileIssues.length > 0) {
|
|
294
|
+
result.invalid++;
|
|
295
|
+
result.issues.push({
|
|
296
|
+
file: relative(projectRoot, file),
|
|
297
|
+
issues: fileIssues
|
|
298
|
+
});
|
|
299
|
+
} else if (Object.keys(frontmatter).length > 0) {
|
|
300
|
+
result.valid++;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return result;
|
|
304
|
+
}
|
|
305
|
+
function createTargetStructure(targetPath) {
|
|
306
|
+
const dirs = [
|
|
307
|
+
"",
|
|
308
|
+
"concepts",
|
|
309
|
+
"concepts/architecture",
|
|
310
|
+
"concepts/patterns",
|
|
311
|
+
"components",
|
|
312
|
+
"components/ui",
|
|
313
|
+
"components/utilities",
|
|
314
|
+
"services",
|
|
315
|
+
"services/api",
|
|
316
|
+
"services/workers",
|
|
317
|
+
"features",
|
|
318
|
+
"features/core",
|
|
319
|
+
"features/advanced",
|
|
320
|
+
"integrations",
|
|
321
|
+
"integrations/databases",
|
|
322
|
+
"integrations/auth",
|
|
323
|
+
"standards",
|
|
324
|
+
"standards/coding",
|
|
325
|
+
"standards/documentation",
|
|
326
|
+
"guides",
|
|
327
|
+
"guides/getting-started",
|
|
328
|
+
"guides/tutorials",
|
|
329
|
+
"references",
|
|
330
|
+
"references/api",
|
|
331
|
+
"_templates",
|
|
332
|
+
"_attachments"
|
|
333
|
+
];
|
|
334
|
+
for (const dir of dirs) {
|
|
335
|
+
const fullPath = join(targetPath, dir);
|
|
336
|
+
if (!existsSync(fullPath)) {
|
|
337
|
+
mkdirSync(fullPath, { recursive: true });
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function detectNodeType(filePath, content, existingFrontmatter) {
|
|
342
|
+
const validTypes = [
|
|
343
|
+
"concept",
|
|
344
|
+
"technical",
|
|
345
|
+
"feature",
|
|
346
|
+
"primitive",
|
|
347
|
+
"service",
|
|
348
|
+
"guide",
|
|
349
|
+
"standard",
|
|
350
|
+
"integration"
|
|
351
|
+
];
|
|
352
|
+
if (existingFrontmatter.type && validTypes.includes(existingFrontmatter.type)) {
|
|
353
|
+
return existingFrontmatter.type;
|
|
354
|
+
}
|
|
355
|
+
for (const { pattern, type } of PATH_PATTERNS) {
|
|
356
|
+
if (pattern.test(filePath)) {
|
|
357
|
+
return type;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const lowerContent = content.toLowerCase();
|
|
361
|
+
const scores = {
|
|
362
|
+
concept: 0,
|
|
363
|
+
technical: 0,
|
|
364
|
+
feature: 0,
|
|
365
|
+
primitive: 0,
|
|
366
|
+
service: 0,
|
|
367
|
+
guide: 0,
|
|
368
|
+
standard: 0,
|
|
369
|
+
integration: 0
|
|
370
|
+
};
|
|
371
|
+
for (const [nodeType, keywords] of Object.entries(CATEGORY_KEYWORDS)) {
|
|
372
|
+
for (const keyword of keywords) {
|
|
373
|
+
const regex = new RegExp(`\\b${keyword}\\b`, "gi");
|
|
374
|
+
const matches = lowerContent.match(regex);
|
|
375
|
+
if (matches) {
|
|
376
|
+
scores[nodeType] += matches.length;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
let maxScore = 0;
|
|
381
|
+
let detectedType = "concept";
|
|
382
|
+
for (const [nodeType, score] of Object.entries(scores)) {
|
|
383
|
+
if (score > maxScore) {
|
|
384
|
+
maxScore = score;
|
|
385
|
+
detectedType = nodeType;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return detectedType;
|
|
389
|
+
}
|
|
390
|
+
function generateFrontmatter(filePath, content, nodeType, existing = {}, status = "active", additionalTags = []) {
|
|
391
|
+
const filename = basename(filePath, ".md");
|
|
392
|
+
const title = existing.title || formatTitle(filename);
|
|
393
|
+
const extractedTags = extractTags(content);
|
|
394
|
+
const allTags = [.../* @__PURE__ */ new Set([
|
|
395
|
+
...existing.tags || [],
|
|
396
|
+
...extractedTags,
|
|
397
|
+
...additionalTags
|
|
398
|
+
])];
|
|
399
|
+
const now = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
400
|
+
const created = existing.created || now;
|
|
401
|
+
return {
|
|
402
|
+
title,
|
|
403
|
+
type: nodeType,
|
|
404
|
+
status: existing.status || status,
|
|
405
|
+
tags: allTags.length > 0 ? allTags : void 0,
|
|
406
|
+
category: existing.category || void 0,
|
|
407
|
+
description: existing.description || extractDescription(content),
|
|
408
|
+
created,
|
|
409
|
+
updated: now,
|
|
410
|
+
aliases: existing.aliases || void 0,
|
|
411
|
+
related: existing.related || void 0
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function formatTitle(filename) {
|
|
415
|
+
return filename.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()).trim();
|
|
416
|
+
}
|
|
417
|
+
function extractTags(content) {
|
|
418
|
+
const tags = [];
|
|
419
|
+
const tagMatches = content.match(/#[\w-]+/g);
|
|
420
|
+
if (tagMatches) {
|
|
421
|
+
tags.push(...tagMatches.map((t) => t.slice(1)));
|
|
422
|
+
}
|
|
423
|
+
return tags.slice(0, 10);
|
|
424
|
+
}
|
|
425
|
+
function extractDescription(content) {
|
|
426
|
+
const lines = content.split("\n");
|
|
427
|
+
let description = "";
|
|
428
|
+
for (const line of lines) {
|
|
429
|
+
const trimmed = line.trim();
|
|
430
|
+
if (trimmed && !trimmed.startsWith("#") && !trimmed.startsWith("```")) {
|
|
431
|
+
description = trimmed;
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (description.length > 200) {
|
|
436
|
+
description = description.slice(0, 197) + "...";
|
|
437
|
+
}
|
|
438
|
+
return description || void 0;
|
|
439
|
+
}
|
|
440
|
+
function buildMarkdownWithFrontmatter(frontmatter, content) {
|
|
441
|
+
const cleanFrontmatter = {};
|
|
442
|
+
for (const [key, value] of Object.entries(frontmatter)) {
|
|
443
|
+
if (value !== void 0) {
|
|
444
|
+
cleanFrontmatter[key] = value;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
const yamlLines = ["---"];
|
|
448
|
+
const orderedKeys = ["title", "type", "status", "tags", "category", "description", "created", "updated", "aliases", "related"];
|
|
449
|
+
for (const key of orderedKeys) {
|
|
450
|
+
if (cleanFrontmatter[key] !== void 0) {
|
|
451
|
+
yamlLines.push(formatYamlLine(key, cleanFrontmatter[key]));
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
yamlLines.push("---");
|
|
455
|
+
yamlLines.push("");
|
|
456
|
+
return yamlLines.join("\n") + content.trim() + "\n";
|
|
457
|
+
}
|
|
458
|
+
function formatYamlLine(key, value) {
|
|
459
|
+
if (Array.isArray(value)) {
|
|
460
|
+
if (value.length === 0) return "";
|
|
461
|
+
return `${key}:
|
|
462
|
+
${value.map((v) => ` - ${v}`).join("\n")}`;
|
|
463
|
+
}
|
|
464
|
+
if (typeof value === "string" && (value.includes(":") || value.includes("#"))) {
|
|
465
|
+
return `${key}: "${value}"`;
|
|
466
|
+
}
|
|
467
|
+
return `${key}: ${value}`;
|
|
468
|
+
}
|
|
469
|
+
export {
|
|
470
|
+
addFrontmatter,
|
|
471
|
+
convertDocs,
|
|
472
|
+
validateFrontmatter
|
|
473
|
+
};
|
|
474
|
+
//# sourceMappingURL=docs-convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-convert.js","sources":["../../src/generators/docs-convert.ts"],"sourcesContent":["/**\n * Docs Converter\n *\n * Converts existing documentation to weave-nn structure with proper\n * frontmatter and directory organization.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync } from 'fs';\nimport { join, basename, dirname, relative, extname } from 'path';\nimport fg from 'fast-glob';\nimport matter from 'gray-matter';\nimport type { NodeType, NodeStatus, NodeFrontmatter } from '../core/types.js';\n\n/**\n * Conversion options\n */\nexport interface ConvertOptions {\n /** Source directory with existing docs */\n sourceDir: string;\n /** Target directory (default: docs-nn) */\n targetDir?: string;\n /** Project root for path resolution */\n projectRoot: string;\n /** Preserve original files (copy instead of move) */\n preserveOriginal?: boolean;\n /** Overwrite existing files in target */\n force?: boolean;\n /** Auto-categorize based on content analysis */\n autoCategory?: boolean;\n /** Dry run - show what would be done */\n dryRun?: boolean;\n}\n\n/**\n * Frontmatter options\n */\nexport interface FrontmatterOptions {\n /** Target file or directory */\n target: string;\n /** Project root */\n projectRoot: string;\n /** Override type detection */\n type?: NodeType;\n /** Override status */\n status?: NodeStatus;\n /** Additional tags to add */\n tags?: string[];\n /** Force overwrite existing frontmatter */\n force?: boolean;\n /** Dry run */\n dryRun?: boolean;\n}\n\n/**\n * Conversion result\n */\nexport interface ConvertResult {\n success: boolean;\n filesProcessed: number;\n filesConverted: number;\n filesSkipped: number;\n errors: string[];\n converted: Array<{\n source: string;\n target: string;\n type: NodeType;\n }>;\n}\n\n/**\n * Frontmatter result\n */\nexport interface FrontmatterResult {\n success: boolean;\n filesProcessed: number;\n filesUpdated: number;\n filesSkipped: number;\n errors: string[];\n}\n\n/**\n * Weave-NN directory structure mapping\n */\nconst CATEGORY_DIRS: Record<NodeType, string> = {\n concept: 'concepts',\n technical: 'components',\n feature: 'features',\n primitive: 'integrations',\n service: 'services',\n guide: 'guides',\n standard: 'standards',\n integration: 'integrations',\n};\n\n/**\n * Keywords for content-based categorization\n */\nconst CATEGORY_KEYWORDS: Record<NodeType, string[]> = {\n concept: [\n 'overview', 'introduction', 'theory', 'principle', 'concept',\n 'philosophy', 'approach', 'methodology', 'paradigm', 'model',\n ],\n technical: [\n 'component', 'implementation', 'class', 'function', 'module',\n 'algorithm', 'data structure', 'interface', 'abstract', 'utility',\n ],\n feature: [\n 'feature', 'capability', 'functionality', 'use case', 'user story',\n 'requirement', 'specification', 'product', 'roadmap',\n ],\n primitive: [\n 'library', 'framework', 'dependency', 'package', 'tool',\n 'sdk', 'runtime', 'platform', 'language',\n ],\n service: [\n 'api', 'endpoint', 'service', 'server', 'backend', 'microservice',\n 'rest', 'graphql', 'webhook', 'worker', 'queue',\n ],\n guide: [\n 'how to', 'tutorial', 'guide', 'walkthrough', 'step by step',\n 'getting started', 'setup', 'installation', 'configuration',\n ],\n standard: [\n 'standard', 'convention', 'best practice', 'rule', 'policy',\n 'guideline', 'coding style', 'lint', 'format',\n ],\n integration: [\n 'integration', 'connect', 'plugin', 'adapter', 'bridge',\n 'sync', 'import', 'export', 'webhook',\n ],\n};\n\n/**\n * Path-based categorization patterns\n */\nconst PATH_PATTERNS: Array<{ pattern: RegExp; type: NodeType }> = [\n { pattern: /\\/(api|endpoints?|routes?)\\//i, type: 'service' },\n { pattern: /\\/(guide|tutorial|howto|getting-started)\\//i, type: 'guide' },\n { pattern: /\\/(component|ui|widget)\\//i, type: 'technical' },\n { pattern: /\\/(feature|capability)\\//i, type: 'feature' },\n { pattern: /\\/(standard|convention|style)\\//i, type: 'standard' },\n { pattern: /\\/(integration|plugin|adapter)\\//i, type: 'integration' },\n { pattern: /\\/(service|worker|job)\\//i, type: 'service' },\n { pattern: /\\/(concept|architecture|design)\\//i, type: 'concept' },\n];\n\n/**\n * Convert existing docs to weave-nn structure\n */\nexport async function convertDocs(options: ConvertOptions): Promise<ConvertResult> {\n const {\n sourceDir,\n targetDir = 'docs-nn',\n projectRoot,\n preserveOriginal = true,\n force = false,\n autoCategory = true,\n dryRun = false,\n } = options;\n\n const result: ConvertResult = {\n success: true,\n filesProcessed: 0,\n filesConverted: 0,\n filesSkipped: 0,\n errors: [],\n converted: [],\n };\n\n const sourcePath = join(projectRoot, sourceDir);\n const targetPath = join(projectRoot, targetDir);\n\n // Validate source exists\n if (!existsSync(sourcePath)) {\n result.success = false;\n result.errors.push(`Source directory not found: ${sourcePath}`);\n return result;\n }\n\n // Create target structure\n if (!dryRun) {\n createTargetStructure(targetPath);\n }\n\n // Find all markdown files\n const files = await fg('**/*.md', {\n cwd: sourcePath,\n ignore: ['node_modules/**', '.git/**', '_templates/**'],\n });\n\n for (const file of files) {\n result.filesProcessed++;\n const sourceFile = join(sourcePath, file);\n\n try {\n // Read and parse file\n const content = readFileSync(sourceFile, 'utf-8');\n const { data: existingFrontmatter, content: body } = matter(content);\n\n // Determine node type\n const nodeType = autoCategory\n ? detectNodeType(file, body, existingFrontmatter)\n : (existingFrontmatter.type as NodeType) || 'concept';\n\n // Determine target path\n const targetSubdir = CATEGORY_DIRS[nodeType];\n const targetFile = join(targetPath, targetSubdir, basename(file));\n\n // Check if target exists\n if (existsSync(targetFile) && !force) {\n result.filesSkipped++;\n continue;\n }\n\n // Generate frontmatter\n const frontmatter = generateFrontmatter(file, body, nodeType, existingFrontmatter);\n\n // Build new content\n const newContent = buildMarkdownWithFrontmatter(frontmatter, body);\n\n if (!dryRun) {\n // Ensure directory exists\n mkdirSync(dirname(targetFile), { recursive: true });\n\n // Write converted file\n writeFileSync(targetFile, newContent, 'utf-8');\n }\n\n result.filesConverted++;\n result.converted.push({\n source: file,\n target: relative(projectRoot, targetFile),\n type: nodeType,\n });\n\n } catch (error) {\n result.errors.push(`Failed to convert ${file}: ${error}`);\n }\n }\n\n result.success = result.errors.length === 0;\n return result;\n}\n\n/**\n * Add or update frontmatter in existing files\n */\nexport async function addFrontmatter(options: FrontmatterOptions): Promise<FrontmatterResult> {\n const {\n target,\n projectRoot,\n type,\n status = 'active',\n tags = [],\n force = false,\n dryRun = false,\n } = options;\n\n const result: FrontmatterResult = {\n success: true,\n filesProcessed: 0,\n filesUpdated: 0,\n filesSkipped: 0,\n errors: [],\n };\n\n const targetPath = join(projectRoot, target);\n\n // Handle single file or directory\n let files: string[];\n if (existsSync(targetPath) && !targetPath.endsWith('.md')) {\n // Directory - find all markdown files\n files = await fg('**/*.md', {\n cwd: targetPath,\n ignore: ['node_modules/**', '.git/**', '_templates/**'],\n absolute: true,\n });\n } else if (existsSync(targetPath)) {\n files = [targetPath];\n } else {\n result.success = false;\n result.errors.push(`Target not found: ${targetPath}`);\n return result;\n }\n\n for (const file of files) {\n result.filesProcessed++;\n\n try {\n const content = readFileSync(file, 'utf-8');\n const { data: existingFrontmatter, content: body } = matter(content);\n\n // Skip if has frontmatter and not forcing\n if (Object.keys(existingFrontmatter).length > 0 && !force) {\n result.filesSkipped++;\n continue;\n }\n\n // Detect type if not specified\n const relPath = relative(projectRoot, file);\n const nodeType = type || detectNodeType(relPath, body, existingFrontmatter);\n\n // Generate frontmatter\n const frontmatter = generateFrontmatter(\n relPath,\n body,\n nodeType,\n force ? {} : existingFrontmatter,\n status,\n tags\n );\n\n // Build new content\n const newContent = buildMarkdownWithFrontmatter(frontmatter, body);\n\n if (!dryRun) {\n writeFileSync(file, newContent, 'utf-8');\n }\n\n result.filesUpdated++;\n\n } catch (error) {\n result.errors.push(`Failed to update ${file}: ${error}`);\n }\n }\n\n result.success = result.errors.length === 0;\n return result;\n}\n\n/**\n * Validate frontmatter in files\n */\nexport async function validateFrontmatter(\n target: string,\n projectRoot: string\n): Promise<{\n valid: number;\n invalid: number;\n missing: number;\n issues: Array<{ file: string; issues: string[] }>;\n}> {\n const result = {\n valid: 0,\n invalid: 0,\n missing: 0,\n issues: [] as Array<{ file: string; issues: string[] }>,\n };\n\n const targetPath = join(projectRoot, target);\n\n const files = await fg('**/*.md', {\n cwd: targetPath,\n ignore: ['node_modules/**', '.git/**', '_templates/**'],\n absolute: true,\n });\n\n const validTypes: NodeType[] = [\n 'concept', 'technical', 'feature', 'primitive',\n 'service', 'guide', 'standard', 'integration',\n ];\n\n const validStatuses: NodeStatus[] = ['draft', 'active', 'deprecated', 'archived'];\n\n for (const file of files) {\n const content = readFileSync(file, 'utf-8');\n const { data: frontmatter } = matter(content);\n const fileIssues: string[] = [];\n\n if (Object.keys(frontmatter).length === 0) {\n result.missing++;\n fileIssues.push('Missing frontmatter');\n } else {\n // Check required fields\n if (!frontmatter.title) {\n fileIssues.push('Missing title');\n }\n if (!frontmatter.type) {\n fileIssues.push('Missing type');\n } else if (!validTypes.includes(frontmatter.type)) {\n fileIssues.push(`Invalid type: ${frontmatter.type}`);\n }\n if (frontmatter.status && !validStatuses.includes(frontmatter.status)) {\n fileIssues.push(`Invalid status: ${frontmatter.status}`);\n }\n if (!frontmatter.created) {\n fileIssues.push('Missing created date');\n }\n }\n\n if (fileIssues.length > 0) {\n result.invalid++;\n result.issues.push({\n file: relative(projectRoot, file),\n issues: fileIssues,\n });\n } else if (Object.keys(frontmatter).length > 0) {\n result.valid++;\n }\n }\n\n return result;\n}\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Create target directory structure\n */\nfunction createTargetStructure(targetPath: string): void {\n const dirs = [\n '',\n 'concepts',\n 'concepts/architecture',\n 'concepts/patterns',\n 'components',\n 'components/ui',\n 'components/utilities',\n 'services',\n 'services/api',\n 'services/workers',\n 'features',\n 'features/core',\n 'features/advanced',\n 'integrations',\n 'integrations/databases',\n 'integrations/auth',\n 'standards',\n 'standards/coding',\n 'standards/documentation',\n 'guides',\n 'guides/getting-started',\n 'guides/tutorials',\n 'references',\n 'references/api',\n '_templates',\n '_attachments',\n ];\n\n for (const dir of dirs) {\n const fullPath = join(targetPath, dir);\n if (!existsSync(fullPath)) {\n mkdirSync(fullPath, { recursive: true });\n }\n }\n}\n\n/**\n * Detect node type from file path and content\n */\nfunction detectNodeType(\n filePath: string,\n content: string,\n existingFrontmatter: Record<string, unknown>\n): NodeType {\n // Use existing type if valid\n const validTypes: NodeType[] = [\n 'concept', 'technical', 'feature', 'primitive',\n 'service', 'guide', 'standard', 'integration',\n ];\n\n if (existingFrontmatter.type && validTypes.includes(existingFrontmatter.type as NodeType)) {\n return existingFrontmatter.type as NodeType;\n }\n\n // Check path patterns\n for (const { pattern, type } of PATH_PATTERNS) {\n if (pattern.test(filePath)) {\n return type;\n }\n }\n\n // Analyze content\n const lowerContent = content.toLowerCase();\n const scores: Record<NodeType, number> = {\n concept: 0,\n technical: 0,\n feature: 0,\n primitive: 0,\n service: 0,\n guide: 0,\n standard: 0,\n integration: 0,\n };\n\n for (const [nodeType, keywords] of Object.entries(CATEGORY_KEYWORDS)) {\n for (const keyword of keywords) {\n const regex = new RegExp(`\\\\b${keyword}\\\\b`, 'gi');\n const matches = lowerContent.match(regex);\n if (matches) {\n scores[nodeType as NodeType] += matches.length;\n }\n }\n }\n\n // Find highest scoring type\n let maxScore = 0;\n let detectedType: NodeType = 'concept';\n\n for (const [nodeType, score] of Object.entries(scores)) {\n if (score > maxScore) {\n maxScore = score;\n detectedType = nodeType as NodeType;\n }\n }\n\n return detectedType;\n}\n\n/**\n * Generate frontmatter for a file\n */\nfunction generateFrontmatter(\n filePath: string,\n content: string,\n nodeType: NodeType,\n existing: Record<string, unknown> = {},\n status: NodeStatus = 'active',\n additionalTags: string[] = []\n): NodeFrontmatter {\n const filename = basename(filePath, '.md');\n const title = existing.title as string || formatTitle(filename);\n\n // Extract tags from content\n const extractedTags = extractTags(content);\n const allTags = [...new Set([\n ...(existing.tags as string[] || []),\n ...extractedTags,\n ...additionalTags,\n ])];\n\n // Get dates\n const now = new Date().toISOString().split('T')[0];\n const created = existing.created as string || now;\n\n return {\n title,\n type: nodeType,\n status: existing.status as NodeStatus || status,\n tags: allTags.length > 0 ? allTags : undefined,\n category: existing.category as string || undefined,\n description: existing.description as string || extractDescription(content),\n created,\n updated: now,\n aliases: existing.aliases as string[] || undefined,\n related: existing.related as string[] || undefined,\n };\n}\n\n/**\n * Format filename as title\n */\nfunction formatTitle(filename: string): string {\n return filename\n .replace(/[-_]/g, ' ')\n .replace(/\\b\\w/g, c => c.toUpperCase())\n .trim();\n}\n\n/**\n * Extract tags from content\n */\nfunction extractTags(content: string): string[] {\n const tags: string[] = [];\n\n // Look for #tags in content\n const tagMatches = content.match(/#[\\w-]+/g);\n if (tagMatches) {\n tags.push(...tagMatches.map(t => t.slice(1)));\n }\n\n return tags.slice(0, 10); // Limit to 10 tags\n}\n\n/**\n * Extract description from first paragraph\n */\nfunction extractDescription(content: string): string | undefined {\n // Skip headers and find first paragraph\n const lines = content.split('\\n');\n let description = '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed && !trimmed.startsWith('#') && !trimmed.startsWith('```')) {\n description = trimmed;\n break;\n }\n }\n\n if (description.length > 200) {\n description = description.slice(0, 197) + '...';\n }\n\n return description || undefined;\n}\n\n/**\n * Build markdown content with frontmatter\n */\nfunction buildMarkdownWithFrontmatter(\n frontmatter: NodeFrontmatter,\n content: string\n): string {\n // Clean undefined values\n const cleanFrontmatter: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(frontmatter)) {\n if (value !== undefined) {\n cleanFrontmatter[key] = value;\n }\n }\n\n // Build YAML frontmatter\n const yamlLines = ['---'];\n\n // Order: title, type, status, tags, description, dates, others\n const orderedKeys = ['title', 'type', 'status', 'tags', 'category', 'description', 'created', 'updated', 'aliases', 'related'];\n\n for (const key of orderedKeys) {\n if (cleanFrontmatter[key] !== undefined) {\n yamlLines.push(formatYamlLine(key, cleanFrontmatter[key]));\n }\n }\n\n yamlLines.push('---');\n yamlLines.push('');\n\n return yamlLines.join('\\n') + content.trim() + '\\n';\n}\n\n/**\n * Format a YAML line\n */\nfunction formatYamlLine(key: string, value: unknown): string {\n if (Array.isArray(value)) {\n if (value.length === 0) return '';\n return `${key}:\\n${value.map(v => ` - ${v}`).join('\\n')}`;\n }\n if (typeof value === 'string' && (value.includes(':') || value.includes('#'))) {\n return `${key}: \"${value}\"`;\n }\n return `${key}: ${value}`;\n}\n"],"names":[],"mappings":";;;;AAmFA,MAAM,gBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,aAAa;AACf;AAKA,MAAM,oBAAgD;AAAA,EACpD,SAAS;AAAA,IACP;AAAA,IAAY;AAAA,IAAgB;AAAA,IAAU;AAAA,IAAa;AAAA,IACnD;AAAA,IAAc;AAAA,IAAY;AAAA,IAAe;AAAA,IAAY;AAAA,EAAA;AAAA,EAEvD,WAAW;AAAA,IACT;AAAA,IAAa;AAAA,IAAkB;AAAA,IAAS;AAAA,IAAY;AAAA,IACpD;AAAA,IAAa;AAAA,IAAkB;AAAA,IAAa;AAAA,IAAY;AAAA,EAAA;AAAA,EAE1D,SAAS;AAAA,IACP;AAAA,IAAW;AAAA,IAAc;AAAA,IAAiB;AAAA,IAAY;AAAA,IACtD;AAAA,IAAe;AAAA,IAAiB;AAAA,IAAW;AAAA,EAAA;AAAA,EAE7C,WAAW;AAAA,IACT;AAAA,IAAW;AAAA,IAAa;AAAA,IAAc;AAAA,IAAW;AAAA,IACjD;AAAA,IAAO;AAAA,IAAW;AAAA,IAAY;AAAA,EAAA;AAAA,EAEhC,SAAS;AAAA,IACP;AAAA,IAAO;AAAA,IAAY;AAAA,IA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,eAAe,WAAW,WAAW,WAAW,SAAS;AAE7H,aAAW,OAAO,aAAa;AAC7B,QAAI,iBAAiB,GAAG,MAAM,QAAW;AACvC,gBAAU,KAAK,eAAe,KAAK,iBAAiB,GAAG,CAAC,CAAC;AAAA,IAC3D;AAAA,EACF;AAEA,YAAU,KAAK,KAAK;AACpB,YAAU,KAAK,EAAE;AAEjB,SAAO,UAAU,KAAK,IAAI,IAAI,QAAQ,SAAS;AACjD;AAKA,SAAS,eAAe,KAAa,OAAwB;AAC3D,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,QAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,WAAO,GAAG,GAAG;AAAA,EAAM,MAAM,IAAI,CAAA,MAAK,OAAO,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA,EAC1D;AACA,MAAI,OAAO,UAAU,aAAa,MAAM,SAAS,GAAG,KAAK,MAAM,SAAS,GAAG,IAAI;AAC7E,WAAO,GAAG,GAAG,MAAM,KAAK;AAAA,EAC1B;AACA,SAAO,GAAG,GAAG,KAAK,KAAK;AACzB;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export type { NodeType, NodeStatus, NodeLink, NodeFrontmatter, KnowledgeNode, Gr
|
|
|
11
11
|
export { generateGraph, generateAndSave, updateGraph, } from './generators/graph-generator.js';
|
|
12
12
|
export { initDocs, docsExist, getDocsPath, } from './generators/docs-init.js';
|
|
13
13
|
export { generateClaudeMd, updateClaudeMd, addSection, getSectionTemplate, listSectionTemplates, } from './generators/claude-md.js';
|
|
14
|
+
export { convertDocs, addFrontmatter, validateFrontmatter, } from './generators/docs-convert.js';
|
|
15
|
+
export type { ConvertOptions, ConvertResult, FrontmatterOptions, FrontmatterResult, } from './generators/docs-convert.js';
|
|
16
|
+
export { analyzeDocs, } from './generators/docs-analyzer.js';
|
|
17
|
+
export type { AnalyzerOptions, AnalyzedDoc, AnalyzerResult, } from './generators/docs-analyzer.js';
|
|
14
18
|
export { ClaudeFlowIntegration, createClaudeFlowIntegration, generateMcpConfig, } from './integrations/claude-flow.js';
|
|
15
19
|
export { createCLI } from './cli/index.js';
|
|
16
20
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAEV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,eAAe,EACf,aAAa,EAGb,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EAGd,QAAQ,EACR,YAAY,EAGZ,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,WAAW,EACX,UAAU,EAGV,eAAe,EACf,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAA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BAA+B,CAAC;AAGvC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC,CAgFD"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import { generateGraph, updateGraph } from "./generators/graph-generator.js";
|
|
|
7
7
|
import { updateClaudeMd } from "./generators/claude-md.js";
|
|
8
8
|
import { addSection, generateClaudeMd, getSectionTemplate, listSectionTemplates } from "./generators/claude-md.js";
|
|
9
9
|
import { KnowledgeGraphManager, createKnowledgeGraph } from "./core/graph.js";
|
|
10
|
+
import { addFrontmatter, convertDocs, validateFrontmatter } from "./generators/docs-convert.js";
|
|
11
|
+
import { analyzeDocs } from "./generators/docs-analyzer.js";
|
|
10
12
|
import { ClaudeFlowIntegration, createClaudeFlowIntegration, generateMcpConfig } from "./integrations/claude-flow.js";
|
|
11
13
|
import { createCLI } from "./cli/index.js";
|
|
12
14
|
async function quickInit(options) {
|
|
@@ -78,7 +80,10 @@ export {
|
|
|
78
80
|
ClaudeFlowIntegration,
|
|
79
81
|
KnowledgeGraphDatabase,
|
|
80
82
|
KnowledgeGraphManager,
|
|
83
|
+
addFrontmatter,
|
|
81
84
|
addSection,
|
|
85
|
+
analyzeDocs,
|
|
86
|
+
convertDocs,
|
|
82
87
|
createCLI,
|
|
83
88
|
createClaudeFlowIntegration,
|
|
84
89
|
createDatabase,
|
|
@@ -94,6 +99,7 @@ export {
|
|
|
94
99
|
listSectionTemplates,
|
|
95
100
|
quickInit,
|
|
96
101
|
updateClaudeMd,
|
|
97
|
-
updateGraph
|
|
102
|
+
updateGraph,
|
|
103
|
+
validateFrontmatter
|
|
98
104
|
};
|
|
99
105
|
//# sourceMappingURL=index.js.map
|