Skip to content

Commit 00aaac3

Browse files
committed
mcp: prefer ast-grep binary over deprecated sg alias
Newer @ast-grep/cli deprecated the `sg` alias and prints a "WARNING: `sg` is deprecated" banner into the captured --json output, which corrupts the parse in cpp_grep_usage / cpp_find_symbol / cpp_outline (the 21 'Failed to parse ast-grep output: invalid character =' failures in run_utils_tests). Prefer the canonical `ast-grep` binary (ships in the same package, emits clean JSON); keep `sg` as a fallback for older installs. Repo-wide CI issue, present on master too (extended checks #3550).
1 parent 559875e commit 00aaac3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

utils/mcp/tools/grep_usage.das

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def detect_ast_grep() : string {
3030
// (`npm install -g @ast-grep/cli`) the global PATH only gets `sg.cmd`, so
3131
// CreateProcess(NULL, "sg ...") fails — fall through to the explicit
3232
// `.cmd` / `.exe` / `.bat` candidates so the shim is picked up.
33-
let candidates = ["sg", "sg.exe", "sg.cmd", "sg.bat"]
33+
let candidates = ["ast-grep", "ast-grep.cmd", "sg", "sg.exe", "sg.cmd", "sg.bat"]
3434
for (c in candidates) {
3535
if (try_ast_grep(c)) return c
3636
}

0 commit comments

Comments
 (0)