doctor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckProviders

func CheckProviders(providerDir string, pluginLogger hclog.Logger) ([]CheckResult, []ProviderHealth)

CheckProviders discovers providers and runs Describe on each. Returns both diagnostic results and Describe data for variable validation (R51). pluginLogger is passed to the plugin Manager for go-plugin client logging.

Types

type CheckResult

type CheckResult struct {
	Name     string
	Status   CheckStatus
	Message  string
	Blocking bool
}

CheckResult holds the outcome of a single diagnostic check.

func CheckCache

func CheckCache(cacheDir string) CheckResult

CheckCache verifies the policy cache directory exists (R52). Doctor requires cached policies to resolve provider-to-target mapping for target variable validation.

func CheckConfig

func CheckConfig(configPath string) CheckResult

CheckConfig validates that the workspace config file exists, is parseable, and passes structural validation including target-policy cross-references.

func CheckPolicyActivePeriod

func CheckPolicyActivePeriod(cfg *complytime.WorkspaceConfig, resolver PolicyGraphResolver, verbose bool) []CheckResult

CheckPolicyActivePeriod resolves each policy's implementation-plan from the cached dependency graph and reports whether the evaluation timeline is currently active. Non-blocking: a policy outside its active period is a concern but does not prevent other checks from running. When verbose is true, enforcement timeline detail is appended. See specs/001-gemara-native-workflow/spec.md

func CheckPolicyVersions

func CheckPolicyVersions(cfg *complytime.WorkspaceConfig, cacheDir string, versionResolver VersionResolver) []CheckResult

CheckPolicyVersions compares cached policy versions against the latest available remotely. Per-policy pass/warn results. Non-blocking warning per unreachable registry — policies from that registry get no staleness line. Supersedes CheckRegistries (R55). See FR-039, R55: specs/001-gemara-native-workflow/spec.md

func CheckVariables

func CheckVariables(cfg *complytime.WorkspaceConfig, healthData []ProviderHealth, resolver PolicyGraphResolver, verbose bool) []CheckResult

CheckVariables validates Describe-declared required variables against workspace config. Global variables are checked against config.variables; target variables are checked against relevant config.targets[].variables using policy → evaluator → target mapping (R51, R52).

Default mode: per-provider summary line with resolved/missing counts. Verbose mode: appends per-key status lines below each provider (R55). See FR-039, R51, R55: specs/001-gemara-native-workflow/spec.md

func Run

func Run(cfg *complytime.WorkspaceConfig, configPath, providerDir, cacheDir string, resolver PolicyGraphResolver, versionResolver VersionResolver, verbose bool, pluginLogger hclog.Logger) []CheckResult

Run orchestrates all diagnostic checks and returns a slice of results. The resolver parameter enables policy → evaluator → target mapping for variable validation (R51, R52). Pass nil if the policy cache is not available — CheckCache will report the failure. pluginLogger is the hclog.Logger used for plugin manager and go-plugin client logging. When verbose is true, CheckVariables expands per-provider variable detail to show individual key status (R55). cacheBaseDir is the root cache directory (~/.complytime) where state.json resides. policiesCacheDir is the policies subdirectory used by CheckCache. See FR-039, R44, R51, R52, R55: specs/001-gemara-native-workflow/spec.md

type CheckStatus

type CheckStatus string

CheckStatus is the result state of a single diagnostic check.

const (
	StatusPass CheckStatus = "pass"
	StatusFail CheckStatus = "fail"
	StatusWarn CheckStatus = "warn"
)

type PolicyGraphResolver

type PolicyGraphResolver interface {
	ResolveVersion(policyID, configVersion string) (string, error)
	ResolvePolicyGraph(policyID, version string) (*policy.DependencyGraph, error)
}

PolicyGraphResolver resolves a policy's dependency graph from cached content. Satisfied by *policy.Resolver — defined as interface for testability (Constitution II).

type ProviderHealth

type ProviderHealth struct {
	EvaluatorID             string
	RequiredGlobalVariables []string
	RequiredTargetVariables []string
}

ProviderHealth holds Describe-declared variable requirements for a single scanning provider, collected during provider discovery (R51).

type VersionResolver

type VersionResolver interface {
	ResolveLatestVersion(registry, repository string) (version string, err error)
}

VersionResolver queries an OCI registry for the latest version of a policy. Satisfied by the adapter in cmd/complyctl/cli/doctor.go — defined as interface for testability (Constitution II). See R55: specs/001-gemara-native-workflow/spec.md

Jump to

Keyboard shortcuts

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