diff --git a/packages/cli/src/commands/commands.ts b/packages/cli/src/commands/commands.ts index dc197ba8a17..11691bbb8b5 100644 --- a/packages/cli/src/commands/commands.ts +++ b/packages/cli/src/commands/commands.ts @@ -73,18 +73,8 @@ const Root = Spec.make(typeof OPENCODE_CLI_NAME === "string" ? OPENCODE_CLI_NAME }, }), Spec.make("uninstall", { - description: "Uninstall OpenCode and remove all related files", + description: "Uninstall OpenCode, keeping session data and configuration", params: { - keepConfig: Flag.boolean("keep-config").pipe( - Flag.withAlias("c"), - Flag.withDescription("Keep configuration files"), - Flag.withDefault(false), - ), - keepData: Flag.boolean("keep-data").pipe( - Flag.withAlias("d"), - Flag.withDescription("Keep session data and snapshots"), - Flag.withDefault(false), - ), dryRun: Flag.boolean("dry-run").pipe( Flag.withDescription("Show what would be removed without removing"), Flag.withDefault(false), diff --git a/packages/cli/src/commands/handlers/uninstall.ts b/packages/cli/src/commands/handlers/uninstall.ts index 69fdbb5dacf..b435774c71a 100644 --- a/packages/cli/src/commands/handlers/uninstall.ts +++ b/packages/cli/src/commands/handlers/uninstall.ts @@ -20,11 +20,10 @@ export default Runtime.handler( const updater = yield* Updater.Service const method = yield* updater.method() const removal = method ? updater.removal(method) : undefined + // Data and config hold sessions, credentials, and user-authored settings; uninstall never removes them. const directories = [ - { path: global.data, label: "Data", keep: input.keepData }, - { path: global.cache, label: "Cache", keep: false }, - { path: global.config, label: "Config", keep: input.keepConfig }, - { path: global.state, label: "State", keep: false }, + { path: global.cache, label: "Cache" }, + { path: global.state, label: "State" }, ] // All channels share these directories. Stop their owners before deleting state or data. // Read registrations directly: ServiceConfig.options() can migrate files even during a dry run. @@ -38,7 +37,7 @@ export default Runtime.handler( yield* Effect.forEach(directories, (directory) => Effect.gen(function* () { if (!(yield* fs.exists(directory.path))) return - log.info(` ${directory.label}: ${directory.path}${directory.keep ? " (keeping)" : ""}`) + log.info(` ${directory.label}: ${directory.path}`) }), ) services.forEach((name) => @@ -85,7 +84,6 @@ export default Runtime.handler( const errors: string[] = [] yield* Effect.forEach(directories, (directory) => Effect.gen(function* () { - if (directory.keep) return progress.start(`Removing ${directory.label}...`) yield* fs.remove(directory.path, { recursive: true, force: true }).pipe( // Windows reports a terminated service as gone before it releases its database diff --git a/services/www/src/docs/content/cli/commands.mdx b/services/www/src/docs/content/cli/commands.mdx index b7f8a512b00..b6f64c535f2 100644 --- a/services/www/src/docs/content/cli/commands.mdx +++ b/services/www/src/docs/content/cli/commands.mdx @@ -563,12 +563,6 @@ Preview what would be removed. $ opencode uninstall --dry-run ``` -Keep configuration and session data. - -```bash -$ opencode uninstall --keep-config --keep-data -``` - View all subcommands and flags. ```bash diff --git a/services/www/src/docs/content/cli/index.mdx b/services/www/src/docs/content/cli/index.mdx index 0ac71cd34b7..ec370c62b03 100644 --- a/services/www/src/docs/content/cli/index.mdx +++ b/services/www/src/docs/content/cli/index.mdx @@ -96,16 +96,9 @@ opencode uninstall --dry-run ``` Run `opencode uninstall` to confirm removal. OpenCode stops registered background services and persistent terminals before -removing global data, cache, configuration, and state. These directories are shared by OpenCode versions and channels. +removing the global cache and state directories. These directories are shared by OpenCode versions and channels. Session +data and configuration are never removed. -To retain configuration and session data: - -```bash -opencode uninstall --keep-config --keep-data -``` - -- `--keep-config` (`-c`) retains configuration files. -- `--keep-data` (`-d`) retains session data and snapshots. Cache and state are still removed. - `--force` (`-f`) skips confirmation; use it for noninteractive removal. - Package-manager installations use the detected package manager. Curl installations print the final command to remove the executable manually.