Documentation
¶
Overview ¶
Package writ implements the writ CLI commands.
Index ¶
- Constants
- Variables
- func BuildTree(g *execution.Graph, cfg *Config) error
- func CollectLayerSources() ([]tree.LayerSource, error)
- func ConfigureEngine(cfg *Config) (*execution.GraphExecutor, error)
- func NewGraph(cfg *Config) *execution.Graph
- func NewRootCmd() *cobra.Command
- type AdoptConfig
- type AdoptGraphBuilder
- type Config
- type DecommissionConfig
- type DecommissionGraphBuilder
- type DeployConfig
- type DeployGraphBuilder
- type GraphBuilder
- type MigrateGraphBuilder
- type ReconcileConfig
- type ReconcileGraphBuilder
- type TargetSpec
- type UpgradeConfig
- type UpgradeGraphBuilder
- type VerifyResult
Constants ¶
const CurrentVersion = "6"
CurrentVersion is the graph format version.
Variables ¶
var LayerOrder = []string{"base", "team", "personal"}
LayerOrder defines the processing order for repository layers. Layers are processed in this order, with later layers overriding earlier ones.
Functions ¶
func BuildTree ¶
BuildTree walks the source directories and populates the graph with file nodes. This processes layers in order (base → team → personal) with collision detection.
func CollectLayerSources ¶
func CollectLayerSources() ([]tree.LayerSource, error)
CollectLayerSources gathers all configured repository layers and expands them into source/target pairs. Returns sources ordered: base/System, base/Home, team/System, team/Home, personal/System, personal/Home (if configured/exist).
func ConfigureEngine ¶
func ConfigureEngine(cfg *Config) (*execution.GraphExecutor, error)
ConfigureEngine creates and configures an execution engine for the graph.
func NewRootCmd ¶
NewRootCmd creates the root writ command with all subcommands.
Types ¶
type AdoptConfig ¶
type AdoptConfig struct {
Config
// Files to adopt.
Files []string
// Layer to adopt into (personal, team, base).
Layer string
// LayerPath is the resolved path to the layer directory.
LayerPath string
// Project to adopt into.
Project string
// FromReceipt adopts from a lore receipt.
FromReceipt bool
}
AdoptConfig contains all settings for an adopt operation.
type AdoptGraphBuilder ¶
type AdoptGraphBuilder struct {
// contains filtered or unexported fields
}
AdoptGraphBuilder builds execution graphs for adopt operations.
func NewAdoptGraphBuilder ¶
func NewAdoptGraphBuilder(cfg *AdoptConfig) *AdoptGraphBuilder
NewAdoptGraphBuilder creates a new adopt graph builder.
type Config ¶
type Config struct {
// Tool is "writ" or "lore".
Tool string
// Sources
LayerSources []tree.LayerSource
SourceRoot string // single-repo mode (when no layers configured)
TargetRoot string
// Selection
Projects []string
Segments segment.Segments
// Behavior
DryRun bool
Verbose bool
ConflictResolution execution.ConflictResolution
// Data for templates
TemplateData map[string]any
// Identities for decryption
Identities []age.Identity
// Signing key (optional)
SigningKey *age.X25519Identity
}
Config contains all resolved settings for a lifecycle operation. This is the common base; specific operations extend it.
func (*Config) SegmentMap ¶
SegmentMap returns the segments as a string map for template data.
type DecommissionConfig ¶
type DecommissionConfig struct {
Config
// Force decommission even with unsigned state.
Force bool
// Prune empty parent directories after file removal.
Prune bool
}
DecommissionConfig contains all settings for a decommission operation.
type DecommissionGraphBuilder ¶
type DecommissionGraphBuilder struct {
// contains filtered or unexported fields
}
DecommissionGraphBuilder builds execution graphs for decommission operations.
func NewDecommissionGraphBuilder ¶
func NewDecommissionGraphBuilder(cfg *DecommissionConfig, view *execution.StateView) *DecommissionGraphBuilder
NewDecommissionGraphBuilder creates a new decommission graph builder.
type DeployConfig ¶
type DeployConfig struct {
Config
}
DeployConfig contains all settings for a deploy operation.
type DeployGraphBuilder ¶
type DeployGraphBuilder struct {
// contains filtered or unexported fields
}
DeployGraphBuilder builds execution graphs for deploy operations.
func NewDeployGraphBuilder ¶
func NewDeployGraphBuilder(cfg *DeployConfig) *DeployGraphBuilder
NewDeployGraphBuilder creates a new deploy graph builder.
type GraphBuilder ¶
GraphBuilder is the interface for all graph builders.
type MigrateGraphBuilder ¶
type MigrateGraphBuilder struct {
// contains filtered or unexported fields
}
MigrateGraphBuilder builds execution graphs for migrate operations.
func NewMigrateGraphBuilder ¶
func NewMigrateGraphBuilder(cfg *Config, sourcePath string) *MigrateGraphBuilder
NewMigrateGraphBuilder creates a new migrate graph builder.
type ReconcileConfig ¶
type ReconcileConfig struct {
Config
// CheckDrift enables drift detection for copied files.
CheckDrift bool
// JSONOutput outputs JSON instead of human-readable text.
JSONOutput bool
}
ReconcileConfig contains all settings for a reconcile operation.
type ReconcileGraphBuilder ¶
type ReconcileGraphBuilder struct {
// contains filtered or unexported fields
}
ReconcileGraphBuilder builds execution graphs for reconcile operations.
func NewReconcileGraphBuilder ¶
func NewReconcileGraphBuilder(cfg *ReconcileConfig) *ReconcileGraphBuilder
NewReconcileGraphBuilder creates a new reconcile graph builder.
type TargetSpec ¶
type TargetSpec struct {
SourceDir string // "System" or "Home"
TargetRoot string // "/" or "$HOME"
}
TargetSpec defines a source directory within a repo and its deployment target.
func TargetOrder ¶
func TargetOrder() []TargetSpec
TargetOrder defines the processing order for targets within each repo. System files are deployed before Home files.
type UpgradeConfig ¶
type UpgradeConfig struct {
Config
// Force upgrades even if target has local modifications.
Force bool
}
UpgradeConfig contains all settings for an upgrade operation.
type UpgradeGraphBuilder ¶
type UpgradeGraphBuilder struct {
// contains filtered or unexported fields
}
UpgradeGraphBuilder builds execution graphs for upgrade operations.
func NewUpgradeGraphBuilder ¶
func NewUpgradeGraphBuilder(cfg *UpgradeConfig, view *execution.StateView) *UpgradeGraphBuilder
NewUpgradeGraphBuilder creates a new upgrade graph builder.
type VerifyResult ¶
type VerifyResult int
VerifyResult indicates the outcome of signature verification.
const ( VerifyOK VerifyResult = iota VerifyUnsigned VerifyInvalid VerifyMissing )
func VerifyGraphSignature ¶
VerifyGraphSignature verifies the graph signature using the provided identities. Returns the verification result and any error encountered.
func (VerifyResult) String ¶
func (r VerifyResult) String() string
String returns a human-readable description of the verify result.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package identity provides age identity loading for writ.
|
Package identity provides age identity loading for writ. |
|
Package reconcile provides full-stack drift detection and repair for writ deployments.
|
Package reconcile provides full-stack drift detection and repair for writ deployments. |
|
Package secrets handles encryption/decryption operations via SOPS.
|
Package secrets handles encryption/decryption operations via SOPS. |
|
Package segment provides segment-based directory matching for writ.
|
Package segment provides segment-based directory matching for writ. |