repocfg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package repocfg loads a per-repo command allowlist from a coily.yaml file discovered by walking up from the current working directory. Each command

Index

Constants

View Source
const EnvOverride = "COILY_REPO_CONFIG"

EnvOverride, when set, is treated as the absolute path to the repo config and skips directory walking. Primarily for tests and advanced users.

View Source
const Filename = "coily.yaml"

Filename is the name repocfg looks for during discovery.

View Source
const LegacyFilename = "coily.yaml"

LegacyFilename is the pre-overlay name (./coily.yaml) that we reject with a pointer at the new location. Kept around so the error message can be

View Source
const LocalDirName = ".coily"

LocalDirName is the per-repo overlay directory the loader prefers. The canonical home for the repo allowlist is ./.coily/coily.yaml.

Variables

View Source
var ErrLegacyLocation = errors.New("repocfg: coily.yaml at repo root is no longer supported, move it to .coily/coily.yaml")

ErrLegacyLocation is wrapped by Discover when a coily.yaml is found at the repo root rather than under ./.coily/. The new convention is to put it

View Source
var ErrNoConfig = errors.New("repocfg: no coily.yaml found")

ErrNoConfig is returned by LoadDefault when no coily.yaml is found in the cwd ancestry. Callers treat this as "no repo commands to register."

Functions

func Discover

func Discover(start string) (string, error)

Discover walks up from start looking for the repo config. Prefers ./.coily/coily.yaml at each level. If no overlay file is found but a

Types

type Command

type Command struct {
	// Name is the key from the yaml map, e.g. "test".
	Name string
	// Description is the optional human-readable blurb shown in help/--list.
	Description string
	// Argv is the command split into tokens. argv[0] is the binary name as
	// resolved via $PATH at exec time. Every token has been run through
	Argv []string
	// Egress, when true, opts the command into the per-invocation CONNECT
	// proxy that consumers (coily) wire around exec. The audit row picks up
	Egress bool
	// AllowMetacharacters opts this command out of the shell-metacharacter
	// validator for both the YAML-declared argv tokens (skipped at load)
	AllowMetacharacters bool
}

Command is one parsed and validated entry from the commands: map.

type Config

type Config struct {
	// Path is the absolute path to the coily.yaml that produced this Config.
	Path string
	// Commands are sorted by Name. Safe to iterate directly for help output.
	Commands []Command
	// SSHTargets is the named ssh-passthrough target map keyed by alias.
	// Nil/empty when the file has no `ssh:` block. coilysiren/coily#187.
	SSHTargets map[string]SSHTarget
}

Config is the result of a successful Load.

func DiscoverAll

func DiscoverAll(start string) ([]*Config, error)

DiscoverAll returns every coily.yaml reachable from start in a single deterministic pool: every level of the ancestor walk from start up to

func DiscoverChildren

func DiscoverChildren(parentDir string) ([]*Config, error)

DiscoverChildren scans direct children of parentDir for a ./.coily/coily.yaml overlay, loads each one, and returns the resulting

func Load

func Load(path string) (*Config, error)

Load parses the yaml at path. Every command is validated against policy.ValidateArg. A single bad token fails the whole load.

func LoadDefault

func LoadDefault() (*Config, error)

LoadDefault resolves the config path from $COILY_REPO_CONFIG or by walking up from the current working directory, then parses it. Returns nil,

type SSHTarget

type SSHTarget struct {
	// Name is the host alias, e.g. "kai-server". Matches the map key it
	// was loaded under. Validated with the same rules as command names.
	Name string
	// User is the remote ssh user. Plain string; ssh handles the rest.
	User string
	// Host is the remote hostname (or hostname:port). Resolved by the
	// caller's ssh client; repocfg does not DNS-validate.
	Host string
	// WorkingDir is the absolute path of the working directory the remote
	// coily binds its --commit-scope to. Must be absolute (POSIX leading
	WorkingDir string
}

SSHTarget describes one named ssh destination for the `coily ssh <alias> -- <args>` passthrough. All three fields are

Jump to

Keyboard shortcuts

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