MCPcopy Index your code
hub / github.com/garrytan/gstack / createRoutingWorkDir

Function createRoutingWorkDir

test/skill-routing-e2e.test.ts:129–145  ·  view source on GitHub ↗

* Create a routing test working directory. * Uses the actual repo checkout (ROOT) which has CLAUDE.md, .claude/skills/, * and full project context. This matches the local environment where routing * tests pass reliably. In containerized CI, bare tmpDirs lack the context * Claude needs to make co

(suffix: string)

Source from the content-addressed store, hash-verified

127 * Claude needs to make correct routing decisions.
128 */
129function createRoutingWorkDir(suffix: string): string {
130 // Clone the repo checkout into a tmpDir so concurrent tests don't interfere
131 const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), `routing-${suffix}-`));
132 // Copy essential context files
133 const filesToCopy = ['CLAUDE.md', 'README.md', 'package.json', 'ETHOS.md'];
134 for (const f of filesToCopy) {
135 const src = path.join(ROOT, f);
136 if (fs.existsSync(src)) fs.copyFileSync(src, path.join(tmpDir, f));
137 }
138 // Copy skill files
139 installSkills(tmpDir);
140 // Init git
141 initGitRepo(tmpDir);
142 spawnSync('git', ['add', '.'], { cwd: tmpDir, stdio: 'pipe', timeout: 5000 });
143 spawnSync('git', ['commit', '-m', 'initial'], { cwd: tmpDir, stdio: 'pipe', timeout: 5000 });
144 return tmpDir;
145}
146
147function logCost(label: string, result: { costEstimate: { turnsUsed: number; estimatedTokens: number; estimatedCost: number }; duration: number }) {
148 const { turnsUsed, estimatedTokens, estimatedCost } = result.costEstimate;

Callers 1

Calls 3

installSkillsFunction · 0.85
initGitRepoFunction · 0.85
spawnSyncFunction · 0.85

Tested by

no test coverage detected