Phase 8b: Helm contract extraction + diagram support

- extractHelmContracts() in contracts.js: values, services, workloads, deps
- Merged Helm contracts into main pipeline (124 contracts on Foxtrot)
- diagrams.js: generateContractDiagram now handles Helm types
- Sanitized Mermaid class names for Helm contracts
- 1601-line contracts index with full classDiagram
This commit is contained in:
Jarvis Prime
2026-03-09 20:05:52 +00:00
parent f49a6c2dd9
commit 4f7c77b3b1
3 changed files with 124 additions and 7 deletions

View File

@@ -88,23 +88,28 @@ function generateContractDiagram(contracts) {
const lines = ['classDiagram'];
for (const c of contracts) {
// Sanitize name for Mermaid (no spaces, parens, special chars)
const safeName = c.name.replace(/[^a-zA-Z0-9_]/g, '_').replace(/_+/g, '_').replace(/^_|_$/g, '');
if (!safeName) continue;
if (c.type === 'Interface' || c.type === 'TypeAlias') {
lines.push(` class ${c.name} {`);
lines.push(` class ${safeName} {`);
if (c.fields) {
for (const f of c.fields) {
lines.push(` +${f.name}: ${f.type}`);
}
}
lines.push(' }');
lines.push(` <<${c.type}>> ${c.name}`);
lines.push(` <<${c.type}>> ${safeName}`);
if (c.extends) {
for (const ext of c.extends) {
lines.push(` ${ext} <|-- ${c.name}`);
const safeExt = ext.replace(/[^a-zA-Z0-9_]/g, '_');
lines.push(` ${safeExt} <|-- ${safeName}`);
}
}
} else if (c.type === 'Enum') {
lines.push(` class ${c.name} {`);
lines.push(` class ${safeName} {`);
lines.push(' <<enumeration>>');
if (c.members) {
for (const m of c.members) {
@@ -112,6 +117,17 @@ function generateContractDiagram(contracts) {
}
}
lines.push(' }');
} else if (c.type === 'HelmValues' || c.type === 'HelmServices' || c.type === 'HelmWorkloads' || c.type === 'HelmDependencies') {
lines.push(` class ${safeName} {`);
lines.push(` <<${c.type}>>`);
if (c.fields) {
for (const f of c.fields) {
const safeField = f.name.replace(/[^a-zA-Z0-9_:.-]/g, '_');
const safeType = (f.type || 'unknown').replace(/[^a-zA-Z0-9_-]/g, '_');
lines.push(` +${safeField}: ${safeType}`);
}
}
lines.push(' }');
}
}