data/tools/bash_tool_full library

Classes

BashSecurityCheck
Dangerous shell patterns that should be blocked or warned about.
BashToolInput
Bash tool input.
BashToolOutput
Bash tool output.
CwdTracker
Working directory tracker for shell sessions.
SandboxConfig
Sandbox configuration.
SecurityCheckResult
Result of security validation.
ShellExecOptions
Shell execution options.

Constants

maxOutputLength → const int
Maximum output length before truncation.
maxPersistedOutputSize → const int
Maximum persisted output size.

Functions

checkPathSafety(String command) → ({bool isDangerous, String? reason})
Check if a command attempts dangerous path operations.
classifyCommand(String command) → ({bool isList, bool isRead, bool isSearch})
Search/read/list classification for UI display.
executeCommand(BashToolInput input, {ShellExecOptions options = const ShellExecOptions(), SandboxConfig sandbox = const SandboxConfig()}) Future<BashToolOutput>
Execute a shell command with full BashTool semantics.
extractCommentLabel(String command) String?
Extract comment label from first line of command.
extractHeredocBaseCommand(String command) String?
Extract the base command from a heredoc.
hasRestrictedFds(String command) bool
Check if a command uses restricted file descriptors.
interpretExitCode(String command, int exitCode) String?
Semantic exit code interpretation.
isImageOutput(String output) bool
Detect if output contains a base64 data URI image.
isReadOnlyCommand(String command) → ({bool isSafe, String? reason})
Check if a command is safe in read-only mode.
isSafeHeredoc(String command) bool
Check if a heredoc is safe (delimiter is quoted/escaped).
isSilentCommand(String command) bool
Check if a command is expected to be silent.
matchesPermissionRule(String command, String rulePattern) bool
Check if a command matches a permission rule pattern.
shouldUseSandbox(String command, SandboxConfig config) bool
Check if a command should use sandbox.
stripAnsi(String text) String
Strip ANSI escape sequences from text.
stripEmptyLines(String output) String
Strip empty leading/trailing lines (preserve internal whitespace).
stripSafeWrappers(String command) String
Strip safe wrappers and env vars from a command for permission checking.
suggestPermissionRule(String command) String
Suggest a permission rule for a command.
targetsDangerousFile(String command, String filePath) bool
Check if a command targets a dangerous file.
truncateOutput(String output, {int maxLength = maxOutputLength}) String
Truncate command output if too long.
validateCommandSecurity(String command) SecurityCheckResult
Validate a command for security issues.