From 8351fa7752bb8341ef405a37ff7c73142715e981 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Sun, 20 Sep 2026 20:11:19 +0200 Subject: commands: split the command table by domain --- AGENTS.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'AGENTS.md') diff --git a/AGENTS.md b/AGENTS.md index 55408ba..89b95b2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -46,12 +46,14 @@ Never rewrite ledger rows in a migration. ## Adding a command -1. Handler in `commands.c` (or the domain file it belongs to), using the - `fail()/failf()` helpers and stable error codes from `PROTOCOL.md` §5.3. -2. Entry in `g_commands[]` with permission, `need_org`, `mutating`, `dry_run` - and a `CMD_ARGS(args_x)` name/type/required/default schema; the dispatcher - validates present arguments before the handler runs and `describe` emits - the schema. +1. Handler in the matching domain file `src/cmd_.c` (shared helpers + live in `src/cmd_util.[ch]`), using the `fail()/failf()` helpers and stable + error codes from `PROTOCOL.md` §5.3. +2. Entry in that file's `g_cmd_[]` table with permission, `need_org`, + `mutating`, `dry_run` and a `CMD_ARGS(args_x)` name/type/required/default + schema; the dispatcher validates present arguments before the handler runs + and `describe` emits the schema. A new file's table is registered in + `g_command_tables[]` in `src/commands.c`; `make check` scans all of them. 3. Audit (`audit_append`) for mutations, after success. 4. Update `docs/PROTOCOL.md`; add tests in `tests/test_core.c`. `make check` (part of `make test`) fails when a command or error code is missing from -- cgit v1.3