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(core-ingestion): Elixir parser via tree-sitter-elixir (#220)
NKlein77d518a8ad874a
diff --git a/core-ingestion/package-lock.json b/core-ingestion/package-lock.jsonindex 8d1c71d7..5b6935c3 100644--- a/core-ingestion/package-lock.json+++ b/core-ingestion/package-lock.json@@ -31,6 +31,7 @@"vitest": "^4.1.0"},"optionalDependencies": {+ "tree-sitter-elixir": "^0.3.5","tree-sitter-kotlin": "^0.3.8","tree-sitter-make": "^1.1.1","tree-sitter-swift": "^0.6.0"@@ -1243,6 +1244,28 @@}}},+ "node_modules/tree-sitter-elixir": {+ "version": "0.3.5",+ "resolved": "https://registry.npmjs.org/tree-sitter-elixir/-/tree-sitter-elixir-0.3.5.tgz",+ "integrity": "sha512-xozQMvYK0aSolcQZAx2d84Xe/YMWFuRPYFlLVxO01bM2GITh5jyiIp0TqPCQa8754UzRAI7A83hZmfiYub5TZQ==",+ "hasInstallScript": true,+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "node-addon-api": "^7.1.0",+ "node-gyp-build": "^4.8.0"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.0"+ }+ },+ "node_modules/tree-sitter-elixir/node_modules/node-addon-api": {+ "version": "7.1.1",+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",+ "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",+ "license": "MIT",+ "optional": true+ },"node_modules/tree-sitter-go": {"version": "0.21.2","resolved": "https://registry.npmjs.org/tree-sitter-go/-/tree-sitter-go-0.21.2.tgz",diff --git a/core-ingestion/package.json b/core-ingestion/package.jsonindex 52d2c7de..56be4a7d 100644--- a/core-ingestion/package.json+++ b/core-ingestion/package.json@@ -34,6 +34,7 @@"optionalDependencies": {"tree-sitter-kotlin": "^0.3.8","tree-sitter-swift": "^0.6.0",+ "tree-sitter-elixir": "^0.3.5","tree-sitter-make": "^1.1.1"},"devDependencies": {diff --git a/core-ingestion/src/__tests__/__snapshots__/parseFile.test.ts.snap b/core-ingestion/src/__tests__/__snapshots__/parseFile.test.ts.snapindex 8187c2de..7219ffe8 100644--- a/core-ingestion/src/__tests__/__snapshots__/parseFile.test.ts.snap+++ b/core-ingestion/src/__tests__/__snapshots__/parseFile.test.ts.snap@@ -1,1857 +1,5 @@// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html-exports[`parseFile snapshots > snapshots Identifiers.scala 1`] = `-{- "chunks": [- {- "chunkKind": "class",- "container": undefined,- "contentHash": "93b03910ef938562",- "endByte": 135,- "language": "scala",- "lineEnd": 7,- "lineStart": 7,- "name": "NodeId",- "startByte": 84,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "367d1dcecdc55b4f",- "endByte": 299,- "language": "scala",- "lineEnd": 11,- "lineStart": 8,- "name": "NodeId",- "startByte": 136,- },- {- "chunkKind": "function",- "container": "NodeId",- "contentHash": "651bc99aed4de8b2",- "endByte": 226,- "language": "scala",- "lineEnd": 9,- "lineStart": 9,- "name": "encoder",- "startByte": 154,- },- {- "chunkKind": "function",- "container": "NodeId",- "contentHash": "3fb1fdd553d01200",- "endByte": 297,- "language": "scala",- "lineEnd": 10,- "lineStart": 10,- "name": "decoder",- "startByte": 229,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "2b6c54c1c4c30580",- "endByte": 352,- "language": "scala",- "lineEnd": 13,- "lineStart": 13,- "name": "EdgeId",- "startByte": 301,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "f9f1c6b8418c30d1",- "endByte": 516,- "language": "scala",- "lineEnd": 17,- "lineStart": 14,- "name": "EdgeId",- "startByte": 353,- },- {- "chunkKind": "function",- "container": "EdgeId",- "contentHash": "5fed49c0d68e8331",- "endByte": 443,- "language": "scala",- "lineEnd": 15,- "lineStart": 15,- "name": "encoder",- "startByte": 371,- },- {- "chunkKind": "function",- "container": "EdgeId",- "contentHash": "474b1dabed027cce",- "endByte": 514,- "language": "scala",- "lineEnd": 16,- "lineStart": 16,- "name": "decoder",- "startByte": 446,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "57a567f9f976b17d",- "endByte": 570,- "language": "scala",- "lineEnd": 19,- "lineStart": 19,- "name": "PatchId",- "startByte": 518,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "7a73c31b3eed31da",- "endByte": 738,- "language": "scala",- "lineEnd": 23,- "lineStart": 20,- "name": "PatchId",- "startByte": 571,- },- {- "chunkKind": "function",- "container": "PatchId",- "contentHash": "8c770dd37c949073",- "endByte": 663,- "language": "scala",- "lineEnd": 21,- "lineStart": 21,- "name": "encoder",- "startByte": 590,- },- {- "chunkKind": "function",- "container": "PatchId",- "contentHash": "20bb8d635f58176a",- "endByte": 736,- "language": "scala",- "lineEnd": 22,- "lineStart": 22,- "name": "decoder",- "startByte": 666,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "d68c470ad1b11435",- "endByte": 792,- "language": "scala",- "lineEnd": 25,- "lineStart": 25,- "name": "ClaimId",- "startByte": 740,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "85a61be88d64bf63",- "endByte": 960,- "language": "scala",- "lineEnd": 29,- "lineStart": 26,- "name": "ClaimId",- "startByte": 793,- },- {- "chunkKind": "function",- "container": "ClaimId",- "contentHash": "4db1372b9a8944e3",- "endByte": 885,- "language": "scala",- "lineEnd": 27,- "lineStart": 27,- "name": "encoder",- "startByte": 812,- },- {- "chunkKind": "function",- "container": "ClaimId",- "contentHash": "8d8ddbe595d64c23",- "endByte": 958,- "language": "scala",- "lineEnd": 28,- "lineStart": 28,- "name": "decoder",- "startByte": 888,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "5712a45ef1b12b31",- "endByte": 1017,- "language": "scala",- "lineEnd": 31,- "lineStart": 31,- "name": "ConflictId",- "startByte": 962,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "e9affa9a7356afa3",- "endByte": 1197,- "language": "scala",- "lineEnd": 35,- "lineStart": 32,- "name": "ConflictId",- "startByte": 1018,- },- {- "chunkKind": "function",- "container": "ConflictId",- "contentHash": "c80e4f0c73ea6d1d",- "endByte": 1116,- "language": "scala",- "lineEnd": 33,- "lineStart": 33,- "name": "encoder",- "startByte": 1040,- },- {- "chunkKind": "function",- "container": "ConflictId",- "contentHash": "ef72658fa91ff811",- "endByte": 1195,- "language": "scala",- "lineEnd": 34,- "lineStart": 34,- "name": "decoder",- "startByte": 1119,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "9621ad4828529d2a",- "endByte": 1247,- "language": "scala",- "lineEnd": 37,- "lineStart": 37,- "name": "Rev",- "startByte": 1199,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "27996787914bcd1d",- "endByte": 1399,- "language": "scala",- "lineEnd": 41,- "lineStart": 38,- "name": "Rev",- "startByte": 1248,- },- {- "chunkKind": "function",- "container": "Rev",- "contentHash": "92ad4d9a4dca16f0",- "endByte": 1332,- "language": "scala",- "lineEnd": 39,- "lineStart": 39,- "name": "encoder",- "startByte": 1263,- },- {- "chunkKind": "function",- "container": "Rev",- "contentHash": "20c75169352560a4",- "endByte": 1397,- "language": "scala",- "lineEnd": 40,- "lineStart": 40,- "name": "decoder",- "startByte": 1335,- },- ],- "entities": [- {- "kind": "file",- "language": "scala",- "lineEnd": 42,- "lineStart": 1,- "name": "Identifiers.scala",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 7,- "lineStart": 7,- "name": "NodeId",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 11,- "lineStart": 8,- "name": "NodeId",- },- {- "container": "NodeId",- "kind": "function",- "language": "scala",- "lineEnd": 9,- "lineStart": 9,- "name": "encoder",- },- {- "container": "NodeId",- "kind": "function",- "language": "scala",- "lineEnd": 10,- "lineStart": 10,- "name": "decoder",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 13,- "lineStart": 13,- "name": "EdgeId",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 17,- "lineStart": 14,- "name": "EdgeId",- },- {- "container": "EdgeId",- "kind": "function",- "language": "scala",- "lineEnd": 15,- "lineStart": 15,- "name": "encoder",- },- {- "container": "EdgeId",- "kind": "function",- "language": "scala",- "lineEnd": 16,- "lineStart": 16,- "name": "decoder",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 19,- "lineStart": 19,- "name": "PatchId",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 23,- "lineStart": 20,- "name": "PatchId",- },- {- "container": "PatchId",- "kind": "function",- "language": "scala",- "lineEnd": 21,- "lineStart": 21,- "name": "encoder",- },- {- "container": "PatchId",- "kind": "function",- "language": "scala",- "lineEnd": 22,- "lineStart": 22,- "name": "decoder",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 25,- "lineStart": 25,- "name": "ClaimId",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 29,- "lineStart": 26,- "name": "ClaimId",- },- {- "container": "ClaimId",- "kind": "function",- "language": "scala",- "lineEnd": 27,- "lineStart": 27,- "name": "encoder",- },- {- "container": "ClaimId",- "kind": "function",- "language": "scala",- "lineEnd": 28,- "lineStart": 28,- "name": "decoder",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 31,- "lineStart": 31,- "name": "ConflictId",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 35,- "lineStart": 32,- "name": "ConflictId",- },- {- "container": "ConflictId",- "kind": "function",- "language": "scala",- "lineEnd": 33,- "lineStart": 33,- "name": "encoder",- },- {- "container": "ConflictId",- "kind": "function",- "language": "scala",- "lineEnd": 34,- "lineStart": 34,- "name": "decoder",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 37,- "lineStart": 37,- "name": "Rev",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 41,- "lineStart": 38,- "name": "Rev",- },- {- "container": "Rev",- "kind": "function",- "language": "scala",- "lineEnd": 39,- "lineStart": 39,- "name": "encoder",- },- {- "container": "Rev",- "kind": "function",- "language": "scala",- "lineEnd": 40,- "lineStart": 40,- "name": "decoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 3,- "lineStart": 3,- "name": "java.util.UUID",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 5,- "lineStart": 5,- "name": "io.circe.Decoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 5,- "lineStart": 5,- "name": "io.circe.Encoder",- },- ],- "filePath": "memory-layer/src/main/scala/ix/memory/model/Identifiers.scala",- "fileRole": {- "role": "production",- "role_confidence": 0.5,- "role_signals": [],- },- "language": "scala",- "relationships": [- {- "dstName": "NodeId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "AnyVal",- "predicate": "EXTENDS",- "srcName": "NodeId",- },- {- "dstName": "NodeId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "NodeId",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "NodeId",- },- {- "dstName": "EdgeId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "AnyVal",- "predicate": "EXTENDS",- "srcName": "EdgeId",- },- {- "dstName": "EdgeId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "EdgeId",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "EdgeId",- },- {- "dstName": "PatchId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "AnyVal",- "predicate": "EXTENDS",- "srcName": "PatchId",- },- {- "dstName": "PatchId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "PatchId",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "PatchId",- },- {- "dstName": "ClaimId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "AnyVal",- "predicate": "EXTENDS",- "srcName": "ClaimId",- },- {- "dstName": "ClaimId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "ClaimId",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "ClaimId",- },- {- "dstName": "ConflictId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "AnyVal",- "predicate": "EXTENDS",- "srcName": "ConflictId",- },- {- "dstName": "ConflictId",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "ConflictId",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "ConflictId",- },- {- "dstName": "Rev",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "AnyVal",- "predicate": "EXTENDS",- "srcName": "Rev",- },- {- "dstName": "Rev",- "predicate": "CONTAINS",- "srcName": "Identifiers.scala",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "Rev",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "Rev",- },- {- "dstName": "java.util.UUID",- "predicate": "IMPORTS",- "srcName": "Identifiers.scala",- },- {- "dstName": "io.circe.Decoder",- "predicate": "IMPORTS",- "srcName": "Identifiers.scala",- },- {- "dstName": "io.circe.Encoder",- "predicate": "IMPORTS",- "srcName": "Identifiers.scala",- },- {- "dstName": "UUID",- "predicate": "REFERENCES",- "srcName": "NodeId",- },- {- "dstName": "NodeId",- "predicate": "REFERENCES",- "srcName": "Identifiers.scala",- },- {- "dstName": "contramap",- "predicate": "CALLS",- "srcName": "NodeId.encoder",- },- {- "dstName": "map",- "predicate": "CALLS",- "srcName": "NodeId.decoder",- },- {- "dstName": "NodeId",- "predicate": "CALLS",- "srcName": "NodeId.decoder",- },- {- "dstName": "UUID",- "predicate": "REFERENCES",- "srcName": "EdgeId",- },- {- "dstName": "EdgeId",- "predicate": "REFERENCES",- "srcName": "Identifiers.scala",- },- {- "dstName": "contramap",- "predicate": "CALLS",- "srcName": "EdgeId.encoder",- },- {- "dstName": "map",- "predicate": "CALLS",- "srcName": "EdgeId.decoder",- },- {- "dstName": "EdgeId",- "predicate": "CALLS",- "srcName": "EdgeId.decoder",- },- {- "dstName": "UUID",- "predicate": "REFERENCES",- "srcName": "PatchId",- },- {- "dstName": "PatchId",- "predicate": "REFERENCES",- "srcName": "Identifiers.scala",- },- {- "dstName": "contramap",- "predicate": "CALLS",- "srcName": "PatchId.encoder",- },- {- "dstName": "map",- "predicate": "CALLS",- "srcName": "PatchId.decoder",- },- {- "dstName": "PatchId",- "predicate": "CALLS",- "srcName": "PatchId.decoder",- },- {- "dstName": "UUID",- "predicate": "REFERENCES",- "srcName": "ClaimId",- },- {- "dstName": "ClaimId",- "predicate": "REFERENCES",- "srcName": "Identifiers.scala",- },- {- "dstName": "contramap",- "predicate": "CALLS",- "srcName": "ClaimId.encoder",- },- {- "dstName": "map",- "predicate": "CALLS",- "srcName": "ClaimId.decoder",- },- {- "dstName": "ClaimId",- "predicate": "CALLS",- "srcName": "ClaimId.decoder",- },- {- "dstName": "UUID",- "predicate": "REFERENCES",- "srcName": "ConflictId",- },- {- "dstName": "ConflictId",- "predicate": "REFERENCES",- "srcName": "Identifiers.scala",- },- {- "dstName": "contramap",- "predicate": "CALLS",- "srcName": "ConflictId.encoder",- },- {- "dstName": "map",- "predicate": "CALLS",- "srcName": "ConflictId.decoder",- },- {- "dstName": "ConflictId",- "predicate": "CALLS",- "srcName": "ConflictId.decoder",- },- {- "dstName": "Rev",- "predicate": "REFERENCES",- "srcName": "Identifiers.scala",- },- {- "dstName": "contramap",- "predicate": "CALLS",- "srcName": "Rev.encoder",- },- {- "dstName": "map",- "predicate": "CALLS",- "srcName": "Rev.decoder",- },- {- "dstName": "Rev",- "predicate": "CALLS",- "srcName": "Rev.decoder",- },- ],-}-`;--exports[`parseFile snapshots > snapshots Node.scala 1`] = `-{- "chunks": [- {- "chunkKind": "interface",- "container": undefined,- "contentHash": "2c3602b7735b0980",- "endByte": 178,- "language": "scala",- "lineEnd": 8,- "lineStart": 8,- "name": "NodeKind",- "startByte": 157,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "30951d9e6d654371",- "endByte": 2795,- "language": "scala",- "lineEnd": 86,- "lineStart": 9,- "name": "NodeKind",- "startByte": 179,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "ce581acd57c5e51f",- "endByte": 239,- "language": "scala",- "lineEnd": 10,- "lineStart": 10,- "name": "Module",- "startByte": 199,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "3894e0f29e12a950",- "endByte": 282,- "language": "scala",- "lineEnd": 11,- "lineStart": 11,- "name": "File",- "startByte": 242,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "4dcb85c557b0aedd",- "endByte": 325,- "language": "scala",- "lineEnd": 12,- "lineStart": 12,- "name": "Class",- "startByte": 285,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "03a112c9600de2f0",- "endByte": 368,- "language": "scala",- "lineEnd": 13,- "lineStart": 13,- "name": "Function",- "startByte": 328,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "1fdadba11c42a39b",- "endByte": 411,- "language": "scala",- "lineEnd": 14,- "lineStart": 14,- "name": "Variable",- "startByte": 371,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "5f274fd3f508d85b",- "endByte": 454,- "language": "scala",- "lineEnd": 15,- "lineStart": 15,- "name": "Config",- "startByte": 414,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "af4c6b74ee8dfdec",- "endByte": 497,- "language": "scala",- "lineEnd": 16,- "lineStart": 16,- "name": "ConfigEntry",- "startByte": 457,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "7ad9b2042370126a",- "endByte": 540,- "language": "scala",- "lineEnd": 17,- "lineStart": 17,- "name": "Service",- "startByte": 500,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "3243234db79f279f",- "endByte": 583,- "language": "scala",- "lineEnd": 18,- "lineStart": 18,- "name": "Endpoint",- "startByte": 543,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "fe900f1a33179972",- "endByte": 626,- "language": "scala",- "lineEnd": 19,- "lineStart": 19,- "name": "Intent",- "startByte": 586,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "cabcf7bc0b832502",- "endByte": 669,- "language": "scala",- "lineEnd": 20,- "lineStart": 20,- "name": "Decision",- "startByte": 629,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "692a1d329f150cb6",- "endByte": 712,- "language": "scala",- "lineEnd": 21,- "lineStart": 21,- "name": "Doc",- "startByte": 672,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "b489d197b9c326f5",- "endByte": 755,- "language": "scala",- "lineEnd": 22,- "lineStart": 22,- "name": "Object",- "startByte": 715,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "93680e321b988261",- "endByte": 799,- "language": "scala",- "lineEnd": 23,- "lineStart": 23,- "name": "Trait",- "startByte": 758,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "83534a6ebc0a194d",- "endByte": 842,- "language": "scala",- "lineEnd": 24,- "lineStart": 24,- "name": "Interface",- "startByte": 802,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "fcbb1b54fb1ed49c",- "endByte": 885,- "language": "scala",- "lineEnd": 25,- "lineStart": 25,- "name": "Method",- "startByte": 845,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "601c3245bb280851",- "endByte": 928,- "language": "scala",- "lineEnd": 26,- "lineStart": 26,- "name": "Plan",- "startByte": 888,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "f4bb8655a119081f",- "endByte": 971,- "language": "scala",- "lineEnd": 27,- "lineStart": 27,- "name": "Task",- "startByte": 931,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "9747366229c0bfdd",- "endByte": 1014,- "language": "scala",- "lineEnd": 28,- "lineStart": 28,- "name": "Bug",- "startByte": 974,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "7ef46a010eea53b9",- "endByte": 1057,- "language": "scala",- "lineEnd": 29,- "lineStart": 29,- "name": "Goal",- "startByte": 1017,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "b5d008578681570b",- "endByte": 1100,- "language": "scala",- "lineEnd": 30,- "lineStart": 30,- "name": "Region",- "startByte": 1060,- },- {- "chunkKind": "class",- "container": "NodeKind",- "contentHash": "f9150e0d644649d1",- "endByte": 1143,- "language": "scala",- "lineEnd": 31,- "lineStart": 31,- "name": "Chunk",- "startByte": 1103,- },- {- "chunkKind": "function",- "container": "NodeKind",- "contentHash": "95329b6c5c6903c8",- "endByte": 1859,- "language": "scala",- "lineEnd": 56,- "lineStart": 33,- "name": "nameMap",- "startByte": 1147,- },- {- "chunkKind": "function",- "container": "NodeKind",- "contentHash": "bf89078ccc0d7613",- "endByte": 2664,- "language": "scala",- "lineEnd": 81,- "lineStart": 58,- "name": "encoder",- "startByte": 1863,- },- {- "chunkKind": "function",- "container": "NodeKind",- "contentHash": "b8f70f2c26f8f73e",- "endByte": 2793,- "language": "scala",- "lineEnd": 85,- "lineStart": 83,- "name": "decoder",- "startByte": 2668,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "ce7365acee3c48bb",- "endByte": 3031,- "language": "scala",- "lineEnd": 98,- "lineStart": 88,- "name": "GraphNode",- "startByte": 2797,- },- {- "chunkKind": "class",- "container": undefined,- "contentHash": "a046c9fd1d01daa9",- "endByte": 3247,- "language": "scala",- "lineEnd": 105,- "lineStart": 100,- "name": "GraphNode",- "startByte": 3033,- },- {- "chunkKind": "function",- "container": "GraphNode",- "contentHash": "8614f0d5d5f8950b",- "endByte": 3175,- "language": "scala",- "lineEnd": 103,- "lineStart": 103,- "name": "encoder",- "startByte": 3108,- },- {- "chunkKind": "function",- "container": "GraphNode",- "contentHash": "4b9bc3a1d304ef20",- "endByte": 3245,- "language": "scala",- "lineEnd": 104,- "lineStart": 104,- "name": "decoder",- "startByte": 3178,- },- ],- "entities": [- {- "kind": "file",- "language": "scala",- "lineEnd": 106,- "lineStart": 1,- "name": "Node.scala",- },- {- "container": undefined,- "kind": "interface",- "language": "scala",- "lineEnd": 8,- "lineStart": 8,- "name": "NodeKind",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 86,- "lineStart": 9,- "name": "NodeKind",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 10,- "lineStart": 10,- "name": "Module",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 11,- "lineStart": 11,- "name": "File",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 12,- "lineStart": 12,- "name": "Class",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 13,- "lineStart": 13,- "name": "Function",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 14,- "lineStart": 14,- "name": "Variable",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 15,- "lineStart": 15,- "name": "Config",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 16,- "lineStart": 16,- "name": "ConfigEntry",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 17,- "lineStart": 17,- "name": "Service",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 18,- "lineStart": 18,- "name": "Endpoint",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 19,- "lineStart": 19,- "name": "Intent",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 20,- "lineStart": 20,- "name": "Decision",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 21,- "lineStart": 21,- "name": "Doc",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 22,- "lineStart": 22,- "name": "Object",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 23,- "lineStart": 23,- "name": "Trait",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 24,- "lineStart": 24,- "name": "Interface",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 25,- "lineStart": 25,- "name": "Method",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 26,- "lineStart": 26,- "name": "Plan",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 27,- "lineStart": 27,- "name": "Task",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 28,- "lineStart": 28,- "name": "Bug",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 29,- "lineStart": 29,- "name": "Goal",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 30,- "lineStart": 30,- "name": "Region",- },- {- "container": "NodeKind",- "kind": "class",- "language": "scala",- "lineEnd": 31,- "lineStart": 31,- "name": "Chunk",- },- {- "container": "NodeKind",- "kind": "function",- "language": "scala",- "lineEnd": 56,- "lineStart": 33,- "name": "nameMap",- },- {- "container": "NodeKind",- "kind": "function",- "language": "scala",- "lineEnd": 81,- "lineStart": 58,- "name": "encoder",- },- {- "container": "NodeKind",- "kind": "function",- "language": "scala",- "lineEnd": 85,- "lineStart": 83,- "name": "decoder",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 98,- "lineStart": 88,- "name": "GraphNode",- },- {- "container": undefined,- "kind": "class",- "language": "scala",- "lineEnd": 105,- "lineStart": 100,- "name": "GraphNode",- },- {- "container": "GraphNode",- "kind": "function",- "language": "scala",- "lineEnd": 103,- "lineStart": 103,- "name": "encoder",- },- {- "container": "GraphNode",- "kind": "function",- "language": "scala",- "lineEnd": 104,- "lineStart": 104,- "name": "decoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 3,- "lineStart": 3,- "name": "java.time.Instant",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 5,- "lineStart": 5,- "name": "io.circe.Decoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 5,- "lineStart": 5,- "name": "io.circe.Encoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 5,- "lineStart": 5,- "name": "io.circe.Json",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 6,- "lineStart": 6,- "name": "io.circe.generic.semiauto.deriveDecoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 6,- "lineStart": 6,- "name": "io.circe.generic.semiauto.deriveEncoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 101,- "lineStart": 101,- "name": "Provenance.instantEncoder",- },- {- "kind": "module",- "language": "scala",- "lineEnd": 101,- "lineStart": 101,- "name": "Provenance.instantDecoder",- },- ],- "filePath": "memory-layer/src/main/scala/ix/memory/model/Node.scala",- "fileRole": {- "role": "production",- "role_confidence": 0.5,- "role_signals": [],- },- "language": "scala",- "relationships": [- {- "dstName": "NodeKind",- "predicate": "CONTAINS",- "srcName": "Node.scala",- },- {- "dstName": "NodeKind",- "predicate": "CONTAINS",- "srcName": "Node.scala",- },- {- "dstName": "Module",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Module",- },- {- "dstName": "File",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "File",- },- {- "dstName": "Class",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Class",- },- {- "dstName": "Function",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Function",- },- {- "dstName": "Variable",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Variable",- },- {- "dstName": "Config",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Config",- },- {- "dstName": "ConfigEntry",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "ConfigEntry",- },- {- "dstName": "Service",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Service",- },- {- "dstName": "Endpoint",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Endpoint",- },- {- "dstName": "Intent",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Intent",- },- {- "dstName": "Decision",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Decision",- },- {- "dstName": "Doc",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Doc",- },- {- "dstName": "Object",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Object",- },- {- "dstName": "Trait",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Trait",- },- {- "dstName": "Interface",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Interface",- },- {- "dstName": "Method",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Method",- },- {- "dstName": "Plan",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Plan",- },- {- "dstName": "Task",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Task",- },- {- "dstName": "Bug",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Bug",- },- {- "dstName": "Goal",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Goal",- },- {- "dstName": "Region",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Region",- },- {- "dstName": "Chunk",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "NodeKind",- "predicate": "EXTENDS",- "srcName": "Chunk",- },- {- "dstName": "nameMap",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "NodeKind",- },- {- "dstName": "GraphNode",- "predicate": "CONTAINS",- "srcName": "Node.scala",- },- {- "dstName": "GraphNode",- "predicate": "CONTAINS",- "srcName": "Node.scala",- },- {- "dstName": "encoder",- "predicate": "CONTAINS",- "srcName": "GraphNode",- },- {- "dstName": "decoder",- "predicate": "CONTAINS",- "srcName": "GraphNode",- },- {- "dstName": "java.time.Instant",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "io.circe.Decoder",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "io.circe.Encoder",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "io.circe.Json",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "io.circe.generic.semiauto.deriveDecoder",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "io.circe.generic.semiauto.deriveEncoder",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "NodeKind",- "predicate": "REFERENCES",- "srcName": "Node.scala",- },- {- "dstName": "Map",- "predicate": "CALLS",- "srcName": "NodeKind.nameMap",- },- {- "dstName": "contramap",- "predicate": "CALLS",- "srcName": "NodeKind.encoder",- },- {- "dstName": "emap",- "predicate": "CALLS",- "srcName": "NodeKind.decoder",- },- {- "dstName": "get",- "predicate": "CALLS",- "srcName": "NodeKind.decoder",- },- {- "dstName": "toRight",- "predicate": "CALLS",- "srcName": "NodeKind.decoder",- },- {- "dstName": "NodeId",- "predicate": "REFERENCES",- "srcName": "GraphNode",- },- {- "dstName": "NodeKind",- "predicate": "REFERENCES",- "srcName": "GraphNode",- },- {- "dstName": "Json",- "predicate": "REFERENCES",- "srcName": "GraphNode",- },- {- "dstName": "Provenance",- "predicate": "REFERENCES",- "srcName": "GraphNode",- },- {- "dstName": "Rev",- "predicate": "REFERENCES",- "srcName": "GraphNode",- },- {- "dstName": "Instant",- "predicate": "REFERENCES",- "srcName": "GraphNode",- },- {- "dstName": "Provenance.instantEncoder",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "Provenance.instantDecoder",- "predicate": "IMPORTS",- "srcName": "Node.scala",- },- {- "dstName": "GraphNode",- "predicate": "REFERENCES",- "srcName": "Node.scala",- },- ],-}-`;-exports[`parseFile snapshots > snapshots doctor.ts 1`] = `{"chunks": [@@ -1944,6 +92,7 @@ exports[`parseFile snapshots > snapshots doctor.ts 1`] = `"role_confidence": 0.5,"role_signals": [],},+ "importAliases": undefined,"language": "typescript","relationships": [{@@ -1984,7 +133,7 @@ exports[`parseFile snapshots > snapshots doctor.ts 1`] = `{"dstName": "Command","predicate": "REFERENCES",- "srcName": "doctor.ts",+ "srcName": "registerDoctorCommand",},{"dstName": "command",diff --git a/core-ingestion/src/__tests__/queries.elixir.test.ts b/core-ingestion/src/__tests__/queries.elixir.test.tsnew file mode 100644index 00000000..6106fe90--- /dev/null+++ b/core-ingestion/src/__tests__/queries.elixir.test.ts@@ -0,0 +1,294 @@+import { describe, expect, it } from 'vitest';++import { parseFile } from '../index.js';++describe('Elixir queries', () => {+ it('captures module, public functions, and private functions', () => {+ const result = parseFile(+ '/repo/user.ex',+ `+defmodule MyApp.User do+ def start_link(opts) do+ GenServer.start_link(__MODULE__, opts)+ end++ def init(state) do+ {:ok, state}+ end++ defp validate(user) do+ :ok+ end+end+ `,+ );++ expect(result).not.toBeNull();+ expect(result!.entities.map(e => e.name)).toEqual(+ expect.arrayContaining(['MyApp.User', 'start_link', 'init', 'validate']),+ );+ });++ it('captures module as a class-kind entity', () => {+ const result = parseFile(+ '/repo/worker.ex',+ `+defmodule MyApp.Worker do+end+ `,+ );++ expect(result).not.toBeNull();+ const mod = result!.entities.find(e => e.name === 'MyApp.Worker');+ expect(mod).toBeDefined();+ expect(mod!.kind).toBe('class');+ });++ it('captures use/alias/import/require as IMPORTS relationships', () => {+ const result = parseFile(+ '/repo/server.ex',+ `+defmodule MyApp.Server do+ use GenServer+ alias MyApp.Repo+ import Ecto.Query+ require Logger+end+ `,+ );++ expect(result).not.toBeNull();+ const importTargets = result!.relationships+ .filter(r => r.predicate === 'IMPORTS')+ .map(r => r.dstName);+ expect(importTargets).toEqual(expect.arrayContaining(['GenServer', 'MyApp.Repo', 'Ecto.Query', 'Logger']));+ });++ it('captures qualified calls like GenServer.start_link', () => {+ const result = parseFile(+ '/repo/worker.ex',+ `+defmodule MyApp.Worker do+ def start_link(opts) do+ GenServer.start_link(__MODULE__, opts)+ end+end+ `,+ );++ expect(result).not.toBeNull();+ expect(result!.relationships).toContainEqual(+ expect.objectContaining({ dstName: 'GenServer.start_link', predicate: 'CALLS' }),+ );+ });++ it('parses .exs script files', () => {+ const result = parseFile(+ '/repo/mix.exs',+ `+defmodule MyApp.MixProject do+ use Mix.Project++ def project do+ [app: :my_app]+ end+end+ `,+ );++ expect(result).not.toBeNull();+ expect(result!.entities.map(e => e.name)).toContain('MyApp.MixProject');+ });++ it('captures defmacro as a macro-kind entity', () => {+ const result = parseFile(+ '/repo/macros.ex',+ `+defmodule MyApp.Macros do+ defmacro my_macro(x) do+ quote do: unquote(x)+ end+end+ `,+ );++ expect(result).not.toBeNull();+ const macro = result!.entities.find(e => e.name === 'my_macro');+ expect(macro).toBeDefined();+ expect(macro!.kind).toBe('macro');+ });++ it('captures defprotocol and defimpl as class-kind entities', () => {+ const result = parseFile(+ '/repo/serializer.ex',+ `+defprotocol MyApp.Serializer do+ def serialize(data)+end++defimpl MyApp.Serializer, for: MyApp.User do+ def serialize(data), do: data+end+ `,+ );++ expect(result).not.toBeNull();+ const names = result!.entities.map(e => e.name);+ expect(names).toContain('MyApp.Serializer');+ const protocol = result!.entities.find(e => e.name === 'MyApp.Serializer');+ expect(protocol!.kind).toBe('class');+ });++ it('does not emit bogus CALLS edges for keywords or self-calls', () => {+ const result = parseFile(+ '/repo/user.ex',+ `+defmodule MyApp.User do+ use GenServer+ alias MyApp.Repo+ import Ecto.Query++ def start_link(opts) do+ GenServer.start_link(__MODULE__, opts)+ end++ defp validate(user) do+ Repo.get(User, user.id)+ user |> Map.put(:validated, true) |> Repo.update()+ end+end+ `,+ );++ expect(result).not.toBeNull();+ const callTargets = result!.relationships+ .filter(r => r.predicate === 'CALLS')+ .map(r => r.dstName);++ expect(callTargets).not.toContain('defmodule');+ expect(callTargets).not.toContain('def');+ expect(callTargets).not.toContain('defp');+ expect(callTargets).not.toContain('use');+ expect(callTargets).not.toContain('alias');+ expect(callTargets).not.toContain('import');+ expect(callTargets).not.toContain('start_link');+ expect(callTargets).not.toContain('validate');+ });++ it('captures guarded functions', () => {+ const result = parseFile(+ '/repo/user.ex',+ `+defmodule MyApp.User do+ def fetch(id) when is_integer(id) do+ {:ok, id}+ end++ defp validate(x) when x > 0 do+ :ok+ end+end+ `,+ );++ expect(result).not.toBeNull();+ expect(result!.entities.map(e => e.name)).toEqual(+ expect.arrayContaining(['fetch', 'validate']),+ );+ });+it('does not emit self-call edge for guarded functions', () => {+ const result = parseFile(+ '/repo/user.ex',+ `+defmodule MyApp.User do+ def fetch(id) when is_integer(id) do+ {:ok, id}+ end+end+ `,+ );++ expect(result).not.toBeNull();+ const callTargets = result!.relationships+ .filter(r => r.predicate === 'CALLS')+ .map(r => r.dstName);+ expect(callTargets).not.toContain('fetch');+ });++ it('captures grouped alias MyApp.{User, Repo, Post} as full-dotted IMPORTS + short aliases', () => {+ const result = parseFile(+ '/repo/context.ex',+ `+defmodule MyApp.Context do+ alias MyApp.{User, Repo, Post}+end+ `,+ );++ expect(result).not.toBeNull();+ const importTargets = result!.relationships+ .filter(r => r.predicate === 'IMPORTS')+ .map(r => r.dstName);+ // Full module names, consistent with the single-alias form (NOT bare members).+ expect(importTargets).toEqual(+ expect.arrayContaining(['MyApp.User', 'MyApp.Repo', 'MyApp.Post']),+ );+ expect(importTargets).not.toContain('User');+ expect(importTargets).not.toContain('Repo');+ // Short names are bound so qualified calls through grouped aliases resolve.+ expect(result!.importAliases).toMatchObject({+ User: 'MyApp.User',+ Repo: 'MyApp.Repo',+ Post: 'MyApp.Post',+ });+ });++ it('merges multi-clause functions into one node spanning all clauses', () => {+ const result = parseFile(+ '/repo/multi.ex',+ `+defmodule MyApp.Multi do+ def handle(x) when is_atom(x) do+ x+ end++ def handle(x, y) do+ {x, y}+ end++ def handle(x) do+ x+ end+end+ `,+ );++ expect(result).not.toBeNull();+ const handles = result!.entities.filter(e => e.name === 'handle');+ // All clauses (guarded + multi-arity) collapse to a single node...+ expect(handles).toHaveLength(1);+ // ...whose span covers the first clause through the last, not just the first.+ expect(handles[0].lineEnd - handles[0].lineStart).toBeGreaterThanOrEqual(8);+ });++ it('does not merge a def and a defmacro of the same name (kind distinguishes them)', () => {+ const result = parseFile(+ '/repo/fm.ex',+ `+defmodule M do+ def foo(x), do: x++ defmacro foo(x, y) do+ quote do: unquote(x)+ end+end+ `,+ );++ expect(result).not.toBeNull();+ const foos = result!.entities.filter(e => e.name === 'foo');+ expect(foos).toHaveLength(2);+ expect(foos.map(e => e.kind).sort()).toEqual(['function', 'macro']);+ });+});+diff --git a/core-ingestion/src/__tests__/resolveEdges.test.ts b/core-ingestion/src/__tests__/resolveEdges.test.tsindex 9693ef94..fe631ccc 100644--- a/core-ingestion/src/__tests__/resolveEdges.test.ts+++ b/core-ingestion/src/__tests__/resolveEdges.test.ts@@ -219,6 +219,40 @@ describe('resolveEdges', () => {});});+ it('resolves Elixir alias-qualified calls through the implicit short alias', () => {+ const caller = fileResult(+ '/repo/lib/my_app/accounts.ex',+ SupportedLanguages.Elixir,+ [entity('create_user', SupportedLanguages.Elixir)],+ [+ { srcName: 'accounts.ex', dstName: 'MyApp.Repo', predicate: 'IMPORTS' },+ { srcName: 'create_user', dstName: 'Repo.insert', predicate: 'CALLS' },+ ],+ );+ caller.importAliases = {+ Repo: 'MyApp.Repo',+ };++ const callee = fileResult(+ '/repo/lib/my_app/repo.ex',+ SupportedLanguages.Elixir,+ [+ entity('MyApp.Repo', SupportedLanguages.Elixir, 'class'),+ entity('insert', SupportedLanguages.Elixir, 'function', 'MyApp.Repo'),+ ],+ );++ expect(resolveEdges([caller, callee])).toContainEqual({+ srcFilePath: '/repo/lib/my_app/accounts.ex',+ srcName: 'create_user',+ dstFilePath: '/repo/lib/my_app/repo.ex',+ dstName: 'Repo.insert',+ dstQualifiedKey: 'MyApp.Repo.insert',+ predicate: 'CALLS',+ confidence: 0.9,+ });+});+it('does not resolve qualifier-assisted edges when the member is missing or the qualifier is ambiguous', () => {const caller = fileResult('/repo/consumer.scala',diff --git a/core-ingestion/src/index.ts b/core-ingestion/src/index.tsindex df4aa259..d6eddd79 100644--- a/core-ingestion/src/index.ts+++ b/core-ingestion/src/index.ts@@ -33,6 +33,7 @@ function tryLoadGrammar(pkg: string): any {}const Kotlin = tryLoadGrammar('tree-sitter-kotlin');const Swift = tryLoadGrammar('tree-sitter-swift');+const Elixir = tryLoadGrammar('tree-sitter-elixir');const Make = tryLoadGrammar('tree-sitter-make');import { SupportedLanguages, languageFromPath } from './languages.js';@@ -115,6 +116,7 @@ const GRAMMAR_MAP: Partial<Record<SupportedLanguages, any>> = {[SupportedLanguages.Scala]: Scala,...(Kotlin ? { [SupportedLanguages.Kotlin]: Kotlin } : {}),...(Swift ? { [SupportedLanguages.Swift]: Swift } : {}),+ ...(Elixir ? { [SupportedLanguages.Elixir]: Elixir } : {}),...(Make ? { [SupportedLanguages.Makefile]: Make } : {}),};@@ -1534,13 +1536,28 @@ export function parseFile(filePath: string, source: string): FileParseResult | n// Import captures (JS/TS/Python path-based)const importSource = match.captures.find((c: any) => c.name === 'import.source');if (importSource) {- const modName = normalizeCapturedImport(importSource.node.text, language);+ // Grouped alias `alias MyApp.{User, Repo}`: each member alias is captured bare+ // ("User"); the prefix alias ("MyApp") comes through @import.prefix so we can+ // rebuild the full module name "MyApp.User", matching the single-alias form.+ const importPrefix = match.captures.find((c: any) => c.name === 'import.prefix')?.node.text;+ let modName = normalizeCapturedImport(importSource.node.text, language);+ if (importPrefix) modName = `${importPrefix}.${modName}`;const importAlias = match.captures.find((c: any) => c.name === 'import.alias')?.node.text;if (importAlias && modName && importAlias !== '.' && importAlias !== '_') {importAliases[importAlias] = modName;}+ // Elixir: `alias MyApp.Repo` (and grouped `alias MyApp.{Repo, ...}`) implicitly+ // bind the last segment as a short name. No @import.alias capture exists, so+ // derive it here — this is what lets Tier-1b resolution translate e.g.+ // 'Repo.insert' → 'MyApp.Repo.insert', including through grouped aliases.+ if (!importAlias && language === SupportedLanguages.Elixir && modName.includes('.')) {+ const directive = match.captures.find((c: any) =>+ c.name === '_directive' || c.name === '_alias_group')?.node.text;+ if (directive === 'alias') {+ importAliases[modName.split('.').pop()!] = modName;+ }+ }if (modName.length > 0 && modName !== '*') {- if (!modName) continue; // skip bare '.' relative importsentities.push({ name: modName, kind: 'module', lineStart: importSource.node.startPosition.row + 1, lineEnd: importSource.node.startPosition.row + 1, language });relationships.push({ srcName: fileName, dstName: modName, predicate: 'IMPORTS' });}@@ -1590,6 +1607,28 @@ export function parseFile(filePath: string, source: string): FileParseResult | nif (isDecoratorCall) continue;}+ // Elixir: skip the function-name node inside def/defp/defmacro(p) argument lists.+ // `def foo(args)` parses as call{target:def, args:[call{target:foo, args:[...]}]}.+ // callName.node is the identifier `foo`; its parent is the inner call node,+ // whose parent is `arguments`, whose parent is the outer def* call.+ // Without this, the inner call{target:foo} would emit a `foo CALLS foo` self-edge.+ if (language === SupportedLanguages.Elixir) {+ const innerCall = callName.node.parent;+ let argsNode = innerCall?.parent;+ if (argsNode?.type === 'binary_operator') {+ argsNode = argsNode.parent; // walk up through when-guard+ }+ if (argsNode?.type === 'arguments') {+ const defCall = argsNode.parent;+ if (defCall?.type === 'call') {+ const defTarget = defCall.childForFieldName?.('target');+ if (defTarget && /^(def|defp|defmacro|defmacrop)$/.test(defTarget.text)) {+ continue;+ }+ }+ }+ }+// Find enclosing function/method for the call; fall back to enclosing class// (e.g. calls in val/lazy val body at class level) before falling back to file.const callLine = callName.node.startPosition.row + 1;@@ -1728,6 +1767,30 @@ export function parseFile(filePath: string, source: string): FileParseResult | n});}+ // Elixir: a function/macro with multiple clauses (guards, pattern-matched heads,+ // or several arities) is emitted as one entity per clause; they collapse to a+ // single node keyed by (container, name). Merge them so the surviving node spans+ // the whole clause group (first clause start .. last clause end) instead of only+ // the first clause. (Per-arity identity, e.g. changeset/2 vs changeset/3, is a+ // larger follow-up: it needs call-arity capture to keep call resolution precise.)+ if (language === SupportedLanguages.Elixir) {+ const firstByKey = new Map<string, ParsedEntity>();+ const dropIdx: number[] = [];+ entities.forEach((e, i) => {+ if (e.kind !== 'function' && e.kind !== 'macro') return;+ const key = `${e.kind} ${e.container ?? ''} ${e.name}`;+ const keep = firstByKey.get(key);+ if (keep) {+ keep.lineStart = Math.min(keep.lineStart, e.lineStart);+ keep.lineEnd = Math.max(keep.lineEnd, e.lineEnd);+ dropIdx.push(i);+ } else {+ firstByKey.set(key, e);+ }+ });+ for (let j = dropIdx.length - 1; j >= 0; j--) entities.splice(dropIdx[j], 1);+ }+return {filePath,language,@@ -2469,10 +2532,10 @@ export function resolveEdges(const qualifierPart = dstName.slice(0, qualDot);const memberPart = dstName.slice(qualDot + 1);if (memberPart && qualifierPart) {- const aliasedImportMatches =- srcLanguage === SupportedLanguages.Go- ? resolveImportQualifierTargets(srcFilePath, srcLanguage, result.importAliases?.[qualifierPart] ?? '')- : [];+ const elixirAliasedModule = srcLanguage === SupportedLanguages.Elixir ? result.importAliases?.[qualifierPart]: undefined;+ const aliasedImportMatches = srcLanguage === SupportedLanguages.Go ? resolveImportQualifierTargets(srcFilePath, srcLanguage, result.importAliases?.[qualifierPart] ?? '')+ : elixirAliasedModule ? results.map(r => r.filePath).filter(fp => fp !== srcFilePath && fileHasSymbol.get(fp)?.has(elixirAliasedModule))+ : [];// Try import-scoped qualifier firstconst qualifierSearchPool = aliasedImportMatches.length > 0? aliasedImportMatches@@ -2490,7 +2553,7 @@ export function resolveEdges(}if (qualImportMatches.length === 1) {const qfp = qualImportMatches[0];- const preferredQKey = aliasedImportMatches.length > 0 ? undefined : `${qualifierPart}.${memberPart}`;+ const preferredQKey = elixirAliasedModule ? `${elixirAliasedModule}.${memberPart}` : aliasedImportMatches.length > 0 ? undefined : `${qualifierPart}.${memberPart}`;if (fileHasSymbol.get(qfp)?.has(memberPart)) {const dstQualifiedKey = bestQKey(fileQKeys, qfp, memberPart, preferredQKey);if (dstQualifiedKey !== null) {diff --git a/core-ingestion/src/languages.ts b/core-ingestion/src/languages.tsindex 660470b0..1141eb70 100644--- a/core-ingestion/src/languages.ts+++ b/core-ingestion/src/languages.ts@@ -19,6 +19,7 @@ export enum SupportedLanguages {JSON = 'json',TOML = 'toml',Markdown = 'markdown',+ Elixir = 'elixir',Makefile = 'makefile',}@@ -55,6 +56,8 @@ const EXT_MAP: Record<string, SupportedLanguages> = {'.toml': SupportedLanguages.TOML,'.md': SupportedLanguages.Markdown,'.markdown': SupportedLanguages.Markdown,+ '.ex': SupportedLanguages.Elixir,+ '.exs': SupportedLanguages.Elixir,'.mk': SupportedLanguages.Makefile,'.makefile': SupportedLanguages.Makefile,};diff --git a/core-ingestion/src/queries.ts b/core-ingestion/src/queries.tsindex d1fac2e7..39f3923b 100644--- a/core-ingestion/src/queries.ts+++ b/core-ingestion/src/queries.ts@@ -1397,6 +1397,92 @@ export const MAKEFILE_QUERIES = ``;+// tree-sitter-elixir: https://github.com/elixir-lang/tree-sitter-elixir+// Most constructs are represented as `call` nodes with a `target` identifier.+export const ELIXIR_QUERIES = `+; ── Module / protocol / impl definitions ─────────────────────────────────────+(call+ target: (identifier) @_defmodule+ (arguments (alias) @name)+ (#match? @_defmodule "^(defmodule|defprotocol)$")) @definition.class++(call+ target: (identifier) @_defimpl+ (arguments (alias) @name)+ (#eq? @_defimpl "defimpl")) @definition.class++; ── Function definitions with parens: def foo(args) do … end ─────────────────+(call+ target: (identifier) @_def+ (arguments+ (call target: (identifier) @name))+ (#match? @_def "^(def|defp)$")) @definition.function++; ── Macro definitions with parens: defmacro my_macro(x) do … end ─────────────+(call+ target: (identifier) @_defmacro+ (arguments+ (call target: (identifier) @name))+ (#match? @_defmacro "^(defmacro|defmacrop)$")) @definition.macro++; ── Zero-arity function definitions without parens: def foo do … end ─────────+(call+ target: (identifier) @_def0+ (arguments+ (identifier) @name)+ (#match? @_def0 "^(def|defp)$")) @definition.function++; ── Zero-arity macro definitions without parens ───────────────────────────────+(call+ target: (identifier) @_defmacro0+ (arguments+ (identifier) @name)+ (#match? @_defmacro0 "^(defmacro|defmacrop)$")) @definition.macro++; ── Module directives → IMPORTS ───────────────────────────────────────────────+(call+ target: (identifier) @_directive+ (arguments (alias) @import.source)+ (#match? @_directive "^(alias|import|use|require)$")) @import++ ; ── Grouped alias: alias MyApp.{User, Repo, Post} → one IMPORTS per member ───+(call+ target: (identifier) @_alias_group+ (arguments+ (dot+ left: (alias) @import.prefix+ right: (tuple (alias) @import.source)))+ (#eq? @_alias_group "alias")) @import++; ── Qualified calls: Foo.bar() — captures qualifier so resolution is possible ─+(call+ target: (dot+ left: (alias) @_qualifier+ right: (identifier) @call.name)) @call++; ── Unqualified calls — keywords excluded to avoid bogus edges ────────────────+(call+ target: (identifier) @call.name+ (#not-match? @call.name "^(def|defp|defmacro|defmacrop|defmodule|defprotocol|defimpl|defstruct|use|alias|import|require|quote|unquote|if|unless|case|cond|with|for|try|receive|raise|throw|fn|do|behaviour|behavior|impl|derive|moduledoc|doc|spec|type|typep|opaque|callback|enforce_keys)$")) @call+++; ── Guarded function definitions: def f(x) when guard do … end ──────────────+(call+ target: (identifier) @_defg+ (arguments+ (binary_operator+ left: (call target: (identifier) @name)))+ (#match? @_defg "^(def|defp)$")) @definition.function++ ; ── Guarded macro definitions ─────────────────────────────────────────────────+(call+ target: (identifier) @_defmacrog+ (arguments+ (binary_operator+ left: (call target: (identifier) @name)))+ (#match? @_defmacrog "^(defmacro|defmacrop)$")) @definition.macro+ `;+export const LANGUAGE_QUERIES: Record<SupportedLanguages, string> = {[SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,[SupportedLanguages.JavaScript]: JAVASCRIPT_QUERIES,@@ -1418,6 +1504,7 @@ export const LANGUAGE_QUERIES: Record<SupportedLanguages, string> = {[SupportedLanguages.JSON]: '',[SupportedLanguages.TOML]: '',[SupportedLanguages.Markdown]: '',+ [SupportedLanguages.Elixir]: ELIXIR_QUERIES,[SupportedLanguages.Makefile]: MAKEFILE_QUERIES,};diff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.tsindex c76ef119..1d31c8ff 100644--- a/ix-cli/src/cli/commands/ingest.ts+++ b/ix-cli/src/cli/commands/ingest.ts@@ -40,6 +40,7 @@ const SUPPORTED_EXTENSIONS = new Set(['.json','.toml','.md', '.markdown',+ '.ex', '.exs','.mk', '.makefile',]);