mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:24:35 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -11,10 +11,7 @@ import {
|
||||
writeConfigFile,
|
||||
} from "../../config/config.js";
|
||||
|
||||
export const ensureFlagCompatibility = (opts: {
|
||||
json?: boolean;
|
||||
plain?: boolean;
|
||||
}) => {
|
||||
export const ensureFlagCompatibility = (opts: { json?: boolean; plain?: boolean }) => {
|
||||
if (opts.json && opts.plain) {
|
||||
throw new Error("Choose either --json or --plain, not both.");
|
||||
}
|
||||
@@ -38,9 +35,7 @@ export async function updateConfig(
|
||||
): Promise<ClawdbotConfig> {
|
||||
const snapshot = await readConfigFileSnapshot();
|
||||
if (!snapshot.valid) {
|
||||
const issues = snapshot.issues
|
||||
.map((issue) => `- ${issue.path}: ${issue.message}`)
|
||||
.join("\n");
|
||||
const issues = snapshot.issues.map((issue) => `- ${issue.path}: ${issue.message}`).join("\n");
|
||||
throw new Error(`Invalid config at ${snapshot.path}\n${issues}`);
|
||||
}
|
||||
const next = mutator(snapshot.config);
|
||||
@@ -48,10 +43,10 @@ export async function updateConfig(
|
||||
return next;
|
||||
}
|
||||
|
||||
export function resolveModelTarget(params: {
|
||||
raw: string;
|
||||
cfg: ClawdbotConfig;
|
||||
}): { provider: string; model: string } {
|
||||
export function resolveModelTarget(params: { raw: string; cfg: ClawdbotConfig }): {
|
||||
provider: string;
|
||||
model: string;
|
||||
} {
|
||||
const aliasIndex = buildModelAliasIndex({
|
||||
cfg: params.cfg,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
@@ -82,9 +77,7 @@ export function normalizeAlias(alias: string): string {
|
||||
const trimmed = alias.trim();
|
||||
if (!trimmed) throw new Error("Alias cannot be empty.");
|
||||
if (!/^[A-Za-z0-9_.:-]+$/.test(trimmed)) {
|
||||
throw new Error(
|
||||
"Alias must use letters, numbers, dots, underscores, colons, or dashes.",
|
||||
);
|
||||
throw new Error("Alias must use letters, numbers, dots, underscores, colons, or dashes.");
|
||||
}
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user