Documentation
¶
Overview ¶
Package config loads Prism configuration from prism.yaml and environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var QuietProblems bool
QuietProblems stops WarnProblems; doctor and config report problems in their own output.
Functions ¶
func ModelContextWindow ¶
ModelContextWindow maps known model name substrings to their context window. Matching is case-insensitive prefix/substring to handle versioned IDs like "claude-sonnet-4-6" or "gpt-4o-2024-11-20" without exhaustive enumeration.
Types ¶
type Config ¶
type Config struct {
// Version, Harnesses and Interface are written by prism init.
Version string
Harnesses string
Interface string
// Model is the active AI model identifier. There is NO auto-detection —
// the MCP initialize handshake does not carry the model — so it is set
// only via prism.yaml, PRISM_MODEL, or a per-call model= argument. When
// empty, ContextWindow() returns a safe 200k default that covers all
// current production models.
Model string
Profile string
MaxCacheFiles int
// Port is prism serve's default port, from `port:` (0 = 8888).
Port int
// ArchDeny holds declared architecture rules, one per `arch_deny:` line
// in prism.yaml: "<from> -> <to>" where each side is a component name
// (directory), a prefix (covers subdirectories), a glob, or "*".
// Validated by prism arch / prism_arch_check against the induced
// component view; every violation cites concrete file:line sites.
ArchDeny []string
// WorkspaceRepos lists other repositories linked to this one, one per
// `workspace_repo: <id>=<path>` line. Path is as written: relative to the
// directory holding this prism.yaml, or absolute.
WorkspaceRepos []WorkspaceRepo
// WorkspaceServer is the shared link server, from `workspace_server:`.
WorkspaceServer string
// CIFailOn lists the finding kinds that fail `prism ci`, from
// `ci_fail_on: missed_sites, arch` (default both).
CIFailOn []string
// CIComment: the CI action posts one sticky PR comment, `ci_comment:`.
CIComment bool
// SensitivePaths adds patterns to the files whose text is withheld from
// search and read, from `sensitive_paths: a, b` (additive only).
SensitivePaths []string
// Sources maps each key set by prism.yaml or the environment to where
// it came from ("prism.yaml:<line>" or "env PRISM_X").
Sources map[string]string
// Problems lists unknown keys and invalid values, one message each.
Problems []string
}
Config holds the resolved Prism configuration. It is the one parser of prism.yaml (CON-08): init's own keys (version, harnesses, interface) are read here too, not by ad hoc line scanners.
func Default ¶
func Default() *Config
Default returns config values with environment overrides applied. Model intentionally defaults to "" (unset — 200k-window default applies).
func LoadFromDir ¶
LoadFromDir looks for prism.yaml in dir and merges over Default(). Parser is intentionally minimal: KEY: VALUE per line, comments with '#'. This keeps Prism single-binary with no YAML dep.
func Parse ¶
Parse reads prism.yaml content (for a revision other than the working tree: prism ci reads its settings from the base commit).
func (*Config) ContextWindow ¶
ContextWindow returns the total context window in tokens for the model. When Model is empty or unrecognised, returns a safe 200k default that is correct for all current Claude models and generous for others.
func (*Config) Keys ¶
Keys lists every known key with its resolved value and source ("default" when neither prism.yaml nor the environment set it).
func (*Config) WarnProblems ¶
func (c *Config) WarnProblems()
WarnProblems prints each problem once per process to stderr.
type WorkspaceRepo ¶
WorkspaceRepo is one `workspace_repo:` entry.