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.
- package/LICENSE +21 -0
- package/README.md +1086 -0
- package/dist/cli/commands/build.d.ts +55 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +105 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/query.d.ts +10 -0
- package/dist/cli/commands/query.d.ts.map +1 -0
- package/dist/cli/commands/query.js +399 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/visualize.d.ts +10 -0
- package/dist/cli/commands/visualize.d.ts.map +1 -0
- package/dist/cli/commands/visualize.js +26 -0
- package/dist/cli/commands/visualize.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +109 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/extraction/documentation.d.ts +28 -0
- package/dist/core/extraction/documentation.d.ts.map +1 -0
- package/dist/core/extraction/documentation.js +330 -0
- package/dist/core/extraction/documentation.js.map +1 -0
- package/dist/core/extraction/index.d.ts +11 -0
- package/dist/core/extraction/index.d.ts.map +1 -0
- package/dist/core/extraction/index.js +9 -0
- package/dist/core/extraction/index.js.map +1 -0
- package/dist/core/extraction/registry.d.ts +40 -0
- package/dist/core/extraction/registry.d.ts.map +1 -0
- package/dist/core/extraction/registry.js +604 -0
- package/dist/core/extraction/registry.js.map +1 -0
- package/dist/core/graph/builder.d.ts +37 -0
- package/dist/core/graph/builder.d.ts.map +1 -0
- package/dist/core/graph/builder.js +421 -0
- package/dist/core/graph/builder.js.map +1 -0
- package/dist/core/graph/index.d.ts +23 -0
- package/dist/core/graph/index.d.ts.map +1 -0
- package/dist/core/graph/index.js +25 -0
- package/dist/core/graph/index.js.map +1 -0
- package/dist/core/graph/types.d.ts +128 -0
- package/dist/core/graph/types.d.ts.map +1 -0
- package/dist/core/graph/types.js +9 -0
- package/dist/core/graph/types.js.map +1 -0
- package/dist/core/visualization/dot-generator.d.ts +13 -0
- package/dist/core/visualization/dot-generator.d.ts.map +1 -0
- package/dist/core/visualization/dot-generator.js +200 -0
- package/dist/core/visualization/dot-generator.js.map +1 -0
- package/dist/core/visualization/index.d.ts +20 -0
- package/dist/core/visualization/index.d.ts.map +1 -0
- package/dist/core/visualization/index.js +23 -0
- package/dist/core/visualization/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-runtime.d.ts +7 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +11 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/runtime/jsx.d.ts +84 -0
- package/dist/runtime/jsx.d.ts.map +1 -0
- package/dist/runtime/jsx.js +93 -0
- package/dist/runtime/jsx.js.map +1 -0
- package/dist/runtime/registry.d.ts +61 -0
- package/dist/runtime/registry.d.ts.map +1 -0
- package/dist/runtime/registry.js +2 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/typescript/index.d.ts +7 -0
- package/dist/typescript/index.d.ts.map +1 -0
- package/dist/typescript/index.js +7 -0
- package/dist/typescript/index.js.map +1 -0
- package/dist/typescript/program.d.ts +33 -0
- package/dist/typescript/program.d.ts.map +1 -0
- package/dist/typescript/program.js +84 -0
- package/dist/typescript/program.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a Graphviz DOT file from a knowledge graph.
|
|
3
|
+
*
|
|
4
|
+
* This creates a hierarchical visualization showing:
|
|
5
|
+
* - Folders as nested subgraphs (boxes)
|
|
6
|
+
* - Modules within their folders (ellipses)
|
|
7
|
+
* - Terms as separate cluster (diamonds)
|
|
8
|
+
* - Docs as separate cluster (notes)
|
|
9
|
+
* - Reference relationships as directed edges
|
|
10
|
+
*/
|
|
11
|
+
export function generateDot(graph) {
|
|
12
|
+
const lines = [];
|
|
13
|
+
// Build folder hierarchy map
|
|
14
|
+
const folderChildren = new Map();
|
|
15
|
+
const modulesByFolder = new Map();
|
|
16
|
+
const exportsByFolder = new Map();
|
|
17
|
+
const exportsByModule = new Map();
|
|
18
|
+
for (const edge of graph.edges) {
|
|
19
|
+
if (edge.type === "contains") {
|
|
20
|
+
if (!folderChildren.has(edge.from)) {
|
|
21
|
+
folderChildren.set(edge.from, []);
|
|
22
|
+
}
|
|
23
|
+
folderChildren.get(edge.from).push(edge.to);
|
|
24
|
+
}
|
|
25
|
+
if (edge.type === "belongs-to") {
|
|
26
|
+
const fromNode = graph.nodes.modules[edge.from] || graph.nodes.exports[edge.from];
|
|
27
|
+
if (fromNode?.type === "module") {
|
|
28
|
+
if (!modulesByFolder.has(edge.to)) {
|
|
29
|
+
modulesByFolder.set(edge.to, []);
|
|
30
|
+
}
|
|
31
|
+
modulesByFolder.get(edge.to).push(edge.from);
|
|
32
|
+
}
|
|
33
|
+
else if (fromNode?.type === "export") {
|
|
34
|
+
// Check if export belongs to a module or folder
|
|
35
|
+
const toNode = graph.nodes.modules[edge.to] || graph.nodes.folders[edge.to];
|
|
36
|
+
if (toNode?.type === "module") {
|
|
37
|
+
if (!exportsByModule.has(edge.to)) {
|
|
38
|
+
exportsByModule.set(edge.to, []);
|
|
39
|
+
}
|
|
40
|
+
exportsByModule.get(edge.to).push(edge.from);
|
|
41
|
+
}
|
|
42
|
+
else if (toNode?.type === "folder") {
|
|
43
|
+
if (!exportsByFolder.has(edge.to)) {
|
|
44
|
+
exportsByFolder.set(edge.to, []);
|
|
45
|
+
}
|
|
46
|
+
exportsByFolder.get(edge.to).push(edge.from);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Header
|
|
52
|
+
lines.push("digraph KnowledgeGraph {");
|
|
53
|
+
lines.push(" rankdir=TB;");
|
|
54
|
+
lines.push(" compound=true;");
|
|
55
|
+
lines.push(' node [fontname="Arial", fontsize=10];');
|
|
56
|
+
lines.push(' edge [fontname="Arial", fontsize=8];');
|
|
57
|
+
lines.push("");
|
|
58
|
+
// Generate folder hierarchy
|
|
59
|
+
const rootFolders = Object.keys(graph.nodes.folders).filter((id) => !graph.edges.some((e) => e.type === "contains" && e.to === id));
|
|
60
|
+
for (const rootId of rootFolders) {
|
|
61
|
+
generateFolderSubgraph(rootId, graph, folderChildren, modulesByFolder, exportsByFolder, exportsByModule, lines, 1);
|
|
62
|
+
}
|
|
63
|
+
// Terms (outside folder hierarchy)
|
|
64
|
+
lines.push(" // Terms");
|
|
65
|
+
lines.push(" subgraph cluster_terms {");
|
|
66
|
+
lines.push(' label="Terms";');
|
|
67
|
+
lines.push(" style=dashed;");
|
|
68
|
+
lines.push(" color=gray;");
|
|
69
|
+
for (const [id, node] of Object.entries(graph.nodes.terms)) {
|
|
70
|
+
const label = formatLabel(id, node.desc, undefined, "term");
|
|
71
|
+
lines.push(` "${id}" [label="${label}", shape=diamond, fillcolor="#F0F4C3", style=filled];`);
|
|
72
|
+
}
|
|
73
|
+
lines.push(" }");
|
|
74
|
+
lines.push("");
|
|
75
|
+
// Docs (outside folder hierarchy)
|
|
76
|
+
lines.push(" // Documentation");
|
|
77
|
+
lines.push(" subgraph cluster_docs {");
|
|
78
|
+
lines.push(' label="Documentation";');
|
|
79
|
+
lines.push(" style=dashed;");
|
|
80
|
+
lines.push(" color=gray;");
|
|
81
|
+
for (const [id, node] of Object.entries(graph.nodes.docs)) {
|
|
82
|
+
// Strip HTML tags from content for cleaner visualization
|
|
83
|
+
// Tags are preserved in the JSON for semantic meaning
|
|
84
|
+
const cleanContent = node.content
|
|
85
|
+
.replace(/<[^>]+>/g, "") // Remove all HTML tags
|
|
86
|
+
.substring(0, 100)
|
|
87
|
+
.replace(/"/g, '\\"')
|
|
88
|
+
.replace(/\n/g, "\\n");
|
|
89
|
+
// Use id (relative path) instead of filePath (absolute path) for portability
|
|
90
|
+
const label = `${id}\\n${cleanContent}...\\n📄 ${id}`;
|
|
91
|
+
lines.push(` "${id}" [label="${label}", shape=note, fillcolor="#E1BEE7", style=filled];`);
|
|
92
|
+
}
|
|
93
|
+
lines.push(" }");
|
|
94
|
+
lines.push("");
|
|
95
|
+
// Edges
|
|
96
|
+
lines.push(" // Relationships");
|
|
97
|
+
const edgesByType = {};
|
|
98
|
+
for (const edge of graph.edges) {
|
|
99
|
+
// Skip hierarchy edges as they're shown by subgraph nesting
|
|
100
|
+
if (edge.type === "contains" || edge.type === "belongs-to")
|
|
101
|
+
continue;
|
|
102
|
+
if (!edgesByType[edge.type]) {
|
|
103
|
+
edgesByType[edge.type] = [];
|
|
104
|
+
}
|
|
105
|
+
edgesByType[edge.type].push(` "${edge.from}" -> "${edge.to}";`);
|
|
106
|
+
}
|
|
107
|
+
// Group edges by type with different styles
|
|
108
|
+
const edgeStyles = {
|
|
109
|
+
references: "[color=grey, style=dashed]",
|
|
110
|
+
};
|
|
111
|
+
for (const [type, edges] of Object.entries(edgesByType)) {
|
|
112
|
+
lines.push(` // ${type} edges`);
|
|
113
|
+
const style = edgeStyles[type] || "";
|
|
114
|
+
for (const edge of edges) {
|
|
115
|
+
lines.push(edge.replace(";", ` ${style};`));
|
|
116
|
+
}
|
|
117
|
+
lines.push("");
|
|
118
|
+
}
|
|
119
|
+
// Footer
|
|
120
|
+
lines.push("}");
|
|
121
|
+
return lines.join("\n");
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Generate a folder subgraph with nested folders and modules
|
|
125
|
+
*/
|
|
126
|
+
function generateFolderSubgraph(folderId, graph, folderChildren, modulesByFolder, exportsByFolder, exportsByModule, lines, depth) {
|
|
127
|
+
const folder = graph.nodes.folders[folderId];
|
|
128
|
+
if (!folder)
|
|
129
|
+
return;
|
|
130
|
+
const indent = " ".repeat(depth);
|
|
131
|
+
const clusterId = `cluster_${folderId.replace(/\./g, "_")}`;
|
|
132
|
+
lines.push(`${indent}subgraph ${clusterId} {`);
|
|
133
|
+
lines.push(`${indent} label="${folderId}";`);
|
|
134
|
+
lines.push(`${indent} style=filled;`);
|
|
135
|
+
lines.push(`${indent} fillcolor="#E3F2FD";`);
|
|
136
|
+
lines.push(`${indent} color="#1976D2";`);
|
|
137
|
+
lines.push("");
|
|
138
|
+
// Add folder node itself
|
|
139
|
+
const folderLabel = formatLabel(folderId, folder.desc, folder.path, "folder");
|
|
140
|
+
lines.push(`${indent} "${folderId}" [label="${folderLabel}", shape=box, fillcolor="#BBDEFB", style=filled];`);
|
|
141
|
+
lines.push("");
|
|
142
|
+
// Add modules that belong to this folder
|
|
143
|
+
const modules = modulesByFolder.get(folderId) || [];
|
|
144
|
+
if (modules.length > 0) {
|
|
145
|
+
lines.push(`${indent} // Modules in ${folderId}`);
|
|
146
|
+
for (const moduleId of modules) {
|
|
147
|
+
const module = graph.nodes.modules[moduleId];
|
|
148
|
+
if (module) {
|
|
149
|
+
const label = formatLabel(moduleId, module.desc, module.resolvedPath, "module");
|
|
150
|
+
lines.push(`${indent} "${moduleId}" [label="${label}", shape=ellipse, fillcolor="#FFF9C4", style=filled];`);
|
|
151
|
+
// Add exports that belong to this module
|
|
152
|
+
const moduleExports = exportsByModule.get(moduleId) || [];
|
|
153
|
+
for (const exportId of moduleExports) {
|
|
154
|
+
const exp = graph.nodes.exports[exportId];
|
|
155
|
+
if (exp) {
|
|
156
|
+
const exportLabel = formatLabel(exportId, exp.desc, exp.resolvedPath, "export");
|
|
157
|
+
lines.push(`${indent} "${exportId}" [label="${exportLabel}", shape=component, fillcolor="#C5E1A5", style=filled];`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
lines.push("");
|
|
163
|
+
}
|
|
164
|
+
// Add exports that belong directly to this folder (no module)
|
|
165
|
+
const folderExports = exportsByFolder.get(folderId) || [];
|
|
166
|
+
if (folderExports.length > 0) {
|
|
167
|
+
lines.push(`${indent} // Exports in ${folderId}`);
|
|
168
|
+
for (const exportId of folderExports) {
|
|
169
|
+
const exp = graph.nodes.exports[exportId];
|
|
170
|
+
if (exp) {
|
|
171
|
+
const label = formatLabel(exportId, exp.desc, exp.resolvedPath, "export");
|
|
172
|
+
lines.push(`${indent} "${exportId}" [label="${label}", shape=component, fillcolor="#C5E1A5", style=filled];`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
lines.push("");
|
|
176
|
+
}
|
|
177
|
+
// Recursively add child folders
|
|
178
|
+
const children = folderChildren.get(folderId) || [];
|
|
179
|
+
for (const childId of children) {
|
|
180
|
+
generateFolderSubgraph(childId, graph, folderChildren, modulesByFolder, exportsByFolder, exportsByModule, lines, depth + 1);
|
|
181
|
+
}
|
|
182
|
+
lines.push(`${indent}}`);
|
|
183
|
+
lines.push("");
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Format a node label with ID, description, and optional path
|
|
187
|
+
*/
|
|
188
|
+
function formatLabel(id, desc, path, type) {
|
|
189
|
+
// Escape quotes and newlines
|
|
190
|
+
const escapedDesc = desc.replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
191
|
+
const escapedPath = path ? path.replace(/"/g, '\\"') : "";
|
|
192
|
+
// Format with type syntax - escape inner quotes for DOT format
|
|
193
|
+
const typeName = type ? type.charAt(0).toUpperCase() + type.slice(1) : "";
|
|
194
|
+
const typePrefix = type ? `${typeName}\\<\\"${id}\\"\\>\\n` : `${id}\\n`;
|
|
195
|
+
if (escapedPath) {
|
|
196
|
+
return `${typePrefix}${escapedDesc}\\n📁 ${escapedPath}`;
|
|
197
|
+
}
|
|
198
|
+
return `${typePrefix}${escapedDesc}`;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=dot-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot-generator.js","sourceRoot":"","sources":["../../../src/core/visualization/dot-generator.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC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ACvC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visualization Module - Generates visual representations of knowledge graphs
|
|
3
|
+
*
|
|
4
|
+
* Public API for creating visualizations from knowledge graphs.
|
|
5
|
+
*/
|
|
6
|
+
export { generateDot } from "./dot-generator.js";
|
|
7
|
+
/**
|
|
8
|
+
* Generate a Graphviz DOT file from a knowledge graph.
|
|
9
|
+
*
|
|
10
|
+
* Creates a hierarchical visualization with:
|
|
11
|
+
* - Nested folder subgraphs
|
|
12
|
+
* - Modules grouped within folders
|
|
13
|
+
* - Terms and docs in separate clusters
|
|
14
|
+
* - Colored edges showing relationships
|
|
15
|
+
*
|
|
16
|
+
* @param graph - Knowledge graph to visualize
|
|
17
|
+
* @returns DOT file content as a string
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateDotGraph(graph: import("../graph/types.js").KnowledgeGraph): string;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/visualization/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,mBAAmB,EAAE,cAAc,GAAG,MAAM,CAE1F"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visualization Module - Generates visual representations of knowledge graphs
|
|
3
|
+
*
|
|
4
|
+
* Public API for creating visualizations from knowledge graphs.
|
|
5
|
+
*/
|
|
6
|
+
import { generateDot } from "./dot-generator.js";
|
|
7
|
+
export { generateDot } from "./dot-generator.js";
|
|
8
|
+
/**
|
|
9
|
+
* Generate a Graphviz DOT file from a knowledge graph.
|
|
10
|
+
*
|
|
11
|
+
* Creates a hierarchical visualization with:
|
|
12
|
+
* - Nested folder subgraphs
|
|
13
|
+
* - Modules grouped within folders
|
|
14
|
+
* - Terms and docs in separate clusters
|
|
15
|
+
* - Colored edges showing relationships
|
|
16
|
+
*
|
|
17
|
+
* @param graph - Knowledge graph to visualize
|
|
18
|
+
* @returns DOT file content as a string
|
|
19
|
+
*/
|
|
20
|
+
export function generateDotGraph(graph) {
|
|
21
|
+
return generateDot(graph);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/visualization/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAiD;IAChF,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tskb - TypeScript Semantic Knowledge Base
|
|
3
|
+
*
|
|
4
|
+
* Public API for building and visualizing knowledge graphs from TypeScript projects.
|
|
5
|
+
*/
|
|
6
|
+
export type { Term, Module, Folder, Export } from "./runtime/registry.js";
|
|
7
|
+
export * from "./runtime/jsx.js";
|
|
8
|
+
export { ref } from "./runtime/jsx.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC1E,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAEjC,wBAAgB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,OAKxC;AAED,eAAO,MAAM,IAAI,YAAM,CAAC;AACxB,eAAO,MAAM,QAAQ,GAAI,cAAc;IAAE,QAAQ,EAAE,GAAG,CAAA;CAAE,QAAa,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// JSX runtime for react-jsx transform
|
|
2
|
+
export * from "./runtime/jsx.js";
|
|
3
|
+
export function jsx(type, props) {
|
|
4
|
+
if (typeof type === "function") {
|
|
5
|
+
return type(props);
|
|
6
|
+
}
|
|
7
|
+
return { type, props };
|
|
8
|
+
}
|
|
9
|
+
export const jsxs = jsx;
|
|
10
|
+
export const Fragment = ({ children }) => children;
|
|
11
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,cAAc,kBAAkB,CAAC;AAEjC,MAAM,UAAU,GAAG,CAAC,IAAS,EAAE,KAAU;IACvC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAC;AACxB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAqB,EAAE,EAAE,CAAC,QAAQ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tskb ReactNode type - pure documentation node types without React dependency
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - Primitives: string, number, boolean, null, undefined
|
|
6
|
+
* - Arrays of nodes
|
|
7
|
+
* - Ref assertions: objects with desc and either path or type properties
|
|
8
|
+
*/
|
|
9
|
+
export type ReactNode = string | number | boolean | null | undefined | ReactNode[] | {
|
|
10
|
+
desc: string;
|
|
11
|
+
path: string;
|
|
12
|
+
} | {
|
|
13
|
+
desc: string;
|
|
14
|
+
type: unknown;
|
|
15
|
+
};
|
|
16
|
+
export declare const ref: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Documentation container - just renders children
|
|
19
|
+
*/
|
|
20
|
+
export declare function Doc({ children }: {
|
|
21
|
+
children: any;
|
|
22
|
+
}): any;
|
|
23
|
+
export declare function H1({ children }: {
|
|
24
|
+
children: any;
|
|
25
|
+
}): any;
|
|
26
|
+
export declare function H2({ children }: {
|
|
27
|
+
children: any;
|
|
28
|
+
}): any;
|
|
29
|
+
export declare function H3({ children }: {
|
|
30
|
+
children: any;
|
|
31
|
+
}): any;
|
|
32
|
+
export declare function P({ children }: {
|
|
33
|
+
children: any;
|
|
34
|
+
}): any;
|
|
35
|
+
export declare function List({ children }: {
|
|
36
|
+
children: any;
|
|
37
|
+
}): any;
|
|
38
|
+
export declare function Li({ children }: {
|
|
39
|
+
children: any;
|
|
40
|
+
}): any;
|
|
41
|
+
/**
|
|
42
|
+
* Code snippet component - embeds executable code for documentation
|
|
43
|
+
*
|
|
44
|
+
* Usage:
|
|
45
|
+
* <Snippet code={() => {
|
|
46
|
+
* const result = someFunction();
|
|
47
|
+
* return result;
|
|
48
|
+
* }} />
|
|
49
|
+
*
|
|
50
|
+
* The function is converted to a string and stored in the knowledge graph.
|
|
51
|
+
*/
|
|
52
|
+
export declare function Snippet({ code }: {
|
|
53
|
+
code: () => any;
|
|
54
|
+
}): any;
|
|
55
|
+
/**
|
|
56
|
+
* Architecture Decision Record component
|
|
57
|
+
*
|
|
58
|
+
* Usage:
|
|
59
|
+
* <Adr
|
|
60
|
+
* id="001"
|
|
61
|
+
* title="Use React for UI layer"
|
|
62
|
+
* status="accepted"
|
|
63
|
+
* date="2024-01-15"
|
|
64
|
+
* deciders="Tech Team"
|
|
65
|
+
* >
|
|
66
|
+
* <H2>Context</H2>
|
|
67
|
+
* <P>We need a UI framework...</P>
|
|
68
|
+
*
|
|
69
|
+
* <H2>Decision</H2>
|
|
70
|
+
* <P>We will use React...</P>
|
|
71
|
+
*
|
|
72
|
+
* <H2>Consequences</H2>
|
|
73
|
+
* <P>Positive: Large ecosystem...</P>
|
|
74
|
+
* </Adr>
|
|
75
|
+
*/
|
|
76
|
+
export declare function Adr({ id, title, status, date, deciders, children, }: {
|
|
77
|
+
id: string;
|
|
78
|
+
title: string;
|
|
79
|
+
status: "proposed" | "accepted" | "deprecated" | "superseded";
|
|
80
|
+
date?: string;
|
|
81
|
+
deciders?: string;
|
|
82
|
+
children: any;
|
|
83
|
+
}): any;
|
|
84
|
+
//# sourceMappingURL=jsx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../../src/runtime/jsx.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,SAAS,EAAE,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAcpC,eAAO,MAAM,GAAG,EAA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AE,MAAM,CAAC;IAClB,QAAQ,EAAE,GAAG,CAAC;CACf,GAAG,GAAG,CAYN"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* ============================================================
|
|
2
|
+
* Reference Helper
|
|
3
|
+
* ============================================================
|
|
4
|
+
*
|
|
5
|
+
* Used with type assertions for type-safe, Shift+F12 trackable references:
|
|
6
|
+
*
|
|
7
|
+
* {ref as tskb.Folders['MyFolder']}
|
|
8
|
+
* {ref as tskb.Modules['MyModule']}
|
|
9
|
+
* {ref as tskb.Terms['MyTerm']}
|
|
10
|
+
* {ref as tskb.Exports['MyExport']}
|
|
11
|
+
*/
|
|
12
|
+
export const ref = Symbol("tskb.ref");
|
|
13
|
+
/**
|
|
14
|
+
* Documentation container - just renders children
|
|
15
|
+
*/
|
|
16
|
+
export function Doc({ children }) {
|
|
17
|
+
return children;
|
|
18
|
+
}
|
|
19
|
+
/* ============================================================
|
|
20
|
+
* Helper components for structured content
|
|
21
|
+
* ============================================================
|
|
22
|
+
*
|
|
23
|
+
* These components add semantic HTML markers to preserve document
|
|
24
|
+
* structure in the extracted content. The tags are kept in the JSON
|
|
25
|
+
* output for AI/tooling but stripped in visualizations for clarity.
|
|
26
|
+
*/
|
|
27
|
+
export function H1({ children }) {
|
|
28
|
+
return `<h1>${children}</h1>`;
|
|
29
|
+
}
|
|
30
|
+
export function H2({ children }) {
|
|
31
|
+
return `<h2>${children}</h2>`;
|
|
32
|
+
}
|
|
33
|
+
export function H3({ children }) {
|
|
34
|
+
return `<h3>${children}</h3>`;
|
|
35
|
+
}
|
|
36
|
+
export function P({ children }) {
|
|
37
|
+
return `<p>${children}</p>`;
|
|
38
|
+
}
|
|
39
|
+
export function List({ children }) {
|
|
40
|
+
return `<ul>${children}</ul>`;
|
|
41
|
+
}
|
|
42
|
+
export function Li({ children }) {
|
|
43
|
+
return `<li>${children}</li>`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Code snippet component - embeds executable code for documentation
|
|
47
|
+
*
|
|
48
|
+
* Usage:
|
|
49
|
+
* <Snippet code={() => {
|
|
50
|
+
* const result = someFunction();
|
|
51
|
+
* return result;
|
|
52
|
+
* }} />
|
|
53
|
+
*
|
|
54
|
+
* The function is converted to a string and stored in the knowledge graph.
|
|
55
|
+
*/
|
|
56
|
+
export function Snippet({ code }) {
|
|
57
|
+
const codeString = code.toString();
|
|
58
|
+
return `<snippet>${codeString}</snippet>`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Architecture Decision Record component
|
|
62
|
+
*
|
|
63
|
+
* Usage:
|
|
64
|
+
* <Adr
|
|
65
|
+
* id="001"
|
|
66
|
+
* title="Use React for UI layer"
|
|
67
|
+
* status="accepted"
|
|
68
|
+
* date="2024-01-15"
|
|
69
|
+
* deciders="Tech Team"
|
|
70
|
+
* >
|
|
71
|
+
* <H2>Context</H2>
|
|
72
|
+
* <P>We need a UI framework...</P>
|
|
73
|
+
*
|
|
74
|
+
* <H2>Decision</H2>
|
|
75
|
+
* <P>We will use React...</P>
|
|
76
|
+
*
|
|
77
|
+
* <H2>Consequences</H2>
|
|
78
|
+
* <P>Positive: Large ecosystem...</P>
|
|
79
|
+
* </Adr>
|
|
80
|
+
*/
|
|
81
|
+
export function Adr({ id, title, status, date, deciders, children, }) {
|
|
82
|
+
const metadata = [
|
|
83
|
+
`id="${id}"`,
|
|
84
|
+
`title="${title}"`,
|
|
85
|
+
`status="${status}"`,
|
|
86
|
+
date ? `date="${date}"` : null,
|
|
87
|
+
deciders ? `deciders="${deciders}"` : null,
|
|
88
|
+
]
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
.join(" ");
|
|
91
|
+
return `<adr ${metadata}>${children}</adr>`;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=jsx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx.js","sourceRoot":"","sources":["../../src/runtime/jsx.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;G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AI,GAAG,CAAC,CAAC,CAAC,IAAI;QAC9B,QAAQ,CAAC,CAAC,CAAC,aAAa,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI;KAC3C;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,OAAO,QAAQ,QAAQ,IAAI,QAAQ,QAAe,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace tskb {
|
|
3
|
+
interface Folders {
|
|
4
|
+
}
|
|
5
|
+
interface Modules {
|
|
6
|
+
}
|
|
7
|
+
interface Terms {
|
|
8
|
+
}
|
|
9
|
+
interface Exports {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Base Abstraction's shapes (definitions)
|
|
15
|
+
*/
|
|
16
|
+
interface InternalFolderDefinition {
|
|
17
|
+
desc: string;
|
|
18
|
+
path: string;
|
|
19
|
+
}
|
|
20
|
+
interface InternalModuleDefinition {
|
|
21
|
+
desc: string;
|
|
22
|
+
type: unknown;
|
|
23
|
+
}
|
|
24
|
+
type InternalTermDefinition = string;
|
|
25
|
+
interface InternalExportDefinition {
|
|
26
|
+
desc: string;
|
|
27
|
+
type: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Normalized views:
|
|
31
|
+
* - If a consumer provides a value that doesn't satisfy the base shape,
|
|
32
|
+
* it will show as `never`/error when used through these types.
|
|
33
|
+
*/
|
|
34
|
+
type NormalizeFolders<T> = {
|
|
35
|
+
[K in keyof T]: T[K] extends InternalFolderDefinition ? T[K] : never;
|
|
36
|
+
};
|
|
37
|
+
type NormalizeModules<T> = {
|
|
38
|
+
[K in keyof T]: T[K] extends InternalModuleDefinition ? T[K] : never;
|
|
39
|
+
};
|
|
40
|
+
type NormalizeTerms<T> = {
|
|
41
|
+
[K in keyof T]: T[K] extends InternalTermDefinition ? T[K] : never;
|
|
42
|
+
};
|
|
43
|
+
type NormalizeExports<T> = {
|
|
44
|
+
[K in keyof T]: T[K] extends InternalExportDefinition ? T[K] : never;
|
|
45
|
+
};
|
|
46
|
+
export type FolderRegistry = NormalizeFolders<tskb.Folders>;
|
|
47
|
+
export type ModuleRegistry = NormalizeModules<tskb.Modules>;
|
|
48
|
+
export type TermRegistry = NormalizeTerms<tskb.Terms>;
|
|
49
|
+
export type ExportRegistry = NormalizeExports<tskb.Exports>;
|
|
50
|
+
/** Keys used for autocomplete. */
|
|
51
|
+
export type FolderName = keyof tskb.Folders;
|
|
52
|
+
export type ModuleName = keyof tskb.Modules;
|
|
53
|
+
export type TermName = keyof tskb.Terms;
|
|
54
|
+
export type ExportName = keyof tskb.Exports;
|
|
55
|
+
/** Generic helpers for nicer authoring ergonomics. */
|
|
56
|
+
export type Folder<Ext extends InternalFolderDefinition> = Ext;
|
|
57
|
+
export type Module<Ext extends InternalModuleDefinition> = Ext;
|
|
58
|
+
export type Term<Ext extends InternalTermDefinition> = Ext;
|
|
59
|
+
export type Export<Ext extends InternalExportDefinition> = Ext;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/runtime/registry.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,IAAI,CAAC;QACb,UAAU,OAAO;SAAG;QACpB,UAAU,OAAO;SAAG;QACpB,UAAU,KAAK;SAAG;QAClB,UAAU,OAAO;SAAG;KACrB;CACF;AAED;;GAEG;AAEH,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,KAAK,sBAAsB,GAAG,MAAM,CAAC;AAErC,UAAU,wBAAwB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AAK,CAAC;AACxC,MAAM,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;AAE5C,sDAAsD;AACtD,MAAM,MAAM,MAAM,CAAC,GAAG,SAAS,wBAAwB,IAAI,GAAG,CAAC;AAC/D,MAAM,MAAM,MAAM,CAAC,GAAG,SAAS,wBAAwB,IAAI,GAAG,CAAC;AAC/D,MAAM,MAAM,IAAI,CAAC,GAAG,SAAS,sBAAsB,IAAI,GAAG,CAAC;AAC3D,MAAM,MAAM,MAAM,CAAC,GAAG,SAAS,wBAAwB,IAAI,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/runtime/registry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typescript/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/typescript/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a TypeScript Program from a list of files and a tsconfig.
|
|
4
|
+
*
|
|
5
|
+
* WHAT IS A TYPESCRIPT PROGRAM?
|
|
6
|
+
* It's TypeScript compiler's internal representation of your code:
|
|
7
|
+
* - Source files (parsed into AST)
|
|
8
|
+
* - Type checker (resolves types, finds symbols)
|
|
9
|
+
* - Compiler options (from tsconfig.json)
|
|
10
|
+
*
|
|
11
|
+
* WHY WE NEED IT:
|
|
12
|
+
* We're not compiling code, we're ANALYZING it. The TypeScript compiler
|
|
13
|
+
* API gives us tools to:
|
|
14
|
+
* 1. Parse .ts/.tsx files into syntax trees
|
|
15
|
+
* 2. Resolve types (what is Context<{...}>?)
|
|
16
|
+
* 3. Find symbols (where is "tskb" namespace defined?)
|
|
17
|
+
* 4. Walk ASTs to extract information
|
|
18
|
+
*
|
|
19
|
+
* THE PROCESS:
|
|
20
|
+
* 1. Read tsconfig.json using ts.readConfigFile
|
|
21
|
+
* 2. Parse it to get compiler options
|
|
22
|
+
* 3. Create a Program with our files + those options
|
|
23
|
+
* 4. Set noEmit=true because we're only reading, not compiling
|
|
24
|
+
*
|
|
25
|
+
* RESULT:
|
|
26
|
+
* A Program object we can query to extract registry and docs.
|
|
27
|
+
*
|
|
28
|
+
* @param files - Array of absolute file paths to analyze
|
|
29
|
+
* @param tsconfigPath - Path to tsconfig.json (for compiler options)
|
|
30
|
+
* @returns TypeScript Program ready for analysis
|
|
31
|
+
*/
|
|
32
|
+
export declare function createProgram(files: string[], tsconfigPath: string): ts.Program;
|
|
33
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/typescript/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC,OAAO,CA+D/E"}
|