@opentrust/cli 7.3.29 → 7.3.31

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.
@@ -13,9 +13,9 @@ const SCAFFOLD_PKG = {
13
13
  status: "opentrust status",
14
14
  },
15
15
  dependencies: {
16
- "@opentrust/core": "^7.3.29",
17
- "@opentrust/gateway": "^7.3.29",
18
- "@opentrust/dashboard": "^7.3.29",
16
+ "@opentrust/core": "^7.3.31",
17
+ "@opentrust/gateway": "^7.3.31",
18
+ "@opentrust/dashboard": "^7.3.31",
19
19
  },
20
20
  };
21
21
  const ENV_TEMPLATE = `# OpenTrust Configuration
@@ -47,6 +47,8 @@ export function executeHostCommand(cmd) {
47
47
  return handleInstallGuards(payload);
48
48
  case "upgrade_guards":
49
49
  return handleUpgradeGuards(payload);
50
+ case "install_openclaw":
51
+ return handleInstallOpenclaw(payload);
50
52
  default:
51
53
  return { success: false, error: `Unknown command type: ${cmd.type}` };
52
54
  }
@@ -286,3 +288,42 @@ function handleUpgradeGuards(payload) {
286
288
  error: install.error,
287
289
  };
288
290
  }
291
+ // ── OpenClaw installation ────────────────────────────
292
+ function handleInstallOpenclaw(payload) {
293
+ const config = payload.config;
294
+ if (!config)
295
+ return { success: false, error: "Missing config in payload. Configure OpenClaw template in Settings first." };
296
+ const results = [];
297
+ try {
298
+ const output = execSync("curl -fsSL https://openclaw.ai/install.sh | bash", {
299
+ encoding: "utf-8",
300
+ timeout: 300_000,
301
+ stdio: ["pipe", "pipe", "pipe"],
302
+ cwd: os.homedir(),
303
+ env: { ...process.env, HOME: os.homedir() },
304
+ shell: "/bin/bash",
305
+ });
306
+ results.push(`Install script: ${output.trim().split("\n").slice(-3).join(" | ")}`);
307
+ }
308
+ catch (err) {
309
+ const stderr = err.stderr?.toString() || "";
310
+ const stdout = err.stdout?.toString() || "";
311
+ if (stdout.toLowerCase().includes("already installed") || stdout.toLowerCase().includes("openclaw")) {
312
+ results.push(`Install script: ${stdout.trim().split("\n").slice(-2).join(" | ")} (may already be installed)`);
313
+ }
314
+ else {
315
+ return { success: false, error: `Install script failed: ${(stderr || err.message || String(err)).slice(0, 500)}` };
316
+ }
317
+ }
318
+ try {
319
+ const clawHome = path.join(os.homedir(), ".openclaw");
320
+ fs.mkdirSync(clawHome, { recursive: true });
321
+ const configFile = path.join(clawHome, "openclaw.json");
322
+ fs.writeFileSync(configFile, JSON.stringify(config, null, 2) + "\n", "utf-8");
323
+ results.push(`Config written to ${configFile}`);
324
+ }
325
+ catch (err) {
326
+ return { success: false, error: `Failed to write config: ${(err.message || String(err)).slice(0, 500)}` };
327
+ }
328
+ return { success: true, output: results.join("\n") };
329
+ }
@@ -1,6 +1,7 @@
1
1
  import os from "node:os";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
+ import { execSync } from "node:child_process";
4
5
  import { getStatus, checkHealth, getAllServiceKeys, SERVICES } from "./process-manager.js";
5
6
  function getLocalIp() {
6
7
  const interfaces = os.networkInterfaces();
@@ -70,6 +71,15 @@ function detectGuards() {
70
71
  return { installed: false };
71
72
  }
72
73
  }
74
+ function detectOpenclaw() {
75
+ try {
76
+ const ver = execSync("openclaw --version", { encoding: "utf-8", timeout: 5_000, stdio: ["pipe", "pipe", "pipe"] }).trim();
77
+ return { installed: true, version: ver || undefined };
78
+ }
79
+ catch {
80
+ return { installed: false };
81
+ }
82
+ }
73
83
  export function getSystemMetadata() {
74
84
  const cpus = os.cpus();
75
85
  return {
@@ -80,5 +90,6 @@ export function getSystemMetadata() {
80
90
  uptime: os.uptime(),
81
91
  nodeVersion: process.version,
82
92
  guards: detectGuards(),
93
+ openclaw: detectOpenclaw(),
83
94
  };
84
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentrust/cli",
3
- "version": "7.3.29",
3
+ "version": "7.3.31",
4
4
  "description": "CLI tool to manage OpenTrust AI Agent Runtime Security Platform — setup, start, stop, status, logs",
5
5
  "type": "module",
6
6
  "bin": {