aboutsummaryrefslogtreecommitdiff
path: root/AGENTS.md
diff options
context:
space:
mode:
Diffstat (limited to 'AGENTS.md')
-rw-r--r--AGENTS.md14
1 files changed, 8 insertions, 6 deletions
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_<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