#2840·ast-grep

[feature] discover `sgconfig.yml` in `.config`

Author: xzfcCreated Jul 22, 2026Updated Jul 23, 2026
Labelsenhancement

⭐ Suggestion

Currently, ast-grep looks for its config in …/sgconfig.yml. (and .yaml, but that's not the point)

I propose to also look in …/.config/ast-grep/sgconfig.yml. (or any other path as long it let us to put it in <repo-root>/.config/)

Use Cases

Declutter repo root. When each tool wants its config to be placed directly in the repo root, it becomes noisy.

See the config-dir proposal and its support tracker.

Right now, it is possible to specify the path explicitly (e.g. ast-grep scan --config .config/ast-grep/sgconfig.yml), but having it out-of-the box would be more convenient/discoverable.