Phase 9b: structural documentation improvements\n\n- sysdoc.js: Added Summary Statistics, Top Charts, and K8s Resource Types to architecture doc\n- Addresses ratchet failures where system-wide rollups were missing from generated prose\n- Eval v2 shows minor improvement, though RAG context window still limits wide scatter-gather queries

This commit is contained in:
Jarvis Prime
2026-03-09 23:40:07 +00:00
parent b99341e8bc
commit 0cc4abcb0f
5 changed files with 1452 additions and 2 deletions

View File

@@ -103,11 +103,38 @@ async function generateDocs(graph, srcRoot, outDir, opts = {}) {
const sysArchContent = `# System Architecture
${archProse}
## Summary Statistics
- **Subsystems:** ${subs.subsystems.length}
- **Helm Charts:** ${helmCharts.length}
- **Total Contracts:** ${contractsResult.contracts.length}
- **Cross-Cutting Concerns:** ${subs.crossCutting.join(', ') || 'none'}
## Subsystems
${subs.subsystems.map(s => `- **${s.name}** (${s.kind}): ${s.entities.modules} modules, ${s.entities.functions} functions`).join('\n')}
| Subsystem | Kind | Files | Modules | Functions |
|---|---|---|---|---|
${subs.subsystems.map(s => `| ${s.name} | ${s.kind} | ${s.files.length} | ${s.entities.modules} | ${s.entities.functions} |`).join('\n')}
## Cross-Cutting Concerns
${subs.crossCutting.map(c => `- **${c}**`).join('\n')}
${subs.crossCutting.map(c => `- **${c}**`).join('\n') || '*None detected*'}
## Cross-Subsystem Dependencies
| From | To | Calls | Imports |
|---|---|---|---|
${Object.entries(subs.dependencyMatrix).filter(([, v]) => (v.calls + v.imports) > 0).sort((a, b) => (b[1].calls + b[1].imports) - (a[1].calls + a[1].imports)).map(([k, v]) => { const [from, to] = k.split('→'); return `| ${from} | ${to} | ${v.calls} | ${v.imports} |`; }).join('\n')}
## Top Helm Charts by Resource Count
| Chart | Path | Resources |
|---|---|---|
${[...helmCharts].sort((a, b) => b.templates.resources.length - a.templates.resources.length).slice(0, 10).map(c => `| ${c.chart.name} | \`${c.dir}\` | ${c.templates.resources.length} |`).join('\n')}
## Kubernetes Resource Types (across all charts)
| Kind | Count |
|---|---|
${(() => { const kinds = {}; for (const c of helmCharts) for (const r of c.templates.resources) kinds[r.kind] = (kinds[r.kind] || 0) + 1; return Object.entries(kinds).sort((a, b) => b[1] - a[1]).slice(0, 15).map(([k, v]) => `| ${k} | ${v} |`).join('\n'); })()}
## Dependency Map
\`\`\`mermaid