Feature: Self-Update (cora upgrade) + Startup Notification
Problem
Cora Code has no built-in update mechanism. Users must manually re-run install.sh to upgrade. There is no notification when a new version is available.
Proposed Solution
1. cora upgrade command
cora upgrade # Check + prompt [y/N]
cora upgrade --yes # Auto-confirm (CI/automation)
cora upgrade --check # Check only, no download
Flow:
- Detect current version (
env!("CARGO_PKG_VERSION"))
- Detect OS/arch (
std::env::consts)
- GET GitHub releases/latest → parse 302 redirect (no API rate limit)
- Compare versions → show release notes link
- Prompt
[y/N] (skip with --yes)
- Download
cora-{target}-{version}.tar.gz
- Verify SHA256 from
checksums-sha256.txt (already generated by CI)
- Path traversal protection (validate archive entries)
- Smoke-test new binary (
cora --version)
- Atomic replace (
cora.new → cora)
- Cleanup temp
Reference: uteke already has a proven implementation (uteke upgrade).
2. Startup update notification (background, non-blocking)
- Check latest version in background thread on every
cora invocation
- Cache result for 24 hours at
~/.codecora/cora-code/update-cache.json
- Print banner to stderr if update available:
⚠ Update available: v0.14.0
Run `cora upgrade` to update (currently v0.13.0)
- Opt-out via config:
update_check: false in config
3. Path standardization (partial)
All new data goes to ~/.codecora/cora-code/ (using existing data_dir.rs).
Dependencies
Add to Cargo.toml:
Files
| File |
Description |
src/commands/upgrade.rs |
Self-update command (~250 lines) |
src/commands/update_check.rs |
Background notification + cache (~100 lines) |
src/data_dir.rs |
Add update_cache_path() helper |
src/commands/mod.rs |
Register modules |
src/main.rs |
Command enum + dispatch + startup hook |
src/config/schema.rs |
Add update_check config field |
Cargo.toml |
Add flate2, tar |
Non-goals (separate issue)
- Migrate existing
~/.cora/ paths (config, auth, scan-cache) to ~/.codecora/cora-code/
- Windows
.zip support for upgrade (Linux/macOS first)
Feature: Self-Update (
cora upgrade) + Startup NotificationProblem
Cora Code has no built-in update mechanism. Users must manually re-run
install.shto upgrade. There is no notification when a new version is available.Proposed Solution
1.
cora upgradecommandFlow:
env!("CARGO_PKG_VERSION"))std::env::consts)[y/N](skip with--yes)cora-{target}-{version}.tar.gzchecksums-sha256.txt(already generated by CI)cora --version)cora.new→cora)Reference:
utekealready has a proven implementation (uteke upgrade).2. Startup update notification (background, non-blocking)
corainvocation~/.codecora/cora-code/update-cache.jsonupdate_check: falsein config3. Path standardization (partial)
All new data goes to
~/.codecora/cora-code/(using existingdata_dir.rs).Dependencies
Add to
Cargo.toml:Files
src/commands/upgrade.rssrc/commands/update_check.rssrc/data_dir.rsupdate_cache_path()helpersrc/commands/mod.rssrc/main.rssrc/config/schema.rsupdate_checkconfig fieldCargo.tomlflate2,tarNon-goals (separate issue)
~/.cora/paths (config, auth, scan-cache) to~/.codecora/cora-code/.zipsupport for upgrade (Linux/macOS first)