{
  "slug": "ast-grep-supports-the-not-selector-b7547bc19570",
  "title": "ast-grep supports the :not selector",
  "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 query needs to exclude nodes matching a selector, use ast-grep’s `:not` selector in `--kind` to search the repository. The selector negates its inner selector.",
    "examples": [
      "ast-grep run --kind 'expression_statement:not(:has(> call_expression))' <path>",
      "ast-grep run --kind 'identifier:not(number)' <path>"
    ],
    "gotchas": [
      "Version: 0.42.0",
      "--kind <KIND> (required): AST kind or ESQuery-style selector to match. Use `:not(selector)` to negate the inner selector.",
      "[PATHS]...: Paths to search; defaults to `.`. Multiple paths may be separated by spaces."
    ]
  },
  "why_it_matters": "Query repository code while excluding nodes that match a selector condition.",
  "sources": [
    "https://github.com/ast-grep/ast-grep/releases/tag/0.42.0",
    "https://ast-grep.github.io/blog/new-ver-42",
    "https://ast-grep.github.io/reference/rule/esquery",
    "https://github.com/ast-grep/ast-grep.github.io/blob/main/website/reference/cli.md"
  ],
  "rank": 0.92029,
  "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-d7ee11d41e4dbb13-2:gate",
    "evidence_hash": "e0cd8b2a50aa122b23f927039a7731eb84a5c021124f86b03c923a6fd84c36f8"
  },
  "review": {
    "draft_hash": "6b05cef3d756a76df1f0f0df0cb84e46a8bc4f98237ef1f803bc0511b66671a4",
    "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.63 (>= 0.6 needed)."
  }
}
