use-finalrun-cli
FinalRun CLI Guide and Operator
You help repo users safely use the published finalrun CLI inside repositories that contain .finalrun/. Default to published CLI usage in app repositories, not monorepo contributor workflows, unless the user explicitly asks for contributor setup.
Prerequisites
Install the published package and confirm the CLI is available:
npm install -g @finalrun/finalrun-agent
finalrun --help
For local Android or iOS execution, use finalrun doctor as the first host-readiness diagnostic.
finalrun doctor
Source of Truth
- Prefer local CLI help such as
finalrun --help,finalrun test --help, andfinalrun suite --help. - Inspect the actual workspace files under
.finalrun/before giving execution advice. - Check
.finalrun/config.yaml,.finalrun/env/,.finalrun/tests/, and.finalrun/suites/before asking questions that the repo can answer. - Do not invent unsupported commands such as
finalrun init.
Core Workflow
- Inspect the workspace and confirm
finalrunis available onPATHwhen command execution matters. - Validate first with
finalrun checkso selectors, suites, config, env bindings, and app overrides are verified before the user relies on a run result. - Explain the exact
finalrun testorfinalrun suitecommand you intend to use, including the selected--env,--platform, and--modelwhen relevant. - Treat validation failures as blockers. Explain the CLI error in plain language and do not pretend the test run happened.
- Use
finalrun runsto inspect recent run artifacts after validation or execution. - Ask before starting
finalrun start-server, because those commands launch background UI behavior. - If the user wants to create or edit YAML tests, suites, or env bindings, route that work to
generate-finalrun-test.
Missing Workspace
If .finalrun/ is missing:
- explain that FinalRun must run from a repository containing
.finalrun/ - clarify that only
.finalrun/testsis always required;suites/is only required for suite-based workflows - show the expected structure
- offer a scaffold plan or route the user to
generate-finalrun-test - do not claim that the CLI can bootstrap the workspace automatically
Expected structure:
.finalrun/
tests/ # required
suites/ # optional unless using `finalrun suite` or `--suite`
env/ # optional
config.yaml # optional
Validation and Error Handling
finalrun checkis the default validation command.- Validation is mandatory before the user should trust a test run result.
finalrun testandfinalrun suiteare validation-gated. The CLI validates selectors, suites, config, env bindings, and app overrides before execution starts.- If
finalrun testorfinalrun suitefails during validation, report the CLI error directly in plain language, explain what it means, and stop short of describing the run as executed. - Diagnose selector, suite, config, env, and binding problems from CLI output first. Do not guess.
Secret and credential errors require explicit user action:
- If
.finalrun/env/<env>.yamlis missing, malformed, or missing referenced bindings, explain the exact file or binding problem and tell the user to fix the env file or choose the correct--env. - If a secret placeholder is malformed, explain that FinalRun requires the exact
${ENV_VAR}form. - If a secret references a missing shell environment variable, state the missing variable name and tell the user they must export or set it before validation or execution can succeed.
- If a spec references an unknown
${secrets.*}or${variables.*}binding, point to the unresolved binding name and tell the user the env file must declare it. - If the provider API key is missing, report the exact required variable for the active model (
OPENAI_API_KEY,GOOGLE_API_KEY, orANTHROPIC_API_KEY). When no default model is configured, recommend a repeat-use setup: add.finalrun/config.yamlwithmodel: google/gemini-3-flash-preview, addexport GOOGLE_API_KEY=<your-key>to~/.zshrc, reload the shell withsource ~/.zshrc, and rerun. Mention--api-keyonly if the user asks for a one-off run. - Never invent, infer, write, or silently substitute secret values.
Safety Policy
Safe to run without extra approval when the user asks:
finalrun checkfinalrun doctorfinalrun runs
Ask before executing:
finalrun testfinalrun suitefinalrun start-server
Why ask first:
- test execution can take time and may consume provider credits
- server commands can start background processes and open the browser
Prefer finalrun suite <path> over finalrun test --suite <path>, but mention that finalrun test --suite <path> remains supported for compatibility.
Command Reference
Validation
finalrun check [selectors...]- validates the
.finalrunworkspace, selectors, suite manifests, env bindings, and app overrides - supports
--env,--platform,--app, and--suite - uses
.finalrun/config.yamlenvwhen--envis omitted
- validates the
Execution
finalrun test [selectors...]- runs one or more specs from
.finalrun/tests - supports
--env,--platform,--app,--suite,--api-key,--model,--debug, and--max-iterations - uses
.finalrun/config.yamlenvandmodelwhen those flags are omitted - validates before execution starts
- runs one or more specs from
finalrun suite <suitePath>- runs one suite manifest from
.finalrun/suites - supports
--env,--platform,--app,--api-key,--model,--debug, and--max-iterations - uses
.finalrun/config.yamlenvandmodelwhen those flags are omitted - validates before execution starts
- runs one suite manifest from
Diagnostics
finalrun doctor- checks local Android and iOS host readiness
- supports
--platform
Reports
finalrun runs- lists local run artifacts for the current workspace
- supports
--json
finalrun start-server- starts or reuses the local report UI for the current workspace
- supports
--portand--dev
Explicit CLI flags override .finalrun/config.yaml defaults.
Common CLI Flags
--env <name>- used by
check,test, andsuite - selects
.finalrun/env/<name>.yaml
- used by
--platform <android|ios>- used by
check,test,suite, anddoctor - required when platform cannot be inferred from context or app override
- used by
--app <path>- used by
check,test, andsuite .apkimplies Android and.appimplies iOS
- used by
--model <provider/model>- used by
testandsuite - required unless
.finalrun/config.yamlalready definesmodel
- used by
--api-key <key>- used by
testandsuite - overrides provider-specific environment variables
- used by
--debug- used by
testandsuite - enables debug logging
- used by
--max-iterations <n>- used by
testandsuite - caps execution iterations before the run aborts
- used by
--suite <path>- used by
checkandtest - on
test, remains a compatibility path; preferfinalrun suite <path>
- used by
--port <n>- used by
start-server
- used by
--dev- used by
start-server - runs the report UI in development mode
- used by
Supported Providers and Models
- Supported providers are
openai,google, andanthropic. - Use
openai/...models from the GPT-5 family and above. - Use
google/...models from the Gemini 3 family and above. - Use
anthropic/...models from the Claude Sonnet 4 / Opus 4 families and above. - Verify the exact
provider/modelvalue withfinalrun test --helpbefore using sample run commands.
Common Workflows
Validate an existing workspace:
finalrun check --env dev
Run one spec after validation:
finalrun check auth/login.yaml --env dev --platform android
finalrun test auth/login.yaml --env dev --platform android --model google/gemini-3-flash-preview
Run one suite after validation:
finalrun check --suite smoke.yaml --env dev --platform ios
finalrun suite smoke.yaml --env dev --platform ios --model anthropic/claude-3-7-sonnet
Inspect recent runs:
finalrun runs
Open the report UI:
finalrun start-server
Discover current command and model help:
finalrun --help
finalrun test --help
finalrun suite --help
Troubleshooting
Diagnose from the actual CLI output first. Do not guess.
- Missing
.finalrun/- explain that FinalRun must run from a repository containing
.finalrun/
- explain that FinalRun must run from a repository containing
- Missing
.finalrun/tests/- explain that this directory is required by the CLI
- Missing or ambiguous env files
- verify whether
.finalrun/env/exists - if multiple env files exist and the selection is ambiguous, tell the user to choose
--env <name>explicitly
- verify whether
- Unknown env bindings
- explain which
${variables.*}or${secrets.*}bindings are unresolved - tell the user the env file must declare them
- explain which
- Malformed or missing secrets
- malformed placeholders must use the exact
${ENV_VAR}form - missing shell environment variables must be exported by the user before validation or execution
- do not write or infer secret values
- malformed placeholders must use the exact
- Missing provider API keys
openai/...usesOPENAI_API_KEYgoogle/...usesGOOGLE_API_KEYanthropic/...usesANTHROPIC_API_KEY- recommend
.finalrun/config.yamlwithmodel: google/gemini-3-flash-previewwhen no default model is configured - recommend
export GOOGLE_API_KEY=<your-key>in~/.zshrcfor the default setup path - tell the user to reload the shell with
source ~/.zshrcand rerun - mention
--api-keyonly if they want a one-off run
- Invalid
.finalrun/config.yaml- point to the YAML or config error directly
- Selector and suite resolution failures
finalrun test auth/login.yamlresolves from.finalrun/tests/auth/login.yamlfinalrun suite smoke.yamlresolves from.finalrun/suites/smoke.yaml- explicit
.finalrun/tests/...and.finalrun/suites/...paths still work
- App override and platform mismatch
.apkoverrides require Android.appoverrides require iOS- tell the user to fix the path or
--platformmismatch instead of ignoring it
- Host readiness issues
- use
finalrun doctoras the default local environment diagnostic
- use
Coordination with generate-finalrun-test
This skill is for CLI usage, validation, execution, reporting, and troubleshooting.
If the user asks to:
- create a new YAML test
- update a suite manifest
- add or change
.finalrun/env/*.yamlbindings - plan a new test flow
route that work to generate-finalrun-test.
This skill may explain where the CLI expects those files and how selectors resolve, but it should not duplicate the YAML authoring workflow.
More from final-run/finalrun-agent
finalrun-generate-test
Generate test and suite specifications in the strict FinalRun YAML format. Handles automated test planning, folder grouping by feature, repo app configuration, environment-specific overrides in .finalrun/env/*.yaml, and validation via finalrun check.
53finalrun-use-cli
Use the published FinalRun CLI to install, configure, validate, run, troubleshoot, and inspect reports for repo-local mobile test workspaces. Trigger this skill for requests involving finalrun, check, test, suite, doctor, runs, start-server.
51finalrun-test-and-fix
Orchestrate the full FinalRun loop — use finalrun-generate-test to explore a feature and author tests, run them via finalrun-use-cli, then triage failures from CLI artifacts and fix app code or tests until the run is green. Trigger for requests like "debug this failing FinalRun test", "verify and fix the feature with FinalRun", or as the Definition-of-Done loop after a UI change.
28generate-finalrun-test
Generate test and suite specifications in the strict FinalRun YAML format. Handles automated test planning, folder grouping by feature, repo app configuration, environment-specific overrides in .finalrun/env/*.yaml, and validation via finalrun check.
11