[PR #8439] feat: add choco and scoop to opencode upgrade methods #12748

Closed
opened 2026-02-16 18:17:38 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8439

State: closed
Merged: Yes


What does this PR do?

Adds support for opencode upgrade to work with Chocolatey and Scoop installations. This works by adding choco and scoop commands to the relevant methods in the Installation namespace -

  • Installation.method: add choco list and scoop list commands
  • Installation.upgrade: add choco upgrade --version=<target> and scoop install opencode@<target> commands
  • Installation.latest: fetch the latest version number of the choco and scoop opencode packages from public manifest URLs

How did you verify your code works?

Chocolatey

PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v
1.1.17
PS C:\Users\Mani\repos\opencode\dev--win-auto-update> bun dev upgrade
$ bun run --cwd packages/opencode --conditions=browser src/index.ts upgrade

                                   
  █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
  █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀
  ▀▀▀▀ █▀▀▀ ▀▀▀▀    ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀


  Upgrade

  Using method: choco

  From v1.1.17  1.1.18

  Upgrade complete

  Done

PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v
1.1.18

Scoop

PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v
1.1.17
PS C:\Users\Mani\repos\opencode\dev--win-auto-update> bun dev upgrade
$ bun run --cwd packages/opencode --conditions=browser src/index.ts upgrade

                                   
  █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
  █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀
  ▀▀▀▀ █▀▀▀ ▀▀▀▀    ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀


  Upgrade

  Using method: scoop

  From v1.1.17  1.1.18

  Upgrade complete

  Done

PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v
1.1.18

Notify Update

latest() pulls in the right version for our chocolatey based install (1.1.18 at the time of this PR whereas latest release is on 1.1.19

image

Not an Elevated Command Shell

Chocolatey has an annoying issue where it doesn't allow installation or upgrading a package if you're not in an elevated command shell. This "error" also passes to stdout and not stderr so we pass a custom error message to the UpgradeFailedError so we can capture it in the upgrade.ts and communicate this to the user.

image

Output of upgrade w/ a non-elevated command shell (this has been tested on cmd and non-elevated powershell.

PS C:\Users\Mani\repos\opencode\dev--win-auto-update> bun dev upgrade
$ bun run --cwd packages/opencode --conditions=browser src/index.ts upgrade

                                   
  █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
  █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀
  ▀▀▀▀ █▀▀▀ ▀▀▀▀    ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀


  Upgrade

  Using method: choco

  From v1.1.17  1.1.18

  Upgrade failed

  Please run the terminal as Administrator and try again

  Done
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8439 **State:** closed **Merged:** Yes --- ### What does this PR do? Adds support for `opencode upgrade` to work with Chocolatey and Scoop installations. This works by adding `choco` and `scoop` commands to the relevant methods in the `Installation` namespace - - `Installation.method`: add `choco list` and `scoop list` commands - `Installation.upgrade`: add `choco upgrade --version=<target>` and `scoop install opencode@<target>` commands - `Installation.latest`: fetch the latest version number of the `choco` and `scoop` opencode packages from public manifest URLs ### How did you verify your code works? #### Chocolatey ```pwsh PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v 1.1.17 PS C:\Users\Mani\repos\opencode\dev--win-auto-update> bun dev upgrade $ bun run --cwd packages/opencode --conditions=browser src/index.ts upgrade   ▄ █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀ ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ┌ Upgrade │ ● Using method: choco │ ● From v1.1.17 → 1.1.18 │ ◇ Upgrade complete │ └ Done PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v 1.1.18 ``` #### Scoop ```pwsh PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v 1.1.17 PS C:\Users\Mani\repos\opencode\dev--win-auto-update> bun dev upgrade $ bun run --cwd packages/opencode --conditions=browser src/index.ts upgrade   ▄ █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀ ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ┌ Upgrade │ ● Using method: scoop │ ● From v1.1.17 → 1.1.18 │ ◇ Upgrade complete │ └ Done PS C:\Users\Mani\repos\opencode\dev--win-auto-update> opencode -v 1.1.18 ``` #### Notify Update `latest()` pulls in the right version for our chocolatey based install (`1.1.18` at the time of this PR whereas latest release is on `1.1.19` <img width="544" height="116" alt="image" src="https://github.com/user-attachments/assets/ff79d81b-09ca-4eae-999c-a1e1fb7d8de1" /> #### Not an Elevated Command Shell Chocolatey has an annoying issue where it doesn't allow installation or upgrading a package if you're not in an elevated command shell. This "error" also passes to `stdout` and not `stderr` so we pass a custom error message to the `UpgradeFailedError` so we can capture it in the `upgrade.ts` and communicate this to the user. <img width="1095" height="651" alt="image" src="https://github.com/user-attachments/assets/54304f7b-2a2e-4fb2-953a-e53df576a147" /> Output of `upgrade` w/ a non-elevated command shell (this has been tested on `cmd` and non-elevated `powershell`. ```pwsh PS C:\Users\Mani\repos\opencode\dev--win-auto-update> bun dev upgrade $ bun run --cwd packages/opencode --conditions=browser src/index.ts upgrade   ▄ █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀ ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ┌ Upgrade │ ● Using method: choco │ ● From v1.1.17 → 1.1.18 │ ■ Upgrade failed │ ■ Please run the terminal as Administrator and try again │ └ Done ```
yindo added the pull-request label 2026-02-16 18:17:38 -05:00
yindo closed this issue 2026-02-16 18:17:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12748