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

Function cmdStatus

dev/local/cli.ts:552–615  ·  view source on GitHub ↗
(repoRoot: string, isJson = false)

Source from the content-addressed store, hash-verified

550 if (otherSessions.length > 0) {
551 console.warn(`⚠ Other kilo-dev sessions are running: ${otherSessions.join(', ')}`);
552 if (portOffset > 0) {
553 console.warn(` This worktree uses port offset ${portOffset}`);
554 } else {
555 console.warn(
556 ' Port conflicts are likely. Set KILO_PORT_OFFSET=auto or stop other sessions.'
557 );
558 }
559 }
560
561 if (portOffset > 0) {
562 console.log(`${DIM}Port offset: ${portOffset} (KILO_PORT_OFFSET)${RESET}`);
563 }
564
565 const mobileEnv: Record<string, string> = {};
566 if (serviceNames.includes('mobile')) {
567 const host = process.env.MOBILE_DEV_HOST || detectLanIp();
568 if (!host) {
569 throw new Error('Could not detect LAN IP. Set MOBILE_DEV_HOST explicitly.');
570 }
571 Object.assign(mobileEnv, prepareMobileEnvironment(repoRoot, host).sessionEnv);
572 }
573
574 const envResult = await syncEnvVars({ repoRoot, yes: true, targets: serviceNames });
575 if (!envResult.ok) {
576 throw new Error('Failed to prepare required local service environment');
577 }
578
579 if (serviceNames.includes('cloud-agent-public-tunnels')) {
580 try {
581 execSync('cloudflared --version', { stdio: 'ignore' });
582 } catch {
583 console.error('cloudflared is not installed. Install it with: brew install cloudflared');
584 process.exit(1);
585 }
586 }
587
588 if (sessionAlreadyRunning) {
589 for (const name of serviceNames) {
590 const service = getService(name);
591 if (service.type !== 'worker' || !findServicePane(sessionName, name)) continue;
592 const outcome = await restartServiceInTmux(sessionName, name, undefined, serviceNames);
593 if (outcome === 'gave-up') throw new Error(`${name} did not restart with refreshed secrets`);
594 }
595 if (Object.keys(mobileEnv).length > 0) {
596 setSessionEnvironment(sessionName, mobileEnv);
597 const nextjsPane = findServicePane(sessionName, 'nextjs');
598 if (nextjsPane) {
599 // The selection keeps the mock's CA export on the relaunched command.
600 const outcome = await restartServiceInTmux(sessionName, 'nextjs', undefined, serviceNames);
601 if (outcome === 'gave-up')
602 throw new Error('nextjs did not restart with refreshed mobile URLs');
603 }
604 const mobilePane = findServicePane(sessionName, 'mobile');
605 if (mobilePane) {
606 const outcome = await restartServiceInTmux(sessionName, 'mobile', mobileEnv);
607 if (outcome === 'gave-up')
608 throw new Error('mobile did not restart with refreshed mobile URLs');
609 }

Callers 1

mainFunction · 0.85

Calls 10

getSessionNameFunction · 0.90
sessionExistsFunction · 0.90
findServicePaneFunction · 0.90
getServiceFunction · 0.90
isPaneRunningCommandFunction · 0.90
probePortFunction · 0.90
readManifestFunction · 0.85
getManifestEntryFunction · 0.85
readNextjsDevPortFunction · 0.85
logMethod · 0.65

Tested by

no test coverage detected