mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:38:28 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -38,17 +38,23 @@ function collectSkillBins(entries: SkillEntry[]): string[] {
|
||||
const install = entry.metadata?.install ?? [];
|
||||
for (const bin of required) {
|
||||
const trimmed = bin.trim();
|
||||
if (trimmed) bins.add(trimmed);
|
||||
if (trimmed) {
|
||||
bins.add(trimmed);
|
||||
}
|
||||
}
|
||||
for (const bin of anyBins) {
|
||||
const trimmed = bin.trim();
|
||||
if (trimmed) bins.add(trimmed);
|
||||
if (trimmed) {
|
||||
bins.add(trimmed);
|
||||
}
|
||||
}
|
||||
for (const spec of install) {
|
||||
const specBins = spec?.bins ?? [];
|
||||
for (const bin of specBins) {
|
||||
const trimmed = String(bin).trim();
|
||||
if (trimmed) bins.add(trimmed);
|
||||
if (trimmed) {
|
||||
bins.add(trimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +99,9 @@ export const skillsHandlers: GatewayRequestHandlers = {
|
||||
const bins = new Set<string>();
|
||||
for (const workspaceDir of workspaceDirs) {
|
||||
const entries = loadWorkspaceSkillEntries(workspaceDir, { config: cfg });
|
||||
for (const bin of collectSkillBins(entries)) bins.add(bin);
|
||||
for (const bin of collectSkillBins(entries)) {
|
||||
bins.add(bin);
|
||||
}
|
||||
}
|
||||
respond(true, { bins: [...bins].toSorted() }, undefined);
|
||||
},
|
||||
@@ -156,17 +164,25 @@ export const skillsHandlers: GatewayRequestHandlers = {
|
||||
}
|
||||
if (typeof p.apiKey === "string") {
|
||||
const trimmed = p.apiKey.trim();
|
||||
if (trimmed) current.apiKey = trimmed;
|
||||
else delete current.apiKey;
|
||||
if (trimmed) {
|
||||
current.apiKey = trimmed;
|
||||
} else {
|
||||
delete current.apiKey;
|
||||
}
|
||||
}
|
||||
if (p.env && typeof p.env === "object") {
|
||||
const nextEnv = current.env ? { ...current.env } : {};
|
||||
for (const [key, value] of Object.entries(p.env)) {
|
||||
const trimmedKey = key.trim();
|
||||
if (!trimmedKey) continue;
|
||||
if (!trimmedKey) {
|
||||
continue;
|
||||
}
|
||||
const trimmedVal = value.trim();
|
||||
if (!trimmedVal) delete nextEnv[trimmedKey];
|
||||
else nextEnv[trimmedKey] = trimmedVal;
|
||||
if (!trimmedVal) {
|
||||
delete nextEnv[trimmedKey];
|
||||
} else {
|
||||
nextEnv[trimmedKey] = trimmedVal;
|
||||
}
|
||||
}
|
||||
current.env = nextEnv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user