@@ -87,21 +87,18 @@ export const UninstallCommand = {
8787 } ,
8888}
8989
90- async function collectRemovalTargets ( args : UninstallArgs , method : Installation . Method ) : Promise < RemovalTargets > {
90+ async function collectRemovalTargets ( args : UninstallArgs , _method : Installation . Method ) : Promise < RemovalTargets > {
9191 const directories : RemovalTargets [ "directories" ] = [
9292 { path : Global . Path . data , label : "Data" , keep : args . keepData } ,
9393 { path : Global . Path . cache , label : "Cache" , keep : false } ,
9494 { path : Global . Path . config , label : "Config" , keep : args . keepConfig } ,
9595 { path : Global . Path . state , label : "State" , keep : false } ,
9696 ]
9797
98- const shellConfig = method === "curl" ? await getShellConfigFile ( ) : null
99- const binary = method === "curl" ? process . execPath : null
100-
101- return { directories, shellConfig, binary }
98+ return { directories, shellConfig : null , binary : null }
10299}
103100
104- async function showRemovalSummary ( targets : RemovalTargets , method : Installation . Method ) {
101+ async function showRemovalSummary ( targets : RemovalTargets , _method : Installation . Method ) {
105102 prompts . log . message ( "The following will be removed:" )
106103
107104 for ( const dir of targets . directories ) {
@@ -126,22 +123,9 @@ async function showRemovalSummary(targets: RemovalTargets, method: Installation.
126123 if ( targets . shellConfig ) {
127124 prompts . log . info ( ` ✓ Shell PATH in ${ shortenPath ( targets . shellConfig ) } ` )
128125 }
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- }
142126}
143127
144- async function executeUninstall ( method : Installation . Method , targets : RemovalTargets ) {
128+ async function executeUninstall ( _method : Installation . Method , targets : RemovalTargets ) {
145129 const spinner = prompts . spinner ( )
146130 const errors : string [ ] = [ ]
147131
@@ -178,48 +162,6 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar
178162 }
179163 }
180164
181- if ( method !== "curl" && method !== "unknown" ) {
182- const cmds : Record < string , string [ ] > = {
183- npm : [ "npm" , "uninstall" , "-g" , "opencode-ai" ] ,
184- pnpm : [ "pnpm" , "uninstall" , "-g" , "opencode-ai" ] ,
185- bun : [ "bun" , "remove" , "-g" , "opencode-ai" ] ,
186- yarn : [ "yarn" , "global" , "remove" , "opencode-ai" ] ,
187- brew : [ "brew" , "uninstall" , "opencode" ] ,
188- choco : [ "choco" , "uninstall" , "opencode" ] ,
189- scoop : [ "scoop" , "uninstall" , "opencode" ] ,
190- }
191-
192- const cmd = cmds [ method ]
193- if ( cmd ) {
194- spinner . start ( `Running ${ cmd . join ( " " ) } ...` )
195- const result = await Process . run ( method === "choco" ? [ "choco" , "uninstall" , "opencode" , "-y" , "-r" ] : cmd , {
196- nothrow : true ,
197- } )
198- if ( result . code !== 0 ) {
199- spinner . stop ( `Package manager uninstall failed: exit code ${ result . code } ` , 1 )
200- const text = `${ result . stdout . toString ( "utf8" ) } \n${ result . stderr . toString ( "utf8" ) } `
201- if ( method === "choco" && text . includes ( "not running from an elevated command shell" ) ) {
202- prompts . log . warn ( `You may need to run '${ cmd . join ( " " ) } ' from an elevated command shell` )
203- } else {
204- prompts . log . warn ( `You may need to run manually: ${ cmd . join ( " " ) } ` )
205- }
206- } else {
207- spinner . stop ( "Package removed" )
208- }
209- }
210- }
211-
212- if ( method === "curl" && targets . binary ) {
213- UI . empty ( )
214- prompts . log . message ( "To finish removing the binary, run:" )
215- prompts . log . info ( ` rm "${ targets . binary } "` )
216-
217- const binDir = path . dirname ( targets . binary )
218- if ( binDir . includes ( ".opencode" ) ) {
219- prompts . log . info ( ` rmdir "${ binDir } " 2>/dev/null` )
220- }
221- }
222-
223165 if ( errors . length > 0 ) {
224166 UI . empty ( )
225167 prompts . log . warn ( "Some operations failed:" )
0 commit comments