diff --git a/prose.js b/prose.js index 916279d..6d24e96 100644 --- a/prose.js +++ b/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) { const usedBy = xref?.[contract.name]?.usedBy || []; let details = ''; + if (contract.type === 'Interface' && contract.fields) { details = `Fields: ${contract.fields.map(f => `${f.name}: ${f.type}`).join(', ')}`; if (contract.extends) details += `\nExtends: ${contract.extends.join(', ')}`; } else if (contract.type === 'Enum' && contract.members) { 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} Type: ${contract.type} @@ -124,7 +133,7 @@ Visibility: ${contract.visibility} ${details} ${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 }); }