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

Function status

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

Source from the content-addressed store, hash-verified

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