From 45cf2b0afca2737fdda41679aab78fea9d7527b5 Mon Sep 17 00:00:00 2001 From: Daniel Scheufler Date: Wed, 22 Jul 2026 08:52:32 -0500 Subject: [PATCH] feat(expand evalScripts for a suitable Demo for Trust-AI): checking for proper PRD sections. (Also demonstrates test speed delta between multiple llm-rubirc vs. script based check. --- eval-script.js | 27 ++++++++++++++++++++++++++- trust-ai.config.yaml | 9 +++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) 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