Documentation
¶
Index ¶
- func PopulateMissingMetadata(m *Manifest, defaultTargetDir, defaultPackageDir string)
- type ContentHasher
- type DoctorState
- type FSManifestStore
- type IgnoredLink
- type IssueType
- type Manifest
- func (m *Manifest) AddIgnoredLink(path, target, reason string)
- func (m *Manifest) AddIgnoredPattern(pattern string)
- func (m *Manifest) AddPackage(pkg PackageInfo)
- func (m *Manifest) ClearRepository()
- func (m *Manifest) EnsureDoctorState()
- func (m *Manifest) GetHash(name string) (string, bool)
- func (m *Manifest) GetPackage(name string) (PackageInfo, bool)
- func (m *Manifest) GetRepository() (RepositoryInfo, bool)
- func (m *Manifest) PackageList() []PackageInfo
- func (m *Manifest) RemoveIgnoredLink(path string) bool
- func (m *Manifest) RemovePackage(name string) bool
- func (m *Manifest) SetHash(name, hash string)
- func (m *Manifest) SetRepository(info RepositoryInfo)
- type ManifestStore
- type PackageInfo
- type PackageSource
- type RepositoryInfo
- type ValidationIssue
- type ValidationResult
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PopulateMissingMetadata ¶
PopulateMissingMetadata fills in TargetDir and PackageDir for packages that were created before these fields existed. This ensures backward compatibility with older manifest files.
Types ¶
type ContentHasher ¶
type ContentHasher struct {
// contains filtered or unexported fields
}
ContentHasher computes content hashes for packages
func NewContentHasher ¶
func NewContentHasher(fs domain.FS) *ContentHasher
NewContentHasher creates a new content hasher
func (*ContentHasher) HashPackage ¶
func (h *ContentHasher) HashPackage(ctx context.Context, pkgPath domain.PackagePath) (string, error)
HashPackage computes content hash for entire package Hash is deterministic and based on file contents and paths
type DoctorState ¶
type DoctorState struct {
IgnoredLinks map[string]IgnoredLink `json:"ignored_links,omitempty"`
IgnoredPatterns []string `json:"ignored_patterns,omitempty"`
}
DoctorState tracks ignored symlinks and patterns for doctor diagnostics.
type FSManifestStore ¶
type FSManifestStore struct {
// contains filtered or unexported fields
}
FSManifestStore implements ManifestStore using filesystem
func NewFSManifestStore ¶
func NewFSManifestStore(fs domain.FS) *FSManifestStore
NewFSManifestStore creates filesystem-based manifest store. Manifest is stored in the target directory for backward compatibility.
func NewFSManifestStoreWithDir ¶
func NewFSManifestStoreWithDir(fs domain.FS, manifestDir string) *FSManifestStore
NewFSManifestStoreWithDir creates filesystem-based manifest store with custom directory. Manifest is stored in the specified manifestDir instead of target directory.
func (*FSManifestStore) Load ¶
func (s *FSManifestStore) Load(ctx context.Context, targetDir domain.TargetPath) domain.Result[Manifest]
Load retrieves manifest from configured directory
func (*FSManifestStore) Save ¶
func (s *FSManifestStore) Save(ctx context.Context, targetDir domain.TargetPath, manifest Manifest) error
Save persists manifest to configured directory
type IgnoredLink ¶
type IgnoredLink struct {
Target string `json:"target"`
TargetHash string `json:"target_hash"` // SHA256 of target path for change detection
AcknowledgedAt time.Time `json:"acknowledged_at"`
Reason string `json:"reason,omitempty"`
}
IgnoredLink represents a symlink that user has acknowledged and wants to ignore.
type Manifest ¶
type Manifest struct {
Version string `json:"version"`
UpdatedAt time.Time `json:"updated_at"`
Packages map[string]PackageInfo `json:"packages"`
Hashes map[string]string `json:"hashes"`
Repository *RepositoryInfo `json:"repository,omitempty"`
Doctor *DoctorState `json:"doctor,omitempty"`
}
Manifest tracks installed package state
func (*Manifest) AddIgnoredLink ¶
AddIgnoredLink adds a symlink to the ignore list.
func (*Manifest) AddIgnoredPattern ¶
AddIgnoredPattern adds a glob pattern to the ignore list.
func (*Manifest) AddPackage ¶
func (m *Manifest) AddPackage(pkg PackageInfo)
AddPackage adds or updates package information
func (*Manifest) ClearRepository ¶
func (m *Manifest) ClearRepository()
ClearRepository removes the repository information from the manifest.
func (*Manifest) EnsureDoctorState ¶
func (m *Manifest) EnsureDoctorState()
EnsureDoctorState initializes the doctor state if it doesn't exist.
func (*Manifest) GetPackage ¶
func (m *Manifest) GetPackage(name string) (PackageInfo, bool)
GetPackage retrieves package information
func (*Manifest) GetRepository ¶
func (m *Manifest) GetRepository() (RepositoryInfo, bool)
GetRepository retrieves the repository information. Returns the repository info and true if set, or empty info and false if not set.
func (*Manifest) PackageList ¶
func (m *Manifest) PackageList() []PackageInfo
PackageList returns all packages as slice
func (*Manifest) RemoveIgnoredLink ¶
RemoveIgnoredLink removes a symlink from the ignore list. Returns true if the link was found and removed, false otherwise.
func (*Manifest) RemovePackage ¶
RemovePackage removes package from manifest
func (*Manifest) SetRepository ¶
func (m *Manifest) SetRepository(info RepositoryInfo)
SetRepository sets the repository information for the manifest.
type ManifestStore ¶
type ManifestStore interface {
// Load retrieves manifest from target directory
// Returns empty manifest if file doesn't exist
Load(ctx context.Context, targetDir domain.TargetPath) domain.Result[Manifest]
// Save persists manifest to target directory
// Write is atomic via temp file and rename
Save(ctx context.Context, targetDir domain.TargetPath, manifest Manifest) error
}
ManifestStore provides persistence for manifests
type PackageInfo ¶
type PackageInfo struct {
Name string `json:"name"`
InstalledAt time.Time `json:"installed_at"`
LinkCount int `json:"link_count"`
Links []string `json:"links"`
Backups map[string]string `json:"backups,omitempty"` // target path -> backup path
Source PackageSource `json:"source,omitempty"` // How package was installed (adopted vs managed)
TargetDir string `json:"target_dir,omitempty"` // Target directory where symlinks are created
PackageDir string `json:"package_dir,omitempty"` // Package directory containing source files
}
PackageInfo contains installation metadata for a package
type PackageSource ¶
type PackageSource string
PackageSource indicates how a package was installed
const ( // SourceManaged indicates package was installed via manage command SourceManaged PackageSource = "managed" // SourceAdopted indicates package was created via adopt command SourceAdopted PackageSource = "adopted" )
type RepositoryInfo ¶
type RepositoryInfo struct {
// URL is the git repository URL.
URL string `json:"url"`
// Branch is the cloned branch name.
Branch string `json:"branch"`
// ClonedAt is the timestamp when the repository was cloned.
ClonedAt time.Time `json:"cloned_at"`
// CommitSHA is the commit hash at clone time (optional).
CommitSHA string `json:"commit_sha,omitempty"`
}
RepositoryInfo contains metadata about the cloned repository.
type ValidationIssue ¶
ValidationIssue describes a specific problem found
type ValidationResult ¶
type ValidationResult struct {
IsValid bool
Issues []ValidationIssue
}
ValidationResult contains validation outcome and issues
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator checks manifest consistency with filesystem
func NewValidator ¶
NewValidator creates a new manifest validator
func (*Validator) Validate ¶
func (v *Validator) Validate(ctx context.Context, targetDir domain.TargetPath, manifest Manifest) ValidationResult
Validate checks manifest consistency with filesystem