style: biome fixes
This commit is contained in:
@@ -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 = <T>(
|
||||
params: Parameters<typeof multiselect<T>>[0],
|
||||
) =>
|
||||
const multiselectStyled = <T>(params: Parameters<typeof multiselect<T>>[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.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user