templates

package
v1.0.49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package templates provides template comparison and update utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeChecksum

func ComputeChecksum(path string) ([]byte, error)

ComputeChecksum computes the SHA-256 checksum of a file.

func ComputeEmbeddedChecksum

func ComputeEmbeddedChecksum(relPath string, embeddedFS embed.FS) ([]byte, error)

ComputeEmbeddedChecksum computes the SHA-256 checksum of an embedded file.

func FindCustomizedFiles

func FindCustomizedFiles(projectDir string, embeddedFS embed.FS) ([]string, error)

FindCustomizedFiles finds all customized files in the .claude directory.

func IsFileCustomized

func IsFileCustomized(projectPath, relPath string, embeddedFS embed.FS) (bool, error)

IsFileCustomized checks if a project file differs from the embedded original.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL