{
  "slug": "jj-fix-can-format-selected-line-ranges-1f1885bf3fe3",
  "title": "jj fix can format selected line ranges",
  "tools": [
    "jj"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-05-07T12:36:00.000Z",
  "announced_at": "2026-05-07T12:36:00.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a configured formatter supports line ranges, set `fix.tools.<name>.line-range-arg` to pass each modified range and optionally set `run-tool-if-zero-line-ranges` to run it when no ranges are available. Run `jj fix --all-lines` to format whole modified files.",
    "examples": [
      "[fix.tools.<name>]\ncommand = [\"<formatter>\", \"<formatter-args>\"]\npatterns = [\"<fileset>\"]\nline-range-arg = \"--lines=$first:$last\"\nrun-tool-if-zero-line-ranges = false\n\njj fix --all-lines"
    ],
    "gotchas": [
      "Version: v0.41.0",
      "fix.tools.<name>.command (required): Arguments to run the tool; first argument is its executable path.",
      "fix.tools.<name>.patterns (required): Filesets selecting affected files; an empty list matches no files.",
      "fix.tools.<name>.line-range-arg: Template string passed for each modified range; `$first` and `$last` are 1-based endpoints. Deletion-only empty ranges are skipped.",
      "fix.tools.<name>.run-tool-if-zero-line-ranges: Run the tool when no line ranges were calculated; defaults to `false`. Not mutually exclusive with `line-range-arg`.",
      "--all-lines: Format all lines instead of only modified lines; short form `-a`.",
      "Prerequisite: Configure a fix tool with a command and matching fileset patterns. For line-limited formatting, the formatter must support the configured range argument.",
      "`--all-lines` matches the previous behavior of formatting the entire file when `line-range-arg` is set."
    ]
  },
  "why_it_matters": "Format only modified lines when running `jj fix` on files with configured formatting tools.",
  "before": "Without line-range configuration, the tool processes the entire file; `--all-lines` formats the entire modified file when line ranges are configured.",
  "sources": [
    "https://github.com/jj-vcs/jj/releases/tag/v0.41.0",
    "https://github.com/jj-vcs/jj/blob/v0.41.0/docs/config.md",
    "https://github.com/jj-vcs/jj/blob/v0.41.0/cli/src/commands/fix.rs"
  ],
  "rank": 0.98023,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave1b-tools-20261017",
    "verdict_id": "wave1b-tools-20261017:wave1b-tools-20261017-6da253a5578c1bf6-0:gate",
    "evidence_hash": "e705ee9b9fa834ff6cba11a1155f4cc5e40b2ef96198803e26ccfaf2c23c0650"
  },
  "review": {
    "draft_hash": "a130c89d9728269de63bb1e028ab20c694c2d907a52a5126a9e812b007d432c4",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave1b-tools-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.68 (>= 0.6 needed)."
  }
}
