- extract-helm.js: strips Go templates, parses Chart.yaml/values.yaml/templates - Extracts K8s resource kinds, cross-chart interactions, shared secrets, ports - generateHelmDiagram() for Mermaid interaction graphs - Integrated into sysdoc.js: Helm entities merge into main knowledge graph - Dir-based filenames to handle duplicate chart names - .gitignore for node_modules, snapshots, venv, wasm - 76 charts, 1813 entities, 1769 relationships on Foxtrot
48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
const {generateEntityDoc} = require('./docgen.js');
|
|
const GraphStore = require('./graph.js');
|
|
const fs = require('fs');
|
|
const g = GraphStore.loadSnapshot('snapshots/openclaw-full.json');
|
|
|
|
async function run() {
|
|
const targets = [
|
|
{id: 'gateway/session-utils.ts', file: '/app/src/gateway/session-utils.ts'},
|
|
{id: 'pairing/pairing-store.ts', file: '/app/src/pairing/pairing-store.ts'},
|
|
{id: 'infra/state-migrations.ts', file: '/app/src/infra/state-migrations.ts'},
|
|
];
|
|
|
|
for (const t of targets) {
|
|
const entity = g.nodes.get(t.id);
|
|
if (!entity) continue;
|
|
|
|
let source = '';
|
|
try { source = fs.readFileSync(t.file, 'utf8'); } catch {}
|
|
|
|
const funcs = [];
|
|
const fileIds = g.fileIndex.get(t.file);
|
|
if (fileIds) {
|
|
for (const fid of fileIds) {
|
|
const fe = g.nodes.get(fid);
|
|
if (fe && fe.type === 'Function' && fe.visibility === 'public') {
|
|
funcs.push(fe.name);
|
|
}
|
|
}
|
|
}
|
|
|
|
const imports = g.edges.filter(e => e.type === 'IMPORTS' && e.source === t.id).map(e => e.target.replace('dep:', ''));
|
|
|
|
console.log(`\n### Module: \`${t.id}\``);
|
|
try {
|
|
// Use Kiro backend instead of local Ollama for faster/more reliable generation
|
|
process.env.LLM_BACKEND = 'openai';
|
|
const doc = await generateEntityDoc(t.id, g, source);
|
|
console.log(doc);
|
|
} catch (e) {
|
|
console.log('*Doc generation failed:* ' + e.message);
|
|
}
|
|
|
|
if (funcs.length > 0) console.log(`\n**Public Exports:** \`${funcs.slice(0, 8).join('`, `')}${funcs.length > 8 ? '` (+' + (funcs.length-8) + ' more)' : '`'}`);
|
|
if (imports.length > 0) console.log(`**Key Dependencies:** \`${imports.slice(0, 6).join('`, `')}${imports.length > 6 ? '` (+' + (imports.length-6) + ' more)' : '`'}`);
|
|
}
|
|
}
|
|
run();
|