()
| 6 | import type { ToolContext } from '../src/tools/types.js'; |
| 7 | |
| 8 | async function createContextRoot(): Promise<{ root: string; ctx: ToolContext }> { |
| 9 | const root = await fs.mkdtemp(path.join(os.tmpdir(), 'codebase-health-tool-')); |
| 10 | const healthPath = path.join(root, '.codebase-context', 'health.json'); |
| 11 | await fs.mkdir(path.dirname(healthPath), { recursive: true }); |
| 12 | |
| 13 | const ctx: ToolContext = { |
| 14 | indexState: { status: 'ready' }, |
| 15 | paths: { |
| 16 | baseDir: path.join(root, '.codebase-context'), |
| 17 | memory: path.join(root, '.codebase-context', 'memory.json'), |
| 18 | intelligence: path.join(root, '.codebase-context', 'intelligence.json'), |
| 19 | health: healthPath, |
| 20 | keywordIndex: path.join(root, '.codebase-context', 'index.json'), |
| 21 | vectorDb: path.join(root, '.codebase-context', 'index') |
| 22 | }, |
| 23 | rootPath: root, |
| 24 | performIndexing: () => undefined |
| 25 | }; |
| 26 | |
| 27 | return { root, ctx }; |
| 28 | } |
| 29 | |
| 30 | describe('get_codebase_health', () => { |
| 31 | it('returns filtered top-risk files from health.json', async () => { |
no outgoing calls
no test coverage detected