CLI commands
The CLI is provided by @flaky-tests/core. Run it with bunx:
bunx @flaky-tests/core [flags]Or install globally:
bun add -g @flaky-tests/coreflaky-tests [flags]Default behavior
Section titled “Default behavior”Running the CLI with no flags:
- Connects to the configured store
- Calls
getNewPatterns()with default window (7 days) and threshold (2 failures) - Prints a summary to stdout
- Exits
0if no patterns found,1if patterns were found
--window <days>
Section titled “--window <days>”Number of days in each detection window. The CLI compares the current window against an equal prior window.
bunx @flaky-tests/core --window 14 # 14-day windowsDefault: 7
--threshold <n>
Section titled “--threshold <n>”Minimum number of failures in the current window to flag a test as flaky.
bunx @flaky-tests/core --threshold 3Default: 2
--prompt
Section titled “--prompt”Print an AI investigation prompt for each pattern to stdout. Structured for pasting into Claude, Cursor, or Copilot.
bunx @flaky-tests/core --prompt--copy
Section titled “--copy”Copy the investigation prompt to the clipboard. Uses pbcopy on macOS, xclip on Linux, clip on Windows.
bunx @flaky-tests/core --prompt --copyIf multiple patterns are found, all prompts are concatenated before copying.
--create-issue
Section titled “--create-issue”Open a GitHub issue for each new pattern. Requires GITHUB_TOKEN and either GITHUB_REPOSITORY (set automatically in Actions) or --repo.
bunx @flaky-tests/core --create-issue --repo your-org/your-repoIssues include the investigation prompt in a collapsible <details> block. If an open issue for the same test already exists, a new one is not created.
--repo <owner/repo>
Section titled “--repo <owner/repo>”Override the repository for issue creation. Defaults to GITHUB_REPOSITORY env var, then falls back to parsing git remote get-url origin.
bunx @flaky-tests/core --create-issue --repo acme/api--html
Section titled “--html”Generate a self-contained HTML report (single file, inline CSS + JS) and open it in the default browser.
bunx @flaky-tests/core --htmlWorks even when there are no newly-flaky patterns — the report falls back to run history. See Using the HTML report for what’s included and how to share it.
--out <path>
Section titled “--out <path>”Destination path for --html. Defaults to a timestamped temp file.
bunx @flaky-tests/core --html --out flaky-report.htmlUse this to commit the report, attach it to a PR, or upload it as a CI artifact.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | No new patterns detected |
1 | One or more new patterns detected |
2 | Configuration error (missing env vars, store connection failed) |
Examples
Section titled “Examples”# Check with defaultsbunx @flaky-tests/core
# Check 30-day window, threshold 5bunx @flaky-tests/core --window 30 --threshold 5
# Print prompts for each patternbunx @flaky-tests/core --prompt
# Copy single prompt to clipboardbunx @flaky-tests/core --prompt --copy
# Create GitHub issuesGITHUB_TOKEN=$TOKEN bunx @flaky-tests/core --create-issue --repo your-org/your-repo
# Use Turso storeFLAKY_TESTS_STORE=turso \ TURSO_URL=libsql://... \ TURSO_AUTH_TOKEN=... \ bunx @flaky-tests/core