Documentation
¶
Overview ¶
Package source owns configuration source adapters. It deliberately has no dependency on Pack or draft semantics.
Index ¶
- Variables
- type Adapter
- type Capabilities
- type CommandRunner
- type GitExecutor
- type GitJSON
- func (g *GitJSON) Capabilities() Capabilities
- func (g *GitJSON) Inspect() (InspectResult, error)
- func (g *GitJSON) Load() (Snapshot, error)
- func (g *GitJSON) Preview(input SaveInput) (Preview, error)
- func (g *GitJSON) ReviewWorkspace() (GitWorkspace, []string, error)
- func (g *GitJSON) Save(input SaveInput) (Snapshot, error)
- func (g *GitJSON) Status() (Status, error)
- type GitJSONField
- type GitJSONFile
- type GitJSONMapping
- type GitJSONProfile
- type GitWorkspace
- type InspectResult
- type ManagedFile
- type MappingDiagnostic
- type Preview
- type PreviewFile
- type SaveInput
- type Snapshot
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( ErrGitWorkspaceDirty = errors.New("git workspace is dirty") ErrRoundTripBlocked = errors.New("git-json round-trip is blocked") )
var DefaultGitExecutor = GitExecutor{Runner: execCommandRunner{}}
var ErrRevisionMismatch = errors.New("source revision mismatch")
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type CommandRunner ¶
CommandRunner executes a program using an argument vector. It deliberately has no shell-string entry point so callers cannot accidentally interpolate branch names, paths, or commit messages into a shell command.
type GitExecutor ¶
type GitExecutor struct {
Runner CommandRunner
}
GitExecutor centralizes every system Git invocation used by source adapters and the review workflow. Tests replace Runner to assert exact argument boundaries without starting a shell.
type GitJSON ¶
type GitJSON struct {
// contains filtered or unexported fields
}
func OpenGitJSON ¶
func (*GitJSON) Capabilities ¶
func (g *GitJSON) Capabilities() Capabilities
func (*GitJSON) Inspect ¶
func (g *GitJSON) Inspect() (InspectResult, error)
func (*GitJSON) ReviewWorkspace ¶
func (g *GitJSON) ReviewWorkspace() (GitWorkspace, []string, error)
ReviewWorkspace returns only the Git repository and declarative managed paths. Unlike Status, it does not read mapped documents, so a blocked round-trip can still be inspected and reported to the user.
type GitJSONField ¶
type GitJSONFile ¶
type GitJSONMapping ¶
type GitJSONMapping struct {
Name string `yaml:"name" json:"name"`
Collection string `yaml:"collection" json:"collection"`
Scope string `yaml:"scope" json:"scope"`
File string `yaml:"file" json:"file"`
RecordsPath string `yaml:"records_path" json:"records_path"`
IDPath string `yaml:"id_path" json:"id_path"`
EnvironmentIDPath string `yaml:"environment_id_path" json:"environment_id_path"`
Fields map[string]GitJSONField `yaml:"fields" json:"fields"`
}
type GitJSONProfile ¶
type GitJSONProfile struct {
Version int `yaml:"version" json:"version"`
Files []GitJSONFile `yaml:"files" json:"files"`
Mappings []GitJSONMapping `yaml:"mappings" json:"mappings"`
}
GitJSONProfile is a declarative bridge from a repository-owned document to the source-neutral configuration shape. Paths are RFC 6901 JSON pointers.
type GitWorkspace ¶
type GitWorkspace struct {
Root string `json:"root"`
Branch string `json:"branch"`
Dirty bool `json:"dirty"`
}
GitWorkspace is deliberately limited to safe, user-visible repository state. The adapter only invokes read-only git commands.
type InspectResult ¶
type InspectResult struct {
Workspace GitWorkspace `json:"workspace"`
ProfilePath string `json:"profile_path"`
Matched bool `json:"matched"`
Diagnostics []MappingDiagnostic `json:"diagnostics"`
}
type ManagedFile ¶
type ManagedFile struct {
// contains filtered or unexported fields
}
func OpenManagedFile ¶
func OpenManagedFile(workspace string) *ManagedFile
func (*ManagedFile) Capabilities ¶
func (m *ManagedFile) Capabilities() Capabilities
func (*ManagedFile) Load ¶
func (m *ManagedFile) Load() (Snapshot, error)
func (*ManagedFile) Status ¶
func (m *ManagedFile) Status() (Status, error)
type MappingDiagnostic ¶
type Preview ¶
type Preview struct {
Digest string `json:"source_digest"`
Files []PreviewFile `json:"files"`
}
type PreviewFile ¶
type SaveInput ¶
type SaveInput struct {
ExpectedRevision string
EnvironmentID string
Baseline map[string]any
EnvironmentOverride map[string]any
}
SaveInput replaces the two source layers visible to one draft save. A nil environment override removes the managed file for that environment.