MCPcopy Create free account
hub / github.com/SethGammon/Citadel / runScenario

Function runScenario

scripts/noop-ablate.js:114–132  ·  view source on GitHub ↗

Run one scenario, return an outcome vector { pass, vector, error }.

(scenario, cli)

Source from the content-addressed store, hash-verified

112
113/** Run one scenario, return an outcome vector { pass, vector, error }. */
114function runScenario(scenario, cli) {
115 let tmpDir = null;
116 try {
117 tmpDir = setupProjectState(scenario.state);
118 const exec = executeClaudeScenario(scenario, cli, tmpDir);
119 if (exec.timedOut) return { pass: null, vector: null, error: 'timed out' };
120 if (exec.error && !exec.output) return { pass: null, vector: null, error: exec.error };
121 const ar = runAssertions(scenario, exec.output);
122 return {
123 pass: ar.every(a => a.passed),
124 vector: ar.map(a => a.passed),
125 error: null,
126 };
127 } catch (e) {
128 return { pass: null, vector: null, error: e.message };
129 } finally {
130 if (tmpDir) { try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch { /* ignore */ } }
131 }
132}
133
134function vectorsEqual(a, b) {
135 if (!a || !b || a.length !== b.length) return false;

Callers 1

runAllFunction · 0.85

Calls 3

setupProjectStateFunction · 0.85
executeClaudeScenarioFunction · 0.85
runAssertionsFunction · 0.85

Tested by

no test coverage detected