@arkhera30/cli 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +46 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -649,7 +649,9 @@ var FORGE_SERVICE = ` # \u2500\u2500 Forge \u2500\u2500\u2500\u2500\u2500\u2500
|
|
|
649
649
|
- FORGE_ANVIL_URL=http://anvil:8100
|
|
650
650
|
- FORGE_VAULT_URL=http://vault-mcp:8300
|
|
651
651
|
- FORGE_HOST_WORKSPACES_PATH=\${HORUS_DATA_PATH}/workspaces
|
|
652
|
+
- FORGE_HOST_MANAGED_REPOS_PATH=\${HORUS_DATA_PATH}/repos
|
|
652
653
|
- FORGE_HOST_REPOS_PATH=\${HOST_REPOS_PATH}
|
|
654
|
+
- FORGE_HOST_MANAGED_REPOS_PATH=\${HORUS_DATA_PATH}/repos
|
|
653
655
|
- FORGE_HOST_ANVIL_URL=http://localhost:\${ANVIL_PORT:-8100}
|
|
654
656
|
- FORGE_HOST_VAULT_URL=http://localhost:\${VAULT_MCP_PORT:-8300}
|
|
655
657
|
- FORGE_HOST_FORGE_URL=http://localhost:\${FORGE_PORT:-8200}
|
|
@@ -2478,6 +2480,45 @@ async function checkServices(runtime) {
|
|
|
2478
2480
|
}
|
|
2479
2481
|
return results;
|
|
2480
2482
|
}
|
|
2483
|
+
async function checkSyncHealth(serviceName, ports) {
|
|
2484
|
+
const portMap = { anvil: ports.anvil, forge: ports.forge };
|
|
2485
|
+
const port = portMap[serviceName];
|
|
2486
|
+
const url = `http://localhost:${port}/health`;
|
|
2487
|
+
try {
|
|
2488
|
+
const resp = await fetch(url, { signal: AbortSignal.timeout(3e3) });
|
|
2489
|
+
const body = await resp.json();
|
|
2490
|
+
const sync = body.sync;
|
|
2491
|
+
if (resp.status === 503 || body.status === "degraded") {
|
|
2492
|
+
const failures = sync?.consecutive_failures ?? "?";
|
|
2493
|
+
const lastError = typeof sync?.last_error === "string" ? sync.last_error : "unknown";
|
|
2494
|
+
const ahead = sync?.ahead ?? "?";
|
|
2495
|
+
const behind = sync?.behind ?? "?";
|
|
2496
|
+
return {
|
|
2497
|
+
status: "fail",
|
|
2498
|
+
label: `Sync: ${serviceName}`,
|
|
2499
|
+
message: `${serviceName} git sync is stuck (${failures} consecutive failures, ${ahead} ahead / ${behind} behind): ${lastError}`,
|
|
2500
|
+
hint: `Run: horus logs ${serviceName} \u2014 or manually: cd ~/Horus/data/${serviceName === "forge" ? "registry" : "notes"} && git reset --hard origin/master`
|
|
2501
|
+
};
|
|
2502
|
+
}
|
|
2503
|
+
if (sync && sync.ok === false) {
|
|
2504
|
+
const failures = sync.consecutive_failures ?? 1;
|
|
2505
|
+
return {
|
|
2506
|
+
status: "warn",
|
|
2507
|
+
label: `Sync: ${serviceName}`,
|
|
2508
|
+
message: `${serviceName} git sync had a recent failure (${failures} consecutive) \u2014 not yet stuck`,
|
|
2509
|
+
hint: `Run: horus logs ${serviceName}`
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
return { status: "pass", label: `Sync: ${serviceName}`, message: `${serviceName} git sync healthy` };
|
|
2513
|
+
} catch {
|
|
2514
|
+
return {
|
|
2515
|
+
status: "warn",
|
|
2516
|
+
label: `Sync: ${serviceName}`,
|
|
2517
|
+
message: `${serviceName} health endpoint not reachable \u2014 sync status unknown`,
|
|
2518
|
+
hint: "Service may not be running"
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2481
2522
|
var doctorCommand = new Command8("doctor").description("Diagnose common Horus issues").action(async () => {
|
|
2482
2523
|
console.log("");
|
|
2483
2524
|
console.log(chalk8.bold("Horus Doctor"));
|
|
@@ -2511,6 +2552,11 @@ var doctorCommand = new Command8("doctor").description("Diagnose common Horus is
|
|
|
2511
2552
|
});
|
|
2512
2553
|
}
|
|
2513
2554
|
}
|
|
2555
|
+
const [anvilSync, forgeSync] = await Promise.all([
|
|
2556
|
+
checkSyncHealth("anvil", ports),
|
|
2557
|
+
checkSyncHealth("forge", ports)
|
|
2558
|
+
]);
|
|
2559
|
+
allResults.push(anvilSync, forgeSync);
|
|
2514
2560
|
for (const result of allResults) {
|
|
2515
2561
|
console.log(`${symbol(result.status)}${colorMessage(result.status, result.message)}`);
|
|
2516
2562
|
}
|