Documentation
¶
Overview ¶
Package writ implements the writ CLI commands.
Index ¶
- Variables
- func CollectLayerSources() ([]tree.LayerSource, error)
- func NewRootCmd() *cobra.Command
- func PartitionByScope(sources []tree.LayerSource) map[string][]tree.LayerSource
- func TargetHome() string
- func TargetSystem() string
- type AdoptConfig
- type Config
- type DecommissionConfig
- type DeployConfig
- type ReconcileConfig
- type RepoRegistration
- type TargetSpec
- type UpgradeConfig
Constants ¶
This section is empty.
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 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 NewRootCmd ¶
NewRootCmd creates the root writ command with all subcommands.
Returns:
- *cobra.Command: configured writ command with target flag and all subcommands
func PartitionByScope ¶
func PartitionByScope(sources []tree.LayerSource) map[string][]tree.LayerSource
PartitionByScope groups layer sources by their TargetName ("System", "Home"). Sources within each partition retain their original ordering. Returns an empty map when sources is empty.
Parameters:
- sources: flat list of layer sources from CollectLayerSources
Returns:
- map[string][]tree.LayerSource: sources keyed by TargetName
func TargetHome ¶
func TargetHome() string
TargetHome returns the deployment target for Home-scoped sources.
The configured value wins when set, which is what makes a deployment addressable somewhere other than the operator's own home — a staging tree, or a test sandbox. Home itself is resolved, never injected: the account database outranks the environment (see xdg), so `HOME` cannot move a deployment and this key is the only thing that can.
Returns:
- `string`: `writ.targets.home` when set, else the user's home directory.
func TargetSystem ¶
func TargetSystem() string
TargetSystem returns the deployment target for System-scoped sources.
The default is `/`, which is correct on Unix and **wrong on Windows**, where a leading separator with no volume is drive-relative and therefore resolves against whatever drive the process is standing on. Fixing that default is [step 58]; this accessor exists so the fix lands in one place, and so a caller that cannot wait — a test, or a staging deployment — can name the root explicitly today.
[step 58]: ../../../docs/plans/extract-starlark-from-op/phase-8/steps/58-windows-system-target-root.md
Returns:
- `string`: `writ.targets.system` when set, else `/`.
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 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
ConflictPolicy op.ConflictPolicy
// 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
// Prune empty parent directories after file removal.
Prune bool
}
DecommissionConfig contains all settings for a decommission operation.
type DeployConfig ¶
type DeployConfig struct {
Config
// AllowDirty permits planning against layers with uncommitted changes.
AllowDirty bool
}
DeployConfig contains all settings for a deploy operation.
type ReconcileConfig ¶
type ReconcileConfig struct {
Config
}
ReconcileConfig contains all settings for a reconcile report.
type RepoRegistration ¶
type RepoRegistration struct {
Layer string `json:"layer"`
Root string `json:"root,omitempty"`
State string `json:"state"`
}
RepoRegistration is a layer's registration as the `repo` commands report it: which layer, the working-tree root it points at, and what state the registration is in. A result like any other, so `--output json` feeds a script and `--output table` scans (10-command-line-interface.md §5).
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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package adopt plans the `writ adopt` batch graph.
|
Package adopt plans the `writ adopt` batch graph. |
|
Package decommission removes deployed files through the sealed graph model (phase-8 step 47 slice 2).
|
Package decommission removes deployed files through the sealed graph model (phase-8 step 47 slice 2). |
|
Package deploy plans and executes writ deployments on the sealed graph model (phase-8 step 47 slice 1).
|
Package deploy plans and executes writ deployments on the sealed graph model (phase-8 step 47 slice 1). |
|
Package identity provides age identity loading for writ.
|
Package identity provides age identity loading for writ. |
|
Package migrate implements dotfile migration analysis and execution.
|
Package migrate implements dotfile migration analysis and execution. |
|
Package readback derives "what has writ deployed" from the store's graph and trace documents (phase-8 step 47 slice 1).
|
Package readback derives "what has writ deployed" from the store's graph and trace documents (phase-8 step 47 slice 1). |
|
Package reconcile reports what should be present, where it should have come from, and what's missing or different.
|
Package reconcile reports what should be present, where it should have come from, and what's missing or different. |
|
Package secret implements the writ secret family: SOPS lifecycle operations scoped to registered layers.
|
Package secret implements the writ secret family: SOPS lifecycle operations scoped to registered layers. |
|
Package segment provides segment-based directory matching for writ.
|
Package segment provides segment-based directory matching for writ. |
|
Package snapshot provides git worktree-based snapshots for hermetic planning.
|
Package snapshot provides git worktree-based snapshots for hermetic planning. |
|
Package tree builds deployment trees from source and target specifications.
|
Package tree builds deployment trees from source and target specifications. |
|
Package upgrade regenerates deployed copied files (templates, secrets, copies) from their current sources (phase-8 step 47 slice 2).
|
Package upgrade regenerates deployed copied files (templates, secrets, copies) from their current sources (phase-8 step 47 slice 2). |