Documentation
¶
Index ¶
- func CreateTempAuthDir() (string, error)
- func EscapePowerShellArg(arg string) string
- func ExecCommand(name string, arg ...string) *exec.Cmd
- func GenerateWrapperScript(authDir, tokenPath, claudePath string, claudeArgs []string) (string, bool, error)
- func WriteTempTokenFile(authDir, token string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTempAuthDir ¶
CreateTempAuthDir creates a private temporary directory for storing auth files. The directory is created with 0700 permissions (owner only) to ensure security. Returns the path to the temporary directory.
func EscapePowerShellArg ¶
EscapePowerShellArg escapes a string for use as a PowerShell argument. It wraps the argument in single quotes and escapes special characters to prevent command injection. Special characters escaped: backtick, dollar sign, double quote, single quote, and common control characters (newline, carriage return, tab, etc.). Note: Some escape sequences like `v (vertical tab) and `f (form feed) are not supported in older PowerShell versions (5.1 and below), so we only escape commonly supported control characters.
func ExecCommand ¶
ExecCommand wraps exec.Command for testability.
func GenerateWrapperScript ¶
func GenerateWrapperScript(authDir, tokenPath, claudePath string, claudeArgs []string) (string, bool, error)
GenerateWrapperScript creates a temporary script that reads the API key from the token file, sets ANTHROPIC_AUTH_TOKEN environment variable, cleans up the token file, and executes the claude command with the provided arguments. Returns the path to the wrapper script and whether to use shell execution.
func WriteTempTokenFile ¶
WriteTempTokenFile creates a temporary file with the API key content. The file is created with 0600 permissions (owner read/write only) to ensure security. Returns the path to the temporary file.
Types ¶
This section is empty.