upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/AGENTS.md
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-10 22:05:33 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-10 22:05:33 +0000
commit3ac8c0cc93b7e07881ce9ba036dd9d8f8b09cb4c (patch)
treec00a0bd8dd9b50dec0831866fe76c13749ab428a /AGENTS.md
parentfe40518a2d2d30f29b8b668c42ce2afa059d95a8 (diff)
docs: add 4-way config sync requirement to AGENTS.md
- Add Configuration Management section documenting 4-way sync - Config must be consistent across: src/config.rs, docs/reference/configuration.md, nix/module.nix, and .env.example - Include complete example showing all four formats - Add to Critical Gotchas list (#8) - Ensures .env.example stays accurate for development and Docker deployments
Diffstat (limited to 'AGENTS.md')
-rw-r--r--AGENTS.md67
1 files changed, 67 insertions, 0 deletions
diff --git a/AGENTS.md b/AGENTS.md
index 6fbec69..9b480b4 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -170,6 +170,72 @@ fn test_audit_tags_automatically_added() {
170- Tags enable production relay cleanup scripts 170- Tags enable production relay cleanup scripts
171- No special handling needed in test code - tags are automatic 171- No special handling needed in test code - tags are automatic
172 172
173## Configuration Management
174
175**⚠️ CRITICAL: Keep Configuration in Sync Across All Four Sources**
176
177Configuration options must be consistent across four locations:
178
1791. **Source code** (`src/config.rs`) - Defines actual config structs, env vars, and defaults
1802. **Documentation** (`docs/reference/configuration.md`) - User-facing reference for all options
1813. **NixOS module** (`nix/module.nix`) - NixOS deployment configuration
1824. **Example env file** (`.env.example`) - Template for development and Docker deployments
183
184**When adding/modifying ANY configuration option:**
185
1861. **Update `src/config.rs`** - Add/modify the field with proper env var name
1872. **Update `docs/reference/configuration.md`** - Document the option with examples and defaults
1883. **Update `nix/module.nix`** - Add/modify the NixOS option in `instanceOptions`
1894. **Update `.env.example`** - Add the option with comments explaining usage and defaults
1905. **Verify consistency** - Check env var names, defaults, and descriptions match exactly
191
192**Critical consistency checks:**
193
194- Environment variable names must match: `NGIT_*` in code, docs, module, and .env.example
195- Default values must match across all four sources
196- Option names should be consistent (snake_case in code, camelCase in NixOS)
197- Descriptions should be similar (can be more detailed in docs)
198
199**Example: Adding a new config option**
200
201```rust
202// 1. src/config.rs
203#[arg(long, env = "NGIT_NEW_OPTION", default_value_t = 42)]
204pub new_option: u32,
205```
206
207```markdown
208<!-- 2. docs/reference/configuration.md -->
209#### `NGIT_NEW_OPTION`
210**Description:** What this option does
211**Type:** Integer
212**Default:** `42`
213**Required:** No
214```
215
216```nix
217# 3. nix/module.nix (in instanceOptions)
218newOption = mkOption {
219 type = types.int;
220 default = 42;
221 description = "What this option does";
222};
223
224# Also add to environment mapping in mkService:
225environment = {
226 # ...
227 NGIT_NEW_OPTION = toString cfg.newOption;
228};
229```
230
231```bash
232# 4. .env.example
233# What this option does
234# CLI: --new-option <value>
235# Default: 42
236# NGIT_NEW_OPTION=42
237```
238
173## Documentation 239## Documentation
174 240
175**⚠️ CRITICAL: Keep Architecture Docs Updated** 241**⚠️ CRITICAL: Keep Architecture Docs Updated**
@@ -205,6 +271,7 @@ This was a key learning from GRASP-01: docs described plans, not implementation,
2055. **Work directory:** All session docs go in `work/`, NOT root 2715. **Work directory:** All session docs go in `work/`, NOT root
2066. **Archive naming:** Use `YYYY-MM-DD-description.md` format 2726. **Archive naming:** Use `YYYY-MM-DD-description.md` format
2077. **test-ngit-relay.sh tests ngit-relay**: This script tests the reference implementation, NOT ngit-grasp 2737. **test-ngit-relay.sh tests ngit-relay**: This script tests the reference implementation, NOT ngit-grasp
2748. **Configuration sync:** Config changes MUST be updated in all four places: `src/config.rs`, `docs/reference/configuration.md`, `nix/module.nix`, AND `.env.example`
208 275
209## File Restrictions by Mode 276## File Restrictions by Mode
210 277