Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateCategories(categories []string) error
- type CheckJSONItem
- type CheckJSONResult
- type Config
- type Executor
- type OnCheckDone
- type Result
- type RunOptions
- type Runner
- func (r *Runner) FilterCategories(categories []categoryDef, filters []string) []categoryDef
- func (r *Runner) RecordTiming(name string, duration time.Duration)
- func (r *Runner) RunChecks(ctx context.Context, category categoryDef, opts RunOptions, onDone OnCheckDone) ([]Result, error)
- func (r *Runner) SaveTimings()
Constants ¶
const ( CategoryEnvironment = "environment" CategoryQuality = "quality" CategoryArchitecture = "architecture" CategorySecurity = "security" CategoryDependencies = "dependencies" CategoryTests = "tests" )
Category constants for filtering
Variables ¶
var AllCategories = []string{ CategoryEnvironment, CategoryQuality, CategoryArchitecture, CategorySecurity, CategoryDependencies, CategoryTests, }
AllCategories lists all valid category names
Functions ¶
func ValidateCategories ¶
ValidateCategories checks if all provided categories are valid
Types ¶
type CheckJSONItem ¶
type CheckJSONItem struct {
Name string `json:"name"`
Category string `json:"category"`
Passed bool `json:"passed"`
DurationMs int64 `json:"duration_ms"`
Error string `json:"error,omitempty"`
}
CheckJSONItem represents a single check result in JSON output.
type CheckJSONResult ¶
type CheckJSONResult struct {
Passed bool `json:"passed"`
Total int `json:"total"`
Failed int `json:"failed"`
Checks []CheckJSONItem `json:"checks"`
}
CheckJSONResult represents the full check output in JSON mode. Implements output.JSONResponder for custom JSON envelope data.
func (CheckJSONResult) JSONResponse ¶
func (r CheckJSONResult) JSONResponse() interface{}
JSONResponse implements output.JSONResponder.
type Config ¶
type Config struct {
FailFast bool
Verbose bool
Parallel bool
Categories []string // Filter to specific categories (empty = all)
ShowTiming bool // Show duration for each check
BinaryName string // Binary name for license-binary check (e.g., "myapp")
}
Config holds configuration for the check command
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor runs checks with a Bubble Tea progress UI or simple output.
func NewExecutor ¶
NewExecutor creates a new executor with TUI or simple output based on environment.
type OnCheckDone ¶
OnCheckDone is called after each check completes, allowing the caller to update a TUI, log progress, etc. The index is the position within the current category's check list.
type Result ¶
type Result struct {
Name string
Category string
Passed bool
Duration time.Duration
Err error
Remediation string
}
Result holds the outcome of a single check execution.
type RunOptions ¶
RunOptions configures how the Runner executes checks.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner handles check orchestration: filtering, ordering, execution, and result collection. It contains no TUI or rendering logic.
func NewRunner ¶
func NewRunner(timings *timingHistory) *Runner
NewRunner creates a Runner with the given timing history.
func (*Runner) FilterCategories ¶
FilterCategories returns only the categories whose display name matches one of the requested filter names. If filters is empty, all categories are returned.
func (*Runner) RecordTiming ¶
RecordTiming exposes timing recording for callers that need to record durations outside of RunChecks (e.g., TUI mode with its own execution loop).
func (*Runner) RunChecks ¶
func (r *Runner) RunChecks(ctx context.Context, category categoryDef, opts RunOptions, onDone OnCheckDone) ([]Result, error)
RunChecks executes checks sequentially or in parallel, collecting results. It calls onDone (if non-nil) after each check completes. Returns all results and an error if any check failed.
func (*Runner) SaveTimings ¶
func (r *Runner) SaveTimings()
SaveTimings persists timing history to disk.