Documentation
¶
Index ¶
Constants ¶
const ( ProviderMoonshot = "Moonshot (Kimi)" ProviderDeepSeek = "DeepSeek" ProviderGLM = "Zhipu (GLM)" ProviderMiniMax = "MiniMax" ProviderAliyun = "Alibaba Cloud (Qwen)" ProviderVolcengine = "Volcengine (Doubao)" ProviderTencent = "Tencent Cloud" ProviderCustom = "Custom provider" )
Provider display names used in the selection menu and switch cases.
Variables ¶
var ErrInterrupted = errors.New("interrupted")
ErrInterrupted is returned when the user cancels an interactive prompt (Ctrl+C).
var GitHubAPI = "https://api.github.com/repos/theopenbee/cc-download/releases/latest"
GitHubAPI is the GitHub Releases API endpoint for cc-download. It is a var (not const) so tests can override it with a local httptest server.
Functions ¶
func ConfigureProvider ¶ added in v0.0.13
func ConfigureProvider() error
ConfigureProvider runs an interactive survey to select a provider and API key, then writes the result to ~/.claude/settings.json (and ~/.claude.json where needed). Returns ErrInterrupted if the user cancels with Ctrl+C.
func Download ¶ added in v0.0.13
Download downloads Claude Code to stateDir/bin/claude and returns the installed path. If the binary already exists and force is false, it returns the existing path immediately without re-downloading. cdnURL, if non-empty, redirects both version check and binary download to the given CDN base URL.
func HandleSurveyErr ¶ added in v0.0.13
HandleSurveyErr converts a survey interrupt into ErrInterrupted and passes other errors through unchanged. It is exported so that cmd-layer code can share the same sentinel error without duplicating the check.
Types ¶
type Invoker ¶
type Invoker struct {
// contains filtered or unexported fields
}
Invoker spawns Claude CLI processes. It is stateless and safe for concurrent use.
func NewInvoker ¶
NewInvoker creates an Invoker. openbeeURL is the openbee server base URL (e.g. "http://host:port") injected as OPENBEE_URL into the subprocess.
func (*Invoker) Run ¶
func (inv *Invoker) Run(ctx context.Context, workDir, prompt string, opts RunOptions, logPath string) (*Process, <-chan Output, error)
Run starts a Claude CLI process, redirecting its stdout and stderr to logPath. The returned channel carries only lifecycle events: OutputDone on success, OutputError on failure. The channel is closed after the process exits.
type Output ¶
type Output struct {
Type OutputType `json:"type"`
Content string `json:"content"`
}
Output is a single output event from a Claude CLI process.
type OutputType ¶
type OutputType string
OutputType classifies a line of output from a Claude CLI process.
const ( OutputStdout OutputType = "stdout" OutputStderr OutputType = "stderr" OutputDone OutputType = "done" OutputError OutputType = "error" )
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process represents a running Claude CLI invocation.
type RunOptions ¶
RunOptions controls session behaviour for a Claude CLI invocation.