> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fallow.tools/llms.txt
> Use this file to discover all available pages before exploring further.

# Global flags

> Global CLI flags available on every fallow command, including root, config, format, cache, threads, workspace, changed-workspaces, score, trend, and snapshot options.

These flags are available on every fallow command (`dead-code`, `check`, `dupes`, `health`, `flags`, `fix`, `watch`, `list`, `init`, `migrate`).

## Reference

| Flag                                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| :---------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-r, --root <PATH>`                       | Project root directory (default: current working directory)                                                                                                                                                                                                                                                                                                                                                                                  |
| `-c, --config <PATH>`                     | Path to config file (default: auto-detected)                                                                                                                                                                                                                                                                                                                                                                                                 |
| `-f, --format <FORMAT>`                   | Output format: `human` (default), `json`, `sarif`, `compact`, `markdown`, `codeclimate`, `gitlab-codequality`, `pr-comment-github`, `pr-comment-gitlab`, `review-github`, `review-gitlab`, `badge`. Alias: `--output`                                                                                                                                                                                                                        |
| `-q, --quiet`                             | Suppress progress bars and status messages                                                                                                                                                                                                                                                                                                                                                                                                   |
| `--no-cache`                              | Disable incremental caching (force full re-parse)                                                                                                                                                                                                                                                                                                                                                                                            |
| `--threads <N>`                           | Number of parser threads (default: available parallelism)                                                                                                                                                                                                                                                                                                                                                                                    |
| `--changed-since <REF>` (alias: `--base`) | Only report issues in files changed since this git ref                                                                                                                                                                                                                                                                                                                                                                                       |
| `--diff-file <PATH>`                      | Path to a unified diff (e.g. `git diff --unified=0 main...HEAD`) used for line-level scoping of the `hot-path-touched` runtime-coverage verdict. A hot function is only flagged when a modified line falls inside its `[start_line, end_line]` range, instead of the file-level match `--changed-since` produces. Falls back to the `FALLOW_DIFF_FILE` env var.                                                                              |
| `--baseline <PATH>`                       | Compare against a previously saved baseline file                                                                                                                                                                                                                                                                                                                                                                                             |
| `--save-baseline <PATH>`                  | Save the current results as a baseline file                                                                                                                                                                                                                                                                                                                                                                                                  |
| `--fail-on-regression`                    | Fail if issue count increased beyond tolerance vs a regression baseline                                                                                                                                                                                                                                                                                                                                                                      |
| `--tolerance <N>`                         | Allowed increase: `"2%"` (percentage) or `"5"` (absolute). Default: `"0"`                                                                                                                                                                                                                                                                                                                                                                    |
| `--regression-baseline <PATH>`            | Path to regression baseline file (default: `.fallow/regression-baseline.json`)                                                                                                                                                                                                                                                                                                                                                               |
| `--save-regression-baseline <PATH>`       | Save current issue counts as a regression baseline                                                                                                                                                                                                                                                                                                                                                                                           |
| `--production`                            | Production mode: exclude test/story/dev files, only start/build scripts                                                                                                                                                                                                                                                                                                                                                                      |
| `--production-dead-code`                  | Per-analysis production mode for dead-code in bare combined runs and `fallow audit`. See [Per-analysis production mode](#per-analysis-production-mode).                                                                                                                                                                                                                                                                                      |
| `--production-health`                     | Per-analysis production mode for health in bare combined runs and `fallow audit`.                                                                                                                                                                                                                                                                                                                                                            |
| `--production-dupes`                      | Per-analysis production mode for duplication in bare combined runs and `fallow audit`.                                                                                                                                                                                                                                                                                                                                                       |
| `-w, --workspace <PATTERNS>`              | Scope output to one or more workspaces. Accepts exact names, globs matched against both the package name AND the workspace path (`apps/*`, `@scope/*`), and `!`-prefixed negations (`!apps/legacy`). Values can be comma-separated (`-w web,admin`) or the flag can be repeated. Quote patterns containing `!` or glob chars to avoid shell expansion.                                                                                       |
| `--changed-workspaces <REF>`              | Git-derived monorepo CI scoping: scope output to workspaces containing any file changed since `REF` (e.g. `origin/main`, `HEAD~1`). Auto-derives the workspace set from `git diff` so CI jobs don't hand-maintain a `--workspace` list. Mutually exclusive with `--workspace`. A missing ref or non-git directory is a hard error (exit 2), not a silent full-scope fallback. Root-only diffs map to 0 workspaces and exit 0 with no issues. |
| `--performance`                           | Show pipeline timing breakdown                                                                                                                                                                                                                                                                                                                                                                                                               |
| `--explain`                               | Include metric definitions in JSON output (`_meta` object). Always enabled for MCP                                                                                                                                                                                                                                                                                                                                                           |
| `--ci`                                    | CI mode: equivalent to `--format sarif --fail-on-issues --quiet`                                                                                                                                                                                                                                                                                                                                                                             |
| `--fail-on-issues`                        | Exit with code 1 if issues are found                                                                                                                                                                                                                                                                                                                                                                                                         |
| `--sarif-file <PATH>`                     | Write SARIF output to a file (in addition to the primary `--format` output)                                                                                                                                                                                                                                                                                                                                                                  |
| `--group-by <MODE>`                       | Group output by CODEOWNERS ownership (`owner`), first directory component (`directory`), workspace package (`package`), or GitLab CODEOWNERS section (`section`). When active, all output formats partition issues into labeled groups.                                                                                                                                                                                                      |
| `--summary`                               | Print a one-line summary of issue counts at the end of the run. In JSON format, adds a `summary` counts object to the output.                                                                                                                                                                                                                                                                                                                |
| `--only <check,dupes,health>`             | Run only specific analyses when no subcommand is given                                                                                                                                                                                                                                                                                                                                                                                       |
| `--skip <check,dupes,health>`             | Skip specific analyses when no subcommand is given                                                                                                                                                                                                                                                                                                                                                                                           |
| `--score`                                 | Compute health score (0-100 with letter grade) in combined mode. Enables the health delta header in PR comments. Also available on [`fallow health`](/cli/health).                                                                                                                                                                                                                                                                           |
| `--trend`                                 | Compare current health metrics against the most recent saved snapshot. Implies `--score`. Also available on [`fallow health`](/cli/health).                                                                                                                                                                                                                                                                                                  |
| `--save-snapshot [PATH]`                  | Save a vital signs snapshot for trend tracking. Default path: `.fallow/snapshots/<timestamp>.json`. Forces file-scores and hotspot computation. Also available on [`fallow health`](/cli/health).                                                                                                                                                                                                                                            |
| `--include-entry-exports`                 | Report unused exports in entry files instead of auto-marking them as used. Catches typos in framework exports (e.g. `meatdata` instead of `metadata`). Also configurable via `includeEntryExports: true` in your fallow config; the CLI flag wins when set.                                                                                                                                                                                  |

## Loaded config disclosure

When fallow loads a config file (either auto-discovered or via `--config`), it prints a single line to **stderr**:

```text theme={null}
loaded config: /repo/.fallowrc.json
```

This makes it obvious which `.fallowrc.json` is in effect, especially in monorepos where multiple configs may exist. The line is suppressed when:

* `--quiet` is set
* `--format` is anything other than `human` (`json`, `sarif`, `compact`, `markdown`, `codeclimate`, `gitlab-codequality`, `pr-comment-github`, `pr-comment-gitlab`, `review-github`, `review-gitlab`, `badge`)

For deeper inspection (the resolved config with `extends` merged), use the dedicated [`fallow config`](/cli/config) subcommand.

## Examples

```bash theme={null}
# Analyze a project in a different directory
fallow dead-code -r /path/to/project

# Use a specific config file
fallow dead-code -c configs/fallow-strict.json

# JSON output with no progress messages
fallow dead-code -f json --quiet

# Limit parallelism to 4 threads
fallow dead-code --threads 4

# Scope to a single workspace package
fallow dead-code -w @myorg/ui

# Scope to whichever workspaces changed since origin/main (CI primitive)
fallow --changed-workspaces origin/main

# Show timing breakdown
fallow dead-code --performance

# Group issues by CODEOWNERS ownership
fallow dead-code --group-by owner

# Group issues by top-level directory
fallow dead-code --group-by directory

# Group issues by workspace package
fallow dead-code --group-by package

# Group issues by GitLab CODEOWNERS section
fallow dead-code --group-by section

# Health score in combined mode
fallow --score

# Save a snapshot and track trends
fallow --save-snapshot
fallow --trend
```

## Per-analysis production mode

Bare combined runs (`fallow` with no subcommand) and `fallow audit` accept three per-analysis production flags so you can enable production mode for one analysis without forcing it on the others:

```bash theme={null}
# Treat health as production-only, leave dead-code and dupes in full-tree mode
fallow --production-health

# Audit changed files with production-only health
fallow audit --base main --production-health
```

The matching environment variables `FALLOW_PRODUCTION_DEAD_CODE`, `FALLOW_PRODUCTION_HEALTH`, and `FALLOW_PRODUCTION_DUPES` accept the same set of values as `FALLOW_PRODUCTION` (`true`, `false`, `1`, `0`, `yes`, `no`, `on`, `off`). The `production` config field also accepts a per-analysis object:

```jsonc theme={null}
{
  "production": {
    "deadCode": false,
    "health": true,
    "dupes": false
  }
}
```

**Precedence (highest to lowest)**: CLI flags (`--production`, `--production-{dead-code,health,dupes}`), per-analysis env var (`FALLOW_PRODUCTION_HEALTH`, etc.), global env var (`FALLOW_PRODUCTION`), config (`production: { ... }` or `production: true`). The legacy boolean form (`--production`, `production: true`, `FALLOW_PRODUCTION=true`) is unchanged and still applies to every analysis.

The per-analysis CLI flags are rejected when used with a subcommand other than `audit` (e.g. `fallow dead-code --production-health` errors). Use the bare command or the per-analysis env vars in that case.

## Grouped output

The `--group-by` flag partitions all issues into labeled groups. This works with every output format and every subcommand.

| Mode        | Grouping                                                                                                                                                                                                                                      | Requires                                                            |
| :---------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------ |
| `owner`     | CODEOWNERS file ownership. Auto-probes `CODEOWNERS`, `.github/CODEOWNERS`, `.gitlab/CODEOWNERS`, `docs/CODEOWNERS`. First owner on multi-owner lines wins.                                                                                    | A CODEOWNERS file (or set `codeowners` in config)                   |
| `directory` | First path component (e.g. `src/utils/foo.ts` groups under `src`)                                                                                                                                                                             | Nothing                                                             |
| `package`   | Workspace package name (e.g. `@myorg/ui`). Issues are grouped by the package they belong to.                                                                                                                                                  | A monorepo with workspace packages                                  |
| `section`   | GitLab CODEOWNERS `[Section]` header name. Distinct sections stay in distinct groups even when they share a default reviewer, so teams with one shared lead reviewer across many sections get per-section triage instead of one giant bucket. | A GitLab-style CODEOWNERS file with at least one `[Section]` header |

With `--format json`, the output shape changes to a grouped envelope:

```json theme={null}
{
  "grouped_by": "owner",
  "total_issues": 12,
  "groups": [
    { "key": "@frontend-team", "total_issues": 8, "unused_files": [], "unused_exports": [] },
    { "key": "@backend-team", "total_issues": 4, "unused_exports": [] }
  ]
}
```

For `--group-by section`, each group also carries an `owners` array with the section's default owners:

```json theme={null}
{
  "grouped_by": "section",
  "total_issues": 6,
  "groups": [
    {
      "key": "billing",
      "owners": ["@core-reviewers", "@alice", "@bob"],
      "total_issues": 2,
      "unused_exports": []
    },
    {
      "key": "notifications",
      "owners": ["@core-reviewers", "@alice", "@bob"],
      "total_issues": 1,
      "unused_exports": []
    }
  ]
}
```

Section and owner groups are not interchangeable: `owner` collapses all sections that share a lead reviewer into a single bucket, while `section` preserves the `[Section]` headers as stable group keys across reviewer rotation.

<Tip>
  Set a custom CODEOWNERS path via the `codeowners` field in `.fallowrc.json` if your file isn't in a standard location.
</Tip>

## Incremental caching

Fallow caches parsed file data between runs to skip unchanged files. On the second run, only modified files are re-parsed. The rest are loaded from cache.

**How it works:**

1. Each file is hashed with [xxh3](https://github.com/Cyan4973/xxHash) (extremely fast, non-cryptographic)
2. If the hash matches the cached version, parsing is skipped entirely
3. The module graph is rebuilt from cached + freshly-parsed data

<Tip>
  Use `--performance` to see cache hit rates and per-stage timings. This is helpful for diagnosing slow runs.
</Tip>

```bash theme={null}
fallow dead-code --performance
```

```ansi theme={null}
 Discovery     12ms   (142 files)
 Parsing       48ms   (23 parsed, 119 cached)
 Resolution    15ms
 Analysis       8ms
 Total         83ms
```

Use `--no-cache` to force a full re-parse. This is useful after major refactors or when debugging unexpected results.

```bash theme={null}
fallow dead-code --no-cache
```

<Warning>
  `--no-cache` makes every run a cold start. Use it only for debugging unexpected results.
</Warning>

## See also

<CardGroup cols={2}>
  <Card title="Environment variables" icon="terminal" href="/configuration/environment">
    Set defaults for format and quiet mode via environment variables.
  </Card>

  <Card title="Configuration" icon="gear" href="/configuration/overview">
    Full config file reference for project-level settings.
  </Card>
</CardGroup>
