tskb 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1086 -0
  3. package/dist/cli/commands/build.d.ts +55 -0
  4. package/dist/cli/commands/build.d.ts.map +1 -0
  5. package/dist/cli/commands/build.js +105 -0
  6. package/dist/cli/commands/build.js.map +1 -0
  7. package/dist/cli/commands/query.d.ts +10 -0
  8. package/dist/cli/commands/query.d.ts.map +1 -0
  9. package/dist/cli/commands/query.js +399 -0
  10. package/dist/cli/commands/query.js.map +1 -0
  11. package/dist/cli/commands/visualize.d.ts +10 -0
  12. package/dist/cli/commands/visualize.d.ts.map +1 -0
  13. package/dist/cli/commands/visualize.js +26 -0
  14. package/dist/cli/commands/visualize.js.map +1 -0
  15. package/dist/cli/index.d.ts +9 -0
  16. package/dist/cli/index.d.ts.map +1 -0
  17. package/dist/cli/index.js +109 -0
  18. package/dist/cli/index.js.map +1 -0
  19. package/dist/core/extraction/documentation.d.ts +28 -0
  20. package/dist/core/extraction/documentation.d.ts.map +1 -0
  21. package/dist/core/extraction/documentation.js +330 -0
  22. package/dist/core/extraction/documentation.js.map +1 -0
  23. package/dist/core/extraction/index.d.ts +11 -0
  24. package/dist/core/extraction/index.d.ts.map +1 -0
  25. package/dist/core/extraction/index.js +9 -0
  26. package/dist/core/extraction/index.js.map +1 -0
  27. package/dist/core/extraction/registry.d.ts +40 -0
  28. package/dist/core/extraction/registry.d.ts.map +1 -0
  29. package/dist/core/extraction/registry.js +604 -0
  30. package/dist/core/extraction/registry.js.map +1 -0
  31. package/dist/core/graph/builder.d.ts +37 -0
  32. package/dist/core/graph/builder.d.ts.map +1 -0
  33. package/dist/core/graph/builder.js +421 -0
  34. package/dist/core/graph/builder.js.map +1 -0
  35. package/dist/core/graph/index.d.ts +23 -0
  36. package/dist/core/graph/index.d.ts.map +1 -0
  37. package/dist/core/graph/index.js +25 -0
  38. package/dist/core/graph/index.js.map +1 -0
  39. package/dist/core/graph/types.d.ts +128 -0
  40. package/dist/core/graph/types.d.ts.map +1 -0
  41. package/dist/core/graph/types.js +9 -0
  42. package/dist/core/graph/types.js.map +1 -0
  43. package/dist/core/visualization/dot-generator.d.ts +13 -0
  44. package/dist/core/visualization/dot-generator.d.ts.map +1 -0
  45. package/dist/core/visualization/dot-generator.js +200 -0
  46. package/dist/core/visualization/dot-generator.js.map +1 -0
  47. package/dist/core/visualization/index.d.ts +20 -0
  48. package/dist/core/visualization/index.d.ts.map +1 -0
  49. package/dist/core/visualization/index.js +23 -0
  50. package/dist/core/visualization/index.js.map +1 -0
  51. package/dist/index.d.ts +9 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +8 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/jsx-runtime.d.ts +7 -0
  56. package/dist/jsx-runtime.d.ts.map +1 -0
  57. package/dist/jsx-runtime.js +11 -0
  58. package/dist/jsx-runtime.js.map +1 -0
  59. package/dist/runtime/jsx.d.ts +84 -0
  60. package/dist/runtime/jsx.d.ts.map +1 -0
  61. package/dist/runtime/jsx.js +93 -0
  62. package/dist/runtime/jsx.js.map +1 -0
  63. package/dist/runtime/registry.d.ts +61 -0
  64. package/dist/runtime/registry.d.ts.map +1 -0
  65. package/dist/runtime/registry.js +2 -0
  66. package/dist/runtime/registry.js.map +1 -0
  67. package/dist/typescript/index.d.ts +7 -0
  68. package/dist/typescript/index.d.ts.map +1 -0
  69. package/dist/typescript/index.js +7 -0
  70. package/dist/typescript/index.js.map +1 -0
  71. package/dist/typescript/program.d.ts +33 -0
  72. package/dist/typescript/program.d.ts.map +1 -0
  73. package/dist/typescript/program.js +84 -0
  74. package/dist/typescript/program.js.map +1 -0
  75. package/package.json +73 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Configuration for the extract command
