Documentation
¶
Overview ¶
Package sidecar coordinates skeeper's mirrored Git repository.
Index ¶
- Constants
- func DefaultNamespace(repoName string) string
- func PrintJSON(w io.Writer, value any) error
- func UpdateGitignore(root string, namespaces []config.Namespace) error
- type FSCKOptions
- type FSCKResult
- type HydrateResult
- type InitDefaults
- type InitOptions
- type InitResult
- type LogOptions
- type MergeDriverNamespace
- type MergeDriverOptions
- type MergeDriverResult
- type MutateOptions
- type MutateResult
- type NamespaceStatus
- type NamespaceSyncResult
- type NamespaceVerification
- type PatternAddOptions
- type PatternAddResult
- type PatternTestOptions
- type PatternTestResult
- type RepairStatus
- type Service
- func (s *Service) Adopt(ctx context.Context, dir string, targets []string, opts MutateOptions) (MutateResult, error)
- func (s *Service) FSCK(ctx context.Context, dir string, opts FSCKOptions) (FSCKResult, error)
- func (s *Service) HooksCheck(ctx context.Context, dir string) (hooks.CheckResult, error)
- func (s *Service) HooksInstall(ctx context.Context, dir string) (hooks.InstallResult, error)
- func (s *Service) Hydrate(ctx context.Context, dir string) (HydrateResult, error)
- func (s *Service) Init(ctx context.Context, dir string, opts InitOptions) (InitResult, error)
- func (s *Service) InitDefaults(ctx context.Context, dir string) (InitDefaults, error)
- func (s *Service) Log(ctx context.Context, dir, path string, options ...LogOptions) (string, error)
- func (s *Service) MergeDriver(ctx context.Context, dir string, opts MergeDriverOptions) (MergeDriverResult, error)
- func (s *Service) PatternAdd(ctx context.Context, dir, glob string, opts PatternAddOptions) (PatternAddResult, error)
- func (s *Service) PatternTest(ctx context.Context, dir, glob string, opts PatternTestOptions) (PatternTestResult, error)
- func (s *Service) RecordBypass(ctx context.Context, dir, reason string) error
- func (s *Service) RepairAbort(ctx context.Context, dir string) error
- func (s *Service) RepairResume(ctx context.Context, dir string) (SyncResult, error)
- func (s *Service) RepairStatus(ctx context.Context, dir string) (RepairStatus, error)
- func (s *Service) Status(ctx context.Context, dir string) (Status, error)
- func (s *Service) Sync(ctx context.Context, dir string, opts SyncOptions) (SyncResult, error)
- func (s *Service) Untrack(ctx context.Context, dir string, targets []string, opts MutateOptions) (MutateResult, error)
- func (s *Service) Verify(ctx context.Context, dir string, opts VerifyOptions) (VerifyResult, error)
- type Status
- type SyncOptions
- type SyncResult
- type VerifyOptions
- type VerifyResult
Constants ¶
const (
// DirName is the sidecar clone directory in the main worktree.
DirName = ".skeeper"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultNamespace ¶ added in v0.1.1
DefaultNamespace returns a safe sidecar namespace derived from a repo name.
Types ¶
type FSCKOptions ¶ added in v0.2.0
FSCKOptions configures working-tree drift checks.
type FSCKResult ¶ added in v0.2.0
type FSCKResult struct {
OK bool `json:"ok"`
Diagnostics []reconcile.Diagnostic `json:"diagnostics,omitempty"`
}
FSCKResult reports working-tree drift against the lock.
type HydrateResult ¶
HydrateResult reports files restored by hydrate.
type InitDefaults ¶
type InitDefaults struct {
SidecarName string
Visibility string
Namespace string
Patterns []string
}
InitDefaults reports the values init should present before user overrides.
type InitOptions ¶
type InitOptions struct {
Sidecar string
SidecarName string
Visibility string
Namespace string
NamespaceSet bool
Bootstrap string
Patterns []string
}
InitOptions configures project bootstrap.
type InitResult ¶
type InitResult struct {
Root string
Sidecar string
Config config.Config
HookPath string
Gitignore string
}
InitResult reports files changed by init.
type LogOptions ¶ added in v0.2.0
LogOptions configures sidecar history output.
type MergeDriverNamespace ¶ added in v0.2.0
type MergeDriverNamespace struct {
Name string `json:"name"`
Branch string `json:"branch"`
Digest lockfile.NamespaceDigest `json:"digest"`
Files int `json:"files"`
Bytes int64 `json:"bytes"`
}
MergeDriverNamespace reports regenerated lock data for one namespace.
type MergeDriverOptions ¶ added in v0.2.0
type MergeDriverOptions struct {
BasePath string `json:"base_path,omitempty"`
CurrentPath string `json:"current_path,omitempty"`
OtherPath string `json:"other_path,omitempty"`
}
MergeDriverOptions contains paths passed by Git's custom merge-driver protocol.
type MergeDriverResult ¶ added in v0.2.0
type MergeDriverResult struct {
LockPath string `json:"lock_path"`
OutputPath string `json:"output_path,omitempty"`
Namespaces []MergeDriverNamespace `json:"namespaces"`
BasePath string `json:"base_path,omitempty"`
CurrentPath string `json:"current_path,omitempty"`
OtherPath string `json:"other_path,omitempty"`
ChangedFiles int `json:"changed_files"`
}
MergeDriverResult reports a regenerated lockfile merge result.
type MutateOptions ¶ added in v0.2.0
MutateOptions configures adopt/untrack.
type MutateResult ¶ added in v0.2.0
type MutateResult struct {
Plan reconcile.Plan `json:"plan"`
Changed []reconcile.TargetDecision `json:"changed"`
DryRun bool `json:"dry_run,omitempty"`
}
MutateResult reports adopt/untrack changes.
type NamespaceStatus ¶ added in v0.1.1
type NamespaceStatus struct {
Name string `json:"name"`
Branch string `json:"branch"`
LastCommit string `json:"last_commit,omitempty"`
LastUnix int64 `json:"last_unix,omitempty"`
Remote string `json:"remote"`
TrackedFiles int `json:"tracked_files"`
LockedCommit string `json:"locked_commit,omitempty"`
LockedDigest lockfile.NamespaceDigest `json:"locked_digest,omitempty"`
}
NamespaceStatus describes one namespace's sidecar state.
type NamespaceSyncResult ¶ added in v0.1.1
type NamespaceSyncResult struct {
Name string `json:"name"`
Branch string `json:"branch"`
ChangedFiles int `json:"changed_files"`
Committed bool `json:"committed"`
Commit string `json:"commit"`
Digest lockfile.NamespaceDigest `json:"digest"`
Files int `json:"files"`
Bytes int64 `json:"bytes"`
Warnings []reconcile.Diagnostic `json:"warnings,omitempty"`
}
NamespaceSyncResult reports one namespace sync outcome.
type NamespaceVerification ¶ added in v0.2.0
type NamespaceVerification struct {
Name string `json:"name"`
Branch string `json:"branch"`
Commit string `json:"commit"`
Digest lockfile.NamespaceDigest `json:"digest"`
Expected lockfile.NamespaceDigest `json:"expected_digest"`
OK bool `json:"ok"`
}
NamespaceVerification reports one namespace verification.
type PatternAddOptions ¶ added in v0.2.0
type PatternAddOptions struct {
Namespace string
Exclude []string
AdoptExisting bool
DryRun bool
JSON bool
Force bool
Commit bool
Message string
}
PatternAddOptions configures pattern add.
type PatternAddResult ¶ added in v0.2.0
type PatternAddResult struct {
ConfigPath string `json:"config_path"`
Gitignore string `json:"gitignore"`
Plan reconcile.Plan `json:"plan"`
DryRun bool `json:"dry_run,omitempty"`
}
PatternAddResult reports pattern add.
type PatternTestOptions ¶ added in v0.2.0
PatternTestOptions configures pattern test.
type PatternTestResult ¶ added in v0.2.0
type PatternTestResult struct {
Namespace string `json:"namespace"`
Glob string `json:"glob"`
Matches []string `json:"matches"`
}
PatternTestResult reports pattern test matches.
type RepairStatus ¶ added in v0.2.0
type RepairStatus struct {
Transaction *state.Transaction `json:"transaction,omitempty"`
Bypass *state.Bypass `json:"bypass,omitempty"`
}
RepairStatus reports local-only repair state.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service executes sidecar workflows.
func (*Service) Adopt ¶ added in v0.2.0
func (s *Service) Adopt(ctx context.Context, dir string, targets []string, opts MutateOptions) (MutateResult, error)
Adopt stops tracking files in the main index after sidecar coverage is pushed.
func (*Service) FSCK ¶ added in v0.2.0
func (s *Service) FSCK(ctx context.Context, dir string, opts FSCKOptions) (FSCKResult, error)
FSCK compares working-tree owned specs against skeeper.lock.
func (*Service) HooksCheck ¶ added in v0.2.0
HooksCheck checks managed hooks.
func (*Service) HooksInstall ¶ added in v0.2.0
HooksInstall installs managed hooks.
func (*Service) Hydrate ¶
Hydrate clones the sidecar if needed and restores spec files from skeeper.lock.
func (*Service) Init ¶
func (s *Service) Init(ctx context.Context, dir string, opts InitOptions) (InitResult, error)
Init creates the remote sidecar, clones it, writes config, and installs hooks.
func (*Service) InitDefaults ¶
InitDefaults returns deterministic defaults for the project at dir.
func (*Service) MergeDriver ¶ added in v0.2.0
func (s *Service) MergeDriver( ctx context.Context, dir string, opts MergeDriverOptions, ) (MergeDriverResult, error)
MergeDriver regenerates skeeper.lock for Git merge-driver invocations.
func (*Service) PatternAdd ¶ added in v0.2.0
func (s *Service) PatternAdd(ctx context.Context, dir, glob string, opts PatternAddOptions) (PatternAddResult, error)
PatternAdd adds a namespace pattern and optionally adopts existing matches.
func (*Service) PatternTest ¶ added in v0.2.0
func (s *Service) PatternTest( ctx context.Context, dir, glob string, opts PatternTestOptions, ) (PatternTestResult, error)
PatternTest reports matches for a candidate glob.
func (*Service) RecordBypass ¶ added in v0.2.0
RecordBypass records an audited pre-commit bypass.
func (*Service) RepairAbort ¶ added in v0.2.0
RepairAbort aborts a transaction before main-index mutation.
func (*Service) RepairResume ¶ added in v0.2.0
RepairResume resumes by running a fresh sync with the recorded inputs.
func (*Service) RepairStatus ¶ added in v0.2.0
RepairStatus returns current repair state.
func (*Service) Sync ¶
func (s *Service) Sync(ctx context.Context, dir string, opts SyncOptions) (SyncResult, error)
Sync mirrors main-tree spec files into the sidecar, pushes, writes, and stages skeeper.lock.
func (*Service) Untrack ¶ added in v0.2.0
func (s *Service) Untrack(ctx context.Context, dir string, targets []string, opts MutateOptions) (MutateResult, error)
Untrack removes main-index tracking while preserving sidecar coverage.
func (*Service) Verify ¶ added in v0.2.0
func (s *Service) Verify(ctx context.Context, dir string, opts VerifyOptions) (VerifyResult, error)
Verify validates skeeper.lock against the sidecar remote.
type Status ¶
type Status struct {
Sidecar string `json:"sidecar"`
Branch string `json:"branch"`
LockPresent bool `json:"lock_present"`
LockCommit string `json:"lock_commit,omitempty"`
Namespaces []NamespaceStatus `json:"namespaces"`
Transaction *state.Transaction `json:"transaction,omitempty"`
Bypass *state.Bypass `json:"bypass,omitempty"`
Diagnostics []reconcile.Diagnostic `json:"diagnostics,omitempty"`
}
Status describes the current sidecar state.
type SyncOptions ¶
type SyncOptions struct {
DryRun bool
JSON bool
Commit bool
Message string
Hook bool
Staged bool
Force bool
// Pull is accepted for older call sites; strict sync always fetches/rebases.
Pull bool
}
SyncOptions configures a sync run.
type SyncResult ¶
type SyncResult struct {
ChangedFiles int `json:"changed_files"`
Committed bool `json:"committed"`
Commit string `json:"commit,omitempty"`
Namespaces []NamespaceSyncResult `json:"namespaces"`
LockPath string `json:"lock_path,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
}
SyncResult reports a completed sync.
type VerifyOptions ¶ added in v0.2.0
VerifyOptions configures lock verification.
type VerifyResult ¶ added in v0.2.0
type VerifyResult struct {
OK bool `json:"ok"`
Namespaces []NamespaceVerification `json:"namespaces"`
Diagnostics []reconcile.Diagnostic `json:"diagnostics,omitempty"`
}
VerifyResult reports lock verification.