From 11a3b5aac9e529c3951edd97891c2b0161f78553 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 11 Jan 2026 10:35:13 +0000 Subject: [PATCH] style: biome fixes --- src/cli/program.ts | 12 ++++---- src/commands/cleanup-utils.ts | 8 ++++-- src/commands/reset.ts | 19 ++++++++++--- src/commands/uninstall.ts | 53 ++++++++++++++++++++++++++--------- 4 files changed, 66 insertions(+), 26 deletions(-) diff --git a/src/cli/program.ts b/src/cli/program.ts index d57f55a41..a614d13cb 100644 --- a/src/cli/program.ts +++ b/src/cli/program.ts @@ -478,7 +478,11 @@ export function buildProgram() { "config|config+creds+sessions|full (default: interactive prompt)", ) .option("--yes", "Skip confirmation prompts", false) - .option("--non-interactive", "Disable prompts (requires --scope + --yes)", false) + .option( + "--non-interactive", + "Disable prompts (requires --scope + --yes)", + false, + ) .option("--dry-run", "Print actions without removing files", false) .action(async (opts) => { try { @@ -501,11 +505,7 @@ export function buildProgram() { .option("--state", "Remove state + config", false) .option("--workspace", "Remove workspace dirs", false) .option("--app", "Remove the macOS app", false) - .option( - "--all", - "Remove service + state + workspace + app", - false, - ) + .option("--all", "Remove service + state + workspace + app", false) .option("--yes", "Skip confirmation prompts", false) .option("--non-interactive", "Disable prompts (requires --yes)", false) .option("--dry-run", "Print actions without removing files", false) diff --git a/src/commands/cleanup-utils.ts b/src/commands/cleanup-utils.ts index 6f515c535..62edcba8c 100644 --- a/src/commands/cleanup-utils.ts +++ b/src/commands/cleanup-utils.ts @@ -1,9 +1,8 @@ import fs from "node:fs/promises"; import path from "node:path"; - +import { resolveDefaultAgentWorkspaceDir } from "../agents/workspace.js"; import type { ClawdbotConfig } from "../config/config.js"; import type { RuntimeEnv } from "../runtime.js"; -import { resolveDefaultAgentWorkspaceDir } from "../agents/workspace.js"; import { resolveHomeDir, resolveUserPath } from "../utils.js"; export type RemovalResult = { @@ -34,7 +33,10 @@ export function collectWorkspaceDirs( export function isPathWithin(child: string, parent: string): boolean { const relative = path.relative(parent, child); - return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative)); + return ( + relative === "" || + (!relative.startsWith("..") && !path.isAbsolute(relative)) + ); } function isUnsafeRemovalTarget(target: string): boolean { diff --git a/src/commands/reset.ts b/src/commands/reset.ts index c8642a7b1..d2f9055d1 100644 --- a/src/commands/reset.ts +++ b/src/commands/reset.ts @@ -1,16 +1,25 @@ import { cancel, confirm, isCancel, select } from "@clack/prompts"; import { + isNixMode, loadConfig, resolveConfigPath, resolveOAuthDir, resolveStateDir, - isNixMode, } from "../config/config.js"; import { resolveGatewayService } from "../daemon/service.js"; import type { RuntimeEnv } from "../runtime.js"; -import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js"; -import { collectWorkspaceDirs, isPathWithin, listAgentSessionDirs, removePath } from "./cleanup-utils.js"; +import { + stylePromptHint, + stylePromptMessage, + stylePromptTitle, +} from "../terminal/prompt-style.js"; +import { + collectWorkspaceDirs, + isPathWithin, + listAgentSessionDirs, + removePath, +} from "./cleanup-utils.js"; export type ResetScope = "config" | "config+creds+sessions" | "full"; @@ -26,7 +35,9 @@ const selectStyled = (params: Parameters>[0]) => ...params, message: stylePromptMessage(params.message), options: params.options.map((opt) => - opt.hint === undefined ? opt : { ...opt, hint: stylePromptHint(opt.hint) }, + opt.hint === undefined + ? opt + : { ...opt, hint: stylePromptHint(opt.hint) }, ), }); diff --git a/src/commands/uninstall.ts b/src/commands/uninstall.ts index e0ee090e9..523a1972e 100644 --- a/src/commands/uninstall.ts +++ b/src/commands/uninstall.ts @@ -1,12 +1,26 @@ -import { cancel, confirm, isCancel, multiselect } from "@clack/prompts"; import path from "node:path"; +import { cancel, confirm, isCancel, multiselect } from "@clack/prompts"; -import { loadConfig, resolveConfigPath, resolveOAuthDir, resolveStateDir, isNixMode } from "../config/config.js"; +import { + isNixMode, + loadConfig, + resolveConfigPath, + resolveOAuthDir, + resolveStateDir, +} from "../config/config.js"; import { resolveGatewayService } from "../daemon/service.js"; import type { RuntimeEnv } from "../runtime.js"; -import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js"; +import { + stylePromptHint, + stylePromptMessage, + stylePromptTitle, +} from "../terminal/prompt-style.js"; import { resolveHomeDir } from "../utils.js"; -import { collectWorkspaceDirs, isPathWithin, removePath } from "./cleanup-utils.js"; +import { + collectWorkspaceDirs, + isPathWithin, + removePath, +} from "./cleanup-utils.js"; type UninstallScope = "service" | "state" | "workspace" | "app"; @@ -21,14 +35,14 @@ export type UninstallOptions = { dryRun?: boolean; }; -const multiselectStyled = ( - params: Parameters>[0], -) => +const multiselectStyled = (params: Parameters>[0]) => multiselect({ ...params, message: stylePromptMessage(params.message), options: params.options.map((opt) => - opt.hint === undefined ? opt : { ...opt, hint: stylePromptHint(opt.hint) }, + opt.hint === undefined + ? opt + : { ...opt, hint: stylePromptHint(opt.hint) }, ), }); @@ -101,7 +115,9 @@ export async function uninstallCommand( if (!hadExplicit) { if (!interactive) { - runtime.error("Non-interactive mode requires explicit scopes (use --all)."); + runtime.error( + "Non-interactive mode requires explicit scopes (use --all).", + ); runtime.exit(1); return; } @@ -115,12 +131,18 @@ export async function uninstallCommand( }, { value: "state", label: "State + config", hint: "~/.clawdbot" }, { value: "workspace", label: "Workspace", hint: "agent files" }, - { value: "app", label: "macOS app", hint: "/Applications/Clawdbot.app" }, + { + value: "app", + label: "macOS app", + hint: "/Applications/Clawdbot.app", + }, ], initialValues: ["service", "state", "workspace"], }); if (isCancel(selection)) { - cancel(stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled."); + cancel( + stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled.", + ); runtime.exit(0); return; } @@ -137,7 +159,9 @@ export async function uninstallCommand( message: stylePromptMessage("Proceed with uninstall?"), }); if (isCancel(ok) || !ok) { - cancel(stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled."); + cancel( + stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled.", + ); runtime.exit(0); return; } @@ -184,7 +208,10 @@ export async function uninstallCommand( if (scopes.has("state") && !scopes.has("workspace")) { const home = resolveHomeDir(); - if (home && workspaceDirs.some((dir) => dir.startsWith(path.resolve(home)))) { + if ( + home && + workspaceDirs.some((dir) => dir.startsWith(path.resolve(home))) + ) { runtime.log( "Tip: workspaces were preserved. Re-run with --workspace to remove them.", );