@clawops/cli 2.0.0 → 2.0.2

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 (75) hide show
  1. package/README.md +99 -12
  2. package/dist/apply-WOUTUUQH.js +27 -0
  3. package/dist/automation-UKRM3BD2.js +44 -0
  4. package/dist/bedrock-XVASJX2K.js +61 -0
  5. package/dist/{bootstrap-DMRPWJGN.js → bootstrap-HNGKY6WW.js} +11 -8
  6. package/dist/{chunk-N44K3LHE.js → chunk-2I7KCMXZ.js} +6 -4
  7. package/dist/{chunk-3WYA2QDM.js → chunk-2Z7J3ERQ.js} +1 -1
  8. package/dist/chunk-3OLUJPCB.js +36 -0
  9. package/dist/{chunk-GYV4KNW7.js → chunk-5TXCUOZV.js} +133 -40
  10. package/dist/chunk-AEEMRFZV.js +24 -0
  11. package/dist/{chunk-YR3O2I3S.js → chunk-BSLIYB5Q.js} +6 -1
  12. package/dist/{chunk-AHAAEXWC.js → chunk-E4NJSJ54.js} +16 -93
  13. package/dist/chunk-FEK7VJAY.js +16 -0
  14. package/dist/{chunk-6TIYVHPX.js → chunk-GIEVAGEK.js} +7 -33
  15. package/dist/chunk-HSPHXG6W.js +67 -0
  16. package/dist/chunk-LEVIW2PV.js +890 -0
  17. package/dist/chunk-MC5ATCXS.js +108 -0
  18. package/dist/chunk-N4WZLWJ4.js +16 -0
  19. package/dist/{chunk-SBLQH2TJ.js → chunk-NUL5F6YV.js} +1 -1
  20. package/dist/chunk-PSOSBJVO.js +51 -0
  21. package/dist/{chunk-AX74VXTV.js → chunk-RATEIAFU.js} +58 -49
  22. package/dist/chunk-RHOWYIWT.js +52 -0
  23. package/dist/{chunk-WHJMKDV7.js → chunk-SDZKCICH.js} +65 -12
  24. package/dist/chunk-V25QRZRB.js +45 -0
  25. package/dist/chunk-VOEJYRIK.js +33 -0
  26. package/dist/{providers-2OABPW2E.js → chunk-VUFMZEIM.js} +3 -2
  27. package/dist/chunk-WTZ2CT35.js +69 -0
  28. package/dist/{chunk-UFRO4H5W.js → chunk-ZMMRIWFS.js} +56 -40
  29. package/dist/cli-NH7VUNOU.js +11 -0
  30. package/dist/cli-auth-GD5SK7JU.js +13 -0
  31. package/dist/cli.js +518 -206
  32. package/dist/context-M4JBBIAV.js +20 -0
  33. package/dist/docker-3PDO4TS7.js +12 -0
  34. package/dist/{firewall-T3NTPZJD.js → firewall-5VKZ4WBH.js} +22 -1
  35. package/dist/generate-J6MIJGII.js +29 -0
  36. package/dist/{harden-PCDK3UQ5.js → harden-72JMRT4E.js} +8 -5
  37. package/dist/index.d.ts +56 -0
  38. package/dist/known-hosts-file-I3Q3NBYQ.js +22 -0
  39. package/dist/{logs-P7YCKVF4.js → logs-5A7YYA53.js} +1 -1
  40. package/dist/{mcp-wire-BFEY2Y6H.js → mcp-wire-NTGL5ITF.js} +25 -15
  41. package/dist/models-AGTQWYDL.js +32 -0
  42. package/dist/network-args-PYJRJBYO.js +64 -0
  43. package/dist/{package-3HUW57XH.js → package-3A6BOALU.js} +11 -3
  44. package/dist/passphrase-MJBE45N7.js +15 -0
  45. package/dist/{pool-EX4ZTA5P.js → pool-PIIKJ4L2.js} +3 -2
  46. package/dist/preflight-EF52S3WW.js +162 -0
  47. package/dist/preflight-MWWM5JT3.js +181 -0
  48. package/dist/preflight-TFD4N5ZU.js +141 -0
  49. package/dist/providers-FW6H6OPF.js +11 -0
  50. package/dist/ready-KDNRBNSU.js +95 -0
  51. package/dist/{remote-config-Z6IIZR3D.js → remote-config-3HZLUWEA.js} +3 -2
  52. package/dist/{runtime-LZ7NA53V.js → runtime-X3KW5TCP.js} +4 -2
  53. package/dist/server-RWM2JI3D.js +46 -0
  54. package/dist/ssh-VAI5DU5M.js +11 -0
  55. package/dist/ssh-key-DUO6OKOI.js +7 -0
  56. package/dist/stack-config-R4SPSUQZ.js +12 -0
  57. package/dist/{validate-BOQRWX4F.js → validate-YVI3BJ55.js} +1 -1
  58. package/dist/wait-WO72TRRQ.js +79 -0
  59. package/package.json +11 -3
  60. package/spec/mcp-tools.yaml +21 -2
  61. package/spec/models.yaml +14 -3
  62. package/spec/providers.schema.json +163 -28
  63. package/dist/apply-AM5HERE7.js +0 -19
  64. package/dist/automation-RULUSJBW.js +0 -30
  65. package/dist/aws-AMON7DA7.js +0 -265
  66. package/dist/azure-T4G6OBJQ.js +0 -273
  67. package/dist/chunk-CKSPROD5.js +0 -129
  68. package/dist/chunk-LU2V3LXA.js +0 -114
  69. package/dist/context-KHKWJJMC.js +0 -10
  70. package/dist/gcp-2JBTD7ZM.js +0 -204
  71. package/dist/generate-2XV2GSP2.js +0 -15
  72. package/dist/local-DXBEVZ5C.js +0 -47
  73. package/dist/server-A5AB67GQ.js +0 -36
  74. package/dist/ssh-B3NZAU4I.js +0 -8
  75. package/dist/{version-guard-GPSTCPT7.js → version-guard-XVYW5WFJ.js} +1 -1
