environment

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_PROMPT = "gsh> "
)

Variables

This section is empty.

Functions

func AppendToAuthorizedCommands

func AppendToAuthorizedCommands(commandRegex string) error

AppendToAuthorizedCommands appends a command regex to the authorized_commands file

func GetAgentContextWindowTokens

func GetAgentContextWindowTokens(runner *interp.Runner, logger *zap.Logger) int

func GetAgentMacros

func GetAgentMacros(runner *interp.Runner, logger *zap.Logger) map[string]string

func GetApprovedBashCommandRegex

func GetApprovedBashCommandRegex(runner *interp.Runner, logger *zap.Logger) []string

func GetAuthorizedCommandsFileForTesting

func GetAuthorizedCommandsFileForTesting() string

func GetConfigDirForTesting

func GetConfigDirForTesting() string

Helper functions for testing

func GetContextNumHistoryConcise

func GetContextNumHistoryConcise(runner *interp.Runner, logger *zap.Logger) int

func GetContextNumHistoryVerbose

func GetContextNumHistoryVerbose(runner *interp.Runner, logger *zap.Logger) int

func GetContextTypesForAgent

func GetContextTypesForAgent(runner *interp.Runner, logger *zap.Logger) []string

func GetContextTypesForExplanation

func GetContextTypesForExplanation(runner *interp.Runner, logger *zap.Logger) []string

func GetContextTypesForPredictionWithPrefix

func GetContextTypesForPredictionWithPrefix(runner *interp.Runner, logger *zap.Logger) []string

func GetContextTypesForPredictionWithoutPrefix

func GetContextTypesForPredictionWithoutPrefix(runner *interp.Runner, logger *zap.Logger) []string

func GetHistoryContextLimit

func GetHistoryContextLimit(runner *interp.Runner, logger *zap.Logger) int

func GetHomeDir

func GetHomeDir(runner *interp.Runner) string

func GetLogLevel

func GetLogLevel(runner *interp.Runner) zap.AtomicLevel

func GetMinimumLines

func GetMinimumLines(runner *interp.Runner, logger *zap.Logger) int

func GetPwd

func GetPwd(runner *interp.Runner) string

func IsCommandAuthorized

func IsCommandAuthorized(command string) (bool, error)

IsCommandAuthorized checks if a command matches any of the authorized patterns

func IsCommandPatternAuthorized

func IsCommandPatternAuthorized(commandPattern string) (bool, error)

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

func LoadAuthorizedCommandsFromFile() ([]string, error)

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 ShouldCleanLogFile

func ShouldCleanLogFile(runner *interp.Runner) bool

func WriteAuthorizedCommandsToFile

func WriteAuthorizedCommandsToFile(patterns []string) error

WriteAuthorizedCommandsToFile writes a list of regex patterns to the authorized_commands file This replaces the entire file content and deduplicates entries

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL