Audit CLI and endpoint implementations against the Plerion OpenAPI spec. Reports missing params, coverage percentages, and gaps per endpoint.
Perform a systematic audit of every Plerion API endpoint comparing the OpenAPI spec parameters against both the endpoint layer (src/api/endpoints/*.rs) and the CLI layer (src/cli/*.rs).
If $ARGUMENTS contains --fix, also implement the missing params. Otherwise, only report.
Fetch the canonical spec using:
gh api repos/plerionhq/docs/contents/api-reference/openapi.yaml -H "Accept: application/vnd.github.raw+json" 2>/dev/null | head -c 100
If the above snippet shows YAML content, fetch the full file:
gh api repos/plerionhq/docs/contents/api-reference/openapi.yaml -H "Accept: application/vnd.github.raw+json" > /private/tmp/openapi.yaml
Otherwise fall back to cloning or use a cached copy.
For every path+method in the spec, extract:
Read ALL files in:
src/api/endpoints/*.rs -- endpoint param structs and function signaturessrc/cli/*.rs -- clap Args structs (the CLI flags users see)Use parallel agents to speed this up.
For each endpoint, check three things:
src/api/endpoints/<resource>.rs have a field for every spec query parameter? Does the function body actually send it as a query param?src/cli/<resource>.rs have a clap #[arg] for every endpoint param? Does the handler actually pass it through to the endpoint params struct?Also check for:
bool instead of Option<bool> (prevents filtering for false)--all + --per-page exist for paginated endpoints?Output the report in this exact format:
| Endpoint | Spec Params | Endpoint Layer | CLI Layer |
|---|---|---|---|
| Findings | 19 | 19 (100%) | 17 (89%) |
| ... | ... | ... | ... |
| TOTAL | N | N (X%) | N (Y%) |
HIGH -- Missing from both endpoint + CLI: Table with: Endpoint, Missing Param, Notes
MEDIUM -- In endpoint but not in CLI: Table with: Command, Missing CLI Flag, Endpoint Field
MEDIUM -- Request body field gaps: Table with: Command, Missing Field, Notes (mark required fields)
LOW -- UX issues:
Boolean flags that can't filter for false, naming mismatches, etc.
List all endpoints with 0 gaps.
If --fix was passed:
#[arg] in the CLI handlertests/<resource>_test.rscargo test after each resource to catch issues early--all + --per-page existlimit/cursor params and hasNext/nextCursor response fieldsdeserialize_option_u32_or_string handles thisASC/DESC, others use asc/desc