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

Function setupProjectState

scripts/skill-bench.js:542–566  ·  view source on GitHub ↗

* Set up a temp project directory with the named state. * If VERIFY_HOOKS is set, also installs Citadel hooks and inits .planning/.

(state)

Source from the content-addressed store, hash-verified

540 * If VERIFY_HOOKS is set, also installs Citadel hooks and inits .planning/.
541 */
542function 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
568function setupCodexProjectRuntime(tmpDir) {
569 execFileSync(process.execPath, [path.join(PLUGIN_ROOT, 'scripts', 'codex-compat.js'), tmpDir], {

Callers 2

runScenarioFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected