Documentation
¶
Overview ¶
Package templates provides template comparison and update utilities.
Index ¶
- func ComputeChecksum(path string) ([]byte, error)
- func ComputeEmbeddedChecksum(relPath string, embeddedFS embed.FS) ([]byte, error)
- func FindCustomizedFiles(projectDir string, embeddedFS embed.FS) ([]string, error)
- func IsFileCustomized(projectPath, relPath string, embeddedFS embed.FS) (bool, error)
- type TemplateStatus
- type TemplateUpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeChecksum ¶
ComputeChecksum computes the SHA-256 checksum of a file.
func ComputeEmbeddedChecksum ¶
ComputeEmbeddedChecksum computes the SHA-256 checksum of an embedded file.
func FindCustomizedFiles ¶
FindCustomizedFiles finds all customized files in the .claude directory.
Types ¶
type TemplateStatus ¶
type TemplateStatus struct {
ProjectTemplateVersion string `json:"project_template_version"` // Version stored in specledger.yaml
CLIVersion string `json:"cli_version"` // Current CLI version
UpdateAvailable bool `json:"update_available"` // true if versions differ
CustomizedFiles []string `json:"customized_files"` // Files that differ from embedded originals
TotalFiles int `json:"total_files"` // Total template files in project
NeedsUpdate bool `json:"needs_update"` // true if UpdateAvailable and in project
InProject bool `json:"in_project"` // true if running in a SpecLedger project
}
TemplateStatus represents the state of project templates relative to current CLI.
func CheckTemplateStatus ¶
func CheckTemplateStatus(projectDir, cliVersion string) (*TemplateStatus, error)
CheckTemplateStatus checks the template status for a project. Returns TemplateStatus with information about template version and customization.
type TemplateUpdateResult ¶
type TemplateUpdateResult struct {
Updated []string `json:"updated"` // Files that were updated (new)
Overwritten []string `json:"overwritten"` // Files that existed and were overwritten
Stale []string `json:"stale"` // Files detected as stale (not deleted, just reported)
Errors []error `json:"errors"` // Any errors encountered
NewVersion string `json:"new_version"` // New template_version written to YAML
Success bool `json:"success"` // true if no fatal errors
}
TemplateUpdateResult represents the result of a template update operation.
func UpdateTemplates ¶
func UpdateTemplates(projectDir, cliVersion string) (*TemplateUpdateResult, error)
UpdateTemplates updates project templates from embedded files using the manifest. All embedded templates are copied, overwriting any existing files. Stale files (specledger.*.md in commands/) are detected but NOT deleted to preserve custom content.