Documentation
¶
Overview ¶
Package drift provides functionality for detecting stale or invalid context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckName ¶ added in v0.3.0
type CheckName string
CheckName identifies a drift detection check.
const ( // CheckPathReferences validates that file paths in context files exist. CheckPathReferences CheckName = "path_references" // CheckStaleness detects accumulated completed tasks. CheckStaleness CheckName = "staleness_check" // CheckConstitution verifies constitution rules are respected. CheckConstitution CheckName = "constitution_check" // CheckRequiredFiles ensures all required context files are present. CheckRequiredFiles CheckName = "required_files" )
type Issue ¶
type Issue struct {
File string `json:"file"`
Line int `json:"line,omitempty"`
Type IssueType `json:"type"`
Message string `json:"message"`
Path string `json:"path,omitempty"`
Rule string `json:"rule,omitempty"`
}
Issue represents a detected drift issue.
Issues are categorized by type and may reference specific files, lines, or paths in the codebase.
Fields:
- File: Context file where the issue was detected (e.g., "ARCHITECTURE.md")
- Line: Line number in the file, if applicable
- Type: Issue category (e.g., "dead_path", "staleness", "missing_file")
- Message: Human-readable description of the issue
- Path: Referenced path that caused the issue, if applicable
- Rule: Constitution rule that was violated, if applicable
type IssueType ¶ added in v0.3.0
type IssueType string
IssueType categorizes a drift issue for grouping and filtering.
const ( // IssueDeadPath indicates a file path reference that no longer exists. IssueDeadPath IssueType = "dead_path" // IssueStaleness indicates accumulated completed tasks needing archival. IssueStaleness IssueType = "staleness" // IssueSecret indicates a file that may contain secrets or credentials. IssueSecret IssueType = "potential_secret" // IssueMissing indicates a required context file that does not exist. IssueMissing IssueType = "missing_file" )
type Report ¶
type Report struct {
Warnings []Issue `json:"warnings"`
Violations []Issue `json:"violations"`
Passed []CheckName `json:"passed"`
}
Report represents the complete drift detection report.
Contains categorized issues and a list of checks that passed.
Fields:
- Warnings: Non-critical issues that should be addressed
- Violations: Critical issues that indicate constitution violations
- Passed: Names of checks that are completed without issues
func Detect ¶
Detect runs all drift detection checks on the given context.
Performs multiple validation checks including path references, staleness indicators, constitution compliance, and required file presence.
Parameters:
- ctx: Loaded context containing files to check
Returns:
- *Report: Drift report with warnings, violations, and passed checks
func (*Report) Status ¶
func (r *Report) Status() StatusType
Status returns the overall status of the report.
Returns:
- StatusType: StatusViolation if any violations, StatusWarning if only warnings, StatusOk otherwise
type StatusType ¶ added in v0.3.0
type StatusType string
StatusType represents the overall status of a drift report.
const ( // StatusOk means no drift was detected. StatusOk StatusType = "ok" // StatusWarning means non-critical issues were found. StatusWarning StatusType = "warning" // StatusViolation means constitution violations were found. StatusViolation StatusType = "violation" )