types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package types defines data structures for git-vendor configuration and state management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchSpec

type BranchSpec struct {
	Ref           string        `yaml:"ref"`
	DefaultTarget string        `yaml:"default_target,omitempty"`
	Mapping       []PathMapping `yaml:"mapping"`
}

BranchSpec defines mappings for a specific Git ref (branch, tag, or commit).

type CloneOptions

type CloneOptions struct {
	Filter     string // e.g., "blob:none"
	NoCheckout bool
	Depth      int
}

CloneOptions holds options for git clone operations

type CommitInfo

type CommitInfo struct {
	Hash      string
	ShortHash string
	Subject   string
	Author    string
	Date      string
}

CommitInfo represents a single git commit

type FileChecksum

type FileChecksum struct {
	Path string `json:"path"`
	Hash string `json:"hash"` // SHA-256 of file content
}

FileChecksum represents a cached checksum for incremental sync

type HookConfig

type HookConfig struct {
	PreSync  string `yaml:"pre_sync,omitempty"`  // Shell command to run before sync
	PostSync string `yaml:"post_sync,omitempty"` // Shell command to run after sync
}

HookConfig defines pre/post sync shell commands for automation

type HookContext

type HookContext struct {
	VendorName  string            // Name of the vendor being synced
	VendorURL   string            // URL of the vendor repository
	Ref         string            // Git ref being synced
	CommitHash  string            // Resolved commit hash
	RootDir     string            // Project root directory
	FilesCopied int               // Number of files copied
	DirsCreated int               // Number of directories created
	Environment map[string]string // Additional environment variables
}

HookContext provides environment context for hook execution

type IncrementalSyncCache

type IncrementalSyncCache struct {
	VendorName string         `json:"vendor_name"`
	Ref        string         `json:"ref"`
	CommitHash string         `json:"commit_hash"`
	Files      []FileChecksum `json:"files"`
	CachedAt   string         `json:"cached_at"` // RFC3339 timestamp
}

IncrementalSyncCache tracks file states for skip optimization

type LockDetails

type LockDetails struct {
	Name        string `yaml:"name"`
	Ref         string `yaml:"ref"`
	CommitHash  string `yaml:"commit_hash"`
	LicensePath string `yaml:"license_path"` // Automatically managed
	Updated     string `yaml:"updated"`
}

LockDetails contains the locked state for a specific vendor and ref.

type ParallelOptions

type ParallelOptions struct {
	Enabled    bool // Whether parallel processing is enabled
	MaxWorkers int  // Maximum concurrent workers (0 = use NumCPU)
}

ParallelOptions configures parallel processing behavior

type PathConflict

type PathConflict struct {
	Path     string
	Vendor1  string
	Vendor2  string
	Mapping1 PathMapping
	Mapping2 PathMapping
}

PathConflict represents a conflict between two vendors mapping to overlapping paths

type PathMapping

type PathMapping struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

PathMapping defines a source-to-destination path mapping for vendoring.

type ProgressTracker

type ProgressTracker interface {
	// Increment advances progress by one unit with an optional status message
	Increment(message string)

	// SetTotal updates the total expected units (for dynamic totals)
	SetTotal(total int)

	// Complete marks the operation as successfully finished
	Complete()

	// Fail marks the operation as failed with an error
	Fail(err error)
}

ProgressTracker represents a progress indicator for long-running operations

type SyncStatus

type SyncStatus struct {
	AllSynced      bool
	VendorStatuses []VendorStatus
}

SyncStatus represents the overall sync status

type UpdateCheckResult

type UpdateCheckResult struct {
	VendorName  string
	Ref         string
	CurrentHash string
	LatestHash  string
	LastUpdated string
	UpToDate    bool
}

UpdateCheckResult represents an available update for a vendor

type VendorConfig

type VendorConfig struct {
	Vendors []VendorSpec `yaml:"vendors"`
}

VendorConfig represents the root configuration file (vendor.yml) structure.

type VendorDiff

type VendorDiff struct {
	VendorName  string
	Ref         string
	OldHash     string
	NewHash     string
	OldDate     string
	NewDate     string
	Commits     []CommitInfo
	CommitCount int
}

VendorDiff represents the commit history between two refs

type VendorLock

type VendorLock struct {
	Vendors []LockDetails `yaml:"vendors"`
}

VendorLock represents the lock file (vendor.lock) storing resolved commit hashes.

type VendorSpec

type VendorSpec struct {
	Name    string       `yaml:"name"`
	URL     string       `yaml:"url"`
	License string       `yaml:"license"`
	Groups  []string     `yaml:"groups,omitempty"` // Optional groups for batch operations
	Hooks   *HookConfig  `yaml:"hooks,omitempty"`  // Optional pre/post sync hooks
	Specs   []BranchSpec `yaml:"specs"`
}

VendorSpec defines a single vendored dependency with its source repository and mappings.

type VendorStatus

type VendorStatus struct {
	Name         string
	Ref          string
	IsSynced     bool
	MissingPaths []string // Paths that should exist but don't
}

VendorStatus represents the sync status of a vendor

Jump to

Keyboard shortcuts

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