Files
kami 9734eec63c docs: add module documentation in AsciiDoc with PlantUML diagrams
Generated by per-group subagents covering all 52 modules across:
core (18), infrastructure (10), apps (5), interfaces (3),
plugins (7), testing (9)

Documentation format:
- AsciiDoc (.adoc) files in docs/modules/<group>/
- PlantUML (.puml) files in docs/diagrams/
- .adoc files reference diagrams via include:: directives

Each doc covers: purpose, responsibilities, non-responsibilities,
key types, event flow, integration points, invariants, PlantUML
diagram, known issues, and open questions.
2026-05-26 16:59:21 +04:00

90 lines
2.8 KiB
Plaintext

= core-config
== purpose
Loads and represents the Correx application configuration from a TOML file. Provides a single entry point (`ConfigLoader`) that reads `~/.config/correx/config.toml` (or a path from `CORREX_CONFIG`) and returns a `CorrexConfig` data class with validated defaults.
== responsibilities
* Read configuration file from well-known filesystem path
* Parse TOML-format configuration with minimal manual parser
* Provide type-safe config objects with sensible defaults for all subsystems
* Silently fall back to defaults when config file is missing or unparseable
== non-responsibilities
* Does not validate configuration values semantically (beyond type coercion)
* Does not watch for file changes at runtime
* Does not manage environment variables beyond `CORREX_CONFIG`
* Does not expose configuration to remote clients
== key types
=== CorrexConfig
* **kind**: data class
* **purpose**: Root configuration object, aggregating all subsystem configs.
* **fields**: `server`, `tui`, `cli`, `approval`, `tools`
=== ServerConfig
* **kind**: data class
* **purpose**: Ktor HTTP server binding configuration.
* **fields**: `host` (default `"localhost"`), `port` (default `8080`)
=== TuiConfig
* **kind**: data class
* **purpose**: Terminal UI preferences.
* **fields**: `theme` (default `"dark"`), `sessionListLimit` (default `5`)
=== CliConfig
* **kind**: data class
* **purpose**: CLI output formatting preferences.
* **fields**: `defaultOutput` (default `"human"`)
=== ApprovalConfig
* **kind**: data class
* **purpose**: Approval gate timeouts.
* **fields**: `timeoutMs` (default `300_000L`)
=== ToolsConfig
* **kind**: data class
* **purpose**: Tool sandbox and execution configuration.
* **fields**: `sandboxRoot`, `workingDir`, `shellAllowedExecutables`, `defaultSystemPromptPath`
=== ConfigLoader
* **kind**: object
* **purpose**: Stateless loader that reads and parses the TOML config file.
* **fields**: none (singleton)
== event flow
*None.* Config is read eagerly at startup and does not participate in event sourcing.
== integration points
* `core:events` — `@Serializable` annotations on all config types
* `apps:cli`, `apps:server`, `core:approvals`, `core:tools` — consume `CorrexConfig` fields
== invariants
* ConfigLoader must never throw on missing or unparseable files — always returns `CorrexConfig()` with defaults
* All config types are `@Serializable` for potential persistence
== PlantUML diagram
[plantuml, core-config, "png"]
----
include::../../diagrams/core-config.puml[]
----
== known issues
* TOML parser is hand-written and only supports sections with simple `key = value` pairs. Arrays, inline tables, and multi-line strings are not supported.
== open questions
* Will config be migrated to a proper TOML library (e.g., `ktoml`)?
* Should config support hot-reload or remain load-once?