chore: Enable more lint rules, disable some that trigger a lot. Will clean up later.

This commit is contained in:
cpojer
2026-01-31 16:03:28 +09:00
parent 481f696a87
commit 15792b153f
292 changed files with 643 additions and 699 deletions

View File

@@ -22,7 +22,7 @@ function guardCancel<T>(value: T | symbol): T {
cancel(stylePromptTitle("Setup cancelled.") ?? "Setup cancelled.");
throw new WizardCancelledError();
}
return value as T;
return value;
}
export function createClackPrompter(): WizardPrompter {

View File

@@ -111,12 +111,12 @@ export async function finalizeOnboardingWizard(options: FinalizeOnboardingOption
if (installDaemon) {
const daemonRuntime =
flow === "quickstart"
? (DEFAULT_GATEWAY_DAEMON_RUNTIME as GatewayDaemonRuntime)
: ((await prompter.select({
? DEFAULT_GATEWAY_DAEMON_RUNTIME
: await prompter.select({
message: "Gateway service runtime",
options: GATEWAY_DAEMON_RUNTIME_OPTIONS,
initialValue: opts.daemonRuntime ?? DEFAULT_GATEWAY_DAEMON_RUNTIME,
})) as GatewayDaemonRuntime);
});
if (flow === "quickstart") {
await prompter.note(
"QuickStart uses Node for the Gateway service (stable + supported).",
@@ -126,14 +126,14 @@ export async function finalizeOnboardingWizard(options: FinalizeOnboardingOption
const service = resolveGatewayService();
const loaded = await service.isLoaded({ env: process.env });
if (loaded) {
const action = (await prompter.select({
const action = await prompter.select({
message: "Gateway service already installed",
options: [
{ value: "restart", label: "Restart" },
{ value: "reinstall", label: "Reinstall" },
{ value: "skip", label: "Skip" },
],
})) as "restart" | "reinstall" | "skip";
});
if (action === "restart") {
await withWizardProgress(
"Gateway service",
@@ -158,7 +158,7 @@ export async function finalizeOnboardingWizard(options: FinalizeOnboardingOption
}
}
if (!loaded || (loaded && (await service.isLoaded({ env: process.env })) === false)) {
if (!loaded || (loaded && !(await service.isLoaded({ env: process.env })))) {
const progress = prompter.progress("Gateway service");
let installError: string | null = null;
try {
@@ -312,7 +312,7 @@ export async function finalizeOnboardingWizard(options: FinalizeOnboardingOption
"Token",
);
hatchChoice = (await prompter.select({
hatchChoice = await prompter.select({
message: "How do you want to hatch your bot?",
options: [
{ value: "tui", label: "Hatch in TUI (recommended)" },
@@ -320,7 +320,7 @@ export async function finalizeOnboardingWizard(options: FinalizeOnboardingOption
{ value: "later", label: "Do this later" },
],
initialValue: "tui",
})) as "tui" | "web" | "later";
});
if (hatchChoice === "tui") {
await runTui({

View File

@@ -45,10 +45,10 @@ export async function configureGatewayForOnboarding(
10,
);
let bind = (
let bind =
flow === "quickstart"
? quickstartGateway.bind
: ((await prompter.select({
: await prompter.select({
message: "Gateway bind",
options: [
{ value: "loopback", label: "Loopback (127.0.0.1)" },
@@ -57,8 +57,7 @@ export async function configureGatewayForOnboarding(
{ value: "auto", label: "Auto (Loopback → LAN)" },
{ value: "custom", label: "Custom IP" },
],
})) as "loopback" | "lan" | "auto" | "custom" | "tailnet")
) as "loopback" | "lan" | "auto" | "custom" | "tailnet";
});
let customBindHost = quickstartGateway.customBindHost;
if (bind === "custom") {
@@ -87,7 +86,7 @@ export async function configureGatewayForOnboarding(
}
}
let authMode = (
let authMode =
flow === "quickstart"
? quickstartGateway.authMode
: ((await prompter.select({
@@ -101,13 +100,12 @@ export async function configureGatewayForOnboarding(
{ value: "password", label: "Password" },
],
initialValue: "token",
})) as GatewayAuthChoice)
) as GatewayAuthChoice;
})) as GatewayAuthChoice);
const tailscaleMode = (
const tailscaleMode =
flow === "quickstart"
? quickstartGateway.tailscaleMode
: ((await prompter.select({
: await prompter.select({
message: "Tailscale exposure",
options: [
{ value: "off", label: "Off", hint: "No Tailscale exposure" },
@@ -122,8 +120,7 @@ export async function configureGatewayForOnboarding(
hint: "Public HTTPS via Tailscale Funnel (internet)",
},
],
})) as "off" | "serve" | "funnel")
) as "off" | "serve" | "funnel";
});
// Detect Tailscale binary before proceeding with serve/funnel setup.
if (tailscaleMode !== "off") {

View File

@@ -135,14 +135,14 @@ export async function runOnboardingWizard(
: undefined;
let flow: WizardFlow =
explicitFlow ??
((await prompter.select({
(await prompter.select({
message: "Onboarding mode",
options: [
{ value: "quickstart", label: "QuickStart", hint: quickstartHint },
{ value: "advanced", label: "Manual", hint: manualHint },
],
initialValue: "quickstart",
})) as "quickstart" | "advanced");
}));
if (opts.mode === "remote" && flow === "quickstart") {
await prompter.note(
@@ -155,14 +155,14 @@ export async function runOnboardingWizard(
if (snapshot.exists) {
await prompter.note(summarizeExistingConfig(baseConfig), "Existing config detected");
const action = (await prompter.select({
const action = await prompter.select({
message: "Config handling",
options: [
{ value: "keep", label: "Use existing values" },
{ value: "modify", label: "Update values" },
{ value: "reset", label: "Reset" },
],
})) as "keep" | "modify" | "reset";
});
if (action === "reset") {
const workspaceDefault = baseConfig.agents?.defaults?.workspace ?? DEFAULT_WORKSPACE;