@@ -17,8 +17,9 @@ function getProvider(name) {
17
17
  function listProviders() {
18
18
  return Array.from(registry.keys());
19
19
  }
20
+
20
21
  export {
22
+ registerProvider,
21
23
  getProvider,
22
- listProviders,
23
- registerProvider
24
+ listProviders
24
25
  };
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ readLocalState
4
+ } from "./chunk-A2I76FTA.js";
5
+ import {
6
+ getConfigDir,
7
+ requireConfig
8
+ } from "./chunk-CX5SL5HP.js";
9
+ import {
10
+ UsageError
11
+ } from "./chunk-KGXPLI7W.js";
12
+ import {
13
+ getProvider
14
+ } from "./chunk-VUFMZEIM.js";
15
+
16
+ // src/cli/context.ts
17
+ function buildContext(args) {
18
+ const config = requireConfig();
19
+ const stackName = typeof args.stack === "string" ? args.stack : config.defaults.stack;
20
+ const providerName = typeof args.provider === "string" ? args.provider : config.stacks[stackName]?.provider ?? config.defaults.provider;
21
+ const adapter = loadProvider(providerName);
22
+ const localState = providerName === "local" ? readLocalState(stackName) : void 0;
23
+ let stackCache = null;
24
+ return {
25
+ config,
26
+ adapter,
27
+ stackName,
28
+ localState,
29
+ async getStack() {
30
+ if (providerName === "local") {
31
+ throw new UsageError(
32
+ "The local provider does not use Pulumi stacks. Use `clawops up` to bootstrap the host instead."
33
+ );
34
+ }
35
+ if (stackCache) return stackCache;
36
+ const stackConfig = config.stacks[stackName];
37
+ if (!stackConfig) {
38
+ throw new UsageError(
39
+ `Stack "${stackName}" not found in config. Run \`clawops init\` or use \`--stack\` to specify a different stack.`
40
+ );
41
+ }
42
+ const { getOrCreateStack } = await import("./automation-UKRM3BD2.js");
43
+ stackCache = await getOrCreateStack({
44
+ stack: stackName,
45
+ stateUrl: stackConfig.stateUrl,
46
+ program: adapter.program,
47
+ configDir: getConfigDir()
48
+ });
49
+ return stackCache;
50
+ }
51
+ };
52
+ }
53
+ function loadProvider(name) {
54
+ try {
55
+ return getProvider(name);
56
+ } catch {
57
+ throw new UsageError(
58
+ `Provider "${name}" is not yet supported. Supported providers: gcp, aws, azure, local`
59
+ );
60
+ }
61
+ }
62
+ async function loadAdapterModule(name) {
63
+ return loadProvider(name);
64
+ }
65
+
66
+ export {
67
+ buildContext,
68
+ loadAdapterModule
69
+ };
@@ -1,30 +1,34 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ resolveSecrets
4
+ } from "./chunk-BOPSG2LI.js";
5
+ import {
6
+ saveOverlay
7
+ } from "./chunk-6ZFIFDBJ.js";
2
8
  import {
3
9
  atomicWriteConfig,
4
10
  deepMerge,
5
11
  readRemoteConfig,
6
12
  restartGateway
7
- } from "./chunk-N44K3LHE.js";
13
+ } from "./chunk-2I7KCMXZ.js";
8
14
  import {
9
- validatePlan
10
- } from "./chunk-YR3O2I3S.js";
15
+ writeStackConfig
16
+ } from "./chunk-HSPHXG6W.js";
11
17
  import {
12
- saveOverlay
13
- } from "./chunk-6ZFIFDBJ.js";
14
- import {
15
- resolveSecrets
16
- } from "./chunk-BOPSG2LI.js";
18
+ validatePlan
19
+ } from "./chunk-BSLIYB5Q.js";
17
20
  import {
18
21
  buildContext
19
- } from "./chunk-LU2V3LXA.js";
22
+ } from "./chunk-WTZ2CT35.js";
23
+ import {
24
+ GATEWAY_PORT
25
+ } from "./chunk-VOEJYRIK.js";
20
26
  import {
21
27
  UsageError
22
28
  } from "./chunk-KGXPLI7W.js";
