@testneo/cli
v0.3.0
Published
TestNeo CLI — .testneo runner, API Risk Discovery, PR validate, Engineering Memory, local-agent routing
Maintainers
Readme
@testneo/cli
Release assurance in your terminal — run .testneo files, pick cloud test cases, one-shot NL (try), API Risk Discovery (paste cURL), PR validation + Engineering Memory. Same backend as the TestNeo app and MCP.
| Surface | Use when |
|---------|----------|
| @testneo/cli (this) | Terminal & CI — humans + scripts |
| @testneo/mcp-server | Cursor / Claude chat agents |
| @testneo/playwright-ai-sdk | Playwright ai.run in Git |
Docs: testneo.ai/docs/testneo-cli.html
Install
npm install -g @testneo/cliFrom monorepo (dev):
cd packages/testneo-cli
npm install && npm run build
# One-shot (safest — no alias):
node dist/cli.js api-risk --help
# Alias: expand pwd NOW (must run this line while cwd is packages/testneo-cli):
alias testneo="node $(pwd)/dist/cli.js"
type testneo # must show an absolute .../packages/testneo-cli/dist/cli.js
# Replace stale global 0.1.x (needs write access to npm prefix):
# sudo npm link
# Check: testneo --version # expect 0.3.0+If you see Cannot find module .../packages/testneo-cli/packages/testneo-cli/dist/cli.js, your alias is a relative path — unset it (unalias testneo) and recreate with the absolute form above.
testneo login # email/password → API key saved
# or:
testneo config set apiKey tn_your_key
testneo config set baseUrl https://app.testneo.ai
testneo config set webAppUrl https://app.testneo.ai
testneo config set projectId 47
testneo config set defaultEnvironment dev
testneo doctorCommands (v0.3.0)
| Command | Description |
|---------|-------------|
| testneo doctor | Validate API key + list projects + agent routing hint |
| testneo login | Interactive login → create tn_ key |
| testneo run <file\|dir> | Run .testneo file(s) |
| testneo run --pick | Browse project cases → multi-select → run |
| testneo run --test-case 12,34 | Run by id (CI) |
| testneo try "…" | One-shot NL → upsert + execute |
| testneo agent status | Local agent online? (drives smart routing) |
| testneo status <id> [--wait] | Poll execution |
| testneo pr validate | Release Brief from local git + EM |
| testneo pr validate --pr 142 | Server PR validation (GitHub connected) |
| testneo pr validate --run-impacted --confirm | Execute impacted tests (write guard) |
| testneo pr history | Recent validation workflows |
| testneo memory list\|patterns\|match | Engineering Memory |
| testneo api-risk scan | Dev team: paste cURL → discover + run (+ brief / promote) |
| testneo api-risk discover\|run\|brief\|promote | Stepwise Risk Discovery (CI-friendly) |
| testneo readiness | Release confidence summary |
| testneo ask "…" | AI Assistant Q&A (same API as web chat + MCP) |
| testneo ask --chat | Interactive multi-turn terminal chat |
| testneo tui | Interactive home (pick → validate → run) |
Global flags
| Flag | Description |
|------|-------------|
| --json | Single JSON result (CI) |
| --agent | NDJSON event stream for coding agents (output mode — not the same as local agent) |
Execution routing (local agent vs cloud)
By default (preferAgent: true), if you omit both flags the CLI prefers a local agent when online, else cloud.
For docs and CI, pass --cloud or --use-agent explicitly so the destination is obvious.
| Control | Effect |
|---------|--------|
| --cloud | Always cloud / EC2 (recommended in examples & CI) |
| --use-agent | Force local agent (must be online) |
| (neither) | Probe agent → local if online, else cloud |
| testneo config set preferAgent false | Always cloud unless --use-agent |
| TESTNEO_PREFER_AGENT=false | Same as above (env) |
testneo agent status
testneo doctor
testneo run smoke.testneo --cloud --wait
testneo run smoke.testneo --use-agent --wait
testneo try "Verify login" --use-agent --waitrun / try flags
--project, --env, --wait, --fail-on-error, --use-agent, --cloud, --timeout
Quick recipes
File suite (CI — pin cloud):
testneo run tests/smoke/ --cloud --wait --fail-on-errorPick & run (TTY):
testneo run --pick --cloud --wait --fail-on-errorOne-shot NL:
testneo try --cloud --url https://www.saucedemo.com \
"Enter username as standard_user
Enter password as secret_sauce
Click Login
Verify Products is visible" --waitPR gate (before merge):
testneo pr validate --project 47
# with execution on cloud (explicit confirm):
testneo pr validate --run-impacted --confirm --cloud --wait --fail-on-errorMemory vs current diff:
testneo memory match --project 47API Risk Discovery (dev team — paste cURL):
# Sample FakeStore cURL ships in the package
# One-shot: discover + run; fail CI if criticals
node dist/cli.js api-risk scan -p 6 -f examples/api-risk/fakestore-products.curl --cloud \
--fail-on-critical --brief-out api-confidence.md --json
# Local agent (private / BFSI)
node dist/cli.js api-risk scan -p 6 --curl - --use-agent --max-variants 20 \
< examples/api-risk/fakestore-products.curl
# Stepwise + promote failures to regression & Engineering Memory
node dist/cli.js api-risk discover -p 6 -f examples/api-risk/fakestore-products.curl --json > discover.json
node dist/cli.js api-risk run -p 6 --discovery-id "$(jq -r .discovery_id discover.json)" \
--cloud --fail-on-critical --json > run.json
node dist/cli.js api-risk promote -p 6 --run-file run.json --confirmAgent mode (Cursor / scripts — NDJSON):
testneo try "Verify login works" --wait --agent.testneo format
# Test: Sauce Demo login
# Project: 47
# Environment: dev
Navigate to {{base_url}}
Enter username as "standard_user"
Enter password as "secret_sauce"
Click on Login button
Verify "Products" is visibleEnvironment variables
| Variable | Purpose |
|----------|---------|
| TESTNEO_BASE_URL | API origin |
| TESTNEO_WEB_APP_URL | Dashboard links |
| TESTNEO_API_KEY | Bearer token |
| TESTNEO_PROJECT_ID | Default project |
| TESTNEO_DEFAULT_ENV | Default environment |
| TESTNEO_PREFER_AGENT | true (default) / false — smart local-agent routing |
Ask (AI Assistant)
Same API as the web AI Assistant and MCP testneo_ai_assistant_query. Answers come from your project data on the server — the CLI only forwards the question.
testneo ask --project YOUR_PROJECT_ID "How many test cases do I have?"
testneo ask --project YOUR_PROJECT_ID "What is my release readiness?"
testneo ask --project YOUR_PROJECT_ID --chatLicense
MIT
