Documentation
¶
Overview ¶
Package shell implements the shell tool: bash -c execution with timeout and output truncation. No sandboxing here — slice 1F adds that layer.
non-login non-interactive bash skips ~/.bash_profile and ~/.bashrc to avoid tripping over user rc files that misbehave under sandbox.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a shell tool with no approval gating. Use NewWithApprover to enable the dangerous-pattern prompt flow.
func NewWithApprover ¶
NewWithApprover returns a shell tool that consults app before running any command flagged by safety.DetectDangerous. A Deny verdict aborts execution and returns an explanatory IsError result.
Types ¶
type Options ¶
Options configures shell behavior beyond approval gating.
UseUserRC sources the user's interactive rc file (.zshrc / .bashrc) before each command so aliases and shell functions are available. Default false preserves the hermetic shape. Shell and RCFile override autodetection (autodetect = $SHELL → ~/.zshrc or ~/.bashrc).
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool is the shell executor.
approver, when non-nil, is consulted whenever safety.DetectDangerous flags the command. nil approver = no gating (legacy behavior). Hardline checks in safety.CheckShellCommand always run regardless of approver.