@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.
- package/README.md +99 -12
- package/dist/apply-WOUTUUQH.js +27 -0
- package/dist/automation-UKRM3BD2.js +44 -0
- package/dist/bedrock-XVASJX2K.js +61 -0
- package/dist/{bootstrap-DMRPWJGN.js → bootstrap-HNGKY6WW.js} +11 -8
- package/dist/{chunk-N44K3LHE.js → chunk-2I7KCMXZ.js} +6 -4
- package/dist/{chunk-3WYA2QDM.js → chunk-2Z7J3ERQ.js} +1 -1
- package/dist/chunk-3OLUJPCB.js +36 -0
- package/dist/{chunk-GYV4KNW7.js → chunk-5TXCUOZV.js} +133 -40
- package/dist/chunk-AEEMRFZV.js +24 -0
- package/dist/{chunk-YR3O2I3S.js → chunk-BSLIYB5Q.js} +6 -1
- package/dist/{chunk-AHAAEXWC.js → chunk-E4NJSJ54.js} +16 -93
- package/dist/chunk-FEK7VJAY.js +16 -0
- package/dist/{chunk-6TIYVHPX.js → chunk-GIEVAGEK.js} +7 -33
- package/dist/chunk-HSPHXG6W.js +67 -0
- package/dist/chunk-LEVIW2PV.js +890 -0
- package/dist/chunk-MC5ATCXS.js +108 -0
- package/dist/chunk-N4WZLWJ4.js +16 -0
- package/dist/{chunk-SBLQH2TJ.js → chunk-NUL5F6YV.js} +1 -1
- package/dist/chunk-PSOSBJVO.js +51 -0
- package/dist/{chunk-AX74VXTV.js → chunk-RATEIAFU.js} +58 -49
- package/dist/chunk-RHOWYIWT.js +52 -0
- package/dist/{chunk-WHJMKDV7.js → chunk-SDZKCICH.js} +65 -12
- package/dist/chunk-V25QRZRB.js +45 -0
- package/dist/chunk-VOEJYRIK.js +33 -0
- package/dist/{providers-2OABPW2E.js → chunk-VUFMZEIM.js} +3 -2
- package/dist/chunk-WTZ2CT35.js +69 -0
- package/dist/{chunk-UFRO4H5W.js → chunk-ZMMRIWFS.js} +56 -40
- package/dist/cli-NH7VUNOU.js +11 -0
- package/dist/cli-auth-GD5SK7JU.js +13 -0
- package/dist/cli.js +518 -206
- package/dist/context-M4JBBIAV.js +20 -0
- package/dist/docker-3PDO4TS7.js +12 -0
- package/dist/{firewall-T3NTPZJD.js → firewall-5VKZ4WBH.js} +22 -1
- package/dist/generate-J6MIJGII.js +29 -0
- package/dist/{harden-PCDK3UQ5.js → harden-72JMRT4E.js} +8 -5
- package/dist/index.d.ts +56 -0
- package/dist/known-hosts-file-I3Q3NBYQ.js +22 -0
- package/dist/{logs-P7YCKVF4.js → logs-5A7YYA53.js} +1 -1
- package/dist/{mcp-wire-BFEY2Y6H.js → mcp-wire-NTGL5ITF.js} +25 -15
- package/dist/models-AGTQWYDL.js +32 -0
- package/dist/network-args-PYJRJBYO.js +64 -0
- package/dist/{package-3HUW57XH.js → package-3A6BOALU.js} +11 -3
- package/dist/passphrase-MJBE45N7.js +15 -0
- package/dist/{pool-EX4ZTA5P.js → pool-PIIKJ4L2.js} +3 -2
- package/dist/preflight-EF52S3WW.js +162 -0
- package/dist/preflight-MWWM5JT3.js +181 -0
- package/dist/preflight-TFD4N5ZU.js +141 -0
- package/dist/providers-FW6H6OPF.js +11 -0
- package/dist/ready-KDNRBNSU.js +95 -0
- package/dist/{remote-config-Z6IIZR3D.js → remote-config-3HZLUWEA.js} +3 -2
- package/dist/{runtime-LZ7NA53V.js → runtime-X3KW5TCP.js} +4 -2
- package/dist/server-RWM2JI3D.js +46 -0
- package/dist/ssh-VAI5DU5M.js +11 -0
- package/dist/ssh-key-DUO6OKOI.js +7 -0
- package/dist/stack-config-R4SPSUQZ.js +12 -0
- package/dist/{validate-BOQRWX4F.js → validate-YVI3BJ55.js} +1 -1
- package/dist/wait-WO72TRRQ.js +79 -0
- package/package.json +11 -3
- package/spec/mcp-tools.yaml +21 -2
- package/spec/models.yaml +14 -3
- package/spec/providers.schema.json +163 -28
- package/dist/apply-AM5HERE7.js +0 -19
- package/dist/automation-RULUSJBW.js +0 -30
- package/dist/aws-AMON7DA7.js +0 -265
- package/dist/azure-T4G6OBJQ.js +0 -273
- package/dist/chunk-CKSPROD5.js +0 -129
- package/dist/chunk-LU2V3LXA.js +0 -114
- package/dist/context-KHKWJJMC.js +0 -10
- package/dist/gcp-2JBTD7ZM.js +0 -204
- package/dist/generate-2XV2GSP2.js +0 -15
- package/dist/local-DXBEVZ5C.js +0 -47
- package/dist/server-A5AB67GQ.js +0 -36
- package/dist/ssh-B3NZAU4I.js +0 -8
- package/dist/{version-guard-GPSTCPT7.js → version-guard-XVYW5WFJ.js} +1 -1
|
@@ -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-
|
|
13
|
+
} from "./chunk-2I7KCMXZ.js";
|
|
8
14
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
15
|
+
writeStackConfig
|
|
16
|
+
} from "./chunk-HSPHXG6W.js";
|
|
11
17
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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-
|
|
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-
|
|
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");
|