MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / materialize

Function materialize

scripts/agent-eval/probe-decl-only.mjs:87–101  ·  view source on GitHub ↗

Copy the fixture, apply the variant, index it. Hermetic per run.

(variant)

Source from the content-addressed store, hash-verified

85
86/** Copy the fixture, apply the variant, index it. Hermetic per run. */
87function materialize(variant) {
88 const dir = mkdtempSync(join(tmpdir(), 'cg-decl-'));
89 cpSync(FIXTURE, dir, { recursive: true });
90 rmSync(join(dir, '.codegraph'), { recursive: true, force: true });
91 if (variant === 'strip-banner') {
92 const p = join(dir, GENERATED_DECL);
93 // Drop only the banner comment lines; every declaration stays.
94 const kept = readFileSync(p, 'utf8').split('\n').filter((l) => !/^\/\/ .*(Generated by Wrangler|Runtime types generated)/.test(l));
95 writeFileSync(p, kept.join('\n'));
96 } else if (variant !== 'both') {
97 rmSync(dir, { recursive: true, force: true });
98 throw new Error(`unknown --variant ${variant} (both | strip-banner)`);
99 }
100 return dir;
101}
102
103const queries = ONE_QUERY
104 ? [{ id: 'custom', kind: 'flow', text: ONE_QUERY }]

Callers 1

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected