Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
feat: add Scala parser support
Joseph Mikhailfe1704ef6afb
diff --git a/core-ingestion/dist/index.js b/core-ingestion/dist/index.jsindex 9ae8264e..fbd8a4c7 100644--- a/core-ingestion/dist/index.js+++ b/core-ingestion/dist/index.js@@ -23,6 +23,8 @@ import Rust from 'tree-sitter-rust';import Ruby from 'tree-sitter-ruby';// @ts-ignoreimport PHP from 'tree-sitter-php';+// @ts-ignore+import Scala from 'tree-sitter-scala';import { SupportedLanguages, languageFromPath } from './languages.js';import { LANGUAGE_QUERIES } from './queries.js';// ---------------------------------------------------------------------------@@ -40,6 +42,7 @@ const GRAMMAR_MAP = {[SupportedLanguages.Rust]: Rust,[SupportedLanguages.Ruby]: Ruby,[SupportedLanguages.PHP]: PHP.php_only,+ [SupportedLanguages.Scala]: Scala,};// Capture key prefix → NodeKind stringconst DEFINITION_KIND_MAP = {diff --git a/core-ingestion/dist/languages.d.ts b/core-ingestion/dist/languages.d.tsindex 210c5d21..009cf3cd 100644--- a/core-ingestion/dist/languages.d.ts+++ b/core-ingestion/dist/languages.d.ts@@ -11,6 +11,7 @@ export declare enum SupportedLanguages {Rust = "rust",PHP = "php",Kotlin = "kotlin",- Swift = "swift"+ Swift = "swift",+ Scala = "scala"}export declare function languageFromPath(filePath: string): SupportedLanguages | null;diff --git a/core-ingestion/dist/languages.js b/core-ingestion/dist/languages.jsindex 12fcf558..ae45ad26 100644--- a/core-ingestion/dist/languages.js+++ b/core-ingestion/dist/languages.js@@ -13,6 +13,7 @@ export var SupportedLanguages;SupportedLanguages["PHP"] = "php";SupportedLanguages["Kotlin"] = "kotlin";SupportedLanguages["Swift"] = "swift";+ SupportedLanguages["Scala"] = "scala";})(SupportedLanguages || (SupportedLanguages = {}));const EXT_MAP = {'.ts': SupportedLanguages.TypeScript,@@ -37,6 +38,8 @@ const EXT_MAP = {'.kt': SupportedLanguages.Kotlin,'.kts': SupportedLanguages.Kotlin,'.swift': SupportedLanguages.Swift,+ '.scala': SupportedLanguages.Scala,+ '.sc': SupportedLanguages.Scala,};export function languageFromPath(filePath) {const ext = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();diff --git a/core-ingestion/dist/queries.d.ts b/core-ingestion/dist/queries.d.tsindex f8aeb533..b220058f 100644--- a/core-ingestion/dist/queries.d.ts+++ b/core-ingestion/dist/queries.d.ts@@ -12,4 +12,5 @@ export declare const PHP_QUERIES = "\n; \u2500\u2500 Namespace \u2500\u2500\u250export declare const RUBY_QUERIES = "\n; \u2500\u2500 Modules \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(module\n name: (constant) @name) @definition.module\n\n; \u2500\u2500 Classes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class\n name: (constant) @name) @definition.class\n\n; \u2500\u2500 Instance methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Singleton (class-level) methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(singleton_method\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Require / require_relative \u2192 IMPORTS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Capture the string argument so the second pass emits an IMPORTS edge.\n(call\n method: (identifier) @_req\n arguments: (argument_list\n (string (string_content) @import.source))\n (#match? @_req \"^require\")) @import\n\n; \u2500\u2500 All other calls \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call\n method: (identifier) @call.name) @call\n\n; \u2500\u2500 Bare calls without parens (identifiers at statement level are method calls) \u2500\n; NOTE: This may over-capture variable reads as calls (e.g. 'result' at\n; statement level). Ruby's grammar makes bare identifiers ambiguous \u2014 they\n; could be local variables or zero-arity method calls. Post-processing via\n; the BUILTINS set suppresses most false positives.\n(body_statement\n (identifier) @call.name @call)\n\n; \u2500\u2500 Heritage: class < SuperClass \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class\n name: (constant) @heritage.class\n superclass: (superclass\n (constant) @heritage.extends)) @heritage\n";export declare const KOTLIN_QUERIES = "\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; tree-sitter-kotlin (fwcd) has no interface_declaration node type.\n; Interfaces are class_declaration nodes with an anonymous \"interface\" keyword child.\n(class_declaration\n \"interface\"\n (type_identifier) @name) @definition.interface\n\n; \u2500\u2500 Classes (regular, data, sealed, enum) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; All have the anonymous \"class\" keyword child. enum class has both\n; \"enum\" and \"class\" children \u2014 the \"class\" child still matches.\n(class_declaration\n \"class\"\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Object declarations (Kotlin singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_declaration\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Companion objects (named only) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(companion_object\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Functions (top-level, member, extension) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n (simple_identifier) @name) @definition.function\n\n; \u2500\u2500 Properties \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (variable_declaration\n (simple_identifier) @name)) @definition.property\n\n; \u2500\u2500 Enum entries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_entry\n (simple_identifier) @name) @definition.enum\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_alias\n (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_header\n (identifier) @import.source) @import\n\n; \u2500\u2500 Function calls (direct) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Method calls (via navigation: obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (navigation_expression\n (navigation_suffix\n (simple_identifier) @call.name))) @call\n\n; \u2500\u2500 Constructor invocations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(constructor_invocation\n (user_type\n (type_identifier) @call.name)) @call\n\n; \u2500\u2500 Infix function calls (e.g., a to b, x until y) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(infix_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Heritage: extends / implements via delegation_specifier \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Interface implementation (bare user_type): class Foo : Bar\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Class extension (constructor_invocation): class Foo : Bar()\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (constructor_invocation\n (user_type (type_identifier) @heritage.extends)))) @heritage\n";export declare const SWIFT_QUERIES = "\n; Classes\n(class_declaration \"class\" name: (type_identifier) @name) @definition.class\n\n; Structs\n(class_declaration \"struct\" name: (type_identifier) @name) @definition.struct\n\n; Enums\n(class_declaration \"enum\" name: (type_identifier) @name) @definition.enum\n\n; Extensions (mapped to class \u2014 no dedicated label in schema)\n(class_declaration \"extension\" name: (user_type (type_identifier) @name)) @definition.class\n\n; Actors\n(class_declaration \"actor\" name: (type_identifier) @name) @definition.class\n\n; Protocols (mapped to interface)\n(protocol_declaration name: (type_identifier) @name) @definition.interface\n\n; Type aliases\n(typealias_declaration name: (type_identifier) @name) @definition.type\n\n; Functions (top-level and methods)\n(function_declaration name: (simple_identifier) @name) @definition.function\n\n; Protocol method declarations\n(protocol_function_declaration name: (simple_identifier) @name) @definition.method\n\n; Initializers \u2014 \"init\" is the canonical name; line offset tracked via definition node\n(init_declaration \"init\" @name) @definition.constructor\n\n; Properties (stored and computed)\n(property_declaration (pattern (simple_identifier) @name)) @definition.property\n\n; Imports\n(import_declaration (identifier (simple_identifier) @import.source)) @import\n\n; Calls - direct function calls\n(call_expression (simple_identifier) @call.name) @call\n\n; Calls - member/navigation calls (obj.method())\n(call_expression (navigation_expression (navigation_suffix (simple_identifier) @call.name))) @call\n\n; Heritage - class/struct/enum inheritance and protocol conformance\n(class_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - protocol inheritance\n(protocol_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - extension protocol conformance (e.g. extension Foo: SomeProtocol)\n; Extensions wrap the name in user_type unlike class/struct/enum declarations\n(class_declaration \"extension\" name: (user_type (type_identifier) @heritage.class)\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n";+export declare const SCALA_QUERIES = "\n; \u2500\u2500 Classes (class, case class, abstract class, sealed class) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_definition\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Traits (mapped to interface) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(trait_definition\n name: (identifier) @name) @definition.interface\n\n; \u2500\u2500 Object definitions (companion objects, case objects, singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_definition\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Function / method definitions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_definition\n name: (identifier) @name) @definition.function\n\n; \u2500\u2500 Abstract method declarations (in traits / abstract classes) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_definition\n name: (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports: simple path segments (import a.b.C \u2192 captures a, b, C) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_declaration\n (identifier) @import.source) @import\n\n; \u2500\u2500 Imports: selective { X, Y } (import a.b.{C, D}) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_declaration\n (namespace_selectors\n (identifier) @import.source)) @import\n\n; \u2500\u2500 Calls: direct function call \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n function: (identifier) @call.name) @call\n\n; \u2500\u2500 Calls: method call (obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n function: (field_expression\n field: (identifier) @call.name)) @call\n\n; \u2500\u2500 Constructor: new Foo() \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(instance_expression\n (type_identifier) @call.name) @call\n\n; \u2500\u2500 Heritage: class / object extends and with \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n\n(trait_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n\n(object_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n";export declare const LANGUAGE_QUERIES: Record<SupportedLanguages, string>;diff --git a/core-ingestion/dist/queries.js b/core-ingestion/dist/queries.jsindex 679b0cb7..88a48de9 100644--- a/core-ingestion/dist/queries.js+++ b/core-ingestion/dist/queries.js@@ -686,6 +686,70 @@ export const SWIFT_QUERIES = `(class_declaration "extension" name: (user_type (type_identifier) @heritage.class)(inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage`;+// Scala queries - works with tree-sitter-scala+export const SCALA_QUERIES = `+; ── Classes (class, case class, abstract class, sealed class) ────────────────+(class_definition+ name: (identifier) @name) @definition.class++; ── Traits (mapped to interface) ─────────────────────────────────────────────+(trait_definition+ name: (identifier) @name) @definition.interface++; ── Object definitions (companion objects, case objects, singletons) ─────────+(object_definition+ name: (identifier) @name) @definition.class++; ── Function / method definitions ────────────────────────────────────────────+(function_definition+ name: (identifier) @name) @definition.function++; ── Abstract method declarations (in traits / abstract classes) ──────────────+(function_declaration+ name: (identifier) @name) @definition.method++; ── Type aliases ──────────────────────────────────────────────────────────────+(type_definition+ name: (type_identifier) @name) @definition.type++; ── Imports: simple path segments (import a.b.C → captures a, b, C) ─────────+(import_declaration+ (identifier) @import.source) @import++; ── Imports: selective { X, Y } (import a.b.{C, D}) ─────────────────────────+(import_declaration+ (namespace_selectors+ (identifier) @import.source)) @import++; ── Calls: direct function call ──────────────────────────────────────────────+(call_expression+ function: (identifier) @call.name) @call++; ── Calls: method call (obj.method()) ────────────────────────────────────────+(call_expression+ function: (field_expression+ field: (identifier) @call.name)) @call++; ── Constructor: new Foo() ────────────────────────────────────────────────────+(instance_expression+ (type_identifier) @call.name) @call++; ── Heritage: class / object extends and with ────────────────────────────────+(class_definition+ name: (identifier) @heritage.class+ extend: (extends_clause+ (type_identifier) @heritage.extends)) @heritage++(trait_definition+ name: (identifier) @heritage.class+ extend: (extends_clause+ (type_identifier) @heritage.extends)) @heritage++(object_definition+ name: (identifier) @heritage.class+ extend: (extends_clause+ (type_identifier) @heritage.extends)) @heritage+`;export const LANGUAGE_QUERIES = {[SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,[SupportedLanguages.JavaScript]: JAVASCRIPT_QUERIES,@@ -700,4 +764,5 @@ export const LANGUAGE_QUERIES = {[SupportedLanguages.PHP]: PHP_QUERIES,[SupportedLanguages.Kotlin]: KOTLIN_QUERIES,[SupportedLanguages.Swift]: SWIFT_QUERIES,+ [SupportedLanguages.Scala]: SCALA_QUERIES,};diff --git a/core-ingestion/package-lock.json b/core-ingestion/package-lock.jsonindex 264e1981..e74ce252 100644--- a/core-ingestion/package-lock.json+++ b/core-ingestion/package-lock.json@@ -19,6 +19,7 @@"tree-sitter-python": "^0.21.0","tree-sitter-ruby": "^0.23.1","tree-sitter-rust": "^0.21.0",+ "tree-sitter-scala": "^0.24.0","tree-sitter-typescript": "^0.21.0"},"devDependencies": {@@ -270,6 +271,25 @@"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==","license": "MIT"},+ "node_modules/tree-sitter-scala": {+ "version": "0.24.0",+ "resolved": "https://registry.npmjs.org/tree-sitter-scala/-/tree-sitter-scala-0.24.0.tgz",+ "integrity": "sha512-vkMuAUrBZ1zZz2XcGDQk18Kz73JkpgaeXzbNVobPke0G35sd9jH32aUxG6OLRKM7et0TbsfqkWf4DeJoGk4K1g==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.2.2",+ "node-gyp-build": "^4.8.2"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.1"+ },+ "peerDependenciesMeta": {+ "tree-sitter": {+ "optional": true+ }+ }+ },"node_modules/tree-sitter-typescript": {"version": "0.21.2","resolved": "https://registry.npmjs.org/tree-sitter-typescript/-/tree-sitter-typescript-0.21.2.tgz",diff --git a/core-ingestion/package.json b/core-ingestion/package.jsonindex 0befc1f6..c04c8e47 100644--- a/core-ingestion/package.json+++ b/core-ingestion/package.json@@ -26,6 +26,7 @@"tree-sitter-python": "^0.21.0","tree-sitter-ruby": "^0.23.1","tree-sitter-rust": "^0.21.0",+ "tree-sitter-scala": "^0.24.0","tree-sitter-typescript": "^0.21.0"},"devDependencies": {diff --git a/core-ingestion/src/index.ts b/core-ingestion/src/index.tsindex 1ad07335..7206a549 100644--- a/core-ingestion/src/index.ts+++ b/core-ingestion/src/index.ts@@ -23,6 +23,8 @@ import Rust from 'tree-sitter-rust';import Ruby from 'tree-sitter-ruby';// @ts-ignoreimport PHP from 'tree-sitter-php';+// @ts-ignore+import Scala from 'tree-sitter-scala';import { SupportedLanguages, languageFromPath } from './languages.js';import { LANGUAGE_QUERIES } from './queries.js';@@ -70,6 +72,7 @@ const GRAMMAR_MAP: Partial<Record<SupportedLanguages, any>> = {[SupportedLanguages.Rust]: Rust,[SupportedLanguages.Ruby]: Ruby,[SupportedLanguages.PHP]: PHP.php_only,+ [SupportedLanguages.Scala]: Scala,};// Capture key prefix → NodeKind stringdiff --git a/core-ingestion/src/languages.ts b/core-ingestion/src/languages.tsindex f8d76c14..48b81165 100644--- a/core-ingestion/src/languages.ts+++ b/core-ingestion/src/languages.ts@@ -12,6 +12,7 @@ export enum SupportedLanguages {PHP = 'php',Kotlin = 'kotlin',Swift = 'swift',+ Scala = 'scala',}const EXT_MAP: Record<string, SupportedLanguages> = {@@ -37,6 +38,8 @@ const EXT_MAP: Record<string, SupportedLanguages> = {'.kt': SupportedLanguages.Kotlin,'.kts': SupportedLanguages.Kotlin,'.swift':SupportedLanguages.Swift,+ '.scala':SupportedLanguages.Scala,+ '.sc': SupportedLanguages.Scala,};export function languageFromPath(filePath: string): SupportedLanguages | null {diff --git a/core-ingestion/src/queries.ts b/core-ingestion/src/queries.tsindex 6c9edd97..af4b73ee 100644--- a/core-ingestion/src/queries.ts+++ b/core-ingestion/src/queries.ts@@ -701,6 +701,71 @@ export const SWIFT_QUERIES = `(inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage`;+// Scala queries - works with tree-sitter-scala+export const SCALA_QUERIES = `+; ── Classes (class, case class, abstract class, sealed class) ────────────────+(class_definition+ name: (identifier) @name) @definition.class++; ── Traits (mapped to interface) ─────────────────────────────────────────────+(trait_definition+ name: (identifier) @name) @definition.interface++; ── Object definitions (companion objects, case objects, singletons) ─────────+(object_definition+ name: (identifier) @name) @definition.class++; ── Function / method definitions ────────────────────────────────────────────+(function_definition+ name: (identifier) @name) @definition.function++; ── Abstract method declarations (in traits / abstract classes) ──────────────+(function_declaration+ name: (identifier) @name) @definition.method++; ── Type aliases ──────────────────────────────────────────────────────────────+(type_definition+ name: (type_identifier) @name) @definition.type++; ── Imports: simple path segments (import a.b.C → captures a, b, C) ─────────+(import_declaration+ (identifier) @import.source) @import++; ── Imports: selective { X, Y } (import a.b.{C, D}) ─────────────────────────+(import_declaration+ (namespace_selectors+ (identifier) @import.source)) @import++; ── Calls: direct function call ──────────────────────────────────────────────+(call_expression+ function: (identifier) @call.name) @call++; ── Calls: method call (obj.method()) ────────────────────────────────────────+(call_expression+ function: (field_expression+ field: (identifier) @call.name)) @call++; ── Constructor: new Foo() ────────────────────────────────────────────────────+(instance_expression+ (type_identifier) @call.name) @call++; ── Heritage: class / object extends and with ────────────────────────────────+(class_definition+ name: (identifier) @heritage.class+ extend: (extends_clause+ (type_identifier) @heritage.extends)) @heritage++(trait_definition+ name: (identifier) @heritage.class+ extend: (extends_clause+ (type_identifier) @heritage.extends)) @heritage++(object_definition+ name: (identifier) @heritage.class+ extend: (extends_clause+ (type_identifier) @heritage.extends)) @heritage+`;+export const LANGUAGE_QUERIES: Record<SupportedLanguages, string> = {[SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,[SupportedLanguages.JavaScript]: JAVASCRIPT_QUERIES,@@ -715,5 +780,6 @@ export const LANGUAGE_QUERIES: Record<SupportedLanguages, string> = {[SupportedLanguages.PHP]: PHP_QUERIES,[SupportedLanguages.Kotlin]: KOTLIN_QUERIES,[SupportedLanguages.Swift]: SWIFT_QUERIES,+ [SupportedLanguages.Scala]: SCALA_QUERIES,};