MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / status

Function status

e2e/scripts/cli.ts:467–504  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

465// --- lifecycle commands ----------------------------------------------------
466
467const status = async () => {
468 if (!existsSync(devDir)) return console.log("no instances");
469 const states: InstanceState[] = [];
470 for (const f of readdirSync(devDir)) {
471 if (!f.endsWith(".json")) continue;
472 try {
473 const parsed: unknown = JSON.parse(readFileSync(join(devDir, f), "utf8"));
474 if (isInstanceState(parsed)) states.push(parsed);
475 } catch {
476 // skip unparseable debris
477 }
478 }
479 if (states.length === 0) return console.log("no instances");
480 for (const state of states) {
481 const live = alive(state.runnerPid);
482 let label: string;
483 if (!live) {
484 label = "DEAD (stale state file)";
485 } else if (state.status === "ready") {
486 const appUrl = state.urls?.app;
487 if (appUrl && !(await appResponds(appUrl))) {
488 label = "UNRESPONSIVE (runner alive but app not answering)";
489 } else {
490 label = state.status;
491 }
492 } else {
493 label = state.status;
494 }
495 console.log(`${state.target}: ${label} — runner ${state.runnerPid}, since ${state.startedAt}`);
496 if (live && state.status === "ready") {
497 if (label === "UNRESPONSIVE (runner alive but app not answering)") {
498 console.log(` log ${state.logFile}`);
499 } else {
500 printInstance(state);
501 }
502 }
503 }
504};
505
506const down = async (targetName: string) => {
507 const state = readState(targetName);

Callers 1

mainFunction · 0.70

Calls 6

isInstanceStateFunction · 0.85
aliveFunction · 0.85
appRespondsFunction · 0.85
printInstanceFunction · 0.85
logMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected