(targets: RemovalTargets, method: Installation.Method)
| 102 | } |
| 103 | |
| 104 | async function showRemovalSummary(targets: RemovalTargets, method: Installation.Method) { |
| 105 | prompts.log.message("The following will be removed:") |
| 106 | |
| 107 | for (const dir of targets.directories) { |
| 108 | const exists = await fs |
| 109 | .access(dir.path) |
| 110 | .then(() => true) |
| 111 | .catch(() => false) |
| 112 | if (!exists) continue |
| 113 | |
| 114 | const size = await getDirectorySize(dir.path) |
| 115 | const sizeStr = formatSize(size) |
| 116 | const status = dir.keep ? UI.Style.TEXT_DIM + "(keeping)" : "" |
| 117 | const prefix = dir.keep ? "○" : "✓" |
| 118 | |
| 119 | prompts.log.info(` ${prefix} ${dir.label}: ${shortenPath(dir.path)} ${UI.Style.TEXT_DIM}(${sizeStr})${status}`) |
| 120 | } |
| 121 | |
| 122 | if (targets.binary) { |
| 123 | prompts.log.info(` ✓ Binary: ${shortenPath(targets.binary)}`) |
| 124 | } |
| 125 | |
| 126 | if (targets.shellConfig) { |
| 127 | prompts.log.info(` ✓ Shell PATH in ${shortenPath(targets.shellConfig)}`) |
| 128 | } |
| 129 | |
| 130 | if (method !== "curl" && method !== "unknown") { |
| 131 | const cmds: Record<string, string> = { |
| 132 | npm: "npm uninstall -g opencode-ai", |
| 133 | pnpm: "pnpm uninstall -g opencode-ai", |
| 134 | bun: "bun remove -g opencode-ai", |
| 135 | yarn: "yarn global remove opencode-ai", |
| 136 | brew: "brew uninstall opencode", |
| 137 | choco: "choco uninstall opencode", |
| 138 | scoop: "scoop uninstall opencode", |
| 139 | } |
| 140 | prompts.log.info(` ✓ Package: ${cmds[method] || method}`) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | async function executeUninstall(method: Installation.Method, targets: RemovalTargets) { |
| 145 | const spinner = prompts.spinner() |
no test coverage detected