agentcheck

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package agentcheck runs the `spec agent check` preflight: it resolves the agent from personal config, reports its capability set, and runs a tiny contained completion to prove the whole path works before the user relies on it mid-draft. The package is named after the command (spec agent check) and the preflight capability, not after "the agent adapter" — that lives in internal/adapter — so the two never read as the same thing on grep.

`spec agent check` exists because misconfiguration should surface in a diagnostic with a named failing step, not as a confusing failure partway through a draft. It mirrors `spec config check` for PM/Jira.

The latency it reports is also the evidence decision 003 defers to: shipping headless-only was justified on the assumption that subprocess spawn cost is negligible next to model latency, and this is where that assumption becomes measurable rather than asserted.

Index

Constants

This section is empty.

Variables

View Source
var KnownHarnesses = []struct {
	Provider string
	Command  string
}{
	{Provider: "claude-code", Command: "claude"},
	{Provider: "pi", Command: "pi"},
}

KnownHarnesses are the coding agents spec can detect on PATH, with the binary each provider expects.

Functions

func Detected

func Detected() []string

Detected returns the providers whose binary is on PATH, so setup can offer what is installed first and make the common case a single keystroke.

func DetectedHint

func DetectedHint() string

DetectedHint suggests installed harnesses in an error message.

func InertSettings

func InertSettings(agentCfg config.ProviderConfig) []string

InertSettings names configured values that cannot take effect for the resolved provider. A setting that looks effective but is not is worse than one that is absent.

Types

type Report

type Report struct {
	Provider      string               `json:"provider"`
	Binary        string               `json:"binary,omitempty"`
	Endpoint      string               `json:"endpoint,omitempty"`
	Capabilities  adapter.Capabilities `json:"capabilities"`
	Model         string               `json:"model,omitempty"`
	LatencyMS     int64                `json:"latency_ms,omitempty"`
	Tokens        int                  `json:"tokens,omitempty"`
	InertSettings []string             `json:"inert_settings,omitempty"`
	FailedStep    string               `json:"failed_step,omitempty"`
	Err           string               `json:"error,omitempty"`
}

Report is the diagnostic result of a preflight Check. It carries everything the CLI and TUI need to render a preflight, including a partial result on failure: a failed step sets FailedStep and Err while leaving the rest of the fields populated up to where the check stopped.

func Check

func Check(agentCfg config.ProviderConfig, agent adapter.AgentAdapter) (Report, error)

Check runs the agent preflight: reachability, capability detection, and (when advertised) a contained Generate round-trip.

Returns a Report for the caller to render and an error only when a step failed. The error wraps the underlying failure and names the failed step; a caller that wants to render the partial result reads Report, which carries FailedStep and Err, so the render is the same on the success and failure paths.

Jump to

Keyboard shortcuts

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