create-openclaw-bot 5.1.14 → 5.1.15

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.
@@ -97,14 +97,14 @@ checks.push(() => expect(
97
97
  && cli.includes('const safeDbPath = JSON.stringify(dbPath);')
98
98
  && cli.includes("const ROUTER='http://localhost:20128';")
99
99
  && cli.includes("fetch(ROUTER + '/api/providers')")
100
- && cli.includes("build9RouterSmartRouteSyncScript(path.join(getNative9RouterDataDir(), 'db.json'))"),
101
- 'Native 9Router flow must write a smart-route sync script based on the platform-specific 9Router data directory'
100
+ && cli.includes("build9RouterSmartRouteSyncScript(path.join(getProject9RouterDataDir(projectDir), 'db.json'))"),
101
+ 'Native 9Router flow must write a smart-route sync script into the project-controlled 9Router data directory'
102
102
  ));
103
103
 
104
104
  checks.push(() => expectMatch(
105
105
  cli,
106
- /function getNative9RouterDataDir\(\) \{[\s\S]*process\.platform === 'win32'[\s\S]*AppData[\s\S]*Roaming[\s\S]*9router[\s\S]*os\.homedir\(\)[\s\S]*\.9router/s,
107
- 'CLI must resolve the correct native 9Router data directory on both Windows and Unix'
106
+ /function getProjectRuntimeEnv\(projectDir, extraEnv = \{\}\) \{[\s\S]*OPENCLAW_HOME: getProjectOpenClawHome\(projectDir\)[\s\S]*OPENCLAW_STATE_DIR: getProjectOpenClawHome\(projectDir\)[\s\S]*DATA_DIR: getProject9RouterDataDir\(projectDir\)/s,
107
+ 'CLI native runtime must derive OPENCLAW_HOME, OPENCLAW_STATE_DIR, and DATA_DIR from the chosen project directory'
108
108
  ));
109
109
 
110
110
  checks.push(() => expect(
@@ -146,8 +146,8 @@ checks.push(() => expectMatch(
146
146
 
147
147
  checks.push(() => expectMatch(
148
148
  cli,
149
- /execSync\(`pm2 start "openclaw gateway run" --name "\$\{appName\}" --cwd "\$\{projectDir\.replace\(\/\\\\\/g, '\/'\)\}" && pm2 save`/,
150
- 'Native single-bot VPS must start gateway through PM2'
149
+ /execFileSync\('pm2', \[[\s\S]*'openclaw'[\s\S]*'gateway'[\s\S]*'run'[\s\S]*getProjectRuntimeEnv\(projectDir\)/s,
150
+ 'Native single-bot VPS must start gateway through PM2 with the project runtime environment'
151
151
  ));
152
152
 
153
153
  checks.push(() => expectMatch(
@@ -255,13 +255,13 @@ checks.push(() => expectMatch(
255
255
 
256
256
  checks.push(() => expectMatch(
257
257
  cli,
258
- /function resolveNative9RouterDesktopLaunch\(\) \{[\s\S]*command: process\.execPath[\s\S]*getGlobalNpmRoot\(\), '9router', 'app', 'server\.js'[\s\S]*PORT: '20128'[\s\S]*HOSTNAME: '0\.0\.0\.0'/s,
258
+ /function resolveNative9RouterDesktopLaunch\(\) \{[\s\S]*get9RouterServerEntryCandidates\(\)\.find\([\s\S]*command: process\.execPath[\s\S]*args: \[serverEntry\][\s\S]*PORT: '20128'[\s\S]*HOSTNAME: '0\.0\.0\.0'/s,
259
259
  'Native desktop 9Router launch must bypass the interactive CLI menu by running the 9Router server entry directly'
260
260
  ));
261
261
 
262
262
  checks.push(() => expectMatch(
263
263
  cli,
264
- /const native9RouterLaunch = resolveNative9RouterDesktopLaunch\(\);[\s\S]*spawnBackgroundProcess\(native9RouterLaunch\.command, native9RouterLaunch\.args, \{[\s\S]*env: native9RouterLaunch\.env/s,
264
+ /const native9RouterLaunch = resolveNative9RouterDesktopLaunch\(\);[\s\S]*spawnBackgroundProcess\(native9RouterLaunch\.command, native9RouterLaunch\.args, \{[\s\S]*getProjectRuntimeEnv\(projectDir, native9RouterLaunch\.env\)/s,
265
265
  'Native desktop 9Router flow must launch through the background helper with the resolved launch spec'
266
266
  ));
267
267
 
@@ -291,9 +291,16 @@ checks.push(() => expectMatch(
291
291
 
292
292
  checks.push(() => expectOrder(
293
293
  cli,
294
- "await syncLocalConfigToHome(projectDir, isVi);",
294
+ "await ensureProjectRuntimeDirs(projectDir, isVi);",
295
295
  "installRelayPluginForProject(projectDir, isVi);",
296
- 'Relay plugin install must happen after config sync in native flow'
296
+ 'Relay plugin install must happen after preparing the project runtime directories in native flow'
297
+ ));
298
+
299
+ checks.push(() => expect(
300
+ !cli.includes('Config synced to ~/.openclaw/')
301
+ && !cli.includes('Config đã được sync vào ~/.openclaw/')
302
+ && !cli.includes("cp -rn ${localClawDir}/. ${globalClawDir}/"),
303
+ 'CLI native flow must no longer sync project config into the global ~/.openclaw directory'
297
304
  ));
298
305
 
299
306
  checks.push(() => expectMatch(
@@ -347,14 +354,76 @@ checks.push(() => expect(
347
354
 
348
355
  checks.push(() => expectMatch(
349
356
  setup,
350
- /else if \(state\.nativeOs === 'vps'\) \{[\s\S]*scriptName = 'setup-openclaw-vps\.sh';[\s\S]*npm config set prefix "\$HOME\/\.local"[\s\S]*npm install -g openclaw@2026\.4\.5 pm2@latest[\s\S]*pm2 save && pm2 startup/s,
351
- 'VPS native script generation must install openclaw+pm2 and persist PM2 startup'
357
+ /else if \(state\.nativeOs === 'vps'\) \{[\s\S]*scriptName = 'setup-openclaw-vps\.sh';[\s\S]*npm config set prefix "\$HOME\/\.local"[\s\S]*PROJECT_DIR="[\s\S]*export OPENCLAW_HOME="\$PROJECT_DIR\/\.openclaw"[\s\S]*export OPENCLAW_STATE_DIR="\$PROJECT_DIR\/\.openclaw"[\s\S]*export DATA_DIR="\$PROJECT_DIR\/\.9router"[\s\S]*npm install -g openclaw@2026\.4\.5 pm2@latest[\s\S]*pm2 save && pm2 startup/s,
358
+ 'VPS native script generation must keep runtime files project-local, install openclaw+pm2, and persist PM2 startup'
359
+ ));
360
+
361
+ checks.push(() => expect(
362
+ setup.includes('scriptName = isDocker ? \'setup-openclaw-docker-macos.sh\' : \'setup-openclaw-macos.sh\';')
363
+ && setup.includes('scriptName = \'setup-openclaw-linux.sh\';')
364
+ && setup.includes('cd "$PROJECT_DIR"')
365
+ && setup.includes('export OPENCLAW_HOME="$PROJECT_DIR/.openclaw"')
366
+ && setup.includes('export OPENCLAW_STATE_DIR="$PROJECT_DIR/.openclaw"')
367
+ && setup.includes('export DATA_DIR="$PROJECT_DIR/.9router"'),
368
+ 'Unix native script generation must use project-local runtime directories and launch from PROJECT_DIR'
369
+ ));
370
+
371
+ checks.push(() => expect(
372
+ setup.includes("arr.push('call npm install -g 9router || goto :fail');")
373
+ && setup.includes('function native9RouterServerEntryLookup() {')
374
+ && setup.includes('return "node -e ')
375
+ && !setup.includes('return "node -p ')
376
+ && setup.includes('function windowsHiddenNodeLaunch(targetPath, extraEnv = {}) {')
377
+ && setup.includes('NINE_ROUTER_ENTRY=%%I')
378
+ && setup.includes("windowsHiddenNodeLaunch('%NINE_ROUTER_ENTRY%', { PORT: '20128', HOSTNAME: '0.0.0.0', DATA_DIR: '%DATA_DIR%' })")
379
+ && setup.includes('NINE_ROUTER_ENTRY="$(${native9RouterServerEntryLookup()})"')
380
+ && setup.includes("const p=path.join(process.env.DATA_DIR||'.9router','db.json');")
381
+ && setup.includes('nohup env PORT=20128 HOSTNAME=0.0.0.0 DATA_DIR="$PWD/.9router" node "$NINE_ROUTER_ENTRY" >/tmp/9router.log 2>&1 &')
382
+ && setup.includes('nohup env DATA_DIR="$PWD/.9router" node ./.openclaw/9router-smart-route-sync.js >/tmp/9router-sync.log 2>&1 &')
383
+ && setup.includes('set "PROJECT_DIR=')
384
+ && setup.includes('set "OPENCLAW_HOME=%PROJECT_DIR%\\\\.openclaw"')
385
+ && setup.includes('set "OPENCLAW_STATE_DIR=%PROJECT_DIR%\\\\.openclaw"')
386
+ && setup.includes('set "DATA_DIR=%PROJECT_DIR%\\\\.9router"'),
387
+ 'Native script generation must install and start a standalone 9Router dashboard on port 20128'
388
+ ));
389
+
390
+ checks.push(() => expect(
391
+ setup.includes("echo OpenClaw Dashboard: http://127.0.0.1:18791")
392
+ && setup.includes("echo Other reachable URLs: http://localhost:18791")
393
+ && setup.includes("echo If the dashboard asks for a Gateway Token, run: openclaw dashboard")
394
+ && setup.includes("echo 9Router Dashboard: http://127.0.0.1:20128/dashboard")
395
+ && !setup.includes('set "HOME=%PROJECT_DIR%"')
396
+ && !setup.includes('set "USERPROFILE=%PROJECT_DIR%"'),
397
+ 'Windows native script generation must print OpenClaw and 9Router dashboard URLs'
398
+ ));
399
+
400
+ checks.push(() => expect(
401
+ setup.includes("bind: 'custom'")
402
+ && setup.includes("customBindHost: '0.0.0.0'")
403
+ && !setup.includes("bind: '0.0.0.0'")
404
+ && setup.includes("state.bots[state.activeBotIndex].provider = key;")
405
+ && setup.includes("state.bots[state.activeBotIndex].model = p.models[0].id;")
406
+ && setup.includes("state.bots[state.activeBotIndex].provider = state.config.provider;")
407
+ && setup.includes("state.bots[state.activeBotIndex].model = state.config.model;")
408
+ && setup.includes("if (state.botCount <= 1 && state.bots[state.activeBotIndex]) {")
409
+ && setup.includes("state.bots[state.activeBotIndex].token = botTokenEl.value;")
410
+ && setup.includes("state.bots[state.activeBotIndex].apiKey = apiKeyEl.value;")
411
+ && setup.includes("const authProviderName = provider.isProxy ? '9router' : state.config.provider;")
412
+ && setup.includes("const authProviderName = botProvider.isProxy ? '9router' : (bot.provider || state.config.provider);")
413
+ && setup.includes("const nativeSkillConfigs = state.config.skills")
414
+ && setup.includes("const nativeSkillInstallCmds = nativeSkillConfigs.map((skill) => `call openclaw skills install ${skill.slug} || echo Warning: Failed to install skill ${skill.slug}`);")
415
+ && setup.includes("lines.push('call npm install -g agent-browser playwright || goto :fail');")
416
+ && setup.includes("lines.push('call npx playwright install chromium || goto :fail');")
417
+ && setup.includes("lines.push('echo Cai skills...');")
418
+ && !setup.includes("const authProviderName = provider.isProxy ? '9router' : provider.id;")
419
+ && !setup.includes("const authProviderName = botProvider.isProxy ? '9router' : botProvider.id;"),
420
+ 'Wizard native config generation must avoid legacy gateway.bind aliases, preserve concrete auth provider ids, and sync single-bot provider/model selections into bot state'
352
421
  ));
353
422
 
354
423
  checks.push(() => expectMatch(
355
424
  setup,
356
- /function providerLines\(arr, shell\) \{[\s\S]*npm install -g 9router[\s\S]*start "9Router" cmd \/k "9router -n -l -H 0\.0\.0\.0 -p 20128 --skip-update"[\s\S]*nohup env PORT=20128 HOSTNAME=0\.0\.0\.0 node "\$\(npm root -g\)\/9router\/app\/server\.js"[\s\S]*9router-smart-route-sync\.js/s,
357
- 'Native script generation must install and start a standalone 9Router dashboard on port 20128'
425
+ /window\.downloadNativeScript = function\(\) \{[\s\S]*generateOutput\(\);[\s\S]*const script = window\._nativeScript;/,
426
+ 'Native script download must regenerate the latest wizard output before reading the cached script'
358
427
  ));
359
428
 
360
429
  checks.push(() => expectMatch(
@@ -365,8 +434,8 @@ checks.push(() => expectMatch(
365
434
 
366
435
  checks.push(() => expectMatch(
367
436
  setup,
368
- /function native9RouterSyncScriptContent\(\) \{[\s\S]*path\.join\(process\.env\.HOME\|\|process\.env\.USERPROFILE\|\|'\.'\,\'\.9router\'\,\'db\.json\'\)[\s\S]*providerConnections[\s\S]*smart-route/s,
369
- 'Native script generation must embed a 9Router smart-route sync script'
437
+ /function native9RouterSyncScriptContent\(\) \{[\s\S]*const p=path\.join\(process\.env\.DATA_DIR\|\|'\.9router','db\.json'\);[\s\S]*const ROUTER='http:\/\/localhost:20128';[\s\S]*fetch\(ROUTER\+'\/api\/providers'\)[\s\S]*d\.connections[\s\S]*smart-route/s,
438
+ 'Native script generation must keep the 9Router sync script project-local via DATA_DIR and sync active providers from the 9Router API'
370
439
  ));
371
440
 
372
441
  checks.push(() => expect(
@@ -407,13 +476,13 @@ checks.push(() => expect(
407
476
 
408
477
  checks.push(() => expectMatch(
409
478
  setup,
410
- /else if \(state\.nativeOs === 'vps'\) \{[\s\S]*PORT=20128 HOSTNAME=0\.0\.0\.0 pm2 start "\$\(npm root -g\)\/9router\/app\/server\.js" --name openclaw-multibot-9router --interpreter "\$\(command -v node\)"[\s\S]*pm2 start --name openclaw-multibot -- sh -c "openclaw gateway run"[\s\S]*pm2 logs openclaw-multibot/s,
479
+ /else if \(state\.nativeOs === 'vps'\) \{[\s\S]*NINE_ROUTER_ENTRY="\$\([\s\S]*PORT=20128 HOSTNAME=0\.0\.0\.0 pm2 start "\$NINE_ROUTER_ENTRY" --name openclaw-multibot-9router --interpreter "\$\(command -v node\)"[\s\S]*pm2 start --name openclaw-multibot -- sh -c "openclaw gateway run"[\s\S]*pm2 logs openclaw-multibot/s,
411
480
  'VPS multi-bot native script must start the shared gateway via PM2'
412
481
  ));
413
482
 
414
483
  checks.push(() => expectMatch(
415
484
  setup,
416
- /else if \(state\.nativeOs === 'vps'\) \{[\s\S]*PORT=20128 HOSTNAME=0\.0\.0\.0 pm2 start "\$\(npm root -g\)\/9router\/app\/server\.js" --name openclaw-9router --interpreter "\$\(command -v node\)"[\s\S]*pm2 start --name openclaw -- sh -c "openclaw gateway run"[\s\S]*pm2 logs openclaw/s,
485
+ /else if \(state\.nativeOs === 'vps'\) \{[\s\S]*NINE_ROUTER_ENTRY="\$\([\s\S]*PORT=20128 HOSTNAME=0\.0\.0\.0 pm2 start "\$NINE_ROUTER_ENTRY" --name openclaw-9router --interpreter "\$\(command -v node\)"[\s\S]*pm2 start --name openclaw -- sh -c "openclaw gateway run"[\s\S]*pm2 logs openclaw/s,
417
486
  'VPS single-bot native script must start one bot via PM2'
418
487
  ));
419
488