mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
Wires Kotlin into the existing tree-sitter pipeline so .kt and .kts files now produce functions, classes, data classes, sealed classes, interfaces, objects, imports, exports, and call-graph edges — matching the behavior of the other language extractors. ## Why @tree-sitter-grammars/tree-sitter-kotlin The standard `tree-sitter-kotlin` (v0.3.8) ships only native bindings. The new `@tree-sitter-grammars/tree-sitter-kotlin@1.1.0` ships a prebuilt `.wasm` (loads cleanly with `web-tree-sitter@^0.26.6`, nodeTypeCount=289, parses class_declaration / function_declaration as expected). Same shape that PR1 used for Swift, just a different publisher because the repomix WASM bundle does not include Kotlin. `@tree-sitter-grammars` is the official tree-sitter org's GitHub account, so this is the canonical upstream WASM source for Kotlin. ## Notes for reviewers - `kotlinConfig` already existed as a stub (no `treeSitter` field), so Android / JVM / Gradle codebases currently produce no structural edges between `.kt` files. This PR adds the `treeSitter` field; the existing plugin loader picks it up unchanged. - **Visibility rule differs from Swift**: Kotlin's default visibility is `public`, so the extractor treats *every* declaration with no modifier as exported. Only an explicit `private` opts out. `internal` and `protected` remain exported in the project-graph sense because they are still resolvable from other files (within the module / via inheritance). - `class_declaration` in tree-sitter-kotlin is overloaded for class, data class, sealed class, and interface (distinguished by the keyword child and `modifiers > class_modifier`). The extractor handles all four uniformly. - `object_declaration` is a separate node type (Kotlin singletons) — treated as a class-like entry with its own `name` and members. - Primary-constructor parameters marked `val` / `var` are surfaced as class properties; plain `parameter`s without `val/var` are constructor-only and are NOT counted as properties (matching Kotlin semantics). - Import handling distinguishes the three forms: plain dotted (`import a.b.C`), wildcard (`import a.b.*` → specifier `"*"`), and aliased (`import a.b.C as Foo` → specifier `"Foo"`). ## Verification - `pnpm lint` clean - `pnpm --filter @understand-anything/core build` clean - `pnpm --filter @understand-anything/skill build` clean - `pnpm --filter @understand-anything/core test`: **692/692** (+22 new Kotlin tests, matching the bar set by go-extractor.test.ts / swift-extractor.test.ts) - `pnpm test`: 196/196 (no regressions) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
58 lines
1.4 KiB
JSON
58 lines
1.4 KiB
JSON
{
|
|
"name": "@understand-anything/core",
|
|
"version": "0.1.0",
|
|
"type": "module",
|
|
"main": "dist/index.js",
|
|
"types": "dist/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./dist/index.js"
|
|
},
|
|
"./search": {
|
|
"types": "./dist/search.d.ts",
|
|
"default": "./dist/search.js"
|
|
},
|
|
"./types": {
|
|
"types": "./dist/types.d.ts",
|
|
"default": "./dist/types.js"
|
|
},
|
|
"./schema": {
|
|
"types": "./dist/schema.d.ts",
|
|
"default": "./dist/schema.js"
|
|
},
|
|
"./languages": {
|
|
"types": "./dist/languages/index.d.ts",
|
|
"default": "./dist/languages/index.js"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"test": "vitest run"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^25.5.0",
|
|
"@vitest/coverage-v8": "3.2.4",
|
|
"typescript": "^5.7.0",
|
|
"vitest": "^3.1.0"
|
|
},
|
|
"dependencies": {
|
|
"@tree-sitter-grammars/tree-sitter-kotlin": "1.1.0",
|
|
"fuse.js": "^7.1.0",
|
|
"ignore": "^7.0.5",
|
|
"tree-sitter-c-sharp": "^0.23.1",
|
|
"tree-sitter-cpp": "^0.23.4",
|
|
"tree-sitter-go": "^0.25.0",
|
|
"tree-sitter-java": "^0.23.5",
|
|
"tree-sitter-javascript": "^0.25.0",
|
|
"tree-sitter-php": "^0.23.11",
|
|
"tree-sitter-python": "^0.25.0",
|
|
"tree-sitter-ruby": "^0.23.1",
|
|
"tree-sitter-rust": "^0.24.0",
|
|
"tree-sitter-typescript": "^0.23.2",
|
|
"web-tree-sitter": "^0.26.6",
|
|
"yaml": "^2.8.3",
|
|
"zod": "^4.3.6"
|
|
}
|
|
}
|