{
  "slug": "wrangler-pages-dev-injects-pages-environment-variables-3e223a67db5d",
  "title": "wrangler pages dev injects Pages environment variables",
  "tools": [
    "wrangler"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-02-12T13:35:21.000Z",
  "announced_at": "2026-02-12T13:35:21.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When running a Pages project locally, use `wrangler pages dev` and check the startup bindings table to verify the Pages environment, branch, and commit values.",
    "examples": [
      "npx wrangler pages dev [<DIRECTORY>]",
      "npx wrangler pages dev --binding=CF_PAGES_BRANCH=<branch>"
    ],
    "gotchas": [
      "Version: 4.65.0",
      "[DIRECTORY]: Directory of static assets to serve.",
      "--binding=<KEY>=<VALUE>: Binds a variable or secret; use the Pages variable name and desired value to override it.",
      "CF_PAGES: Injected as `1` to indicate the Pages environment.",
      "CF_PAGES_BRANCH: Injected from the current Git branch, or `local` when Git branch detection is unavailable.",
      "CF_PAGES_COMMIT_SHA: Injected from the current Git commit SHA, or a zero SHA placeholder when Git commit detection is unavailable.",
      "CF_PAGES_URL: Injected as `https://<short-sha>.<project-name>.pages.dev`.",
      "`CF_PAGES_BRANCH` defaults to the current git branch, or `\"local\"` when not in a git repository.",
      "`CF_PAGES_COMMIT_SHA` defaults to the current git commit SHA, or a placeholder when not in a git repository.",
      "`CF_PAGES_URL` is a simulated commit preview URL."
    ]
  },
  "why_it_matters": "Run a Pages project locally and verify that its framework detects the Pages environment and current branch or commit.",
  "sources": [
    "https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.65.0",
    "https://developers.cloudflare.com/workers/wrangler/commands/pages/",
    "https://developers.cloudflare.com/pages/functions/bindings/",
    "https://github.com/cloudflare/workers-sdk/blob/b900c5adc18c12d500e0fb8c58c2295843518695/packages/wrangler/src/pages/dev.ts"
  ],
  "rank": 0.97041,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "backfill-20261007",
    "verdict_id": "backfill-20261007:backfill-20261007-2325e431f58c8b59-0:gate",
    "evidence_hash": "247b178f40e6e3fa51e2557f04897397512ecaad40dd0962358008cd049bd67b"
  },
  "review": {
    "draft_hash": "dbb7841ebc63bfd0c41232c1102cd13a7b9dbece57ce5142ac9d2f793507cee5",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "backfill-20261007:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.97 >= 0.9; 2 needed) and Jev gave 0.71 (>= 0.6 needed)."
  }
}
