@xfxstudio/claworld 0.2.12 → 0.2.13
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 +45 -19
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -5
- package/skills/claworld-help/SKILL.md +84 -83
- package/skills/claworld-join-and-chat/SKILL.md +1 -1
- package/src/openclaw/plugin/onboarding.js +128 -103
- package/src/product-shell/agent-cards/spec-builder.js +2 -2
- package/src/product-shell/onboarding/onboarding-service.js +27 -25
- package/bin/claworld.mjs +0 -9
- package/src/openclaw/installer/cli.js +0 -406
- package/src/openclaw/installer/core.js +0 -2122
- package/src/openclaw/installer/doctor.js +0 -876
- package/src/openclaw/installer/workspace-contract.js +0 -427
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CLAWORLD_DOCTOR_COMMAND,
|
|
3
|
-
CLAWORLD_INSTALLER_COMMAND,
|
|
4
2
|
CLAWORLD_INSTALLER_PACKAGE_NAME,
|
|
5
3
|
CLAWORLD_OPENCLAW_MIN_HOST_VERSION,
|
|
6
|
-
CLAWORLD_UNINSTALL_COMMAND,
|
|
7
|
-
CLAWORLD_UPDATE_COMMAND,
|
|
8
4
|
} from '../../openclaw/installer/constants.js';
|
|
9
5
|
|
|
10
6
|
const DEFAULT_INSTALL_CHANNEL_ID = 'claworld';
|
|
11
7
|
const DEFAULT_INSTALL_ACCOUNT_ID = 'claworld';
|
|
12
8
|
const DEFAULT_INSTALL_LOCAL_AGENT_ID = 'main';
|
|
13
9
|
const DEFAULT_ACTIVATION_DISPLAY_NAME = 'Claworld Agent';
|
|
10
|
+
const CLAWORLD_HOST_NATIVE_INSTALL_COMMAND = `openclaw plugins install ${CLAWORLD_INSTALLER_PACKAGE_NAME}`;
|
|
11
|
+
const CLAWORLD_HOST_NATIVE_SETUP_COMMAND = 'openclaw channels add --channel claworld';
|
|
12
|
+
const CLAWORLD_HOST_NATIVE_ONBOARD_COMMAND = 'openclaw onboard';
|
|
13
|
+
const CLAWORLD_HOST_NATIVE_INSPECT_COMMAND = 'openclaw plugins info claworld';
|
|
14
14
|
|
|
15
15
|
function normalizeText(value, fallback = null) {
|
|
16
16
|
if (value == null) return fallback;
|
|
@@ -107,15 +107,15 @@ export function createOnboardingService({ worldService, store = null } = {}) {
|
|
|
107
107
|
product: 'claworld',
|
|
108
108
|
mode: 'agent_install',
|
|
109
109
|
installer: {
|
|
110
|
-
command:
|
|
110
|
+
command: CLAWORLD_HOST_NATIVE_INSTALL_COMMAND,
|
|
111
111
|
packageName: CLAWORLD_INSTALLER_PACKAGE_NAME,
|
|
112
112
|
minHostVersion: CLAWORLD_OPENCLAW_MIN_HOST_VERSION,
|
|
113
|
-
canonicalFlow: '
|
|
113
|
+
canonicalFlow: 'host_native_setup',
|
|
114
114
|
lifecycle: {
|
|
115
|
-
install:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
install: CLAWORLD_HOST_NATIVE_INSTALL_COMMAND,
|
|
116
|
+
configure: CLAWORLD_HOST_NATIVE_SETUP_COMMAND,
|
|
117
|
+
onboard: CLAWORLD_HOST_NATIVE_ONBOARD_COMMAND,
|
|
118
|
+
inspect: CLAWORLD_HOST_NATIVE_INSPECT_COMMAND,
|
|
119
119
|
},
|
|
120
120
|
},
|
|
121
121
|
plugin: {
|
|
@@ -139,10 +139,11 @@ export function createOnboardingService({ worldService, store = null } = {}) {
|
|
|
139
139
|
},
|
|
140
140
|
compatibility: {
|
|
141
141
|
nativeOpenclaw: {
|
|
142
|
-
status: '
|
|
142
|
+
status: 'preferred',
|
|
143
143
|
commands: [
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
CLAWORLD_HOST_NATIVE_INSTALL_COMMAND,
|
|
145
|
+
CLAWORLD_HOST_NATIVE_SETUP_COMMAND,
|
|
146
|
+
CLAWORLD_HOST_NATIVE_ONBOARD_COMMAND,
|
|
146
147
|
],
|
|
147
148
|
},
|
|
148
149
|
},
|
|
@@ -160,14 +161,14 @@ export function createOnboardingService({ worldService, store = null } = {}) {
|
|
|
160
161
|
expectedBinding: 'runtime_bound_by_app_token',
|
|
161
162
|
},
|
|
162
163
|
steps: [
|
|
163
|
-
`run ${
|
|
164
|
-
|
|
165
|
-
'
|
|
166
|
-
|
|
167
|
-
'
|
|
168
|
-
'
|
|
169
|
-
'
|
|
170
|
-
|
|
164
|
+
`run ${CLAWORLD_HOST_NATIVE_INSTALL_COMMAND}`,
|
|
165
|
+
`configure one account with ${CLAWORLD_HOST_NATIVE_SETUP_COMMAND} or ${CLAWORLD_HOST_NATIVE_ONBOARD_COMMAND}`,
|
|
166
|
+
'host-native setup writes or refreshes the claworld channel config and binding without requiring backend activation',
|
|
167
|
+
`inspect plugin install state with ${CLAWORLD_HOST_NATIVE_INSPECT_COMMAND} when setup needs verification`,
|
|
168
|
+
'ask once for the desired public display name after setup completes',
|
|
169
|
+
'claworld_profile(action=update_identity) performs activation when needed, persists the returned appToken, and completes the public displayName#code identity',
|
|
170
|
+
'use claworld_pair_agent when runtime readiness still looks unhealthy after setup or initialization',
|
|
171
|
+
'ongoing package updates and removal stay on the OpenClaw host plugin lifecycle instead of a plugin-owned installer CLI',
|
|
171
172
|
],
|
|
172
173
|
recommendedWorlds,
|
|
173
174
|
status: 'ready',
|
|
@@ -181,10 +182,11 @@ export function createOnboardingService({ worldService, store = null } = {}) {
|
|
|
181
182
|
return {
|
|
182
183
|
selectedWorld: selectedWorld ? { worldId: selectedWorld.worldId, displayName: selectedWorld.displayName } : null,
|
|
183
184
|
actions: [
|
|
184
|
-
'install the claworld plugin
|
|
185
|
-
'
|
|
186
|
-
'
|
|
187
|
-
'claworld_profile
|
|
185
|
+
'install the claworld plugin through the OpenClaw host',
|
|
186
|
+
'configure the claworld channel account and local binding through host-native setup',
|
|
187
|
+
'ask once for the desired public display name',
|
|
188
|
+
'call claworld_profile with action=update_identity to finish activation and public naming',
|
|
189
|
+
'use claworld_pair_agent only when the runtime still needs diagnosis after setup or initialization',
|
|
188
190
|
'collect required world profile fields',
|
|
189
191
|
'validate world membership eligibility',
|
|
190
192
|
'start the first A2A loop or deliver world content',
|
package/bin/claworld.mjs
DELETED
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
import os from 'os';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import {
|
|
4
|
-
expandUserPath,
|
|
5
|
-
} from '../plugin/managed-config.js';
|
|
6
|
-
import {
|
|
7
|
-
CLAWORLD_DOCTOR_COMMAND,
|
|
8
|
-
CLAWORLD_INSTALLER_BIN_NAME,
|
|
9
|
-
CLAWORLD_INSTALLER_COMMAND,
|
|
10
|
-
CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE,
|
|
11
|
-
CLAWORLD_UNINSTALL_COMMAND,
|
|
12
|
-
CLAWORLD_UPDATE_COMMAND,
|
|
13
|
-
} from './constants.js';
|
|
14
|
-
import { formatClaworldDoctorReport, runClaworldDoctor } from './doctor.js';
|
|
15
|
-
import {
|
|
16
|
-
DEFAULT_OPENCLAW_BIN,
|
|
17
|
-
DEFAULT_OPENCLAW_CONFIG_PATH,
|
|
18
|
-
runClaworldInstallerInstall,
|
|
19
|
-
runClaworldInstallerUninstall,
|
|
20
|
-
runClaworldInstallerUpdate,
|
|
21
|
-
} from './core.js';
|
|
22
|
-
|
|
23
|
-
function resolveCliHomeDir(env = process.env) {
|
|
24
|
-
const envHomeDir = String(
|
|
25
|
-
env.HOME
|
|
26
|
-
|| env.USERPROFILE
|
|
27
|
-
|| (
|
|
28
|
-
env.HOMEDRIVE && env.HOMEPATH
|
|
29
|
-
? path.join(env.HOMEDRIVE, env.HOMEPATH)
|
|
30
|
-
: ''
|
|
31
|
-
),
|
|
32
|
-
).trim();
|
|
33
|
-
return envHomeDir || os.homedir();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function printHelp() {
|
|
37
|
-
console.log(`Usage: ${CLAWORLD_INSTALLER_BIN_NAME} <command> [options]
|
|
38
|
-
|
|
39
|
-
Commands:
|
|
40
|
-
install Run the installer-first Claworld setup flow
|
|
41
|
-
doctor Validate the managed Claworld install health
|
|
42
|
-
update Update the tracked Claworld plugin, refresh managed state, and run doctor
|
|
43
|
-
uninstall Safely remove the managed Claworld runtime and uninstall the plugin
|
|
44
|
-
upgrade Alias for update
|
|
45
|
-
help Show this help
|
|
46
|
-
|
|
47
|
-
Install options:
|
|
48
|
-
--config <path> OpenClaw config path (default: ${DEFAULT_OPENCLAW_CONFIG_PATH})
|
|
49
|
-
--state-dir <path> Optional OPENCLAW_STATE_DIR for OpenClaw commands
|
|
50
|
-
--openclaw-bin <path> OpenClaw CLI binary (default: ${DEFAULT_OPENCLAW_BIN})
|
|
51
|
-
--server-url <url> Override the Claworld backend URL
|
|
52
|
-
--api-key <value> Override the Claworld backend API key
|
|
53
|
-
--account-id <id> Managed Claworld account id (default: claworld)
|
|
54
|
-
--agent-id <id> Local OpenClaw agent id to bind claworld onto (default: main)
|
|
55
|
-
--workspace <path> Optional dedicated workspace path for claworld-specific bootstrap files
|
|
56
|
-
--display-name <name> Managed display name override
|
|
57
|
-
--tool-profile <profile> minimal | default | full | world
|
|
58
|
-
--repo-root <path> Local repo root when using --plugin-install-mode link|copy
|
|
59
|
-
--plugin-install-mode <m> npm | link | copy | skip (default: npm)
|
|
60
|
-
--plugin-source <value> npm package or local path (default: ${CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE})
|
|
61
|
-
Update options:
|
|
62
|
-
--config <path> OpenClaw config path (default: ${DEFAULT_OPENCLAW_CONFIG_PATH})
|
|
63
|
-
--state-dir <path> Optional OPENCLAW_STATE_DIR for OpenClaw commands
|
|
64
|
-
--openclaw-bin <path> OpenClaw CLI binary (default: ${DEFAULT_OPENCLAW_BIN})
|
|
65
|
-
--server-url <url> Override the Claworld backend URL
|
|
66
|
-
--api-key <value> Override the Claworld backend API key
|
|
67
|
-
--account-id <id> Managed Claworld account id (default: claworld)
|
|
68
|
-
--agent-id <id> Local OpenClaw agent id bound to claworld (default: main)
|
|
69
|
-
--workspace <path> Optional dedicated workspace path for claworld-specific bootstrap files
|
|
70
|
-
--display-name <name> Managed display name override
|
|
71
|
-
--tool-profile <profile> minimal | default | full | world
|
|
72
|
-
Doctor options:
|
|
73
|
-
--config <path> OpenClaw config path (default: ${DEFAULT_OPENCLAW_CONFIG_PATH})
|
|
74
|
-
--state-dir <path> Optional OPENCLAW_STATE_DIR for OpenClaw commands
|
|
75
|
-
--openclaw-bin <path> OpenClaw CLI binary (default: ${DEFAULT_OPENCLAW_BIN})
|
|
76
|
-
--server-url <url> Override the Claworld backend URL
|
|
77
|
-
--account-id <id> Managed Claworld account id (default: claworld)
|
|
78
|
-
--agent-id <id> Local OpenClaw agent id bound to claworld (default: main)
|
|
79
|
-
--workspace <path> Optional dedicated workspace path override
|
|
80
|
-
Uninstall options:
|
|
81
|
-
--config <path> OpenClaw config path (default: ${DEFAULT_OPENCLAW_CONFIG_PATH})
|
|
82
|
-
--state-dir <path> Optional OPENCLAW_STATE_DIR for OpenClaw commands
|
|
83
|
-
--openclaw-bin <path> OpenClaw CLI binary (default: ${DEFAULT_OPENCLAW_BIN})
|
|
84
|
-
--account-id <id> Managed Claworld account id (default: claworld)
|
|
85
|
-
--agent-id <id> Local OpenClaw agent id bound to claworld (default: main)
|
|
86
|
-
--json Print machine-readable result
|
|
87
|
-
--help, -h Show this help
|
|
88
|
-
|
|
89
|
-
Canonical commands:
|
|
90
|
-
${CLAWORLD_INSTALLER_COMMAND}
|
|
91
|
-
${CLAWORLD_DOCTOR_COMMAND}
|
|
92
|
-
${CLAWORLD_UPDATE_COMMAND}
|
|
93
|
-
${CLAWORLD_UNINSTALL_COMMAND}
|
|
94
|
-
`);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function nextValue(argv, index) {
|
|
98
|
-
if (index + 1 >= argv.length) {
|
|
99
|
-
throw new Error(`Missing value for ${argv[index]}`);
|
|
100
|
-
}
|
|
101
|
-
return argv[index + 1];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function parseInstallerCliArgs(argv = process.argv.slice(2), env = process.env) {
|
|
105
|
-
const homeDir = resolveCliHomeDir(env);
|
|
106
|
-
const options = {
|
|
107
|
-
command: null,
|
|
108
|
-
json: false,
|
|
109
|
-
install: {
|
|
110
|
-
openclawBin: env.OPENCLAW_BIN || DEFAULT_OPENCLAW_BIN,
|
|
111
|
-
configPath: expandUserPath(env.OPENCLAW_CONFIG_PATH || DEFAULT_OPENCLAW_CONFIG_PATH, homeDir),
|
|
112
|
-
stateDir: env.OPENCLAW_STATE_DIR ? expandUserPath(env.OPENCLAW_STATE_DIR, homeDir) : null,
|
|
113
|
-
serverUrl: null,
|
|
114
|
-
apiKey: null,
|
|
115
|
-
accountId: 'claworld',
|
|
116
|
-
agentId: 'main',
|
|
117
|
-
workspace: null,
|
|
118
|
-
displayName: null,
|
|
119
|
-
repoRoot: null,
|
|
120
|
-
pluginInstallMode: 'npm',
|
|
121
|
-
pluginInstallSource: CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE,
|
|
122
|
-
toolProfile: null,
|
|
123
|
-
},
|
|
124
|
-
update: {
|
|
125
|
-
openclawBin: env.OPENCLAW_BIN || DEFAULT_OPENCLAW_BIN,
|
|
126
|
-
configPath: expandUserPath(env.OPENCLAW_CONFIG_PATH || DEFAULT_OPENCLAW_CONFIG_PATH, homeDir),
|
|
127
|
-
stateDir: env.OPENCLAW_STATE_DIR ? expandUserPath(env.OPENCLAW_STATE_DIR, homeDir) : null,
|
|
128
|
-
serverUrl: null,
|
|
129
|
-
apiKey: null,
|
|
130
|
-
accountId: 'claworld',
|
|
131
|
-
agentId: 'main',
|
|
132
|
-
workspace: null,
|
|
133
|
-
displayName: null,
|
|
134
|
-
pluginInstallSource: CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE,
|
|
135
|
-
toolProfile: null,
|
|
136
|
-
},
|
|
137
|
-
doctor: {
|
|
138
|
-
openclawBin: env.OPENCLAW_BIN || DEFAULT_OPENCLAW_BIN,
|
|
139
|
-
configPath: expandUserPath(env.OPENCLAW_CONFIG_PATH || DEFAULT_OPENCLAW_CONFIG_PATH, homeDir),
|
|
140
|
-
stateDir: env.OPENCLAW_STATE_DIR ? expandUserPath(env.OPENCLAW_STATE_DIR, homeDir) : null,
|
|
141
|
-
serverUrl: null,
|
|
142
|
-
accountId: 'claworld',
|
|
143
|
-
agentId: 'main',
|
|
144
|
-
workspace: null,
|
|
145
|
-
},
|
|
146
|
-
uninstall: {
|
|
147
|
-
openclawBin: env.OPENCLAW_BIN || DEFAULT_OPENCLAW_BIN,
|
|
148
|
-
configPath: expandUserPath(env.OPENCLAW_CONFIG_PATH || DEFAULT_OPENCLAW_CONFIG_PATH, homeDir),
|
|
149
|
-
stateDir: env.OPENCLAW_STATE_DIR ? expandUserPath(env.OPENCLAW_STATE_DIR, homeDir) : null,
|
|
150
|
-
accountId: 'claworld',
|
|
151
|
-
agentId: 'main',
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
if (argv.length === 0) {
|
|
156
|
-
printHelp();
|
|
157
|
-
return { ...options, command: 'help' };
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
options.command = argv[0] === 'upgrade' ? 'update' : argv[0];
|
|
161
|
-
const remaining = argv.slice(1);
|
|
162
|
-
|
|
163
|
-
for (let index = 0; index < remaining.length; index += 1) {
|
|
164
|
-
const arg = remaining[index];
|
|
165
|
-
switch (arg) {
|
|
166
|
-
case '--config':
|
|
167
|
-
options.install.configPath = expandUserPath(nextValue(remaining, index), homeDir);
|
|
168
|
-
options.update.configPath = options.install.configPath;
|
|
169
|
-
options.doctor.configPath = options.install.configPath;
|
|
170
|
-
options.uninstall.configPath = options.install.configPath;
|
|
171
|
-
index += 1;
|
|
172
|
-
break;
|
|
173
|
-
case '--state-dir':
|
|
174
|
-
options.install.stateDir = expandUserPath(nextValue(remaining, index), homeDir);
|
|
175
|
-
options.update.stateDir = options.install.stateDir;
|
|
176
|
-
options.doctor.stateDir = options.install.stateDir;
|
|
177
|
-
options.uninstall.stateDir = options.install.stateDir;
|
|
178
|
-
index += 1;
|
|
179
|
-
break;
|
|
180
|
-
case '--openclaw-bin':
|
|
181
|
-
options.install.openclawBin = nextValue(remaining, index);
|
|
182
|
-
options.update.openclawBin = options.install.openclawBin;
|
|
183
|
-
options.doctor.openclawBin = options.install.openclawBin;
|
|
184
|
-
options.uninstall.openclawBin = options.install.openclawBin;
|
|
185
|
-
index += 1;
|
|
186
|
-
break;
|
|
187
|
-
case '--server-url':
|
|
188
|
-
options.install.serverUrl = nextValue(remaining, index);
|
|
189
|
-
options.update.serverUrl = options.install.serverUrl;
|
|
190
|
-
options.doctor.serverUrl = options.install.serverUrl;
|
|
191
|
-
index += 1;
|
|
192
|
-
break;
|
|
193
|
-
case '--api-key':
|
|
194
|
-
options.install.apiKey = nextValue(remaining, index);
|
|
195
|
-
options.update.apiKey = options.install.apiKey;
|
|
196
|
-
index += 1;
|
|
197
|
-
break;
|
|
198
|
-
case '--account-id':
|
|
199
|
-
options.install.accountId = nextValue(remaining, index);
|
|
200
|
-
options.update.accountId = options.install.accountId;
|
|
201
|
-
options.doctor.accountId = options.install.accountId;
|
|
202
|
-
options.uninstall.accountId = options.install.accountId;
|
|
203
|
-
index += 1;
|
|
204
|
-
break;
|
|
205
|
-
case '--agent-id':
|
|
206
|
-
options.install.agentId = nextValue(remaining, index);
|
|
207
|
-
options.update.agentId = options.install.agentId;
|
|
208
|
-
options.doctor.agentId = options.install.agentId;
|
|
209
|
-
options.uninstall.agentId = options.install.agentId;
|
|
210
|
-
index += 1;
|
|
211
|
-
break;
|
|
212
|
-
case '--workspace':
|
|
213
|
-
options.install.workspace = expandUserPath(nextValue(remaining, index), homeDir);
|
|
214
|
-
options.update.workspace = options.install.workspace;
|
|
215
|
-
options.doctor.workspace = options.install.workspace;
|
|
216
|
-
index += 1;
|
|
217
|
-
break;
|
|
218
|
-
case '--display-name':
|
|
219
|
-
options.install.displayName = nextValue(remaining, index);
|
|
220
|
-
options.update.displayName = options.install.displayName;
|
|
221
|
-
index += 1;
|
|
222
|
-
break;
|
|
223
|
-
case '--tool-profile':
|
|
224
|
-
options.install.toolProfile = nextValue(remaining, index);
|
|
225
|
-
options.update.toolProfile = options.install.toolProfile;
|
|
226
|
-
index += 1;
|
|
227
|
-
break;
|
|
228
|
-
case '--repo-root':
|
|
229
|
-
options.install.repoRoot = path.resolve(expandUserPath(nextValue(remaining, index), homeDir));
|
|
230
|
-
index += 1;
|
|
231
|
-
break;
|
|
232
|
-
case '--plugin-install-mode':
|
|
233
|
-
options.install.pluginInstallMode = nextValue(remaining, index);
|
|
234
|
-
index += 1;
|
|
235
|
-
break;
|
|
236
|
-
case '--plugin-source':
|
|
237
|
-
options.install.pluginInstallSource = nextValue(remaining, index);
|
|
238
|
-
options.update.pluginInstallSource = options.install.pluginInstallSource;
|
|
239
|
-
index += 1;
|
|
240
|
-
break;
|
|
241
|
-
case '--json':
|
|
242
|
-
options.json = true;
|
|
243
|
-
break;
|
|
244
|
-
case '--help':
|
|
245
|
-
case '-h':
|
|
246
|
-
printHelp();
|
|
247
|
-
return { ...options, command: 'help' };
|
|
248
|
-
default:
|
|
249
|
-
throw new Error(`Unknown argument: ${arg}`);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (!['install', 'update', 'uninstall', 'doctor', 'help'].includes(options.command)) {
|
|
254
|
-
throw new Error(`Unknown command: ${options.command}`);
|
|
255
|
-
}
|
|
256
|
-
if (options.command === 'install' && !['npm', 'link', 'copy', 'skip'].includes(options.install.pluginInstallMode)) {
|
|
257
|
-
throw new Error(`Unsupported plugin install mode: ${options.install.pluginInstallMode}`);
|
|
258
|
-
}
|
|
259
|
-
if (
|
|
260
|
-
options.command === 'install'
|
|
261
|
-
&& options.install.pluginInstallMode !== 'npm'
|
|
262
|
-
&& !options.install.repoRoot
|
|
263
|
-
&& !options.install.pluginInstallSource
|
|
264
|
-
) {
|
|
265
|
-
throw new Error('Local plugin install mode requires --repo-root or --plugin-source.');
|
|
266
|
-
}
|
|
267
|
-
if (
|
|
268
|
-
options.command === 'install'
|
|
269
|
-
&& options.install.pluginInstallMode === 'link'
|
|
270
|
-
&& !options.install.repoRoot
|
|
271
|
-
&& options.install.pluginInstallSource === CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE
|
|
272
|
-
) {
|
|
273
|
-
throw new Error('Link install mode requires --repo-root or --plugin-source <local-path>.');
|
|
274
|
-
}
|
|
275
|
-
if (
|
|
276
|
-
options.command === 'install'
|
|
277
|
-
&& options.install.pluginInstallMode === 'copy'
|
|
278
|
-
&& !options.install.repoRoot
|
|
279
|
-
&& options.install.pluginInstallSource === CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE
|
|
280
|
-
) {
|
|
281
|
-
throw new Error('Copy install mode requires --repo-root or --plugin-source <local-path>.');
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (
|
|
285
|
-
options.command === 'install'
|
|
286
|
-
&& options.install.pluginInstallMode !== 'npm'
|
|
287
|
-
&& options.install.repoRoot
|
|
288
|
-
&& options.install.pluginInstallSource === CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE
|
|
289
|
-
) {
|
|
290
|
-
options.install.pluginInstallSource = options.install.repoRoot;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return options;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function printInstallSummary(result) {
|
|
297
|
-
console.log('');
|
|
298
|
-
console.log('Claworld installer complete');
|
|
299
|
-
console.log('===========================');
|
|
300
|
-
console.log(`Managed account: ${result.transformed?.config?.channels?.claworld?.defaultAccount || 'claworld'}`);
|
|
301
|
-
console.log(`OpenClaw version: ${result.host?.version || '(unknown)'}`);
|
|
302
|
-
console.log(`Plugin action: ${result.plugin?.action || 'unknown'}`);
|
|
303
|
-
console.log(`Activation: ${result.activationStatus === 'ready' ? 'ready' : 'pending via claworld_profile'}`);
|
|
304
|
-
console.log(`Runtime refresh: ${result.runtimeRefresh?.action || 'unknown'}`);
|
|
305
|
-
console.log(`Config path: ${result.configPath}`);
|
|
306
|
-
console.log(`Backup path: ${result.backupPath || '(unchanged or new file)'}`);
|
|
307
|
-
console.log('');
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function printUpdateSummary(result, doctorResult) {
|
|
311
|
-
const trackedInstall = result.plugin?.trackedInstall || null;
|
|
312
|
-
const trackedSummary = trackedInstall?.tracked
|
|
313
|
-
? `${trackedInstall.source || 'tracked'}${trackedInstall.spec ? ` (${trackedInstall.spec})` : ''}`
|
|
314
|
-
: 'not recorded';
|
|
315
|
-
console.log('');
|
|
316
|
-
console.log('Claworld update complete');
|
|
317
|
-
console.log('========================');
|
|
318
|
-
console.log(`Managed account: ${result.managedOptions?.accountId || 'claworld'}`);
|
|
319
|
-
console.log(`OpenClaw version: ${result.host?.version || '(unknown)'}`);
|
|
320
|
-
console.log(`Plugin action: ${result.plugin?.action || 'unknown'}`);
|
|
321
|
-
console.log(`Tracked install: ${trackedSummary}`);
|
|
322
|
-
console.log(`Activation: ${result.activationStatus === 'ready' ? 'ready' : 'pending via claworld_profile'}`);
|
|
323
|
-
console.log(`Runtime refresh: ${result.runtimeRefresh?.action || 'unknown'}`);
|
|
324
|
-
console.log(`Doctor status: ${doctorResult?.status || 'unknown'}`);
|
|
325
|
-
console.log(`Config path: ${result.configPath}`);
|
|
326
|
-
console.log(`Backup path: ${result.backupPath || '(unchanged or new file)'}`);
|
|
327
|
-
console.log('');
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function printUninstallSummary(result) {
|
|
331
|
-
console.log('');
|
|
332
|
-
console.log('Claworld uninstall complete');
|
|
333
|
-
console.log('===========================');
|
|
334
|
-
console.log(`Managed account: ${result.transformed?.backup?.accountId || 'claworld'}`);
|
|
335
|
-
console.log(`OpenClaw version: ${result.host?.version || '(unknown)'}`);
|
|
336
|
-
console.log(`Plugin action: ${result.plugin?.action || 'unknown'}`);
|
|
337
|
-
console.log(`Runtime refresh: ${result.runtimeRefresh?.action || 'unknown'}`);
|
|
338
|
-
console.log(`Config path: ${result.configPath}`);
|
|
339
|
-
console.log(`Backup path: ${result.backupPath || '(unchanged or new file)'}`);
|
|
340
|
-
console.log('');
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
export async function runInstallerCli(argv = process.argv.slice(2), env = process.env) {
|
|
344
|
-
const parsed = parseInstallerCliArgs(argv, env);
|
|
345
|
-
if (parsed.command === 'help') {
|
|
346
|
-
return { ok: true, command: 'help' };
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (parsed.command === 'install') {
|
|
350
|
-
const result = await runClaworldInstallerInstall(parsed.install);
|
|
351
|
-
if (parsed.json) {
|
|
352
|
-
console.log(JSON.stringify(result, null, 2));
|
|
353
|
-
} else {
|
|
354
|
-
printInstallSummary(result);
|
|
355
|
-
}
|
|
356
|
-
return result;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
if (parsed.command === 'update') {
|
|
360
|
-
const result = await runClaworldInstallerUpdate(parsed.update);
|
|
361
|
-
const doctorResult = await runClaworldDoctor({
|
|
362
|
-
...parsed.doctor,
|
|
363
|
-
configPath: result.configPath,
|
|
364
|
-
stateDir: result.stateDir,
|
|
365
|
-
serverUrl: result.effectiveServerUrl || parsed.doctor.serverUrl,
|
|
366
|
-
accountId: result.managedOptions?.accountId || parsed.doctor.accountId,
|
|
367
|
-
agentId: result.managedOptions?.agentId || parsed.doctor.agentId,
|
|
368
|
-
workspace: result.managedOptions?.workspace || parsed.doctor.workspace,
|
|
369
|
-
});
|
|
370
|
-
if (parsed.json) {
|
|
371
|
-
console.log(JSON.stringify({ ...result, doctor: doctorResult }, null, 2));
|
|
372
|
-
} else {
|
|
373
|
-
printUpdateSummary(result, doctorResult);
|
|
374
|
-
process.stdout.write(formatClaworldDoctorReport(doctorResult));
|
|
375
|
-
}
|
|
376
|
-
if (!doctorResult.ok) {
|
|
377
|
-
process.exitCode = 1;
|
|
378
|
-
}
|
|
379
|
-
return {
|
|
380
|
-
...result,
|
|
381
|
-
doctor: doctorResult,
|
|
382
|
-
ok: doctorResult.ok,
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (parsed.command === 'uninstall') {
|
|
387
|
-
const result = await runClaworldInstallerUninstall(parsed.uninstall);
|
|
388
|
-
if (parsed.json) {
|
|
389
|
-
console.log(JSON.stringify(result, null, 2));
|
|
390
|
-
} else {
|
|
391
|
-
printUninstallSummary(result);
|
|
392
|
-
}
|
|
393
|
-
return result;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
const result = await runClaworldDoctor(parsed.doctor);
|
|
397
|
-
if (parsed.json) {
|
|
398
|
-
console.log(JSON.stringify(result, null, 2));
|
|
399
|
-
} else {
|
|
400
|
-
process.stdout.write(formatClaworldDoctorReport(result));
|
|
401
|
-
}
|
|
402
|
-
if (!result.ok) {
|
|
403
|
-
process.exitCode = 1;
|
|
404
|
-
}
|
|
405
|
-
return result;
|
|
406
|
-
}
|