Documentation
¶
Overview ¶
Package rc provides runtime configuration loading from .contextrc files.
Index ¶
Constants ¶
const DefaultArchiveAfterDays = 7
DefaultArchiveAfterDays is the default days before archiving.
const DefaultTokenBudget = 8000
DefaultTokenBudget is the default token budget when not configured.
Variables ¶
This section is empty.
Functions ¶
func AllowOutsideCwd ¶ added in v0.6.0
func AllowOutsideCwd() bool
AllowOutsideCwd returns whether boundary validation should be skipped.
Returns false (default) when the field is not set in .contextrc.
Returns:
- bool: True if context directory is allowed outside the project root
func ArchiveAfterDays ¶
func ArchiveAfterDays() int
ArchiveAfterDays returns the configured days before archiving.
Returns:
- int: Number of days after which completed tasks are archived (default 7)
func AutoArchive ¶
func AutoArchive() bool
AutoArchive returns whether auto-archiving is enabled.
Returns:
- bool: True if completed tasks should be auto-archived
func ContextDir ¶
func ContextDir() string
ContextDir returns the configured context directory.
Priority: CLI override > env var > .contextrc > default.
Returns:
- string: The context directory path (e.g., ".context")
func FilePriority ¶
FilePriority returns the priority of a context file.
If a priority_order is configured in .contextrc, that order is used. Otherwise, the default config.FileReadOrder is used.
Lower numbers indicate higher priority (1 = highest). Unknown files return 100.
Parameters:
- name: Filename to look up (e.g., "TASKS.md")
Returns:
- int: Priority value (1-9 for known files, 100 for unknown)
func OverrideContextDir ¶
func OverrideContextDir(dir string)
OverrideContextDir sets a CLI-provided override for the context directory.
This takes precedence over all other configuration sources.
Parameters:
- dir: Directory path to use as an override
func PriorityOrder ¶
func PriorityOrder() []string
PriorityOrder returns the configured file priority order.
Returns:
- []string: File names in priority order, or nil if not configured (callers should fall back to config.FileReadOrder)
func Reset ¶
func Reset()
Reset clears the cached configuration, forcing reload on the next access. This is primarily useful for testing.
func ScratchpadEncrypt ¶ added in v0.6.0
func ScratchpadEncrypt() bool
ScratchpadEncrypt returns whether the scratchpad should be encrypted.
Returns true (default) when the field is not set in .contextrc.
Returns:
- bool: True if scratchpad encryption is enabled (default true)
func TokenBudget ¶
func TokenBudget() int
TokenBudget returns the configured default token budget.
Priority: env var > .contextrc > default (8000).
Returns:
- int: The token budget for context assembly
Types ¶
type CtxRC ¶
type CtxRC struct {
ContextDir string `yaml:"context_dir"`
TokenBudget int `yaml:"token_budget"`
PriorityOrder []string `yaml:"priority_order"`
AutoArchive bool `yaml:"auto_archive"`
ArchiveAfterDays int `yaml:"archive_after_days"`
ScratchpadEncrypt *bool `yaml:"scratchpad_encrypt"`
AllowOutsideCwd bool `yaml:"allow_outside_cwd"`
}
CtxRC represents the configuration from the .contextrc file.
Fields:
- ContextDir: Name of the context directory (default ".context")
- TokenBudget: Default token budget for context assembly (default 8000)
- PriorityOrder: Custom file loading priority order
- AutoArchive: Whether to auto-archive completed tasks (default true)
- ArchiveAfterDays: Days before archiving completed tasks (default 7)
- ScratchpadEncrypt: Whether to encrypt the scratchpad (default true)
- AllowOutsideCwd: Skip boundary validation for external context dirs (default false)