Phase 6+7: LLM prose generation pass over Foxtrot docs\n\n- Ran Claude Haiku to generate prose for architecture, subsystems, flows, and 124 Helm contracts\n- Fixed describeContract prompt in prose.js to correctly identify and describe Helm contract types without hallucinating\n- 80 files generated with rich architectural summaries
This commit is contained in:
13
prose.js
13
prose.js
@@ -108,14 +108,23 @@ Write ONLY the narrative paragraph, no heading. Explain what happens when this e
|
|||||||
async function describeContract(contract, xref, llmOpts) {
|
async function describeContract(contract, xref, llmOpts) {
|
||||||
const usedBy = xref?.[contract.name]?.usedBy || [];
|
const usedBy = xref?.[contract.name]?.usedBy || [];
|
||||||
let details = '';
|
let details = '';
|
||||||
|
|
||||||
if (contract.type === 'Interface' && contract.fields) {
|
if (contract.type === 'Interface' && contract.fields) {
|
||||||
details = `Fields: ${contract.fields.map(f => `${f.name}: ${f.type}`).join(', ')}`;
|
details = `Fields: ${contract.fields.map(f => `${f.name}: ${f.type}`).join(', ')}`;
|
||||||
if (contract.extends) details += `\nExtends: ${contract.extends.join(', ')}`;
|
if (contract.extends) details += `\nExtends: ${contract.extends.join(', ')}`;
|
||||||
} else if (contract.type === 'Enum' && contract.members) {
|
} else if (contract.type === 'Enum' && contract.members) {
|
||||||
details = `Members: ${contract.members.join(', ')}`;
|
details = `Members: ${contract.members.join(', ')}`;
|
||||||
|
} else if (contract.type.startsWith('Helm')) {
|
||||||
|
// Helm contract types
|
||||||
|
if (contract.fields) {
|
||||||
|
details = `Fields: ${contract.fields.slice(0, 20).map(f => `${f.name}: ${f.type}`).join(', ')}`;
|
||||||
|
if (contract.fields.length > 20) details += ` (+${contract.fields.length - 20} more)`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const prompt = `Write a 1-2 sentence description of this TypeScript ${contract.type.toLowerCase()}.
|
const typeLabel = contract.type.startsWith('Helm') ? `Helm ${contract.type.replace('Helm', '').toLowerCase()} contract` : `TypeScript ${contract.type.toLowerCase()}`;
|
||||||
|
|
||||||
|
const prompt = `Write a 1-2 sentence description of this ${typeLabel}.
|
||||||
|
|
||||||
Name: ${contract.name}
|
Name: ${contract.name}
|
||||||
Type: ${contract.type}
|
Type: ${contract.type}
|
||||||
@@ -124,7 +133,7 @@ Visibility: ${contract.visibility}
|
|||||||
${details}
|
${details}
|
||||||
${usedBy.length > 0 ? `Used by subsystems: ${usedBy.join(', ')}` : 'Not referenced cross-subsystem'}
|
${usedBy.length > 0 ? `Used by subsystems: ${usedBy.join(', ')}` : 'Not referenced cross-subsystem'}
|
||||||
|
|
||||||
Write ONLY the description, no heading.`;
|
Write ONLY the description, no heading. Do not ask for more information.`;
|
||||||
|
|
||||||
return callLLM(prompt, { ...llmOpts, maxTokens: 256 });
|
return callLLM(prompt, { ...llmOpts, maxTokens: 256 });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user