refactor: normalize cli command hints

This commit is contained in:
Peter Steinberger
2026-01-20 07:42:21 +00:00
parent 11b9b6dba5
commit 6d5195c890
106 changed files with 521 additions and 220 deletions

View File

@@ -4,6 +4,7 @@ import { createExecTool } from "../../agents/bash-tools.js";
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
import { killProcessTree } from "../../agents/shell-utils.js";
import type { ClawdbotConfig } from "../../config/config.js";
import { formatCliCommand } from "../../cli/command-format.js";
import { logVerbose } from "../../globals.js";
import { clampInt } from "../../utils.js";
import type { MsgContext } from "../templating.js";
@@ -167,7 +168,9 @@ function formatElevatedUnavailableMessage(params: {
lines.push("- agents.list[].tools.elevated.enabled");
lines.push("- agents.list[].tools.elevated.allowFrom.<provider>");
if (params.sessionKey) {
lines.push(`See: clawdbot sandbox explain --session ${params.sessionKey}`);
lines.push(
`See: ${formatCliCommand(`clawdbot sandbox explain --session ${params.sessionKey}`)}`,
);
}
return lines.join("\n");
}

View File

@@ -1,3 +1,4 @@
import { formatCliCommand } from "../../cli/command-format.js";
import type { ElevatedLevel, ReasoningLevel } from "./directives.js";
export const SYSTEM_MARK = "⚙️";
@@ -44,7 +45,9 @@ export function formatElevatedUnavailableText(params: {
);
}
if (params.sessionKey) {
lines.push(`See: clawdbot sandbox explain --session ${params.sessionKey}`);
lines.push(
`See: ${formatCliCommand(`clawdbot sandbox explain --session ${params.sessionKey}`)}`,
);
}
return lines.join("\n");
}

View File

@@ -4,6 +4,7 @@ import { normalizeChannelId } from "../../channels/plugins/index.js";
import { CHAT_CHANNEL_ORDER } from "../../channels/registry.js";
import type { AgentElevatedAllowFromConfig, ClawdbotConfig } from "../../config/config.js";
import { INTERNAL_MESSAGE_CHANNEL } from "../../utils/message-channel.js";
import { formatCliCommand } from "../../cli/command-format.js";
import type { MsgContext } from "../templating.js";
function normalizeAllowToken(value?: string) {
@@ -187,7 +188,9 @@ export function formatElevatedUnavailableMessage(params: {
lines.push("- agents.list[].tools.elevated.enabled");
lines.push("- agents.list[].tools.elevated.allowFrom.<provider>");
if (params.sessionKey) {
lines.push(`See: clawdbot sandbox explain --session ${params.sessionKey}`);
lines.push(
`See: ${formatCliCommand(`clawdbot sandbox explain --session ${params.sessionKey}`)}`,
);
}
return lines.join("\n");
}