flakiness 0.217.0 → 0.219.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli/cli.js CHANGED
@@ -1028,7 +1028,7 @@ import path7 from "path";
1028
1028
  // ../package.json
1029
1029
  var package_default = {
1030
1030
  name: "@flakiness/monorepo",
1031
- version: "0.217.0",
1031
+ version: "0.219.0",
1032
1032
  type: "module",
1033
1033
  private: true,
1034
1034
  scripts: {
@@ -1964,6 +1964,41 @@ function durationTrendScale(currentMs, baseMs) {
1964
1964
  }
1965
1965
 
1966
1966
  // src/cli/cmd-list-tests.ts
1967
+ function buildTimelineSplit(filters) {
1968
+ const systemFilters = [];
1969
+ if (filters.envName?.length)
1970
+ systemFilters.push({ name: "name", values: filters.envName });
1971
+ if (filters.envPath?.length)
1972
+ systemFilters.push({ name: "path", values: filters.envPath });
1973
+ if (filters.envCategory?.length)
1974
+ systemFilters.push({ name: "category", values: filters.envCategory });
1975
+ if (filters.envOs?.length)
1976
+ systemFilters.push({ name: "osname", values: filters.envOs });
1977
+ if (filters.envArch?.length)
1978
+ systemFilters.push({ name: "osarch", values: filters.envArch });
1979
+ const userFilters = /* @__PURE__ */ new Map();
1980
+ for (const entry of filters.envMetadata ?? []) {
1981
+ const eqIndex = entry.indexOf("=");
1982
+ const key = entry.slice(0, eqIndex);
1983
+ const value = entry.slice(eqIndex + 1);
1984
+ let values = userFilters.get(key);
1985
+ if (!values) {
1986
+ values = [];
1987
+ userFilters.set(key, values);
1988
+ }
1989
+ values.push(value);
1990
+ }
1991
+ if (!systemFilters.length && !userFilters.size)
1992
+ return void 0;
1993
+ return {
1994
+ splitByDefault: true,
1995
+ filters: {
1996
+ system: systemFilters.length ? systemFilters : void 0,
1997
+ user: userFilters.size ? Array.from(userFilters, ([name, values]) => ({ name, values })) : void 0
1998
+ },
1999
+ inverse: {}
2000
+ };
2001
+ }
1967
2002
  async function cmdListTests(options) {
1968
2003
  const [orgSlug, projectSlug] = options.flakinessProject.split("/");
1969
2004
  if (!orgSlug || !projectSlug)
@@ -1992,7 +2027,8 @@ async function cmdListTests(options) {
1992
2027
  direction: options.sortDir
1993
2028
  },
1994
2029
  historyBuckets: 10,
1995
- fql: options.fql
2030
+ fql: options.fql,
2031
+ timelineSplit: buildTimelineSplit(options)
1996
2032
  });
1997
2033
  let scope = "default branch";
1998
2034
  if (options.pr !== void 0)
@@ -2020,9 +2056,12 @@ async function cmdListTests(options) {
2020
2056
  const trend = formatDurationTrend(testStats.durationChangeMs, testStats.durationMs);
2021
2057
  const flipRate = formatFlipRate(testStats.flipRate);
2022
2058
  const env = formatEnv(testStats.env);
2059
+ const metadata = formatEnvMetadata(testStats.env);
2023
2060
  lines.push(`### ${index + 1}. ${fullName}`);
2024
2061
  lines.push(`- Location: ${asInlineCode(location)}`);
2025
2062
  lines.push(`- Env: ${asInlineCode(env)}`);
2063
+ if (metadata)
2064
+ lines.push(`- Env Metadata: ${asInlineCode(metadata)}`);
2026
2065
  lines.push(`- Status: ${asInlineCode(status)}`);
2027
2066
  lines.push(`- Duration: ${asInlineCode(duration)} (${asInlineCode(trend)})`);
2028
2067
  lines.push(`- Flip Rate: ${asInlineCode(flipRate)}`);
@@ -2053,18 +2092,25 @@ function outcomeToStatus(outcome) {
2053
2092
  }
2054
2093
  function formatEnv(env) {
2055
2094
  const parts = [];
2056
- const { systemData } = env;
2057
- if (systemData.osName)
2058
- parts.push(`os=${systemData.osName}`);
2059
- if (systemData.osVersion)
2060
- parts.push(`osVersion=${systemData.osVersion}`);
2061
- if (systemData.osArch)
2062
- parts.push(`arch=${systemData.osArch}`);
2063
- if (env.userSuppliedData) {
2064
- for (const [key, value] of Object.entries(env.userSuppliedData))
2065
- parts.push(`${key}=${value}`);
2066
- }
2067
- return parts.join(", ") || env.name || "unknown";
2095
+ if (env.category)
2096
+ parts.push(`category=${env.category}`);
2097
+ if (env.name)
2098
+ parts.push(`name=${env.name}`);
2099
+ if (env.configPath)
2100
+ parts.push(`path=${env.configPath}`);
2101
+ if (env.systemData.osName) {
2102
+ const os4 = [env.systemData.osName, env.systemData.osVersion].filter(Boolean).join(" ");
2103
+ parts.push(`os=${os4}`);
2104
+ }
2105
+ if (env.systemData.osArch)
2106
+ parts.push(`arch=${env.systemData.osArch}`);
2107
+ return parts.join(", ") || "unknown";
2108
+ }
2109
+ function formatEnvMetadata(env) {
2110
+ if (!env.userSuppliedData)
2111
+ return void 0;
2112
+ const parts = Object.entries(env.userSuppliedData).map(([key, value]) => `${key}=${value}`);
2113
+ return parts.length ? parts.join(", ") : void 0;
2068
2114
  }
2069
2115
  function formatDurationTrend(changeMs, currentMs) {
2070
2116
  const baseMs = currentMs - changeMs;
@@ -2087,17 +2133,18 @@ function asInlineCode(text) {
2087
2133
  import { execSync } from "child_process";
2088
2134
  import chalk3 from "chalk";
2089
2135
  import fs5 from "fs";
2136
+ import os3 from "os";
2090
2137
  import path5 from "path";
2091
2138
 
2092
2139
  // src/generated/bundledSkillsData.ts
2093
2140
  var BUNDLED_SKILLS = [
2094
2141
  {
2095
2142
  "name": "flakiness-investigation",
2096
- "description": "Use when querying Flakiness.io test data, writing FQL filters, finding flaky or failed tests, investigating regressions, analyzing test health, or fixing PR test failures with the flakiness CLI.",
2143
+ "description": "TRIGGER when: CI fails, tests fail, PR checks fail, user asks about test results, regressions, flakiness, or test health. Always use this INSTEAD OF `gh` CLI for investigating test failures \u2014 it distinguishes regressions (caused by the PR) from pre-existing failures and flakes. DO NOT TRIGGER when: the user is asking about non-test CI issues (e.g. build failures, deployment problems).",
2097
2144
  "files": [
2098
2145
  {
2099
2146
  "path": "SKILL.md",
2100
- "content": "---\nname: flakiness-investigation\ndescription: Use when querying Flakiness.io test data, writing FQL filters, finding flaky or failed tests, investigating regressions, analyzing test health, or fixing PR test failures with the flakiness CLI.\n---\n\n# Flakiness Investigation\n\nUse the `flakiness` CLI to query and analyze test data from Flakiness.io.\n\n## Prerequisites\n\n- The `flakiness` CLI must be available in PATH (installed via `npm install -g flakiness` or `npx flakiness`).\n- A project must be specified: `--project <org/project>` or set `FLAKINESS_PROJECT` env var.\n- Authentication: run `flakiness auth login` first, or set `FLAKINESS_ACCESS_TOKEN`.\n\n## Core command\n\n```bash\nflakiness list tests --project <org/project> [--pr <number>] [--branch <name>] [--fql <query>] [--sort <axis>] [--sort-dir asc|desc] [--page <n>] [--page-size <n>]\n```\n\n### Scope options\n\n| Flag | Effect |\n|------|--------|\n| *(none)* | Default branch \u2014 tests from the day of its head commit (in the project's timezone) |\n| `--pr <number>` | Pull request \u2014 tests from the merge-commit of the PR branch into the target branch |\n| `--branch <name>` | Named branch \u2014 tests from the day of its head commit (in the project's timezone) |\n\n`--pr` and `--branch` are mutually exclusive.\n\n### Status semantics with `--pr`\n\nWhen querying a PR, the status values have specific meaning:\n\n| Status | Meaning |\n|--------|---------|\n| `regressed` | Test was passing on the target branch but fails in this PR \u2014 **caused by the PR** |\n| `failed` | Test also fails on the target branch \u2014 **pre-existing failure, not caused by the PR** |\n| `flaked` | Test failed but passed on retry \u2014 flaky, not a real failure |\n| `passed` | Test passes |\n| `skipped` | Test was skipped |\n\n### Sort axes\n\n- `outcome` \u2014 sort by test outcome severity (default)\n- `flip_rate` \u2014 sort by flip rate (how often a test flips between pass/fail)\n- `duration` \u2014 sort by test duration\n- `duration_trend` \u2014 sort by duration trend\n- `name` \u2014 sort alphabetically\n\n### Common queries\n\n| Goal | FQL + flags |\n|------|-------------|\n| Flaky tests | `--fql 'flip>0%' --sort flip_rate --sort-dir desc` |\n| Very flaky (>50%) | `--fql 'flip>50%' --sort flip_rate --sort-dir desc` |\n| Failed tests | `--fql 's:failed' --sort outcome --sort-dir desc` |\n| Regressions | `--fql 's:regressed'` |\n| All broken tests | `--fql 'status:(failed, regressed)'` |\n| Slow tests | `--fql 'd>5s' --sort duration --sort-dir desc` |\n| Tests matching error | `--fql '$timeout'` |\n| Tests in file | `--fql 'f:login.spec.ts'` |\n\n## FQL (Filter Query Language)\n\nFull reference: [references/fql.md](references/fql.md)\n\nKey rules:\n- Multiple tokens combine with AND: `s:failed f:e2e` means \"failed AND in e2e files\"\n- Prefix with `-` to exclude: `-#smoke` excludes smoke-tagged tests\n- Same filter type uses OR: `status:(failed, regressed)` means \"failed OR regressed\"\n- Quote values with spaces: `f:'tests/e2e checkout'`\n\n### Filter types\n\n| Filter | Syntax | Example |\n|--------|--------|---------|\n| Text search | `<text>` | `login` |\n| Status | `s:<status>` | `s:failed`, `status:(failed, regressed)` |\n| File | `f:<path>` | `f:login.spec.ts` |\n| Error | `$<text>` | `$timeout` |\n| Tag | `#<tag>` | `#smoke` |\n| Duration | `d><time>` | `d>2s`, `d<=500ms` |\n| Flip rate | `flip><pct>` | `flip>0%`, `fr>50%` |\n| Annotation | `@<type>` | `@skip` |\n\n### Status values\n\n`passed`, `failed`, `flaked`, `skipped`, `regressed`\n\n## Workflow: Fix My PR Tests\n\nWhen a user asks to fix failing tests in a PR, follow these steps:\n\n1. **Fetch regressions from the PR:**\n ```bash\n flakiness list tests --project <org/project> --pr <number> --fql 's:regressed' --page-size 50\n ```\n Tests with status `regressed` were passing on the target branch but fail in this PR \u2014 these are **caused by the PR** and must be fixed.\n\n2. **Analyze the output:** Look at the error messages, file paths, and test names to understand what the PR broke.\n\n3. **Fix the regressions** by reading the reported file paths and error messages, then making targeted code changes.\n\n4. **Optionally check pre-existing failures:** Tests with status `failed` also fail on the target branch and are not caused by the PR. You can list them with:\n ```bash\n flakiness list tests --project <org/project> --pr <number> --fql 's:failed' --page-size 50\n ```\n These are informational \u2014 fixing them is a bonus, not a requirement.\n\n5. **Ignore flakes:** Tests with status `flaked` failed but passed on retry \u2014 they are flaky and not actionable in the context of a PR fix.\n\n## Workflow tips\n\n1. Start broad: `flakiness list tests --project <org/project> --page-size 20`\n2. Filter down with FQL based on what you're investigating\n3. Use `--page-size 50` or higher to see more results at once\n4. Combine filters: `--fql 's:failed $timeout f:e2e -#smoke'`\n\nMore recipes: [references/recipes.md](references/recipes.md)\n"
2147
+ "content": "---\nname: flakiness-investigation\ndescription: >-\n TRIGGER when: CI fails, tests fail, PR checks fail, user asks about test results, regressions, flakiness, or test health.\n Always use this INSTEAD OF `gh` CLI for investigating test failures \u2014 it distinguishes regressions (caused by the PR) from pre-existing failures and flakes.\n DO NOT TRIGGER when: the user is asking about non-test CI issues (e.g. build failures, deployment problems).\n---\n\n# Flakiness Investigation\n\nUse the `flakiness` CLI to query and analyze test data from Flakiness.io.\n\n## Prerequisites\n\n- The `flakiness` CLI must be available in PATH (installed via `npm install -g flakiness` or `npx flakiness`).\n- A project must be specified: `--project <org/project>` or set `FLAKINESS_PROJECT` env var.\n- Authentication: run `flakiness auth login` first, or set `FLAKINESS_ACCESS_TOKEN`.\n\n## Core command\n\n```bash\nflakiness list tests --project <org/project> [--pr <number>] [--branch <name>] [--fql <query>] [--sort <axis>] [--sort-dir asc|desc] [--page <n>] [--page-size <n>] [--env-name <value>] [--env-path <value>] [--env-category <value>] [--env-os <value>] [--env-arch <value>] [--env-metadata <key=value>]\n```\n\n### Scope options\n\n| Flag | Effect |\n|------|--------|\n| *(none)* | Default branch \u2014 tests from the day of its head commit (in the project's timezone) |\n| `--pr <number>` | Pull request \u2014 tests from the merge-commit of the PR branch into the target branch |\n| `--branch <name>` | Named branch \u2014 tests from the day of its head commit (in the project's timezone) |\n\n`--pr` and `--branch` are mutually exclusive.\n\n### Environment filter options\n\nFilter results by environment. All flags are repeatable. Multiple values for the same flag are OR'd; different flags are AND'd.\n\n| Flag | Filters by | Example |\n|------|-----------|---------|\n| `--env-name <value>` | Environment name | `--env-name chromium` |\n| `--env-path <value>` | Config file path | `--env-path playwright.config.ts` |\n| `--env-category <value>` | Test category | `--env-category playwright` |\n| `--env-os <value>` | OS name + version | `--env-os \"Ubuntu 22.04\"` |\n| `--env-arch <value>` | CPU architecture | `--env-arch x86_64` |\n| `--env-metadata <key=value>` | User-supplied metadata | `--env-metadata browser=chromium` |\n\nThe output for each test shows environment info in the same `key=value` format:\n- **Env** line: system-collected data with keys matching the `--env-*` flag suffixes (`category=`, `name=`, `path=`, `os=`, `arch=`)\n- **Env Metadata** line (if any): user-supplied key=value pairs\n\nThis makes it easy to copy a value from the output and use it as a filter flag.\n\n### Status semantics with `--pr`\n\nWhen querying a PR, the status values have specific meaning:\n\n| Status | Meaning |\n|--------|---------|\n| `regressed` | Test was passing on the target branch but fails in this PR \u2014 **caused by the PR** |\n| `failed` | Test also fails on the target branch \u2014 **pre-existing failure, not caused by the PR** |\n| `flaked` | Test failed but passed on retry \u2014 flaky, not a real failure |\n| `passed` | Test passes |\n| `skipped` | Test was skipped |\n\n### Sort axes\n\n- `outcome` \u2014 sort by test outcome severity (default)\n- `flip_rate` \u2014 sort by flip rate (how often a test flips between pass/fail)\n- `duration` \u2014 sort by test duration\n- `duration_trend` \u2014 sort by duration trend\n- `name` \u2014 sort alphabetically\n\n### Common queries\n\n| Goal | FQL + flags |\n|------|-------------|\n| Flaky tests | `--fql 'flip>0%' --sort flip_rate --sort-dir desc` |\n| Very flaky (>50%) | `--fql 'flip>50%' --sort flip_rate --sort-dir desc` |\n| Failed tests | `--fql 's:failed' --sort outcome --sort-dir desc` |\n| Regressions | `--fql 's:regressed'` |\n| All broken tests | `--fql 'status:(failed, regressed)'` |\n| Slow tests | `--fql 'd>5s' --sort duration --sort-dir desc` |\n| Tests matching error | `--fql '$timeout'` |\n| Tests in file | `--fql 'f:login.spec.ts'` |\n| Tests on Linux | `--env-os \"Ubuntu 22.04\"` |\n| Tests for chromium project | `--env-name chromium` |\n| Tests with specific metadata | `--env-metadata browser=firefox` |\n| Linux or macOS failures | `--env-os \"Ubuntu 22.04\" --env-os \"Darwin 24.0\" --fql 's:failed'` |\n\n## FQL (Filter Query Language)\n\nFull reference: [references/fql.md](references/fql.md)\n\nKey rules:\n- Multiple tokens combine with AND: `s:failed f:e2e` means \"failed AND in e2e files\"\n- Prefix with `-` to exclude: `-#smoke` excludes smoke-tagged tests\n- Same filter type uses OR: `status:(failed, regressed)` means \"failed OR regressed\"\n- Quote values with spaces: `f:'tests/e2e checkout'`\n\n### Filter types\n\n| Filter | Syntax | Example |\n|--------|--------|---------|\n| Text search | `<text>` | `login` |\n| Status | `s:<status>` | `s:failed`, `status:(failed, regressed)` |\n| File | `f:<path>` | `f:login.spec.ts` |\n| Error | `$<text>` | `$timeout` |\n| Tag | `#<tag>` | `#smoke` |\n| Duration | `d><time>` | `d>2s`, `d<=500ms` |\n| Flip rate | `flip><pct>` | `flip>0%`, `fr>50%` |\n| Annotation | `@<type>` | `@skip` |\n\n### Status values\n\n`passed`, `failed`, `flaked`, `skipped`, `regressed`\n\n## Workflow: Fix My PR Tests\n\nWhen a user asks to fix failing tests in a PR, follow these steps:\n\n1. **Find the project slug:** Search the codebase for `flakinessProject` to find the `--project` value. It is typically configured in a test reporter config (e.g. `playwright.config.ts`, `jest.config.ts`) as `flakinessProject: 'org/project'`.\n\n2. **Fetch regressions from the PR:**\n ```bash\n flakiness list tests --project <org/project> --pr <number> --fql 's:regressed' --page-size 50\n ```\n Tests with status `regressed` were passing on the target branch but fail in this PR \u2014 these are **caused by the PR** and must be fixed.\n\n3. **Analyze the output:** Look at the error messages, file paths, and test names to understand what the PR broke.\n\n4. **Fix the regressions** by reading the reported file paths and error messages, then making targeted code changes.\n\n5. **Optionally check pre-existing failures:** Tests with status `failed` also fail on the target branch and are not caused by the PR. You can list them with:\n ```bash\n flakiness list tests --project <org/project> --pr <number> --fql 's:failed' --page-size 50\n ```\n These are informational \u2014 fixing them is a bonus, not a requirement.\n\n6. **Ignore flakes:** Tests with status `flaked` failed but passed on retry \u2014 they are flaky and not actionable in the context of a PR fix.\n\n## Workflow tips\n\n1. Start broad: `flakiness list tests --project <org/project> --page-size 20`\n2. Filter down with FQL based on what you're investigating\n3. Use `--page-size 50` or higher to see more results at once\n4. Combine filters: `--fql 's:failed $timeout f:e2e -#smoke'`\n\nMore recipes: [references/recipes.md](references/recipes.md)\n"
2101
2148
  },
2102
2149
  {
2103
2150
  "path": "references/fql.md",
@@ -2105,7 +2152,7 @@ var BUNDLED_SKILLS = [
2105
2152
  },
2106
2153
  {
2107
2154
  "path": "references/recipes.md",
2108
- "content": "# Investigation Recipes\n\nReplace `myorg/myproject` with the target project slug, or set `FLAKINESS_PROJECT`.\n\n## Query a pull request\n\nShows tests from the merge-commit of the PR branch into the target branch.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42\n```\n\n## Find PR regressions (caused by the PR)\n\nTests marked `regressed` were passing on the target branch but fail in this PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:regressed'\n```\n\n## Find pre-existing failures in a PR\n\nTests marked `failed` also fail on the target branch \u2014 not caused by the PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:failed'\n```\n\n## Find all broken tests in a PR\n\nIncludes both PR-caused regressions and pre-existing failures.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 'status:(failed, regressed)' --page-size 50\n```\n\n## Query a specific branch\n\nShows tests from the day of the branch's head commit, in the project's timezone.\n\n```bash\nflakiness list tests --project myorg/myproject --branch feature/login\n```\n\n## Find all flaky tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>0%' --sort flip_rate --sort-dir desc\n```\n\n## Find the most flaky tests (>50% flip rate)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>50%' --sort flip_rate --sort-dir desc\n```\n\n## Show failed tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed' --sort outcome --sort-dir desc\n```\n\n## Show regressions\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:regressed'\n```\n\n## Show all currently broken tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'status:(failed, regressed)' --sort outcome --sort-dir desc\n```\n\n## Show flaked tests (passed on retry)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:flaked' --sort flip_rate --sort-dir desc\n```\n\n## Find slow tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'd>5s' --sort duration --sort-dir desc\n```\n\n## Find tests by error text\n\n```bash\nflakiness list tests --project myorg/myproject --fql '$timeout'\nflakiness list tests --project myorg/myproject --fql '$\"network error\"'\n```\n\n## Combine filters\n\nFailed tests in e2e files, excluding smoke-tagged tests:\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed f:e2e -#smoke'\n```\n\n## Narrow to a specific file\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'f:login.spec.ts'\n```\n\n## Find tests with a specific annotation\n\n```bash\nflakiness list tests --project myorg/myproject --fql '@skip'\nflakiness list tests --project myorg/myproject --fql '@fixme'\n```\n"
2155
+ "content": "# Investigation Recipes\n\nReplace `myorg/myproject` with the target project slug, or set `FLAKINESS_PROJECT`.\n\n## Query a pull request\n\nShows tests from the merge-commit of the PR branch into the target branch.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42\n```\n\n## Find PR regressions (caused by the PR)\n\nTests marked `regressed` were passing on the target branch but fail in this PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:regressed'\n```\n\n## Find pre-existing failures in a PR\n\nTests marked `failed` also fail on the target branch \u2014 not caused by the PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:failed'\n```\n\n## Find all broken tests in a PR\n\nIncludes both PR-caused regressions and pre-existing failures.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 'status:(failed, regressed)' --page-size 50\n```\n\n## Query a specific branch\n\nShows tests from the day of the branch's head commit, in the project's timezone.\n\n```bash\nflakiness list tests --project myorg/myproject --branch feature/login\n```\n\n## Find all flaky tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>0%' --sort flip_rate --sort-dir desc\n```\n\n## Find the most flaky tests (>50% flip rate)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>50%' --sort flip_rate --sort-dir desc\n```\n\n## Show failed tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed' --sort outcome --sort-dir desc\n```\n\n## Show regressions\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:regressed'\n```\n\n## Show all currently broken tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'status:(failed, regressed)' --sort outcome --sort-dir desc\n```\n\n## Show flaked tests (passed on retry)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:flaked' --sort flip_rate --sort-dir desc\n```\n\n## Find slow tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'd>5s' --sort duration --sort-dir desc\n```\n\n## Find tests by error text\n\n```bash\nflakiness list tests --project myorg/myproject --fql '$timeout'\nflakiness list tests --project myorg/myproject --fql '$\"network error\"'\n```\n\n## Combine filters\n\nFailed tests in e2e files, excluding smoke-tagged tests:\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed f:e2e -#smoke'\n```\n\n## Narrow to a specific file\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'f:login.spec.ts'\n```\n\n## Find tests with a specific annotation\n\n```bash\nflakiness list tests --project myorg/myproject --fql '@skip'\nflakiness list tests --project myorg/myproject --fql '@fixme'\n```\n\n## Filter by environment\n\n### Show tests for a specific OS\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\"\n```\n\n### Show tests for a specific environment name\n\n```bash\nflakiness list tests --project myorg/myproject --env-name chromium\n```\n\n### Show tests for a specific architecture\n\n```bash\nflakiness list tests --project myorg/myproject --env-arch arm64\n```\n\n### Show tests for multiple OSes (OR)\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --env-os \"Darwin 24.0\"\n```\n\n### Combine env filter with FQL\n\nFailed tests on Linux only:\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --fql 's:failed'\n```\n\n### Filter by user-supplied metadata\n\n```bash\nflakiness list tests --project myorg/myproject --env-metadata browser=firefox\n```\n\n### Combine multiple env filters (AND)\n\nTests on Linux with arm64 architecture:\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --env-arch arm64\n```\n"
2109
2156
  }
2110
2157
  ]
2111
2158
  }
@@ -2121,8 +2168,9 @@ function projectRoot() {
2121
2168
  }
2122
2169
  }
2123
2170
  async function cmdSkillsInstall(options) {
2171
+ const root = options.project ? projectRoot() : os3.homedir();
2124
2172
  for (const skill of BUNDLED_SKILLS) {
2125
- const dest = path5.join(projectRoot(), `.${options.agent}`, "skills", skill.name);
2173
+ const dest = path5.join(root, `.${options.agent}`, "skills", skill.name);
2126
2174
  await fs5.promises.rm(dest, { recursive: true, force: true });
2127
2175
  for (const file of skill.files) {
2128
2176
  const filePath = path5.join(dest, file.path);
@@ -2235,7 +2283,20 @@ var optTestsPR = new Option("--pr <number>", "Show tests from a specific pull re
2235
2283
  return parsed;
2236
2284
  }).conflicts("branch");
2237
2285
  var optTestsBranch = new Option("--branch <name>", "Show tests from a specific branch").conflicts("pr");
2238
- list.command("tests").description("Query tests data. Defaults to the default branch (day of head commit in project timezone). Use --pr for PR merge-commit tests, or --branch for a named branch.").addOption(optTestsPage).addOption(optTestsPageSize).addOption(optTestsSort).addOption(optTestsSortDir).addOption(optTestsFQL).addOption(optTestsPR).addOption(optTestsBranch).addOption(mustFlakinessProject).addOption(optEndpoint).addOption(optAccessToken).action(async (options) => runCommand(async () => {
2286
+ function collectValues(value, prev) {
2287
+ return [...prev ?? [], value];
2288
+ }
2289
+ var optTestsEnvName = new Option("--env-name <value>", "Filter by environment name (repeatable)").argParser(collectValues);
2290
+ var optTestsEnvPath = new Option("--env-path <value>", "Filter by config path (repeatable)").argParser(collectValues);
2291
+ var optTestsEnvCategory = new Option("--env-category <value>", "Filter by category (repeatable)").argParser(collectValues);
2292
+ var optTestsEnvOs = new Option("--env-os <value>", "Filter by OS name + version (repeatable)").argParser(collectValues);
2293
+ var optTestsEnvArch = new Option("--env-arch <value>", "Filter by CPU architecture (repeatable)").argParser(collectValues);
2294
+ var optTestsEnvMetadata = new Option("--env-metadata <key=value>", "Filter by user-supplied environment metadata (repeatable)").argParser((value, prev) => {
2295
+ if (!value.includes("="))
2296
+ throw new Error(`Invalid env-metadata format '${value}'; expected key=value`);
2297
+ return [...prev ?? [], value];
2298
+ });
2299
+ list.command("tests").description("Query tests data. Defaults to the default branch (day of head commit in project timezone). Use --pr for PR merge-commit tests, or --branch for a named branch.").addOption(optTestsPage).addOption(optTestsPageSize).addOption(optTestsSort).addOption(optTestsSortDir).addOption(optTestsFQL).addOption(optTestsPR).addOption(optTestsBranch).addOption(optTestsEnvName).addOption(optTestsEnvPath).addOption(optTestsEnvCategory).addOption(optTestsEnvOs).addOption(optTestsEnvArch).addOption(optTestsEnvMetadata).addOption(mustFlakinessProject).addOption(optEndpoint).addOption(optAccessToken).action(async (options) => runCommand(async () => {
2239
2300
  await cmdListTests({
2240
2301
  page: options.page,
2241
2302
  pageSize: options.pageSize,
@@ -2244,6 +2305,12 @@ list.command("tests").description("Query tests data. Defaults to the default bra
2244
2305
  fql: options.fql,
2245
2306
  pr: options.pr,
2246
2307
  branch: options.branch,
2308
+ envName: options.envName,
2309
+ envPath: options.envPath,
2310
+ envCategory: options.envCategory,
2311
+ envOs: options.envOs,
2312
+ envArch: options.envArch,
2313
+ envMetadata: options.envMetadata,
2247
2314
  endpoint: options.endpoint,
2248
2315
  accessToken: options.accessToken,
2249
2316
  flakinessProject: options.project
@@ -2261,8 +2328,8 @@ auth.command("whoami").description("Show current logged in user information").ac
2261
2328
  }));
2262
2329
  var skills = program.command("skills").description("Manage agent skills");
2263
2330
  var optAgent = new Option("--agent <agent>", "Target agent").choices(AGENTS).makeOptionMandatory();
2264
- skills.command("install").description("Install bundled skills into the project").addOption(optAgent).action(async (options) => runCommand(async () => {
2265
- await cmdSkillsInstall({ agent: options.agent });
2331
+ skills.command("install").description("Install bundled skills into the user home directory (use --project for project-local install)").addOption(optAgent).option("--project", "Install into the project directory instead of the user home directory").action(async (options) => runCommand(async () => {
2332
+ await cmdSkillsInstall({ agent: options.agent, project: options.project });
2266
2333
  }));
2267
2334
  program.command("access").description("Check access to a Flakiness.io project").addOption(mustFlakinessProject).addOption(optAccessToken).addOption(optEndpoint).option("--json", "Output result as JSON").option("-q, --quiet", "Suppress output, only set exit code").action(async (options) => runCommand(async () => {
2268
2335
  await cmdAccess({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flakiness",
3
- "version": "0.217.0",
3
+ "version": "0.219.0",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "flakiness": "./lib/cli/cli.js"
@@ -22,8 +22,9 @@
22
22
  "@playwright/test": "^1.57.0",
23
23
  "@types/debug": "^4.1.12",
24
24
  "@types/express": "^4.17.20",
25
- "@flakiness/server": "0.217.0",
26
- "@flakiness/shared": "0.217.0"
25
+ "gray-matter": "^4.0.3",
26
+ "@flakiness/shared": "0.219.0",
27
+ "@flakiness/server": "0.219.0"
27
28
  },
28
29
  "dependencies": {
29
30
  "@flakiness/flakiness-report": "^0.28.0",