Documentation
¶
Overview ¶
Package projects defines the local filesystem policy for git-ci projects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeSlug ¶
NormalizeSlug converts arbitrary text into lowercase ASCII slug components. Runs of unsupported characters become one hyphen, while leading and trailing separators are removed. An input with no ASCII letters or digits normalizes to the empty string and should be rejected or given a fallback by the caller.
func SuggestSlug ¶
SuggestSlug deterministically derives a valid project slug from path's directory basename. It does not inspect existing projects, so suggestions do not change when another project with the same basename is discovered.
func ValidateSlug ¶
ValidateSlug reports whether slug contains only lowercase ASCII letters, digits, and single interior hyphens.
Types ¶
type Project ¶
Project is an immediately discovered Git repository. Path is canonical and SuggestedSlug is derived only from the directory basename.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry contains the canonical directories under which local projects may be selected. Its roots are immutable after construction.
func NewRegistry ¶
NewRegistry builds a project registry from configured roots. Every root must already exist and be a directory. Roots are made absolute, symlinks are resolved, then equal and nested roots are removed. The remaining roots are sorted lexicographically so policy decisions do not depend on configuration order.
func (*Registry) Discover ¶
Discover finds Git repositories that are immediate children of configured roots. It does not walk descendants. Entries whose canonical target escapes a root are ignored. Results are sorted by canonical path, then suggested slug, and duplicate canonical paths are returned once.
func (*Registry) DiscoverProjects ¶
DiscoverProjects is an explicit name for Discover.
func (*Registry) ValidateLocalPath ¶
ValidateLocalPath validates an operator-selected local directory and returns its canonical path. Absolute paths must be beneath one configured root. Relative paths are evaluated beneath every canonical root in sorted order; exactly one existing canonical directory must be valid, otherwise an absent or ambiguous selection is rejected. The process working directory is never used to resolve a relative selection.