diff options
| author | Mani Sundararajan <[email protected]> | 2026-01-18 03:40:01 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-18 02:40:01 -0600 |
| commit | 0ccf9bd9acf5d861c89c39878f50fc9cd7f48735 (patch) | |
| tree | 59ad2f942efdfea3dbf79f8af23d075983046b5f | |
| parent | ee4ea653116803fcb2af731ca0a520e5fee2c68d (diff) | |
| download | opencode-0ccf9bd9acf5d861c89c39878f50fc9cd7f48735.tar.gz opencode-0ccf9bd9acf5d861c89c39878f50fc9cd7f48735.zip | |
feat(cli): uninstall opencode installed via windows package managers (#8571)
| -rw-r--r-- | packages/opencode/src/cli/cmd/uninstall.ts | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/packages/opencode/src/cli/cmd/uninstall.ts b/packages/opencode/src/cli/cmd/uninstall.ts index 62210d575..704d3572b 100644 --- a/packages/opencode/src/cli/cmd/uninstall.ts +++ b/packages/opencode/src/cli/cmd/uninstall.ts @@ -133,6 +133,8 @@ async function showRemovalSummary(targets: RemovalTargets, method: Installation. bun: "bun remove -g opencode-ai", yarn: "yarn global remove opencode-ai", brew: "brew uninstall opencode", + choco: "choco uninstall opencode", + scoop: "scoop uninstall opencode", } prompts.log.info(` ✓ Package: ${cmds[method] || method}`) } @@ -182,16 +184,27 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar bun: ["bun", "remove", "-g", "opencode-ai"], yarn: ["yarn", "global", "remove", "opencode-ai"], brew: ["brew", "uninstall", "opencode"], + choco: ["choco", "uninstall", "opencode"], + scoop: ["scoop", "uninstall", "opencode"], } const cmd = cmds[method] if (cmd) { spinner.start(`Running ${cmd.join(" ")}...`) - const result = await $`${cmd}`.quiet().nothrow() + const result = + method === "choco" + ? await $`echo Y | choco uninstall opencode -y -r`.quiet().nothrow() + : await $`${cmd}`.quiet().nothrow() if (result.exitCode !== 0) { - spinner.stop(`Package manager uninstall failed`, 1) - prompts.log.warn(`You may need to run manually: ${cmd.join(" ")}`) - errors.push(`Package manager: exit code ${result.exitCode}`) + spinner.stop(`Package manager uninstall failed: exit code ${result.exitCode}`, 1) + if ( + method === "choco" && + result.stdout.toString("utf8").includes("not running from an elevated command shell") + ) { + prompts.log.warn(`You may need to run '${cmd.join(" ")}' from an elevated command shell`) + } else { + prompts.log.warn(`You may need to run manually: ${cmd.join(" ")}`) + } } else { spinner.stop("Package removed") } |
