diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-20 20:11:19 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-20 20:11:19 +0200 |
| commit | 8351fa7752bb8341ef405a37ff7c73142715e981 (patch) | |
| tree | dde603d313f4f26934f2ce20a22dfd9b69324cf0 /AGENTS.md | |
| parent | beafdbe0d64340387d619c38554976410129f05b (diff) | |
| download | bokf-8351fa7752bb8341ef405a37ff7c73142715e981.tar.gz bokf-8351fa7752bb8341ef405a37ff7c73142715e981.zip | |
commands: split the command table by domain
Diffstat (limited to 'AGENTS.md')
| -rw-r--r-- | AGENTS.md | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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_<domain>.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_<domain>[]` 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 |
