Skip to main content

Supported Languages

Shaktiman indexes source files using tree-sitter grammars. The following languages are wired today, with their file extensions, imports recognized, and chunkable node types. The authoritative list lives in internal/parser/languages.go (GetLanguageConfig).

Languages

LanguageExtensionsImport / export / ambient wrappersChunkable kinds
TypeScript.ts, .tsximport: import_statement; export: export_statement; ambient: ambient_declarationfunction, class, interface, type, block, method, namespace
JavaScript.js, .jsx, .mjs, .cjsimport: import_statement; export: export_statementfunction, class, type, block, method
Python.pyimport: import_statement, import_from_statementfunction, class, type, block
Go.goimport: import_declarationfunction, method, type, block
Rust.rsimport: use_declarationfunction, type, interface, block (modules / impl / traits / macros)
Java.javaimport: import_declarationclass, interface, type, method, block
Ruby.rb, .rake, .gemspec— (require / require_relative are method calls, not distinct import nodes)function, class
ERB.erbblock (directive / output_directive / template)
Bash.sh, .bashfunction

What "chunkable" means

Every language config maps tree-sitter node types to a NodeMeta{Kind, IsContainer} entry:

  • IsContainer: true — the parser recurses into the node's body (classes, traits, modules, impl blocks, export wrappers). Nested methods, trait methods, and so on each become their own chunks.
  • IsContainer: false — the parser stops at the declaration (functions, types, const/var).
  • Wrappers (e.g. export_statement, decorated_definition) have Kind: "" and are resolved via their inner child.

The recursive-AST design is captured in ADR-004: Recursive AST-Driven Chunking.

Adding a language

Per the Contributing guide, adding a language requires:

  1. Add a LanguageConfig entry in internal/parser/languages.go with the tree-sitter grammar, import node types, and chunkable kinds.
  2. Import the tree-sitter grammar (tree-sitter-<lang>).
  3. Register file extensions in internal/daemon/scanner.go and internal/core/fallback.go.
  4. Add test fixtures under testdata/.
  5. Optionally add test-file patterns in langTestPatterns (internal/types/config.go).

Known gaps

Tree-sitter grammar coverage is not uniform — a language shown above may still have specific constructs that don't produce an expected chunk. See Known Limitations and docs/review-findings/parser-bugs-from-recursive-chunking.md for the current list.

Source of truth

  • internal/parser/languages.goGetLanguageConfig, per-language NodeMeta mappings, grammar imports.
  • internal/types/config.golangTestPatterns (test-file glob defaults).
  • internal/daemon/scanner.go — file extension → language dispatch.