Documentation
¶
Overview ¶
Package archive provides utilities for archiving completed changes, including merging spec deltas and moving change directories to archive.
The archive workflow consists of several stages: 1. Validation - Ensures the change passes all spec validation rules 2. Task checking - Verifies implementation tasks are complete 3. Spec merging - Applies delta specs to main specifications 4. Archiving - Moves change to archive with timestamp prefix
This package enforces the Spectr workflow where changes move from spectr/changes/ to spectr/changes/archive/YYYY-MM-DD-<name>/ after deployment, with their delta specs merged into spectr/specs/.
Package archive provides command structures and execution logic for archiving completed changes.
Package archive provides utilities for archiving completed changes, including merging spec deltas and moving change directories to archive.
Index ¶
- func CheckDuplicatesAndConflicts(deltaPlan *parsers.DeltaPlan) error
- func ValidatePostMerge(mergedContent, _ string) error
- func ValidatePreArchive(changeDir string) (*validation.ValidationReport, error)
- func ValidatePreMerge(baseSpecPath string, deltaPlan *parsers.DeltaPlan, specExists bool) error
- type ArchiveCmd
- type ArchiveResult
- type OperationCounts
- type SpecUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDuplicatesAndConflicts ¶
CheckDuplicatesAndConflicts validates that there are no duplicate requirements within delta sections and no cross-section conflicts
func ValidatePostMerge ¶
ValidatePostMerge validates a merged spec for correctness Ensures the merged spec has valid structure and no duplicate requirements
func ValidatePreArchive ¶
func ValidatePreArchive( changeDir string, ) (*validation.ValidationReport, error)
ValidatePreArchive performs all pre-archive validation checks. Validation is always strict: warnings are converted to errors. Returns validation report and error (error is for filesystem issues, not validation failures)
func ValidatePreMerge ¶
ValidatePreMerge validates delta operations against base spec Checks that source requirements exist for MODIFIED/REMOVED/RENAMED and that target requirements don't exist for ADDED/RENAMED
This is a wrapper around validation.ValidatePreMerge for backward compatibility.
Types ¶
type ArchiveCmd ¶
type ArchiveCmd struct {
ChangeID string `arg:"" optional:"" predictor:"changeID"`
Yes bool ` name:"yes" short:"y" help:"Skip confirmation"` //nolint:lll,revive // Kong struct tag with alignment
SkipSpecs bool ` name:"skip-specs" help:"Skip spec updates"` //nolint:lll,revive // Kong struct tag with alignment
NoValidate bool ` name:"no-validate" help:"Skip validation"` //nolint:lll,revive // Kong struct tag with alignment
}
ArchiveCmd represents the archive command configuration
type ArchiveResult ¶
type ArchiveResult struct {
// ArchivePath is the relative path to the archived change
// (e.g., "spectr/changes/archive/2025-12-02-change-id/")
ArchivePath string
// Counts tracks the number of each delta operation applied
Counts OperationCounts
// Capabilities lists the updated capability names (e.g., ["auth", "api"])
Capabilities []string
}
ArchiveResult contains the results of an archive operation.
func Archive ¶
func Archive( cmd *ArchiveCmd, workingDir string, ) (ArchiveResult, error)
Archive archives a change by validating, applying specs, and moving to archive directory
The workingDir parameter allows operating in a different working directory (e.g., for git worktree operations). If workingDir is empty, the current working directory is used as the project root.
Returns ArchiveResult containing the archive path, operation counts, and updated capabilities.
type OperationCounts ¶
OperationCounts tracks the number of each delta operation applied
func MergeSpec ¶
func MergeSpec( baseSpecPath, deltaSpecPath string, specExists bool, ) (string, OperationCounts, error)
MergeSpec applies delta operations from a delta spec to a base spec Returns the merged spec content and operation counts
func (*OperationCounts) Total ¶
func (oc *OperationCounts) Total() int
Total adds up all counts for delta operations.
type SpecUpdate ¶
type SpecUpdate struct {
Source string // Path to delta spec in change
Target string // Path to main spec in spectr/specs
Exists bool // Does target spec already exist?
}
SpecUpdate represents a spec file to update during archive