@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
package/README.md
CHANGED
|
@@ -8,6 +8,9 @@ A powerful NPM library for creating and managing knowledge graphs for Claude Cod
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
10
10
|
- **Knowledge Graph Generation** - Automatically generate knowledge graphs from markdown documentation
|
|
11
|
+
- **Documentation Analyzer** - Advanced analyzer that migrates existing docs to structured knowledge graphs
|
|
12
|
+
- **Obsidian-Style Output** - Wikilinks, callouts, frontmatter, and tags following Obsidian conventions
|
|
13
|
+
- **Automatic Categorization** - AI-powered content analysis for intelligent document categorization
|
|
11
14
|
- **Docs Initialization** - Create structured documentation directories following weave-nn methodology
|
|
12
15
|
- **CLAUDE.md Management** - Generate and update CLAUDE.md configuration files
|
|
13
16
|
- **Claude-Flow Integration** - Sync knowledge graphs with claude-flow memory for cross-session persistence
|
|
@@ -37,7 +40,24 @@ kg init
|
|
|
37
40
|
kg init --path /path/to/project --docs documentation
|
|
38
41
|
```
|
|
39
42
|
|
|
40
|
-
### 2.
|
|
43
|
+
### 2. Analyze & Migrate Existing Documentation (NEW in v0.2.0)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Analyze docs and create knowledge graph structure
|
|
47
|
+
kg analyze
|
|
48
|
+
|
|
49
|
+
# Preview what would be created (dry run)
|
|
50
|
+
kg analyze --dry-run --verbose
|
|
51
|
+
|
|
52
|
+
# Deep analysis with claude-flow agents
|
|
53
|
+
kg analyze deep
|
|
54
|
+
|
|
55
|
+
# Generate analysis report only
|
|
56
|
+
kg analyze report
|
|
57
|
+
kg analyze report --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 3. Initialize Documentation Directory
|
|
41
61
|
|
|
42
62
|
```bash
|
|
43
63
|
# Create docs with weave-nn structure
|
|
@@ -47,7 +67,7 @@ kg docs init
|
|
|
47
67
|
kg docs init --no-examples
|
|
48
68
|
```
|
|
49
69
|
|
|
50
|
-
###
|
|
70
|
+
### 4. Generate Knowledge Graph
|
|
51
71
|
|
|
52
72
|
```bash
|
|
53
73
|
# Full generation
|
|
@@ -57,7 +77,20 @@ kg graph
|
|
|
57
77
|
kg graph --update
|
|
58
78
|
```
|
|
59
79
|
|
|
60
|
-
###
|
|
80
|
+
### 5. Convert Existing Docs
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Convert docs/ to docs-nn/ with proper structure
|
|
84
|
+
kg convert docs
|
|
85
|
+
|
|
86
|
+
# Add frontmatter to existing files
|
|
87
|
+
kg frontmatter add docs/
|
|
88
|
+
|
|
89
|
+
# Validate frontmatter
|
|
90
|
+
kg frontmatter validate docs/
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 6. Update CLAUDE.md
|
|
61
94
|
|
|
62
95
|
```bash
|
|
63
96
|
# Generate CLAUDE.md with knowledge graph integration
|
|
@@ -67,7 +100,7 @@ kg claude update
|
|
|
67
100
|
kg claude update --template full
|
|
68
101
|
```
|
|
69
102
|
|
|
70
|
-
###
|
|
103
|
+
### 7. Sync with Claude-Flow
|
|
71
104
|
|
|
72
105
|
```bash
|
|
73
106
|
# Sync to claude-flow memory
|
|
@@ -82,15 +115,112 @@ kg sync --show-commands
|
|
|
82
115
|
| Command | Description |
|
|
83
116
|
|---------|-------------|
|
|
84
117
|
| `kg init` | Initialize knowledge graph in project |
|
|
118
|
+
| `kg analyze` | **NEW** Analyze & migrate docs to knowledge graph structure |
|
|
119
|
+
| `kg analyze deep` | **NEW** Deep analysis with claude-flow agents |
|
|
120
|
+
| `kg analyze report` | **NEW** Generate analysis report without creating files |
|
|
85
121
|
| `kg graph` | Generate/update knowledge graph |
|
|
86
122
|
| `kg docs init` | Initialize docs directory |
|
|
87
123
|
| `kg docs status` | Show documentation status |
|
|
124
|
+
| `kg convert docs` | Convert existing docs to weave-nn structure |
|
|
125
|
+
| `kg frontmatter add` | Add frontmatter to markdown files |
|
|
126
|
+
| `kg frontmatter validate` | Validate frontmatter in files |
|
|
127
|
+
| `kg frontmatter update` | Update/regenerate frontmatter |
|
|
88
128
|
| `kg claude update` | Update CLAUDE.md |
|
|
89
129
|
| `kg claude preview` | Preview CLAUDE.md content |
|
|
90
130
|
| `kg sync` | Sync with claude-flow memory |
|
|
91
131
|
| `kg stats` | Display graph statistics |
|
|
92
132
|
| `kg search <query>` | Search the knowledge graph |
|
|
93
133
|
|
|
134
|
+
## Documentation Analyzer (v0.2.0)
|
|
135
|
+
|
|
136
|
+
The new analyzer automatically:
|
|
137
|
+
|
|
138
|
+
1. **Categorizes documents** into appropriate directories based on content analysis
|
|
139
|
+
2. **Extracts metadata** including title, type, tags, and key concepts
|
|
140
|
+
3. **Generates frontmatter** with proper weave-nn fields
|
|
141
|
+
4. **Creates wikilinks** between related documents
|
|
142
|
+
5. **Builds MOC files** (Map of Content) for navigation
|
|
143
|
+
6. **Identifies research areas** and TODOs for follow-up
|
|
144
|
+
7. **Links to originals** for reference back to source documentation
|
|
145
|
+
|
|
146
|
+
### Analyzer Output Structure
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
docs-nn/
|
|
150
|
+
├── MOC.md # Master index
|
|
151
|
+
├── PRIMITIVES.md # Core building blocks
|
|
152
|
+
├── concepts/
|
|
153
|
+
│ ├── _MOC.md # Category index
|
|
154
|
+
│ └── *.md # Concept documents
|
|
155
|
+
├── components/
|
|
156
|
+
│ ├── _MOC.md
|
|
157
|
+
│ └── *.md
|
|
158
|
+
├── services/
|
|
159
|
+
├── features/
|
|
160
|
+
├── integrations/
|
|
161
|
+
├── standards/
|
|
162
|
+
├── guides/
|
|
163
|
+
├── references/
|
|
164
|
+
├── _templates/
|
|
165
|
+
├── _attachments/
|
|
166
|
+
└── _archive/
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Generated Document Format
|
|
170
|
+
|
|
171
|
+
Each analyzed document includes:
|
|
172
|
+
|
|
173
|
+
```markdown
|
|
174
|
+
---
|
|
175
|
+
title: "Document Title"
|
|
176
|
+
type: concept
|
|
177
|
+
status: active
|
|
178
|
+
tags:
|
|
179
|
+
- tag1
|
|
180
|
+
- tag2
|
|
181
|
+
category: concepts
|
|
182
|
+
description: "Auto-generated summary"
|
|
183
|
+
created: 2025-01-01
|
|
184
|
+
updated: 2025-01-01
|
|
185
|
+
original: "docs/original-file.md"
|
|
186
|
+
related:
|
|
187
|
+
- "[[Related Document]]"
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
# Document Title
|
|
191
|
+
|
|
192
|
+
## Overview
|
|
193
|
+
|
|
194
|
+
Auto-generated summary...
|
|
195
|
+
|
|
196
|
+
> [!info] Original Documentation
|
|
197
|
+
> See [[docs/original-file.md|original document]] for full details.
|
|
198
|
+
|
|
199
|
+
## Key Concepts
|
|
200
|
+
|
|
201
|
+
- **Concept 1**
|
|
202
|
+
- **Concept 2**
|
|
203
|
+
|
|
204
|
+
## Related
|
|
205
|
+
|
|
206
|
+
- [[Related Document 1]]
|
|
207
|
+
- [[Related Document 2]]
|
|
208
|
+
|
|
209
|
+
## Research Needed
|
|
210
|
+
|
|
211
|
+
> [!warning] Areas Requiring Further Research
|
|
212
|
+
> - Area needing investigation
|
|
213
|
+
|
|
214
|
+
## TODOs
|
|
215
|
+
|
|
216
|
+
- [ ] Task to complete
|
|
217
|
+
- [ ] Another task
|
|
218
|
+
|
|
219
|
+
## Tags
|
|
220
|
+
|
|
221
|
+
#tag1 #tag2
|
|
222
|
+
```
|
|
223
|
+
|
|
94
224
|
## Programmatic Usage
|
|
95
225
|
|
|
96
226
|
```typescript
|
|
@@ -100,6 +230,10 @@ import {
|
|
|
100
230
|
initDocs,
|
|
101
231
|
generateClaudeMd,
|
|
102
232
|
quickInit,
|
|
233
|
+
// New in v0.2.0
|
|
234
|
+
analyzeDocs,
|
|
235
|
+
convertDocs,
|
|
236
|
+
addFrontmatter,
|
|
103
237
|
} from '@weavelogic/knowledge-graph-agent';
|
|
104
238
|
|
|
105
239
|
// Quick initialization
|
|
@@ -110,6 +244,37 @@ const result = await quickInit({
|
|
|
110
244
|
updateClaudeMd: true,
|
|
111
245
|
});
|
|
112
246
|
|
|
247
|
+
// Analyze and migrate documentation (NEW)
|
|
248
|
+
const analyzeResult = await analyzeDocs({
|
|
249
|
+
sourceDir: 'docs',
|
|
250
|
+
targetDir: 'docs-nn',
|
|
251
|
+
projectRoot: '/path/to/project',
|
|
252
|
+
useClaudeFlow: false,
|
|
253
|
+
createMOC: true,
|
|
254
|
+
linkOriginal: true,
|
|
255
|
+
dryRun: false,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
console.log(`Analyzed: ${analyzeResult.filesAnalyzed}`);
|
|
259
|
+
console.log(`Created: ${analyzeResult.filesCreated}`);
|
|
260
|
+
console.log(`MOC files: ${analyzeResult.mocFilesCreated}`);
|
|
261
|
+
|
|
262
|
+
// Convert existing docs
|
|
263
|
+
const convertResult = await convertDocs({
|
|
264
|
+
sourceDir: 'docs',
|
|
265
|
+
targetDir: 'docs-nn',
|
|
266
|
+
projectRoot: '/path/to/project',
|
|
267
|
+
autoCategory: true,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Add frontmatter to files
|
|
271
|
+
const fmResult = await addFrontmatter({
|
|
272
|
+
target: 'docs',
|
|
273
|
+
projectRoot: '/path/to/project',
|
|
274
|
+
type: 'concept',
|
|
275
|
+
status: 'active',
|
|
276
|
+
});
|
|
277
|
+
|
|
113
278
|
// Or use individual components
|
|
114
279
|
const db = createDatabase('.kg/knowledge.db');
|
|
115
280
|
const graph = createKnowledgeGraph('my-project', '/project/root');
|
|
@@ -192,6 +357,9 @@ created: 2025-01-01
|
|
|
192
357
|
updated: 2025-01-01
|
|
193
358
|
aliases: [Alternative Name]
|
|
194
359
|
related: [other-document]
|
|
360
|
+
category: concepts
|
|
361
|
+
description: Brief description
|
|
362
|
+
original: docs/source-file.md
|
|
195
363
|
---
|
|
196
364
|
```
|
|
197
365
|
|
|
@@ -202,6 +370,7 @@ The knowledge graph integrates with claude-flow for:
|
|
|
202
370
|
- **Memory Persistence**: Store graph data in claude-flow memory
|
|
203
371
|
- **Cross-Session Context**: Access knowledge across Claude sessions
|
|
204
372
|
- **Agent Coordination**: Share knowledge between swarm agents
|
|
373
|
+
- **Deep Analysis**: Use claude-flow agents for comprehensive documentation analysis
|
|
205
374
|
|
|
206
375
|
### MCP Commands
|
|
207
376
|
|
|
@@ -247,10 +416,40 @@ Create `.kg/config.json` to customize behavior:
|
|
|
247
416
|
"enabled": true,
|
|
248
417
|
"namespace": "knowledge-graph",
|
|
249
418
|
"syncOnChange": true
|
|
419
|
+
},
|
|
420
|
+
"analyzer": {
|
|
421
|
+
"targetDir": "docs-nn",
|
|
422
|
+
"createMOC": true,
|
|
423
|
+
"linkOriginal": true
|
|
250
424
|
}
|
|
251
425
|
}
|
|
252
426
|
```
|
|
253
427
|
|
|
428
|
+
## Changelog
|
|
429
|
+
|
|
430
|
+
### v0.2.0 (2025-12-29)
|
|
431
|
+
|
|
432
|
+
- **NEW**: `kg analyze` command for advanced documentation analysis and migration
|
|
433
|
+
- **NEW**: `kg analyze deep` for claude-flow powered deep analysis
|
|
434
|
+
- **NEW**: `kg analyze report` for generating analysis reports
|
|
435
|
+
- **NEW**: `kg convert docs` for converting existing documentation
|
|
436
|
+
- **NEW**: `kg frontmatter add/validate/update` commands
|
|
437
|
+
- **NEW**: Automatic categorization based on content analysis
|
|
438
|
+
- **NEW**: MOC (Map of Content) generation for navigation
|
|
439
|
+
- **NEW**: Obsidian-style callouts (`> [!info]`, `> [!warning]`)
|
|
440
|
+
- **NEW**: Research area detection and TODO extraction
|
|
441
|
+
- **NEW**: Cross-reference building between related documents
|
|
442
|
+
- **IMPROVED**: Enhanced frontmatter generation with more fields
|
|
443
|
+
|
|
444
|
+
### v0.1.0 (2025-12-28)
|
|
445
|
+
|
|
446
|
+
- Initial release
|
|
447
|
+
- Knowledge graph generation
|
|
448
|
+
- Docs initialization
|
|
449
|
+
- CLAUDE.md management
|
|
450
|
+
- Claude-flow integration
|
|
451
|
+
- Full-text search
|
|
452
|
+
|
|
254
453
|
## API Reference
|
|
255
454
|
|
|
256
455
|
See [docs/API.md](./docs/API.md) for detailed API documentation.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analyze Command
|
|
3
|
+
*
|
|
4
|
+
* Advanced documentation analyzer using claude-flow for deep analysis
|
|
5
|
+
* and creating proper knowledge graph documentation structure.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
/**
|
|
9
|
+
* Create analyze command
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAnalyzeCommand(): Command;
|
|
12
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/analyze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAyV9C"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import ora from "ora";
|
|
4
|
+
import { existsSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import { analyzeDocs } from "../../generators/docs-analyzer.js";
|
|
7
|
+
import { validateProjectRoot } from "../../core/security.js";
|
|
8
|
+
function createAnalyzeCommand() {
|
|
9
|
+
const command = new Command("analyze");
|
|
10
|
+
command.description("Analyze and migrate docs to knowledge graph structure").option("-p, --path <path>", "Project root path", ".").option("-s, --source <dir>", "Source docs directory", "docs").option("-t, --target <dir>", "Target directory", "docs-nn").option("--use-claude-flow", "Use claude-flow for deep analysis").option("--no-moc", "Skip MOC (Map of Content) generation").option("--no-link-original", "Do not link back to original docs").option("--max-depth <n>", "Maximum analysis depth", "3").option("--dry-run", "Show what would be done without making changes").option("-v, --verbose", "Verbose output").action(async (options) => {
|
|
11
|
+
const spinner = ora("Analyzing documentation...").start();
|
|
12
|
+
try {
|
|
13
|
+
const projectRoot = validateProjectRoot(options.path);
|
|
14
|
+
const sourceDir = options.source;
|
|
15
|
+
const targetDir = options.target;
|
|
16
|
+
if (!existsSync(join(projectRoot, sourceDir))) {
|
|
17
|
+
spinner.fail(`Source directory not found: ${sourceDir}`);
|
|
18
|
+
console.log(chalk.gray(" Specify source with --source <dir>"));
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
if (existsSync(join(projectRoot, targetDir)) && !options.dryRun) {
|
|
22
|
+
spinner.warn(`Target directory exists: ${targetDir}`);
|
|
23
|
+
console.log(chalk.yellow(" Files may be overwritten. Use --dry-run to preview."));
|
|
24
|
+
}
|
|
25
|
+
if (options.dryRun) {
|
|
26
|
+
spinner.text = "Analyzing documentation (dry run)...";
|
|
27
|
+
}
|
|
28
|
+
if (options.useClaudeFlow) {
|
|
29
|
+
spinner.text = "Analyzing with claude-flow (deep analysis)...";
|
|
30
|
+
}
|
|
31
|
+
const result = await analyzeDocs({
|
|
32
|
+
sourceDir,
|
|
33
|
+
targetDir,
|
|
34
|
+
projectRoot,
|
|
35
|
+
useClaudeFlow: options.useClaudeFlow,
|
|
36
|
+
createMOC: options.moc !== false,
|
|
37
|
+
linkOriginal: options.linkOriginal !== false,
|
|
38
|
+
maxDepth: parseInt(options.maxDepth, 10),
|
|
39
|
+
dryRun: options.dryRun,
|
|
40
|
+
verbose: options.verbose
|
|
41
|
+
});
|
|
42
|
+
if (result.success) {
|
|
43
|
+
if (options.dryRun) {
|
|
44
|
+
spinner.succeed("Dry run complete!");
|
|
45
|
+
} else {
|
|
46
|
+
spinner.succeed("Documentation analyzed and migrated!");
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
spinner.warn("Analysis completed with errors");
|
|
50
|
+
}
|
|
51
|
+
console.log();
|
|
52
|
+
console.log(chalk.cyan.bold(" Analysis Results"));
|
|
53
|
+
console.log(chalk.gray(" ─────────────────────────────────────"));
|
|
54
|
+
console.log();
|
|
55
|
+
console.log(chalk.white(" Summary:"));
|
|
56
|
+
console.log(chalk.gray(` Source: ${sourceDir}/`));
|
|
57
|
+
console.log(chalk.gray(` Target: ${targetDir}/`));
|
|
58
|
+
console.log(chalk.green(` Files analyzed: ${result.filesAnalyzed}`));
|
|
59
|
+
console.log(chalk.green(` Files created: ${result.filesCreated}`));
|
|
60
|
+
console.log(chalk.blue(` MOC files: ${result.mocFilesCreated}`));
|
|
61
|
+
if (result.structure.size > 0) {
|
|
62
|
+
console.log();
|
|
63
|
+
console.log(chalk.white(" Categories:"));
|
|
64
|
+
for (const [category, docs] of result.structure) {
|
|
65
|
+
console.log(chalk.cyan(` ${category.padEnd(15)}`), chalk.gray(`${docs.length} docs`));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (result.analyzed.length > 0 && options.verbose) {
|
|
69
|
+
console.log();
|
|
70
|
+
console.log(chalk.white(" Sample documents:"));
|
|
71
|
+
result.analyzed.slice(0, 5).forEach((doc) => {
|
|
72
|
+
console.log(chalk.gray(` ${doc.originalPath}`));
|
|
73
|
+
console.log(chalk.cyan(` → ${doc.newPath}`) + chalk.gray(` [${doc.type}]`));
|
|
74
|
+
if (doc.tags.length > 0) {
|
|
75
|
+
console.log(chalk.gray(` tags: ${doc.tags.slice(0, 5).map((t) => `#${t}`).join(" ")}`));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
if (result.analyzed.length > 5) {
|
|
79
|
+
console.log(chalk.gray(` ... and ${result.analyzed.length - 5} more`));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (result.errors.length > 0) {
|
|
83
|
+
console.log();
|
|
84
|
+
console.log(chalk.red(" Errors:"));
|
|
85
|
+
result.errors.slice(0, 5).forEach((err) => {
|
|
86
|
+
console.log(chalk.gray(` - ${err}`));
|
|
87
|
+
});
|
|
88
|
+
if (result.errors.length > 5) {
|
|
89
|
+
console.log(chalk.gray(` ... and ${result.errors.length - 5} more`));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const researchDocs = result.analyzed.filter((d) => d.researchNeeded.length > 0);
|
|
93
|
+
const todoDocs = result.analyzed.filter((d) => d.todos.length > 0);
|
|
94
|
+
if (researchDocs.length > 0 || todoDocs.length > 0) {
|
|
95
|
+
console.log();
|
|
96
|
+
console.log(chalk.yellow(" Attention Needed:"));
|
|
97
|
+
if (researchDocs.length > 0) {
|
|
98
|
+
console.log(chalk.yellow(` 📚 ${researchDocs.length} docs need research`));
|
|
99
|
+
}
|
|
100
|
+
if (todoDocs.length > 0) {
|
|
101
|
+
console.log(chalk.yellow(` ✏️ ${todoDocs.length} docs have TODOs`));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (!options.dryRun && result.filesCreated > 0) {
|
|
105
|
+
console.log();
|
|
106
|
+
console.log(chalk.cyan(" Next steps:"));
|
|
107
|
+
console.log(chalk.white(` 1. Review ${targetDir}/MOC.md (Master Index)`));
|
|
108
|
+
console.log(chalk.white(` 2. Check ${targetDir}/PRIMITIVES.md`));
|
|
109
|
+
console.log(chalk.white(` 3. Run: kg graph --docs ${targetDir}`));
|
|
110
|
+
console.log(chalk.white(` 4. Run: kg stats --docs ${targetDir}`));
|
|
111
|
+
if (researchDocs.length > 0) {
|
|
112
|
+
console.log(chalk.white(` 5. Address research items in flagged docs`));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
console.log();
|
|
116
|
+
} catch (error) {
|
|
117
|
+
spinner.fail("Analysis failed");
|
|
118
|
+
console.error(chalk.red(String(error)));
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
command.command("deep").description("Deep analysis using claude-flow agents for comprehensive knowledge extraction").option("-p, --path <path>", "Project root path", ".").option("-s, --source <dir>", "Source docs directory", "docs").option("-t, --target <dir>", "Target directory", "docs-nn").option("--agents <n>", "Number of parallel agents", "3").action(async (options) => {
|
|
123
|
+
const spinner = ora("Initializing deep analysis with claude-flow...").start();
|
|
124
|
+
try {
|
|
125
|
+
const projectRoot = validateProjectRoot(options.path);
|
|
126
|
+
const sourceDir = options.source;
|
|
127
|
+
const targetDir = options.target;
|
|
128
|
+
if (!existsSync(join(projectRoot, sourceDir))) {
|
|
129
|
+
spinner.fail(`Source directory not found: ${sourceDir}`);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
spinner.text = "Running claude-flow deep analysis...";
|
|
133
|
+
const result = await analyzeDocs({
|
|
134
|
+
sourceDir,
|
|
135
|
+
targetDir,
|
|
136
|
+
projectRoot,
|
|
137
|
+
useClaudeFlow: true,
|
|
138
|
+
createMOC: true,
|
|
139
|
+
linkOriginal: true,
|
|
140
|
+
maxDepth: 5,
|
|
141
|
+
dryRun: false,
|
|
142
|
+
verbose: true
|
|
143
|
+
});
|
|
144
|
+
if (result.success) {
|
|
145
|
+
spinner.succeed("Deep analysis complete!");
|
|
146
|
+
} else {
|
|
147
|
+
spinner.warn("Deep analysis completed with some errors");
|
|
148
|
+
}
|
|
149
|
+
console.log();
|
|
150
|
+
console.log(chalk.cyan.bold(" Deep Analysis Results"));
|
|
151
|
+
console.log(chalk.gray(" ─────────────────────────────────────"));
|
|
152
|
+
console.log(chalk.green(` Documents analyzed: ${result.filesAnalyzed}`));
|
|
153
|
+
console.log(chalk.green(` Knowledge docs: ${result.filesCreated}`));
|
|
154
|
+
console.log(chalk.blue(` Index files (MOC): ${result.mocFilesCreated}`));
|
|
155
|
+
console.log(chalk.gray(` Categories: ${result.structure.size}`));
|
|
156
|
+
const totalResearch = result.analyzed.reduce((sum, d) => sum + d.researchNeeded.length, 0);
|
|
157
|
+
const totalTodos = result.analyzed.reduce((sum, d) => sum + d.todos.length, 0);
|
|
158
|
+
console.log();
|
|
159
|
+
console.log(chalk.white(" Knowledge extraction:"));
|
|
160
|
+
console.log(chalk.cyan(` Research areas: ${totalResearch}`));
|
|
161
|
+
console.log(chalk.cyan(` TODOs found: ${totalTodos}`));
|
|
162
|
+
console.log(chalk.cyan(` Concepts: ${result.analyzed.reduce((sum, d) => sum + d.concepts.length, 0)}`));
|
|
163
|
+
console.log(chalk.cyan(` Cross-refs: ${result.analyzed.reduce((sum, d) => sum + d.related.length, 0)}`));
|
|
164
|
+
console.log();
|
|
165
|
+
console.log(chalk.white(` Output: ${targetDir}/`));
|
|
166
|
+
console.log(chalk.gray(` MOC.md Master index`));
|
|
167
|
+
console.log(chalk.gray(` PRIMITIVES.md Core building blocks`));
|
|
168
|
+
console.log(chalk.gray(` */_MOC.md Category indexes`));
|
|
169
|
+
console.log();
|
|
170
|
+
} catch (error) {
|
|
171
|
+
spinner.fail("Deep analysis failed");
|
|
172
|
+
console.error(chalk.red(String(error)));
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
command.command("report").description("Generate analysis report without creating files").option("-p, --path <path>", "Project root path", ".").option("-s, --source <dir>", "Source docs directory", "docs").option("--json", "Output as JSON").action(async (options) => {
|
|
177
|
+
const spinner = ora("Generating analysis report...").start();
|
|
178
|
+
try {
|
|
179
|
+
const projectRoot = validateProjectRoot(options.path);
|
|
180
|
+
const sourceDir = options.source;
|
|
181
|
+
if (!existsSync(join(projectRoot, sourceDir))) {
|
|
182
|
+
spinner.fail(`Source directory not found: ${sourceDir}`);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
const result = await analyzeDocs({
|
|
186
|
+
sourceDir,
|
|
187
|
+
targetDir: "docs-nn",
|
|
188
|
+
projectRoot,
|
|
189
|
+
useClaudeFlow: false,
|
|
190
|
+
createMOC: false,
|
|
191
|
+
linkOriginal: false,
|
|
192
|
+
dryRun: true,
|
|
193
|
+
verbose: false
|
|
194
|
+
});
|
|
195
|
+
spinner.succeed("Report generated!");
|
|
196
|
+
if (options.json) {
|
|
197
|
+
const report = {
|
|
198
|
+
summary: {
|
|
199
|
+
totalDocs: result.filesAnalyzed,
|
|
200
|
+
categories: Object.fromEntries(result.structure)
|
|
201
|
+
},
|
|
202
|
+
documents: result.analyzed.map((d) => ({
|
|
203
|
+
original: d.originalPath,
|
|
204
|
+
target: d.newPath,
|
|
205
|
+
type: d.type,
|
|
206
|
+
category: d.category,
|
|
207
|
+
tags: d.tags,
|
|
208
|
+
concepts: d.concepts,
|
|
209
|
+
researchNeeded: d.researchNeeded,
|
|
210
|
+
todos: d.todos
|
|
211
|
+
})),
|
|
212
|
+
researchAreas: result.analyzed.flatMap((d) => d.researchNeeded.map((r) => ({ doc: d.title, area: r }))),
|
|
213
|
+
todos: result.analyzed.flatMap((d) => d.todos.map((t) => ({ doc: d.title, todo: t })))
|
|
214
|
+
};
|
|
215
|
+
console.log(JSON.stringify(report, null, 2));
|
|
216
|
+
} else {
|
|
217
|
+
console.log();
|
|
218
|
+
console.log(chalk.cyan.bold(" Documentation Analysis Report"));
|
|
219
|
+
console.log(chalk.gray(" ─────────────────────────────────────"));
|
|
220
|
+
console.log();
|
|
221
|
+
console.log(chalk.white(` Total documents: ${result.filesAnalyzed}`));
|
|
222
|
+
console.log();
|
|
223
|
+
const byType = /* @__PURE__ */ new Map();
|
|
224
|
+
result.analyzed.forEach((d) => {
|
|
225
|
+
byType.set(d.type, (byType.get(d.type) || 0) + 1);
|
|
226
|
+
});
|
|
227
|
+
console.log(chalk.white(" By Type:"));
|
|
228
|
+
for (const [type, count] of byType) {
|
|
229
|
+
const bar = "█".repeat(Math.ceil(count / result.filesAnalyzed * 20));
|
|
230
|
+
console.log(chalk.cyan(` ${type.padEnd(12)} ${bar} ${count}`));
|
|
231
|
+
}
|
|
232
|
+
console.log();
|
|
233
|
+
console.log(chalk.white(" By Category:"));
|
|
234
|
+
for (const [category, docs] of result.structure) {
|
|
235
|
+
const bar = "█".repeat(Math.ceil(docs.length / result.filesAnalyzed * 20));
|
|
236
|
+
console.log(chalk.cyan(` ${category.padEnd(12)} ${bar} ${docs.length}`));
|
|
237
|
+
}
|
|
238
|
+
console.log();
|
|
239
|
+
const withResearch = result.analyzed.filter((d) => d.researchNeeded.length > 0);
|
|
240
|
+
const withTodos = result.analyzed.filter((d) => d.todos.length > 0);
|
|
241
|
+
console.log(chalk.white(" Areas Needing Attention:"));
|
|
242
|
+
console.log(chalk.yellow(` 📚 Research needed: ${withResearch.length} docs`));
|
|
243
|
+
console.log(chalk.yellow(` ✏️ With TODOs: ${withTodos.length} docs`));
|
|
244
|
+
console.log();
|
|
245
|
+
if (withResearch.length > 0) {
|
|
246
|
+
console.log(chalk.white(" Top Research Areas:"));
|
|
247
|
+
withResearch.slice(0, 5).forEach((d) => {
|
|
248
|
+
console.log(chalk.gray(` ${d.title}:`));
|
|
249
|
+
d.researchNeeded.slice(0, 2).forEach((r) => {
|
|
250
|
+
console.log(chalk.yellow(` - ${r.slice(0, 60)}...`));
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
console.log();
|
|
254
|
+
}
|
|
255
|
+
console.log(chalk.cyan(" Run `kg analyze` to migrate documentation"));
|
|
256
|
+
console.log();
|
|
257
|
+
}
|
|
258
|
+
} catch (error) {
|
|
259
|
+
spinner.fail("Report generation failed");
|
|
260
|
+
console.error(chalk.red(String(error)));
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return command;
|
|
265
|
+
}
|
|
266
|
+
export {
|
|
267
|
+
createAnalyzeCommand
|
|
268
|
+
};
|
|
269
|
+
//# sourceMappingURL=analyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.js","sources":["../../../src/cli/commands/analyze.ts"],"sourcesContent":["/**\n * Analyze Command\n *\n * Advanced documentation analyzer using claude-flow for deep analysis\n * and creating proper knowledge graph documentation structure.\n */\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\nimport { analyzeDocs } from '../../generators/docs-analyzer.js';\nimport { validateProjectRoot } from '../../core/security.js';\n\n/**\n * Create analyze command\n */\nexport function createAnalyzeCommand(): Command {\n const command = new Command('analyze');\n\n command\n .description('Analyze and migrate docs to knowledge graph structure')\n .option('-p, --path <path>', 'Project root path', '.')\n .option('-s, --source <dir>', 'Source docs directory', 'docs')\n .option('-t, --target <dir>', 'Target directory', 'docs-nn')\n .option('--use-claude-flow', 'Use claude-flow for deep analysis')\n .option('--no-moc', 'Skip MOC (Map of Content) generation')\n .option('--no-link-original', 'Do not link back to original docs')\n .option('--max-depth <n>', 'Maximum analysis depth', '3')\n .option('--dry-run', 'Show what would be done without making changes')\n .option('-v, --verbose', 'Verbose output')\n .action(async (options) => {\n const spinner = ora('Analyzing documentation...').start();\n\n try {\n const projectRoot = validateProjectRoot(options.path);\n const sourceDir = options.source;\n const targetDir = options.target;\n\n // Check source exists\n if (!existsSync(join(projectRoot, sourceDir))) {\n spinner.fail(`Source directory not found: ${sourceDir}`);\n console.log(chalk.gray(' Specify source with --source <dir>'));\n process.exit(1);\n }\n\n // Check if target already exists\n if (existsSync(join(projectRoot, targetDir)) && !options.dryRun) {\n spinner.warn(`Target directory exists: ${targetDir}`);\n console.log(chalk.yellow(' Files may be overwritten. Use --dry-run to preview.'));\n }\n\n if (options.dryRun) {\n spinner.text = 'Analyzing documentation (dry run)...';\n }\n\n if (options.useClaudeFlow) {\n spinner.text = 'Analyzing with claude-flow (deep analysis)...';\n }\n\n const result = await analyzeDocs({\n sourceDir,\n targetDir,\n projectRoot,\n useClaudeFlow: options.useClaudeFlow,\n createMOC: options.moc !== false,\n linkOriginal: options.linkOriginal !== false,\n maxDepth: parseInt(options.maxDepth, 10),\n dryRun: options.dryRun,\n verbose: options.verbose,\n });\n\n if (result.success) {\n if (options.dryRun) {\n spinner.succeed('Dry run complete!');\n } else {\n spinner.succeed('Documentation analyzed and migrated!');\n }\n } else {\n spinner.warn('Analysis completed with errors');\n }\n\n // Display results\n console.log();\n console.log(chalk.cyan.bold(' Analysis Results'));\n console.log(chalk.gray(' ─────────────────────────────────────'));\n console.log();\n console.log(chalk.white(' Summary:'));\n console.log(chalk.gray(` Source: ${sourceDir}/`));\n console.log(chalk.gray(` Target: ${targetDir}/`));\n console.log(chalk.green(` Files analyzed: ${result.filesAnalyzed}`));\n console.log(chalk.green(` Files created: ${result.filesCreated}`));\n console.log(chalk.blue(` MOC files: ${result.mocFilesCreated}`));\n\n // Category breakdown\n if (result.structure.size > 0) {\n console.log();\n console.log(chalk.white(' Categories:'));\n for (const [category, docs] of result.structure) {\n console.log(chalk.cyan(` ${category.padEnd(15)}`), chalk.gray(`${docs.length} docs`));\n }\n }\n\n // Show sample analyzed documents\n if (result.analyzed.length > 0 && options.verbose) {\n console.log();\n console.log(chalk.white(' Sample documents:'));\n result.analyzed.slice(0, 5).forEach(doc => {\n console.log(chalk.gray(` ${doc.originalPath}`));\n console.log(chalk.cyan(` → ${doc.newPath}`) + chalk.gray(` [${doc.type}]`));\n if (doc.tags.length > 0) {\n console.log(chalk.gray(` tags: ${doc.tags.slice(0, 5).map(t => `#${t}`).join(' ')}`));\n }\n });\n if (result.analyzed.length > 5) {\n console.log(chalk.gray(` ... and ${result.analyzed.length - 5} more`));\n }\n }\n\n // Show errors\n if (result.errors.length > 0) {\n console.log();\n console.log(chalk.red(' Errors:'));\n result.errors.slice(0, 5).forEach(err => {\n console.log(chalk.gray(` - ${err}`));\n });\n if (result.errors.length > 5) {\n console.log(chalk.gray(` ... and ${result.errors.length - 5} more`));\n }\n }\n\n // Research needed summary\n const researchDocs = result.analyzed.filter(d => d.researchNeeded.length > 0);\n const todoDocs = result.analyzed.filter(d => d.todos.length > 0);\n\n if (researchDocs.length > 0 || todoDocs.length > 0) {\n console.log();\n console.log(chalk.yellow(' Attention Needed:'));\n if (researchDocs.length > 0) {\n console.log(chalk.yellow(` 📚 ${researchDocs.length} docs need research`));\n }\n if (todoDocs.length > 0) {\n console.log(chalk.yellow(` ✏️ ${todoDocs.length} docs have TODOs`));\n }\n }\n\n // Next steps\n if (!options.dryRun && result.filesCreated > 0) {\n console.log();\n console.log(chalk.cyan(' Next steps:'));\n console.log(chalk.white(` 1. Review ${targetDir}/MOC.md (Master Index)`));\n console.log(chalk.white(` 2. Check ${targetDir}/PRIMITIVES.md`));\n console.log(chalk.white(` 3. Run: kg graph --docs ${targetDir}`));\n console.log(chalk.white(` 4. Run: kg stats --docs ${targetDir}`));\n if (researchDocs.length > 0) {\n console.log(chalk.white(` 5. Address research items in flagged docs`));\n }\n }\n\n console.log();\n\n } catch (error) {\n spinner.fail('Analysis failed');\n console.error(chalk.red(String(error)));\n process.exit(1);\n }\n });\n\n // Deep analyze subcommand (uses claude-flow agents)\n command\n .command('deep')\n .description('Deep analysis using claude-flow agents for comprehensive knowledge extraction')\n .option('-p, --path <path>', 'Project root path', '.')\n .option('-s, --source <dir>', 'Source docs directory', 'docs')\n .option('-t, --target <dir>', 'Target directory', 'docs-nn')\n .option('--agents <n>', 'Number of parallel agents', '3')\n .action(async (options) => {\n const spinner = ora('Initializing deep analysis with claude-flow...').start();\n\n try {\n const projectRoot = validateProjectRoot(options.path);\n const sourceDir = options.source;\n const targetDir = options.target;\n\n // Check source exists\n if (!existsSync(join(projectRoot, sourceDir))) {\n spinner.fail(`Source directory not found: ${sourceDir}`);\n process.exit(1);\n }\n\n spinner.text = 'Running claude-flow deep analysis...';\n\n // Run deep analysis with claude-flow\n const result = await analyzeDocs({\n sourceDir,\n targetDir,\n projectRoot,\n useClaudeFlow: true,\n createMOC: true,\n linkOriginal: true,\n maxDepth: 5,\n dryRun: false,\n verbose: true,\n });\n\n if (result.success) {\n spinner.succeed('Deep analysis complete!');\n } else {\n spinner.warn('Deep analysis completed with some errors');\n }\n\n console.log();\n console.log(chalk.cyan.bold(' Deep Analysis Results'));\n console.log(chalk.gray(' ─────────────────────────────────────'));\n console.log(chalk.green(` Documents analyzed: ${result.filesAnalyzed}`));\n console.log(chalk.green(` Knowledge docs: ${result.filesCreated}`));\n console.log(chalk.blue(` Index files (MOC): ${result.mocFilesCreated}`));\n console.log(chalk.gray(` Categories: ${result.structure.size}`));\n\n // Research summary\n const totalResearch = result.analyzed.reduce((sum, d) => sum + d.researchNeeded.length, 0);\n const totalTodos = result.analyzed.reduce((sum, d) => sum + d.todos.length, 0);\n\n console.log();\n console.log(chalk.white(' Knowledge extraction:'));\n console.log(chalk.cyan(` Research areas: ${totalResearch}`));\n console.log(chalk.cyan(` TODOs found: ${totalTodos}`));\n console.log(chalk.cyan(` Concepts: ${result.analyzed.reduce((sum, d) => sum + d.concepts.length, 0)}`));\n console.log(chalk.cyan(` Cross-refs: ${result.analyzed.reduce((sum, d) => sum + d.related.length, 0)}`));\n\n console.log();\n console.log(chalk.white(` Output: ${targetDir}/`));\n console.log(chalk.gray(` MOC.md Master index`));\n console.log(chalk.gray(` PRIMITIVES.md Core building blocks`));\n console.log(chalk.gray(` */\\_MOC.md Category indexes`));\n console.log();\n\n } catch (error) {\n spinner.fail('Deep analysis failed');\n console.error(chalk.red(String(error)));\n process.exit(1);\n }\n });\n\n // Report subcommand\n command\n .command('report')\n .description('Generate analysis report without creating files')\n .option('-p, --path <path>', 'Project root path', '.')\n .option('-s, --source <dir>', 'Source docs directory', 'docs')\n .option('--json', 'Output as JSON')\n .action(async (options) => {\n const spinner = ora('Generating analysis report...').start();\n\n try {\n const projectRoot = validateProjectRoot(options.path);\n const sourceDir = options.source;\n\n if (!existsSync(join(projectRoot, sourceDir))) {\n spinner.fail(`Source directory not found: ${sourceDir}`);\n process.exit(1);\n }\n\n const result = await analyzeDocs({\n sourceDir,\n targetDir: 'docs-nn',\n projectRoot,\n useClaudeFlow: false,\n createMOC: false,\n linkOriginal: false,\n dryRun: true,\n verbose: false,\n });\n\n spinner.succeed('Report generated!');\n\n if (options.json) {\n // JSON output\n const report = {\n summary: {\n totalDocs: result.filesAnalyzed,\n categories: Object.fromEntries(result.structure),\n },\n documents: result.analyzed.map(d => ({\n original: d.originalPath,\n target: d.newPath,\n type: d.type,\n category: d.category,\n tags: d.tags,\n concepts: d.concepts,\n researchNeeded: d.researchNeeded,\n todos: d.todos,\n })),\n researchAreas: result.analyzed\n .flatMap(d => d.researchNeeded.map(r => ({ doc: d.title, area: r }))),\n todos: result.analyzed\n .flatMap(d => d.todos.map(t => ({ doc: d.title, todo: t }))),\n };\n console.log(JSON.stringify(report, null, 2));\n } else {\n // Human-readable output\n console.log();\n console.log(chalk.cyan.bold(' Documentation Analysis Report'));\n console.log(chalk.gray(' ─────────────────────────────────────'));\n console.log();\n console.log(chalk.white(` Total documents: ${result.filesAnalyzed}`));\n console.log();\n\n // Type breakdown\n const byType = new Map<string, number>();\n result.analyzed.forEach(d => {\n byType.set(d.type, (byType.get(d.type) || 0) + 1);\n });\n\n console.log(chalk.white(' By Type:'));\n for (const [type, count] of byType) {\n const bar = '█'.repeat(Math.ceil(count / result.filesAnalyzed * 20));\n console.log(chalk.cyan(` ${type.padEnd(12)} ${bar} ${count}`));\n }\n console.log();\n\n // Category breakdown\n console.log(chalk.white(' By Category:'));\n for (const [category, docs] of result.structure) {\n const bar = '█'.repeat(Math.ceil(docs.length / result.filesAnalyzed * 20));\n console.log(chalk.cyan(` ${category.padEnd(12)} ${bar} ${docs.length}`));\n }\n console.log();\n\n // Issues\n const withResearch = result.analyzed.filter(d => d.researchNeeded.length > 0);\n const withTodos = result.analyzed.filter(d => d.todos.length > 0);\n\n console.log(chalk.white(' Areas Needing Attention:'));\n console.log(chalk.yellow(` 📚 Research needed: ${withResearch.length} docs`));\n console.log(chalk.yellow(` ✏️ With TODOs: ${withTodos.length} docs`));\n console.log();\n\n // Top research areas\n if (withResearch.length > 0) {\n console.log(chalk.white(' Top Research Areas:'));\n withResearch.slice(0, 5).forEach(d => {\n console.log(chalk.gray(` ${d.title}:`));\n d.researchNeeded.slice(0, 2).forEach(r => {\n console.log(chalk.yellow(` - ${r.slice(0, 60)}...`));\n });\n });\n console.log();\n }\n\n console.log(chalk.cyan(' Run `kg analyze` to migrate documentation'));\n console.log();\n }\n\n } catch (error) {\n spinner.fail('Report generation failed');\n console.error(chalk.red(String(error)));\n process.exit(1);\n }\n });\n\n return command;\n}\n"],"names":[],"mappings":";;;;;;;AAkBO,SAAS,uBAAgC;AAC9C,QAAM,UAAU,IAAI,QAAQ,SAAS;AAErC,UACG,YAAY,uDAAuD,EACnE,OAAO,qBAAqB,qBAAqB,GAAG,EACpD,OAAO,sBAAsB,yBAAyB,MAAM,EAC5D,OAAO,sBAAsB,oBAAoB,SAAS,EAC1D,OAAO,qBAAqB,mCAAmC,EAC/D,OAAO,YAAY,sCAAsC,EACzD,OAAO,sBAAsB,mCAAmC,EAChE,OAAO,mBAAmB,0BAA0B,GAAG,EACvD,OAAO,aAAa,gDAAgD,EACpE,OAAO,iBAAiB,gBAAgB,EACxC,OAAO,OAAO,YAAY;AACzB,UAAM,U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AE,eAAe,SAAS,CAAC;AAC5E,cAAM,YAAY,OAAO,SAAS,OAAO,OAAK,EAAE,MAAM,SAAS,CAAC;AAEhE,gBAAQ,IAAI,MAAM,MAAM,4BAA4B,CAAC;AACrD,gBAAQ,IAAI,MAAM,OAAO,6BAA6B,aAAa,MAAM,OAAO,CAAC;AACjF,gBAAQ,IAAI,MAAM,OAAO,8BAA8B,UAAU,MAAM,OAAO,CAAC;AAC/E,gBAAQ,IAAA;AAGR,YAAI,aAAa,SAAS,GAAG;AAC3B,kBAAQ,IAAI,MAAM,MAAM,uBAAuB,CAAC;AAChD,uBAAa,MAAM,GAAG,CAAC,EAAE,QAAQ,CAAA,MAAK;AACpC,oBAAQ,IAAI,MAAM,KAAK,OAAO,EAAE,KAAK,GAAG,CAAC;AACzC,cAAE,eAAe,MAAM,GAAG,CAAC,EAAE,QAAQ,CAAA,MAAK;AACxC,sBAAQ,IAAI,MAAM,OAAO,WAAW,EAAE,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC;AAAA,YAC1D,CAAC;AAAA,UACH,CAAC;AACD,kBAAQ,IAAA;AAAA,QACV;AAEA,gBAAQ,IAAI,MAAM,KAAK,6CAA6C,CAAC;AACrE,gBAAQ,IAAA;AAAA,MACV;AAAA,IAEF,SAAS,OAAO;AACd,cAAQ,KAAK,0BAA0B;AACvC,cAAQ,MAAM,MAAM,IAAI,OAAO,KAAK,CAAC,CAAC;AACtC,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert Command
|
|
3
|
+
*
|
|
4
|
+
* Convert existing documentation to weave-nn structure.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
/**
|
|
8
|
+
* Create convert command
|
|
9
|
+
*/
|
|
10
|
+
export declare function createConvertCommand(): Command;
|
|
11
|
+
/**
|
|
12
|
+
* Create frontmatter command
|
|
13
|
+
*/
|
|
14
|
+
export declare function createFrontmatterCommand(): Command;
|
|
15
|
+
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/convert.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CA6G9C;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CA6JlD"}
|