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 ¶
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.
const Filename = "coily.yaml"
Filename is the name repocfg looks for during discovery.
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
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 ¶
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
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 ¶
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 ¶
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 ¶
DiscoverChildren scans direct children of parentDir for a ./.coily/coily.yaml overlay, loads each one, and returns the resulting
func Load ¶
Load parses the yaml at path. Every command is validated against policy.ValidateArg. A single bad token fails the whole load.
func LoadDefault ¶
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