@beeos-ai/cli 1.0.17 → 1.0.19
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 +613 -541
- package/package.json +1 -1
- package/scripts/_existing_install_actions.json +30 -34
- package/scripts/install.Tests.ps1 +3 -1
- package/scripts/install.ps1 +58 -130
- package/scripts/install.sh +106 -157
package/package.json
CHANGED
|
@@ -1,56 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": [
|
|
3
|
-
"P1-E of the install-link review
|
|
3
|
+
"Existing-install copy lint anchor (was P1-E of the install-link review).",
|
|
4
4
|
"",
|
|
5
|
-
"
|
|
6
|
-
"menu with subtly different copy:",
|
|
5
|
+
"## Historical context",
|
|
7
6
|
"",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
7
|
+
"Before CLI 1.0.18 the same 'BeeOS is already installed — what now?'",
|
|
8
|
+
"menu was rendered from THREE places — install.sh, install.ps1, and",
|
|
9
|
+
"init.ts — and this manifest enforced shared keyword wording across",
|
|
10
|
+
"all three. The bash + PowerShell sites can't import TypeScript",
|
|
11
|
+
"constants, so a vitest grep lint",
|
|
12
|
+
"(`web/packages/cli/src/__tests__/existing-install-actions.test.ts`)",
|
|
13
|
+
"kept the three menus from drifting apart.",
|
|
11
14
|
"",
|
|
12
|
-
"
|
|
13
|
-
"wording with this manifest plus a vitest grep lint",
|
|
14
|
-
"(`web/packages/cli/src/__tests__/existing-install-actions.test.ts`).",
|
|
15
|
-
"If you change a label in any of the three files, update the",
|
|
16
|
-
"matching `keywords` here so the lint stays representative; if you",
|
|
17
|
-
"add a new action altogether, add a new entry below + render it",
|
|
18
|
-
"in all three sites.",
|
|
15
|
+
"## CLI 1.0.18 simplification",
|
|
19
16
|
"",
|
|
20
|
-
"
|
|
17
|
+
"The bootstrap scripts (install.sh / install.ps1) are now framework-",
|
|
18
|
+
"agnostic: their only job is `detect Node + npm i -g @beeos-ai/cli +",
|
|
19
|
+
"exec beeos init`. They no longer render any menu — 'what to do",
|
|
20
|
+
"when BeeOS is already installed' is `beeos init`'s job, where the",
|
|
21
|
+
"user sees the upgrade / rebind / reset-all / skip choices.",
|
|
21
22
|
"",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
23
|
+
"Consequence: the cross-site copy alignment lint shrinks to a",
|
|
24
|
+
"**single-file** lint on detect.ts. install.sh and install.ps1 are",
|
|
25
|
+
"removed from `files`. The `actions` block stays as a sanity check",
|
|
26
|
+
"that detect.ts's `initDecisionLabel` keeps recognisable terminology",
|
|
27
|
+
"(Upgrade / Re-bind / Skip).",
|
|
24
28
|
"",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"",
|
|
30
|
-
"These are NOT enforced across all 3 call sites because the",
|
|
31
|
-
"pre-Node bash/PowerShell installers have only [Reinstall][Re-run][Skip]",
|
|
32
|
-
"buttons — the rebind variants live exclusively inside `beeos init`'s",
|
|
33
|
-
"interactive menu. The 'rerun' keyword 'Re-bind' below incidentally",
|
|
34
|
-
"covers detect.ts's soft-rebind label, which keeps this lint passing."
|
|
29
|
+
"The `advisory` block (added in 1.0.17 for the soft-rebind / reset-all",
|
|
30
|
+
"split) is preserved and still pins the must-appear-in copy on",
|
|
31
|
+
"detect.ts so users can tell the two rebind variants apart from the",
|
|
32
|
+
"label alone."
|
|
35
33
|
],
|
|
36
34
|
"actions": {
|
|
37
35
|
"upgrade": {
|
|
38
|
-
"$comment": "
|
|
39
|
-
"keywords": ["
|
|
36
|
+
"$comment": "detect.ts 'Upgrade CLI & agents' label.",
|
|
37
|
+
"keywords": ["Upgrade"]
|
|
40
38
|
},
|
|
41
39
|
"rerun": {
|
|
42
|
-
"$comment": "
|
|
43
|
-
"keywords": ["Re-
|
|
40
|
+
"$comment": "detect.ts soft-rebind label includes 'Re-bind'; advisory block below pins the full phrasing.",
|
|
41
|
+
"keywords": ["Re-bind", "Reusing"]
|
|
44
42
|
},
|
|
45
43
|
"skip": {
|
|
46
|
-
"$comment": "
|
|
44
|
+
"$comment": "Stable across releases.",
|
|
47
45
|
"keywords": ["Skip"]
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
|
-
"$files_root_comment": "
|
|
48
|
+
"$files_root_comment": "Path is relative to the `web/` workspace root (the test resolves it against that anchor).",
|
|
51
49
|
"files": [
|
|
52
|
-
"packages/cli/scripts/install.sh",
|
|
53
|
-
"packages/cli/scripts/install.ps1",
|
|
54
50
|
"packages/core/src/detect.ts"
|
|
55
51
|
],
|
|
56
52
|
"$advisory_comment": "Strings below are advisory — not enforced by the lint, but checked by `existing-install-actions.test.ts` to make sure detect.ts's two rebind variants stay distinguishable from each other.",
|
|
@@ -64,6 +64,9 @@ Describe "install.ps1 parse-time integrity" {
|
|
|
64
64
|
# CLI >= 1.0.16: Install-DeviceAgentSuite has been removed —
|
|
65
65
|
# the device suite installs lazily on the first
|
|
66
66
|
# `beeos device attach` (see core/device-setup.ts).
|
|
67
|
+
# CLI >= 1.0.18: Read-ExistingInstallAction + Get-BeeosVersion
|
|
68
|
+
# are gone — `beeos init` is the single owner of the
|
|
69
|
+
# already-installed menu, the bootstrap script just hands off.
|
|
67
70
|
$expected = @(
|
|
68
71
|
"Write-BeeInfo",
|
|
69
72
|
"Write-BeeOk",
|
|
@@ -74,7 +77,6 @@ Describe "install.ps1 parse-time integrity" {
|
|
|
74
77
|
"Install-NodeAuto",
|
|
75
78
|
"Show-InstallHints",
|
|
76
79
|
"Send-Telemetry",
|
|
77
|
-
"Read-ExistingInstallAction",
|
|
78
80
|
"Invoke-BeeosCli",
|
|
79
81
|
# P2-8: PSCore + RunAs auto-elevation helpers.
|
|
80
82
|
"Test-IsAdministrator",
|
package/scripts/install.ps1
CHANGED
|
@@ -4,43 +4,38 @@
|
|
|
4
4
|
BeeOS CLI Installer for Windows.
|
|
5
5
|
|
|
6
6
|
.DESCRIPTION
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
$env:BEEOS_API_URL
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
$env:BEEOS_AGENT_GATEWAY_URL
|
|
23
|
-
|
|
24
|
-
$env:BEEOS_DASHBOARD_URL
|
|
25
|
-
$env:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
CLI is globally available for
|
|
40
|
-
follow-up commands. The device
|
|
41
|
-
suite is NOT eagerly installed
|
|
42
|
-
(CLI >= 1.0.16); see
|
|
43
|
-
web/packages/core/src/device-setup.ts.
|
|
7
|
+
Responsibilities (deliberately minimal — framework-agnostic):
|
|
8
|
+
1. Detect or install Node.js (via winget / Chocolatey fallback).
|
|
9
|
+
2. `npm install -g @beeos-ai/cli`.
|
|
10
|
+
3. `exec beeos init` (or `beeos device attach` with `-Device`).
|
|
11
|
+
|
|
12
|
+
Anything else — "you already have BeeOS installed, what now?",
|
|
13
|
+
framework selection, rebind variants — lives inside the CLI's own
|
|
14
|
+
`beeos init` menu, not here. The bootstrap script stays small so
|
|
15
|
+
it's easy to maintain and easy to diagnose on a customer machine.
|
|
16
|
+
|
|
17
|
+
Optional env vars:
|
|
18
|
+
|
|
19
|
+
$env:BEEOS_API_URL Public API base (this script uses
|
|
20
|
+
it for telemetry; the CLI uses it
|
|
21
|
+
for runtime). Defaults to production.
|
|
22
|
+
$env:BEEOS_AGENT_GATEWAY_URL Agent Gateway base (forwarded as-is
|
|
23
|
+
to the spawned CLI).
|
|
24
|
+
$env:BEEOS_DASHBOARD_URL Dashboard base (OAuth / bind redirect).
|
|
25
|
+
$env:BEEOS_INSTALL_DRY_RUN=1 CI smoke-test escape hatch.
|
|
26
|
+
$env:BEEOS_NO_TELEMETRY=1 Disable script-level telemetry POSTs.
|
|
27
|
+
$env:BEEOS_USE_NPX = "1" Power-user throwaway install (beeos
|
|
28
|
+
won't persist on PATH).
|
|
29
|
+
|
|
30
|
+
IMPORTANT (env inheritance):
|
|
31
|
+
$env:BEEOS_API_URL / BEEOS_AGENT_GATEWAY_URL / BEEOS_DASHBOARD_URL
|
|
32
|
+
must be set in THE SAME PowerShell session that runs this script
|
|
33
|
+
before the irm | iex pipe. They reach `beeos init` via the normal
|
|
34
|
+
process env passthrough — there is NO auto-injection from
|
|
35
|
+
command-line args.
|
|
36
|
+
|
|
37
|
+
Working: $env:BEEOS_API_URL = '...'; irm beeos.ai/install.ps1 | iex
|
|
38
|
+
Broken: irm beeos.ai/install.ps1 | iex (vars never set)
|
|
44
39
|
|
|
45
40
|
.EXAMPLE
|
|
46
41
|
# One-liner (PowerShell 5+):
|
|
@@ -48,14 +43,14 @@
|
|
|
48
43
|
|
|
49
44
|
.EXAMPLE
|
|
50
45
|
# With specific CLI version:
|
|
51
|
-
.\install.ps1 -Version 1.0.
|
|
46
|
+
.\install.ps1 -Version 1.0.18
|
|
52
47
|
|
|
53
48
|
.EXAMPLE
|
|
54
49
|
# Jump straight into device attach instead of init:
|
|
55
50
|
.\install.ps1 -Device
|
|
56
51
|
|
|
57
52
|
.EXAMPLE
|
|
58
|
-
# Bare-metal one-
|
|
53
|
+
# Bare-metal staging one-liner:
|
|
59
54
|
$env:BEEOS_API_URL = "https://public-api-staging.beeos.ai"
|
|
60
55
|
$env:BEEOS_AGENT_GATEWAY_URL = "https://agent-gw-staging.beeos.ai"
|
|
61
56
|
$env:BEEOS_DASHBOARD_URL = "https://beeos-staging-web.vercel.app"
|
|
@@ -346,9 +341,15 @@ function Install-NodeAuto {
|
|
|
346
341
|
# choco's portable installs work without admin in some cases.
|
|
347
342
|
if (-not (Test-IsAdministrator)) {
|
|
348
343
|
if (Request-Elevation) {
|
|
349
|
-
# Elevated process took over; exit
|
|
350
|
-
#
|
|
351
|
-
|
|
344
|
+
# Elevated process took over; exit so the user doesn't see
|
|
345
|
+
# two installs racing. We use exit 10 (not 0) so any CI /
|
|
346
|
+
# automation wrapping the call can distinguish "the install
|
|
347
|
+
# COMPLETED in this session" (exit 0) from "the install
|
|
348
|
+
# was MOVED to an elevated window — wait for that one to
|
|
349
|
+
# finish" (exit 10). The new window's exit code is the
|
|
350
|
+
# authoritative success / failure signal.
|
|
351
|
+
Write-BeeOk "Installation moved to the elevated window. This session exits with code 10."
|
|
352
|
+
exit 10
|
|
352
353
|
}
|
|
353
354
|
Write-BeeWarn "Continuing without admin — winget/choco may fail with EACCES."
|
|
354
355
|
}
|
|
@@ -425,59 +426,6 @@ function Show-InstallHints {
|
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
428
|
|
|
428
|
-
# ── Existing install detection ───────────────────────────────
|
|
429
|
-
|
|
430
|
-
function Get-BeeosVersion {
|
|
431
|
-
try {
|
|
432
|
-
$out = & beeos --version 2>$null
|
|
433
|
-
if ($out) {
|
|
434
|
-
if ($out -match "\d+\.\d+\.\d+") { return $Matches[0] }
|
|
435
|
-
return ($out -replace '\s+','')
|
|
436
|
-
}
|
|
437
|
-
} catch {}
|
|
438
|
-
return $null
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function Read-ExistingInstallAction {
|
|
442
|
-
# Note on naming: "Reinstall + upgrade CLI" deliberately differs
|
|
443
|
-
# from the `beeos init` menu's "Upgrade CLI & agents" item. The
|
|
444
|
-
# script-side action also re-bootstraps Node / pnpm and re-applies
|
|
445
|
-
# this shell's env vars before exec'ing the new binary, which the
|
|
446
|
-
# in-CLI upgrade does NOT do — choosing a different verb keeps the
|
|
447
|
-
# two flows distinguishable. See `install.sh` for the matching
|
|
448
|
-
# docstring.
|
|
449
|
-
#
|
|
450
|
-
# P1-E of the install-link review: the labels rendered below are
|
|
451
|
-
# anchored against `install.sh::prompt_existing_install_action` +
|
|
452
|
-
# `init.ts::decideAction` via
|
|
453
|
-
# `web/packages/cli/scripts/_existing_install_actions.json` and
|
|
454
|
-
# the vitest grep lint at
|
|
455
|
-
# `web/packages/cli/src/__tests__/existing-install-actions.test.ts`.
|
|
456
|
-
# Keep at least one keyword from `keywords[action]` per option.
|
|
457
|
-
$ver = Get-BeeosVersion
|
|
458
|
-
if (-not $ver) { $ver = "unknown" }
|
|
459
|
-
Write-BeeWarn "BeeOS CLI is already installed (v$ver)."
|
|
460
|
-
Write-Host ""
|
|
461
|
-
Write-Host " [1] Reinstall + upgrade CLI to the latest version, then run beeos init"
|
|
462
|
-
Write-Host " [2] Re-run beeos init without reinstalling"
|
|
463
|
-
Write-Host " [3] Skip (do nothing)"
|
|
464
|
-
Write-Host ""
|
|
465
|
-
|
|
466
|
-
if (-not [Environment]::UserInteractive) {
|
|
467
|
-
Write-BeeInfo "Non-interactive shell — defaulting to reinstall."
|
|
468
|
-
return "upgrade"
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
$choice = Read-Host "Choose [1-3]"
|
|
472
|
-
switch ($choice) {
|
|
473
|
-
"" { return "upgrade" }
|
|
474
|
-
"1" { return "upgrade" }
|
|
475
|
-
"2" { return "rerun" }
|
|
476
|
-
"3" { return "skip" }
|
|
477
|
-
default { return "upgrade" }
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
429
|
# ── Run CLI ──────────────────────────────────────────────────
|
|
482
430
|
|
|
483
431
|
function Invoke-BeeosCli {
|
|
@@ -509,19 +457,25 @@ function Invoke-BeeosCli {
|
|
|
509
457
|
}
|
|
510
458
|
|
|
511
459
|
Write-BeeInfo "Installing $CliPackage globally..."
|
|
512
|
-
|
|
513
|
-
|
|
460
|
+
# 1.0.19: tee npm output into $BeeosInstallLog so support
|
|
461
|
+
# engineers can see the full npm stderr after-the-fact, not just
|
|
462
|
+
# whatever scrolled past in the terminal. `2>&1` merges stderr
|
|
463
|
+
# into the pipe so Tee-Object captures both streams.
|
|
464
|
+
& npm install -g $CliPackage 2>&1 | Tee-Object -FilePath $BeeosInstallLog -Append
|
|
465
|
+
$npmExit = $LASTEXITCODE
|
|
466
|
+
if ($npmExit -ne 0) {
|
|
514
467
|
# P0-A of the install-link review: fail-after-bootstrap signal.
|
|
515
468
|
# The `install.bootstrap.cli_installed` event is only emitted
|
|
516
469
|
# AFTER npm reports success.
|
|
517
470
|
Send-Telemetry -Event "install.bootstrap.npm_fail" -ErrorCode "npm_install_cli_failed" -Success $false
|
|
518
471
|
Write-BeeError "npm install -g $CliPackage failed."
|
|
472
|
+
Write-BeeError " Full log: $BeeosInstallLog"
|
|
519
473
|
Write-BeeError ""
|
|
520
474
|
Write-BeeError "Common fixes:"
|
|
521
475
|
Write-BeeError " - EEXIST on beeos from another package:"
|
|
522
|
-
Write-BeeError " npm uninstall -g beeos # then re-run installer"
|
|
476
|
+
Write-BeeError " npm uninstall -g @beeos-ai/cli # then re-run installer"
|
|
523
477
|
Write-BeeError " - EACCES / permission error: run PowerShell as Administrator"
|
|
524
|
-
exit
|
|
478
|
+
exit 3
|
|
525
479
|
}
|
|
526
480
|
# Device-agent suite is intentionally NOT installed here; `beeos
|
|
527
481
|
# device attach` will auto-install it on first use via
|
|
@@ -608,37 +562,11 @@ if (-not (Test-NodeVersion)) {
|
|
|
608
562
|
$nodeVer = & node -v
|
|
609
563
|
Write-BeeOk "Node.js $nodeVer detected"
|
|
610
564
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
Write-BeeInfo "Skipping. Run `beeos init` or `beeos device attach` manually later."
|
|
617
|
-
exit 0
|
|
618
|
-
}
|
|
619
|
-
"upgrade" {
|
|
620
|
-
Write-BeeInfo "Reinstalling $CliPackage..."
|
|
621
|
-
& npm install -g $CliPackage
|
|
622
|
-
if ($LASTEXITCODE -ne 0) {
|
|
623
|
-
Send-Telemetry -Event "install.bootstrap.npm_fail" -ErrorCode "npm_install_cli_failed_upgrade" -Success $false
|
|
624
|
-
Write-BeeError "npm install -g $CliPackage failed."
|
|
625
|
-
Write-BeeError ""
|
|
626
|
-
Write-BeeError "Common fixes:"
|
|
627
|
-
Write-BeeError " - EEXIST on beeos from another package:"
|
|
628
|
-
Write-BeeError " npm uninstall -g beeos # then re-run installer"
|
|
629
|
-
Write-BeeError " - EACCES / permission error: run PowerShell as Administrator"
|
|
630
|
-
exit 1
|
|
631
|
-
}
|
|
632
|
-
# Device suite is NOT upgraded here. `beeos device upgrade`
|
|
633
|
-
# is the canonical refresh path (it also restarts the
|
|
634
|
-
# running fleet); the install-script upgrade prompt only
|
|
635
|
-
# refreshes the CLI itself.
|
|
636
|
-
}
|
|
637
|
-
"rerun" {
|
|
638
|
-
Write-BeeInfo "Reusing existing install."
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
565
|
+
# Bootstrap is finished. Hand off to `Invoke-BeeosCli` which performs
|
|
566
|
+
# `npm install -g @beeos-ai/cli` (idempotent — npm short-circuits when
|
|
567
|
+
# the requested version is already on disk) and then runs the freshly
|
|
568
|
+
# installed binary. "What does the CLI do when it's already installed?"
|
|
569
|
+
# is now `beeos init`'s problem; we don't second-guess it from out here.
|
|
642
570
|
|
|
643
571
|
Write-BeeInfo "Running BeeOS CLI..."
|
|
644
572
|
Write-Host ""
|