{
  "slug": "yq-parent-negative-indices-and-root-command-f78972ae9deb",
  "title": "yq parent negative indices and root command",
  "tools": [
    "yq"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-01-31T04:21:30.000Z",
  "announced_at": "2026-01-31T04:21:30.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a query needs an ancestor, use `parent` with a negative index; use `root` to reference the top-level document. The official docs found do not show runnable syntax for negative `parent` indices or the `root` command.",
    "examples": [
      "yq '.a.b.c | parent(2)' <file>"
    ],
    "gotchas": [
      "Version: v4.52.1",
      "parent(n): Returns the parent node; `n` is the number of levels to go up and defaults to 1. Negative values are not documented on this page."
    ]
  },
  "why_it_matters": "Reference the top-level document or a parent element while querying structured repository data.",
  "sources": [
    "https://github.com/mikefarah/yq/releases/tag/v4.52.1",
    "https://mikefarah.gitbook.io/yq/operators/parent"
  ],
  "rank": 0.92026,
  "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": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-c0bbd115e4ce8dce-1:gate",
    "evidence_hash": "a2ee1f53297f6d19038cde935d4b9b3b4c57a6c03f6e872f1ac7679eb1ac96da"
  },
  "review": {
    "draft_hash": "1529ec6fb70b5a9dd49c04d61f94cdebe3554749d97049d67bbd5c7d1c513cc1",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:gate",
    "reason": "2 of 3 judge runs approved with p_yes >= 0.9 (mean 0.92 >= 0.9; 2 needed) and Jev gave 0.65 (>= 0.6 needed)."
  }
}
