Documentation
¶
Overview ¶
Command cligen generates the resource commands of the bma CLI (cmd/bma/api_gen.go) from the public BMA OpenAPI document (ADR-0102): every operation becomes one entry of apiOperations, from which cmd/bma builds a cobra command. Never edit api_gen.go by hand; regenerate:
go run ./tools/cligen -spec contracts/bma-api/bma.openapi.yaml -out cmd/bma/api_gen.go
Naming: the path's resource segments are the command groups and the operation is the verb. A trailing segment after a path parameter is a sub-resource (its own group) when the document lists it or has items below it; otherwise it is an action and its name is the verb (POST /v1/sessions/{id}/archive -> `bma sessions archive <id>`). Collection GET is list, collection POST create, item GET get, item POST/PUT/PATCH update, item DELETE delete. Names are kebab-case.
Operations a generic request cannot express are marked HandWritten and covered by hand-written commands that name the operation in their "operation" annotation: event streams (text/event-stream) and multipart uploads; and the operations with a top-level command of their own (topLevel). cmd/bma's parity test checks that every operation has exactly one command and every generated command an operation.