Skip to content

feat(cli): replace tale update with tale upgrade for self-upgrading CLI#1223

Merged
larryro merged 3 commits into
mainfrom
feat/cli-upgrade-command
Apr 9, 2026
Merged

feat(cli): replace tale update with tale upgrade for self-upgrading CLI#1223
larryro merged 3 commits into
mainfrom
feat/cli-upgrade-command

Conversation

@larryro

@larryro larryro commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces tale update with tale upgrade, which now downloads the latest CLI binary from GitHub Releases and then syncs project files — combining two manual steps into one command
  • Extracts compareVersions into a shared utility and reuses it in both the upgrade action and the version registry
  • Adds safety guards: binary verification, backup-and-restore on failure, sudo retry, dry-run support, and a dev-mode guard
  • Keeps update as a hidden alias for backward compatibility

Test plan

  • Run tale upgrade --dry-run on Linux/macOS and verify it prints what would happen without modifying anything
  • Run tale upgrade against a real release to confirm download, verification, replacement, and project file sync
  • Run tale update and confirm the alias still works
  • Verify tale upgrade errors gracefully when run via bun run (dev mode guard)
  • Confirm docs reflect the new command name

Summary by CodeRabbit

Release Notes

  • New Features

    • CLI now supports self-upgrading with automatic binary verification and rollback protection.
  • Changes

    • Renamed the update command to upgrade.
    • Updated all documentation to reflect the new command name.

larryro added 2 commits April 9, 2026 13:56
Remove the ambiguous `tale update` command (which only synced project
files) and introduce `tale upgrade` that unifies binary self-upgrade
and project file sync into a single command.

- Add self-upgrade: download latest binary from GitHub Releases, verify
  via --version check, replace with backup/restore on failure
- Handle cross-filesystem moves via shell mv (avoids EXDEV from
  fs.rename), sudo fallback for permission-restricted install dirs
- Support GITHUB_TOKEN/GH_TOKEN for authenticated GitHub API requests
- Platform/arch allowlist with clear errors for unsupported targets
- Windows support via rename-self pattern for locked executables
- Extract compareVersions() utility from get-available-versions.ts for
  directional semver comparison (prevents false downgrades)
- After binary replacement, spawn new binary with hidden
  --internal-sync-only flag to sync project files using new templates
- Update all documentation references from tale update to tale upgrade
- Add dev-mode guard to prevent overwriting Bun runtime via process.execPath
- Fix Windows `ren` bug passing full path instead of filename as second arg
- Fix silent backup restore failure that lied about restoration success
- Add 30s timeout to GitHub API call to prevent indefinite hangs
- Add runtime validation for GitHub API tag_name response field
- Add User-Agent header to GitHub API requests
- Improve 403 error message to mention both rate limiting and auth issues
- Fix double-header UX when upgrade delegates to update for file sync
- Remove dead skipVersionCheck code path (unreachable after update removal)
- Replace process.exit() with thrown error for consistent error handling
- Add backward-compat alias so `tale update` still works

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

…and promptTemplates

Consolidated duplicate indexes with identical fields but different names,
which caused Convex push failures.
@larryro larryro merged commit 3627395 into main Apr 9, 2026
23 checks passed
@larryro larryro deleted the feat/cli-upgrade-command branch April 9, 2026 06:23
@coderabbitai

coderabbitai Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR renames the CLI command from tale update to tale upgrade across documentation and implementation. The changes include updating all documentation references (README, quickstart, market-analysis, ai-assisted-development) to reflect the new command name and purpose. The CLI command wiring is refactored: the createUpdateCommand() export is removed, replaced by a new createUpgradeCommand() that registers itself with an update alias for backwards compatibility. The update action gains a skipHeader option to control header emission. A new comprehensive upgrade action implements self-upgrade logic including platform/arch-specific binary handling, GitHub release querying, version comparison, binary verification, file replacement with rollback, and project sync. Version comparison logic is extracted into a dedicated compareVersions utility function, and get-available-versions.ts is refactored to use it.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely captures the main change: replacing the 'tale update' command with 'tale upgrade' for self-upgrading CLI functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-upgrade-command

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant