MCPcopy Create free account
hub / github.com/microsoft/AI-Engineering-Coach / parseMainRoot

Function parseMainRoot

scripts/parse-parity.ts:53–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51}
52
53function parseMainRoot(): string {
54 const args = process.argv.slice(2);
55 const i = args.indexOf('--main');
56 if (i >= 0 && args[i + 1]) return path.resolve(args[i + 1]);
57 if (process.env.PARITY_MAIN) return path.resolve(process.env.PARITY_MAIN);
58
59 // Default: discover the main worktree from git rather than hard-coding a path, so this runs on
60 // any OS and any checkout layout. Fail with an actionable message if it cannot be found.
61 const fromGit = findMainWorktree();
62 if (fromGit && fs.existsSync(path.join(fromGit, 'src', 'core', 'parser.ts'))) return fromGit;
63
64 throw new Error(
65 'parse-parity: could not locate a main checkout to compare against. Pass --main <path>, set ' +
66 'PARITY_MAIN, or add a worktree for the main branch (git worktree add <path> main).',
67 );
68}
69
70const mainRoot = parseMainRoot();
71const outDir = path.join(branchRoot, 'scripts', '.parity-out');

Callers 1

parse-parity.tsFile · 0.85

Calls 1

findMainWorktreeFunction · 0.85

Tested by

no test coverage detected