mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:14:33 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -16,13 +16,23 @@ import { normalizeToolName } from "./tool-policy.js";
|
||||
|
||||
function extendExecMeta(toolName: string, args: unknown, meta?: string): string | undefined {
|
||||
const normalized = toolName.trim().toLowerCase();
|
||||
if (normalized !== "exec" && normalized !== "bash") return meta;
|
||||
if (!args || typeof args !== "object") return meta;
|
||||
if (normalized !== "exec" && normalized !== "bash") {
|
||||
return meta;
|
||||
}
|
||||
if (!args || typeof args !== "object") {
|
||||
return meta;
|
||||
}
|
||||
const record = args as Record<string, unknown>;
|
||||
const flags: string[] = [];
|
||||
if (record.pty === true) flags.push("pty");
|
||||
if (record.elevated === true) flags.push("elevated");
|
||||
if (flags.length === 0) return meta;
|
||||
if (record.pty === true) {
|
||||
flags.push("pty");
|
||||
}
|
||||
if (record.elevated === true) {
|
||||
flags.push("elevated");
|
||||
}
|
||||
if (flags.length === 0) {
|
||||
return meta;
|
||||
}
|
||||
const suffix = flags.join(" · ");
|
||||
return meta ? `${meta} · ${suffix}` : suffix;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user