Documentation
¶
Overview ¶
Package doctor runs diagnostic checks on Genie configuration and environment (config file, secrets, MCP, SCM, model provider) and returns a list of results (errors, warnings, info) with stable ErrCodes for troubleshooting.
It solves the problem of validating setup before or during runs: "genie doctor" and the setup wizard use it to report missing keys, invalid URLs, and connectivity issues so users can fix configuration without guessing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorCount ¶
ErrorCount returns the number of results with Level == SeverityError.
Types ¶
type ErrCode ¶
type ErrCode string
ErrCode is a stable identifier for each diagnostic so users can look up resolution steps in the documentation (e.g. docs/data/docs.yml error_codes). Every problem reported by genie doctor MUST have an ErrCode.
const ( // Config ErrCodeConfigFileMissing ErrCode = "GENIE_DOC_001" ErrCodeConfigFileRead ErrCode = "GENIE_DOC_002" ErrCodeConfigParse ErrCode = "GENIE_DOC_003" ErrCodeConfigUnsupportedExt ErrCode = "GENIE_DOC_004" // Secrets (external / [security.secrets]) ErrCodeSecretManagerInit ErrCode = "GENIE_DOC_011" ErrCodeSecretResolveFailed ErrCode = "GENIE_DOC_012" // Model config ErrCodeModelNoProviders ErrCode = "GENIE_DOC_020" ErrCodeModelMissingToken ErrCode = "GENIE_DOC_021" ErrCodeModelValidateError ErrCode = "GENIE_DOC_022" // MCP ErrCodeMCPConfigInvalid ErrCode = "GENIE_DOC_030" ErrCodeMCPConnectFailed ErrCode = "GENIE_DOC_031" ErrCodeMCPInitializeFailed ErrCode = "GENIE_DOC_032" ErrCodeMCPListToolsFailed ErrCode = "GENIE_DOC_033" // SCM ErrCodeSCMNotConfigured ErrCode = "GENIE_DOC_040" ErrCodeSCMProviderInvalid ErrCode = "GENIE_DOC_041" ErrCodeSCMTokenMissing ErrCode = "GENIE_DOC_042" ErrCodeSCMInitFailed ErrCode = "GENIE_DOC_043" ErrCodeSCMValidateFailed ErrCode = "GENIE_DOC_044" // Messenger (optional check) ErrCodeMessengerConfigInvalid ErrCode = "GENIE_DOC_050" ErrCodeMessengerSecretMissing ErrCode = "GENIE_DOC_051" // Web search (optional) ErrCodeWebSearchConfigInvalid ErrCode = "GENIE_DOC_060" )
type Result ¶
type Result struct {
ErrCode ErrCode
Level Severity
Section string // e.g. "config", "mcp", "scm", "secrets", "model_config"
Message string
Detail string
}
Result is a single diagnostic from a doctor check. Every problem MUST have an ErrCode for troubleshooting docs.
type Results ¶ added in v0.1.6
type Results []Result
func Run ¶
func Run(ctx context.Context, cfg config.GenieConfig, cfgPath string, sp security.SecretProvider) Results
Run runs all doctor checks against the loaded config and secret provider. cfgPath is the config file path used for loading (may be empty). It returns a slice of results; callers should report errors for any Result with Level == SeverityError.
func (Results) GetSection ¶ added in v0.1.6
GetSection returns the first result with the given section, or nil if none.