@sdotwinter/openclaw-deterministic 0.17.2 → 0.17.4
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/bin/cli.js +5 -0
- package/bin/status.js +58 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -15,6 +15,10 @@ switch (command) {
|
|
|
15
15
|
require(path.join(__dirname, "doctor"));
|
|
16
16
|
break;
|
|
17
17
|
|
|
18
|
+
case "status":
|
|
19
|
+
require(path.join(__dirname, "status"));
|
|
20
|
+
break;
|
|
21
|
+
|
|
18
22
|
case "install":
|
|
19
23
|
require(path.join(__dirname, "install"));
|
|
20
24
|
break;
|
|
@@ -62,6 +66,7 @@ function showHelp() {
|
|
|
62
66
|
console.log("Usage:");
|
|
63
67
|
console.log(" oc-deterministic init");
|
|
64
68
|
console.log(" oc-deterministic doctor");
|
|
69
|
+
console.log(" oc-deterministic status");
|
|
65
70
|
console.log(" oc-deterministic install");
|
|
66
71
|
console.log(" oc-deterministic upgrade");
|
|
67
72
|
console.log(" oc-deterministic enable");
|
package/bin/status.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
// Reuse doctor in JSON mode
|
|
7
|
+
const doctorPath = path.join(__dirname, "doctor");
|
|
8
|
+
|
|
9
|
+
const result = spawnSync("node", [doctorPath, "--json"], {
|
|
10
|
+
encoding: "utf8",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (result.error) {
|
|
14
|
+
console.error("CRITICAL");
|
|
15
|
+
console.error("Doctor execution failed.");
|
|
16
|
+
process.exit(5);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let data;
|
|
20
|
+
try {
|
|
21
|
+
data = JSON.parse(result.stdout);
|
|
22
|
+
} catch {
|
|
23
|
+
console.error("CRITICAL");
|
|
24
|
+
console.error("Doctor returned invalid JSON.");
|
|
25
|
+
process.exit(6);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!data.openclawDetected || !data.workspaceDetected) {
|
|
29
|
+
console.log("CRITICAL");
|
|
30
|
+
console.log("OpenClaw not detected.");
|
|
31
|
+
process.exit(2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (data.semanticStatus === "hard-limit-exceeded") {
|
|
35
|
+
console.log("CRITICAL");
|
|
36
|
+
console.log("Semantic HARD_LIMIT exceeded.");
|
|
37
|
+
process.exit(3);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (
|
|
41
|
+
data.integrity &&
|
|
42
|
+
Object.values(data.integrity).some(
|
|
43
|
+
(x) => x.present && x.valid === false
|
|
44
|
+
)
|
|
45
|
+
) {
|
|
46
|
+
console.log("DEGRADED");
|
|
47
|
+
console.log("Canonical integrity failure.");
|
|
48
|
+
process.exit(4);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (data.semanticStatus === "risk-threshold") {
|
|
52
|
+
console.log("DEGRADED");
|
|
53
|
+
console.log("Semantic above risk threshold.");
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log("OK");
|
|
58
|
+
process.exit(0);
|