* Set up a temp project directory with the named state. * If VERIFY_HOOKS is set, also installs Citadel hooks and inits .planning/.
(state)
| 540 | * If VERIFY_HOOKS is set, also installs Citadel hooks and inits .planning/. |
| 541 | */ |
| 542 | function setupProjectState(state) { |
| 543 | const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'citadel-bench-')); |
| 544 | |
| 545 | if (STATES[state]) { |
| 546 | STATES[state](tmpDir); |
| 547 | } else { |
| 548 | console.warn(` WARN: Unknown state "${state}" — using clean state`); |
| 549 | } |
| 550 | |
| 551 | if (VERIFY_HOOKS) { |
| 552 | try { |
| 553 | execFileSync('node', [path.join(PLUGIN_ROOT, 'scripts', 'install-hooks.js'), tmpDir], { |
| 554 | encoding: 'utf8', timeout: 10000, stdio: 'pipe', |
| 555 | }); |
| 556 | const { spawnSync } = require('child_process'); |
| 557 | spawnSync('node', [path.join(PLUGIN_ROOT, 'hooks_src', 'init-project.js')], { |
| 558 | cwd: tmpDir, |
| 559 | env: { ...process.env, CLAUDE_PROJECT_DIR: tmpDir, CLAUDE_PLUGIN_DATA: path.join(tmpDir, '.claude') }, |
| 560 | encoding: 'utf8', timeout: 10000, |
| 561 | }); |
| 562 | } catch { /* best-effort — don't fail scenario setup */ } |
| 563 | } |
| 564 | |
| 565 | return tmpDir; |
| 566 | } |
| 567 | |
| 568 | function setupCodexProjectRuntime(tmpDir) { |
| 569 | execFileSync(process.execPath, [path.join(PLUGIN_ROOT, 'scripts', 'codex-compat.js'), tmpDir], { |
no outgoing calls
no test coverage detected