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

Function writeRepro

__tests__/deprioritize-config.test.ts:32–84  ·  view source on GitHub ↗

#982's minimal reproduction layout.

(root: string)

Source from the content-addressed store, hash-verified

30
31/** #982's minimal reproduction layout. */
32function writeRepro(root: string): void {
33 const mk = (rel: string, content: string) => {
34 const p = path.join(root, rel);
35 fs.mkdirSync(path.dirname(p), { recursive: true });
36 fs.writeFileSync(p, content);
37 };
38
39 // Product code. No symbol here is literally named `usage`.
40 mk(
41 'apps/desktop/statusbar/StatusBar.ts',
42 [
43 'export class DesktopStatusBar {',
44 ' render(): string { return this.refresh(); }',
45 ' refresh(): string { return "status bar"; }',
46 ' mount(): void {}',
47 '}',
48 ].join('\n')
49 );
50 mk(
51 'apps/desktop/statusbar/StatusBarController.ts',
52 [
53 "import { DesktopStatusBar } from './StatusBar';",
54 'export class StatusBarController {',
55 ' constructor(private readonly bar: DesktopStatusBar) {}',
56 ' show(): string { return this.bar.render(); }',
57 '}',
58 ].join('\n')
59 );
60 mk(
61 'apps/desktop/context/ContextWindowMeter.ts',
62 [
63 'export class ContextWindowMeter {',
64 ' read(): number { return this.recompute(); }',
65 ' recompute(): number { return estimateTokens("context window"); }',
66 '}',
67 'export function estimateTokens(text: string): number { return text.length; }',
68 ].join('\n')
69 );
70 mk(
71 'apps/desktop/context/format.ts',
72 'export function formatTokens(n: number): string { return `${n} tokens`; }\n'
73 );
74 mk('gateway/server/server.ts', 'export function startServer(): void {}\n');
75 mk('packages/core/util/strings.ts', 'export function slugify(s: string): string { return s; }\n');
76
77 // The peripheral tree: two standalone helpers, each with a module-level `usage`.
78 for (const skill of ['bodyfat', 'nutrition']) {
79 mk(
80 `optional-skills/${skill}/scripts/${skill}_calc.ts`,
81 ['export function usage(): void {', ` console.log("usage: ${skill}_calc [options]");`, '}'].join('\n')
82 );
83 }
84}
85
86const isHelper = (r: { node: { name: string; filePath: string } }): boolean =>
87 r.node.name.toLowerCase() === 'usage' && r.node.filePath.includes('optional-skills');

Callers 1

Calls 2

mkFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected