ascctl (Agent Playbook)
Agent Contract v1 (Read This First)
- •Parse stdout only: it is always exactly one JSON object (success, error, and
--help). - •Treat stderr as logs/progress (
--verbose, warnings). - •JSON is compact + deterministic (
sortedKeys).--prettyis still JSON.
Exit codes:
- •
0success - •
2usage / validation / confirm required / spec missing / select not found / non-JSON requires--out - •
3auth/config/credentials/signing - •
4network/transport - •
5API non-2xx (HTTP) - •
6internal/unexpected
Preflight (Before Any API Call)
- •Ensure the CLI exists:
bash
command -v ascctl
- •Credentials precedence: CLI flags > env vars > config file.
Env vars:
- •
ASC_ISSUER_ID,ASC_KEY_ID - •
ASC_PRIVATE_KEY_PATH(path to.p8) orASC_PRIVATE_KEY_PEM(raw PEM) - •
ASC_PROFILE(profile name in config)
- •Keep a stable local spec path (recommended):
bash
mkdir -p ~/.cache/ascctl ascctl openapi spec update --out ~/.cache/ascctl/openapi.oas.json --force
In all OpenAPI commands below, prefer:
bash
--spec ~/.cache/ascctl/openapi.oas.json
Universal Hammer Workflow (OpenAPI-First)
- •Discover operations:
bash
ascctl openapi ops list --spec ~/.cache/ascctl/openapi.oas.json --details --text builds --method GET
- •Inspect one operation:
bash
ascctl openapi op show --spec ~/.cache/ascctl/openapi.oas.json --id <operationId>
- •Generate a ready-to-run template (preferred for agents):
bash
ascctl openapi op template --spec ~/.cache/ascctl/openapi.oas.json --id <operationId>
Use:
- •
data.argvas the canonical invocation (string array, no quoting pitfalls) - •
data.bodyas the minimal body skeleton (fill placeholders like"VALUE") - •
data.hintsto learn required params/headers/content-types without reading docs
- •Execute:
bash
ascctl openapi op run --spec ~/.cache/ascctl/openapi.oas.json --id <operationId> \ --path-param id=... \ --query limit=1 \ --header If-Match=... \ --select /data/0/id
Inputs:
- •Path params:
--path-param key=value(repeatable) - •Query params:
--query key=value(repeatable) - •Headers:
--header key=value(repeatable) - •Body:
--body-json '{...}'or--body-file /path/to/body.json
Guardrails (Do Not Skip)
- •Mutating methods (
POST,PUT,PATCH,DELETE) require--confirm. - •Prefer
--dry-runfirst to validate request resolution without network. - •If the response is not JSON: you must use
--out <file>(stdout must stay JSON). - •Debug/offline:
- •
--record <dir>saves resolved request (no secrets) + response meta + raw bytes - •
--replay <dir>replays the same envelope without network
- •
Token Economy (Default Behaviors)
- •Prefer
ascctl ids ...when you only need an ID and want to continue quickly. - •Prefer
--select /json/pointerto return only the needed fragment. - •For GET list endpoints:
--paginate(GET-only) +--limit N(default 200). Use--limit 0for unlimited.
Help Is JSON
ascctl ... --help returns JSON with the help string inside data.help. Never assume raw help text is printed to stdout.