MCPcopy Index your code
hub / github.com/PatrickSys/codebase-context / createContextRoot

Function createContextRoot

tests/get-codebase-health.test.ts:8–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import type { ToolContext } from '../src/tools/types.js';
7
8async 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
30describe('get_codebase_health', () => {
31 it('returns filtered top-risk files from health.json', async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected