MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / findRepoRoot

Function findRepoRoot

dev/local/runner.ts:28–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27export function findRepoRoot(): string {
28 let dir = import.meta.dirname;
29 for (let i = 0; i < 20; i++) {
30 const pkgPath = path.join(dir, 'package.json');
31 if (fs.existsSync(pkgPath)) {
32 try {
33 const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
34 if (pkg.name === 'kilocode-monorepo') return dir;
35 } catch {
36 // Not valid JSON, keep walking
37 }
38 }
39 const parent = path.dirname(dir);
40 if (parent === dir) break;
41 dir = parent;
42 }
43 throw new Error("Could not find repo root (package.json with name 'kilocode-monorepo')");
44}
45
46export function probePort(port: number, timeoutMs = 500): Promise<boolean> {
47 return new Promise(resolve => {
48 const socket = new net.Socket();

Callers 5

dashboard.tsxFile · 0.90
mainFunction · 0.90
buildStartCommandFunction · 0.70
startServiceInTmuxFunction · 0.70
buildLogPipeCommandFunction · 0.70

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected