@xfxstudio/claworld 0.2.15 → 0.2.16
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/bin/claworld.mjs +9 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +5 -1
- package/skills/claworld-help/SKILL.md +113 -103
- package/skills/claworld-join-and-chat/SKILL.md +205 -104
- package/skills/claworld-manage-worlds/SKILL.md +149 -109
- package/skills/claworld-manage-worlds/references/world-context-templates.md +145 -0
- package/src/lib/relay/kickoff-text.js +49 -21
- package/src/openclaw/installer/cli.js +406 -0
- package/src/openclaw/installer/constants.js +14 -0
- package/src/openclaw/installer/core.js +2115 -0
- package/src/openclaw/installer/doctor.js +876 -0
- package/src/openclaw/installer/workspace-contract.js +427 -0
- package/src/openclaw/plugin/claworld-channel-plugin.js +149 -157
- package/src/openclaw/plugin/register-tooling.js +556 -0
- package/src/openclaw/plugin/register.js +137 -569
- package/src/openclaw/plugin/relay-client-shared.js +146 -0
- package/src/openclaw/plugin/relay-client.js +26 -150
- package/src/openclaw/runtime/product-shell-helper.js +14 -142
- package/src/openclaw/runtime/tool-contracts.js +18 -16
- package/src/product-shell/contracts/chat-request-approval-policy.js +2 -7
- package/src/product-shell/contracts/world-orchestration.js +17 -71
|
@@ -0,0 +1,406 @@
|
|
|
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_account'}`);
|
|
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_account'}`);
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const installerPackageJson = require('../../../package.json');
|
|
5
|
+
|
|
6
|
+
export const CLAWORLD_INSTALLER_BIN_NAME = 'claworld';
|
|
7
|
+
export const CLAWORLD_INSTALLER_PACKAGE_NAME = '@xfxstudio/claworld';
|
|
8
|
+
export const CLAWORLD_INSTALLER_PACKAGE_VERSION = installerPackageJson.version;
|
|
9
|
+
export const CLAWORLD_INSTALLER_DEFAULT_PLUGIN_SOURCE = `${CLAWORLD_INSTALLER_PACKAGE_NAME}@${CLAWORLD_INSTALLER_PACKAGE_VERSION}`;
|
|
10
|
+
export const CLAWORLD_INSTALLER_COMMAND = 'npx -y @xfxstudio/claworld install';
|
|
11
|
+
export const CLAWORLD_DOCTOR_COMMAND = 'npx -y @xfxstudio/claworld doctor';
|
|
12
|
+
export const CLAWORLD_UPDATE_COMMAND = 'npx -y @xfxstudio/claworld update';
|
|
13
|
+
export const CLAWORLD_UNINSTALL_COMMAND = 'npx -y @xfxstudio/claworld uninstall';
|
|
14
|
+
export const CLAWORLD_OPENCLAW_MIN_HOST_VERSION = '>=2026.3.22';
|