chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -8,7 +8,9 @@ import { detectBinary, resolveNodeManagerOptions } from "./onboard-helpers.js";
function summarizeInstallFailure(message: string): string | undefined {
const cleaned = message.replace(/^Install failed(?:\s*\([^)]*\))?\s*:?\s*/i, "").trim();
if (!cleaned) return undefined;
if (!cleaned) {
return undefined;
}
const maxLen = 140;
return cleaned.length > maxLen ? `${cleaned.slice(0, maxLen - 1)}` : cleaned;
}
@@ -20,7 +22,9 @@ function formatSkillHint(skill: {
const desc = skill.description?.trim();
const installLabel = skill.install[0]?.label?.trim();
const combined = desc && installLabel ? `${desc}${installLabel}` : desc || installLabel;
if (!combined) return "install";
if (!combined) {
return "install";
}
const maxLen = 90;
return combined.length > maxLen ? `${combined.slice(0, maxLen - 1)}` : combined;
}
@@ -71,7 +75,9 @@ export async function setupSkills(
message: "Configure skills now? (recommended)",
initialValue: true,
});
if (!shouldConfigure) return cfg;
if (!shouldConfigure) {
return cfg;
}
if (needsBrewPrompt) {
await prompter.note(
@@ -135,9 +141,13 @@ export async function setupSkills(
const selected = toInstall.filter((name) => name !== "__skip__");
for (const name of selected) {
const target = installable.find((s) => s.name === name);
if (!target || target.install.length === 0) continue;
if (!target || target.install.length === 0) {
continue;
}
const installId = target.install[0]?.id;
if (!installId) continue;
if (!installId) {
continue;
}
const spin = prompter.progress(`Installing ${name}`);
const result = await installSkill({
workspaceDir,
@@ -151,8 +161,11 @@ export async function setupSkills(
const code = result.code == null ? "" : ` (exit ${result.code})`;
const detail = summarizeInstallFailure(result.message);
spin.stop(`Install failed: ${name}${code}${detail ? `${detail}` : ""}`);
if (result.stderr) runtime.log(result.stderr.trim());
else if (result.stdout) runtime.log(result.stdout.trim());
if (result.stderr) {
runtime.log(result.stderr.trim());
} else if (result.stdout) {
runtime.log(result.stdout.trim());
}
runtime.log(
`Tip: run \`${formatCliCommand("openclaw doctor")}\` to review skills + requirements.`,
);
@@ -162,12 +175,16 @@ export async function setupSkills(
}
for (const skill of missing) {
if (!skill.primaryEnv || skill.missing.env.length === 0) continue;
if (!skill.primaryEnv || skill.missing.env.length === 0) {
continue;
}
const wantsKey = await prompter.confirm({
message: `Set ${skill.primaryEnv} for ${skill.name}?`,
initialValue: false,
});
if (!wantsKey) continue;
if (!wantsKey) {
continue;
}
const apiKey = String(
await prompter.text({
message: `Enter ${skill.primaryEnv}`,