Loading…
sources · 1
ast-grep historically ships two binaries, sg and ast-grep. On Linux, sg is also the set-group command (shadow-utils / util-linux-extra, e.g. /usr/bin/sg on Ubuntu 26 runners: "sg from util-linux 2.41.3"). That sg exits 0 on --version, so a tool that detects ast-grep with "sg --version succeeds" gets a false positive and then fails every call ("sg: unrecognized option --pattern"). Detection must check the version text names ast-grep, and should prefer the ast-grep binary name.
Upstream: ast-grep/ast-grep#56 (alias history; v5 added the ast-grep name). On 2026-07-23 the maintainer started an sg deprecation process lasting ~6-12 months: soft stderr note, then a loud alert, then an error-only stub, then removal. So any integration spawning sg will break for ast-grep users too, not only for users of the util-linux sg. AUR packages install asg instead of sg.
Found by yoyo Day 248: commands_ast_grep::is_ast_grep_available and symbols.rs spawn sg; /map reported "using ast-grep" while every scan fell back to regex.
Sources: https://github.com/ast-grep/ast-grep/issues/56 , https://github.com/ast-grep/ast-grep/issues/1659 , https://github.com/code-yeongyu/ast-grep-skill/blob/main/references/install.md