3
+ */
4
+ export interface ExtractConfig {
5
+ /**
6
+ * Glob pattern to match documentation files
7
+ */
8
+ pattern: string;
9
+ /**
10
+ * Output file path for the generated graph JSON
11
+ */
12
+ output: string;
13
+ /**
14
+ * Path to tsconfig.json
15
+ */
16
+ tsconfig: string;
17
+ }
18
+ /**
19
+ * Generates a knowledge graph from tskb documentation files.
20
+ *
21
+ * PIPELINE OVERVIEW:
22
+ * Orchestrates the complete knowledge graph extraction process through six stages:
23
+ *
24
+ * 1. FILE DISCOVERY
25
+ * Locates all documentation files matching the glob pattern.
26
+ *
27
+ * 2. PROGRAM INITIALIZATION
28
+ * Loads files into TypeScript's compiler, providing access to the parsed AST
29
+ * (Abstract Syntax Tree) and type checker.
30
+ *
31
+ * 3. REGISTRY EXTRACTION
32
+ * Scans the AST for `declare global { namespace tskb { ... } }` declarations.
33
+ * Extracts Context/Module/Term definitions to build the canonical vocabulary—
34
+ * the authoritative names and descriptions for your codebase.
35
+ *
36
+ * 4. DOCUMENTATION EXTRACTION
37
+ * Processes each file's AST to extract documentation by traversing the JSX
38
+ * tree to extract text and references, capturing content and its relationships
39
+ * to vocabulary items.
40
+ *
41
+ * 5. GRAPH CONSTRUCTION
42
+ * Merges registry and documentation into a unified graph structure with
43
+ * nodes (entities) and edges (relationships), creating a queryable network.
44
+ *
45
+ * 6. SERIALIZATION
46
+ * Writes the graph to JSON format for consumption by AI tools and documentation systems.
47
+ *
48
+ * OUTPUT:
49
+ * A comprehensive knowledge graph mapping your codebase's architecture, entities,
50
+ * and their interconnections—enabling AI to understand your project structure.
51
+ *
52
+ * @param config - Extract configuration (pattern, output, tsconfig)
53
+ */
54
+ export declare function build(config: ExtractConfig): Promise<void>;
55
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFhE"}
@@ -0,0 +1,105 @@
1
+ import { globSync } from "glob";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { createProgram } from "../../typescript/index.js";
5
+ import { extractRegistry, extractDocs } from "../../core/extraction/index.js";
6
+ import { buildGraph } from "../../core/graph/index.js";
7
+ /**
8
+ * Generates a knowledge graph from tskb documentation files.
9
+ *
10
+ * PIPELINE OVERVIEW:
11
+ * Orchestrates the complete knowledge graph extraction process through six stages:
12
+ *
13
+ * 1. FILE DISCOVERY
14
+ * Locates all documentation files matching the glob pattern.
15
+ *
16
+ * 2. PROGRAM INITIALIZATION
17
+ * Loads files into TypeScript's compiler, providing access to the parsed AST
18
+ * (Abstract Syntax Tree) and type checker.
19
+ *
20
+ * 3. REGISTRY EXTRACTION
21
+ * Scans the AST for `declare global { namespace tskb { ... } }` declarations.
22
+ * Extracts Context/Module/Term definitions to build the canonical vocabulary—
23
+ * the authoritative names and descriptions for your codebase.
24
+ *
25
+ * 4. DOCUMENTATION EXTRACTION
26
+ * Processes each file's AST to extract documentation by traversing the JSX
27
+ * tree to extract text and references, capturing content and its relationships
28
+ * to vocabulary items.
29
+ *
30
+ * 5. GRAPH CONSTRUCTION
31
+ * Merges registry and documentation into a unified graph structure with
32
+ * nodes (entities) and edges (relationships), creating a queryable network.
33
+ *
34
+ * 6. SERIALIZATION
35
+ * Writes the graph to JSON format for consumption by AI tools and documentation systems.
36
+ *
37
+ * OUTPUT:
38
+ * A comprehensive knowledge graph mapping your codebase's architecture, entities,
39
+ * and their interconnections—enabling AI to understand your project structure.
40
+ *
41
+ * @param config - Extract configuration (pattern, output, tsconfig)
42
+ */
43
+ export async function build(config) {
44
+ console.log("tskb build");
45
+ console.log(` Pattern: ${config.pattern}`);
46
+ console.log(` Tsconfig: ${config.tsconfig}`);
47
+ console.log("");
48
+ // Find all matching files
49
+ const files = globSync(config.pattern, { absolute: true, nodir: true });
50
+ console.log(`Found ${files.length} documentation files`);
51
+ if (files.length === 0) {
52
+ console.warn("No files found matching pattern");
53
+ return;
54
+ }
55
+ // Create TypeScript program
56
+ console.log("Creating TypeScript program...");
57
+ const program = createProgram(files, config.tsconfig);
58
+ // Extract registry (vocabulary)
59
+ console.log("Extracting registry (Folders, Modules, Terms)...");
60
+ const tsconfigDir = path.dirname(path.resolve(config.tsconfig));
61
+ // Use rootDir from tsconfig if available, otherwise use tsconfig directory
62
+ const compilerOptions = program.getCompilerOptions();
63
+ const baseDir = compilerOptions.rootDir
64
+ ? path.resolve(tsconfigDir, compilerOptions.rootDir)
65
+ : tsconfigDir;
66
+ console.log(` Base directory: ${baseDir}`);
67
+ const registry = extractRegistry(program, baseDir, config.tsconfig);
68
+ console.log(` ├─ ${registry.folders.size} folders`);
69
+ // Report path resolution status
70
+ const foldersWithPaths = Array.from(registry.folders.values()).filter((c) => c.path);
71
+ const validPaths = foldersWithPaths.filter((c) => c.pathExists).length;
72
+ const invalidPaths = foldersWithPaths.filter((c) => !c.pathExists).length;
73
+ if (foldersWithPaths.length > 0) {
74
+ console.log(` │ └─ Paths: ${validPaths} valid, ${invalidPaths > 0 ? `${invalidPaths} missing` : "0 missing"}`);
75
+ }
76
+ console.log(` ├─ ${registry.modules.size} modules`);
77
+ // Report module import path resolution status
78
+ const modulesWithImports = Array.from(registry.modules.values()).filter((m) => m.importPath);
79
+ const validImports = modulesWithImports.filter((m) => m.pathExists).length;
80
+ const invalidImports = modulesWithImports.filter((m) => !m.pathExists).length;
81
+ if (modulesWithImports.length > 0) {
82
+ console.log(` │ └─ Imports: ${validImports} valid, ${invalidImports > 0 ? `${invalidImports} missing` : "0 missing"}`);
83
+ }
84
+ console.log(` └─ ${registry.terms.size} terms`);
85
+ // Extract documentation
86
+ console.log("Extracting documentation...");
87
+ const docs = extractDocs(program, new Set(files), baseDir);
88
+ console.log(`└─ ${docs.length} docs`);
89
+ // Build knowledge graph
90
+ console.log("Building knowledge graph...");
91
+ const graph = buildGraph(registry, docs, baseDir);
92
+ console.log(` ├─ ${graph.metadata.stats.folderCount} folder nodes`);
93
+ console.log(` ├─ ${graph.metadata.stats.moduleCount} module nodes`);
94
+ console.log(` ├─ ${graph.metadata.stats.exportCount} export nodes`);
95
+ console.log(` ├─ ${graph.metadata.stats.termCount} term nodes`);
96
+ console.log(` ├─ ${graph.metadata.stats.docCount} doc nodes`);
97
+ console.log(` └─ ${graph.metadata.stats.edgeCount} edges`);
98
+ // Write output
99
+ console.log(`Writing graph to ${config.output}...`);
100
+ fs.mkdirSync(path.dirname(config.output), { recursive: true });
101
+ fs.writeFileSync(config.output, JSON.stringify(graph, null, 2), "utf-8");
102
+ console.log("");
103
+ console.log("Done!");
104
+ }
105
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAoBvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAqB;IAC/C,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,C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O,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IACpD,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAEzE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Query the knowledge graph for nodes matching the search term
3
+ *
4
+ * @param graphPath - Path to the knowledge graph JSON file
5
+ * @param searchTerm - Search term to match against nodes
6
+ * @param concise - Output concise format optimized for AI consumption (default: true)
7
+ * @returns Array of matching nodes with their edges
8
+ */
9
+ export declare function query(graphPath: string, searchTerm: string, concise?: boolean): Promise<void>;
10
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/query.ts"],"names":[],"mappings":"AA0EA;;;;;;;GAOG;AACH,wBAAsB,KAAK,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,OAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAoBf"}
@@ -0,0 +1,399 @@
1
+ import fs from "node:fs";
2
+ /**
3
+ * Query the knowledge graph for nodes matching the search term
4
+ *
5
+ * @param graphPath - Path to the knowledge graph JSON file
6
+ * @param searchTerm - Search term to match against nodes
7
+ * @param concise - Output concise format optimized for AI consumption (default: true)
8
+ * @returns Array of matching nodes with their edges
9
+ */
10
+ export async function query(graphPath, searchTerm, concise = true) {
11
+ // Load the knowledge graph
12
+ if (!fs.existsSync(graphPath)) {
13
+ console.error(`Error: Graph file not found: ${graphPath}`);
14
+ process.exit(1);
15
+ }
16
+ const graphJson = fs.readFileSync(graphPath, "utf-8");
17
+ const graph = JSON.parse(graphJson);
18
+ const matches = searchGraph(graph, searchTerm, concise);
19
+ // Output results wrapper
20
+ const response = {
21
+ query: searchTerm,
22
+ results: matches,
23
+ resultCount: matches.length,
24
+ };
25
+ console.log(JSON.stringify(response, null, 2));
26
+ }
27
+ /**
28
+ * Search across all nodes in the graph
29
+ */
30
+ function searchGraph(graph, searchTerm, concise) {
31
+ const matches = [];
32
+ const lowerSearchTerm = searchTerm.toLowerCase();
33
+ // Search folders
34
+ for (const [id, node] of Object.entries(graph.nodes.folders)) {
35
+ const result = matchNode(id, node, lowerSearchTerm, graph.edges, graph, concise);
36
+ if (result)
37
+ matches.push(result);
38
+ }
39
+ // Search modules
40
+ for (const [id, node] of Object.entries(graph.nodes.modules)) {
41
+ const result = matchNode(id, node, lowerSearchTerm, graph.edges, graph, concise);
42
+ if (result)
43
+ matches.push(result);
44
+ }
45
+ // Search terms
46
+ for (const [id, node] of Object.entries(graph.nodes.terms)) {
47
+ const result = matchNode(id, node, lowerSearchTerm, graph.edges, graph, concise);
48
+ if (result)
49
+ matches.push(result);
50
+ }
51
+ // Search exports
52
+ for (const [id, node] of Object.entries(graph.nodes.exports)) {
53
+ const result = matchNode(id, node, lowerSearchTerm, graph.edges, graph, concise);
54
+ if (result)
55
+ matches.push(result);
56
+ }
57
+ // Search docs
58
+ for (const [id, node] of Object.entries(graph.nodes.docs)) {
59
+ const result = matchNode(id, node, lowerSearchTerm, graph.edges, graph, concise);
60
+ if (result)
61
+ matches.push(result);
62
+ }
63
+ // Sort by score (highest first)
64
+ return matches.sort((a, b) => b.match.score - a.match.score);
65
+ }
66
+ /**
67
+ * Check if a node matches the search term and build enhanced match result
68
+ */
69
+ function matchNode(id, node, searchTerm, allEdges, graph, concise) {
70
+ const matchedFields = [];
71
+ let score = 0;
72
+ // Search in ID
73
+ if (id.toLowerCase().includes(searchTerm)) {
74
+ matchedFields.push("id");
75
+ score += 10; // ID matches are high priority
76
+ }
77
+ // Search in description
78
+ if ("desc" in node && node.desc.toLowerCase().includes(searchTerm)) {
79
+ matchedFields.push("desc");
80
+ score += 5;
81
+ }
82
+ // Search in paths
83
+ if ("path" in node && node.path && node.path.toLowerCase().includes(searchTerm)) {
84
+ matchedFields.push("path");
85
+ score += 8;
86
+ }
87
+ if ("resolvedPath" in node &&
88
+ node.resolvedPath &&
89
+ node.resolvedPath.toLowerCase().includes(searchTerm)) {
90
+ matchedFields.push("resolvedPath");
91
+ score += 8;
92
+ }
93
+ if ("filePath" in node && node.filePath.toLowerCase().includes(searchTerm)) {
94
+ matchedFields.push("filePath");
95
+ score += 8;
96
+ }
97
+ // Search in doc content
98
+ if (node.type === "doc" && node.content.toLowerCase().includes(searchTerm)) {
99
+ matchedFields.push("content");
100
+ score += 3; // Lower priority for content matches
101
+ }
102
+ // Search in import paths
103
+ if ("importPath" in node &&
104
+ node.importPath &&
105
+ node.importPath.toLowerCase().includes(searchTerm)) {
106
+ matchedFields.push("importPath");
107
+ score += 7;
108
+ }
109
+ // If no matches, return null
110
+ if (matchedFields.length === 0) {
111
+ return null;
112
+ }
113
+ // Get edges for this node
114
+ const edges = getNodeEdges(allEdges, id);
115
+ // Build enhanced response
116
+ return buildQueryMatch(id, node, matchedFields, score, edges, graph, concise);
117
+ }
118
+ /**
119
+ * Get all edges connected to a node
120
+ */
121
+ function getNodeEdges(allEdges, nodeId) {
122
+ const incoming = [];
123
+ const outgoing = [];
124
+ for (const edge of allEdges) {
125
+ if (edge.to === nodeId) {
126
+ incoming.push(edge);
127
+ }
128
+ if (edge.from === nodeId) {
129
+ outgoing.push(edge);
130
+ }
131
+ }
132
+ return { incoming, outgoing };
133
+ }
134
+ /**
135
+ * Build enhanced query match result with all context
136
+ */
137
+ function buildQueryMatch(id, node, matchedFields, score, edges, graph, concise) {
138
+ if (concise) {
139
+ // Concise mode: minimal output for AI consumption
140
+ const parent = findParent(edges, graph);
141
+ const primaryFile = extractPrimaryFile(node);
142
+ const relatedFiles = extractRelatedFiles(node, edges, graph, primaryFile).slice(0, 3);
143
+ return {
144
+ match: {
145
+ id,
146
+ type: node.type,
147
+ desc: "desc" in node ? node.desc : undefined,
148
+ score,
149
+ matchReason: matchedFields.join(", "),
150
+ },
151
+ context: {
152
+ hierarchy: buildHierarchy(id, node, edges, graph),
153
+ parent,
154
+ },
155
+ files: {
156
+ primary: primaryFile,
157
+ related: relatedFiles,
158
+ },
159
+ relationships: buildRelationships(edges, graph),
160
+ documentation: extractDocumentation(id, node, edges, graph, true),
161
+ suggestions: generateSuggestions(node, edges, graph, matchedFields),
162
+ };
163
+ }
164
+ // Verbose mode: full context
165
+ return {
166
+ match: {
167
+ id,
168
+ type: node.type,
169
+ desc: "desc" in node ? node.desc : undefined,
170
+ score,
171
+ matchReason: `Matched in ${matchedFields.join(", ")}`,
172
+ },
173
+ context: {
174
+ hierarchy: buildHierarchy(id, node, edges, graph),
175
+ parent: findParent(edges, graph),
176
+ },
177
+ files: extractFiles(node, edges, graph),
178
+ relationships: buildRelationships(edges, graph),
179
+ documentation: extractDocumentation(id, node, edges, graph, false),
180
+ suggestions: generateSuggestions(node, edges, graph, matchedFields),
181
+ };
182
+ }
183
+ /**
184
+ * Build hierarchy breadcrumb from root to current node
185
+ */
186
+ function buildHierarchy(id, node, edges, graph) {
187
+ const hierarchy = [];
188
+ // Find belongs-to or contained-by relationships
189
+ const parentEdge = edges.outgoing.find((e) => e.type === "belongs-to") ||
190
+ edges.incoming.find((e) => e.type === "contains");
191
+ if (parentEdge) {
192
+ const parentId = parentEdge.type === "belongs-to" ? parentEdge.to : parentEdge.from;
193
+ const parentNode = findNodeById(parentId, graph);
194
+ if (parentNode) {
195
+ // Recursively build parent hierarchy
196
+ const parentEdges = getNodeEdges(graph.edges, parentId);
197
+ const parentHierarchy = buildHierarchy(parentId, parentNode, parentEdges, graph);
198
+ hierarchy.push(...parentHierarchy);
199
+ }
200
+ }
201
+ hierarchy.push(id);
202
+ return hierarchy;
203
+ }
204
+ /**
205
+ * Find parent node from edges
206
+ */
207
+ function findParent(edges, graph) {
208
+ const parentEdge = edges.outgoing.find((e) => e.type === "belongs-to") ||
209
+ edges.incoming.find((e) => e.type === "contains");
210
+ if (!parentEdge)
211
+ return undefined;
212
+ const parentId = parentEdge.type === "belongs-to" ? parentEdge.to : parentEdge.from;
213
+ const parentNode = findNodeById(parentId, graph);
214
+ if (!parentNode)
215
+ return undefined;
216
+ return {
217
+ id: parentId,
218
+ type: parentNode.type,
219
+ desc: "desc" in parentNode ? parentNode.desc : undefined,
220
+ };
221
+ }
222
+ /**
223
+ * Extract primary file from node
224
+ */
225
+ function extractPrimaryFile(node) {
226
+ if ("resolvedPath" in node && node.resolvedPath) {
227
+ return node.resolvedPath;
228
+ }
229
+ else if ("filePath" in node) {
230
+ return node.filePath;
231
+ }
232
+ else if ("path" in node && node.path) {
233
+ return node.path;
234
+ }
235
+ return undefined;
236
+ }
237
+ /**
238
+ * Extract related files from connected nodes
239
+ */
240
+ function extractRelatedFiles(node, edges, graph, primaryFile) {
241
+ const related = [];
242
+ for (const edge of [...edges.incoming, ...edges.outgoing]) {
243
+ const relatedId = edge.from === node.id ? edge.to : edge.from;
244
+ const relatedNode = findNodeById(relatedId, graph);
245
+ if (!relatedNode)
246
+ continue;
247
+ const filePath = extractPrimaryFile(relatedNode);
248
+ if (filePath && filePath !== primaryFile && !related.includes(filePath)) {
249
+ related.push(filePath);
250
+ }
251
+ }
252
+ return related;
253
+ }
254
+ /**
255
+ * Extract primary and related files (verbose mode)
256
+ */
257
+ function extractFiles(node, edges, graph) {
258
+ const primary = extractPrimaryFile(node);
259
+ const related = extractRelatedFiles(node, edges, graph, primary);
260
+ return { primary, related };
261
+ }
262
+ /**
263
+ * Build relationship categorization
264
+ */
265
+ function buildRelationships(edges, graph) {
266
+ const uses = [];
267
+ const usedBy = [];
268
+ const contains = [];
269
+ const belongsTo = [];
270
+ // Process outgoing edges
271
+ for (const edge of edges.outgoing) {
272
+ const targetNode = findNodeById(edge.to, graph);
273
+ if (!targetNode)
274
+ continue;
275
+ const relatedNode = {
276
+ id: edge.to,
277
+ type: targetNode.type,
278
+ desc: "desc" in targetNode ? targetNode.desc : undefined,
279
+ relationship: edge.type,
280
+ };
281
+ if (edge.type === "references") {
282
+ uses.push(relatedNode);
283
+ }
284
+ else if (edge.type === "contains") {
285
+ contains.push(relatedNode);
286
+ }
287
+ else if (edge.type === "belongs-to") {
288
+ belongsTo.push(relatedNode);
289
+ }
290
+ }
291
+ // Process incoming edges
292
+ for (const edge of edges.incoming) {
293
+ const sourceNode = findNodeById(edge.from, graph);
294
+ if (!sourceNode)
295
+ continue;
296
+ const relatedNode = {
297
+ id: edge.from,
298
+ type: sourceNode.type,
299
+ desc: "desc" in sourceNode ? sourceNode.desc : undefined,
300
+ relationship: edge.type,
301
+ };
302
+ if (edge.type === "references") {
303
+ usedBy.push(relatedNode);
304
+ }
305
+ else if (edge.type === "contains") {
306
+ belongsTo.push(relatedNode);
307
+ }
308
+ }
309
+ return { uses, usedBy, contains, belongsTo };
310
+ }
311
+ /**
312
+ * Extract documentation context
313
+ */
314
+ function extractDocumentation(id, node, edges, graph, concise) {
315
+ const relatedDocs = [];
316
+ let primary;
317
+ const excerptLength = concise ? 100 : 200;
318
+ // If this is a doc node, use it as primary
319
+ if (node.type === "doc") {
320
+ const excerpt = node.content.substring(0, excerptLength).replace(/\s+/g, " ").trim();
321
+ primary = {
322
+ file: node.filePath,
323
+ excerpt: excerpt + (node.content.length > excerptLength ? "..." : ""),
324
+ };
325
+ }
326
+ // Find related doc nodes
327
+ const maxRelatedDocs = concise ? 2 : 10;
328
+ for (const edge of edges.incoming) {
329
+ if (edge.type === "references" && relatedDocs.length < maxRelatedDocs) {
330
+ const docNode = graph.nodes.docs[edge.from];
331
+ if (docNode) {
332
+ relatedDocs.push({
333
+ id: edge.from,
334
+ title: docNode.filePath.split("/").pop() || edge.from,
335
+ });
336
+ // Use first doc as primary if we don't have one
337
+ if (!primary) {
338
+ const excerpt = docNode.content.substring(0, excerptLength).replace(/\s+/g, " ").trim();
339
+ primary = {
340
+ file: docNode.filePath,
341
+ excerpt: excerpt + (docNode.content.length > excerptLength ? "..." : ""),
342
+ };
343
+ }
344
+ }
345
+ }
346
+ }
347
+ return { primary, relatedDocs };
348
+ }
349
+ /**
350
+ * Generate AI suggestions
351
+ */
352
+ function generateSuggestions(node, edges, graph, matchedFields) {
353
+ const readNext = [];
354
+ const keywords = [];
355
+ // Extract keywords from matched fields
356
+ if (matchedFields.includes("id")) {
357
+ keywords.push(...node.id.toLowerCase().split(/[.\-_]/));
358
+ }
359
+ if ("desc" in node) {
360
+ keywords.push(...node.desc.toLowerCase().split(/\s+/).slice(0, 5));
361
+ }
362
+ // Generate read next suggestions
363
+ if ("resolvedPath" in node && node.resolvedPath) {
364
+ readNext.push(`Read ${node.resolvedPath} to understand the implementation`);
365
+ }
366
+ // Suggest reading parent context
367
+ const parentEdge = edges.outgoing.find((e) => e.type === "belongs-to");
368
+ if (parentEdge) {
369
+ const parentNode = findNodeById(parentEdge.to, graph);
370
+ if (parentNode && "resolvedPath" in parentNode && parentNode.resolvedPath) {
371
+ readNext.push(`Check ${parentNode.resolvedPath} for parent context`);
372
+ }
373
+ }
374
+ // Suggest reading documentation
375
+ for (const edge of edges.incoming) {
376
+ if (edge.type === "references") {
377
+ const docNode = graph.nodes.docs[edge.from];
378
+ if (docNode) {
379
+ readNext.push(`Review ${docNode.filePath} for architecture context`);
380
+ }
381
+ }
382
+ }
383
+ return {
384
+ readNext: readNext.slice(0, 3), // Limit to top 3
385
+ keywords: [...new Set(keywords)].filter((k) => k.length > 2).slice(0, 5), // Dedupe and limit
386
+ };
387
+ }
388
+ /**
389
+ * Find any node by ID across all node types
390
+ */
391
+ function findNodeById(id, graph) {
392
+ return (graph.nodes.folders[id] ||
393
+ graph.nodes.modules[id] ||
394
+ graph.nodes.terms[id] ||
395
+ graph.nodes.exports[id] ||
396
+ graph.nodes.docs[id] ||
397
+ null);
398
+ }
399
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/cli/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AA0EzB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,SAAiB,EACjB,UAAkB,EAClB,UAAmB,IAAI;IAEvB,2BAA2B;IAC3B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,gCAAgC,SAAS,EAAE,CAAC,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtD,MAAM,KAAK,GAAmB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAExD,yBAAyB;IACzB,MAAM,QAAQ,GAAG;QACf,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,OAAO,CAAC,MAAM;KAC5B,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,KAAqB,EAAE,UAAkB,EAAE,OAAgB;IAC9E,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,eAAe,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAEjD,iBAAiB;IACjB,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,I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,EAAE,CAAC,CAAC,EAAE,mBAAmB;KAC9F,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,EAAU,EAAE,KAAqB;IACrD,OAAO,CACL,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,IAAI,CACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Visualize command - generates a Graphviz DOT file from a knowledge graph JSON.
3
+ *
4
+ * This is a thin CLI wrapper around the core visualization module.
5
+ *
6
+ * @param graphPath - Path to the knowledge graph JSON file
7
+ * @param outputPath - Path where the DOT file should be written
8
+ */
9
+ export declare function visualize(graphPath: string, outputPath: string): Promise<void>;
10
+ //# sourceMappingURL=visualize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visualize.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/visualize.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAkBpE"}
@@ -0,0 +1,26 @@
1
+ import { generateDot } from "../../core/visualization/index.js";
2
+ import fs from "node:fs/promises";
3
+ /**
4
+ * Visualize command - generates a Graphviz DOT file from a knowledge graph JSON.
5
+ *
6
+ * This is a thin CLI wrapper around the core visualization module.
7
+ *
8
+ * @param graphPath - Path to the knowledge graph JSON file
9
+ * @param outputPath - Path where the DOT file should be written
10
+ */
11
+ export async function visualize(graphPath, outputPath) {
12
+ console.log("Visualizing knowledge graph...");
13
+ console.log(` Input: ${graphPath}`);
14
+ console.log(` Output: ${outputPath}`);
15
+ // Read the knowledge graph
16
+ const graphJson = await fs.readFile(graphPath, "utf-8");
17
+ const graph = JSON.parse(graphJson);
18
+ // Generate DOT content
19
+ const dot = generateDot(graph);
20
+ // Write DOT file
21
+ await fs.writeFile(outputPath, dot, "utf-8");
22
+ console.log("DOT file generated!");
23
+ console.log(` Render with: dot -Tpng ${outputPath} -o graph.png`);
24
+ console.log(` Or view with: xdot ${outputPath}`);
25
+ }
26
+ //# sourceMappingURL=visualize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visualize.js","sourceRoot":"","sources":["../../../src/cli/commands/visualize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,SAAiB,EAAE,UAAkB;IACnE,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,EAAE,CAAC,CAAC;IAExC,2BAA2B;IAC3B,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxD,MAAM,KAAK,GAAmB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAEpD,uBAAuB;IACvB,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAE/B,iBAAiB;IACjB,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,6BAA6B,UAAU,eAAe,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAC;AACrD,CAAC"}