(originalCwd: string)
| 12 | } |
| 13 | |
| 14 | function probeProjectMemoryFiles(originalCwd: string): ProjectMemoryProbeEntry[] { |
| 15 | const script = [ |
| 16 | 'process.env.NCODE_BUILD_MODE = "noumena";', |
| 17 | `const { setOriginalCwd } = await import(${JSON.stringify('./src/bootstrap/state.js')});`, |
| 18 | `const { getMemoryFiles } = await import(${JSON.stringify('./src/utils/claudemd.js')});`, |
| 19 | `setOriginalCwd(${JSON.stringify(originalCwd)});`, |
| 20 | 'const files = await getMemoryFiles();', |
| 21 | 'const projectFiles = files.filter(file => file.type === "Project").map(file => ({ path: file.path, content: file.content }));', |
| 22 | 'console.log(JSON.stringify(projectFiles));', |
| 23 | ].join('\n') |
| 24 | |
| 25 | const result = Bun.spawnSync({ |
| 26 | cmd: [BUN_BIN, '-e', script], |
| 27 | cwd: CODE_ROOT, |
| 28 | stdout: 'pipe', |
| 29 | stderr: 'pipe', |
| 30 | env: { |
| 31 | ...process.env, |
| 32 | NODE_ENV: 'test', |
| 33 | }, |
| 34 | }) |
| 35 | |
| 36 | expect(result.exitCode).toBe(0) |
| 37 | return JSON.parse(result.stdout.toString()) as ProjectMemoryProbeEntry[] |
| 38 | } |
| 39 | |
| 40 | describe('claudemd project memory repo boundary', () => { |
| 41 | it('stops loading project instructions at the repo root', () => { |
no test coverage detected