Documentation
¶
Overview ¶
Package doctor diagnoses authored project inputs without executing configuration.
Index ¶
- Variables
- func SummarizePaths(paths []string) string
- type Check
- type DependencyTargetReporter
- type DependencyValidator
- type Engine
- type Event
- type Finding
- type GitHubRepositoryChecker
- type Options
- type RecoveryEntry
- type RecoveryMode
- type Report
- type RepositoryChecker
- type RepositoryHealth
- type Rule
- type SourceReader
- type StackInputs
- type StackValidator
Constants ¶
This section is empty.
Variables ¶
var ( ErrOptions = errors.New("invalid doctor options") ErrChanged = errors.New("doctor source changed since inspection") ErrVerification = errors.New("doctor semantic verification failed") // ErrRecoveryManifest reports a backup manifest value that cannot be read. ErrRecoveryManifest = errors.New("invalid doctor recovery manifest") // ErrNoConfiguration reports that no Atmos configuration could be located for the project. ErrNoConfiguration = errors.New("no project Atmos configuration found") )
var ErrMonorepoVersion = errors.New("component version cannot be resolved to a tag")
ErrMonorepoVersion reports a source whose version cannot be checked against a single tag.
Functions ¶
func SummarizePaths ¶
summarizePaths lists at most maxListedPaths paths and counts the rest.
Types ¶
type Check ¶
type Check struct {
ID string `json:"id"`
Status string `json:"status"`
Files int `json:"files"`
Reason string `json:"reason,omitempty"`
}
Check records coverage separately from findings, including incomplete checks.
type DependencyTargetReporter ¶
type DependencyTargetReporter interface {
DependencyTargets(context.Context, *schema.AtmosConfiguration, StackInputs) (map[dependency.ComponentRef][]dependency.ComponentRef, error)
}
DependencyTargetReporter reports the dependencies the runtime would select for each component, so a repair can be shown not to change the dependency graph.
type DependencyValidator ¶
type DependencyValidator interface {
ValidateDependencies(context.Context, *schema.AtmosConfiguration, StackInputs) error
}
DependencyValidator checks the production dependency graph without evaluating configuration.
type Engine ¶
type Engine struct {
FS filesystem.FileSystem
Repositories RepositoryChecker
BackupDir func() (string, error)
Observe func(Event)
Stacks StackValidator
// Monorepo proves that a component moved out of the archived monorepo has identical files.
Monorepo monorepo.Verifier
}
Engine dependencies are injectable to test writes and network failures.
type Event ¶
type Event struct {
Finding *Finding
Phase string
Label string
Index int
Total int
Done bool
Status string
}
Event communicates progress without coupling checks to terminal rendering.
type Finding ¶
type Finding struct {
RuleID string `json:"rule_id"`
Category string `json:"category"`
Severity validation.Severity `json:"severity"`
File string `json:"file,omitempty"`
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
Message string `json:"message"`
Remediation string `json:"remediation,omitempty"`
Documentation string `json:"documentation,omitempty"`
Status string `json:"status"`
Fixable bool `json:"fixable"`
Reason string `json:"reason,omitempty"`
}
Finding contains a diagnostic and the explicit repair decision.
type GitHubRepositoryChecker ¶
type GitHubRepositoryChecker struct{}
GitHubRepositoryChecker reuses Atmos's authenticated, host-scoped GitHub client.
func (GitHubRepositoryChecker) Check ¶
func (GitHubRepositoryChecker) Check(ctx context.Context, uri string) RepositoryHealth
type Options ¶
type Options struct {
UnverifiedInputs []string
Root string
ConfigFiles []string
ConfigDirs []string
Profiles []string
BasePath string
Fix bool
DryRun bool
Offline bool
Only []string
Exclude []string
Selected []string
// SelectedRoot is the absolute directory that Selected paths are relative to,
// typically the Git worktree root. Empty means Selected is relative to Root.
SelectedRoot string
Affected bool
// contains filtered or unexported fields
}
Options selects project inputs and the repair policy.
type RecoveryEntry ¶
type RecoveryEntry struct {
Path string `json:"path"`
Copy string `json:"copy"`
Mode RecoveryMode `json:"mode"`
Before string `json:"before_sha256"`
After string `json:"after_sha256"`
}
RecoveryEntry records enough information to restore the exact original bytes.
type RecoveryMode ¶
type RecoveryMode uint32
RecoveryMode is a file's permission bits. It is written as the octal string chmod accepts, for example "0644", and reads both that form and the decimal number older manifests recorded.
func (RecoveryMode) MarshalJSON ¶
func (m RecoveryMode) MarshalJSON() ([]byte, error)
MarshalJSON writes the mode as an octal string.
func (*RecoveryMode) UnmarshalJSON ¶
func (m *RecoveryMode) UnmarshalJSON(data []byte) error
UnmarshalJSON reads an octal string, or the decimal number written by older manifests.
type Report ¶
type Report struct {
// SourceRoot resolves project-relative locations for human source excerpts.
SourceRoot string `json:"-"`
Version int `json:"version"`
Findings []Finding `json:"findings"`
Checks []Check `json:"checks"`
ChangedFiles []string `json:"changed_files"`
Backup string `json:"backup,omitempty"`
Recovery string `json:"recovery,omitempty"`
Fix bool `json:"fix"`
DryRun bool `json:"dry_run"`
OperationalError string `json:"operational_error,omitempty"`
}
Report is the complete machine-readable run result.
func (*Report) ExitCode ¶
ExitCode evaluates remaining findings. Operational failures cannot be suppressed, and neither can a requested repair that failed verification: a fix run that did not deliver what was asked for exits 1 whatever the severity threshold. A dry run applies nothing, so it only applies the threshold.
func (*Report) ValidationReport ¶
func (r *Report) ValidationReport() validation.Report
ValidationReport adapts findings to Atmos's existing rich and SARIF renderers.
type RepositoryChecker ¶
type RepositoryChecker interface {
Check(context.Context, string) RepositoryHealth
}
RepositoryChecker inspects repository metadata without cloning or installing tools.
type RepositoryHealth ¶
RepositoryHealth deliberately distinguishes inaccessible repositories from missing ones.
type Rule ¶
type Rule struct {
ID string `json:"id"`
Category string `json:"category"`
Description string `json:"description"`
}
Rule describes a built-in check. Replacement prose is never executable.
type SourceReader ¶
SourceReader reads stack manifests as doctor sees them: current content, or a repair candidate while one is verified.
type StackInputs ¶
type StackInputs struct {
// Files are the top-level manifests, as slash paths relative to the stacks base path, after
// stacks.included_paths and stacks.excluded_paths are applied.
Files []string
// Reader supplies the content of each manifest and of everything it imports.
Reader SourceReader
}
StackInputs are the static stack manifests captured for the stack consumers.
type StackValidator ¶
type StackValidator interface {
Validate(context.Context, *schema.AtmosConfiguration, StackInputs) error
}
StackValidator checks static inputs with the production stack consumers.
Source Files
¶
- actions.go
- component_monorepo.go
- constants.go
- dependencies.go
- dependencies_verify.go
- discovery.go
- discovery_config.go
- discovery_imports.go
- discovery_read.go
- discovery_vendor.go
- edit_apply.go
- engine.go
- exclude.go
- fix.go
- fix_backup.go
- fix_drift.go
- limits.go
- locate.go
- remediation.go
- repositories.go
- rules.go
- stacks.go
- templates.go
- types.go
- validation.go
- verify.go
- verify_comments.go
- yaml_functions.go