@beeos-ai/cli 1.0.16 → 1.0.18
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/dist/index.js +424 -41
- package/package.json +1 -1
- package/scripts/_existing_install_actions.json +47 -22
- package/scripts/install.Tests.ps1 +36 -19
- package/scripts/install.ps1 +39 -163
- package/scripts/install.sh +35 -150
package/scripts/install.sh
CHANGED
|
@@ -1,58 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
#
|
|
3
3
|
# BeeOS CLI Installer (macOS / Linux)
|
|
4
|
+
#
|
|
4
5
|
# Usage:
|
|
5
6
|
# curl -fsSL https://beeos.ai/install | bash
|
|
6
7
|
# curl -fsSL https://beeos.ai/install | bash -s -- [beeos init args]
|
|
7
|
-
# curl -fsSL https://beeos.ai/install | bash -s -- --device
|
|
8
|
+
# curl -fsSL https://beeos.ai/install | bash -s -- --device # → beeos device attach
|
|
8
9
|
#
|
|
9
|
-
#
|
|
10
|
+
# Responsibilities (deliberately minimal — framework-agnostic):
|
|
10
11
|
# 1. Detect OS + CPU architecture, refuse unsupported targets early.
|
|
11
|
-
# 2. Make sure Node.js >= MIN_NODE_VERSION is available (install via
|
|
12
|
-
# fnm / brew when possible).
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
# 4.
|
|
17
|
-
# `--device` is passed.
|
|
12
|
+
# 2. Make sure Node.js >= MIN_NODE_VERSION is available (install via
|
|
13
|
+
# nvm / fnm / brew when possible). All heavier dependencies (adb,
|
|
14
|
+
# scrcpy-bridge, the device-agent suite) are installed lazily by
|
|
15
|
+
# the CLI itself when the user actually needs them.
|
|
16
|
+
# 3. `npm install -g @beeos-ai/cli`.
|
|
17
|
+
# 4. `exec beeos init` (or `beeos device attach` with `--device`).
|
|
18
18
|
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
# Config` env-overrides layer; older CLIs only honor BEEOS_API_URL
|
|
24
|
-
# (telemetry) + BEEOS_AGENT_GATEWAY_URL (runtime).
|
|
19
|
+
# Anything else — "you already have BeeOS installed, what now?",
|
|
20
|
+
# framework selection, rebind variants — lives inside the CLI's own
|
|
21
|
+
# `beeos init` menu, not here. The bootstrap script stays small so it's
|
|
22
|
+
# easy to maintain and easy to diagnose on a customer machine.
|
|
25
23
|
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
# BEEOS_USE_NPX=1
|
|
39
|
-
#
|
|
40
|
-
# persist on PATH after the script exits.
|
|
41
|
-
# Default behaviour (since CLI 1.0.11) is
|
|
42
|
-
# always `npm install -g` so the CLI is
|
|
43
|
-
# globally available for follow-up commands.
|
|
44
|
-
# The device-agent suite is no longer
|
|
45
|
-
# eagerly installed (CLI ≥ 1.0.16); see
|
|
46
|
-
# `web/packages/core/src/device-setup.ts`.
|
|
24
|
+
# ── Optional env vars ─────────────────────────────────────────────
|
|
25
|
+
# BEEOS_API_URL Public API base (this script uses it for
|
|
26
|
+
# telemetry; the CLI uses it for runtime).
|
|
27
|
+
# Defaults to production.
|
|
28
|
+
# BEEOS_AGENT_GATEWAY_URL Agent Gateway base (forwarded as-is to the
|
|
29
|
+
# spawned CLI).
|
|
30
|
+
# BEEOS_DASHBOARD_URL Dashboard base (OAuth / bind redirect).
|
|
31
|
+
# BEEOS_INSTALL_LOG Path to a forensic log of Node-bootstrap
|
|
32
|
+
# stderr; defaults to /tmp/beeos-install-$$.log.
|
|
33
|
+
# BEEOS_INSTALL_DRY_RUN=1 CI smoke-test escape hatch — return 0
|
|
34
|
+
# from main() before any side effect.
|
|
35
|
+
# BEEOS_NO_TELEMETRY=1 Disable the script-level telemetry POSTs.
|
|
36
|
+
# BEEOS_USE_NPX=1 Power-user throwaway install (beeos won't
|
|
37
|
+
# persist on PATH).
|
|
47
38
|
#
|
|
48
|
-
#
|
|
49
|
-
# add `BEEOS_DEVICE_AGENT_VERSION=...` to the shell when you later run
|
|
50
|
-
# `beeos device attach` if you need to pin a specific build):
|
|
39
|
+
# Bare-metal staging one-liner:
|
|
51
40
|
#
|
|
52
41
|
# BEEOS_API_URL=https://public-api-staging.beeos.ai \
|
|
53
42
|
# BEEOS_AGENT_GATEWAY_URL=https://agent-gw-staging.beeos.ai \
|
|
54
43
|
# BEEOS_DASHBOARD_URL=https://beeos-staging-web.vercel.app \
|
|
55
|
-
# curl -fsSL https://beeos.ai/install | bash -s -- --version 1.0.
|
|
44
|
+
# curl -fsSL https://beeos.ai/install | bash -s -- --version 1.0.18
|
|
56
45
|
|
|
57
46
|
set -euo pipefail
|
|
58
47
|
|
|
@@ -65,11 +54,6 @@ RED="\033[31m"
|
|
|
65
54
|
CYAN="\033[36m"
|
|
66
55
|
|
|
67
56
|
CLI_PACKAGE="@beeos-ai/cli@latest"
|
|
68
|
-
# `@beeos-ai/device-agent` + `@beeos-ai/device-mcp-server` are NOT
|
|
69
|
-
# installed here. CLI ≥ 1.0.16 installs them lazily on the first
|
|
70
|
-
# `beeos device attach` via `ensureDeviceAgent` in
|
|
71
|
-
# `web/packages/core/src/device-setup.ts`. OpenClaw-only users never
|
|
72
|
-
# download the device suite at all.
|
|
73
57
|
MIN_NODE_VERSION=18
|
|
74
58
|
NVM_VERSION="v0.40.1"
|
|
75
59
|
FNM_INSTALL_URL="https://fnm.vercel.app/install"
|
|
@@ -410,76 +394,6 @@ print_install_hints() {
|
|
|
410
394
|
echo ""
|
|
411
395
|
}
|
|
412
396
|
|
|
413
|
-
# ── Existing install detection ───────────────────────────────
|
|
414
|
-
|
|
415
|
-
beeos_already_installed() {
|
|
416
|
-
if command -v beeos &>/dev/null; then
|
|
417
|
-
return 0
|
|
418
|
-
fi
|
|
419
|
-
return 1
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
beeos_current_version() {
|
|
423
|
-
# `beeos --version` currently prints just the semver string. Tolerate
|
|
424
|
-
# other formats by extracting the first dotted number we can find.
|
|
425
|
-
local out
|
|
426
|
-
out=$(beeos --version 2>/dev/null | head -n1 | tr -d '[:space:]' || true)
|
|
427
|
-
if [[ "$out" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
|
428
|
-
echo "${BASH_REMATCH[0]}"
|
|
429
|
-
else
|
|
430
|
-
echo "$out"
|
|
431
|
-
fi
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
prompt_existing_install_action() {
|
|
435
|
-
# The labels here are anchored against the equivalents in
|
|
436
|
-
# install.ps1 (Read-ExistingInstallAction) and `init.ts`'s
|
|
437
|
-
# `decideAction` menu by
|
|
438
|
-
# `web/packages/cli/scripts/_existing_install_actions.json` and the
|
|
439
|
-
# vitest grep lint at
|
|
440
|
-
# `web/packages/cli/src/__tests__/existing-install-actions.test.ts`
|
|
441
|
-
# (P1-E of the install-link review). Keep at least one keyword from
|
|
442
|
-
# the manifest's `keywords[action]` array per option so the lint
|
|
443
|
-
# doesn't break.
|
|
444
|
-
#
|
|
445
|
-
# Only prompt on an interactive TTY. When the script is piped without a
|
|
446
|
-
# TTY attached (e.g. one-liner with no tty allocated), default to
|
|
447
|
-
# "reinstall + re-run init" which is the safest non-destructive choice.
|
|
448
|
-
if [[ ! -t 0 ]] && [[ ! -t 1 ]]; then
|
|
449
|
-
info "Non-interactive shell detected — defaulting to reinstall."
|
|
450
|
-
echo "upgrade"
|
|
451
|
-
return 0
|
|
452
|
-
fi
|
|
453
|
-
|
|
454
|
-
# Note on naming: the option below is labelled "Reinstall + upgrade
|
|
455
|
-
# CLI" deliberately. `beeos init`'s own menu has an item called
|
|
456
|
-
# "Upgrade CLI & agents" — it does (now) call `npm i -g` for the
|
|
457
|
-
# three-piece suite and re-runs `beeos start openclaw`. The script
|
|
458
|
-
# action here is broader: it also re-bootstraps Node / pnpm if
|
|
459
|
-
# missing, re-applies env vars from this shell, and *exec*s the
|
|
460
|
-
# newly-installed binary. Different verb avoids the user thinking
|
|
461
|
-
# they're picking the same code path twice. (See `init.ts`'s own
|
|
462
|
-
# upgrade branch for the in-CLI behavior.)
|
|
463
|
-
local ver
|
|
464
|
-
ver=$(beeos_current_version || true)
|
|
465
|
-
ver="${ver:-unknown}"
|
|
466
|
-
warn "BeeOS CLI is already installed (v${ver})."
|
|
467
|
-
echo ""
|
|
468
|
-
echo " [1] Reinstall + upgrade CLI to the latest version, then run ${BOLD}beeos init${RESET}"
|
|
469
|
-
echo " [2] Re-run ${BOLD}beeos init${RESET} without reinstalling"
|
|
470
|
-
echo " [3] Skip (do nothing)"
|
|
471
|
-
echo ""
|
|
472
|
-
|
|
473
|
-
local choice
|
|
474
|
-
read -rp "Choose [1-3]: " choice </dev/tty || choice=""
|
|
475
|
-
case "$choice" in
|
|
476
|
-
""|1) echo "upgrade" ;;
|
|
477
|
-
2) echo "rerun" ;;
|
|
478
|
-
3) echo "skip" ;;
|
|
479
|
-
*) echo "upgrade" ;;
|
|
480
|
-
esac
|
|
481
|
-
}
|
|
482
|
-
|
|
483
397
|
# ── Main ─────────────────────────────────────────────────────
|
|
484
398
|
|
|
485
399
|
run_cli() {
|
|
@@ -581,41 +495,12 @@ main() {
|
|
|
581
495
|
|
|
582
496
|
success "Node.js $(node -v) detected"
|
|
583
497
|
|
|
584
|
-
#
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
info "Skipping. Run \`beeos init\` or \`beeos device attach\` manually later."
|
|
591
|
-
exit 0
|
|
592
|
-
;;
|
|
593
|
-
upgrade)
|
|
594
|
-
info "Reinstalling ${CLI_PACKAGE}..."
|
|
595
|
-
if command -v npm &>/dev/null; then
|
|
596
|
-
if ! npm install -g "$CLI_PACKAGE"; then
|
|
597
|
-
send_telemetry "install.bootstrap.npm_fail" "npm_install_cli_failed_upgrade" false
|
|
598
|
-
error "npm install -g ${CLI_PACKAGE} failed."
|
|
599
|
-
error ""
|
|
600
|
-
error "Common fixes:"
|
|
601
|
-
error " - EEXIST on /bin/beeos from another package:"
|
|
602
|
-
error " npm uninstall -g beeos # then re-run installer"
|
|
603
|
-
error " - EACCES permission error:"
|
|
604
|
-
error " use a node version manager (nvm / fnm) or sudo"
|
|
605
|
-
exit 1
|
|
606
|
-
fi
|
|
607
|
-
# Device-agent suite is intentionally NOT upgraded here.
|
|
608
|
-
# `beeos device upgrade` is the canonical refresh path (it
|
|
609
|
-
# also restarts the running fleet); the install-script
|
|
610
|
-
# upgrade prompt only refreshes the CLI itself.
|
|
611
|
-
fi
|
|
612
|
-
;;
|
|
613
|
-
rerun)
|
|
614
|
-
info "Reusing existing install."
|
|
615
|
-
;;
|
|
616
|
-
esac
|
|
617
|
-
fi
|
|
618
|
-
|
|
498
|
+
# Bootstrap is finished. Hand off to `run_cli` which performs
|
|
499
|
+
# `npm install -g @beeos-ai/cli` (idempotent — npm short-circuits
|
|
500
|
+
# when the requested version is already on disk) and then `exec`s
|
|
501
|
+
# the freshly-installed binary. "What does the CLI do when it's
|
|
502
|
+
# already installed?" is now `beeos init`'s problem; we don't
|
|
503
|
+
# second-guess it from out here.
|
|
619
504
|
info "Running BeeOS CLI..."
|
|
620
505
|
echo ""
|
|
621
506
|
|