feat(cli): add pi2 update with a versioned install layout
The standalone (curl installer) channel had no upgrade path of its own: the
documented one was 're-run the installer', which the Neovim plugin cannot do
safely and which re-downloads 35 MB without version arithmetic, provenance or
rollback. ADR 0003 records the design; this is the implementation.
- install.sh now installs one immutable tree per version
(`<prefix>/versions/<v>/{bin,share,LICENSE}`) behind a single atomically
swapped `current` symlink, writes `<prefix>/install.json` as the install
receipt, and migrates a pre-0.1.7 flat layout in place. Keeping `current` plus
one previous tree gives a one-step rollback for free.
- `pi2 update` (native TypeScript, no `curl | sh` subprocess) resolves the
release with an ETag-cached GitHub lookup, picks the asset from the
build-time `PI2_BUILD_TARGET` define instead of re-probing libc, verifies
SHA256SUMS, verifies SLSA provenance with `gh attestation verify`, runs the
new binary once, then swaps `current` and rewrites the receipt. Flags:
--check/--dry-run/--version/--force/--json/--require-attestation/
--skip-attestation. Downgrades need --force; restarts stay manual.
- the receipt is the only channel detection: npm, Homebrew and the AUR are
refused with the command that owns their tree, and a flat install is told to
re-run the installer once. No heuristics on `process.execPath`.
- `pi2 install-service` renders `<prefix>/current/bin/pi2`, so an update no
longer invalidates the unit.
- `scripts/build-binary.sh` injects `PI2_BUILD_TARGET`; `tarball.ts` is a
dependency-free ustar/PAX reader with traversal and symlink rejection.
Verified against the real release: install.sh into a scratch prefix, update
--check/--dry-run, a local 0.1.7 mirror upgrade (attestation warn path), then
`pi2 update --version 0.1.6 --force` (real download, real attestation
verified), plus boot-check and the refusal paths. typecheck + 567 daemon tests
+ web typecheck + 537 web tests + smoke are green.
This commit is contained in:
1 parent
29aee26733
commit
8fb535f7f3
20 files changed
+2557
-43
No files matched your search
@@ -29,7 +29,7 @@ Adding bulk to this file is a mistake, not a contribution.
|
||||
| `src/daemon/` | HTTP/WS/SSE, auth, static assets, routing, event relay |
|
||||
| `src/instances/` | discovery, lazy spawn, one-instance-per-workspace, crash handling |
|
||||
| `src/workspaces/` | registry, disk discovery, aliases/trust, visibility policy |
|
||||
| `src/cli/` | `pi2` — `daemon`, `open`, `attach`, `status`, `doctor`, `pairing`, `install-service` |
|
||||
| `src/cli/` | `pi2` — `daemon`, `open`, `attach`, `status`, `doctor`, `pairing`, `install-service`, `update` |
|
||||
| `src/config.ts` | env-only configuration (`PI2_*`, `PI2_HOST`, `PI2_WORKSPACE_*`) |
|
||||
| `src/core/network.ts` | reachable addresses: kind classification, `bases[]` order, CORS origins |
|
||||
| `src/core/qr.ts` | zero-dependency QR encoder (pairing links; rows, no quiet zone) |
|
||||
@@ -68,7 +68,7 @@ owner/repo/workflow filename, not the npm name).
|
||||
| Doc | Contents |
|
||||
|---|---|
|
||||
| `docs/protocol.md` | the browser ↔ daemon ↔ plugin wire contract |
|
||||
| `docs/install.md` | canonical CLI-first install guide, channels, run modes, services |
|
||||
| `docs/install.md` | canonical CLI-first install guide, channels, run modes, services, `pi2 update` |
|
||||
| `docs/session-dot.md` | the session-list status dot: the `:PiSessions` matrix, the unread flags, the one blink clock |
|
||||
| `docs/deployment.md` | env vars, runtime files, ports, auth, services, troubleshooting |
|
||||
| `docs/e2e.md` | scenario ids, isolation, skip conditions, report paths |
|
||||
|
||||
Reference in new issue
Block a user