Merge branch 'pr-1619' into integration/validation-batch

This commit is contained in:
Alex Newman
2026-04-06 14:18:28 -07:00
2 changed files with 14 additions and 1 deletions
+1
View File
@@ -138,6 +138,7 @@
"tree-sitter-go": "^0.25.0",
"tree-sitter-java": "^0.23.5",
"tree-sitter-javascript": "^0.25.0",
"tree-sitter-php": "^0.24.2",
"tree-sitter-python": "^0.25.0",
"tree-sitter-ruby": "^0.23.1",
"tree-sitter-rust": "^0.24.0",
+13 -1
View File
@@ -3,7 +3,7 @@
*
* No native bindings. No WASM. Just the CLI binary + query patterns.
*
* Supported: JS, TS, Python, Go, Rust, Ruby, Java, C, C++
* Supported: JS, TS, Python, Go, Rust, Ruby, Java, C, C++, PHP
*
* by Copter Labs
*/
@@ -66,6 +66,7 @@ const LANG_MAP: Record<string, string> = {
".cxx": "cpp",
".hpp": "cpp",
".hh": "cpp",
".php": "php",
};
export function detectLanguage(filePath: string): string {
@@ -86,6 +87,7 @@ const GRAMMAR_PACKAGES: Record<string, string> = {
java: "tree-sitter-java",
c: "tree-sitter-c",
cpp: "tree-sitter-cpp",
php: "tree-sitter-php/php",
};
function resolveGrammarPath(language: string): string | null {
@@ -159,6 +161,15 @@ const QUERIES: Record<string, string> = {
(class_definition name: (identifier) @name) @cls
(import_statement) @imp
(import_declaration) @imp
`,
php: `
(function_definition name: (name) @name) @func
(method_declaration name: (name) @name) @method
(class_declaration name: (name) @name) @cls
(interface_declaration name: (name) @name) @iface
(trait_declaration name: (name) @name) @trait_def
(namespace_use_declaration) @imp
`,
};
@@ -173,6 +184,7 @@ function getQueryKey(language: string): string {
case "rust": return "rust";
case "ruby": return "ruby";
case "java": return "java";
case "php": return "php";
default: return "generic";
}
}