Skip to content

feat(cli): add progress feedback to upgrade command#31645

Open
szzhoujiarui-sketch wants to merge 2 commits into
anomalyco:devfrom
szzhoujiarui-sketch:260610-cli-upgrade-progress-bar
Open

feat(cli): add progress feedback to upgrade command#31645
szzhoujiarui-sketch wants to merge 2 commits into
anomalyco:devfrom
szzhoujiarui-sketch:260610-cli-upgrade-progress-bar

Conversation

@szzhoujiarui-sketch

Copy link
Copy Markdown

Issue for this PR

Closes #31623

Type of change

  • New feature

What does this PR do?

Adds progress feedback to the opencode upgrade command. Users now see real-time progress messages during download and installation instead of a silent process that appears to hang.

Changes:

  • New progress tracking types and formatter in src/installation/progress.ts
  • Optional progressCallback parameter added to Installation.upgrade() method
  • Stream-based download progress for curl method (shows %, size, speed)
  • Stage-based progress for all other install methods (npm/pnpm/bun/brew/choco/scoop)
  • Integrated with @clack/prompts spinner in CLI upgrade command
  • Unit tests for progress formatting

Example output:

[spinner] Checking for updates...
[spinner] Downloading v1.17.0 (45%, 10.0 MB, 2.5 MB/s)...
[spinner] Installing...
[✓] Upgrade complete

Why this works:

  • Uses Stream API for real-time progress tracking on curl downloads
  • Progress callback is optional for backward compatibility
  • Stage-based fallback for package manager methods that don't expose detailed progress

How did you verify your code works?

  • Unit tests covering all progress stages and edge cases (15 test cases)
  • Manual testing on Linux with curl installation method
  • Verified spinner displays progress messages correctly
  • Confirmed backward compatibility (no progress callback works unchanged)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- Add progress tracking with stage-based updates
- Display download percentage, size, and speed for curl method
- Show progress messages for all installation methods
- Backward compatible with optional progress callback
- Fixes anomalyco#31623
@szzhoujiarui-sketch

Copy link
Copy Markdown
Author

Note: The check-duplicates failure is a CI infrastructure issue (likely OPENCODE_API_KEY or AI service timeout), not a problem with this PR. All required checks pass:\n\n- ✅ add-contributor-label\n- ✅ check-compliance \n- ✅ check-standards\n- ❌ check-duplicates (AI service failure - requests manual review)\n\nThis PR implements progress feedback for opencode upgrade command (issue #31623). Please review manually.

@szzhoujiarui-sketch

szzhoujiarui-sketch commented Jun 10, 2026

Copy link
Copy Markdown
Author

The check-duplicates failure appears to come from the duplicate PR workflow itself rather than this PR code.

Relevant log:

TypeError: undefined is not an object (evaluating 'session.data.id')
at script/duplicate-pr.ts:64:29

The failing step is:

COMMENT=$(bun script/duplicate-pr.ts -f pr_info.txt "Check the attached file for PR details and search for duplicates")

So opencode.client.session.create() returned without data, and duplicate-pr.ts crashes when accessing session.data!.id. This job runs from the base repo workflow/script and uses OPENCODE_API_KEY, so it is independent of the changes in this PR. Please rerun after fixing the workflow/API issue or review this PR manually.

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.

[FEATURE]:Add progress bar / indicator to opencode upgrade command

2 participants