chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -60,12 +60,8 @@ export async function resolveNonInteractiveApiKey(params: {
}
const profileHint =
params.allowProfile === false
? ""
: `, or existing ${params.provider} API-key profile`;
params.runtime.error(
`Missing ${params.flagName} (or ${params.envVar} in env${profileHint}).`,
);
params.allowProfile === false ? "" : `, or existing ${params.provider} API-key profile`;
params.runtime.error(`Missing ${params.flagName} (or ${params.envVar} in env${profileHint}).`);
params.runtime.exit(1);
return null;
}

View File

@@ -1,9 +1,5 @@
import type { ClawdbotConfig } from "../../config/config.js";
import {
CONFIG_PATH_CLAWDBOT,
resolveGatewayPort,
writeConfigFile,
} from "../../config/config.js";
import { CONFIG_PATH_CLAWDBOT, resolveGatewayPort, writeConfigFile } from "../../config/config.js";
import type { RuntimeEnv } from "../../runtime.js";
import { sleep } from "../../utils.js";
import { DEFAULT_GATEWAY_DAEMON_RUNTIME } from "../daemon-runtime.js";

View File

@@ -9,10 +9,7 @@ import { parseDurationMs } from "../../../cli/parse-duration.js";
import type { ClawdbotConfig } from "../../../config/config.js";
import { upsertSharedEnvVar } from "../../../infra/env-file.js";
import type { RuntimeEnv } from "../../../runtime.js";
import {
buildTokenProfileId,
validateAnthropicSetupToken,
} from "../../auth-token.js";
import { buildTokenProfileId, validateAnthropicSetupToken } from "../../auth-token.js";
import { applyGoogleGeminiModelDefault } from "../../google-gemini-model-default.js";
import {
applyAuthProfileConfig,
@@ -73,9 +70,7 @@ export async function applyNonInteractiveAuthChoice(params: {
}
const provider = normalizeProviderId(providerRaw);
if (provider !== "anthropic") {
runtime.error(
"Only --token-provider anthropic is supported for --auth-choice token.",
);
runtime.error("Only --token-provider anthropic is supported for --auth-choice token.");
runtime.exit(1);
return null;
}
@@ -96,8 +91,7 @@ export async function applyNonInteractiveAuthChoice(params: {
const expiresInRaw = opts.tokenExpiresIn?.trim();
if (expiresInRaw) {
try {
expires =
Date.now() + parseDurationMs(expiresInRaw, { defaultUnit: "d" });
expires = Date.now() + parseDurationMs(expiresInRaw, { defaultUnit: "d" });
} catch (err) {
runtime.error(`Invalid --token-expires-in: ${String(err)}`);
runtime.exit(1);
@@ -105,9 +99,7 @@ export async function applyNonInteractiveAuthChoice(params: {
}
}
const profileId =
opts.tokenProfileId?.trim() ||
buildTokenProfileId({ provider, name: "" });
const profileId = opts.tokenProfileId?.trim() || buildTokenProfileId({ provider, name: "" });
upsertAuthProfile({
profileId,
credential: {
@@ -258,9 +250,7 @@ export async function applyNonInteractiveAuthChoice(params: {
mode: "api_key",
});
const modelId =
authChoice === "minimax-api-lightning"
? "MiniMax-M2.1-lightning"
: "MiniMax-M2.1";
authChoice === "minimax-api-lightning" ? "MiniMax-M2.1-lightning" : "MiniMax-M2.1";
return applyMinimaxApiConfig(nextConfig, modelId);
}

View File

@@ -12,10 +12,7 @@ import { resolveGatewayService } from "../../../daemon/service.js";
import { buildServiceEnvironment } from "../../../daemon/service-env.js";
import { isSystemdUserServiceAvailable } from "../../../daemon/systemd.js";
import type { RuntimeEnv } from "../../../runtime.js";
import {
DEFAULT_GATEWAY_DAEMON_RUNTIME,
isGatewayDaemonRuntime,
} from "../../daemon-runtime.js";
import { DEFAULT_GATEWAY_DAEMON_RUNTIME, isGatewayDaemonRuntime } from "../../daemon-runtime.js";
import type { OnboardOptions } from "../../onboard-types.js";
import { ensureSystemdUserLingerNonInteractive } from "../../systemd-linger.js";
@@ -33,9 +30,7 @@ export async function installGatewayDaemonNonInteractive(params: {
const systemdAvailable =
process.platform === "linux" ? await isSystemdUserServiceAvailable() : true;
if (process.platform === "linux" && !systemdAvailable) {
runtime.log(
"Systemd user services are unavailable; skipping daemon install.",
);
runtime.log("Systemd user services are unavailable; skipping daemon install.");
return;
}
@@ -47,19 +42,17 @@ export async function installGatewayDaemonNonInteractive(params: {
const service = resolveGatewayService();
const devMode =
process.argv[1]?.includes(`${path.sep}src${path.sep}`) &&
process.argv[1]?.endsWith(".ts");
process.argv[1]?.includes(`${path.sep}src${path.sep}`) && process.argv[1]?.endsWith(".ts");
const nodePath = await resolvePreferredNodePath({
env: process.env,
runtime: daemonRuntimeRaw,
});
const { programArguments, workingDirectory } =
await resolveGatewayProgramArguments({
port,
dev: devMode,
runtime: daemonRuntimeRaw,
nodePath,
});
const { programArguments, workingDirectory } = await resolveGatewayProgramArguments({
port,
dev: devMode,
runtime: daemonRuntimeRaw,
nodePath,
});
if (daemonRuntimeRaw === "node") {
const systemNode = await resolveSystemNodeInfo({ env: process.env });

View File

@@ -20,18 +20,13 @@ export function applyNonInteractiveGatewayConfig(params: {
const { opts, runtime } = params;
const hasGatewayPort = opts.gatewayPort !== undefined;
if (
hasGatewayPort &&
(!Number.isFinite(opts.gatewayPort) || (opts.gatewayPort ?? 0) <= 0)
) {
if (hasGatewayPort && (!Number.isFinite(opts.gatewayPort) || (opts.gatewayPort ?? 0) <= 0)) {
runtime.error("Invalid --gateway-port");
runtime.exit(1);
return null;
}
const port = hasGatewayPort
? (opts.gatewayPort as number)
: params.defaultPort;
const port = hasGatewayPort ? (opts.gatewayPort as number) : params.defaultPort;
let bind = opts.gatewayBind ?? "loopback";
let authMode = opts.gatewayAuth ?? "token";
const tailscaleMode = opts.tailscale ?? "off";
@@ -43,8 +38,7 @@ export function applyNonInteractiveGatewayConfig(params: {
// - If using Tailscale Funnel, require password auth.
if (tailscaleMode !== "off" && bind !== "loopback") bind = "loopback";
if (authMode === "off" && bind !== "loopback") authMode = "token";
if (tailscaleMode === "funnel" && authMode !== "password")
authMode = "password";
if (tailscaleMode === "funnel" && authMode !== "password") authMode = "password";
let nextConfig = params.nextConfig;
let gatewayToken = opts.gatewayToken?.trim() || undefined;