worktreepolicy

package
v0.179.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package worktreepolicy owns the pure worktree configuration format and validation. Reading a user or repository policy remains the responsibility of the caller.

Index

Constants

View Source
const (
	Version                  = 1
	MaxConfigSize            = 64 << 10
	StoreModeCentral         = "central"
	StoreModeRepositoryLocal = "repository-local"
)

Variables

This section is empty.

Functions

func RepositoryPlacementPolicy

func RepositoryPlacementPolicy(config Config, baseRevision, userConfigPath string) error

RepositoryPlacementPolicy rejects machine-local settings in a tracked policy.

func ValidateRetiredArchiveRepositoryName

func ValidateRetiredArchiveRepositoryName(repository string) error

ValidateRetiredArchiveRepositoryName preserves the repository-basename grammar used by the worktrees facade, including a leading dot.

Types

type BranchValidator

type BranchValidator func(string) bool

BranchValidator checks the complete candidate ref, including the probe suffix. The caller supplies its existing Git branch grammar implementation.

type Config

type Config struct {
	Version   int `yaml:"version"`
	Worktrees struct {
		BranchPrefix *string `yaml:"branch_prefix"`
		// Store and Root are machine-local user policy, never repository policy.
		Store *string `yaml:"store"`
		Root  *string `yaml:"root"`
	} `yaml:"worktrees"`
	// Retirement is machine-local user policy. A source repository cannot
	// choose where a developer exports private Work Log evidence.
	Retirement struct {
		ArchiveRepository *string                                     `yaml:"archive_repository"`
		Organizations     map[string]RetiredArchiveOrganizationConfig `yaml:"organizations"`
	} `yaml:"retirement"`
}

Config is layered user then repository. A nil prefix leaves the lower layer intact; an explicitly empty value deliberately disables it.

func Decode

func Decode(path string, contents []byte, validBranch BranchValidator) (Config, bool, error)

Decode validates policy bytes without reading files or invoking Git. The found result mirrors the facade contract: true only for a valid document.

type RetiredArchiveOrganizationConfig

type RetiredArchiveOrganizationConfig struct {
	ArchiveRepository *string `yaml:"archive_repository"`
}

Jump to

Keyboard shortcuts

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