Documentation
¶
Overview ¶
Package claudecode manages Claude Code CLI installation and launching.
Index ¶
- func ParseClaudeArgs(args []string) (claspArgs, claudeArgs []string)
- func RunWithClaudeCode(cfg ProxyLaunchConfig) error
- func SpawnProxyBackground(port int, provider, model string) (*exec.Cmd, error)
- type InstallOptions
- type InstallStatus
- type LaunchOptions
- type Manager
- func (m *Manager) CacheStatus(status *InstallStatus) error
- func (m *Manager) CheckForUpdates(currentVersion string) (bool, string, error)
- func (m *Manager) CheckInstallation() (*InstallStatus, error)
- func (m *Manager) EnsureInstalled() (*InstallStatus, error)
- func (m *Manager) GetLatestVersion() (string, error)
- func (m *Manager) Install() error
- func (m *Manager) Launch(opts LaunchOptions) error
- func (m *Manager) LaunchWithProxy(proxyPort int, opts LaunchOptions) error
- func (m *Manager) LoadCachedStatus() (*InstallStatus, error)
- func (m *Manager) SetInstallOptions(opts InstallOptions)
- func (m *Manager) Update() error
- type ProxyLaunchConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseClaudeArgs ¶
ParseClaudeArgs separates CLASP args from Claude Code args. Everything after "--" is passed to Claude Code.
func RunWithClaudeCode ¶
func RunWithClaudeCode(cfg ProxyLaunchConfig) error
RunWithClaudeCode starts the CLASP proxy and launches Claude Code in one operation. This is the main entry point for the "clasp" command when used to launch Claude.
Types ¶
type InstallOptions ¶
InstallOptions configures the installation behavior.
type InstallStatus ¶
type InstallStatus struct {
Installed bool `json:"installed"`
Version string `json:"version"`
Path string `json:"path"`
NeedsUpdate bool `json:"needs_update"`
LatestVersion string `json:"latest_version,omitempty"`
LastChecked int64 `json:"last_checked"`
InstallMethod string `json:"install_method"` // npm, npx, binary
}
InstallStatus represents the current Claude Code installation state.
type LaunchOptions ¶
type LaunchOptions struct {
WorkingDir string
Args []string
ProxyURL string
APIKey string // Optional: pre-configured API key for the proxy
Interactive bool
PassthroughEnv bool // Pass through all environment variables
SkipPermissions bool // Use --dangerously-skip-permissions flag
}
LaunchOptions configures how Claude Code is launched.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles Claude Code CLI installation and launching.
func NewManager ¶
NewManager creates a new Claude Code manager.
func (*Manager) CacheStatus ¶
func (m *Manager) CacheStatus(status *InstallStatus) error
CacheStatus saves installation status to cache.
func (*Manager) CheckForUpdates ¶
CheckForUpdates checks if a newer version of Claude Code is available.
func (*Manager) CheckInstallation ¶
func (m *Manager) CheckInstallation() (*InstallStatus, error)
CheckInstallation checks if Claude Code is installed and its version. Priority: 1) Bundled in node_modules 2) Global npm 3) npx fallback
func (*Manager) EnsureInstalled ¶
func (m *Manager) EnsureInstalled() (*InstallStatus, error)
EnsureInstalled checks if Claude Code is installed and installs it if needed.
func (*Manager) GetLatestVersion ¶
GetLatestVersion fetches the latest version from npm.
func (*Manager) Launch ¶
func (m *Manager) Launch(opts LaunchOptions) error
Launch starts Claude Code with the CLASP proxy configuration.
func (*Manager) LaunchWithProxy ¶
func (m *Manager) LaunchWithProxy(proxyPort int, opts LaunchOptions) error
LaunchWithProxy starts CLASP proxy and then launches Claude Code.
func (*Manager) LoadCachedStatus ¶
func (m *Manager) LoadCachedStatus() (*InstallStatus, error)
LoadCachedStatus loads installation status from cache.
func (*Manager) SetInstallOptions ¶
func (m *Manager) SetInstallOptions(opts InstallOptions)
SetInstallOptions sets installation options.