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: replace Scala regex parsers with tree-sitter in CLI
Joseph Mikhail270c74373899
diff --git a/build.sbt b/build.sbtindex 66410b9a..1b129698 100644--- a/build.sbt+++ b/build.sbt@@ -29,9 +29,6 @@ lazy val memoryLayer = (project in file("memory-layer"))// ArangoDB"com.arangodb" % "arangodb-java-driver" % "7.12.0",- // Tree-sitter- "ch.usi.si.seart" % "java-tree-sitter" % "1.12.0",-// Logging"org.typelevel" %% "log4cats-slf4j" % "2.7.0","ch.qos.logback" % "logback-classic" % "1.5.6",diff --git a/ix-cli/package-lock.json b/ix-cli/package-lock.jsonindex 98e8d1a9..63340817 100644--- a/ix-cli/package-lock.json+++ b/ix-cli/package-lock.json@@ -8,9 +8,20 @@"name": "@ix/cli","version": "0.1.0","dependencies": {- "@modelcontextprotocol/sdk": "^1.0.0","chalk": "^5.3.0","commander": "^12.0.0",+ "tree-sitter": "^0.21.0",+ "tree-sitter-c": "^0.21.0",+ "tree-sitter-c-sharp": "^0.21.0",+ "tree-sitter-cpp": "^0.22.0",+ "tree-sitter-go": "^0.21.0",+ "tree-sitter-java": "^0.21.0",+ "tree-sitter-javascript": "^0.21.0",+ "tree-sitter-php": "^0.23.12",+ "tree-sitter-python": "^0.21.0",+ "tree-sitter-ruby": "^0.23.1",+ "tree-sitter-rust": "^0.21.0",+ "tree-sitter-typescript": "^0.21.0","yaml": "^2.4.0"},"bin": {@@ -465,18 +476,6 @@"node": ">=18"}},- "node_modules/@hono/node-server": {- "version": "1.19.10",- "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.10.tgz",- "integrity": "sha512-hZ7nOssGqRgyV3FVVQdfi+U4q02uB23bpnYpdvNXkYTRRyWx84b7yf1ans+dnJ/7h41sGL3CeQTfO+ZGxuO+Iw==",- "license": "MIT",- "engines": {- "node": ">=18.14.1"- },- "peerDependencies": {- "hono": "^4"- }- },"node_modules/@jest/schemas": {"version": "29.6.3","resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz",@@ -497,46 +496,6 @@"dev": true,"license": "MIT"},- "node_modules/@modelcontextprotocol/sdk": {- "version": "1.27.1",- "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.27.1.tgz",- "integrity": "sha512-sr6GbP+4edBwFndLbM60gf07z0FQ79gaExpnsjMGePXqFcSSb7t6iscpjk9DhFhwd+mTEQrzNafGP8/iGGFYaA==",- "license": "MIT",- "dependencies": {- "@hono/node-server": "^1.19.9",- "ajv": "^8.17.1",- "ajv-formats": "^3.0.1",- "content-type": "^1.0.5",- "cors": "^2.8.5",- "cross-spawn": "^7.0.5",- "eventsource": "^3.0.2",- "eventsource-parser": "^3.0.0",- "express": "^5.2.1",- "express-rate-limit": "^8.2.1",- "hono": "^4.11.4",- "jose": "^6.1.3",- "json-schema-typed": "^8.0.2",- "pkce-challenge": "^5.0.0",- "raw-body": "^3.0.0",- "zod": "^3.25 || ^4.0",- "zod-to-json-schema": "^3.25.1"- },- "engines": {- "node": ">=18"- },- "peerDependencies": {- "@cfworker/json-schema": "^4.1.1",- "zod": "^3.25 || ^4.0"- },- "peerDependenciesMeta": {- "@cfworker/json-schema": {- "optional": true- },- "zod": {- "optional": false- }- }- },"node_modules/@rollup/rollup-android-arm-eabi": {"version": "4.59.0","resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz",@@ -907,6 +866,7 @@"integrity": "sha512-Uarfe6J91b9HAUXxjvSOdiO2UPOKLm07Q1oh0JHxoZ1y8HoqxDAu3gVrsrOHeiio0kSsoVBt4wFrKOm0dKxVPQ==","dev": true,"license": "MIT",+ "peer": true,"dependencies": {"undici-types": "~6.21.0"}@@ -985,19 +945,6 @@"url": "https://opencollective.com/vitest"}},- "node_modules/accepts": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",- "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",- "license": "MIT",- "dependencies": {- "mime-types": "^3.0.0",- "negotiator": "^1.0.0"- },- "engines": {- "node": ">= 0.6"- }- },"node_modules/acorn": {"version": "8.16.0","resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",@@ -1024,39 +971,6 @@"node": ">=0.4.0"}},- "node_modules/ajv": {- "version": "8.18.0",- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",- "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",- "license": "MIT",- "dependencies": {- "fast-deep-equal": "^3.1.3",- "fast-uri": "^3.0.1",- "json-schema-traverse": "^1.0.0",- "require-from-string": "^2.0.2"- },- "funding": {- "type": "github",- "url": "https://github.com/sponsors/epoberezkin"- }- },- "node_modules/ajv-formats": {- "version": "3.0.1",- "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",- "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",- "license": "MIT",- "dependencies": {- "ajv": "^8.0.0"- },- "peerDependencies": {- "ajv": "^8.0.0"- },- "peerDependenciesMeta": {- "ajv": {- "optional": true- }- }- },"node_modules/ansi-styles": {"version": "5.2.0","resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",@@ -1080,39 +994,6 @@"node": "*"}},- "node_modules/body-parser": {- "version": "2.2.2",- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",- "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==",- "license": "MIT",- "dependencies": {- "bytes": "^3.1.2",- "content-type": "^1.0.5",- "debug": "^4.4.3",- "http-errors": "^2.0.0",- "iconv-lite": "^0.7.0",- "on-finished": "^2.4.1",- "qs": "^6.14.1",- "raw-body": "^3.0.1",- "type-is": "^2.0.1"- },- "engines": {- "node": ">=18"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/bytes": {- "version": "3.1.2",- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",- "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },"node_modules/cac": {"version": "6.7.14","resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",@@ -1123,35 +1004,6 @@"node": ">=8"}},- "node_modules/call-bind-apply-helpers": {- "version": "1.0.2",- "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",- "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",- "license": "MIT",- "dependencies": {- "es-errors": "^1.3.0",- "function-bind": "^1.1.2"- },- "engines": {- "node": ">= 0.4"- }- },- "node_modules/call-bound": {- "version": "1.0.4",- "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",- "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",- "license": "MIT",- "dependencies": {- "call-bind-apply-helpers": "^1.0.2",- "get-intrinsic": "^1.3.0"- },- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },"node_modules/chai": {"version": "4.5.0","resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz",@@ -1212,67 +1064,11 @@"dev": true,"license": "MIT"},- "node_modules/content-disposition": {- "version": "1.0.1",- "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz",- "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==",- "license": "MIT",- "engines": {- "node": ">=18"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/content-type": {- "version": "1.0.5",- "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",- "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",- "license": "MIT",- "engines": {- "node": ">= 0.6"- }- },- "node_modules/cookie": {- "version": "0.7.2",- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",- "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",- "license": "MIT",- "engines": {- "node": ">= 0.6"- }- },- "node_modules/cookie-signature": {- "version": "1.2.2",- "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",- "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",- "license": "MIT",- "engines": {- "node": ">=6.6.0"- }- },- "node_modules/cors": {- "version": "2.8.6",- "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",- "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",- "license": "MIT",- "dependencies": {- "object-assign": "^4",- "vary": "^1"- },- "engines": {- "node": ">= 0.10"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },"node_modules/cross-spawn": {"version": "7.0.6","resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz","integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",+ "dev": true,"license": "MIT","dependencies": {"path-key": "^3.1.0",@@ -1287,6 +1083,7 @@"version": "4.4.3","resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz","integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "dev": true,"license": "MIT","dependencies": {"ms": "^2.1.3"@@ -1313,15 +1110,6 @@"node": ">=6"}},- "node_modules/depd": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",- "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },"node_modules/diff-sequences": {"version": "29.6.3","resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz",@@ -1332,65 +1120,6 @@"node": "^14.15.0 || ^16.10.0 || >=18.0.0"}},- "node_modules/dunder-proto": {- "version": "1.0.1",- "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",- "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",- "license": "MIT",- "dependencies": {- "call-bind-apply-helpers": "^1.0.1",- "es-errors": "^1.3.0",- "gopd": "^1.2.0"- },- "engines": {- "node": ">= 0.4"- }- },- "node_modules/ee-first": {- "version": "1.1.1",- "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",- "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",- "license": "MIT"- },- "node_modules/encodeurl": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",- "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },- "node_modules/es-define-property": {- "version": "1.0.1",- "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",- "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",- "license": "MIT",- "engines": {- "node": ">= 0.4"- }- },- "node_modules/es-errors": {- "version": "1.3.0",- "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",- "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",- "license": "MIT",- "engines": {- "node": ">= 0.4"- }- },- "node_modules/es-object-atoms": {- "version": "1.1.1",- "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",- "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",- "license": "MIT",- "dependencies": {- "es-errors": "^1.3.0"- },- "engines": {- "node": ">= 0.4"- }- },"node_modules/esbuild": {"version": "0.27.3","resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz",@@ -1433,12 +1162,6 @@"@esbuild/win32-x64": "0.27.3"}},- "node_modules/escape-html": {- "version": "1.0.3",- "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",- "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",- "license": "MIT"- },"node_modules/estree-walker": {"version": "3.0.3","resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",@@ -1449,36 +1172,6 @@"@types/estree": "^1.0.0"}},- "node_modules/etag": {- "version": "1.8.1",- "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",- "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",- "license": "MIT",- "engines": {- "node": ">= 0.6"- }- },- "node_modules/eventsource": {- "version": "3.0.7",- "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz",- "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==",- "license": "MIT",- "dependencies": {- "eventsource-parser": "^3.0.1"- },- "engines": {- "node": ">=18.0.0"- }- },- "node_modules/eventsource-parser": {- "version": "3.0.6",- "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz",- "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==",- "license": "MIT",- "engines": {- "node": ">=18.0.0"- }- },"node_modules/execa": {"version": "8.0.1","resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz",@@ -1503,128 +1196,6 @@"url": "https://github.com/sindresorhus/execa?sponsor=1"}},- "node_modules/express": {- "version": "5.2.1",- "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",- "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",- "license": "MIT",- "dependencies": {- "accepts": "^2.0.0",- "body-parser": "^2.2.1",- "content-disposition": "^1.0.0",- "content-type": "^1.0.5",- "cookie": "^0.7.1",- "cookie-signature": "^1.2.1",- "debug": "^4.4.0",- "depd": "^2.0.0",- "encodeurl": "^2.0.0",- "escape-html": "^1.0.3",- "etag": "^1.8.1",- "finalhandler": "^2.1.0",- "fresh": "^2.0.0",- "http-errors": "^2.0.0",- "merge-descriptors": "^2.0.0",- "mime-types": "^3.0.0",- "on-finished": "^2.4.1",- "once": "^1.4.0",- "parseurl": "^1.3.3",- "proxy-addr": "^2.0.7",- "qs": "^6.14.0",- "range-parser": "^1.2.1",- "router": "^2.2.0",- "send": "^1.1.0",- "serve-static": "^2.2.0",- "statuses": "^2.0.1",- "type-is": "^2.0.1",- "vary": "^1.1.2"- },- "engines": {- "node": ">= 18"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/express-rate-limit": {- "version": "8.3.0",- "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.3.0.tgz",- "integrity": "sha512-KJzBawY6fB9FiZGdE/0aftepZ91YlaGIrV8vgblRM3J8X+dHx/aiowJWwkx6LIGyuqGiANsjSwwrbb8mifOJ4Q==",- "license": "MIT",- "dependencies": {- "ip-address": "10.1.0"- },- "engines": {- "node": ">= 16"- },- "funding": {- "url": "https://github.com/sponsors/express-rate-limit"- },- "peerDependencies": {- "express": ">= 4.11"- }- },- "node_modules/fast-deep-equal": {- "version": "3.1.3",- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",- "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",- "license": "MIT"- },- "node_modules/fast-uri": {- "version": "3.1.0",- "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz",- "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==",- "funding": [- {- "type": "github",- "url": "https://github.com/sponsors/fastify"- },- {- "type": "opencollective",- "url": "https://opencollective.com/fastify"- }- ],- "license": "BSD-3-Clause"- },- "node_modules/finalhandler": {- "version": "2.1.1",- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",- "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",- "license": "MIT",- "dependencies": {- "debug": "^4.4.0",- "encodeurl": "^2.0.0",- "escape-html": "^1.0.3",- "on-finished": "^2.4.1",- "parseurl": "^1.3.3",- "statuses": "^2.0.1"- },- "engines": {- "node": ">= 18.0.0"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/forwarded": {- "version": "0.2.0",- "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",- "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",- "license": "MIT",- "engines": {- "node": ">= 0.6"- }- },- "node_modules/fresh": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",- "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },"node_modules/fsevents": {"version": "2.3.3","resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",@@ -1640,15 +1211,6 @@"node": "^8.16.0 || ^10.6.0 || >=11.0.0"}},- "node_modules/function-bind": {- "version": "1.1.2",- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",- "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",- "license": "MIT",- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },"node_modules/get-func-name": {"version": "2.0.2","resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz",@@ -1659,43 +1221,6 @@"node": "*"}},- "node_modules/get-intrinsic": {- "version": "1.3.0",- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",- "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",- "license": "MIT",- "dependencies": {- "call-bind-apply-helpers": "^1.0.2",- "es-define-property": "^1.0.1",- "es-errors": "^1.3.0",- "es-object-atoms": "^1.1.1",- "function-bind": "^1.1.2",- "get-proto": "^1.0.1",- "gopd": "^1.2.0",- "has-symbols": "^1.1.0",- "hasown": "^2.0.2",- "math-intrinsics": "^1.1.0"- },- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/get-proto": {- "version": "1.0.1",- "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",- "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",- "license": "MIT",- "dependencies": {- "dunder-proto": "^1.0.1",- "es-object-atoms": "^1.0.0"- },- "engines": {- "node": ">= 0.4"- }- },"node_modules/get-stream": {"version": "8.0.1","resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",@@ -1722,71 +1247,6 @@"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"}},- "node_modules/gopd": {- "version": "1.2.0",- "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",- "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",- "license": "MIT",- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/has-symbols": {- "version": "1.1.0",- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",- "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",- "license": "MIT",- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/hasown": {- "version": "2.0.2",- "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",- "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",- "license": "MIT",- "dependencies": {- "function-bind": "^1.1.2"- },- "engines": {- "node": ">= 0.4"- }- },- "node_modules/hono": {- "version": "4.12.4",- "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.4.tgz",- "integrity": "sha512-ooiZW1Xy8rQ4oELQ++otI2T9DsKpV0M6c6cO6JGx4RTfav9poFFLlet9UMXHZnoM1yG0HWGlQLswBGX3RZmHtg==",- "license": "MIT",- "engines": {- "node": ">=16.9.0"- }- },- "node_modules/http-errors": {- "version": "2.0.1",- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",- "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",- "license": "MIT",- "dependencies": {- "depd": "~2.0.0",- "inherits": "~2.0.4",- "setprototypeof": "~1.2.0",- "statuses": "~2.0.2",- "toidentifier": "~1.0.1"- },- "engines": {- "node": ">= 0.8"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },"node_modules/human-signals": {"version": "5.0.0","resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz",@@ -1797,52 +1257,6 @@"node": ">=16.17.0"}},- "node_modules/iconv-lite": {- "version": "0.7.2",- "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",- "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",- "license": "MIT",- "dependencies": {- "safer-buffer": ">= 2.1.2 < 3.0.0"- },- "engines": {- "node": ">=0.10.0"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/inherits": {- "version": "2.0.4",- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",- "license": "ISC"- },- "node_modules/ip-address": {- "version": "10.1.0",- "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz",- "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==",- "license": "MIT",- "engines": {- "node": ">= 12"- }- },- "node_modules/ipaddr.js": {- "version": "1.9.1",- "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",- "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",- "license": "MIT",- "engines": {- "node": ">= 0.10"- }- },- "node_modules/is-promise": {- "version": "4.0.0",- "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",- "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",- "license": "MIT"- },"node_modules/is-stream": {"version": "3.0.0","resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",@@ -1860,17 +1274,9 @@"version": "2.0.0","resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz","integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",+ "dev": true,"license": "ISC"},- "node_modules/jose": {- "version": "6.1.3",- "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz",- "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==",- "license": "MIT",- "funding": {- "url": "https://github.com/sponsors/panva"- }- },"node_modules/js-tokens": {"version": "9.0.1","resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz",@@ -1878,18 +1284,6 @@"dev": true,"license": "MIT"},- "node_modules/json-schema-traverse": {- "version": "1.0.0",- "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",- "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",- "license": "MIT"- },- "node_modules/json-schema-typed": {- "version": "8.0.2",- "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz",- "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==",- "license": "BSD-2-Clause"- },"node_modules/local-pkg": {"version": "0.5.1","resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.1.tgz",@@ -1927,36 +1321,6 @@"@jridgewell/sourcemap-codec": "^1.5.5"}},- "node_modules/math-intrinsics": {- "version": "1.1.0",- "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",- "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",- "license": "MIT",- "engines": {- "node": ">= 0.4"- }- },- "node_modules/media-typer": {- "version": "1.1.0",- "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",- "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },- "node_modules/merge-descriptors": {- "version": "2.0.0",- "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",- "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",- "license": "MIT",- "engines": {- "node": ">=18"- },- "funding": {- "url": "https://github.com/sponsors/sindresorhus"- }- },"node_modules/merge-stream": {"version": "2.0.0","resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",@@ -1964,31 +1328,6 @@"dev": true,"license": "MIT"},- "node_modules/mime-db": {- "version": "1.54.0",- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",- "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",- "license": "MIT",- "engines": {- "node": ">= 0.6"- }- },- "node_modules/mime-types": {- "version": "3.0.2",- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",- "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",- "license": "MIT",- "dependencies": {- "mime-db": "^1.54.0"- },- "engines": {- "node": ">=18"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },"node_modules/mimic-fn": {"version": "4.0.0","resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",@@ -2026,6 +1365,7 @@"version": "2.1.3","resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz","integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "dev": true,"license": "MIT"},"node_modules/nanoid": {@@ -2047,13 +1387,24 @@"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"}},- "node_modules/negotiator": {- "version": "1.0.0",- "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",- "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",+ "node_modules/node-addon-api": {+ "version": "8.6.0",+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.6.0.tgz",+ "integrity": "sha512-gBVjCaqDlRUk0EwoPNKzIr9KkS9041G/q31IBShPs1Xz6UTA+EXdZADbzqAJQrpDRq71CIMnOP5VMut3SL0z5Q==","license": "MIT","engines": {- "node": ">= 0.6"+ "node": "^18 || ^20 || >= 21"+ }+ },+ "node_modules/node-gyp-build": {+ "version": "4.8.4",+ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",+ "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",+ "license": "MIT",+ "bin": {+ "node-gyp-build": "bin.js",+ "node-gyp-build-optional": "optional.js",+ "node-gyp-build-test": "build-test.js"}},"node_modules/npm-run-path": {@@ -2085,48 +1436,6 @@"url": "https://github.com/sponsors/sindresorhus"}},- "node_modules/object-assign": {- "version": "4.1.1",- "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",- "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",- "license": "MIT",- "engines": {- "node": ">=0.10.0"- }- },- "node_modules/object-inspect": {- "version": "1.13.4",- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",- "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",- "license": "MIT",- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/on-finished": {- "version": "2.4.1",- "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",- "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",- "license": "MIT",- "dependencies": {- "ee-first": "1.1.1"- },- "engines": {- "node": ">= 0.8"- }- },- "node_modules/once": {- "version": "1.4.0",- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",- "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",- "license": "ISC",- "dependencies": {- "wrappy": "1"- }- },"node_modules/onetime": {"version": "6.0.0","resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",@@ -2159,34 +1468,16 @@"url": "https://github.com/sponsors/sindresorhus"}},- "node_modules/parseurl": {- "version": "1.3.3",- "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",- "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },"node_modules/path-key": {"version": "3.1.1","resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz","integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",+ "dev": true,"license": "MIT","engines": {"node": ">=8"}},- "node_modules/path-to-regexp": {- "version": "8.3.0",- "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",- "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",- "license": "MIT",- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },"node_modules/pathe": {"version": "1.1.2","resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",@@ -2209,16 +1500,7 @@"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz","integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==","dev": true,- "license": "ISC"- },- "node_modules/pkce-challenge": {- "version": "5.0.1",- "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz",- "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==",- "license": "MIT",- "engines": {- "node": ">=16.20.0"- }+ "license": "ISC"},"node_modules/pkg-types": {"version": "1.3.1",@@ -2283,58 +1565,6 @@"node": "^14.15.0 || ^16.10.0 || >=18.0.0"}},- "node_modules/proxy-addr": {- "version": "2.0.7",- "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",- "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",- "license": "MIT",- "dependencies": {- "forwarded": "0.2.0",- "ipaddr.js": "1.9.1"- },- "engines": {- "node": ">= 0.10"- }- },- "node_modules/qs": {- "version": "6.15.0",- "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz",- "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==",- "license": "BSD-3-Clause",- "dependencies": {- "side-channel": "^1.1.0"- },- "engines": {- "node": ">=0.6"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/range-parser": {- "version": "1.2.1",- "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",- "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",- "license": "MIT",- "engines": {- "node": ">= 0.6"- }- },- "node_modules/raw-body": {- "version": "3.0.2",- "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",- "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",- "license": "MIT",- "dependencies": {- "bytes": "~3.1.2",- "http-errors": "~2.0.1",- "iconv-lite": "~0.7.0",- "unpipe": "~1.0.0"- },- "engines": {- "node": ">= 0.10"- }- },"node_modules/react-is": {"version": "18.3.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",@@ -2342,15 +1572,6 @@"dev": true,"license": "MIT"},- "node_modules/require-from-string": {- "version": "2.0.2",- "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",- "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",- "license": "MIT",- "engines": {- "node": ">=0.10.0"- }- },"node_modules/resolve-pkg-maps": {"version": "1.0.0","resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",@@ -2406,83 +1627,11 @@"fsevents": "~2.3.2"}},- "node_modules/router": {- "version": "2.2.0",- "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",- "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",- "license": "MIT",- "dependencies": {- "debug": "^4.4.0",- "depd": "^2.0.0",- "is-promise": "^4.0.0",- "parseurl": "^1.3.3",- "path-to-regexp": "^8.0.0"- },- "engines": {- "node": ">= 18"- }- },- "node_modules/safer-buffer": {- "version": "2.1.2",- "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",- "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",- "license": "MIT"- },- "node_modules/send": {- "version": "1.2.1",- "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",- "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",- "license": "MIT",- "dependencies": {- "debug": "^4.4.3",- "encodeurl": "^2.0.0",- "escape-html": "^1.0.3",- "etag": "^1.8.1",- "fresh": "^2.0.0",- "http-errors": "^2.0.1",- "mime-types": "^3.0.2",- "ms": "^2.1.3",- "on-finished": "^2.4.1",- "range-parser": "^1.2.1",- "statuses": "^2.0.2"- },- "engines": {- "node": ">= 18"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/serve-static": {- "version": "2.2.1",- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",- "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",- "license": "MIT",- "dependencies": {- "encodeurl": "^2.0.0",- "escape-html": "^1.0.3",- "parseurl": "^1.3.3",- "send": "^1.2.0"- },- "engines": {- "node": ">= 18"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/setprototypeof": {- "version": "1.2.0",- "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",- "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",- "license": "ISC"- },"node_modules/shebang-command": {"version": "2.0.0","resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz","integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",+ "dev": true,"license": "MIT","dependencies": {"shebang-regex": "^3.0.0"@@ -2495,83 +1644,12 @@"version": "3.0.0","resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz","integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",+ "dev": true,"license": "MIT","engines": {"node": ">=8"}},- "node_modules/side-channel": {- "version": "1.1.0",- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",- "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",- "license": "MIT",- "dependencies": {- "es-errors": "^1.3.0",- "object-inspect": "^1.13.3",- "side-channel-list": "^1.0.0",- "side-channel-map": "^1.0.1",- "side-channel-weakmap": "^1.0.2"- },- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/side-channel-list": {- "version": "1.0.0",- "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",- "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",- "license": "MIT",- "dependencies": {- "es-errors": "^1.3.0",- "object-inspect": "^1.13.3"- },- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/side-channel-map": {- "version": "1.0.1",- "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",- "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",- "license": "MIT",- "dependencies": {- "call-bound": "^1.0.2",- "es-errors": "^1.3.0",- "get-intrinsic": "^1.2.5",- "object-inspect": "^1.13.3"- },- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },- "node_modules/side-channel-weakmap": {- "version": "1.0.2",- "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",- "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",- "license": "MIT",- "dependencies": {- "call-bound": "^1.0.2",- "es-errors": "^1.3.0",- "get-intrinsic": "^1.2.5",- "object-inspect": "^1.13.3",- "side-channel-map": "^1.0.1"- },- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },"node_modules/siginfo": {"version": "2.0.0","resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",@@ -2609,15 +1687,6 @@"dev": true,"license": "MIT"},- "node_modules/statuses": {- "version": "2.0.2",- "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",- "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },"node_modules/std-env": {"version": "3.10.0","resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz",@@ -2678,13 +1747,237 @@"node": ">=14.0.0"}},- "node_modules/toidentifier": {- "version": "1.0.1",- "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",- "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",+ "node_modules/tree-sitter": {+ "version": "0.21.1",+ "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.21.1.tgz",+ "integrity": "sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==",+ "hasInstallScript": true,"license": "MIT",- "engines": {- "node": ">=0.6"+ "peer": true,+ "dependencies": {+ "node-addon-api": "^8.0.0",+ "node-gyp-build": "^4.8.0"+ }+ },+ "node_modules/tree-sitter-c": {+ "version": "0.21.4",+ "resolved": "https://registry.npmjs.org/tree-sitter-c/-/tree-sitter-c-0.21.4.tgz",+ "integrity": "sha512-IahxFIhXiY15SUlrt2upBiKSBGdOaE1fjKLK1Ik5zxqGHf6T1rvr3IJrovbsE5sXhypx7Hnmf50gshsppaIihA==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.0.0",+ "node-gyp-build": "^4.8.1"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.0"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }+ }+ },+ "node_modules/tree-sitter-c-sharp": {+ "version": "0.21.3",+ "resolved": "https://registry.npmjs.org/tree-sitter-c-sharp/-/tree-sitter-c-sharp-0.21.3.tgz",+ "integrity": "sha512-TVsl5EhmqetO/mhzDPVnMK6TPFnpNMKP0OTNuAQIprshk5Hx672ODRxoIoG5WqvUUlsnBu8J0zmn35hmJqelsA==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.0.0",+ "node-gyp-build": "^4.8.1"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.0"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }+ }+ },+ "node_modules/tree-sitter-cpp": {+ "version": "0.22.3",+ "resolved": "https://registry.npmjs.org/tree-sitter-cpp/-/tree-sitter-cpp-0.22.3.tgz",+ "integrity": "sha512-p7w5903L/koqTQFVDwyyX0vjioxoZu2G4zT2ZHVG8DvLQbWN6OjNAqfMsCi+WdVkfMgU+7j06hS8i3j6Q0sPNQ==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.0.0",+ "node-gyp-build": "^4.8.1"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.1"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "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",+ "integrity": "sha512-aMFwjsB948nWhURiIxExK8QX29JYKs96P/IfXVvluVMRJZpL04SREHsdOZHYqJr1whkb7zr3/gWHqqvlkczmvw==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.1.0",+ "node-gyp-build": "^4.8.1"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.0"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }+ }+ },+ "node_modules/tree-sitter-java": {+ "version": "0.21.0",+ "resolved": "https://registry.npmjs.org/tree-sitter-java/-/tree-sitter-java-0.21.0.tgz",+ "integrity": "sha512-CKJiTo1uc3SUsgEcaZgufGx8my6dzihy8JR/JsJH40Tj3uSe2/eFLk+0q+fpbosGAyY4YiXJtEoFB2O4bS2yOw==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.0.0",+ "node-gyp-build": "^4.8.0"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.0"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }+ }+ },+ "node_modules/tree-sitter-javascript": {+ "version": "0.21.4",+ "resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.21.4.tgz",+ "integrity": "sha512-Lrk8yahebwrwc1sWJE9xPcz1OnnqiEV7Dh5fbN6EN3wNAdu9r06HpTqLqDwUUbnG4EB46Sfk+FJFAOldfoKLOw==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.0.0",+ "node-gyp-build": "^4.8.1"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.1"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }+ }+ },+ "node_modules/tree-sitter-php": {+ "version": "0.23.12",+ "resolved": "https://registry.npmjs.org/tree-sitter-php/-/tree-sitter-php-0.23.12.tgz",+ "integrity": "sha512-VwkBVOahhC2NYXK/Fuqq30NxuL/6c2hmbxEF4jrB7AyR5rLc7nT27mzF3qoi+pqx9Gy2AbXnGezF7h4MeM6YRA==",+ "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-python": {+ "version": "0.21.0",+ "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.21.0.tgz",+ "integrity": "sha512-IUKx7JcTVbByUx1iHGFS/QsIjx7pqwTMHL9bl/NGyhyyydbfNrpruo2C7W6V4KZrbkkCOlX8QVrCoGOFW5qecg==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^7.1.0",+ "node-gyp-build": "^4.8.0"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.0"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }+ }+ },+ "node_modules/tree-sitter-python/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"+ },+ "node_modules/tree-sitter-ruby": {+ "version": "0.23.1",+ "resolved": "https://registry.npmjs.org/tree-sitter-ruby/-/tree-sitter-ruby-0.23.1.tgz",+ "integrity": "sha512-d9/RXgWjR6HanN7wTYhS5bpBQLz1VkH048Vm3CodPGyJVnamXMGb8oEhDypVCBq4QnHui9sTXuJBBP3WtCw5RA==",+ "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-rust": {+ "version": "0.21.0",+ "resolved": "https://registry.npmjs.org/tree-sitter-rust/-/tree-sitter-rust-0.21.0.tgz",+ "integrity": "sha512-unVr73YLn3VC4Qa/GF0Nk+Wom6UtI526p5kz9Rn2iZSqwIFedyCZ3e0fKCEmUJLIPGrTb/cIEdu3ZUNGzfZx7A==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^7.1.0",+ "node-gyp-build": "^4.8.0"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.1"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }+ }+ },+ "node_modules/tree-sitter-rust/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"+ },+ "node_modules/tree-sitter-typescript": {+ "version": "0.21.2",+ "resolved": "https://registry.npmjs.org/tree-sitter-typescript/-/tree-sitter-typescript-0.21.2.tgz",+ "integrity": "sha512-/RyNK41ZpkA8PuPZimR6pGLvNR1p0ibRUJwwQn4qAjyyLEIQD/BNlwS3NSxWtGsAWZe9gZ44VK1mWx2+eQVldg==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-addon-api": "^8.0.0",+ "node-gyp-build": "^4.8.1"+ },+ "peerDependencies": {+ "tree-sitter": "^0.21.0"+ },+ "peerDependenciesMeta": {+ "tree_sitter": {+ "optional": true+ }}},"node_modules/tsx": {@@ -2717,20 +2010,6 @@"node": ">=4"}},- "node_modules/type-is": {- "version": "2.0.1",- "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",- "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",- "license": "MIT",- "dependencies": {- "content-type": "^1.0.5",- "media-typer": "^1.1.0",- "mime-types": "^3.0.0"- },- "engines": {- "node": ">= 0.6"- }- },"node_modules/typescript": {"version": "5.9.3","resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",@@ -2759,24 +2038,6 @@"dev": true,"license": "MIT"},- "node_modules/unpipe": {- "version": "1.0.0",- "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",- "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },- "node_modules/vary": {- "version": "1.1.2",- "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",- "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",- "license": "MIT",- "engines": {- "node": ">= 0.8"- }- },"node_modules/vite": {"version": "5.4.21","resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",@@ -3360,6 +2621,7 @@"version": "2.0.2","resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz","integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",+ "dev": true,"license": "ISC","dependencies": {"isexe": "^2.0.0"@@ -3388,12 +2650,6 @@"node": ">=8"}},- "node_modules/wrappy": {- "version": "1.0.2",- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",- "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",- "license": "ISC"- },"node_modules/yaml": {"version": "2.8.2","resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz",@@ -3421,24 +2677,6 @@"funding": {"url": "https://github.com/sponsors/sindresorhus"}- },- "node_modules/zod": {- "version": "4.3.6",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",- "license": "MIT",- "funding": {- "url": "https://github.com/sponsors/colinhacks"- }- },- "node_modules/zod-to-json-schema": {- "version": "3.25.1",- "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz",- "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==",- "license": "ISC",- "peerDependencies": {- "zod": "^3.25 || ^4"- }}}}diff --git a/ix-cli/package.json b/ix-cli/package.jsonindex 30e8ae94..36fa8d52 100644--- a/ix-cli/package.json+++ b/ix-cli/package.json@@ -15,7 +15,19 @@"dependencies": {"commander": "^12.0.0","chalk": "^5.3.0",- "yaml": "^2.4.0"+ "yaml": "^2.4.0",+ "tree-sitter": "^0.21.0",+ "tree-sitter-javascript": "^0.21.0",+ "tree-sitter-typescript": "^0.21.0",+ "tree-sitter-python": "^0.21.0",+ "tree-sitter-java": "^0.21.0",+ "tree-sitter-c": "^0.21.0",+ "tree-sitter-cpp": "^0.22.0",+ "tree-sitter-c-sharp": "^0.21.0",+ "tree-sitter-go": "^0.21.0",+ "tree-sitter-rust": "^0.21.0",+ "tree-sitter-ruby": "^0.23.1",+ "tree-sitter-php": "^0.23.12"},"devDependencies": {"typescript": "^5.4.0",diff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.tsindex 5a43c3c3..1912a83c 100644--- a/ix-cli/src/cli/commands/ingest.ts+++ b/ix-cli/src/cli/commands/ingest.ts@@ -1,11 +1,13 @@-import * as nodePath from "node:path";-import type { Command } from "commander";-import chalk from "chalk";-import { IxClient } from "../../client/api.js";-import type { GraphPatchPayload } from "../../client/types.js";-import { getEndpoint, resolveWorkspaceRoot } from "../config.js";-import { resolveGitHubToken } from "../github/auth.js";-import { parseGitHubRepo, fetchGitHubData } from "../github/fetch.js";+import * as nodePath from 'node:path';+import * as fs from 'node:fs';+import * as crypto from 'node:crypto';+import type { Command } from 'commander';+import chalk from 'chalk';+import { IxClient } from '../../client/api.js';+import type { GraphPatchPayload } from '../../client/types.js';+import { getEndpoint, resolveWorkspaceRoot } from '../config.js';+import { resolveGitHubToken } from '../github/auth.js';+import { parseGitHubRepo, fetchGitHubData } from '../github/fetch.js';import {deterministicId,transformIssue,@@ -13,25 +15,63 @@ import {transformPR,transformPRComment,transformCommit,-} from "../github/transform.js";+} from '../github/transform.js';+import { parseFile } from '../../parser/index.js';+import { buildPatch } from '../../parser/patch-builder.js';+import { languageFromPath } from '../../parser/languages.js';++// ---------------------------------------------------------------------------+// File discovery+// ---------------------------------------------------------------------------++const IGNORE_DIRS = new Set([+ 'node_modules', '.git', 'dist', 'build', 'target', '.next',+ '.cache', '__pycache__', '.ix', '.claude', '.gitnexus',+]);++const MAX_FILE_BYTES = 1024 * 1024; // 1 MB++function* walkFiles(dir: string, recursive: boolean): Generator<string> {+ let entries: fs.Dirent[];+ try { entries = fs.readdirSync(dir, { withFileTypes: true }); }+ catch { return; }++ for (const entry of entries) {+ if (IGNORE_DIRS.has(entry.name)) continue;+ const full = nodePath.join(dir, entry.name);+ if (entry.isDirectory()) {+ if (recursive) yield* walkFiles(full, true);+ } else if (entry.isFile()) {+ if (languageFromPath(entry.name) !== null) yield full;+ }+ }+}++function sha256(content: Buffer): string {+ return crypto.createHash('sha256').update(content).digest('hex');+}++// ---------------------------------------------------------------------------+// Command registration+// ---------------------------------------------------------------------------export function registerIngestCommand(program: Command): void {program- .command("ingest [path]")- .description("Ingest source files or GitHub data into the knowledge graph")- .option("--path <dir>", "Path to ingest (alternative to positional argument)")- .option("--recursive", "Recursively ingest directory")- .option("--github <owner/repo>", "Ingest issues, PRs, and commits from a GitHub repository")- .option("--token <pat>", "GitHub personal access token")- .option("--since <date>", "Only fetch items updated after this date (ISO 8601)")- .option("--limit <n>", "Max items per category (default 50)", "50")- .option("--force", "Force re-ingest even if files are unchanged (useful after parser upgrades)")- .option("--format <fmt>", "Output format (text|json)", "text")- .option("--root <dir>", "Workspace root directory")- .addHelpText("after", "\nExamples:\n ix ingest ./src --recursive\n ix ingest --path ./src --recursive --force\n ix ingest --github owner/repo\n ix ingest --github owner/repo --since 2026-01-01 --limit 20 --format json\n ix ingest --github owner/repo --token ghp_xxxx")+ .command('ingest [path]')+ .description('Ingest source files or GitHub data into the knowledge graph')+ .option('--path <dir>', 'Path to ingest (alternative to positional argument)')+ .option('--recursive', 'Recursively ingest directory')+ .option('--github <owner/repo>', 'Ingest issues, PRs, and commits from a GitHub repository')+ .option('--token <pat>', 'GitHub personal access token')+ .option('--since <date>', 'Only fetch items updated after this date (ISO 8601)')+ .option('--limit <n>', 'Max items per category (default 50)', '50')+ .option('--force', 'Force re-ingest even if files are unchanged (useful after parser upgrades)')+ .option('--format <fmt>', 'Output format (text|json)', 'text')+ .option('--root <dir>', 'Workspace root directory')+ .addHelpText('after', '\nExamples:\n ix ingest ./src --recursive\n ix ingest --path ./src --recursive --force\n ix ingest --github owner/repo\n ix ingest --github owner/repo --since 2026-01-01 --limit 20 --format json\n ix ingest --github owner/repo --token ghp_xxxx').action(async (positionalPath: string | undefined, opts: {path?: string; recursive?: boolean; force?: boolean; github?: string; token?: string;- since?: string; limit: string; format: string; root?: string+ since?: string; limit: string; format: string; root?: string;}) => {const effectivePath = positionalPath ?? opts.path;if (opts.github) {@@ -39,12 +79,16 @@ export function registerIngestCommand(program: Command): void {} else if (effectivePath) {await ingestFiles(effectivePath, opts);} else {- console.error("Error: provide a <path> or use --github <owner/repo>");+ console.error('Error: provide a <path> or use --github <owner/repo>');process.exit(1);}});}+// ---------------------------------------------------------------------------+// File ingestion — parse locally, send via /v1/patch+// ---------------------------------------------------------------------------+async function ingestFiles(path: string,opts: { recursive?: boolean; force?: boolean; format: string; root?: string }@@ -52,57 +96,124 @@ async function ingestFiles(const resolvedPath = nodePath.isAbsolute(path)? path: nodePath.resolve(resolveWorkspaceRoot(opts.root), path);+const client = new IxClient(getEndpoint());const start = performance.now();- const spinner = ["\u28CB", "\u28D9", "\u28F9", "\u28F8", "\u28FC", "\u28F4", "\u28E6", "\u28E7", "\u28C7", "\u28CF"];+ const spinner = ['\u28CB', '\u28D9', '\u28F9', '\u28F8', '\u28FC', '\u28F4', '\u28E6', '\u28E7', '\u28C7', '\u28CF'];let spinIdx = 0;- const interval = opts.format === "text" ? setInterval(() => {+ const interval = opts.format === 'text' ? setInterval(() => {const elapsed = ((performance.now() - start) / 1000).toFixed(0);process.stderr.write(`\r${spinner[spinIdx++ % spinner.length]} Ingesting... ${elapsed}s`);}, 200) : null;+ let filesDiscovered = 0;+ let patchesApplied = 0;+ let filesSkipped = 0;+ let parseErrors = 0;+ let tooLarge = 0;+ let latestRev = 0;+try {- const result = await client.ingest(resolvedPath, opts.recursive, opts.force);+ // Collect files+ const stat = fs.statSync(resolvedPath);+ const filePaths: string[] = stat.isFile()+ ? [resolvedPath]+ : Array.from(walkFiles(resolvedPath, opts.recursive ?? false));++ filesDiscovered = filePaths.length;++ // Load existing source hashes for change detection (unless --force)+ const knownHashes = opts.force ? new Map<string, string>() : await loadExistingHashes(client, filePaths);++ for (const filePath of filePaths) {+ try {+ const fileSize = fs.statSync(filePath).size;+ if (fileSize === 0) { filesSkipped++; continue; }+ if (fileSize > MAX_FILE_BYTES) { tooLarge++; continue; }++ const bytes = fs.readFileSync(filePath);+ const hash = sha256(bytes);++ if (!opts.force && knownHashes.get(filePath) === hash) {+ filesSkipped++;+ continue;+ }++ const source = bytes.toString('utf-8');+ const parsed = parseFile(filePath, source);++ if (!parsed) {+ // Unsupported file type — skip silently+ filesSkipped++;+ continue;+ }++ const patch = buildPatch(parsed, hash);+ const result = await client.commitPatch(patch);+ if (result.rev > latestRev) latestRev = result.rev;+ patchesApplied++;+ } catch {+ parseErrors++;+ }+ }+ } finally {if (interval) {clearInterval(interval);- process.stderr.write("\r" + " ".repeat(40) + "\r");+ process.stderr.write('\r' + ' '.repeat(40) + '\r');}- const elapsed = ((performance.now() - start) / 1000).toFixed(2);-- if (opts.format === "json") {- console.log(JSON.stringify({ ...result, elapsedSeconds: parseFloat(elapsed) }, null, 2));- } else {- console.log(chalk.bold("\nIngest summary"));- console.log(` processed: ${result.patchesApplied} files (${elapsed}s)`);- console.log(` discovered: ${result.filesProcessed} files`);- if (result.skipReasons) {- const sr = result.skipReasons;- if (sr.unchanged > 0) console.log(` ${chalk.dim("skipped unchanged:")} ${sr.unchanged}`);- if (sr.emptyFile > 0) console.log(` ${chalk.dim("skipped empty:")} ${sr.emptyFile}`);- if (sr.parseError > 0) console.log(` ${chalk.red("parse errors:")} ${sr.parseError}`);- if (sr.tooLarge > 0) console.log(` ${chalk.dim("skipped too large:")} ${sr.tooLarge}`);- } else if (result.filesSkipped) {- console.log(` ${chalk.dim("skipped:")} ${result.filesSkipped} unchanged files`);- }- console.log(` rev: ${result.latestRev}`);+ }- if (result.patchesApplied === 0 && result.filesProcessed === 0) {- console.log(chalk.yellow("\n Warning: No files ingested. The path may be outside the project root,"));- console.log(chalk.yellow(" contain no supported file types, or not exist."));- } else if (result.patchesApplied === 0 && result.filesProcessed > 0) {- console.log(chalk.dim("\n All files unchanged since last ingest."));- }- console.log();+ const elapsed = ((performance.now() - start) / 1000).toFixed(2);++ if (opts.format === 'json') {+ console.log(JSON.stringify({+ filesProcessed: filesDiscovered,+ patchesApplied,+ filesSkipped,+ entitiesCreated: 0,+ latestRev,+ skipReasons: { unchanged: filesSkipped, emptyFile: 0, parseError: parseErrors, tooLarge },+ elapsedSeconds: parseFloat(elapsed),+ }, null, 2));+ } else {+ console.log(chalk.bold('\nIngest summary'));+ console.log(` processed: ${patchesApplied} files (${elapsed}s)`);+ console.log(` discovered: ${filesDiscovered} files`);+ if (filesSkipped > 0) console.log(` ${chalk.dim('skipped unchanged:')} ${filesSkipped}`);+ if (parseErrors > 0) console.log(` ${chalk.red('parse errors:')} ${parseErrors}`);+ if (tooLarge > 0) console.log(` ${chalk.dim('skipped too large:')} ${tooLarge}`);+ console.log(` rev: ${latestRev}`);++ if (patchesApplied === 0 && filesDiscovered === 0) {+ console.log(chalk.yellow('\n Warning: No files found. Check the path and supported extensions.'));+ } else if (patchesApplied === 0 && filesDiscovered > 0) {+ console.log(chalk.dim('\n All files unchanged since last ingest.'));}- } finally {- if (interval) clearInterval(interval);+ console.log();}}+// ---------------------------------------------------------------------------+// Load existing hashes from the server for change detection+// ---------------------------------------------------------------------------++async function loadExistingHashes(client: IxClient, filePaths: string[]): Promise<Map<string, string>> {+ try {+ const hashes = await (client as any).getSourceHashes(filePaths);+ return new Map(Object.entries(hashes ?? {}));+ } catch {+ return new Map();+ }+}++// ---------------------------------------------------------------------------+// GitHub ingestion (unchanged)+// ---------------------------------------------------------------------------+async function ingestGitHub(opts: {github?: string; token?: string; since?: string;- limit: string; format: string+ limit: string; format: string;}): Promise<void> {const repo = parseGitHubRepo(opts.github!);const token = await resolveGitHubToken(opts.token);@@ -112,42 +223,31 @@ async function ingestGitHub(opts: {const since = opts.since ?? new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);- if (opts.format !== "json") {+ if (opts.format !== 'json') {process.stderr.write(`Fetching from ${repo.owner}/${repo.repo} (since ${since})...\n`);}const data = await fetchGitHubData(repo, token, { since, limit });const allOps: any[] = [];-- for (const issue of data.issues) {- allOps.push(...transformIssue(repo, issue));- }+ for (const issue of data.issues) allOps.push(...transformIssue(repo, issue));for (const [issueNum, comments] of data.issueComments) {- for (const comment of comments) {- allOps.push(...transformIssueComment(repo, issueNum, comment));- }- }- for (const pr of data.pullRequests) {- allOps.push(...transformPR(repo, pr));+ for (const comment of comments) allOps.push(...transformIssueComment(repo, issueNum, comment));}+ for (const pr of data.pullRequests) allOps.push(...transformPR(repo, pr));for (const [prNum, comments] of data.prComments) {- for (const comment of comments) {- allOps.push(...transformPRComment(repo, prNum, comment));- }- }- for (const commit of data.commits) {- allOps.push(...transformCommit(repo, commit));+ for (const comment of comments) allOps.push(...transformPRComment(repo, prNum, comment));}+ for (const commit of data.commits) allOps.push(...transformCommit(repo, commit));const patch: GraphPatchPayload = {patchId: deterministicId(`github://${repo.owner}/${repo.repo}:${since}:${Date.now()}`),- actor: "ix/github-ingest",+ actor: 'ix/github-ingest',timestamp: new Date().toISOString(),source: {uri: `github://${repo.owner}/${repo.repo}`,- extractor: "github-ingest/1.0",- sourceType: "comment",+ extractor: 'github-ingest/1.0',+ sourceType: 'comment',},baseRev: 0,ops: allOps,@@ -158,29 +258,23 @@ async function ingestGitHub(opts: {const result = await client.commitPatch(patch);const elapsed = ((performance.now() - start) / 1000).toFixed(2);- if (opts.format === "json") {+ if (opts.format === 'json') {console.log(JSON.stringify({source: `${repo.owner}/${repo.repo}`,issues: data.issues.length,pullRequests: data.pullRequests.length,commits: data.commits.length,- issueComments: [...data.issueComments.values()].reduce((s, c) => s + c.length, 0),- prComments: [...data.prComments.values()].reduce((s, c) => s + c.length, 0),totalOps: allOps.length,rev: result.rev,status: result.status,elapsedSeconds: parseFloat(elapsed),}, null, 2));} else {- console.log(chalk.bold("\nGitHub ingest summary"));+ console.log(chalk.bold('\nGitHub ingest summary'));console.log(` repo: ${repo.owner}/${repo.repo}`);console.log(` issues: ${data.issues.length}`);console.log(` pull requests: ${data.pullRequests.length}`);console.log(` commits: ${data.commits.length}`);- const issueCommentCount = [...data.issueComments.values()].reduce((s, c) => s + c.length, 0);- const prCommentCount = [...data.prComments.values()].reduce((s, c) => s + c.length, 0);- if (issueCommentCount > 0) console.log(` issue comments: ${issueCommentCount}`);- if (prCommentCount > 0) console.log(` PR comments: ${prCommentCount}`);console.log(` total ops: ${allOps.length}`);console.log(` rev: ${result.rev}`);console.log(` elapsed: ${elapsed}s`);diff --git a/ix-cli/src/cli/commands/watch.ts b/ix-cli/src/cli/commands/watch.tsindex 86963b32..6698c5d9 100644--- a/ix-cli/src/cli/commands/watch.ts+++ b/ix-cli/src/cli/commands/watch.ts@@ -5,14 +5,15 @@ import type { Command } from "commander";import chalk from "chalk";import { IxClient } from "../../client/api.js";import { getEndpoint, resolveWorkspaceRoot } from "../config.js";+import { parseFile } from "../../parser/index.js";+import { buildPatch } from "../../parser/patch-builder.js";+import { languageFromPath } from "../../parser/languages.js";const SUPPORTED_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs",".scala", ".sc", ".java",- ".py", ".rb", ".go", ".rs",- ".md", ".mdx",- ".json", ".yaml", ".yml", ".toml",- ".sql", ".graphql", ".gql",+ ".py", ".rb", ".go", ".rs", ".kt", ".kts", ".cs", ".php", ".swift",+ ".c", ".h", ".cpp", ".cc", ".cxx", ".hpp",]);const SUPPORTED_NAMES = new Set([@@ -104,13 +105,15 @@ export function registerWatchCommand(program: Command): void {}try {- const result = await client.ingest(filePath, false);- lastHash.set(filePath, hash);- if (result.patchesApplied > 0) {- console.log(`${chalk.cyan("[watch]")} ingested: ${chalk.bold(rel)} → rev ${result.latestRev}`);- } else {- console.log(`${chalk.dim("[watch]")} unchanged: ${rel}`);+ const parsed = parseFile(filePath, content);+ if (!parsed) {+ console.log(`${chalk.dim("[watch]")} skipped (unsupported): ${rel}`);+ return;}+ const patch = buildPatch(parsed, hash);+ const result = await client.commitPatch(patch);+ lastHash.set(filePath, hash);+ console.log(`${chalk.cyan("[watch]")} ingested: ${chalk.bold(rel)} → rev ${result.rev}`);} catch (err: any) {console.error(`${chalk.red("[watch]")} error ingesting ${rel}: ${err.message}`);}@@ -219,12 +222,14 @@ async function pollMode(const rel = path.relative(root, f);console.log(`${chalk.dim("[watch]")} changed: ${rel}`);try {- const result = await client.ingest(f, false);- if (result.patchesApplied > 0) {- console.log(`${chalk.cyan("[watch]")} ingested: ${chalk.bold(rel)} → rev ${result.latestRev}`);- } else {- console.log(`${chalk.dim("[watch]")} unchanged: ${rel}`);- }+ const content = readFileContent(f);+ if (!content) continue;+ const parsed = parseFile(f, content);+ if (!parsed) continue;+ const hash = hashContent(content);+ const patch = buildPatch(parsed, hash);+ const result = await client.commitPatch(patch);+ console.log(`${chalk.cyan("[watch]")} ingested: ${chalk.bold(rel)} → rev ${result.rev}`);} catch (err: any) {console.error(`${chalk.red("[watch]")} error: ${err.message}`);}diff --git a/ix-cli/src/parser/index.ts b/ix-cli/src/parser/index.tsnew file mode 100644index 00000000..cdaa88ed--- /dev/null+++ b/ix-cli/src/parser/index.ts@@ -0,0 +1,304 @@+import * as nodePath from 'node:path';+// @ts-ignore — tree-sitter has no bundled types+import Parser from 'tree-sitter';+// @ts-ignore+import JavaScript from 'tree-sitter-javascript';+// @ts-ignore+import TypeScript from 'tree-sitter-typescript';+// @ts-ignore+import Python from 'tree-sitter-python';+// @ts-ignore+import Java from 'tree-sitter-java';+// @ts-ignore+import C from 'tree-sitter-c';+// @ts-ignore+import CPP from 'tree-sitter-cpp';+// @ts-ignore+import CSharp from 'tree-sitter-c-sharp';+// @ts-ignore+import Go from 'tree-sitter-go';+// @ts-ignore+import Rust from 'tree-sitter-rust';+// @ts-ignore+import Ruby from 'tree-sitter-ruby';+// @ts-ignore+import PHP from 'tree-sitter-php';++import { SupportedLanguages, languageFromPath } from './languages.js';+import { LANGUAGE_QUERIES } from './queries.js';++// ---------------------------------------------------------------------------+// Public types+// ---------------------------------------------------------------------------++export interface ParsedEntity {+ name: string;+ kind: string; // NodeKind string: "class", "function", "method", etc.+ lineStart: number;+ lineEnd: number;+ language: string;+}++export interface ParsedRelationship {+ srcName: string;+ dstName: string;+ predicate: string; // "CONTAINS" | "CALLS" | "IMPORTS" | "EXTENDS"+}++export interface FileParseResult {+ filePath: string;+ language: SupportedLanguages;+ entities: ParsedEntity[];+ relationships: ParsedRelationship[];+}++// ---------------------------------------------------------------------------+// Language → grammar map+// ---------------------------------------------------------------------------++const GRAMMAR_MAP: Partial<Record<SupportedLanguages, any>> = {+ [SupportedLanguages.JavaScript]: JavaScript,+ [SupportedLanguages.TypeScript]: TypeScript.typescript,+ [SupportedLanguages.Python]: Python,+ [SupportedLanguages.Java]: Java,+ [SupportedLanguages.C]: C,+ [SupportedLanguages.CPlusPlus]: CPP,+ [SupportedLanguages.CSharp]: CSharp,+ [SupportedLanguages.Go]: Go,+ [SupportedLanguages.Rust]: Rust,+ [SupportedLanguages.Ruby]: Ruby,+ [SupportedLanguages.PHP]: PHP.php_only,+};++// Capture key prefix → NodeKind string+const DEFINITION_KIND_MAP: Record<string, string> = {+ 'definition.class': 'class',+ 'definition.interface': 'interface',+ 'definition.function': 'function',+ 'definition.method': 'method',+ 'definition.struct': 'class',+ 'definition.enum': 'class',+ 'definition.trait': 'trait',+ 'definition.module': 'module',+ 'definition.namespace': 'module',+ 'definition.impl': 'class',+ 'definition.type': 'class',+ 'definition.property': 'function',+ 'definition.const': 'function',+ 'definition.static': 'function',+ 'definition.macro': 'function',+ 'definition.union': 'class',+ 'definition.typedef': 'class',+ 'definition.template': 'class',+ 'definition.record': 'class',+ 'definition.delegate': 'class',+ 'definition.annotation':'class',+ 'definition.constructor':'method',+};++// Builtins to exclude from CALLS edges+const BUILTINS = new Set([+ 'print', 'println', 'len', 'range', 'int', 'str', 'float', 'list', 'dict',+ 'set', 'tuple', 'type', 'isinstance', 'super', 'property', 'enumerate',+ 'zip', 'map', 'filter', 'sorted', 'any', 'all', 'min', 'max', 'sum',+ 'console', 'log', 'warn', 'error', 'debug', 'info',+ 'require', 'module', 'exports', 'undefined', 'null', 'true', 'false',+ 'if', 'for', 'while', 'return', 'new', 'this', 'self',+ 'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean', 'JSON',+ 'Math', 'Date', 'Error', 'Map', 'Set', 'Symbol',+ 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',+ 'process', 'Buffer', 'global', 'window', 'document',+]);++// ---------------------------------------------------------------------------+// Parser instance (reused across calls)+// ---------------------------------------------------------------------------++let _parser: Parser | null = null;++function getParser(): Parser {+ if (!_parser) _parser = new Parser();+ return _parser;+}++// ---------------------------------------------------------------------------+// Main parse function+// ---------------------------------------------------------------------------++export function parseFile(filePath: string, source: string): FileParseResult | null {+ const language = languageFromPath(filePath);+ if (!language) return null;++ // TypeScript TSX uses a separate grammar+ const isTsx = filePath.endsWith('.tsx');+ const grammar = isTsx ? TypeScript.tsx : GRAMMAR_MAP[language];+ if (!grammar) return null;++ const queries = LANGUAGE_QUERIES[language];+ if (!queries) return null;++ try {+ const parser = getParser();+ parser.setLanguage(grammar);+ const tree = parser.parse(source);+ const query = grammar.query(queries);+ const matches = query.matches(tree.rootNode);++ const fileName = nodePath.basename(filePath);+ const lines = source.split('\n');++ const entities: ParsedEntity[] = [+ { name: fileName, kind: 'file', lineStart: 1, lineEnd: lines.length, language },+ ];+ const relationships: ParsedRelationship[] = [];++ // Track class ranges for containment: [name, startLine, endLine]+ const classRanges: Array<{ name: string; start: number; end: number }> = [];+ // Track seen calls per enclosing scope to avoid duplicate CALLS edges+ const seenCalls = new Map<string, Set<string>>();++ // --- First pass: collect definitions ---+ for (const match of matches) {+ const captureNames = match.captures.map((c: any) => c.name);++ // Definition captures: name + definition.*+ const defCapture = match.captures.find((c: any) =>+ c.name.startsWith('definition.')+ );+ const nameCapture = match.captures.find((c: any) => c.name === 'name');++ if (defCapture && nameCapture) {+ const kind = DEFINITION_KIND_MAP[defCapture.name] ?? 'function';+ const name = nameCapture.node.text;+ if (!name || name.length === 0) continue;++ const defNode = defCapture.node;+ const lineStart = defNode.startPosition.row + 1;+ const lineEnd = defNode.endPosition.row + 1;++ entities.push({ name, kind, lineStart, lineEnd, language });++ if (kind === 'class' || kind === 'interface' || kind === 'trait') {+ classRanges.push({ name, start: lineStart, end: lineEnd });+ }++ // Containment: file CONTAINS or class CONTAINS+ const enclosing = findEnclosing(classRanges, lineStart, name);+ if (enclosing) {+ relationships.push({ srcName: enclosing, dstName: name, predicate: 'CONTAINS' });+ } else {+ relationships.push({ srcName: fileName, dstName: name, predicate: 'CONTAINS' });+ }+ continue;+ }++ // Heritage: EXTENDS+ const heritageClass = match.captures.find((c: any) =>+ c.name === 'heritage.class'+ );+ const heritageExtends = match.captures.find((c: any) =>+ c.name === 'heritage.extends' || c.name === 'heritage.trait'+ );+ if (heritageClass && heritageExtends) {+ relationships.push({+ srcName: heritageClass.node.text,+ dstName: heritageExtends.node.text,+ predicate: 'EXTENDS',+ });+ continue;+ }++ // Heritage: IMPLEMENTS (separate edge type, use EXTENDS for simplicity)+ const heritageImpl = match.captures.find((c: any) =>+ c.name === 'heritage.implements'+ );+ if (heritageClass && heritageImpl) {+ relationships.push({+ srcName: heritageClass.node.text,+ dstName: heritageImpl.node.text,+ predicate: 'EXTENDS',+ });+ continue;+ }+ }++ // --- Second pass: calls and imports ---+ for (const match of matches) {+ // Import captures+ const importSource = match.captures.find((c: any) => c.name === 'import.source');+ if (importSource) {+ let importPath = importSource.node.text+ .replace(/^["'`]|["'`]$/g, '') // strip quotes+ .replace(/\\\\/g, '/'); // normalise backslashes+ if (importPath.length > 0) {+ const modName = importPath.split('/').pop() ?? importPath;+ entities.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' });+ }+ continue;+ }++ // Call captures+ const callName = match.captures.find((c: any) => c.name === 'call.name');+ if (callName) {+ const callee = callName.node.text;+ if (!callee || BUILTINS.has(callee) || callee.length <= 1) continue;++ // Find enclosing function/method for the call+ const callLine = callName.node.startPosition.row + 1;+ const caller = findEnclosingFunction(entities, callLine) ?? fileName;++ const scope = caller;+ if (!seenCalls.has(scope)) seenCalls.set(scope, new Set());+ const seen = seenCalls.get(scope)!;+ if (!seen.has(callee)) {+ seen.add(callee);+ relationships.push({ srcName: caller, dstName: callee, predicate: 'CALLS' });+ }+ continue;+ }+ }++ return { filePath, language, entities, relationships };+ } catch {+ return null;+ }+}++// ---------------------------------------------------------------------------+// Helpers+// ---------------------------------------------------------------------------++function findEnclosing(+ ranges: Array<{ name: string; start: number; end: number }>,+ line: number,+ excludeName: string+): string | null {+ // Find the innermost class/interface that contains this line+ let best: { name: string; start: number; end: number } | null = null;+ for (const r of ranges) {+ if (r.name === excludeName) continue;+ if (line >= r.start && line <= r.end) {+ if (!best || (r.end - r.start) < (best.end - best.start)) {+ best = r;+ }+ }+ }+ return best?.name ?? null;+}++function findEnclosingFunction(+ entities: ParsedEntity[],+ line: number+): string | null {+ let best: ParsedEntity | null = null;+ for (const e of entities) {+ if (e.kind !== 'function' && e.kind !== 'method') continue;+ if (line >= e.lineStart && line <= e.lineEnd) {+ if (!best || (e.lineEnd - e.lineStart) < (best.lineEnd - best.lineStart)) {+ best = e;+ }+ }+ }+ return best?.name ?? null;+}diff --git a/ix-cli/src/parser/languages.ts b/ix-cli/src/parser/languages.tsnew file mode 100644index 00000000..f8d76c14--- /dev/null+++ b/ix-cli/src/parser/languages.ts@@ -0,0 +1,45 @@+export enum SupportedLanguages {+ JavaScript = 'javascript',+ TypeScript = 'typescript',+ Python = 'python',+ Java = 'java',+ C = 'c',+ CPlusPlus = 'cpp',+ CSharp = 'csharp',+ Go = 'go',+ Ruby = 'ruby',+ Rust = 'rust',+ PHP = 'php',+ Kotlin = 'kotlin',+ Swift = 'swift',+}++const EXT_MAP: Record<string, SupportedLanguages> = {+ '.ts': SupportedLanguages.TypeScript,+ '.tsx': SupportedLanguages.TypeScript,+ '.js': SupportedLanguages.JavaScript,+ '.jsx': SupportedLanguages.JavaScript,+ '.mjs': SupportedLanguages.JavaScript,+ '.cjs': SupportedLanguages.JavaScript,+ '.py': SupportedLanguages.Python,+ '.java': SupportedLanguages.Java,+ '.c': SupportedLanguages.C,+ '.h': SupportedLanguages.C,+ '.cpp': SupportedLanguages.CPlusPlus,+ '.cc': SupportedLanguages.CPlusPlus,+ '.cxx': SupportedLanguages.CPlusPlus,+ '.hpp': SupportedLanguages.CPlusPlus,+ '.cs': SupportedLanguages.CSharp,+ '.go': SupportedLanguages.Go,+ '.rb': SupportedLanguages.Ruby,+ '.rs': SupportedLanguages.Rust,+ '.php': SupportedLanguages.PHP,+ '.kt': SupportedLanguages.Kotlin,+ '.kts': SupportedLanguages.Kotlin,+ '.swift':SupportedLanguages.Swift,+};++export function languageFromPath(filePath: string): SupportedLanguages | null {+ const ext = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();+ return EXT_MAP[ext] ?? null;+}diff --git a/ix-cli/src/parser/patch-builder.ts b/ix-cli/src/parser/patch-builder.tsnew file mode 100644index 00000000..161e3d62--- /dev/null+++ b/ix-cli/src/parser/patch-builder.ts@@ -0,0 +1,111 @@+import * as crypto from 'node:crypto';+import * as nodePath from 'node:path';+import type { GraphPatchPayload, PatchOp } from '../client/types.js';+import type { FileParseResult } from './index.js';++// ---------------------------------------------------------------------------+// Deterministic UUID from a string (matches existing CLI convention)+// ---------------------------------------------------------------------------++function deterministicId(input: string): string {+ const hash = crypto.createHash('sha256').update(input).digest('hex');+ return [+ hash.slice(0, 8),+ hash.slice(8, 12),+ hash.slice(12, 16),+ hash.slice(16, 20),+ hash.slice(20, 32),+ ].join('-');+}++function nodeId(filePath: string, name: string): string {+ return deterministicId(`${filePath}:${name}`);+}++function edgeId(filePath: string, src: string, dst: string, predicate: string): string {+ return deterministicId(`${filePath}:${src}:${dst}:${predicate}`);+}++// ---------------------------------------------------------------------------+// Source type from file extension+// ---------------------------------------------------------------------------++function sourceType(filePath: string): string {+ const ext = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();+ if (['.json', '.yaml', '.yml', '.toml', '.ini', '.conf', '.env'].includes(ext)) return 'config';+ if (['.md', '.mdx', '.rst', '.txt'].includes(ext)) return 'doc';+ return 'code';+}++function extractorName(filePath: string): string {+ return `tree-sitter/1.0`;+}++// ---------------------------------------------------------------------------+// Build a GraphPatchPayload from a FileParseResult+// ---------------------------------------------------------------------------++export function buildPatch(+ result: FileParseResult,+ sourceHash: string,+ previousPatchId?: string+): GraphPatchPayload {+ const { filePath, entities, relationships } = result;+ const ops: PatchOp[] = [];++ // UpsertNode for each entity+ for (const e of entities) {+ ops.push({+ type: 'UpsertNode',+ id: nodeId(filePath, e.name),+ kind: e.kind,+ name: e.name,+ attrs: {+ line_start: e.lineStart,+ line_end: e.lineEnd,+ language: e.language,+ },+ });+ }++ // UpsertEdge for each relationship+ for (const r of relationships) {+ ops.push({+ type: 'UpsertEdge',+ id: edgeId(filePath, r.srcName, r.dstName, r.predicate),+ src: nodeId(filePath, r.srcName),+ dst: nodeId(filePath, r.dstName),+ predicate: r.predicate,+ attrs: {},+ });+ }++ // AssertClaim for each relationship (feeds the confidence/conflict engine)+ for (const r of relationships) {+ ops.push({+ type: 'AssertClaim',+ entityId: nodeId(filePath, r.srcName),+ field: `${r.predicate.toLowerCase()}:${r.dstName}`,+ value: r.dstName,+ confidence: null,+ });+ }++ const patchId = deterministicId(`${filePath}:${sourceHash}:${Date.now()}`);++ return {+ patchId,+ actor: 'ix/ingestion',+ timestamp: new Date().toISOString(),+ source: {+ uri: filePath,+ sourceHash,+ extractor: extractorName(filePath),+ sourceType: sourceType(filePath),+ },+ baseRev: 0,+ ops,+ replaces: previousPatchId ? [previousPatchId] : [],+ intent: `Parsed ${nodePath.basename(filePath)}`,+ };+}diff --git a/ix-cli/src/parser/queries.ts b/ix-cli/src/parser/queries.tsnew file mode 100644index 00000000..80aef5fc--- /dev/null+++ b/ix-cli/src/parser/queries.ts@@ -0,0 +1,704 @@+import { SupportedLanguages } from './languages.js';++/*+ * Tree-sitter queries for extracting code definitions.+ *+ * Note: Different grammars (typescript vs tsx vs javascript) may have+ * slightly different node types. These queries are designed to be+ * compatible with the standard tree-sitter grammars.+ */++// TypeScript queries - works with tree-sitter-typescript+export const TYPESCRIPT_QUERIES = `+(class_declaration+ name: (type_identifier) @name) @definition.class++(interface_declaration+ name: (type_identifier) @name) @definition.interface++(function_declaration+ name: (identifier) @name) @definition.function++(method_definition+ name: (property_identifier) @name) @definition.method++(lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (arrow_function))) @definition.function++(lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (function_expression))) @definition.function++(export_statement+ declaration: (lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (arrow_function)))) @definition.function++(export_statement+ declaration: (lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (function_expression)))) @definition.function++(import_statement+ source: (string) @import.source) @import++; Re-export statements: export { X } from './y'+(export_statement+ source: (string) @import.source) @import++(call_expression+ function: (identifier) @call.name) @call++(call_expression+ function: (member_expression+ property: (property_identifier) @call.name)) @call++; Constructor calls: new Foo()+(new_expression+ constructor: (identifier) @call.name) @call++; Heritage queries - class extends+(class_declaration+ name: (type_identifier) @heritage.class+ (class_heritage+ (extends_clause+ value: (identifier) @heritage.extends))) @heritage++; Heritage queries - class implements interface+(class_declaration+ name: (type_identifier) @heritage.class+ (class_heritage+ (implements_clause+ (type_identifier) @heritage.implements))) @heritage.impl+`;++// JavaScript queries - works with tree-sitter-javascript+export const JAVASCRIPT_QUERIES = `+(class_declaration+ name: (identifier) @name) @definition.class++(function_declaration+ name: (identifier) @name) @definition.function++(method_definition+ name: (property_identifier) @name) @definition.method++(lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (arrow_function))) @definition.function++(lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (function_expression))) @definition.function++(export_statement+ declaration: (lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (arrow_function)))) @definition.function++(export_statement+ declaration: (lexical_declaration+ (variable_declarator+ name: (identifier) @name+ value: (function_expression)))) @definition.function++(import_statement+ source: (string) @import.source) @import++; Re-export statements: export { X } from './y'+(export_statement+ source: (string) @import.source) @import++(call_expression+ function: (identifier) @call.name) @call++(call_expression+ function: (member_expression+ property: (property_identifier) @call.name)) @call++; Constructor calls: new Foo()+(new_expression+ constructor: (identifier) @call.name) @call++; Heritage queries - class extends (JavaScript uses different AST than TypeScript)+; In tree-sitter-javascript, class_heritage directly contains the parent identifier+(class_declaration+ name: (identifier) @heritage.class+ (class_heritage+ (identifier) @heritage.extends)) @heritage+`;++// Python queries - works with tree-sitter-python+export const PYTHON_QUERIES = `+(class_definition+ name: (identifier) @name) @definition.class++(function_definition+ name: (identifier) @name) @definition.function++(import_statement+ name: (dotted_name) @import.source) @import++(import_from_statement+ module_name: (dotted_name) @import.source) @import++(import_from_statement+ module_name: (relative_import) @import.source) @import++(call+ function: (identifier) @call.name) @call++(call+ function: (attribute+ attribute: (identifier) @call.name)) @call++; Heritage queries - Python class inheritance+(class_definition+ name: (identifier) @heritage.class+ superclasses: (argument_list+ (identifier) @heritage.extends)) @heritage+`;++// Java queries - works with tree-sitter-java+export const JAVA_QUERIES = `+; Classes, Interfaces, Enums, Annotations+(class_declaration name: (identifier) @name) @definition.class+(interface_declaration name: (identifier) @name) @definition.interface+(enum_declaration name: (identifier) @name) @definition.enum+(annotation_type_declaration name: (identifier) @name) @definition.annotation++; Methods & Constructors+(method_declaration name: (identifier) @name) @definition.method+(constructor_declaration name: (identifier) @name) @definition.constructor++; Imports - capture any import declaration child as source+(import_declaration (_) @import.source) @import++; Calls+(method_invocation name: (identifier) @call.name) @call+(method_invocation object: (_) name: (identifier) @call.name) @call++; Constructor calls: new Foo()+(object_creation_expression type: (type_identifier) @call.name) @call++; Heritage - extends class+(class_declaration name: (identifier) @heritage.class+ (superclass (type_identifier) @heritage.extends)) @heritage++; Heritage - implements interfaces+(class_declaration name: (identifier) @heritage.class+ (super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl+`;++// C queries - works with tree-sitter-c+export const C_QUERIES = `+; Functions (direct declarator)+(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function+(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function++; Functions returning pointers (pointer_declarator wraps function_declarator)+(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function+(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function++; Functions returning double pointers (nested pointer_declarator)+(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function++; Structs, Unions, Enums, Typedefs+(struct_specifier name: (type_identifier) @name) @definition.struct+(union_specifier name: (type_identifier) @name) @definition.union+(enum_specifier name: (type_identifier) @name) @definition.enum+(type_definition declarator: (type_identifier) @name) @definition.typedef++; Macros+(preproc_function_def name: (identifier) @name) @definition.macro+(preproc_def name: (identifier) @name) @definition.macro++; Includes+(preproc_include path: (_) @import.source) @import++; Calls+(call_expression function: (identifier) @call.name) @call+(call_expression function: (field_expression field: (field_identifier) @call.name)) @call+`;++// Go queries - works with tree-sitter-go+export const GO_QUERIES = `+; Functions & Methods+(function_declaration name: (identifier) @name) @definition.function+(method_declaration name: (field_identifier) @name) @definition.method++; Types+(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @definition.struct+(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @definition.interface++; Imports+(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import+(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import++; Struct embedding (anonymous fields = inheritance)+(type_declaration+ (type_spec+ name: (type_identifier) @heritage.class+ type: (struct_type+ (field_declaration_list+ (field_declaration+ type: (type_identifier) @heritage.extends))))) @definition.struct++; Calls+(call_expression function: (identifier) @call.name) @call+(call_expression function: (selector_expression field: (field_identifier) @call.name)) @call++; Struct literal construction: User{Name: "Alice"}+(composite_literal type: (type_identifier) @call.name) @call+`;++// C++ queries - works with tree-sitter-cpp+export const CPP_QUERIES = `+; Classes, Structs, Namespaces+(class_specifier name: (type_identifier) @name) @definition.class+(struct_specifier name: (type_identifier) @name) @definition.struct+(namespace_definition name: (namespace_identifier) @name) @definition.namespace+(enum_specifier name: (type_identifier) @name) @definition.enum++; Typedefs and unions (common in C-style headers and mixed C/C++ code)+(type_definition declarator: (type_identifier) @name) @definition.typedef+(union_specifier name: (type_identifier) @name) @definition.union++; Macros+(preproc_function_def name: (identifier) @name) @definition.macro+(preproc_def name: (identifier) @name) @definition.macro++; Functions & Methods (direct declarator)+(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function+(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method++; Functions/methods returning pointers (pointer_declarator wraps function_declarator)+(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function+(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method++; Functions/methods returning double pointers (nested pointer_declarator)+(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function+(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))))) @definition.method++; Functions/methods returning references (reference_declarator wraps function_declarator)+(function_definition declarator: (reference_declarator (function_declarator declarator: (identifier) @name))) @definition.function+(function_definition declarator: (reference_declarator (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method++; Destructors (destructor_name is distinct from identifier in tree-sitter-cpp)+(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (destructor_name) @name))) @definition.method++; Function declarations / prototypes (common in headers)+(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function+(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function++; Inline class method declarations (inside class body, no body: void Foo();)+(field_declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.method++; Inline class method definitions (inside class body, with body: void Foo() { ... })+(field_declaration_list+ (function_definition+ declarator: (function_declarator+ declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name)) @definition.method)++; Templates+(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template+(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template++; Includes+(preproc_include path: (_) @import.source) @import++; Calls+(call_expression function: (identifier) @call.name) @call+(call_expression function: (field_expression field: (field_identifier) @call.name)) @call+(call_expression function: (qualified_identifier name: (identifier) @call.name)) @call+(call_expression function: (template_function name: (identifier) @call.name)) @call++; Constructor calls: new User()+(new_expression type: (type_identifier) @call.name) @call++; Heritage+(class_specifier name: (type_identifier) @heritage.class+ (base_class_clause (type_identifier) @heritage.extends)) @heritage+(class_specifier name: (type_identifier) @heritage.class+ (base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage+`;++// C# queries - works with tree-sitter-c-sharp+export const CSHARP_QUERIES = `+; Types+(class_declaration name: (identifier) @name) @definition.class+(interface_declaration name: (identifier) @name) @definition.interface+(struct_declaration name: (identifier) @name) @definition.struct+(enum_declaration name: (identifier) @name) @definition.enum+(record_declaration name: (identifier) @name) @definition.record+(delegate_declaration name: (identifier) @name) @definition.delegate++; Namespaces (block form and C# 10+ file-scoped form)+(namespace_declaration name: (identifier) @name) @definition.namespace+(namespace_declaration name: (qualified_name) @name) @definition.namespace+(file_scoped_namespace_declaration name: (identifier) @name) @definition.namespace+(file_scoped_namespace_declaration name: (qualified_name) @name) @definition.namespace++; Methods & Properties+(method_declaration name: (identifier) @name) @definition.method+(local_function_statement name: (identifier) @name) @definition.function+(constructor_declaration name: (identifier) @name) @definition.constructor+(property_declaration name: (identifier) @name) @definition.property++; Primary constructors (C# 12): class User(string name, int age) { }+(class_declaration name: (identifier) @name (parameter_list) @definition.constructor)+(record_declaration name: (identifier) @name (parameter_list) @definition.constructor)++; Using+(using_directive (qualified_name) @import.source) @import+(using_directive (identifier) @import.source) @import++; Calls+(invocation_expression function: (identifier) @call.name) @call+(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call++; Null-conditional method calls: user?.Save()+; Parses as: invocation_expression → conditional_access_expression → member_binding_expression → identifier+(invocation_expression+ function: (conditional_access_expression+ (member_binding_expression+ (identifier) @call.name))) @call++; Constructor calls: new Foo() and new Foo { Props }+(object_creation_expression type: (identifier) @call.name) @call++; Target-typed new (C# 9): User u = new("x", 5)+(variable_declaration type: (identifier) @call.name (variable_declarator (implicit_object_creation_expression) @call))++; Heritage+(class_declaration name: (identifier) @heritage.class+ (base_list (identifier) @heritage.extends)) @heritage+(class_declaration name: (identifier) @heritage.class+ (base_list (generic_name (identifier) @heritage.extends))) @heritage+`;++// Rust queries - works with tree-sitter-rust+export const RUST_QUERIES = `+; Functions & Items+(function_item name: (identifier) @name) @definition.function+(struct_item name: (type_identifier) @name) @definition.struct+(enum_item name: (type_identifier) @name) @definition.enum+(trait_item name: (type_identifier) @name) @definition.trait+(impl_item type: (type_identifier) @name !trait) @definition.impl+(impl_item type: (generic_type type: (type_identifier) @name) !trait) @definition.impl+(mod_item name: (identifier) @name) @definition.module++; Type aliases, const, static, macros+(type_item name: (type_identifier) @name) @definition.type+(const_item name: (identifier) @name) @definition.const+(static_item name: (identifier) @name) @definition.static+(macro_definition name: (identifier) @name) @definition.macro++; Use statements+(use_declaration argument: (_) @import.source) @import++; Calls+(call_expression function: (identifier) @call.name) @call+(call_expression function: (field_expression field: (field_identifier) @call.name)) @call+(call_expression function: (scoped_identifier name: (identifier) @call.name)) @call+(call_expression function: (generic_function function: (identifier) @call.name)) @call++; Struct literal construction: User { name: value }+(struct_expression name: (type_identifier) @call.name) @call++; Heritage (trait implementation) — all combinations of concrete/generic trait × concrete/generic type+(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage+(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage+(impl_item trait: (type_identifier) @heritage.trait type: (generic_type type: (type_identifier) @heritage.class)) @heritage+(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (generic_type type: (type_identifier) @heritage.class)) @heritage+`;++// PHP queries - works with tree-sitter-php (php_only grammar)+export const PHP_QUERIES = `+; ── Namespace ────────────────────────────────────────────────────────────────+(namespace_definition+ name: (namespace_name) @name) @definition.namespace++; ── Classes ──────────────────────────────────────────────────────────────────+(class_declaration+ name: (name) @name) @definition.class++; ── Interfaces ───────────────────────────────────────────────────────────────+(interface_declaration+ name: (name) @name) @definition.interface++; ── Traits ───────────────────────────────────────────────────────────────────+(trait_declaration+ name: (name) @name) @definition.trait++; ── Enums (PHP 8.1) ──────────────────────────────────────────────────────────+(enum_declaration+ name: (name) @name) @definition.enum++; ── Top-level functions ───────────────────────────────────────────────────────+(function_definition+ name: (name) @name) @definition.function++; ── Methods (including constructors) ─────────────────────────────────────────+(method_declaration+ name: (name) @name) @definition.method++; ── Class properties (including Eloquent $fillable, $casts, etc.) ────────────+(property_declaration+ (property_element+ (variable_name+ (name) @name))) @definition.property++; ── Imports: use statements ──────────────────────────────────────────────────+; Simple: use App\\Models\\User;+(namespace_use_declaration+ (namespace_use_clause+ (qualified_name) @import.source)) @import++; ── Function/method calls ────────────────────────────────────────────────────+; Regular function call: foo()+(function_call_expression+ function: (name) @call.name) @call++; Method call: $obj->method()+(member_call_expression+ name: (name) @call.name) @call++; Nullsafe method call: $obj?->method()+(nullsafe_member_call_expression+ name: (name) @call.name) @call++; Static call: Foo::bar() (php_only uses scoped_call_expression)+(scoped_call_expression+ name: (name) @call.name) @call++; Constructor call: new User()+(object_creation_expression (name) @call.name) @call++; ── Heritage: extends ────────────────────────────────────────────────────────+(class_declaration+ name: (name) @heritage.class+ (base_clause+ [(name) (qualified_name)] @heritage.extends)) @heritage++; ── Heritage: implements ─────────────────────────────────────────────────────+(class_declaration+ name: (name) @heritage.class+ (class_interface_clause+ [(name) (qualified_name)] @heritage.implements)) @heritage.impl++; ── Heritage: use trait (must capture enclosing class name) ──────────────────+(class_declaration+ name: (name) @heritage.class+ body: (declaration_list+ (use_declaration+ [(name) (qualified_name)] @heritage.trait))) @heritage+`;++// Ruby queries - works with tree-sitter-ruby+// NOTE: Ruby uses `call` for require, include, extend, prepend, attr_* etc.+// These are all captured as @call and routed in JS post-processing:+// - require/require_relative → import extraction+// - include/extend/prepend → heritage (mixin) extraction+// - attr_accessor/attr_reader/attr_writer → property definition extraction+// - everything else → regular call extraction+export const RUBY_QUERIES = `+; ── Modules ──────────────────────────────────────────────────────────────────+(module+ name: (constant) @name) @definition.module++; ── Classes ──────────────────────────────────────────────────────────────────+(class+ name: (constant) @name) @definition.class++; ── Instance methods ─────────────────────────────────────────────────────────+(method+ name: (identifier) @name) @definition.method++; ── Singleton (class-level) methods ──────────────────────────────────────────+(singleton_method+ name: (identifier) @name) @definition.method++; ── All calls (require, include, attr_*, and regular calls routed in JS) ─────+(call+ method: (identifier) @call.name) @call++; ── Bare calls without parens (identifiers at statement level are method calls) ─+; NOTE: This may over-capture variable reads as calls (e.g. 'result' at+; statement level). Ruby's grammar makes bare identifiers ambiguous — they+; could be local variables or zero-arity method calls. Post-processing via+; isBuiltInOrNoise and symbol resolution filtering suppresses most false+; positives, but a variable name that coincidentally matches a method name+; elsewhere may produce a false CALLS edge.+(body_statement+ (identifier) @call.name @call)++; ── Heritage: class < SuperClass ─────────────────────────────────────────────+(class+ name: (constant) @heritage.class+ superclass: (superclass+ (constant) @heritage.extends)) @heritage+`;++// Kotlin queries - works with tree-sitter-kotlin (fwcd/tree-sitter-kotlin)+// Based on official tags.scm; functions use simple_identifier, classes use type_identifier+export const KOTLIN_QUERIES = `+; ── Interfaces ─────────────────────────────────────────────────────────────+; tree-sitter-kotlin (fwcd) has no interface_declaration node type.+; Interfaces are class_declaration nodes with an anonymous "interface" keyword child.+(class_declaration+ "interface"+ (type_identifier) @name) @definition.interface++; ── Classes (regular, data, sealed, enum) ────────────────────────────────+; All have the anonymous "class" keyword child. enum class has both+; "enum" and "class" children — the "class" child still matches.+(class_declaration+ "class"+ (type_identifier) @name) @definition.class++; ── Object declarations (Kotlin singletons) ──────────────────────────────+(object_declaration+ (type_identifier) @name) @definition.class++; ── Companion objects (named only) ───────────────────────────────────────+(companion_object+ (type_identifier) @name) @definition.class++; ── Functions (top-level, member, extension) ──────────────────────────────+(function_declaration+ (simple_identifier) @name) @definition.function++; ── Properties ───────────────────────────────────────────────────────────+(property_declaration+ (variable_declaration+ (simple_identifier) @name)) @definition.property++; ── Enum entries ─────────────────────────────────────────────────────────+(enum_entry+ (simple_identifier) @name) @definition.enum++; ── Type aliases ─────────────────────────────────────────────────────────+(type_alias+ (type_identifier) @name) @definition.type++; ── Imports ──────────────────────────────────────────────────────────────+(import_header+ (identifier) @import.source) @import++; ── Function calls (direct) ──────────────────────────────────────────────+(call_expression+ (simple_identifier) @call.name) @call++; ── Method calls (via navigation: obj.method()) ──────────────────────────+(call_expression+ (navigation_expression+ (navigation_suffix+ (simple_identifier) @call.name))) @call++; ── Constructor invocations ──────────────────────────────────────────────+(constructor_invocation+ (user_type+ (type_identifier) @call.name)) @call++; ── Infix function calls (e.g., a to b, x until y) ──────────────────────+(infix_expression+ (simple_identifier) @call.name) @call++; ── Heritage: extends / implements via delegation_specifier ──────────────+; Interface implementation (bare user_type): class Foo : Bar+(class_declaration+ (type_identifier) @heritage.class+ (delegation_specifier+ (user_type (type_identifier) @heritage.extends))) @heritage++; Class extension (constructor_invocation): class Foo : Bar()+(class_declaration+ (type_identifier) @heritage.class+ (delegation_specifier+ (constructor_invocation+ (user_type (type_identifier) @heritage.extends)))) @heritage+`;++// Swift queries - works with tree-sitter-swift+export const SWIFT_QUERIES = `+; Classes+(class_declaration "class" name: (type_identifier) @name) @definition.class++; Structs+(class_declaration "struct" name: (type_identifier) @name) @definition.struct++; Enums+(class_declaration "enum" name: (type_identifier) @name) @definition.enum++; Extensions (mapped to class — no dedicated label in schema)+(class_declaration "extension" name: (user_type (type_identifier) @name)) @definition.class++; Actors+(class_declaration "actor" name: (type_identifier) @name) @definition.class++; Protocols (mapped to interface)+(protocol_declaration name: (type_identifier) @name) @definition.interface++; Type aliases+(typealias_declaration name: (type_identifier) @name) @definition.type++; Functions (top-level and methods)+(function_declaration name: (simple_identifier) @name) @definition.function++; Protocol method declarations+(protocol_function_declaration name: (simple_identifier) @name) @definition.method++; Initializers+(init_declaration) @definition.constructor++; Properties (stored and computed)+(property_declaration (pattern (simple_identifier) @name)) @definition.property++; Imports+(import_declaration (identifier (simple_identifier) @import.source)) @import++; Calls - direct function calls+(call_expression (simple_identifier) @call.name) @call++; Calls - member/navigation calls (obj.method())+(call_expression (navigation_expression (navigation_suffix (simple_identifier) @call.name))) @call++; Heritage - class/struct/enum inheritance and protocol conformance+(class_declaration name: (type_identifier) @heritage.class+ (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage++; Heritage - protocol inheritance+(protocol_declaration name: (type_identifier) @heritage.class+ (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage++; Heritage - extension protocol conformance (e.g. extension Foo: SomeProtocol)+; Extensions wrap the name in user_type unlike class/struct/enum declarations+(class_declaration "extension" name: (user_type (type_identifier) @heritage.class)+ (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage+`;++export const LANGUAGE_QUERIES: Record<SupportedLanguages, string> = {+ [SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,+ [SupportedLanguages.JavaScript]: JAVASCRIPT_QUERIES,+ [SupportedLanguages.Python]: PYTHON_QUERIES,+ [SupportedLanguages.Java]: JAVA_QUERIES,+ [SupportedLanguages.C]: C_QUERIES,+ [SupportedLanguages.Go]: GO_QUERIES,+ [SupportedLanguages.CPlusPlus]: CPP_QUERIES,+ [SupportedLanguages.CSharp]: CSHARP_QUERIES,+ [SupportedLanguages.Ruby]: RUBY_QUERIES,+ [SupportedLanguages.Rust]: RUST_QUERIES,+ [SupportedLanguages.PHP]: PHP_QUERIES,+ [SupportedLanguages.Kotlin]: KOTLIN_QUERIES,+ [SupportedLanguages.Swift]: SWIFT_QUERIES,+};+\ No newline at end of filediff --git a/memory-layer/src/main/scala/ix/memory/Main.scala b/memory-layer/src/main/scala/ix/memory/Main.scalaindex 29ef36fd..50133f18 100644--- a/memory-layer/src/main/scala/ix/memory/Main.scala+++ b/memory-layer/src/main/scala/ix/memory/Main.scala@@ -9,7 +9,6 @@ import ix.memory.api.Routesimport ix.memory.conflict.ConflictServiceimport ix.memory.context._import ix.memory.db._-import ix.memory.ingestion._object Main extends IOApp.Simple {@@ -28,12 +27,8 @@ object Main extends IOApp.Simple {// 2. Core APIswriteApi = new ArangoGraphWriteApi(client)queryApi = new ArangoGraphQueryApi(client)- bulkWriteApi = new BulkWriteApi(client)// 3. Services- parserRouter = new ParserRouter()- ingestionService = new IngestionService(parserRouter, writeApi, queryApi)- bulkIngestionService = new BulkIngestionService(parserRouter, bulkWriteApi, queryApi)seeder = new GraphSeeder(queryApi)expander = new GraphExpander(queryApi)claimCollector = new ClaimCollector(queryApi)@@ -44,7 +39,7 @@ object Main extends IOApp.Simple {conflictService = new ConflictService(client, queryApi, writeApi)// 4. HTTP routes- routes = Routes.all(contextService, ingestionService, bulkIngestionService, queryApi, writeApi, conflictService, client)+ routes = Routes.all(contextService, queryApi, writeApi, conflictService, client)// 5. Serverserver <- EmberServerBuilderdiff --git a/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala b/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scaladeleted file mode 100644index d393c47d..00000000--- a/memory-layer/src/main/scala/ix/memory/api/IngestionRoutes.scala+++ /dev/null@@ -1,69 +0,0 @@-package ix.memory.api--import java.nio.file.Paths--import cats.effect.IO-import io.circe.{Decoder, Encoder}-import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}-import org.http4s.HttpRoutes-import org.http4s.circe.CirceEntityCodec._-import org.http4s.dsl.io._--import ix.memory.ingestion.{BulkIngestionService, IngestionProgress, IngestionService}-import org.typelevel.log4cats.slf4j.Slf4jLogger--case class IngestRequest(path: String, language: Option[String], recursive: Option[Boolean], force: Option[Boolean])--object IngestRequest {- implicit val decoder: Decoder[IngestRequest] = deriveDecoder[IngestRequest]- implicit val encoder: Encoder[IngestRequest] = deriveEncoder[IngestRequest]-}--case class SkipReasonsResponse(unchanged: Int, emptyFile: Int, parseError: Int, tooLarge: Int)--object SkipReasonsResponse {- implicit val encoder: Encoder[SkipReasonsResponse] = deriveEncoder[SkipReasonsResponse]- implicit val decoder: Decoder[SkipReasonsResponse] = deriveDecoder[SkipReasonsResponse]-}--case class IngestResponse(filesProcessed: Int, patchesApplied: Int, filesSkipped: Int,- entitiesCreated: Int, latestRev: Long, skipReasons: SkipReasonsResponse)--object IngestResponse {- implicit val encoder: Encoder[IngestResponse] = deriveEncoder[IngestResponse]- implicit val decoder: Decoder[IngestResponse] = deriveDecoder[IngestResponse]-}--class IngestionRoutes(ingestionService: IngestionService, bulkIngestionService: BulkIngestionService) {-- private val logger = Slf4jLogger.getLoggerFromName[IO]("ix.ingest.progress")-- private val progressLog: IngestionProgress => IO[Unit] = { p =>- logger.info(s"discovered=${p.filesDiscovered} parsed=${p.filesParsed} chunks=${p.chunksWritten}/${p.totalChunks}")- }-- val routes: HttpRoutes[IO] = HttpRoutes.of[IO] {- case req @ POST -> Root / "v1" / "ingest" =>- (for {- body <- req.as[IngestRequest]- _ <- IO.raiseWhen(body.path.contains(".."))(- new IllegalArgumentException("Path traversal not allowed")- )- path = Paths.get(body.path)- result <- bulkIngestionService.ingestPath(path, body.language, body.recursive.getOrElse(false), progressLog, body.force.getOrElse(false))- resp <- Ok(IngestResponse(- filesProcessed = result.filesProcessed,- patchesApplied = result.patchesApplied,- filesSkipped = result.filesSkipped,- entitiesCreated = result.entitiesCreated,- latestRev = result.latestRev.value,- skipReasons = SkipReasonsResponse(- result.skipReasons.unchanged,- result.skipReasons.emptyFile,- result.skipReasons.parseError,- result.skipReasons.tooLarge- )- ))- } yield resp).handleErrorWith(ErrorHandler.handle(_))- }-}diff --git a/memory-layer/src/main/scala/ix/memory/api/Routes.scala b/memory-layer/src/main/scala/ix/memory/api/Routes.scalaindex 0ca20508..05072e53 100644--- a/memory-layer/src/main/scala/ix/memory/api/Routes.scala+++ b/memory-layer/src/main/scala/ix/memory/api/Routes.scala@@ -11,18 +11,15 @@ import org.http4s.dsl.io._import ix.memory.conflict.ConflictServiceimport ix.memory.context.ContextServiceimport ix.memory.db.{ArangoClient, GraphQueryApi, GraphWriteApi}-import ix.memory.ingestion.{BulkIngestionService, IngestionService}object Routes {def all(- contextService: ContextService,- ingestionService: IngestionService,- bulkIngestionService: BulkIngestionService,- queryApi: GraphQueryApi,- writeApi: GraphWriteApi,- conflictService: ConflictService,- client: ArangoClient+ contextService: ContextService,+ queryApi: GraphQueryApi,+ writeApi: GraphWriteApi,+ conflictService: ConflictService,+ client: ArangoClient): HttpRoutes[IO] = {val health = HttpRoutes.of[IO] {@@ -30,14 +27,13 @@ object Routes {Ok(Json.obj("status" -> "ok".asJson))}- val contextRoutes = new ContextRoutes(contextService).routes- val ingestionRoutes = new IngestionRoutes(ingestionService, bulkIngestionService).routes- val entityRoutes = new EntityRoutes(queryApi).routes- val diffRoutes = new DiffRoutes(queryApi).routes- val conflictRoutes = new ConflictRoutes(conflictService).routes- val decideRoutes = new DecideRoutes(writeApi).routes- val searchRoutes = new SearchRoutes(queryApi).routes- val truthRoutes = new TruthRoutes(writeApi, queryApi).routes+ val contextRoutes = new ContextRoutes(contextService).routes+ val entityRoutes = new EntityRoutes(queryApi).routes+ val diffRoutes = new DiffRoutes(queryApi).routes+ val conflictRoutes = new ConflictRoutes(conflictService).routes+ val decideRoutes = new DecideRoutes(writeApi).routes+ val searchRoutes = new SearchRoutes(queryApi).routes+ val truthRoutes = new TruthRoutes(writeApi, queryApi).routesval patchRoutes = new PatchRoutes(client).routesval decisionListRoutes = new DecisionRoutes(queryApi).routesval expandRoutes = new ExpandRoutes(queryApi).routes@@ -45,7 +41,7 @@ object Routes {val patchCommitRoutes = new PatchCommitRoutes(writeApi).routesval listRoutes = new ListRoutes(queryApi).routes- health <+> contextRoutes <+> ingestionRoutes <+> entityRoutes <+>+ health <+> contextRoutes <+> entityRoutes <+>diffRoutes <+> conflictRoutes <+> decideRoutes <+> searchRoutes <+>truthRoutes <+> patchRoutes <+> decisionListRoutes <+> expandRoutes <+>statsRoutes <+> patchCommitRoutes <+> listRoutesdiff --git a/memory-layer/src/main/scala/ix/memory/ingestion/BulkIngestionService.scala b/memory-layer/src/main/scala/ix/memory/ingestion/BulkIngestionService.scaladeleted file mode 100644index 3d685cf8..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/BulkIngestionService.scala+++ /dev/null@@ -1,183 +0,0 @@-package ix.memory.ingestion--import java.nio.file.{Files, Path}--import cats.effect.IO-import cats.syntax.all._-import cats.effect.implicits._-import io.circe.Json-import io.circe.syntax._-import org.typelevel.log4cats.slf4j.Slf4jLogger-import org.typelevel.log4cats.Logger--import ix.memory.db.{BulkWriteApi, CommitResult, CommitStatus, FileBatch, GraphQueryApi}-import ix.memory.model._--private[ingestion] sealed trait ParseOutcome-private[ingestion] case class Parsed(batch: FileBatch) extends ParseOutcome-private[ingestion] case class Skipped(reason: String) extends ParseOutcome--/**- * High-performance ingestion service that:- * 1. Discovers files (with optional language filter)- * 2. Parses files in parallel (bounded by CPU cores)- * 3. Batches parsed results- * 4. Bulk-inserts via Document API- */-class BulkIngestionService(- parserRouter: ParserRouter,- bulkWriteApi: BulkWriteApi,- queryApi: GraphQueryApi-) {-- private val parallelism = Runtime.getRuntime.availableProcessors.max(2)- private val MaxFileBytes: Long = 1024 * 1024 // 1 MB- private val mapper = new com.fasterxml.jackson.databind.ObjectMapper()- private val logger: Logger[IO] = Slf4jLogger.getLoggerFromName[IO]("ix.ingestion")-- /**- * Ingest files under a path using parallel parsing and bulk writes.- */- def ingestPath(- path: Path,- language: Option[String],- recursive: Boolean,- onProgress: IngestionProgress => IO[Unit] = _ => IO.unit,- force: Boolean = false- ): IO[IngestionResult] = {- for {- files <- discoverFiles(path, language, recursive)- _ <- onProgress(IngestionProgress(files.size, 0, 0, 0))- hashMap <- if (force) IO.pure(Map.empty[String, String]) else loadExistingHashes(files)- outcomes <- files.parTraverseN(parallelism) { f =>- parseFile(f, hashMap).handleErrorWith { err =>- logger.warn(s"Parse error: ${f.toString} — ${err.getMessage}") *>- IO.pure(Skipped("parseError"): ParseOutcome)- }- }- validBatches = outcomes.collect { case Parsed(b) => b }- unchangedCount = outcomes.count { case Skipped("unchanged") => true; case _ => false }- emptyCount = outcomes.count { case Skipped("emptyFile") => true; case _ => false }- errorCount = outcomes.count { case Skipped("parseError") => true; case _ => false }- tooLargeCount = outcomes.count { case Skipped("tooLarge") => true; case _ => false }- skippedCount = unchangedCount + emptyCount + errorCount + tooLargeCount- totalChunks = if (validBatches.isEmpty) 0 else (validBatches.size + 99) / 100- _ <- onProgress(IngestionProgress(files.size, outcomes.size, 0, totalChunks))- latestRev <- queryApi.getLatestRev- result <- if (validBatches.isEmpty) IO.pure(CommitResult(latestRev, CommitStatus.Ok))- else commitChunkedWithProgress(validBatches.toVector, latestRev.value, onProgress, files.size, outcomes.size)- } yield IngestionResult(- filesProcessed = files.size,- patchesApplied = validBatches.size,- filesSkipped = skippedCount,- entitiesCreated = validBatches.flatMap(_.patch.ops.collect { case _: PatchOp.UpsertNode => 1 }).size,- latestRev = result.newRev,- skipReasons = SkipReasons(unchanged = unchangedCount, emptyFile = emptyCount, parseError = errorCount, tooLarge = tooLargeCount)- )- }-- private def commitChunkedWithProgress(- batches: Vector[FileBatch],- baseRev: Long,- onProgress: IngestionProgress => IO[Unit],- discovered: Int,- parsed: Int- ): IO[CommitResult] = {- val chunkSize = 100- val chunks = batches.grouped(chunkSize).toVector- val totalChunks = chunks.size-- chunks.zipWithIndex.foldLeft(IO.pure(baseRev)) { case (revIO, (chunk, idx)) =>- revIO.flatMap { currentRev =>- bulkWriteApi.commitBatch(chunk, currentRev).flatMap { result =>- onProgress(IngestionProgress(discovered, parsed, idx + 1, totalChunks)) *>- IO.pure(result.newRev.value)- }- }- }.map(finalRev => CommitResult(Rev(finalRev), CommitStatus.Ok))- }-- /**- * Parse a single file into a FileBatch (or None if unchanged).- */- private def parseFile(filePath: Path, hashMap: Map[String, String]): IO[ParseOutcome] = {- for {- fileSize <- IO.blocking(Files.size(filePath))- result <- if (fileSize > MaxFileBytes) IO.pure(Skipped("tooLarge"): ParseOutcome)- else if (fileSize == 0L) IO.pure(Skipped("emptyFile"): ParseOutcome)- else {- for {- bytes <- IO.blocking(Files.readAllBytes(filePath))- hash = sha256Bytes(bytes)- outcome <- hashMap.get(filePath.toString) match {- case Some(existingHash) if existingHash == hash =>- IO.pure(Skipped("unchanged"): ParseOutcome)- case _ =>- for {- source <- IO.blocking {- try new String(bytes, java.nio.charset.StandardCharsets.UTF_8)- catch { case _: Throwable => new String(bytes, java.nio.charset.StandardCharsets.ISO_8859_1) }- }- parserOpt = parserRouter.parserFor(filePath.toString)- parseResult = parserOpt match {- case Some(p) => p.parse(filePath.getFileName.toString, source)- case None => genericTextParse(filePath.getFileName.toString, source)- }- patch = GraphPatchBuilder.build(filePath.toString, Some(hash), parseResult)- _ <- IO.fromEither(PatchValidator.validate(patch).left.map(msg => new IllegalStateException(msg)))- provenance = buildProvenanceMap(patch)- } yield Parsed(FileBatch(filePath.toString, Some(hash), patch, provenance)): ParseOutcome- }- } yield outcome- }- } yield result- }-- private def loadExistingHashes(files: List[Path]): IO[Map[String, String]] = {- val paths = files.map(_.toString)- queryApi.getSourceHashes(paths)- }-- private def buildProvenanceMap(patch: GraphPatch): java.util.Map[String, AnyRef] = {- val json = Json.obj(- "source_uri" -> Json.fromString(patch.source.uri),- "source_hash" -> patch.source.sourceHash.fold(Json.Null)(Json.fromString),- "extractor" -> Json.fromString(patch.source.extractor),- "source_type" -> Json.fromString(patch.source.sourceType.asJson.asString.getOrElse("code")),- "observed_at" -> Json.fromString(patch.timestamp.toString)- )- mapper.readValue(json.noSpaces, classOf[java.util.Map[String, AnyRef]])- }-- private def discoverFiles(- path: Path,- language: Option[String],- recursive: Boolean- ): IO[List[Path]] = IO.blocking {- val extensions = FileDiscovery.extensionsFor(language)- if (Files.isRegularFile(path)) {- if (FileDiscovery.matchesFilter(path, extensions)) List(path) else List.empty- } else if (Files.isDirectory(path)) {- // Try git ls-files first (respects .gitignore), fall back to manual walk- FileDiscovery.tryGitLsFiles(path, recursive, extensions)- .getOrElse(FileDiscovery.walkFiles(path, recursive, extensions))- } else List.empty- }-- private def sha256Bytes(bytes: Array[Byte]): String = {- val md = java.security.MessageDigest.getInstance("SHA-256")- md.digest(bytes).map("%02x".format(_)).mkString- }-- private def genericTextParse(fileName: String, source: String): ParseResult = {- val lines = if (source.isEmpty) 1 else source.count(_ == '\n') + 1- ParseResult(- entities = Vector(ParsedEntity(- name = fileName, kind = NodeKind.File,- attrs = Map("content" -> Json.fromString(source)),- lineStart = 1, lineEnd = lines- )),- relationships = Vector.empty- )- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/FileDiscovery.scala b/memory-layer/src/main/scala/ix/memory/ingestion/FileDiscovery.scaladeleted file mode 100644index 2a20186a..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/FileDiscovery.scala+++ /dev/null@@ -1,142 +0,0 @@-package ix.memory.ingestion--import java.nio.file.{Files, Path}--/**- * Discovers source files for ingestion.- *- * Primary strategy: `git ls-files` — respects .gitignore, fast, works for any repo.- * Fallback: manual file walk with hardcoded ignore list (for non-git directories).- */-object FileDiscovery {-- private val defaultExtensions = Set(- // code- ".py", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs",- ".java", ".scala", ".sc", ".go", ".rs", ".c", ".h", ".cc", ".cpp", ".hpp",- ".kt", ".kts", ".swift", ".rb", ".php", ".cs", ".ex", ".exs",- ".lua", ".zig", ".nim", ".jl", ".r", ".R", ".pl", ".pm",- ".sh", ".bash", ".zsh", ".fish",-- // config / data- ".json", ".yaml", ".yml", ".toml", ".ini", ".conf", ".env", ".properties",- ".xml", ".plist", ".gradle",-- // docs- ".md", ".mdx", ".rst", ".txt",-- // build- ".sbt", ".gradle", ".cmake"- )-- /** Files matched by name regardless of extension. */- private val specialFiles = Set(- "Dockerfile", "Makefile", "Rakefile", "Gemfile", "Procfile",- "README", "LICENSE", "NOTICE", "CHANGELOG",- "Cargo.toml", "go.mod", "go.sum",- "package.json", "tsconfig.json", "pyproject.toml", "setup.py", "setup.cfg",- "build.sbt", "build.gradle", "pom.xml", "CMakeLists.txt",- ".gitignore", ".dockerignore", ".editorconfig"- )-- def extensionsFor(language: Option[String]): Set[String] = language match {- case Some("python") => Set(".py")- case Some("typescript") => Set(".ts", ".tsx")- case Some("javascript") => Set(".js", ".jsx", ".mjs", ".cjs")- case Some("scala") => Set(".scala", ".sc")- case Some("java") => Set(".java")- case Some("go") => Set(".go")- case Some("rust") => Set(".rs")- case Some("ruby") => Set(".rb")- case Some("config") => Set(".json", ".yaml", ".yml", ".toml", ".ini", ".conf", ".properties", ".xml")- case Some("markdown") => Set(".md", ".mdx")- case _ => defaultExtensions- }-- def matchesFilter(file: Path, extensions: Set[String]): Boolean = {- val name = file.getFileName.toString- specialFiles.contains(name) || extensions.exists(name.endsWith)- }-- /**- * Use `git ls-files` to discover tracked files. Returns None if not a git repo- * or git is not available.- */- def tryGitLsFiles(dir: Path, recursive: Boolean, extensions: Set[String]): Option[List[Path]] = {- try {- val pb = new ProcessBuilder("git", "ls-files", "--cached", "--others", "--exclude-standard")- pb.directory(dir.toFile)- pb.redirectErrorStream(true)- val proc = pb.start()- val reader = new java.io.BufferedReader(- new java.io.InputStreamReader(proc.getInputStream, java.nio.charset.StandardCharsets.UTF_8)- )- val result = scala.collection.mutable.ListBuffer.empty[Path]-- try {- var line = reader.readLine()- while (line != null) {- if (line.nonEmpty) {- val p = dir.resolve(line).normalize()- val isUnder = if (recursive) true else p.getParent == dir- if (isUnder && Files.isRegularFile(p) && matchesFilter(p, extensions)) {- result += p- }- }- line = reader.readLine()- }- } finally {- reader.close()- }-- val exitCode = proc.waitFor()- if (exitCode != 0) None else Some(result.toList)- } catch {- case _: Throwable => None- }- }-- /**- * Fallback: walk the directory tree, skipping common non-source directories.- */- def walkFiles(dir: Path, recursive: Boolean, extensions: Set[String]): List[Path] = {- import scala.jdk.CollectionConverters._-- if (!recursive) {- val stream = Files.list(dir)- try {- stream.iterator().asScala- .filter(Files.isRegularFile(_))- .filter(matchesFilter(_, extensions))- .toList- } finally stream.close()- } else {- // Directories to skip when not using git- val ignoredDirs = Set(- "node_modules", ".git", ".hg", ".svn",- "target", "dist", "build", "out", ".next",- "__pycache__", ".tox", ".venv", "venv", ".mypy_cache", ".pytest_cache",- ".gradle", ".idea", ".vscode", ".settings", ".vs",- ".cache", ".parcel-cache", "coverage", ".nyc_output",- "vendor", "Pods", ".dart_tool", ".pub-cache",- "bin", "obj", "pkg"- )- val result = scala.collection.mutable.ListBuffer.empty[Path]- Files.walkFileTree(dir, new java.nio.file.SimpleFileVisitor[Path] {- override def preVisitDirectory(d: Path, attrs: java.nio.file.attribute.BasicFileAttributes): java.nio.file.FileVisitResult = {- val name = d.getFileName.toString- if (d != dir && (ignoredDirs.contains(name) || name.startsWith(".")))- java.nio.file.FileVisitResult.SKIP_SUBTREE- else- java.nio.file.FileVisitResult.CONTINUE- }- override def visitFile(file: Path, attrs: java.nio.file.attribute.BasicFileAttributes): java.nio.file.FileVisitResult = {- if (matchesFilter(file, extensions))- result += file- java.nio.file.FileVisitResult.CONTINUE- }- })- result.toList- }- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/Fingerprint.scala b/memory-layer/src/main/scala/ix/memory/ingestion/Fingerprint.scaladeleted file mode 100644index 8a7c4baf..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/Fingerprint.scala+++ /dev/null@@ -1,20 +0,0 @@-package ix.memory.ingestion--import java.security.MessageDigest--object Fingerprint {-- /** Compute a normalized content fingerprint from signature + body.- * Returns a 32-char hex string (first 16 bytes of SHA-256).- */- def compute(signature: String, body: String): String = {- val normalized = (signature.trim + "\n" + body.trim)- .replaceAll("\\s+", " ")- .trim- val digest = MessageDigest.getInstance("SHA-256")- digest.digest(normalized.getBytes("UTF-8"))- .take(16)- .map("%02x".format(_))- .mkString- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/GraphPatchBuilder.scala b/memory-layer/src/main/scala/ix/memory/ingestion/GraphPatchBuilder.scaladeleted file mode 100644index c11587ef..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/GraphPatchBuilder.scala+++ /dev/null@@ -1,99 +0,0 @@-package ix.memory.ingestion--import java.time.Instant-import java.util.UUID--import io.circe.Json--import ix.memory.model._--object GraphPatchBuilder {-- /**- * Build a GraphPatch from a ParseResult and file metadata.- *- * Uses deterministic UUID generation (UUID v3 (MD5-based nameUUID)) so that- * re-parsing the same file produces the same node/edge IDs, enabling- * idempotent upserts.- */- def build(- filePath: String,- sourceHash: Option[String],- parseResult: ParseResult- ): GraphPatch = {-- def nodeIdFor(name: String): NodeId =- NodeId(UUID.nameUUIDFromBytes(s"$filePath:$name".getBytes("UTF-8")))-- def edgeIdFor(src: String, dst: String, predicate: String): EdgeId =- EdgeId(UUID.nameUUIDFromBytes(s"$filePath:$src:$dst:$predicate".getBytes("UTF-8")))-- val extractor = if (filePath.endsWith(".py")) "tree-sitter-python/1.0"- else if (filePath.endsWith(".ts") || filePath.endsWith(".tsx")) "typescript-parser/1.0"- else if (filePath.endsWith(".scala") || filePath.endsWith(".sc")) "scala-parser/1.0"- else if (filePath.endsWith(".json") || filePath.endsWith(".yaml") || filePath.endsWith(".yml") || filePath.endsWith(".toml")) "config-parser/1.0"- else if (filePath.endsWith(".md")) "markdown-parser/1.0"- else "unknown-parser/1.0"-- val nodeOps = parseResult.entities.map { e =>- val baseAttrs = e.attrs +- ("line_start" -> Json.fromInt(e.lineStart)) +- ("line_end" -> Json.fromInt(e.lineEnd))- val attrsWithFp = e.contentFingerprint match {- case Some(fp) => baseAttrs + ("content_fingerprint" -> Json.fromString(fp))- case None => baseAttrs- }- PatchOp.UpsertNode(nodeIdFor(e.name), e.kind, e.name, attrsWithFp)- }-- val edgeOps = parseResult.relationships.map { r =>- PatchOp.UpsertEdge(- edgeIdFor(r.srcName, r.dstName, r.predicate),- nodeIdFor(r.srcName),- nodeIdFor(r.dstName),- EdgePredicate(r.predicate),- Map.empty- )- }-- // Generate claims so the confidence/conflict engine has data to operate on.- val relationshipClaims = parseResult.relationships.map { r =>- PatchOp.AssertClaim(- entityId = nodeIdFor(r.srcName),- field = s"${r.predicate.toLowerCase}:${r.dstName}",- value = Json.fromString(r.dstName),- confidence = None // will be computed at query time- )- }-- val attributeClaims = parseResult.entities.flatMap { e =>- e.attrs.flatMap { case (key, value) =>- Vector(PatchOp.AssertClaim(- entityId = nodeIdFor(e.name),- field = key,- value = value,- confidence = None- ))- }- }-- val claimOps = relationshipClaims ++ attributeClaims- val allOps = nodeOps ++ edgeOps ++ claimOps-- val sourceType = if (filePath.endsWith(".py") || filePath.endsWith(".ts") || filePath.endsWith(".tsx") || filePath.endsWith(".scala") || filePath.endsWith(".sc")) SourceType.Code- else if (filePath.endsWith(".json") || filePath.endsWith(".yaml") || filePath.endsWith(".yml") || filePath.endsWith(".toml")) SourceType.Config- else if (filePath.endsWith(".md")) SourceType.Doc- else SourceType.Code-- GraphPatch(- patchId = PatchId(UUID.randomUUID()),- actor = "ix/ingestion",- timestamp = Instant.now(),- source = PatchSource(filePath, sourceHash, extractor, sourceType),- baseRev = Rev(0L),- ops = allOps,- replaces = Vector.empty,- intent = Some(s"Parsed $filePath")- )- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/IngestionService.scala b/memory-layer/src/main/scala/ix/memory/ingestion/IngestionService.scaladeleted file mode 100644index ea66a6bb..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/IngestionService.scala+++ /dev/null@@ -1,277 +0,0 @@-package ix.memory.ingestion--import java.nio.file.{Files, Path}-import java.time.Instant-import java.util.UUID--import cats.effect.IO-import cats.syntax.all._-import ix.memory.db.{CommitResult, GraphQueryApi, GraphWriteApi}-import ix.memory.model._-import io.circe.Json--/**- * Orchestrates file ingestion: reads source files, parses them,- * builds graph patches, and commits them through the write API.- */-class IngestionService(parserRouter: ParserRouter, writeApi: GraphWriteApi, queryApi: GraphQueryApi) {-- /**- * Ingest a single file: read, parse, build patch, commit.- */- def ingestFile(filePath: Path): IO[CommitResult] = {- for {- bytes <- IO.blocking(Files.readAllBytes(filePath))- _ <- if (bytes.isEmpty) IO.raiseError(new RuntimeException(s"Skipping empty file: $filePath"))- else IO.unit- // Hash raw bytes so revisions are stable across encodings- hash = Some(sha256Bytes(bytes))- // Decode text with UTF-8, fallback to ISO-8859-1 to avoid hard failures- source <- IO.blocking {- try new String(bytes, java.nio.charset.StandardCharsets.UTF_8)- catch { case _: Throwable => new String(bytes, java.nio.charset.StandardCharsets.ISO_8859_1) }- }- // Use the language-specific parser when available; otherwise fall back to generic text- parserOpt = parserRouter.parserFor(filePath.toString)- result = parserOpt match {- case Some(p) => p.parse(filePath.getFileName.toString, source)- case None => genericTextParse(filePath.getFileName.toString, source)- }- val fp = filePath.toString- extractor = if (fp.endsWith(".py")) "tree-sitter-python/1.0"- else if (fp.endsWith(".ts") || fp.endsWith(".tsx")) "typescript-parser/1.0"- else if (fp.endsWith(".scala") || fp.endsWith(".sc")) "scala-parser/1.0"- else if (fp.endsWith(".json") || fp.endsWith(".yaml") || fp.endsWith(".yml") || fp.endsWith(".toml") || fp.endsWith(".ini") || fp.endsWith(".conf") || fp.endsWith(".properties") || fp.endsWith(".env")) "config-parser/1.0"- else if (fp.endsWith(".md") || fp.endsWith(".mdx") || fp.endsWith(".rst") || fp.endsWith(".txt")) "markdown-parser/1.0"- else "text-parser/1.0"- existing <- queryApi.getPatchesBySource(filePath.toString, extractor)- prevPatch = existing.headOption- prevHash = prevPatch.flatMap(_.hcursor.downField("data").downField("source").get[String]("sourceHash").toOption)- // If hash unchanged, skip (idempotent)- _ <- if (prevHash == hash) IO.raiseError(new RuntimeException("Idempotent — file unchanged"))- else IO.unit- prevPatchId = prevPatch.flatMap(_.hcursor.downField("data").get[String]("patchId").toOption)- .flatMap(s => scala.util.Try(java.util.UUID.fromString(s)).toOption)- .map(PatchId(_))- replaces = prevPatchId.toVector- patch = GraphPatchBuilder.build(filePath.toString, hash, result).copy(replaces = replaces)- _ <- IO.fromEither(PatchValidator.validate(patch).left.map(msg => new IllegalStateException(msg)))- commit <- writeApi.commitPatch(patch)- // Resolve cross-file import edges after main patch is committed- _ <- resolveImportEdges(filePath, result, hash).attempt.void- // Resolve named import symbols to their actual source entities- _ <- resolveNamedImports(filePath, result, hash).attempt.void- } yield commit- }-- /**- * Ingest all matching files under a path.- *- * @param path root directory or single file- * @param language optional language filter (e.g. "python")- * @param recursive whether to recurse into subdirectories- * @return aggregated ingestion result- */- def ingestPath(- path: Path,- language: Option[String],- recursive: Boolean- ): IO[IngestionResult] = {- for {- files <- discoverFiles(path, language, recursive)- results <- files.traverse(f => ingestFile(f).attempt)- successes = results.collect { case Right(cr) => cr }- idempotentCount = results.count {- case Left(e: RuntimeException) if e.getMessage.startsWith("Idempotent") => true- case _ => false- }- latestRev = successes.lastOption.map(_.newRev).getOrElse(Rev(0L))- } yield IngestionResult(- filesProcessed = files.size,- patchesApplied = successes.size,- filesSkipped = idempotentCount,- entitiesCreated = 0, // Would need to count from parse results- latestRev = latestRev- )- }-- private def discoverFiles(- path: Path,- language: Option[String],- recursive: Boolean- ): IO[List[Path]] = IO.blocking {- val extensions = FileDiscovery.extensionsFor(language)- if (Files.isRegularFile(path)) {- if (FileDiscovery.matchesFilter(path, extensions)) List(path) else List.empty- } else if (Files.isDirectory(path)) {- FileDiscovery.tryGitLsFiles(path, recursive, extensions)- .getOrElse(FileDiscovery.walkFiles(path, recursive, extensions))- } else {- List.empty- }- }-- private def resolveImportEdges(- filePath: Path,- parseResult: ParseResult,- sourceHash: Option[String]- ): IO[Unit] = {- val importRels = parseResult.relationships.filter(_.predicate == "IMPORTS")- importRels.traverse_ { rel =>- val targetName = rel.dstName- // Try to resolve relative imports (./config, ../utils)- val resolvedPath = resolveRelativePath(filePath, targetName)- resolvedPath match {- case Some(resolved) =>- queryApi.searchNodes(resolved.getFileName.toString, limit = 1).flatMap {- case nodes if nodes.nonEmpty =>- val srcId = NodeId(UUID.nameUUIDFromBytes(s"${filePath}:${filePath.getFileName}".getBytes("UTF-8")))- val dstId = nodes.head.id- val edgeId = EdgeId(UUID.nameUUIDFromBytes(s"${srcId.value}:${dstId.value}:IMPORTS".getBytes("UTF-8")))- val patch = GraphPatch(- patchId = PatchId(UUID.randomUUID()),- actor = "ix/cross-file",- timestamp = Instant.now(),- source = PatchSource(filePath.toString, sourceHash, "cross-file-resolver/1.0", SourceType.Code),- baseRev = Rev(0L),- ops = Vector(PatchOp.UpsertEdge(edgeId, srcId, dstId, EdgePredicate("IMPORTS"), Map.empty)),- replaces = Vector.empty,- intent = Some(s"Cross-file import: ${filePath.getFileName} -> ${resolved.getFileName}")- )- writeApi.commitPatch(patch).void- case _ => IO.unit- }- case None => IO.unit- }- }- }-- private def resolveNamedImports(- filePath: Path,- parseResult: ParseResult,- sourceHash: Option[String]- ): IO[Unit] = {- val namedImports = parseResult.relationships.filter { rel =>- rel.predicate == "IMPORTS" && !rel.dstName.contains("/") && !rel.dstName.contains(".")- }- namedImports.traverse_ { rel =>- queryApi.searchNodes(rel.dstName, limit = 5, nameOnly = true).flatMap { nodes =>- val external = nodes.filter { n =>- n.name == rel.dstName &&- n.provenance.sourceUri != filePath.toString- }- external.headOption match {- case Some(target) =>- val srcId = NodeId(UUID.nameUUIDFromBytes(- s"${filePath}:${filePath.getFileName}".getBytes("UTF-8")))- val edgeId = EdgeId(UUID.nameUUIDFromBytes(- s"${srcId.value}:${target.id.value}:IMPORTS".getBytes("UTF-8")))- val patch = GraphPatch(- patchId = PatchId(UUID.randomUUID()),- actor = "ix/cross-file",- timestamp = Instant.now(),- source = PatchSource(filePath.toString, sourceHash,- "cross-file-resolver/1.0", SourceType.Code),- baseRev = Rev(0L),- ops = Vector(PatchOp.UpsertEdge(- edgeId, srcId, target.id, EdgePredicate("IMPORTS"), Map.empty)),- replaces = Vector.empty,- intent = Some(s"Named import: ${filePath.getFileName} -> ${rel.dstName}")- )- writeApi.commitPatch(patch).void- case None => IO.unit- }- }- }- }-- private def resolveRelativePath(from: Path, importTarget: String): Option[Path] = {- if (importTarget.startsWith("./") || importTarget.startsWith("../")) {- val base = from.getParent- if (base == null) return None-- // 1. Try the import target as-is and with source extensions appended- val directExtensions = List("", ".ts", ".tsx", ".scala", ".py", ".js")- val directMatch = directExtensions.collectFirst {- case ext =>- val candidate = base.resolve(importTarget + ext).normalize()- if (Files.exists(candidate)) candidate else null- }.flatMap(Option(_))- if (directMatch.isDefined) return directMatch-- // 2. Strip compiled extensions (.js/.mjs/.cjs) and try source extensions- val strippable = List(".js", ".mjs", ".cjs")- val stripped = strippable.collectFirst {- case ext if importTarget.endsWith(ext) =>- importTarget.stripSuffix(ext)- }- val strippedMatch = stripped.flatMap { baseName =>- val sourceExtensions = List(".ts", ".tsx")- sourceExtensions.collectFirst {- case ext =>- val candidate = base.resolve(baseName + ext).normalize()- if (Files.exists(candidate)) candidate else null- }.flatMap(Option(_))- }- if (strippedMatch.isDefined) return strippedMatch-- // 3. Try directory index files (e.g., ./utils -> ./utils/index.ts)- val indexExtensions = List("index.ts", "index.tsx", "index.js")- indexExtensions.collectFirst {- case idx =>- val candidate = base.resolve(importTarget).resolve(idx).normalize()- if (Files.exists(candidate)) candidate else null- }.flatMap(Option(_))- } else None- }-- private def sha256Bytes(bytes: Array[Byte]): String = {- val md = java.security.MessageDigest.getInstance("SHA-256")- md.digest(bytes).map("%02x".format(_)).mkString- }-- /**- * Generic fallback parse: ensures every text file produces at least a File entity with content.- * This avoids needing a bespoke parser for every dev/text extension.- */- private def genericTextParse(fileName: String, source: String): ParseResult = {- val lines = if (source.isEmpty) 1 else source.count(_ == '\n') + 1- ParseResult(- entities = Vector(- ParsedEntity(- name = fileName,- kind = NodeKind.File,- attrs = Map(- "content" -> Json.fromString(source)- ),- lineStart = 1,- lineEnd = lines- )- ),- relationships = Vector.empty- )- }-}--case class IngestionProgress(- filesDiscovered: Int,- filesParsed: Int,- chunksWritten: Int,- totalChunks: Int-)--case class SkipReasons(- unchanged: Int = 0,- emptyFile: Int = 0,- parseError: Int = 0,- tooLarge: Int = 0-)--case class IngestionResult(- filesProcessed: Int,- patchesApplied: Int,- filesSkipped: Int,- entitiesCreated: Int,- latestRev: Rev,- skipReasons: SkipReasons = SkipReasons()-)diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/ParseResult.scala b/memory-layer/src/main/scala/ix/memory/ingestion/ParseResult.scaladeleted file mode 100644index 43ba1269..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/ParseResult.scala+++ /dev/null@@ -1,24 +0,0 @@-package ix.memory.ingestion--import ix.memory.model.NodeKind-import io.circe.Json--case class ParsedEntity(- name: String,- kind: NodeKind,- attrs: Map[String, Json],- lineStart: Int,- lineEnd: Int,- contentFingerprint: Option[String] = None-)--case class ParsedRelationship(- srcName: String,- dstName: String,- predicate: String-)--case class ParseResult(- entities: Vector[ParsedEntity],- relationships: Vector[ParsedRelationship]-)diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/Parser.scala b/memory-layer/src/main/scala/ix/memory/ingestion/Parser.scaladeleted file mode 100644index cec94982..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/Parser.scala+++ /dev/null@@ -1,9 +0,0 @@-package ix.memory.ingestion--/**- * Common trait for language-specific source code parsers.- * Both TreeSitterPythonParser and TypeScriptParser implement this.- */-trait Parser {- def parse(fileName: String, source: String): ParseResult-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/ParserRouter.scala b/memory-layer/src/main/scala/ix/memory/ingestion/ParserRouter.scaladeleted file mode 100644index a5d24632..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/ParserRouter.scala+++ /dev/null@@ -1,25 +0,0 @@-package ix.memory.ingestion--import ix.memory.ingestion.parsers.{ConfigParser, MarkdownParser, ScalaParser, TreeSitterPythonParser, TypeScriptParser}--/**- * Routes file paths to the appropriate language parser.- * Supports Python (.py), TypeScript (.ts/.tsx), config files (.json/.yaml/.yml/.toml),- * and Markdown (.md).- */-class ParserRouter {- private val pythonParser = new TreeSitterPythonParser()- private val tsParser = new TypeScriptParser()- private val configParser = new ConfigParser()- private val markdownParser = new MarkdownParser()- private val scalaParser = new ScalaParser()-- def parserFor(filePath: String): Option[Parser] = {- if (filePath.endsWith(".py")) Some(pythonParser)- else if (filePath.endsWith(".ts") || filePath.endsWith(".tsx")) Some(tsParser)- else if (filePath.endsWith(".scala") || filePath.endsWith(".sc")) Some(scalaParser)- else if (filePath.endsWith(".json") || filePath.endsWith(".yaml") || filePath.endsWith(".yml") || filePath.endsWith(".toml")) Some(configParser)- else if (filePath.endsWith(".md")) Some(markdownParser)- else None- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/PatchValidator.scala b/memory-layer/src/main/scala/ix/memory/ingestion/PatchValidator.scaladeleted file mode 100644index f2823309..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/PatchValidator.scala+++ /dev/null@@ -1,16 +0,0 @@-package ix.memory.ingestion--import ix.memory.model.GraphPatch--/**- * Simple validation for graph patches before committing.- */-object PatchValidator {-- def validate(patch: GraphPatch): Either[String, GraphPatch] = {- if (patch.ops.isEmpty)- Left("Patch has no operations")- else- Right(patch)- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/ConfigParser.scala b/memory-layer/src/main/scala/ix/memory/ingestion/parsers/ConfigParser.scaladeleted file mode 100644index bd396ed7..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/ConfigParser.scala+++ /dev/null@@ -1,190 +0,0 @@-package ix.memory.ingestion.parsers--import ix.memory.ingestion.{Parser, ParseResult, ParsedEntity, ParsedRelationship}-import ix.memory.model.NodeKind-import io.circe.Json--/**- * Parser for configuration files (JSON, YAML, TOML).- *- * Flattens nested structures into dot-path entries so that each leaf value- * becomes a ConfigEntry node with a meaningful value (never "{" or "[").- */-class ConfigParser extends Parser {-- private val JsonExtensions = Set(".json")- private val YamlExtensions = Set(".yaml", ".yml")- private val TomlExtensions = Set(".toml")-- def canParse(fileName: String): Boolean = {- val lower = fileName.toLowerCase- (JsonExtensions ++ YamlExtensions ++ TomlExtensions).exists(ext => lower.endsWith(ext))- }-- def parse(fileName: String, source: String): ParseResult = {- val lower = fileName.toLowerCase-- val entries: Vector[(String, String, Int)] =- if (JsonExtensions.exists(ext => lower.endsWith(ext))) parseJson(source)- else if (YamlExtensions.exists(ext => lower.endsWith(ext))) parseYaml(source)- else if (TomlExtensions.exists(ext => lower.endsWith(ext))) parseToml(source)- else Vector.empty-- buildResult(fileName, source, entries)- }-- // ---------------------------------------------------------------------------- // Result builder- // ----------------------------------------------------------------------------- private def buildResult(- fileName: String,- source: String,- entries: Vector[(String, String, Int)]- ): ParseResult = {- val lines = source.split("\n", -1)-- val configEntity = ParsedEntity(- name = fileName,- kind = NodeKind.Config,- attrs = Map("format" -> Json.fromString(detectFormat(fileName))),- lineStart = 1,- lineEnd = lines.length- )-- val entryEntities = entries.map { case (key, value, line) =>- ParsedEntity(- name = key,- kind = NodeKind.ConfigEntry,- attrs = Map("value" -> Json.fromString(value)),- lineStart = line,- lineEnd = line- )- }-- val relationships = entries.map { case (key, _, _) =>- ParsedRelationship(fileName, key, "CONTAINS")- }-- ParseResult(- entities = configEntity +: entryEntities,- relationships = relationships- )- }-- private def detectFormat(fileName: String): String = {- val lower = fileName.toLowerCase- if (JsonExtensions.exists(ext => lower.endsWith(ext))) "json"- else if (YamlExtensions.exists(ext => lower.endsWith(ext))) "yaml"- else if (TomlExtensions.exists(ext => lower.endsWith(ext))) "toml"- else "unknown"- }-- // ---------------------------------------------------------------------------- // JSON parsing — Circe-based with flattening- // ----------------------------------------------------------------------------- private def parseJson(source: String): Vector[(String, String, Int)] = {- io.circe.parser.parse(source) match {- case Right(json) => flattenJson("", json, 1)- case Left(_) => regexParseJson(source)- }- }-- private def flattenJson(prefix: String, json: io.circe.Json, line: Int): Vector[(String, String, Int)] = {- json.fold(- jsonNull = Vector.empty,- jsonBoolean = b => Vector((prefix, b.toString, line)),- jsonNumber = n => Vector((prefix, n.toString, line)),- jsonString = s => Vector((prefix, s, line)),- jsonArray = arr => arr.zipWithIndex.flatMap { case (v, i) =>- val key = if (prefix.isEmpty) s"[$i]" else s"$prefix[$i]"- flattenJson(key, v, line)- }.toVector,- jsonObject = obj => obj.toVector.flatMap { case (k, v) =>- val key = if (prefix.isEmpty) k else s"$prefix.$k"- v.fold(- jsonNull = Vector((key, "null", line)),- jsonBoolean = b => Vector((key, b.toString, line)),- jsonNumber = n => Vector((key, n.toString, line)),- jsonString = s => Vector((key, s, line)),- jsonArray = _ => flattenJson(key, v, line),- jsonObject = _ => flattenJson(key, v, line)- )- }- )- }-- /** Regex fallback for malformed JSON */- private def regexParseJson(source: String): Vector[(String, String, Int)] = {- val KvPattern = """"([^"]+)"\s*:\s*"([^"]*)"""".r- val lines = source.split("\n", -1)- lines.zipWithIndex.flatMap { case (line, idx) =>- KvPattern.findAllMatchIn(line).map { m =>- (m.group(1), m.group(2), idx + 1)- }- }.toVector- }-- // ---------------------------------------------------------------------------- // YAML parsing — indentation-aware- // ----------------------------------------------------------------------------- private def parseYaml(source: String): Vector[(String, String, Int)] = {- val lines = source.split("\n", -1)- val result = Vector.newBuilder[(String, String, Int)]- val stack = scala.collection.mutable.Stack.empty[(Int, String)] // (indent, prefix)-- val KvWithValue = """^([a-zA-Z_][\w.-]*)\s*:\s*(.+)$""".r- val KvNoValue = """^([a-zA-Z_][\w.-]*)\s*:\s*$""".r-- lines.zipWithIndex.foreach { case (line, idx) =>- val trimmed = line.trim- if (!trimmed.startsWith("#") && trimmed.nonEmpty) {- val indent = line.takeWhile(_ == ' ').length- trimmed match {- case KvWithValue(key, value) =>- while (stack.nonEmpty && stack.top._1 >= indent) stack.pop()- val fullKey = if (stack.nonEmpty) s"${stack.top._2}.$key" else key- result += ((fullKey, value.trim, idx + 1))- case KvNoValue(key) =>- while (stack.nonEmpty && stack.top._1 >= indent) stack.pop()- val fullKey = if (stack.nonEmpty) s"${stack.top._2}.$key" else key- stack.push((indent, fullKey))- case _ =>- // skip list items, comments, etc.- }- }- }- result.result()- }-- // ---------------------------------------------------------------------------- // TOML parsing — section-aware- // ----------------------------------------------------------------------------- private def parseToml(source: String): Vector[(String, String, Int)] = {- val lines = source.split("\n", -1)- val result = Vector.newBuilder[(String, String, Int)]- var currentSection = ""-- val SectionPattern = """^\[([^\]]+)\]""".r- val KvPattern = """^([a-zA-Z_][\w.-]*)\s*=\s*(.+)$""".r-- lines.zipWithIndex.foreach { case (line, idx) =>- val trimmed = line.trim- if (!trimmed.startsWith("#") && trimmed.nonEmpty) {- trimmed match {- case SectionPattern(section) =>- currentSection = section- case KvPattern(key, value) =>- val fullKey = if (currentSection.isEmpty) key else s"$currentSection.$key"- val cleanValue = value.trim.stripPrefix("\"").stripSuffix("\"")- result += ((fullKey, cleanValue, idx + 1))- case _ =>- }- }- }- result.result()- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/MarkdownParser.scala b/memory-layer/src/main/scala/ix/memory/ingestion/parsers/MarkdownParser.scaladeleted file mode 100644index 7d99504c..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/MarkdownParser.scala+++ /dev/null@@ -1,78 +0,0 @@-package ix.memory.ingestion.parsers--import ix.memory.ingestion.{Parser, ParseResult, ParsedEntity, ParsedRelationship}-import ix.memory.model.NodeKind-import io.circe.Json--import scala.util.matching.Regex--/**- * Markdown parser that extracts structural entities from `.md` files.- *- * Each heading becomes a Doc entity with attrs for `level`, `title`, and `content`.- * Content captures all non-header lines in the section, up to 2000 characters.- * A top-level File entity is also emitted, with CONTAINS edges to each section.- */-class MarkdownParser extends Parser {-- private val HeadingPattern: Regex = """^(#{1,6})\s+(.+)$""".r-- def parse(fileName: String, source: String): ParseResult = {- val lines = source.split("\n", -1)-- // -- File entity --- val fileEntity = ParsedEntity(- name = fileName,- kind = NodeKind.File,- attrs = Map("language" -> Json.fromString("markdown")),- lineStart = 1,- lineEnd = lines.length- )-- // Collect headings with their line indices- val headings: Vector[(Int, Int, String)] = lines.zipWithIndex.flatMap { case (line, idx) =>- HeadingPattern.findFirstMatchIn(line.trim).map { m =>- val level = m.group(1).length- val title = m.group(2).trim- (idx, level, title)- }- }.toVector-- var entities = Vector(fileEntity)- var relationships = Vector.empty[ParsedRelationship]-- for (i <- headings.indices) {- val (startIdx, level, title) = headings(i)- val endIdx = if (i + 1 < headings.length) headings(i + 1)._1 else lines.length-- val content = extractContent(lines, startIdx, endIdx)-- val entity = ParsedEntity(- name = title,- kind = NodeKind.Doc,- attrs = Map(- "level" -> Json.fromInt(level),- "title" -> Json.fromString(title),- "content" -> Json.fromString(content)- ),- lineStart = startIdx + 1,- lineEnd = endIdx- )-- entities = entities :+ entity- relationships = relationships :+ ParsedRelationship(fileName, title, "CONTAINS")- }-- ParseResult(entities, relationships)- }-- /**- * Extract content from all non-header lines in the section, up to 2000 characters.- */- private def extractContent(lines: Array[String], startIdx: Int, endIdx: Int): String = {- val contentLines = lines.slice(startIdx + 1, endIdx).filterNot { line =>- HeadingPattern.findFirstMatchIn(line.trim).isDefined- }- contentLines.mkString("\n").trim.take(2000)- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/ScalaParser.scala b/memory-layer/src/main/scala/ix/memory/ingestion/parsers/ScalaParser.scaladeleted file mode 100644index deac202c..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/ScalaParser.scala+++ /dev/null@@ -1,357 +0,0 @@-package ix.memory.ingestion.parsers--import ix.memory.ingestion.{Fingerprint, Parser, ParseResult, ParsedEntity, ParsedRelationship}-import ix.memory.model.NodeKind-import io.circe.Json--import scala.util.matching.Regex--/**- * Regex-based Scala source parser that extracts structural entities and relationships.- *- * Extracts: traits, classes, case classes, objects, methods (def), and imports.- * Uses brace counting for block boundary detection.- */-class ScalaParser extends Parser {-- // Patterns for Scala constructs- private val TraitPattern: Regex = """^\s*(?:sealed\s+|abstract\s+|private\s+|protected\s+)*trait\s+(\w+)""".r- private val ClassPattern: Regex = """^\s*(?:sealed\s+|abstract\s+|private\s+|protected\s+)*class\s+(\w+)""".r- private val CaseClassPattern: Regex = """^\s*(?:sealed\s+|abstract\s+|private\s+|protected\s+)*case\s+class\s+(\w+)""".r- private val ObjectPattern: Regex = """^\s*(?:sealed\s+|abstract\s+|private\s+|protected\s+)*(?:case\s+)?object\s+(\w+)""".r- private val DefPattern: Regex = """^\s*(?:override\s+)?(?:private(?:\[\w+\])?\s+|protected(?:\[\w+\])?\s+)?(?:final\s+)?def\s+(\w+)""".r- private val ImportPattern: Regex = """^\s*import\s+(.+)$""".r- private val CallPattern: Regex = """(?:(?:this|super)\.)?\b(\w+)\s*(?:\[.*?\])?\s*\(""".r- private val ExtendsPattern: Regex = """extends\s+(\w+)""".r- private val TypeRefPattern: Regex = """\b([A-Z]\w+)""".r- private val QualifiedRefPattern: Regex = """\b([A-Z]\w+)\.(\w+)""".r-- private val ScalaBuiltinTypes: Set[String] = Set(- "String", "Int", "Long", "Double", "Float", "Boolean", "Unit", "Any", "AnyRef", "AnyVal",- "Nothing", "Null", "Option", "List", "Map", "Set", "Vector", "Seq", "Array", "Future",- "IO", "Either", "Try", "Some", "None", "Right", "Left", "Success", "Failure"- )-- private val ScalaBuiltins: Set[String] = Set(- "println", "print", "require", "assert", "assume",- "Some", "None", "Option", "List", "Map", "Set", "Vector",- "Right", "Left", "Try", "Success", "Failure",- "Future", "IO", "pure", "flatMap", "map", "filter",- "foreach", "fold", "foldLeft", "foldRight",- "toString", "hashCode", "equals", "getClass",- "apply", "unapply", "copy", "andThen", "compose",- "getOrElse", "orElse", "contains", "exists", "forall",- "collect", "traverse", "sequence", "attempt", "handleErrorWith",- "raiseError", "blocking", "delay", "suspend", "async",- "mkString", "toList", "toVector", "toSet", "toMap",- "head", "tail", "size", "length", "isEmpty", "nonEmpty",- "take", "drop", "slice", "zip", "zipWithIndex",- "sortBy", "groupBy", "distinct", "flatten"- )-- def parse(fileName: String, source: String): ParseResult = {- val lines = source.split("\n", -1)-- val fileEntity = ParsedEntity(- name = fileName,- kind = NodeKind.File,- attrs = Map("language" -> Json.fromString("scala")),- lineStart = 1,- lineEnd = lines.length- )-- var entities = Vector(fileEntity)- var relationships = Vector.empty[ParsedRelationship]-- // Track type ranges for containment: (name, startLine, endLine)- var typeRanges = Vector.empty[(String, Int, Int)]-- for ((line, idx) <- lines.zipWithIndex) {- val lineNum = idx + 1- val trimmed = line.trim-- // Skip comment lines- if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*")) {- // no-op- } else {-- // Case class must be checked before class (since "case class" contains "class")- val handledAsType = CaseClassPattern.findFirstMatchIn(line) match {- case Some(m) =>- val name = m.group(1)- val endLine = findBraceBlockEnd(lines, idx).getOrElse(lineNum)- val bodyText = lines.slice(idx, endLine).mkString("\n")- val fp = Fingerprint.compute(extractTypeSignature(trimmed), bodyText)- entities = entities :+ ParsedEntity(- name = name,- kind = NodeKind.Class,- attrs = Map("scala_kind" -> Json.fromString("case_class"), "language" -> Json.fromString("scala"),- "signature" -> Json.fromString(extractTypeSignature(trimmed)), "visibility" -> Json.fromString(extractVisibility(trimmed))),- lineStart = lineNum,- lineEnd = endLine,- contentFingerprint = Some(fp)- )- val enclosingType = typeRanges.find { case (_, start, end) => lineNum > start && lineNum <= end }- val containsSrc = enclosingType.map(_._1).getOrElse(fileName)- relationships = relationships :+ ParsedRelationship(containsSrc, name, "CONTAINS")- typeRanges = typeRanges :+ (name, lineNum, endLine)- ExtendsPattern.findFirstMatchIn(line).foreach { em =>- relationships = relationships :+ ParsedRelationship(name, em.group(1), "EXTENDS")- }- true-- case None =>- // Check for trait- TraitPattern.findFirstMatchIn(line) match {- case Some(m) =>- val name = m.group(1)- val endLine = findBraceBlockEnd(lines, idx).getOrElse(lineNum)- val bodyText = lines.slice(idx, endLine).mkString("\n")- val fp = Fingerprint.compute(extractTypeSignature(trimmed), bodyText)- entities = entities :+ ParsedEntity(- name = name,- kind = NodeKind.Trait,- attrs = Map("scala_kind" -> Json.fromString("trait"), "language" -> Json.fromString("scala"),- "signature" -> Json.fromString(extractTypeSignature(trimmed)), "visibility" -> Json.fromString(extractVisibility(trimmed))),- lineStart = lineNum,- lineEnd = endLine,- contentFingerprint = Some(fp)- )- val enclosingType = typeRanges.find { case (_, start, end) => lineNum > start && lineNum <= end }- val containsSrc = enclosingType.map(_._1).getOrElse(fileName)- relationships = relationships :+ ParsedRelationship(containsSrc, name, "CONTAINS")- typeRanges = typeRanges :+ (name, lineNum, endLine)- ExtendsPattern.findFirstMatchIn(line).foreach { em =>- relationships = relationships :+ ParsedRelationship(name, em.group(1), "EXTENDS")- }- true-- case None =>- // Check for object (before class, since object keyword won't match class pattern)- ObjectPattern.findFirstMatchIn(line) match {- case Some(m) =>- val name = m.group(1)- val endLine = findBraceBlockEnd(lines, idx).getOrElse(lineNum)- val bodyText = lines.slice(idx, endLine).mkString("\n")- val fp = Fingerprint.compute(extractTypeSignature(trimmed), bodyText)- entities = entities :+ ParsedEntity(- name = name,- kind = NodeKind.Object,- attrs = Map("scala_kind" -> Json.fromString("object"), "language" -> Json.fromString("scala"),- "signature" -> Json.fromString(extractTypeSignature(trimmed)), "visibility" -> Json.fromString(extractVisibility(trimmed))),- lineStart = lineNum,- lineEnd = endLine,- contentFingerprint = Some(fp)- )- val enclosingType = typeRanges.find { case (_, start, end) => lineNum > start && lineNum <= end }- val containsSrc = enclosingType.map(_._1).getOrElse(fileName)- relationships = relationships :+ ParsedRelationship(containsSrc, name, "CONTAINS")- typeRanges = typeRanges :+ (name, lineNum, endLine)- ExtendsPattern.findFirstMatchIn(line).foreach { em =>- relationships = relationships :+ ParsedRelationship(name, em.group(1), "EXTENDS")- }- true-- case None =>- // Check for class- ClassPattern.findFirstMatchIn(line) match {- case Some(m) =>- val name = m.group(1)- val endLine = findBraceBlockEnd(lines, idx).getOrElse(lineNum)- val bodyText = lines.slice(idx, endLine).mkString("\n")- val fp = Fingerprint.compute(extractTypeSignature(trimmed), bodyText)- entities = entities :+ ParsedEntity(- name = name,- kind = NodeKind.Class,- attrs = Map("scala_kind" -> Json.fromString("class"), "language" -> Json.fromString("scala"),- "signature" -> Json.fromString(extractTypeSignature(trimmed)), "visibility" -> Json.fromString(extractVisibility(trimmed))),- lineStart = lineNum,- lineEnd = endLine,- contentFingerprint = Some(fp)- )- val enclosingType = typeRanges.find { case (_, start, end) => lineNum > start && lineNum <= end }- val containsSrc = enclosingType.map(_._1).getOrElse(fileName)- relationships = relationships :+ ParsedRelationship(containsSrc, name, "CONTAINS")- typeRanges = typeRanges :+ (name, lineNum, endLine)- ExtendsPattern.findFirstMatchIn(line).foreach { em =>- relationships = relationships :+ ParsedRelationship(name, em.group(1), "EXTENDS")- }- true- case None => false- }- }- }- }-- // Check for def (only if we didn't match a type on this line)- if (!handledAsType) {- DefPattern.findFirstMatchIn(line).foreach { m =>- val funcName = m.group(1)- val endLine = findBraceBlockEnd(lines, idx).getOrElse(lineNum)-- val signature = extractSignature(trimmed)- val visibility = extractVisibility(trimmed)-- // Determine enclosing type- val enclosing = typeRanges.find { case (_, start, end) =>- lineNum > start && lineNum <= end- }-- val (kind, edgePredicate, edgeSrc) = enclosing match {- case Some((typeName, _, _)) => (NodeKind.Method, "CONTAINS", typeName)- case None => (NodeKind.Function, "CONTAINS", fileName)- }-- val bodyText = lines.slice(idx, endLine).mkString("\n")- val fp = Fingerprint.compute(signature, bodyText)-- entities = entities :+ ParsedEntity(- name = funcName,- kind = kind,- attrs = Map(- "language" -> Json.fromString("scala"),- "summary" -> Json.fromString(signature),- "signature" -> Json.fromString(signature),- "visibility" -> Json.fromString(visibility)- ),- lineStart = lineNum,- lineEnd = endLine,- contentFingerprint = Some(fp)- )-- relationships = relationships :+ ParsedRelationship(edgeSrc, funcName, edgePredicate)-- // Extract CALLS and REFERENCES from method/function body- val callsInFunc = extractCalls(lines, idx, endLine, funcName)- relationships = relationships ++ callsInFunc-- // Extract REFERENCES from method signature type annotations- val enclosingTypeName = enclosing.map(_._1).getOrElse("")- val sigRefs = TypeRefPattern.findAllMatchIn(signature).map(_.group(1)).toSet- for (ref <- sigRefs) {- if (!ScalaBuiltinTypes.contains(ref) && ref != funcName && ref != enclosingTypeName && ref != fileName) {- relationships = relationships :+ ParsedRelationship(funcName, ref, "REFERENCES")- }- }- }- }-- // Check for imports- ImportPattern.findFirstMatchIn(line).foreach { m =>- val importPath = m.group(1).trim- // Parse import path: "ix.memory.model.{Claim, GraphNode}" -> module "ix.memory.model"- // "cats.effect.IO" -> module "cats.effect.IO"- val moduleName = if (importPath.contains("{")) {- // Grouped import: take the prefix before the braces- importPath.substring(0, importPath.indexOf('{')).stripSuffix(".").trim- } else {- importPath- }-- // Avoid duplicate module entities- if (!entities.exists(e => e.name == moduleName && e.kind == NodeKind.Module)) {- entities = entities :+ ParsedEntity(- name = moduleName,- kind = NodeKind.Module,- attrs = Map.empty,- lineStart = lineNum,- lineEnd = lineNum- )- }- relationships = relationships :+ ParsedRelationship(fileName, moduleName, "IMPORTS")- }-- } // end else (non-comment)- }-- ParseResult(entities, relationships)- }-- /**- * Find the end of a brace-delimited block starting at `startIdx`.- * Counts opening and closing braces. Returns None if no opening brace is found- * (e.g. abstract method in a trait with no body).- */- private def findBraceBlockEnd(lines: Array[String], startIdx: Int): Option[Int] = {- var braceCount = 0- var foundOpen = false- var i = startIdx-- while (i < lines.length) {- val line = lines(i)- for (ch <- line) {- ch match {- case '{' =>- braceCount += 1- foundOpen = true- case '}' =>- braceCount -= 1- if (foundOpen && braceCount == 0) {- return Some(i + 1) // 1-indexed- }- case _ => // skip- }- }- // If we found an opening brace and closed it, we'd have returned above- // If line ends and no brace found yet, keep going- i += 1- }-- if (foundOpen) Some(lines.length) else None- }-- /** Extract CALLS and qualified REFERENCES relationships from a method/function body. */- private def extractCalls(lines: Array[String], startIdx: Int, endIdx: Int, callerName: String): Vector[ParsedRelationship] = {- var calls = Vector.empty[ParsedRelationship]- val seen = scala.collection.mutable.Set.empty[String]- val refSeen = scala.collection.mutable.Set.empty[String]- for (i <- (startIdx + 1) until endIdx.min(lines.length)) {- val line = lines(i).trim- if (!line.startsWith("//") && !line.startsWith("*")) {- CallPattern.findAllMatchIn(line).foreach { m =>- val callee = m.group(1)- // Only include lowercase-starting identifiers (methods/functions, not types)- if (callee != callerName && !ScalaBuiltins.contains(callee) && !seen.contains(callee) && callee.head.isLower) {- seen += callee- calls = calls :+ ParsedRelationship(callerName, callee, "CALLS")- }- }- // Extract qualified REFERENCES (e.g., NodeKind.File, SourceType.Code)- QualifiedRefPattern.findAllMatchIn(line).foreach { m =>- val qualifier = m.group(1)- if (!ScalaBuiltinTypes.contains(qualifier) && !ScalaBuiltins.contains(qualifier) &&- !refSeen.contains(qualifier) && qualifier != callerName) {- refSeen += qualifier- calls = calls :+ ParsedRelationship(callerName, qualifier, "REFERENCES")- }- }- }- }- calls- }-- /** Extract a type signature (trait/class/object), stripping body braces. */- private def extractTypeSignature(trimmedLine: String): String = {- val cleaned = trimmedLine- .replaceAll("""\s*\{\s*$""", "")- .trim- cleaned.take(120)- }-- /** Extract a clean signature from a trimmed line, stripping trailing body markers. */- private def extractSignature(trimmedLine: String): String = {- val cleaned = trimmedLine- .replaceAll("""\s*=\s*\{?\s*$""", "")- .replaceAll("""\s*\{\s*$""", "")- .trim- cleaned.take(120)- }-- /** Detect visibility from a trimmed line (after stripping `override`). */- private def extractVisibility(trimmedLine: String): String = {- val withoutOverride = trimmedLine.replaceFirst("""^\s*override\s+""", "").trim- if (withoutOverride.startsWith("private")) "private"- else if (withoutOverride.startsWith("protected")) "protected"- else "public"- }-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/TreeSitterPythonParser.scala b/memory-layer/src/main/scala/ix/memory/ingestion/parsers/TreeSitterPythonParser.scaladeleted file mode 100644index deb06bdd..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/TreeSitterPythonParser.scala+++ /dev/null@@ -1,250 +0,0 @@-package ix.memory.ingestion.parsers--import ix.memory.ingestion.{Fingerprint, Parser, ParseResult, ParsedEntity, ParsedRelationship}-import ix.memory.model.NodeKind-import io.circe.Json--import scala.util.matching.Regex--/**- * Python source parser that extracts structural entities and relationships.- *- * Attempts to use tree-sitter JNI first; falls back to regex-based extraction- * when the native library is unavailable (common on some platforms).- * The regex fallback is sufficient for Phase 1 since the goal is the pipeline- * structure, not production-grade parsing.- */-class TreeSitterPythonParser extends Parser {-- /**- * Parse a Python source file and extract entities and relationships.- *- * @param fileName the file name (e.g. "billing_service.py")- * @param source the full source code as a string- * @return ParseResult with entities and relationships- */- def parse(fileName: String, source: String): ParseResult = {- // Try tree-sitter first, fall back to regex- tryTreeSitter(fileName, source).getOrElse(regexParse(fileName, source))- }-- // ---------------------------------------------------------------------------- // Tree-sitter JNI attempt- // ----------------------------------------------------------------------------- private def tryTreeSitter(fileName: String, source: String): Option[ParseResult] = {- try {- val langClass = Class.forName("ch.usi.si.seart.treesitter.Language")- val pythonLang = langClass.getMethod("valueOf", classOf[String]).invoke(null, "PYTHON")-- val parserClass = Class.forName("ch.usi.si.seart.treesitter.Parser")- val parser = parserClass.getMethod("getFor", langClass).invoke(null, pythonLang)-- val tree = parserClass.getMethod("parse", classOf[String]).invoke(parser, source)- val treeClass = Class.forName("ch.usi.si.seart.treesitter.Tree")- val root = treeClass.getMethod("getRootNode").invoke(tree)-- // If we get here, tree-sitter loaded successfully- // We would walk the AST here, but for now this path is not reached- // on platforms where the JNI library is unavailable.- parserClass.getMethod("close").invoke(parser)- treeClass.getMethod("close").invoke(tree)- None // TODO: implement full tree-sitter AST walking when JNI works- } catch {- case _: Throwable => None // Catches both Exception and Error (e.g. UnsatisfiedLinkError)- }- }-- // ---------------------------------------------------------------------------- // Regex-based fallback parser- // ----------------------------------------------------------------------------- private val ClassPattern: Regex = """^class\s+(\w+)""".r- private val FuncPattern: Regex = """^(\s*)def\s+(\w+)""".r- private val ImportPattern: Regex = """^import\s+(\w+)""".r- private val FromImportPattern: Regex = """^from\s+(\w+)\s+import""".r- private val CallPattern: Regex = """(?:self\.)?(\w+)\(""".r-- private def regexParse(fileName: String, source: String): ParseResult = {- val lines = source.split("\n", -1)-- // -- File entity --- val fileEntity = ParsedEntity(- name = fileName,- kind = NodeKind.File,- attrs = Map("language" -> Json.fromString("python")),- lineStart = 1,- lineEnd = lines.length- )-- // -- Classes and functions --- var entities = Vector(fileEntity)- var relationships = Vector.empty[ParsedRelationship]-- // Track class ranges: (className, lineStart, lineEnd) for containment checks- var classRanges = Vector.empty[(String, Int, Int)]-- for ((line, idx) <- lines.zipWithIndex) {- val lineNum = idx + 1-- // Skip comment lines — prevents matching patterns inside comments- if (line.trim.startsWith("#")) {- // no-op: skip this line entirely- } else {-- // Check for class definition- ClassPattern.findFirstMatchIn(line).foreach { m =>- val className = m.group(1)- val classEnd = findBlockEnd(lines, idx)- val bodyText = lines.slice(idx, classEnd).mkString("\n")- val fp = Fingerprint.compute(line.trim.take(120), bodyText)- entities = entities :+ ParsedEntity(- name = className,- kind = NodeKind.Class,- attrs = Map("language" -> Json.fromString("python")),- lineStart = lineNum,- lineEnd = classEnd,- contentFingerprint = Some(fp)- )- // File CONTAINS class- relationships = relationships :+ ParsedRelationship(fileName, className, "CONTAINS")- classRanges = classRanges :+ (className, lineNum, classEnd)- }-- // Check for function/method definition- FuncPattern.findFirstMatchIn(line).foreach { m =>- val funcName = m.group(2)- val funcEnd = findBlockEnd(lines, idx)- val bodyText = lines.slice(idx, funcEnd).mkString("\n")- val fp = Fingerprint.compute(line.trim.take(120), bodyText)-- entities = entities :+ ParsedEntity(- name = funcName,- kind = NodeKind.Function,- attrs = Map("language" -> Json.fromString("python")),- lineStart = lineNum,- lineEnd = funcEnd,- contentFingerprint = Some(fp)- )-- // Check if this function's line falls within any class range- val enclosingClass = classRanges.find { case (_, start, end) =>- lineNum > start && lineNum <= end- }- enclosingClass match {- case Some((className, _, _)) =>- // Method inside a class- relationships = relationships :+ ParsedRelationship(className, funcName, "CONTAINS")- case None =>- // Top-level function — file defines it- relationships = relationships :+ ParsedRelationship(fileName, funcName, "CONTAINS")- }-- // Extract function calls within the function body- val callsInFunc = extractCalls(lines, idx, funcName)- relationships = relationships ++ callsInFunc- }-- // Check for imports- ImportPattern.findFirstMatchIn(line).foreach { m =>- val moduleName = m.group(1)- entities = entities :+ ParsedEntity(- name = moduleName,- kind = NodeKind.Module,- attrs = Map.empty,- lineStart = lineNum,- lineEnd = lineNum- )- relationships = relationships :+ ParsedRelationship(fileName, moduleName, "IMPORTS")- }-- FromImportPattern.findFirstMatchIn(line).foreach { m =>- val moduleName = m.group(1)- // Avoid duplicate module entities- if (!entities.exists(e => e.name == moduleName && e.kind == NodeKind.Module)) {- entities = entities :+ ParsedEntity(- name = moduleName,- kind = NodeKind.Module,- attrs = Map.empty,- lineStart = lineNum,- lineEnd = lineNum- )- }- relationships = relationships :+ ParsedRelationship(fileName, moduleName, "IMPORTS")- }-- } // end else (non-comment line)- }-- ParseResult(entities, relationships)- }-- /**- * Find the end line of a block starting at `startIdx` using indentation.- * Looks for the last line that has greater indentation than the definition line.- */- private def findBlockEnd(lines: Array[String], startIdx: Int): Int = {- val baseIndent = lines(startIdx).takeWhile(_ == ' ').length- var endIdx = startIdx- var i = startIdx + 1- while (i < lines.length) {- val line = lines(i)- if (line.trim.nonEmpty) {- val indent = line.takeWhile(_ == ' ').length- if (indent > baseIndent) {- endIdx = i- } else {- // Block ended- return endIdx + 1- }- }- i += 1- }- // If we reach end of file, the block extends to the end- endIdx + 1- }-- /**- * Extract CALLS relationships from the body of a function starting at `funcIdx`.- * Uses a simple heuristic: look for `identifier(` patterns in subsequent indented lines.- */- private def extractCalls(lines: Array[String], funcIdx: Int, callerName: String): Vector[ParsedRelationship] = {- val baseIndent = lines(funcIdx).takeWhile(_ == ' ').length- var calls = Vector.empty[ParsedRelationship]- val seen = scala.collection.mutable.Set.empty[String]- var i = funcIdx + 1-- while (i < lines.length) {- val line = lines(i)- if (line.trim.nonEmpty) {- val indent = line.takeWhile(_ == ' ').length- if (indent <= baseIndent) {- // Exited the function body- return calls- }- // Find calls in this line- CallPattern.findAllMatchIn(line).foreach { m =>- val callee = m.group(1)- // Filter out Python builtins and self-references, and skip 'self' prefix calls- // that match the method name itself- if (callee != callerName && !PythonBuiltins.contains(callee) && !seen.contains(callee)) {- seen += callee- calls = calls :+ ParsedRelationship(callerName, callee, "CALLS")- }- }- }- i += 1- }- calls- }-- private val PythonBuiltins: Set[String] = Set(- "print", "len", "range", "int", "str", "float", "list", "dict",- "set", "tuple", "type", "isinstance", "issubclass", "hasattr",- "getattr", "setattr", "delattr", "super", "property", "staticmethod",- "classmethod", "enumerate", "zip", "map", "filter", "sorted",- "reversed", "any", "all", "min", "max", "sum", "abs", "round",- "input", "open", "format", "repr", "id", "hash", "callable",- "iter", "next", "not", "raise"- )-}diff --git a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/TypeScriptParser.scala b/memory-layer/src/main/scala/ix/memory/ingestion/parsers/TypeScriptParser.scaladeleted file mode 100644index fc2670a2..00000000--- a/memory-layer/src/main/scala/ix/memory/ingestion/parsers/TypeScriptParser.scala+++ /dev/null@@ -1,422 +0,0 @@-package ix.memory.ingestion.parsers--import ix.memory.ingestion.{Fingerprint, Parser, ParseResult, ParsedEntity, ParsedRelationship}-import ix.memory.model.NodeKind-import io.circe.Json--import scala.util.matching.Regex--/**- * TypeScript/JavaScript source parser that extracts structural entities- * and relationships using regex-based extraction.- */-class TypeScriptParser extends Parser {-- /**- * Parse a TypeScript source file and extract entities and relationships.- *- * @param fileName the file name (e.g. "api.ts")- * @param source the full source code as a string- * @return ParseResult with entities and relationships- */- def parse(fileName: String, source: String): ParseResult = {- val lines = source.split("\n", -1)-- // -- File entity (no raw content stored) --- val fileEntity = ParsedEntity(- name = fileName,- kind = NodeKind.File,- attrs = Map("language" -> Json.fromString("typescript")),- lineStart = 1,- lineEnd = lines.length- )-- var entities = Vector(fileEntity)- var relationships = Vector.empty[ParsedRelationship]-- // Track class ranges for containment- var classRanges = Vector.empty[(String, Int, Int)]-- for ((line, idx) <- lines.zipWithIndex) {- val lineNum = idx + 1- val trimmed = line.trim-- // Skip comment lines- if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*")) {- // no-op- } else {-- // Check for class definition- ClassPattern.findFirstMatchIn(line).foreach { m =>- val className = m.group(1)- val classEnd = findBraceBlockEnd(lines, idx)- val bodyText = lines.slice(idx, classEnd).mkString("\n")- val fp = Fingerprint.compute(trimmed.replaceAll("""\s*\{\s*$""", "").take(120), bodyText)- val exported = trimmed.startsWith("export ") || trimmed.startsWith("export{")- entities = entities :+ ParsedEntity(- name = className,- kind = NodeKind.Class,- attrs = Map("language" -> Json.fromString("typescript"), "exported" -> Json.fromBoolean(exported)),- lineStart = lineNum,- lineEnd = classEnd,- contentFingerprint = Some(fp)- )- relationships = relationships :+ ParsedRelationship(fileName, className, "CONTAINS")- classRanges = classRanges :+ (className, lineNum, classEnd)-- // Extract methods from this class- val methods = extractMethods(lines, idx, classEnd, className)- entities = entities ++ methods._1- relationships = relationships ++ methods._2- }-- // Check for top-level function (not inside a class)- if (!insideClass(lineNum, classRanges)) {- FuncPattern.findFirstMatchIn(line).foreach { m =>- val funcName = m.group(1)- val funcEnd = findBraceBlockEnd(lines, idx)- val summary = line.trim.take(120)- val bodyText = lines.slice(idx, funcEnd).mkString("\n")- val fp = Fingerprint.compute(summary, bodyText)- val exported = trimmed.startsWith("export ") || trimmed.startsWith("export{")- entities = entities :+ ParsedEntity(- name = funcName,- kind = NodeKind.Function,- attrs = Map(- "language" -> Json.fromString("typescript"),- "summary" -> Json.fromString(summary),- "signature" -> Json.fromString(summary),- "visibility" -> Json.fromString("public"),- "exported" -> Json.fromBoolean(exported)- ),- lineStart = lineNum,- lineEnd = funcEnd,- contentFingerprint = Some(fp)- )- relationships = relationships :+ ParsedRelationship(fileName, funcName, "CONTAINS")-- // Extract calls within this function- val calls = extractCalls(lines, idx, funcEnd, funcName)- relationships = relationships ++ calls- }-- // Check for arrow function / const function- val arrowMatch = ArrowFuncPattern.findFirstMatchIn(line)- val constFuncMatch = ConstFuncPattern.findFirstMatchIn(line)- val funcMatch = arrowMatch.orElse(constFuncMatch)- funcMatch.foreach { m =>- val funcName = m.group(1)- // Avoid duplicates if already captured by FuncPattern- if (!entities.exists(e => e.name == funcName && e.kind == NodeKind.Function)) {- val funcEnd = findBraceBlockEnd(lines, idx)- val summary = line.trim.take(120)- val bodyText = lines.slice(idx, funcEnd).mkString("\n")- val fp = Fingerprint.compute(summary, bodyText)- val exported = trimmed.startsWith("export ") || trimmed.startsWith("export{")- entities = entities :+ ParsedEntity(- name = funcName,- kind = NodeKind.Function,- attrs = Map(- "language" -> Json.fromString("typescript"),- "summary" -> Json.fromString(summary),- "signature" -> Json.fromString(summary),- "visibility" -> Json.fromString("public"),- "exported" -> Json.fromBoolean(exported)- ),- lineStart = lineNum,- lineEnd = funcEnd,- contentFingerprint = Some(fp)- )- relationships = relationships :+ ParsedRelationship(fileName, funcName, "CONTAINS")-- val callRels = extractCalls(lines, idx, funcEnd, funcName)- relationships = relationships ++ callRels- }- }- }-- // Check for imports- ImportPattern.findFirstMatchIn(line).foreach { m =>- val moduleName = m.group(1)- if (!entities.exists(e => e.name == moduleName && e.kind == NodeKind.Module)) {- entities = entities :+ ParsedEntity(- name = moduleName,- kind = NodeKind.Module,- attrs = Map.empty,- lineStart = lineNum,- lineEnd = lineNum- )- }- relationships = relationships :+ ParsedRelationship(fileName, moduleName, "IMPORTS")- }-- // Extract named import bindings: import { foo, bar } from "mod"- NamedImportPattern.findFirstMatchIn(line).foreach { m =>- val names = m.group(1).split(",").map(_.trim).filter(_.nonEmpty)- for (rawName <- names) {- val symbolName = if (rawName.contains(" as ")) rawName.split("\\s+as\\s+").last.trim else rawName- if (symbolName.nonEmpty && !relationships.exists(r => r.srcName == fileName && r.dstName == symbolName && r.predicate == "IMPORTS")) {- relationships = relationships :+ ParsedRelationship(fileName, symbolName, "IMPORTS")- }- }- }-- SideEffectImportPattern.findFirstMatchIn(line).foreach { m =>- val moduleName = m.group(1)- if (!relationships.exists(r => r.dstName == moduleName && r.predicate == "IMPORTS")) {- if (!entities.exists(e => e.name == moduleName && e.kind == NodeKind.Module)) {- entities = entities :+ ParsedEntity(- name = moduleName,- kind = NodeKind.Module,- attrs = Map.empty,- lineStart = lineNum,- lineEnd = lineNum- )- }- relationships = relationships :+ ParsedRelationship(fileName, moduleName, "IMPORTS")- }- }-- // Check for interface definition- InterfacePattern.findFirstMatchIn(line).foreach { m =>- val ifaceName = m.group(1)- if (!entities.exists(e => e.name == ifaceName && e.kind == NodeKind.Interface)) {- val ifaceEnd = findBraceBlockEnd(lines, idx)- val bodyText = lines.slice(idx, ifaceEnd).mkString("\n")- val fp = Fingerprint.compute(trimmed.replaceAll("""\s*\{\s*$""", "").take(120), bodyText)- val exported = trimmed.startsWith("export ") || trimmed.startsWith("export{")- entities = entities :+ ParsedEntity(- name = ifaceName,- kind = NodeKind.Interface,- attrs = Map(- "language" -> Json.fromString("typescript"),- "ts_kind" -> Json.fromString("interface"),- "exported" -> Json.fromBoolean(exported)- ),- lineStart = lineNum,- lineEnd = ifaceEnd,- contentFingerprint = Some(fp)- )- relationships = relationships :+ ParsedRelationship(fileName, ifaceName, "CONTAINS")- }- }-- // Check for type alias- TypeAliasPattern.findFirstMatchIn(line).foreach { m =>- val typeName = m.group(1)- if (!trimmed.startsWith("import")) {- val exported = trimmed.startsWith("export ") || trimmed.startsWith("export{")- val fp = Fingerprint.compute(trimmed.take(120), trimmed)- entities = entities :+ ParsedEntity(- name = typeName,- kind = NodeKind.Class,- attrs = Map(- "language" -> Json.fromString("typescript"),- "ts_kind" -> Json.fromString("type_alias"),- "exported" -> Json.fromBoolean(exported)- ),- lineStart = lineNum,- lineEnd = lineNum,- contentFingerprint = Some(fp)- )- relationships = relationships :+ ParsedRelationship(fileName, typeName, "CONTAINS")- }- }-- } // end else (non-comment)- }-- // Extract file-level calls from code outside named functions/methods/classes- val coveredRanges: Vector[(Int, Int)] = entities- .filter(e => e.kind == NodeKind.Function || e.kind == NodeKind.Method || e.kind == NodeKind.Class)- .map(e => (e.lineStart, e.lineEnd))-- val fileCallsSeen = scala.collection.mutable.Set.empty[String]- for ((line, idx) <- lines.zipWithIndex) {- val lineNum = idx + 1- val inNamedBody = coveredRanges.exists { case (s, e) => lineNum >= s && lineNum <= e }- if (!inNamedBody && !line.trim.startsWith("//") && !line.trim.startsWith("*")) {- CallPattern.findAllMatchIn(line).foreach { m =>- val callee = m.group(1)- if (!TypeScriptBuiltins.contains(callee) && !TypeScriptKeywords.contains(callee)- && !fileCallsSeen.contains(callee) && callee != fileName) {- fileCallsSeen += callee- relationships = relationships :+ ParsedRelationship(fileName, callee, "CALLS")- }- }- }- }-- ParseResult(entities, relationships)- }-- // ---------------------------------------------------------------------------- // Patterns- // ----------------------------------------------------------------------------- private val ClassPattern: Regex = """(?:export\s+)?(?:abstract\s+)?class\s+(\w+)""".r- private val FuncPattern: Regex = """(?:export\s+)?(?:async\s+)?function\s+(\w+)""".r- private val ArrowFuncPattern: Regex = """(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?(?:\([^)]*\)|[a-zA-Z_]\w*)\s*(?::\s*[^=]+)?\s*=>""".r- private val ConstFuncPattern: Regex = """(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?function""".r- private val MethodPattern: Regex = """^\s+(?:async\s+)?(?:private\s+|public\s+|protected\s+|static\s+|readonly\s+)*(\w+)\s*(?:<[^>]+>)?\s*\(""".r- private val ImportPattern: Regex = """import\s+.*?from\s+['"]([^'"]+)['"]""".r- private val NamedImportPattern: Regex = """import\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]""".r- private val SideEffectImportPattern: Regex = """^import\s+['"]([^'"]+)['"]""".r- private val InterfacePattern: Regex = """(?:export\s+)?interface\s+(\w+)""".r- private val TypeAliasPattern: Regex = """(?:export\s+)?type\s+(\w+)\s*(?:<[^>]+>)?\s*=""".r- private val CallPattern: Regex = """(?:(?:this|self|await)\.)?\b(\w+)\s*\(""".r-- // ---------------------------------------------------------------------------- // Helpers- // ----------------------------------------------------------------------------- private def insideClass(lineNum: Int, classRanges: Vector[(String, Int, Int)]): Boolean =- classRanges.exists { case (_, start, end) => lineNum > start && lineNum <= end }-- private def extractVisibility(trimmedLine: String): String = {- if (trimmedLine.startsWith("private ") || trimmedLine.startsWith("private\t")) "private"- else if (trimmedLine.startsWith("protected ") || trimmedLine.startsWith("protected\t")) "protected"- else "public"- }-- /**- * Extract methods from a class body.- */- private def extractMethods(- lines: Array[String],- classStartIdx: Int,- classEndLine: Int,- className: String- ): (Vector[ParsedEntity], Vector[ParsedRelationship]) = {- var entities = Vector.empty[ParsedEntity]- var relationships = Vector.empty[ParsedRelationship]-- var i = classStartIdx + 1- while (i < lines.length && (i + 1) <= classEndLine) {- val line = lines(i)- val lineNum = i + 1-- if (!line.trim.startsWith("//") && !line.trim.startsWith("*")) {- MethodPattern.findFirstMatchIn(line).foreach { m =>- val methodName = m.group(1)- // Skip keywords that look like methods- if (!TypeScriptKeywords.contains(methodName)) {- val methodEnd = findBraceBlockEnd(lines, i)- val summary = line.trim.take(120)- val visibility = extractVisibility(line.trim)- val bodyText = lines.slice(i, methodEnd).mkString("\n")- val fp = Fingerprint.compute(summary, bodyText)- entities = entities :+ ParsedEntity(- name = methodName,- kind = NodeKind.Method,- attrs = Map(- "language" -> Json.fromString("typescript"),- "summary" -> Json.fromString(summary),- "signature" -> Json.fromString(summary),- "visibility" -> Json.fromString(visibility)- ),- lineStart = lineNum,- lineEnd = methodEnd,- contentFingerprint = Some(fp)- )- relationships = relationships :+ ParsedRelationship(className, methodName, "CONTAINS")-- // Extract calls within this method- val calls = extractCalls(lines, i, methodEnd, methodName)- relationships = relationships ++ calls- }- }- }- i += 1- }-- (entities, relationships)- }-- /**- * Find end of a brace-delimited block starting near `startIdx`.- *- * Uses end-of-line brace depth to detect block entry. This correctly- * skips inline TypeScript type annotations like `{ kind?: string }`- * that balance to zero on a single line, which would otherwise cause- * the parser to think the function body ended on the parameter line.- */- private def findBraceBlockEnd(lines: Array[String], startIdx: Int): Int = {- var braceCount = 0- var entered = false- var i = startIdx- while (i < lines.length) {- for (ch <- lines(i)) {- if (ch == '{') braceCount += 1- if (ch == '}') braceCount -= 1- }- // Only mark as entered when braceCount > 0 at end of line.- // This skips inline type annotations like { a: string; b: number }- // that balance to 0 within the same line.- if (!entered && braceCount > 0) entered = true- if (entered && braceCount <= 0) return i + 1- i += 1- }- lines.length- }-- /**- * Extract CALLS relationships from a function/method body.- */- private def extractCalls(- lines: Array[String],- funcStartIdx: Int,- funcEndLine: Int,- callerName: String- ): Vector[ParsedRelationship] = {- var calls = Vector.empty[ParsedRelationship]- val seen = scala.collection.mutable.Set.empty[String]- var i = funcStartIdx + 1-- while (i < lines.length && (i + 1) <= funcEndLine) {- val line = lines(i)- CallPattern.findAllMatchIn(line).foreach { m =>- val callee = m.group(1)- if (callee != callerName && !TypeScriptBuiltins.contains(callee) &&- !TypeScriptKeywords.contains(callee) && !seen.contains(callee)) {- seen += callee- calls = calls :+ ParsedRelationship(callerName, callee, "CALLS")- }- }- i += 1- }- calls- }-- private val TypeScriptKeywords: Set[String] = Set(- "if", "else", "for", "while", "do", "switch", "case", "break",- "continue", "return", "throw", "try", "catch", "finally",- "new", "delete", "typeof", "instanceof", "void", "in", "of",- "class", "extends", "implements", "interface", "enum", "type",- "const", "let", "var", "function", "async", "await",- "import", "export", "default", "from", "as",- "this", "super", "constructor", "static", "private", "public", "protected"- )-- private val TypeScriptBuiltins: Set[String] = Set(- "console", "log", "error", "warn", "parseInt", "parseFloat",- "String", "Number", "Boolean", "Array", "Object", "Promise",- "JSON", "Math", "Date", "RegExp", "Error", "Map", "Set",- "WeakMap", "WeakSet", "Symbol",- "setTimeout", "setInterval", "clearTimeout", "clearInterval",- "require", "module", "exports",- "fetch", "Response", "Request", "URL", "Buffer", "process",- // Array/iterable methods- "map", "filter", "reduce", "forEach", "sort", "find", "some", "every",- "includes", "indexOf", "slice", "splice", "push", "pop", "shift", "unshift",- "concat", "join", "flat", "flatMap", "fill", "from",- // String methods- "split", "replace", "trim", "toUpperCase", "toLowerCase", "substring",- "charAt", "startsWith", "endsWith", "padStart", "padEnd", "match", "test",- // Object methods- "keys", "values", "entries", "assign", "create", "freeze",- "defineProperty", "getOwnPropertyNames", "hasOwnProperty",- // Promise methods- "then", "catch", "finally", "all", "race", "resolve", "reject"- )-}