kibi-plugin-treesitter
v2.0.0
Published
Offline multi-language Tree-sitter symbol extraction
Downloads
631
Readme
Kibi Tree-sitter plugin
This package provides the kibi.symbol-extractor.v2 capability for Python, Go, Rust, Java, C#, PHP, C, C++, Bash, Ruby, Terraform, and generic HCL source files. It returns syntax-derived declarations with explicit ok, partial, unsupported, or failed status for the exact source text it receives.
The package contains its pinned grammar WebAssembly files and parser queries. The runtime is web-tree-sitter 0.27.0. Catalog metadata records the upstream source commits, registry package integrity, parser ABI, query provenance, and SHA-256 digests. C and C++ header files use explicit language selection because .h alone cannot distinguish them. PHP analysis uses the mixed HTML/PHP grammar so declarations around embedded HTML remain visible. The shell catalog covers Bash syntax; .sh files use that subset, while a shebang naming a different or unknown interpreter returns unsupported.
At analysis time the plugin reads only its installed files and source text. It does not fetch grammars, run compilers, invoke the analyzed program, load language toolchains, evaluate Terraform, or expand macros. Parsing runs in a small pool of persistent workers (at most four, one fewer than the available CPUs) with bounded input, output symbols, and wall-clock time. Each worker loads a grammar once and serves one file at a time; a worker that times out or fails is replaced, and workers are recycled after 256 analyses. The wall-clock budget is the host-granted timeoutMs, capped at 10 seconds. Node workers configure 64 MiB old-generation heap, 16 MiB young-generation heap, and a 4 MiB stack. Bun ignores the Node resourceLimits option, so those heap and stack caps are not enforced there; see its Node compatibility documentation. WebAssembly linear memory and total process RSS are not separately capped in either runtime. The worker is not an operating-system sandbox.
ok means the selected syntax queries returned supported declaration forms without detected parse or coverage gaps; it is not proof of the complete runtime symbol set. Java, C#, and C++ overload locators preserve source-level parameter spelling; C++ method signatures also include const, volatile, and ref qualifiers. The analyzer does not resolve aliases, generic substitutions, or language-specific type equivalence. C/C++ includes, conditional compilation, and invoked declaration macros return partial; exact prototypes and definitions collapse within one file only when their supported signatures match, while unresolved collisions remain distinct with source-local locators and partial status. Python decorators, metaclasses, and exec(), Rust macro invocations, duplicate PHP declarations, dynamic Ruby method APIs/redefinitions, and Bash eval, sourced files, conditional declarations, and duplicate names also remain explicit partial-analysis cases.
Terraform and generic HCL output static labeled blocks as unknown structural symbols with precise nativeKind; Terraform locals attributes are variable symbols. Provider and terraform metadata blocks are omitted. Dynamic/escaped labels, unsupported Terraform block types, nested Terraform blocks, unlabeled generic HCL blocks, and nested HCL blocks are reported as uncovered. These records describe configuration structure and do not imply executable code or proof-bearing functions. HCL labels use JSON-escaped segment identities; source-local suffixes are only a way to preserve colliding declarations, not semantic identities.
Syntax errors omit damaged candidates and return partial while retaining clean declarations. Unsupported extensions return unsupported; oversize inputs, parser startup errors, and worker timeouts return failed. A valid file with no supported declarations can return an empty ok result. See catalog.json, integrity.json, SBOM.spdx.json, and THIRD_PARTY_NOTICES.md for the complete shipped component record.
