CLI and CI
Usability testing in CI, from your terminal or coding agent
@sunzuai/cli runs Sunzu studies from a terminal and tests apps that exist only on your machine with synthetic humans. Put a usability test in GitHub Actions, or give your coding agent a check to run before it opens a pull request.
What does the Sunzu CLI do?
sunzu is a user research CLI: depth interviews, concept tests, usability tests and content tests all start from a terminal.
It also tests what is not online. Through a bridge between the study and your machine, participants use:
- a web app on
http://localhost:3000; - a site reachable only through your VPN;
- an Android app in your emulator, or an iOS app in your simulator, including builds that are in no store.
How to install the CLI and sign in
npm install -g @sunzuai/cli
sunzu login # opens the Sunzu consent page in your browser
sunzu whoami # profile, account, plan and credits left this month
It needs Node.js 22 or later. Web tests need Chrome, Chromium, Edge or Brave; --chrome PATH or SUNZU_CHROME picks one. Mobile tests need Appium, set up once (see the FAQ below).
The sign-in works in the account you choose on the consent page, which can also create one, and lasts 60 days. Disconnect it from your profile page in the app, or with sunzu logout. Credentials are stored in ~/.config/sunzu/credentials.json, readable by you only.
The main commands:
sunzu audiences # the audiences you can study, with their ids
sunzu studies # your recent studies
sunzu wait <testId> # until it completes, then the report link
sunzu report <testId> # the report, as JSON
sunzu call start_concept_test --file args.json # any MCP toolHow to run a usability test from the terminal
sunzu ux http://localhost:3000 \
--task "Find a claw hammer and add it to the cart" \
--success "The cart shows the claw hammer"
Write the task in the user’s words, and the success criterion as something visible on screen. The CLI opens a browser on your machine, launches the study and prints the report link when it completes. Keep it running until then: the participants explore through it.
--name titles the study and --headed shows the browser windows. For a native app, --android <package> or --ios <bundle id> replaces the address.
JSON output and exit codes
Every command takes --json. For sunzu ux and sunzu wait, the output is the study’s final state:
testIdandstatus, which iscompletedorfailed;reportUrl, the report in the app;report.findings, each with aseverityofcritical,high,mediumorlow;report.fixes, the changes the report recommends.
The report also records how each session ended: direct success, indirect success or abandoned. Exit codes are 0 for success, 1 for an error, 2 for a usage error and 130 for an interruption. With --json, a failed study still prints its JSON, so check .status before you read the findings.
Automated UX testing in GitHub Actions
This job builds the app, starts it and runs a usability test. It fails when the study does not complete or when the report lists a critical finding. It runs when a pull request carries the ux-gate label, so credits go to the changes that need a check.
name: Usability gate
on:
pull_request:
types: [labeled, synchronize]
jobs:
usability:
if: contains(github.event.pull_request.labels.*.name, 'ux-gate')
runs-on: ubuntu-latest
timeout-minutes: 45
env:
SUNZU_API_KEY: ${{ secrets.SUNZU_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
- run: npm ci && npm run build
- run: |
npm start &
npx wait-on http://localhost:3000
- run: |
npx @sunzuai/cli ux http://localhost:3000 --json \
--task "Order dinner for four friends and split the bill" \
--success "The confirmation shows four payment links" \
> study.json
- name: Gate on critical findings
run: |
jq -e '.status == "completed"' study.json
echo "Report: $(jq -r '.reportUrl' study.json)" >> "$GITHUB_STEP_SUMMARY"
test "$(jq '[.report.findings[]? | select(.severity == "critical")] | length' study.json)" -eq 0
- uses: actions/upload-artifact@v4
if: always()
with: { name: sunzu-report, path: study.json }
Create an API key on your profile page in the Sunzu app, where it is listed under MCP, and store it as the repository secret SUNZU_API_KEY; the CLI reads it instead of a browser sign-in. A preview deployment the runner can reach works in place of localhost. Add high to the filter once the team trusts the signal.
Usability checks from coding agents (Claude Code, Cursor)
Anthropic’s guidance for Claude Code is to give the agent a check it can run, and to ask for evidence rather than a claim. Claude Code, Cursor or any agent with a shell can run sunzu ux on its own change. Add a rule to AGENTS.md or CLAUDE.md:
## Usability check before a pull request
When a change touches a user-facing flow:
1. Start the app locally.
2. For each task in the spec's acceptance section, run:
sunzu ux http://localhost:3000 --json \
--task "<task>" --success "<success>" > study.json
3. Fix every critical or high finding your change caused, then test again.
4. Put the report link, and any finding left unfixed, in the pull request.
Ask before launching more than two studies for one pull request.
A rule in a file is advice; the CI gate runs every time. Assistants that use MCP instead of a shell connect to the MCP server. When their test needs your localhost, run sunzu bridge and give them the bridge id it prints. The AI-PDLC field guide has more recipes.
Costs and limits
Every study spends plan credits, whether it starts in the app, an assistant or CI, and the CLI cannot buy more: that stays in the app. Solo costs $20 a month (first month free) for 10,000 credits and up to 5 tests; Team costs $100 a month for 50,000 credits and up to 25 tests. Both include CI/CD automation (pricing).
Participants are AI simulations of an audience, not recruited people, so read a study for direction and for the problems it finds. In Sunzu’s internal back-testing, usability tests detected 75% of the defects found by reference research with 500+ humans, against 34% for a human expert with AI (benchmark, scope). A passing gate can still miss a defect. Test with people when a decision depends on lived experience, accessibility, safety or cultural context, or is expensive to reverse.
Frequently asked questions
Does the Sunzu CLI get access to my browser, cookies or files?
No. It starts a new browser with an empty temporary profile, deleted when it exits. It refuses requests to open files, upload files from your disk, or grant camera, microphone, screen or clipboard access. On an emulator or simulator it accepts only the app you named, and refuses installs, file copies, shell commands and scripts.
How do I test an Android or iOS app from the command line?
Install Appium once (npm install -g appium), with the uiautomator2 driver for Android or xcuitest for iOS on macOS with Xcode. Start an emulator or simulator, install your build, then run sunzu ux --android or --ios with the app’s id; --udid picks the device when several are running. Each visit restarts your app, keeping what it saved on the device. The first iOS test takes a few extra minutes to build Appium’s WebDriverAgent.
Which audience does a CLI usability test use?
sunzu audiences --json lists the audiences you can study, with library ones marked. Pass their ids with --audience id,id. By default a test takes 6 people from one audience, 3 each from two, or 2 each from three; --per-audience sets 1 to 10.
How long does a usability test take in a CI pipeline?
Several minutes, about as long as a large test suite. Give the job a timeout well above that; the example uses 45 minutes. If the CLI stops mid-study, the study loses its browser, and sunzu bridge reconnects it while participants are still exploring.
Does the usability gate run on pull requests from forks?
GitHub does not pass repository secrets to workflows triggered from forks, so the job has no API key there. Run the gate on branches in your own repository.
What is the difference between the Sunzu CLI and the MCP server?
They share your profile, your account and the same tools: sunzu tools lists them and sunzu call runs any of them. The MCP server serves AI assistants, with sign-in through OAuth. The CLI serves terminals, scripts, CI and coding agents, and it is how a study reaches an app running on your own machine.