An open source design system that's fully customizable and agent ready
TypeScript
Fix docsRead tracking in vibe test aggregator (#92)
Cindy Zhang179fc58a52eb
diff --git a/internal/vibe-tests/src/aggregate.ts b/internal/vibe-tests/src/aggregate.tsindex f1e8a1be9e..853b1d80a0 100644--- a/internal/vibe-tests/src/aggregate.ts+++ b/internal/vibe-tests/src/aggregate.ts@@ -848,7 +848,6 @@ function loadResults(resultsDir: string): (TestResult & {target?: string})[] {const promptId = file.replace('.tsx', '');const resultPath = path.join(individualResultsDir, file);const taskPath = path.join(tasksDir, `${promptId}.json`);- const metaPath = path.join(individualResultsDir, `${promptId}.meta.json`);// Read the generated codeconst code = fs.readFileSync(resultPath, 'utf-8');@@ -866,14 +865,20 @@ function loadResults(resultsDir: string): (TestResult & {target?: string})[] {task = JSON.parse(fs.readFileSync(taskPath, 'utf-8'));}- // Load docs read metadata if available+ // Load docs read from corresponding .json result filelet docsRead: string[] | undefined;- if (fs.existsSync(metaPath)) {+ const jsonResultPath = path.join(+ individualResultsDir,+ `${promptId}.json`,+ );+ if (fs.existsSync(jsonResultPath)) {try {- const meta = JSON.parse(fs.readFileSync(metaPath, 'utf-8'));- docsRead = meta.docsRead;+ const jsonResult = JSON.parse(+ fs.readFileSync(jsonResultPath, 'utf-8'),+ );+ docsRead = jsonResult.docsRead;} catch {- console.warn(`Warning: Could not parse ${metaPath}`);+ // Ignore parse errors, docsRead will remain undefined}}diff --git a/internal/vibe-tests/src/interactive.ts b/internal/vibe-tests/src/interactive.tsindex 611d7f3d49..745a779aca 100644--- a/internal/vibe-tests/src/interactive.ts+++ b/internal/vibe-tests/src/interactive.ts@@ -902,7 +902,6 @@ function generateSubagentPrompt(resultsDir: string,): string {const codePath = `${resultsDir}/results/${prompt.id}.tsx`;- const metaPath = `${resultsDir}/results/${prompt.id}.meta.json`;// Target-specific AGENTS.md fileconst agentsMdFile =@@ -924,15 +923,13 @@ function generateSubagentPrompt(const framing = personaFraming[config.target]?.[config.persona] || '';- // Natural prompt with AGENTS.md instruction and metadata tracking+ // Natural prompt with AGENTS.md instruction+ // Note: docsRead tracking is handled via the structured JSON result (see subagent instructions)return `First read ${agentsMdFile} in this directory for component library guidance.${framing}${prompt.prompt}-Write the code to: ${codePath}--After writing the code, create ${metaPath} listing any doc files you read:-{"docsRead": ["filename1.md", "filename2.md"]}`;+Write the code to: ${codePath}`;}/**