Skip to content

feat(cli): update check + self update#140

Merged
Leechael merged 4 commits intomainfrom
feat/cli-update-check
Jan 19, 2026
Merged

feat(cli): update check + self update#140
Leechael merged 4 commits intomainfrom
feat/cli-update-check

Conversation

@Leechael
Copy link
Collaborator

Summary

  • Adds lightweight update notification with 200ms hard timeout and 24h TTL.
  • Adds phala self update to upgrade the CLI using the detected package manager/runtime.
  • Keeps utilities silent; all user-facing output is routed through commands/dispatcher.

Design notes (why this approach)

  • PDM-style philosophy: no detached worker/daemon; keep a tiny bounded time window (200ms) and fail silently to avoid impacting UX.
  • JSON safety: no update notice in --json or when JSON mode is enabled.
  • Cache-first UX: if updateCheckLatest_* indicates a newer version, we can notify without re-checking the network.
  • Security: self-update executes package manager via argv (no shell string injection) and validates --channel as a dist-tag token.

Channels (stable vs prerelease)

  • Stable users track latest by default.
  • Prerelease builds (e.g. x.y.z-beta.n) default to channel beta.
  • Override via PHALA_UPDATE_CHANNEL, config updateCheckChannel, or phala self update --channel <tag>.
  • Caches are separated per channel:
    • updateCheckLastAt_<channel> / updateCheckLatest_<channel> (e.g. _latest, _beta)
    • Backward compat for stable: updateCheckLastAt / updateCheckLatest still written for latest.

UX

  • Disable update notice:
    • PHALA_DISABLE_UPDATE_CHECK=1
    • phala config set disableUpdateNotice true

Implementation

  • Update check entrypoints: cli/src/core/update-check.ts + cli/src/core/dispatcher.ts
  • Self update command: cli/src/commands/self/update
  • Package manager detection: cli/src/core/package-manager.ts

Tests

  • Unit tests cover skip conditions, caching, scoped package encoding, dist-tag channel selection, and timeout.

@Leechael
Copy link
Collaborator Author

!release cli patch beta

@github-actions
Copy link
Contributor

🚀 @Leechael release command accepted: cli patch (beta).

📦 Prerelease tag: beta (will publish to npm with tag beta)
Target branch: feat/cli-update-check (open PR). Version commits will be pushed to this branch.
The release workflow is queued; results will be posted here.

@github-actions
Copy link
Contributor

🎉 Release completed: cli v1.1.3-beta.2

📦 Package Info

  • Package size: size: 197.0
  • Unpacked size: size: 675.8
  • Total files: files:
📄 Files included
11.4kB LICENSE
23.4kB README.md
28.3kB dist/api/index.d.ts
124.5kB dist/api/index.js
20B dist/index.d.ts
486.3kB dist/index.js
1.9kB package.json

@Leechael Leechael force-pushed the feat/cli-update-check branch from f118405 to 9d348b7 Compare January 19, 2026 08:41
@Leechael Leechael merged commit 84f3318 into main Jan 19, 2026
9 checks passed
@Leechael Leechael deleted the feat/cli-update-check branch January 19, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants