Expand description
cairn report {create, list, view, resolve, flag, unflag} — thin
wrappers over the moderation + admin XRPC endpoints Cairn exposes
(#7 + #16).
Every subcommand follows the same flow:
- Load the session file (required).
- Mint a fresh service-auth JWT via PDS
getServiceAuth. On 401, callrefreshSessiononce, persist rotated tokens atomically (§5.3 auto-refresh path), retry. - Issue the HTTP call to Cairn with the service-auth token.
- Return a typed response the CLI dispatcher turns into
human or JSON output via the per-subcommand
format_*_{human, json}pairs.
Each orchestrator function’s doc-comment cites the handler it wraps so a future reader can jump from CLI code to server code without grep.
Structs§
- Apply
Label Arg - Optional label-application sub-object on
cairn report resolve. Mirrors the server handler’sInputApplyLabelshape. - Create
Report Response - Successful
createReportresponse — only the fields the CLI displays. Extra fields are ignored by serde. - Report
Create Input - Input to
cairn report create— wire-agnostic so the CLI flags - Report
Detail - Full report record — includes
reasonbody (admin-authenticated only, per §F11). - Report
Flag Input - Input to
cairn report flag/cairn report unflag. - Report
Flag Response - Synthetic response for
cairn report {flag, unflag}. The server’s response body is{}— operationally we only care that the call succeeded (2xx). The struct echoes the input fields the CLI prints. - Report
List Entry - One row in a
listReportsresponse. Deliberately omits thereasonfield — the server’sReportListEntryprojection drops it per §F11 and the CLI’s shape preserves that invariant type-level. - Report
List Input - Input to
cairn report list. - Report
List Response listReportsresponse envelope.- Report
Resolve Input - Input to
cairn report resolve. - Report
View Input - Input to
cairn report view.
Enums§
- Report
Subject - Subject-union wire shape. Deserializes the server’s
{ $type: ..., ... }tagged representation.
Functions§
- create
- Submit the report. Mutates
sessionin place on a mid-call token refresh and persists the rotation atomically before returning.session_pathis the SAME path the caller loaded from, so the file on disk stays in sync. - flag
- Flag or unflag a reporter.
- format_
create_ human - Human-readable one-liner for
cairn report create— default output when--jsonis not set. - format_
create_ json - Machine-readable
--jsonrenderer forcairn report create. - format_
flag_ human - Human one-liner for
cairn report flag/cairn report unflag. - format_
flag_ json - JSON output for
cairn report flag/cairn report unflag. Includes anactiondiscriminator so scripts can branch without re-readingsuppressed. - format_
list_ human - Tabular human output for
cairn report list. Columns: id, status, reporter (truncated), subject (summary), reason-type (truncated), created_at. Trailingnext cursor: …line when a next page exists. - format_
list_ json - JSON envelope for
cairn report list. - format_
resolve_ human - Human one-liner for
cairn report resolve. Names whether a label was applied so the operator sees the side-effect at a glance. - format_
resolve_ json - JSON output for
cairn report resolve— the resolvedReportDetail. - format_
view_ human - Multi-line field/value output for
cairn report view. - format_
view_ json - JSON output for
cairn report view. - list
- Query the reports table via the admin HTTP endpoint.
- resolve
- Resolve a report.
- view
- Fetch a single report record (with reason body).