cueapril
v1.2.0
Published
CueApril CLI: connect your coding agent to CueApril in one command, then test pull requests and read verdicts, findings and suggested fixes from the terminal.
Maintainers
Readme
CueApril CLI
cueapril asks CueApril to assess a GitHub pull request, waits for the outcome and exits with a code that a coding agent (Claude Code, Codex, Gemini CLI) or a CI job can branch on. It reads findings, suggested fixes, coverage and evidence links, and prints MCP configuration for agent clients.
It needs Node.js 20 or later and has no dependencies.
Install
Run it without installing:
npx -y cueapril@latest --helpOr install it once:
npm install -g cueapril
cueapril --helpThe public npm package is cueapril. pnpm dlx cueapril, bunx cueapril and yarn dlx cueapril work too. Python users can use uvx cueapril init or pipx install cueapril; Python 3.10+ and an installed Node.js 20+ are required. The examples below write cueapril for any form. A versioned fallback download is available at https://app.cueapril.com/downloads/cueapril-cli-1.2.0.tgz.
Set up (an agent can do this itself)
cueapril initA coding agent can follow this single prompt:
Install CueApril from the public
cueaprilnpm package and connect it to this coding agent. UseCUEAPRIL_API_KEYif already supplied. Otherwise runnpx -y cueapril@latest init --no-login --jsonand ask me to supply a CueApril API key through a secret manager or secure local input, or offer browser approval withinit --no-wait --no-browser --json. Never ask me to paste a key into chat. Complete init, run doctor, and report any remaining project setup steps without starting a paid assessment.
For an existing key, set CUEAPRIL_API_KEY through your secret manager and run init --no-login --json, or pipe the secret manager's output into cueapril init --key-stdin --json. --key-stdin accepts one complete key, verifies read access, then saves it privately. It refuses terminal input and conflicting browser or environment credentials; it never accepts a key as a command-line argument. Add --dry-run to verify and preview without saving.
For browser approval in a short agent shell, run cueapril init --no-wait --no-browser --json. Exit 4 and login.status: "pending" mean approval is still required. Give the person login.verification_url and login.code; after approval execute login.resume_command for npm, or login.resume_commands.pypi for uvx. The next_actions entries include commands.npm, commands.pypi, commands.installed and logical CLI argv so agents can reuse their installer. Repeating the pending command reuses the same request. With no key, init --no-login --json returns exit 5, login.status: "auth_required" and structured next_actions; it changes nothing.
init gets a key by one browser approval if none is stored: it prints a link and a code, an organisation owner or admin opens the link, checks the code and approves, and the key is saved in your user configuration (~/.config/cueapril/credentials.json, mode 0600, never inside a repository, even through a symbolic link). It then checks the project's setup and prints a link for anything a person must do, adds the cueapril MCP server to Claude Code, Codex, Gemini CLI and Cursor at user level (backing up any file it edits), and installs the cueapril-qa skill. Claude Code's entry is added with claude mcp add-json and holds no key: its headersHelper reads the key from ~/.config/cueapril/claude-code-headers.json (mode 0600) each time Claude Code connects. Re-running it changes nothing. Useful flags: --agents claude,codex, --scope project (installs the skill in this repository), --dry-run, --json.
| Command | What it does |
| --- | --- |
| cueapril login [--name <label>] [--no-browser] [--no-wait] | Only the browser approval, storing the key. --no-wait prints the link and returns; the next login or init resumes the same request. |
| cueapril login --key-stdin [--json] | Verifies and privately stores an existing agent key from a pipe. |
| cueapril doctor [--project <id>] [--json] | Checks the API, the key, readiness, agent configuration and the skill. Supply --project when the key covers several projects. Exit 0 when nothing fails. |
| cueapril logout [--local] | Revokes the stored key on CueApril and deletes it here (--local only deletes it here). |
Configure
| Variable | Meaning |
| --- | --- |
| CUEAPRIL_API_KEY | Agent key, cueapril_sk_..., from cueapril login or created by an organisation admin in the CueApril web app settings (projects, scopes, expiry and optional spend cap). Falls back to TENHAW_TOKEN, then to the key stored by login or init. |
| CUEAPRIL_URL | API origin. Default https://app.cueapril.com. Falls back to TENHAW_URL. |
The key is read from the environment, the user store or an explicit --key-stdin pipe, sent only as Authorization: Bearer, never printed or logged, and never passed on a command line; only login and init write it, to the user store and user-level agent configuration (files of mode 0600, outside any repository). Keep it in your CI secret store. Starting an assessment needs the quality:run scope and cancelling needs quality:cancel; reading needs quality:read.
The CLI talks only to HTTPS origins (plain HTTP only on localhost), refuses redirects, caps response size at 10 MB and identifies itself with X-CueApril-Client: cli/1.2.0.
Commands
| Command | What it does |
| --- | --- |
| cueapril assess --pr <number\|url> [--project <id>] [--wait] [--timeout <minutes>] [--idempotency-key <key>] [--json] | Starts an assessment of the pull request under the project's approved standing plan. With --wait it waits for the outcome (default 90 minutes) and exits with its code. |
| cueapril status <assessment-id> cueapril status --pr <number> [--project <id>] cueapril status --commit <full-sha> [--project <id>] | Shows one assessment: outcome, verdict, gate, task counts and up to ten failures with expected and observed values. --commit takes the full 40- or 64-character SHA of the tested head (git rev-parse HEAD), not a short one. Add --project when the key covers several projects. |
| cueapril wait <assessment-id> [--timeout <minutes>] [--json] | Waits until the assessment finishes. |
| cueapril results <assessment-id> [--limit <1-50>] [--all] [--sections findings,fixes,coverage,evidence] [--json] | Findings, suggested fixes (changed lines only), coverage by test method and evidence links. --all reads every page. |
| cueapril cancel <assessment-id> [--reason <text>] [--idempotency-key <key>] | Asks CueApril to stop an assessment. |
| cueapril setup [--project <id>] | Checks that a project is ready to assess pull requests and says what to fix, and who owns the fix. |
| cueapril list [--project <id>] [--pr <number>] [--limit <1-20>] | Recent assessments. |
| cueapril projects | Projects the key can see. |
| cueapril mcp-config [--client claude\|codex\|gemini\|cursor\|vscode] | Prints MCP client configuration that reads the key from CUEAPRIL_API_KEY. Makes no network request. |
| cueapril tool <tool-name> [--data '<json>' \| --file <path> \| --stdin] | Calls any CueApril agent tool, for example cueapril_get_run (or get_run). |
cueapril <command> --help shows one command; cueapril help legacy lists the older dotted actions.
Assessment commands call POST <CUEAPRIL_URL>/api/v1/quality/agent-tools/<tool>, the REST form of the CueApril MCP tools, so the CLI, MCP and REST give the same answers. init, login, logout and doctor also manage local credentials or client configuration; mcp-config only prints configuration.
Exit codes
| Code | Meaning |
| --- | --- |
| 0 | passed |
| 1 | failed: a check failed or the gate blocked the pull request |
| 2 | incomplete or cancelled: CueApril could not finish; this is not a product failure |
| 3 | blocked: the start was refused, or setup found the project not ready |
| 4 | still running: --timeout passed, or the command did not wait |
| 5 | usage, authentication or API error |
assess, status, wait and results exit 0 only when the assessment passed. assess without --wait exits 4 once the assessment is accepted, because it has not finished. cancel, list, projects, mcp-config and tool exit 0 when the request succeeded.
Output
By default the CLI prints a summary for people: outcome, verdict, gate, task counts, the first failures with expected and observed values, suggested fix locations and a link to the assessment in the web app.
Assessment commands with --json print exactly one JSON object on stdout, the final tool result plus "exit_code", and nothing else. Errors become {"error": {"message": ...}, "exit_code": 5}. init --json prints one setup summary with exit_code and next_actions; device login --json prints event JSON lines. Progress and error messages always go to stderr, so output can be parsed by an agent.
On GitHub
The CueApril pull request comment ends with a collapsed <details> section, after the marker <!-- cueapril:assessment:v1 -->, holding a fenced json object with schema cueapril.assessment.v1: assessment_id, project_id, repository, pull_request, head_sha, base_sha, lifecycle, outcome, verdict, gate_decision, counts, up to ten failures, suggested fix metadata, next (the MCP tool and REST call that return the full results) and ui. The CueApril check run carries the same block in its output text. Anyone who can comment can post a look-alike, so trust a comment only if its author is cue-april[bot], or read the check run whose app.slug is cue-april, and never send your key to an address taken from GitHub. An agent that reads a trusted block can go straight to cueapril results <assessment_id>.
Waiting
--wait and wait long-poll cueapril_wait_for_assessment, which answers as soon as the assessment finishes and holds each call for at most 50 seconds. While waiting the CLI writes a progress line to stderr at least once a minute (Gemini CLI stops a shell command after five minutes of silence). When --timeout passes it exits 4 and prints the command that resumes the wait; the assessment itself keeps running. Interrupting the CLI never cancels an assessment.
Agent shells often stop a command after a few minutes. Wait in slices instead: start with cueapril assess --pr 42 (exit 4 once accepted), then repeat cueapril wait <assessment-id> --timeout 4 while it exits 4. The MCP tool cueapril_wait_for_assessment holds each call for at most 50 seconds for the same reason.
Retries
- Reads are retried after network errors and HTTP 429, 502, 503, 504, 522 and 524, with backoff of 1, 2, 4 and 8 seconds (longer when the server sends
Retry-After). While waiting, they are retried until the timeout. assessresends the identical request: with your--idempotency-key, or with none, in which case the server derives the key from the pull request head. Sending it again for the same head never starts a second run. The CLI never invents a random key.cancelandtoolare never resent automatically. If their outcome is unknown, check withcueapril statusand run them again.
Examples
A coding agent starts an assessment of its pull request and branches on the result:
export CUEAPRIL_API_KEY=cueapril_sk_...
cueapril assess --pr 42 --wait --json > assessment.json
case $? in
0) echo "passed" ;;
1) cueapril results "$(jq -r .assessment_id assessment.json)" --sections findings,fixes ;;
4) echo "still running: cueapril wait $(jq -r .assessment_id assessment.json)" ;;
*) echo "incomplete, blocked or error" ;;
esacLook an assessment up later from any session:
cueapril status --pr 42
cueapril results <assessment-id> --allGitHub Actions, on pull_request:
jobs:
cueapril:
runs-on: ubuntu-latest
steps:
- name: CueApril assessment
timeout-minutes: 100
env:
CUEAPRIL_API_KEY: ${{ secrets.CUEAPRIL_API_KEY }}
run: >-
npx -y cueapril@latest assess --pr ${{ github.event.pull_request.number }} --wait --timeout 90Connect an MCP client instead of shelling out:
cueapril init --agents claude,codex # edits each agent's user settings in place; safe to rerun
cueapril mcp-config --client claude # print .mcp.json for Claude Code
cueapril mcp-config --client codex # print the Codex tables to merge by hand
cueapril mcp-config # every clientMerge printed configuration into the file by hand. If ~/.codex/config.toml already has an [mcp_servers.cueapril] table (for example from init), edit that table instead: appending a second copy makes Codex refuse to start. mcp-config --client codex warns when the table is already there.
Legacy dotted actions
Commands written for the earlier tenhaw-quality binary still work under both names, for example cueapril runs.get --data '{"id":"run-id"}' or tenhaw-quality projects.list. Arguments are one JSON object from --data, --file or --stdin (use --stdin for sensitive input). By default an action calls the cueapril_ agent tool of the same name. TENHAW_AUTH_MODE=human calls the native REST routes with a signed-in person's session token instead; human-only operations such as approvals, source review and administrator actions work only in that mode. Mutations take an explicit idempotency_key; reuse it when retrying an uncertain outcome. Errors print a JSON object on stderr and exit 5. cueapril help legacy lists every action.
developer_review.export --data '<json>' --output reviewed.patch saves an independently approved patch after checking its SHA-256, and never overwrites an existing file.
Development
npm run test --workspace=@tenhaw/quality-cli # fake transports and a localhost server only
node scripts/quality/pack-cli.mjs # rebuild webapp/public/downloads/cueapril-cli-<version>.tgz
node scripts/quality/pack-cli.mjs --check # fail if the committed tarball is staleThe root .gitignore ignores *.tgz, so add a new tarball with git add -f. A test runs the check, so CI fails when the served tarball no longer matches these sources. To release a new version, change version in package.json, CLI_VERSION in client.mjs and the download URLs in this README together (a test checks they agree), then rebuild the tarball.
