@clawops/cli 1.7.9 → 2.0.0

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.
Files changed (57) hide show
  1. package/README.md +412 -70
  2. package/dist/{apply-F3KY2HTB.js → apply-AM5HERE7.js} +8 -6
  3. package/dist/{aws-L4RR2LSE.js → aws-AMON7DA7.js} +20 -9
  4. package/dist/{azure-7OXQENQL.js → azure-T4G6OBJQ.js} +19 -8
  5. package/dist/{bootstrap-HL4DNUNG.js → bootstrap-DMRPWJGN.js} +28 -19
  6. package/dist/bootstrap.sh.tmpl +51 -31
  7. package/dist/channels-KBUR42IU.js +53 -0
  8. package/dist/{chunk-DQDAWNGB.js → chunk-3WYA2QDM.js} +1 -1
  9. package/dist/chunk-6TIYVHPX.js +152 -0
  10. package/dist/{chunk-3XK66DKK.js → chunk-AHAAEXWC.js} +41 -0
  11. package/dist/{chunk-GZN7PKP4.js → chunk-AX74VXTV.js} +292 -94
  12. package/dist/{chunk-C5X375RO.js → chunk-CKSPROD5.js} +59 -15
  13. package/dist/{chunk-UKTP332Z.js → chunk-GAZPPSKU.js} +6 -7
  14. package/dist/{chunk-FNS56UQY.js → chunk-GYV4KNW7.js} +319 -252
  15. package/dist/{chunk-PVUVI35Y.js → chunk-JW5A7E3X.js} +5 -1
  16. package/dist/chunk-LT4XMO5D.js +50 -0
  17. package/dist/{chunk-P5LKWRPL.js → chunk-LU2V3LXA.js} +3 -3
  18. package/dist/chunk-N44K3LHE.js +140 -0
  19. package/dist/chunk-NUDIHZEH.js +55 -0
  20. package/dist/chunk-SBLQH2TJ.js +56 -0
  21. package/dist/chunk-UFRO4H5W.js +228 -0
  22. package/dist/{chunk-A4QR4TXW.js → chunk-WHJMKDV7.js} +24 -4
  23. package/dist/chunk-YR3O2I3S.js +101 -0
  24. package/dist/cli.js +866 -577
  25. package/dist/config-validate-K2N6XLDX.js +76 -0
  26. package/dist/{context-5LCUG2QR.js → context-KHKWJJMC.js} +1 -1
  27. package/dist/{firewall-XQGO7HWK.js → firewall-T3NTPZJD.js} +10 -0
  28. package/dist/{gcp-UG6AWPIZ.js → gcp-2JBTD7ZM.js} +19 -8
  29. package/dist/{generate-OAGYT3VH.js → generate-2XV2GSP2.js} +4 -4
  30. package/dist/{harden-URPXLSVF.js → harden-PCDK3UQ5.js} +48 -11
  31. package/dist/health-5CCOXYGG.js +11 -0
  32. package/dist/logs-P7YCKVF4.js +15 -0
  33. package/dist/{mcp-wire-7E5JQY47.js → mcp-wire-BFEY2Y6H.js} +23 -17
  34. package/dist/{package-5AR4ZPK4.js → package-3HUW57XH.js} +3 -3
  35. package/dist/plugins-DTST3OER.js +49 -0
  36. package/dist/{pool-QGFQRMGU.js → pool-EX4ZTA5P.js} +2 -2
  37. package/dist/privileged-JFA6LLTV.js +17 -0
  38. package/dist/{remote-config-QDLN4UMG.js → remote-config-Z6IIZR3D.js} +3 -3
  39. package/dist/runtime-LZ7NA53V.js +42 -0
  40. package/dist/{server-FIZCOLHL.js → server-A5AB67GQ.js} +16 -12
  41. package/dist/spec-path-KQOOIQCA.js +9 -0
  42. package/dist/{ssh-CNJNLM3E.js → ssh-B3NZAU4I.js} +1 -1
  43. package/dist/upgrade-ULD4KFYC.js +88 -0
  44. package/dist/validate-BOQRWX4F.js +14 -0
  45. package/dist/{version-guard-VUCNZXQS.js → version-guard-GPSTCPT7.js} +3 -3
  46. package/dist/{versions-2UVAT6PQ.js → versions-W5LRQCAJ.js} +2 -2
  47. package/package.json +3 -3
  48. package/spec/deploy-plan.schema.json +114 -25
  49. package/spec/integrations.yaml +135 -28
  50. package/spec/mcp-tools.yaml +68 -35
  51. package/spec/models.yaml +9 -0
  52. package/spec/openclaw-2.0.config.schema.json +1 -0
  53. package/spec/openclaw-versions.yaml +116 -27
  54. package/dist/chunk-35WVQY3X.js +0 -122
  55. package/dist/chunk-6X45DDGH.js +0 -42
  56. package/dist/chunk-SEZMVVAS.js +0 -156
  57. package/dist/validate-CFQ4FH2T.js +0 -10
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ resolveSpecDir
4
+ } from "./chunk-JW5A7E3X.js";
5
+
6
+ // src/plan/validate.ts
7
+ import Ajv from "ajv/dist/2020";
8
+ import addFormats from "ajv-formats";
9
+ import { readFileSync } from "fs";
10
+ import { join } from "path";
11
+ var _validate;
12
+ function getValidator() {
13
+ if (_validate) return _validate;
14
+ const ajv = new Ajv({ strict: false });
15
+ addFormats(ajv);
16
+ const schema = JSON.parse(
17
+ readFileSync(join(resolveSpecDir(), "deploy-plan.schema.json"), "utf-8")
18
+ );
19
+ _validate = ajv.compile(schema);
20
+ return _validate;
21
+ }
22
+ function validatePlan(plan) {
23
+ const validate = getValidator();
24
+ const ok = validate(plan);
25
+ if (ok) return { ok: true, errors: [] };
26
+ const errors = (validate.errors ?? []).map(
27
+ (e) => `${e.instancePath} ${e.message ?? ""}`.trim()
28
+ );
29
+ return { ok: false, errors };
30
+ }
31
+ function assertValidPlan(plan) {
32
+ const result = validatePlan(plan);
33
+ if (!result.ok) {
34
+ throw new Error(`Invalid deploy plan:
35
+ ${result.errors.join("\n")}`);
36
+ }
37
+ }
38
+ async function validatePlanConfig(plan) {
39
+ const overlay = plan.spec?.openclaw?.config;
40
+ if (overlay === void 0 || overlay === null) return { ok: true, errors: [], warnings: [] };
41
+ const [{ validateConfig }, yaml] = await Promise.all([
42
+ import("./config-validate-K2N6XLDX.js"),
43
+ import("./js-yaml-PTEEG4FO.js")
44
+ ]);
45
+ const { loadVersionSpec } = await import("./versions-W5LRQCAJ.js");
46
+ const spec = loadVersionSpec(yaml);
47
+ const { deepMerge } = await import("./remote-config-Z6IIZR3D.js");
48
+ const merged = deepMerge(
49
+ { gateway: { mode: "local" } },
50
+ overlay
51
+ );
52
+ const { errors, warnings } = await validateConfig(merged, {
53
+ openclawVersion: plan.spec?.openclaw?.version,
54
+ schemaCapturedFrom: spec.runtime?.configSchemaCapturedFrom
55
+ });
56
+ return { ok: errors.length === 0, errors, warnings };
57
+ }
58
+ function validatePlanNetwork(plan) {
59
+ const net = plan.spec?.network;
60
+ if (!net) return { ok: true, errors: [], warnings: [] };
61
+ const errors = [];
62
+ const warnings = [];
63
+ const publish = net.publishGateway ?? "loopback";
64
+ const gatewayCidrs = net.allowedGatewayCidrs ?? [];
65
+ if (publish === "loopback" && gatewayCidrs.length > 0) {
66
+ errors.push(
67
+ `network.allowedGatewayCidrs lists ${gatewayCidrs.length} CIDR(s) but network.publishGateway is "loopback", so the gateway binds 127.0.0.1 on the host and nothing is listening on a routable interface. Those rules would admit traffic to a closed port. Either drop them and reach the gateway with \`clawops tunnel\`, or set publishGateway to "all" \u2014 which serves plaintext HTTP, so put TLS in front of it.`
68
+ );
69
+ }
70
+ for (const [field, cidrs] of [
71
+ ["allowedSshCidrs", net.allowedSshCidrs ?? []],
72
+ ["allowedGatewayCidrs", gatewayCidrs]
73
+ ]) {
74
+ if (cidrs.some((c) => c === "0.0.0.0/0" || c === "::/0")) {
75
+ warnings.push(
76
+ `network.${field} admits the whole internet. clawops will create the rule you asked for, but \`clawops harden\` reports it as a finding.`
77
+ );
78
+ }
79
+ }
80
+ const configured = gatewayPortFromConfig(plan.spec?.openclaw?.config);
81
+ if (net.gatewayPort !== void 0 && configured !== void 0 && configured !== net.gatewayPort) {
82
+ errors.push(
83
+ `network.gatewayPort is ${net.gatewayPort} but the config overlay sets gateway.port to ${configured}. The container would publish one port while the gateway listened on the other. Set one of them, not both.`
84
+ );
85
+ }
86
+ return { ok: errors.length === 0, errors, warnings };
87
+ }
88
+ function gatewayPortFromConfig(config) {
89
+ if (config === null || typeof config !== "object") return void 0;
90
+ const gateway = config["gateway"];
91
+ if (gateway === null || typeof gateway !== "object") return void 0;
92
+ const port = gateway["port"];
93
+ return typeof port === "number" ? port : void 0;
94
+ }
95
+
96
+ export {
97
+ validatePlan,
98
+ assertValidPlan,
99
+ validatePlanConfig,
100
+ validatePlanNetwork
101
+ };