diff --git a/eval-script.js b/eval-script.js index 7a5b8a5..b5ea57e 100644 --- a/eval-script.js +++ b/eval-script.js @@ -51,4 +51,29 @@ function isConcise(output) { return wordCount >= 50 && wordCount <= 500; } -module.exports = { hasCodeFormatting, explainsWhy, mentionsBestPractices, isConcise }; +function hasPRDSections(output) { + const sections = [ + 'Vision', + 'Goals', + 'Personas', + 'User Stories', + 'Functional Requirements', + 'Non-Functional Requirements', + 'Metrics', + 'Risks', + ]; + + const missingSections = sections.filter(section => !output.includes(section)); + + const score = (sections.length - missingSections.length) / sections.length; + + return { + pass: score >= 0.7, + score: score, + reason: missingSections.length === 0 ? 'All PRD sections present' : `Missing sections: ${missingSections.join(', ')}`, + } + + return sections.every(section => output.includes(section)); +} + +module.exports = { hasCodeFormatting, explainsWhy, mentionsBestPractices, isConcise, hasPRDSections }; diff --git a/trust-ai.config.yaml b/trust-ai.config.yaml index d20edd8..7532f95 100644 --- a/trust-ai.config.yaml +++ b/trust-ai.config.yaml @@ -131,4 +131,13 @@ tests: threshold: 0.7 metric: non-functional-requirements weight: 1.50 + + - vars: + request: 'I want to extend an existing pomodoro app to ring with a customizable chime when the timer expires, and be able to change the chimes for the completion of a pomodoro, completion of rest, and indication when it is time for a long break.' + description: 'PRD Generation - Deterministic Scripts' + assert: + # PRD Sections + - type: javascript + value: file://eval-script.js:hasPRDSections + outputPath: trust-ai/results.html \ No newline at end of file