23
- import {
24
- GATEWAY_PORT
25
- } from "./chunk-6TIYVHPX.js";
26
29
 
27
30
  // src/plan/apply.ts
31
+ import process from "process";
28
32
  async function applyPlan(plan, opts) {
29
33
  const validation = validatePlan(plan);
30
34
  if (!validation.ok) {
@@ -38,28 +42,14 @@ ${validation.errors.join("\n")}`
38
42
  "plan/apply is not supported for the local provider. Use `clawops up` directly."
39
43
  );
40
44
  }
41
- const { guardOpenclawVersion } = await import("./version-guard-GPSTCPT7.js");
45
+ const { guardOpenclawVersion } = await import("./version-guard-XVYW5WFJ.js");
42
46
  await guardOpenclawVersion(plan.spec.openclaw.version);
43
47
  const ctx = buildContext({
44
48
  stack: plan.spec.stackName,
45
49
  provider: plan.spec.provider
46
50
  });
47
51
  const stack = await ctx.getStack();
48
- await stack.setConfig("instanceType", { value: plan.spec.instanceType });
49
- if (plan.spec.region) {
50
- await stack.setConfig("region", { value: plan.spec.region });
51
- }
52
- await stack.setConfig("openclawVersion", { value: plan.spec.openclaw.version });
53
- await stack.setConfig("publishGateway", {
54
- value: plan.spec.network?.publishGateway ?? "loopback"
55
- });
56
- await stack.setConfig("gatewayPort", {
57
- value: String(plan.spec.network?.gatewayPort ?? GATEWAY_PORT)
58
- });
59
- const modelProvider = plan.spec.openclaw.config?.["models"]?.["provider"];
60
- if (modelProvider === "bedrock") {
61
- await stack.setConfig("bedrockEnabled", { value: "true" });
62
- }
52
+ await writeStackConfig(stack, plan);
63
53
  if (plan.metadata.stackVersion !== void 0) {
64
54
  const currentInfo = await stack.info();
65
55
  if (currentInfo !== void 0 && currentInfo.version !== plan.metadata.stackVersion) {
@@ -86,6 +76,25 @@ The diff you reviewed may no longer reflect what will be applied.
86
76
  changeSummary[op] = count;
87
77
  }
88
78
  }
79
+ const { waitForSsh } = await import("./wait-WO72TRRQ.js");
80
+ const conn = await connectionInfoFor(ctx, outputs);
81
+ if (opts?.skipReadiness) {
82
+ return { outputs, changeSummary, durationMs: Date.now() - start };
83
+ }
84
+ const readySession = await waitForSsh(conn, {
85
+ signal: opts?.signal,
86
+ onProgress: (line) => reportProgress(opts, line)
87
+ });
88
+ const { waitForGateway } = await import("./ready-KDNRBNSU.js");
89
+ try {
90
+ await waitForGateway(readySession, {
91
+ signal: opts?.signal,
92
+ port: plan.spec.network?.gatewayPort ?? GATEWAY_PORT,
93
+ onProgress: (line) => reportProgress(opts, line)
94
+ });
95
+ } finally {
96
+ readySession.close();
97
+ }
89
98
  const hasOverlay = plan.spec.openclaw.config !== void 0 || plan.spec.openclaw.channels !== void 0;
90
99
  if (hasOverlay) {
91
100
  await applyConfigOverlay(plan, outputs, ctx, opts?.signal);
@@ -96,17 +105,24 @@ The diff you reviewed may no longer reflect what will be applied.
96
105
  durationMs: Date.now() - start
97
106
  };
98
107
  }
99
- async function applyConfigOverlay(plan, outputs, ctx, signal) {
100
- const { connect } = await import("./ssh-B3NZAU4I.js");
101
- const connInfo = ctx.adapter.getConnectionInfo(outputs);
102
- const session = await connect({
103
- host: connInfo.host,
104
- port: connInfo.port,
105
- user: connInfo.user,
106
- privateKeyPath: connInfo.privateKeyPath,
107
- knownHostsPath: connInfo.knownHostsPath,
108
- signal
108
+ function reportProgress(opts, line) {
109
+ if (opts?.onProgress) opts.onProgress(line);
110
+ else opts?.onOutput?.(line);
111
+ }
112
+ async function connectionInfoFor(ctx, outputs) {
113
+ const { extractBaseOutputs } = await import("./outputs-DJHBY7EE.js");
114
+ return ctx.adapter.getConnectionInfo({
115
+ ...extractBaseOutputs(outputs),
116
+ privateKeyPath: expandHome(ctx.config.ssh.keyPath),
117
+ knownHostsPath: expandHome(ctx.config.ssh.knownHostsPath)
109
118
  });
119
+ }
120
+ function expandHome(p) {
121
+ return p.replace(/^~/, process.env["HOME"] ?? "~");
122
+ }
123
+ async function applyConfigOverlay(plan, outputs, ctx, signal) {
124
+ const { connect } = await import("./ssh-VAI5DU5M.js");
125
+ const session = await connect({ ...await connectionInfoFor(ctx, outputs), signal });
110
126
  try {
111
127
  const remote = await readRemoteConfig(session, signal);
112
128
  const configOverlay = plan.spec.openclaw.config ?? {};
@@ -134,7 +150,7 @@ async function applyConfigOverlay(plan, outputs, ctx, signal) {
134
150
  async function installProviderPlugins(session, cfg, openclawVersion, signal) {
135
151
  const [{ requiredPlugins, installCommand }, { STATE_DIR_HOST_LINUX }, yaml, { readFileSync }, { join }, { resolveSpecDir }] = await Promise.all([
136
152
  import("./plugins-DTST3OER.js"),
137
- import("./runtime-LZ7NA53V.js"),
153
+ import("./runtime-X3KW5TCP.js"),
138
154
  import("./js-yaml-PTEEG4FO.js"),
139
155
  import("fs"),
140
156
  import("path"),
@@ -189,7 +205,7 @@ async function loadChannelCatalog() {
189
205
  return yaml.load(readFileSync(join(resolveSpecDir(), "integrations.yaml"), "utf-8"));
190
206
  }
191
207
  async function installChannelPlugins(session, cfg, openclawVersion, signal) {
192
- const [{ requiredChannelPlugins, channelInstallCommand }, { STATE_DIR_HOST_LINUX }] = await Promise.all([import("./channels-KBUR42IU.js"), import("./runtime-LZ7NA53V.js")]);
208
+ const [{ requiredChannelPlugins, channelInstallCommand }, { STATE_DIR_HOST_LINUX }] = await Promise.all([import("./channels-KBUR42IU.js"), import("./runtime-X3KW5TCP.js")]);
193
209
  const needed = requiredChannelPlugins(cfg, await loadChannelCatalog());
194
210
  if (needed.length === 0) return;
195
211
  const { execPrivileged } = await import("./privileged-JFA6LLTV.js");
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ensurePulumiCli,
4
+ pulumiCliRoot,
5
+ pulumiCliStatus
6
+ } from "./chunk-PSOSBJVO.js";
7
+ export {
8
+ ensurePulumiCli,
9
+ pulumiCliRoot,
10
+ pulumiCliStatus
11
+ };
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ accountFromProfile,
4
+ azureCliAccount,
5
+ azureConfigDir,
6
+ resolveSubscriptionId
7
+ } from "./chunk-RHOWYIWT.js";
8
+ export {
9
+ accountFromProfile,
10
+ azureCliAccount,
11
+ azureConfigDir,
12
+ resolveSubscriptionId
13
+ };