{
  "slug": "ast-grep-adds-a-parameterized-util-7d4f836e173a",
  "title": "ast-grep adds a parameterized util",
  "tools": [
    "ast-grep"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-03-16T03:29:14.000Z",
  "announced_at": "2026-03-16T03:29:14.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a rule needs a reusable global utility customized for different contexts, define parameters on the utility and pass a rule object for every parameter through the caller’s `matches` rule.",
    "examples": [
      "# utils/audit-log-call.yml\nid: audit-log-call\narguments: [logger-rule]\nlanguage: TypeScript\nrule:\n  pattern: $OBJ.$METHOD($$$ARGS)\n  all:\n    - has:\n        kind: member_expression\n        has:\n          field: object\n          matches: logger-rule\n    - has:\n        field: arguments\n        has:\n          kind: string\n\n# rules/audit-logging.yml\nid: no-console-string\nlanguage: TypeScript\nrule:\n  matches:\n    audit-log-call:\n      logger-rule: { regex: ^console$ }"
    ],
    "gotchas": [
      "Version: 0.42.0",
      "arguments: Utility declaration list of parameter names. Every declared parameter must be supplied at the call site; there are no optional parameters.",
      "<parameter name> (for example, logger-rule) (required): At the call site, provide a full ast-grep rule object as the value; arguments are rules, not strings.",
      "matches (required): In the utility body, a bare parameter name in `matches` refers to the bound rule. At the call site, `matches` names the parameterized global utility and maps each argument name to its rule object.",
      "Prerequisite: Use ast-grep 0.42 parameterized utilities; the release documentation labels this feature experimental.",
      "Prerequisite: Parameters can be declared only by global utility rules in separate YAML files under the `utils/` directory; the utility has `id`, `language`, and `rule`.",
      "Prerequisite: All declared arguments must be supplied. The documentation does not state that parameters are mutually exclusive."
    ]
  },
  "why_it_matters": "Use ast-grep's parameterized util while maintaining or changing repository code.",
  "sources": [
    "https://github.com/ast-grep/ast-grep/releases/tag/0.42.0",
    "https://ast-grep.github.io/blog/new-ver-42"
  ],
  "rank": 0.9403,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3-rejudge+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-d7ee11d41e4dbb13-4:rescue",
    "evidence_hash": "e0cd8b2a50aa122b23f927039a7731eb84a5c021124f86b03c923a6fd84c36f8"
  },
  "review": {
    "draft_hash": "693dae6c7be0b6389d3c383a2b68034eabde8570a4629688bfd3c83882d92666",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:rescue",
    "reason": "Rescue path: first rejected only because the extracted card lacked usage; judged again on the enriched card, 3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.94 >= 0.9; 2 needed) and Jev gave 0.67 (>= 0.6 needed)."
  }
}
