Documentation
¶
Index ¶
- Constants
- func AppendToAuthorizedCommands(commandRegex string) error
- func GetAgentContextWindowTokens(runner *interp.Runner, logger *zap.Logger) int
- func GetAgentMacros(runner *interp.Runner, logger *zap.Logger) map[string]string
- func GetAgentName(runner *interp.Runner) string
- func GetAgentPrompt(runner *interp.Runner) string
- func GetApprovedBashCommandRegex(runner *interp.Runner, logger *zap.Logger) []string
- func GetAssistantHeight(runner *interp.Runner, logger *zap.Logger) int
- func GetAuthorizedCommandsFileForTesting() string
- func GetConfigDirForTesting() string
- func GetContextNumHistoryConcise(runner *interp.Runner, logger *zap.Logger) int
- func GetContextNumHistoryVerbose(runner *interp.Runner, logger *zap.Logger) int
- func GetContextTypesForAgent(runner *interp.Runner, logger *zap.Logger) []string
- func GetContextTypesForExplanation(runner *interp.Runner, logger *zap.Logger) []string
- func GetContextTypesForPredictionWithPrefix(runner *interp.Runner, logger *zap.Logger) []string
- func GetContextTypesForPredictionWithoutPrefix(runner *interp.Runner, logger *zap.Logger) []string
- func GetDefaultToYes(runner *interp.Runner) bool
- func GetHistoryContextLimit(runner *interp.Runner, logger *zap.Logger) int
- func GetHistorySize(runner *interp.Runner, logger *zap.Logger) int
- func GetHomeDir(runner *interp.Runner) string
- func GetIdleSummaryTimeout(runner *interp.Runner, logger *zap.Logger) int
- func GetLogLevel(runner *interp.Runner) zap.AtomicLevel
- func GetPrompt(ctx context.Context, runner *interp.Runner, logger *zap.Logger) string
- func GetPwd(runner *interp.Runner) string
- func GetUser(runner *interp.Runner) string
- func IsAutocdEnabled(runner *interp.Runner) bool
- func IsAutocdVerbose(runner *interp.Runner) bool
- func IsBishVariable(name string) bool
- func IsCommandAuthorized(command string) (bool, error)
- func IsCommandPatternAuthorized(commandPattern string) (bool, error)
- func LoadAuthorizedCommandsFromFile() ([]string, error)
- func ResetCacheForTesting()
- func SetAuthorizedCommandsFileForTesting(file string)
- func SetConfigDirForTesting(dir string)
- func SetSessionConfigOverrideGetter(getter func(key string) (string, bool))
- func ShouldCleanLogFile(runner *interp.Runner) bool
- func SyncVariableToEnv(runner *interp.Runner, varName string)
- func SyncVariablesToEnv(runner *interp.Runner)
- func ValidateAssistantHeight(value string) error
- func ValidateBaseURL(value string) error
- func ValidateConfigValue(envVar, value string) error
- func WriteAuthorizedCommandsToFile(patterns []string) error
- type DynamicEnviron
- type ValidationError
Constants ¶
const ( DEFAULT_PROMPT = "bish> " DEFAULT_AGENT_PROMPT = "🤖> " )
Variables ¶
This section is empty.
Functions ¶
func AppendToAuthorizedCommands ¶
AppendToAuthorizedCommands appends a command regex to the authorized_commands file
func GetAgentMacros ¶
func GetAgentName ¶
GetAgentName returns the name of the active subagent or defaults to "bish"
func GetAgentPrompt ¶
GetAgentPrompt returns the prompt to use when the agent displays commands If BISH_APROMPT is set, it uses that; otherwise uses DEFAULT_AGENT_PROMPT to differentiate agent commands from user commands
func GetAuthorizedCommandsFileForTesting ¶
func GetAuthorizedCommandsFileForTesting() string
func GetContextTypesForAgent ¶
func GetDefaultToYes ¶
GetDefaultToYes returns whether prompts should default to "yes" when Enter is pressed. When true, prompts display Y/n and Enter confirms. When false, prompts display y/N and Enter denies.
func GetHistoryContextLimit ¶
func GetHistorySize ¶ added in v0.30.0
GetHistorySize returns the number of history entries to display for Up/Down navigation. Defaults to 1024 if not set or invalid.
func GetHomeDir ¶
func GetIdleSummaryTimeout ¶
GetIdleSummaryTimeout returns the idle summary timeout in seconds. Returns 0 if disabled, otherwise defaults to 60 seconds.
func GetLogLevel ¶
func GetLogLevel(runner *interp.Runner) zap.AtomicLevel
func IsAutocdEnabled ¶ added in v0.30.0
IsAutocdEnabled checks if BISH_AUTOCD is enabled Autocd allows users to change directories by typing just the path
func IsAutocdVerbose ¶ added in v0.30.0
IsAutocdVerbose checks if BISH_AUTOCD_VERBOSE is enabled When enabled, prints "cd <path>" when autocd triggers
func IsBishVariable ¶
IsBishVariable checks if a variable name is a bish-specific variable that should be synced
func IsCommandAuthorized ¶
IsCommandAuthorized checks if a command matches any of the authorized patterns
func IsCommandPatternAuthorized ¶
IsCommandPatternAuthorized checks if a specific command pattern already exists in the authorized_commands file This is used for pre-selecting permissions in the menu - only exact pattern matches should be pre-selected
func LoadAuthorizedCommandsFromFile ¶
LoadAuthorizedCommandsFromFile loads authorized command regex patterns from file
func ResetCacheForTesting ¶
func ResetCacheForTesting()
ResetCacheForTesting resets the authorized commands cache for testing
func SetAuthorizedCommandsFileForTesting ¶
func SetAuthorizedCommandsFileForTesting(file string)
func SetConfigDirForTesting ¶
func SetConfigDirForTesting(dir string)
func SetSessionConfigOverrideGetter ¶
SetSessionConfigOverrideGetter sets the function to get session config overrides
func ShouldCleanLogFile ¶
func SyncVariableToEnv ¶
SyncVariableToEnv syncs a single bish variable to system environment
func SyncVariablesToEnv ¶
SyncVariablesToEnv syncs bish's internal variables to system environment variables This makes variables like BISH_PROMPT visible to external commands like 'env'
func ValidateAssistantHeight ¶ added in v0.30.0
ValidateAssistantHeight validates the assistant height value. Returns nil if valid, or a ValidationError with a descriptive message.
func ValidateBaseURL ¶ added in v0.30.0
ValidateBaseURL validates a base URL value. Returns nil if valid, or a ValidationError with a descriptive message. Empty values are allowed (optional field).
func ValidateConfigValue ¶ added in v0.30.0
ValidateConfigValue validates a configuration value based on its environment variable name. Returns nil if valid, or a ValidationError with a descriptive message.
func WriteAuthorizedCommandsToFile ¶
WriteAuthorizedCommandsToFile writes a list of regex patterns to the authorized_commands file This replaces the entire file content and deduplicates entries
Types ¶
type DynamicEnviron ¶
type DynamicEnviron struct {
// contains filtered or unexported fields
}
DynamicEnviron implements expand.Environ to provide a dynamic environment that includes both system environment variables and BISH-specific variables
func NewDynamicEnviron ¶
func NewDynamicEnviron() *DynamicEnviron
NewDynamicEnviron creates a new DynamicEnviron that wraps the system environment and adds BISH-specific variables
func (*DynamicEnviron) Each ¶
func (de *DynamicEnviron) Each(fn func(name string, vr expand.Variable) bool)
Each iterates over all variables, including both GSH and system variables
func (*DynamicEnviron) Get ¶
func (de *DynamicEnviron) Get(name string) expand.Variable
Get retrieves a variable by name, checking GSH variables first, then system environment
func (*DynamicEnviron) UpdateBishVar ¶
func (de *DynamicEnviron) UpdateBishVar(name, value string)
UpdateBishVar updates a BISH variable in the dynamic environment
func (*DynamicEnviron) UpdateSystemEnv ¶
func (de *DynamicEnviron) UpdateSystemEnv()
UpdateSystemEnv updates the system environment wrapper
type ValidationError ¶ added in v0.30.0
ValidationError represents an input validation error with a user-friendly message
func (*ValidationError) Error ¶ added in v0.30.0
func (e *ValidationError) Error() string