Skip to main content

Module project_config

Module project_config 

Source
Expand description

§Module: project_config

Project-level configuration loaded from .agent-doc/config.toml. Shared between binary and library for consistent project config handling.

§Spec

  • Defines ProjectConfig: per-project settings (tmux_session, components).
  • Defines ComponentConfig: per-component patch configuration (mode, timestamps, hooks).
  • load_project() reads and parses the project config file. On absence, I/O error, or parse error, returns ProjectConfig::default() and emits a warning to stderr (never panics).
  • project_tmux_session() is a convenience wrapper returning the configured tmux session name.
  • save_project() serialises ProjectConfig to TOML and writes it to .agent-doc/config.toml, creating the directory if needed.

§Agentic Contracts

  • Never panics on missing config: load_project() returns defaults when the file is absent.
  • Project config errors are non-fatal: errors are surfaced as stderr warnings, not propagated.
  • Atomic-safe directory creation: save_project() calls create_dir_all before writing.

Structs§

ComponentConfig
Component patch configuration (mode, timestamps, max entries, hooks).
ProjectConfig
Project-level configuration, read from .agent-doc/config.toml relative to CWD.

Functions§

load_project
Load project config from .agent-doc/config.toml in CWD, or return defaults. Also performs one-time migration from legacy components.toml if present.
project_tmux_session
Get the project’s configured tmux session (convenience helper).
save_project
Save project config to .agent-doc/config.toml.
update_project_tmux_session
Update the project’s configured tmux session. Called when the configured session is dead and we fall back to a different one.