@arkhera30/cli 0.3.8 → 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 +53 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -649,11 +649,14 @@ 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}
|
|
656
658
|
- FORGE_SCAN_PATHS=\${FORGE_SCAN_PATHS:-/data/repos}
|
|
659
|
+
- FORGE_SESSION_TTL_MS=\${FORGE_SESSION_TTL_MS:-1800000}
|
|
657
660
|
- GITHUB_TOKEN=\${GITHUB_TOKEN:-}
|
|
658
661
|
- TYPESENSE_HOST=typesense
|
|
659
662
|
- TYPESENSE_PORT=8108
|
|
@@ -831,6 +834,12 @@ function generateComposeFile(config, runtime) {
|
|
|
831
834
|
- PORT=8000
|
|
832
835
|
- GITHUB_TOKEN=${token}
|
|
833
836
|
- GITHUB_API_HOST=${apiHost}
|
|
837
|
+
- TYPESENSE_HOST=typesense
|
|
838
|
+
- TYPESENSE_PORT=8108
|
|
839
|
+
- TYPESENSE_API_KEY=\${TYPESENSE_API_KEY:-horus-local-key}
|
|
840
|
+
depends_on:
|
|
841
|
+
typesense:
|
|
842
|
+
condition: service_healthy
|
|
834
843
|
networks:
|
|
835
844
|
- horus-net
|
|
836
845
|
restart: unless-stopped
|
|
@@ -2471,6 +2480,45 @@ async function checkServices(runtime) {
|
|
|
2471
2480
|
}
|
|
2472
2481
|
return results;
|
|
2473
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
|
+
}
|
|
2474
2522
|
var doctorCommand = new Command8("doctor").description("Diagnose common Horus issues").action(async () => {
|
|
2475
2523
|
console.log("");
|
|
2476
2524
|
console.log(chalk8.bold("Horus Doctor"));
|
|
@@ -2504,6 +2552,11 @@ var doctorCommand = new Command8("doctor").description("Diagnose common Horus is
|
|
|
2504
2552
|
});
|
|
2505
2553
|
}
|
|
2506
2554
|
}
|
|
2555
|
+
const [anvilSync, forgeSync] = await Promise.all([
|
|
2556
|
+
checkSyncHealth("anvil", ports),
|
|
2557
|
+
checkSyncHealth("forge", ports)
|
|
2558
|
+
]);
|
|
2559
|
+
allResults.push(anvilSync, forgeSync);
|
|
2507
2560
|
for (const result of allResults) {
|
|
2508
2561
|
console.log(`${symbol(result.status)}${colorMessage(result.status, result.message)}`);
|
|
2509
2562
|
}
|