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

@@ -60,7 +60,9 @@ function candidateBinDirs(opts: EnsureOpenClawPathOpts): string[] {
try {
const execDir = path.dirname(execPath);
const siblingCli = path.join(execDir, "openclaw");
if (isExecutable(siblingCli)) candidates.push(execDir);
if (isExecutable(siblingCli)) {
candidates.push(execDir);
}
} catch {
// ignore
}
@@ -68,11 +70,15 @@ function candidateBinDirs(opts: EnsureOpenClawPathOpts): string[] {
// Project-local installs (best effort): if a `node_modules/.bin/openclaw` exists near cwd,
// include it. This helps when running under launchd or other minimal PATH environments.
const localBinDir = path.join(cwd, "node_modules", ".bin");
if (isExecutable(path.join(localBinDir, "openclaw"))) candidates.push(localBinDir);
if (isExecutable(path.join(localBinDir, "openclaw"))) {
candidates.push(localBinDir);
}
const miseDataDir = process.env.MISE_DATA_DIR ?? path.join(homeDir, ".local", "share", "mise");
const miseShims = path.join(miseDataDir, "shims");
if (isDirectory(miseShims)) candidates.push(miseShims);
if (isDirectory(miseShims)) {
candidates.push(miseShims);
}
candidates.push(...resolveBrewPathDirs({ homeDir }));
@@ -80,7 +86,9 @@ function candidateBinDirs(opts: EnsureOpenClawPathOpts): string[] {
if (platform === "darwin") {
candidates.push(path.join(homeDir, "Library", "pnpm"));
}
if (process.env.XDG_BIN_HOME) candidates.push(process.env.XDG_BIN_HOME);
if (process.env.XDG_BIN_HOME) {
candidates.push(process.env.XDG_BIN_HOME);
}
candidates.push(path.join(homeDir, ".local", "bin"));
candidates.push(path.join(homeDir, ".local", "share", "pnpm"));
candidates.push(path.join(homeDir, ".bun", "bin"));
@@ -102,8 +110,12 @@ export function ensureOpenClawCliOnPath(opts: EnsureOpenClawPathOpts = {}) {
const existing = opts.pathEnv ?? process.env.PATH ?? "";
const prepend = candidateBinDirs(opts);
if (prepend.length === 0) return;
if (prepend.length === 0) {
return;
}
const merged = mergePath({ existing, prepend });
if (merged) process.env.PATH = merged;
if (merged) {
process.env.PATH = merged;
}
}