config

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads Prism configuration from prism.yaml and environment.

Index

Constants

This section is empty.

Variables

View Source
var QuietProblems bool

QuietProblems stops WarnProblems; doctor and config report problems in their own output.

Functions

func ModelContextWindow

func ModelContextWindow(model string) int

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 LoadFile

func LoadFile(path string) *Config

LoadFile parses one prism.yaml path; a missing file gives the defaults.

func LoadFromDir

func LoadFromDir(dir string) (*Config, error)

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

func Parse(data []byte) *Config

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

func (c *Config) ContextWindow() int

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

func (c *Config) Keys() [][3]string

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.

func (*Config) WithModel

func (c *Config) WithModel(model string) *Config

WithModel returns a shallow copy of the config with Model overridden. Use this for per-call effective context windows without mutating state.

type WorkspaceRepo

type WorkspaceRepo struct {
	ID   string
	Path string
}

WorkspaceRepo is one `workspace_repo:` entry.

Jump to

Keyboard shortcuts

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