codingharness

package
v1.112.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClaudeStateNotInstalled    = "not-installed"
	ClaudeStateAuthCheckFailed = "auth-check-failed"
	ClaudeStateUnauthenticated = "unauthenticated"
	ClaudeStateAuthenticated   = "authenticated"
)

Claude Code CLI probe states, from worst to best.

View Source
const (
	TypeClaudeCode = "claude-code"
	TypeCodex      = "codex"
	TypePi         = "pi"
	TypeOpenCode   = "opencode"
)
View Source
const ClaudeInstallDocsURL = "https://docs.anthropic.com/en/docs/claude-code"

ClaudeInstallDocsURL is where the Claude Code CLI install instructions live.

View Source
const ClaudeLoginCommand = "claude auth login --claudeai"

ClaudeLoginCommand is the official interactive Claude Code login for a Claude (claude.ai) subscription. docker-agent never runs it implicitly: remediation messages print it, and the setup wizard only executes it after an explicit confirmation.

Variables

This section is empty.

Functions

func Label

func Label(cfg *latest.HarnessConfig) string

func NewProvider

func NewProvider(cfg *latest.HarnessConfig) (baseharness.Provider, error)

func RunClaudeLogin added in v1.112.0

func RunClaudeLogin(ctx context.Context) error

RunClaudeLogin runs the official interactive Claude Code login (ClaudeLoginCommand) attached to this process's terminal, so the login lands in the exact OS user and environment docker-agent runs as. Callers must only invoke it after an explicit user confirmation: the command is interactive and opens a browser.

Types

type ClaudeCLIProbe added in v1.112.0

type ClaudeCLIProbe struct {
	// LookPath defaults to exec.LookPath.
	LookPath func(file string) (string, error)
	// RunOutput runs a command and returns its stdout. It defaults to a
	// direct exec.CommandContext invocation (never a shell) bounded by
	// Timeout.
	RunOutput func(ctx context.Context, name string, args ...string) ([]byte, error)
	// Timeout bounds each CLI invocation; defaults to claudeProbeTimeout.
	Timeout time.Duration
}

ClaudeCLIProbe checks the installation and login state of the Claude Code CLI. The zero value probes the real `claude` binary from PATH; tests inject the seams.

func (ClaudeCLIProbe) Probe added in v1.112.0

Probe distinguishes four states: the binary is not installed, the auth check could not be completed, the CLI is installed but not logged in, and the CLI is logged in.

type ClaudeCLIStatus added in v1.112.0

type ClaudeCLIStatus struct {
	State            string `json:"state"`
	Version          string `json:"version,omitempty"`
	AuthMethod       string `json:"auth_method,omitempty"`
	APIProvider      string `json:"api_provider,omitempty"`
	SubscriptionType string `json:"subscription_type,omitempty"`
	// Detail explains the not-installed and auth-check-failed states. It only
	// ever carries exec-level error strings (exit status, context timeout),
	// never command output.
	Detail string `json:"detail,omitempty"`
}

ClaudeCLIStatus reports the state of the locally installed Claude Code CLI. Only non-identifying fields of `claude auth status` are retained: the email, organization, and token material the command also reports are never parsed, stored, or printed.

func ProbeClaudeCLI added in v1.112.0

func ProbeClaudeCLI(ctx context.Context) ClaudeCLIStatus

ProbeClaudeCLI probes the Claude Code CLI with the default seams. It never starts a login or a browser; it only observes.

func (ClaudeCLIStatus) AuthSummary added in v1.112.0

func (s ClaudeCLIStatus) AuthSummary() string

AuthSummary renders the safe auth metadata as a short human-readable fragment, e.g. "auth: claude.ai, api: firstParty, subscription: pro".

func (ClaudeCLIStatus) Authenticated added in v1.112.0

func (s ClaudeCLIStatus) Authenticated() bool

Authenticated reports whether the CLI is logged in.

func (ClaudeCLIStatus) Installed added in v1.112.0

func (s ClaudeCLIStatus) Installed() bool

Installed reports whether the `claude` binary was found in PATH.

Jump to

Keyboard shortcuts

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