@kreuzberg/opencode-tree-sitter-language-pack
v0.2.2
Published
OpenCode tools for parsing and code intelligence with the ts-pack CLI.
Maintainers
Readme
tree-sitter-language-pack
Parse and extract code intelligence from 300+ programming languages with tree-sitter — structure, imports, symbols, and syntax-aware chunking — using the local ts-pack CLI in your agent.
Install
From the marketplace (recommended)
Pending review for official Claude marketplace.
Self-host:
/plugin marketplace add kreuzberg-dev/plugins
/plugin install tree-sitter-language-pack@kreuzbergBinary requirement
The bundled MCP launcher (scripts/mcp-launch.sh) resolves a ts-pack binary
automatically on first run: it reuses one already on PATH, then tries
npx/uvx, then Homebrew, then a prebuilt download from the tool's latest
GitHub release. No manual install is required to use the MCP server.
To install the ts-pack CLI yourself:
brew install kreuzberg-dev/tap/ts-pack
# or run it without a persistent install (the CLI proxy package self-installs the binary):
npx @kreuzberg/ts-pack-cli --help
uvx --from ts-pack-cli ts-pack --help
# or download a prebuilt binary from the latest GitHub release:
# https://github.com/kreuzberg-dev/tree-sitter-language-pack/releases/latest
# or build from source (binary is installed as `ts-pack`):
cargo install --git https://github.com/kreuzberg-dev/tree-sitter-language-pack ts-pack-cliParser libraries download on demand the first time a language is used. For offline or CI runs, prefetch them:
ts-pack download --all # every language
ts-pack download python rust # specific languagesSDKs (optional)
pip install tree-sitter-language-pack # Python
npm install @kreuzberg/tree-sitter-language-pack # Node.js / TypeScriptRust, Ruby, Go, Java, C#, PHP, Elixir, and WebAssembly bindings are also published.
Skills shipped
| Skill | Trigger |
|-------|---------|
| tree-sitter-language-pack | Parse and extract code intelligence from 306 languages. Use when writing code that parses source, extracts structure/imports/exports/symbols/docstrings/comments, detects a language, runs diagnostics, or chunks code for LLMs — in Rust, Python, Node.js/TypeScript, or the ts-pack CLI. |
| parsing-source | Use when the user wants a tree-sitter syntax tree for a source file — an s-expression dump or JSON tree. |
| extracting-code-structure | Use when the user wants structured code metadata — functions, classes, imports, exports, symbols, docstrings, comments, or syntax diagnostics. |
| chunking-for-llms | Use when splitting source code into chunks for an LLM context window without breaking syntax mid-construct. |
| detecting-languages | Use when the user wants to know which programming language a file or snippet is — by path, extension, or content. |
| managing-parsers | Use when managing the parser cache — prefetch for offline/CI, list downloaded languages, inspect a language, find the cache dir, or clean it. |
| using-the-mcp-server | Use when parsing, processing, or detecting languages through the MCP server's parse/process/detect tools instead of the CLI. Covers the tool surface and the auto-installing launcher. |
MCP server
The plugin auto-registers an MCP server named tree-sitter-language-pack,
launched via scripts/mcp-launch.sh (which execs ts-pack mcp). It exposes
ts-pack's parse (syntax tree), process (structure/imports/exports/symbols/
docstrings/diagnostics/chunks), and detect (language detection) capabilities as
tools, so the agent can parse and analyze code directly without shelling out to
the CLI. The launcher auto-installs a binary on first run (override with
TS_PACK_LAUNCHER=auto|npx|uvx|brew|download). The mcp subcommand ships in a
recent release of the tool; an older binary on PATH may need an upgrade to
expose it. See the using-the-mcp-server skill for details.
CLI
ts-pack subcommands:
| Command | Purpose |
|---------|---------|
| parse <file> | Parse into a syntax tree (--format sexp\|json). |
| process <file> | Code-intelligence pipeline → JSON (feature flags below). |
| list | List languages (--downloaded, --manifest, --filter). |
| info <language> | Show whether a language is known and cached. |
| download [langs...] | Download parsers (--all, --groups, --fresh). |
| clean | Remove all cached parsers (--force). |
| cache-dir | Print the cache directory. |
| init | Write a language-pack.toml config. |
| completions <shell> | Generate shell completions. |
process flags: --structure, --imports, --exports, --comments,
--symbols, --docstrings, --diagnostics, --all, --chunk-size <bytes>,
--language <name>. With no feature flags it defaults to
--structure --imports --exports.
There is no detect or validate subcommand: language detection is
implicit in parse/process (from the file extension), and diagnostics
come from process --diagnostics. Content-based detection is available in
the SDK (detect_language_from_content).
SDK
from tree_sitter_language_pack import process, ProcessConfig
result = process(source_code, ProcessConfig("python").all())
for item in result["structure"]:
print(item["kind"], item["name"], item["start_line"])import { process, detectLanguageFromPath } from "@kreuzberg/tree-sitter-language-pack";
const lang = detectLanguageFromPath("src/app.ts");
const result = process(source, { language: lang ?? "typescript", structure: true, imports: true });Configuration
ts-pack init writes a language-pack.toml pinning a cache directory and a
language set:
cache_dir = ".ts-pack-cache"
languages = ["python", "rust", "typescript"]Commit it to pin the parser set across a team or CI. The cache location can
also be inspected with ts-pack cache-dir.
Examples
Parse a file into a syntax tree:
ts-pack parse src/main.rsExtract structure and imports as JSON:
ts-pack process src/app.ts --structure --importsChunk a large file for an LLM:
ts-pack process big_module.py --chunk-size 2000Versioning
The plugin version tracks the marketplace VERSION file. See CHANGELOG.md for release notes.
License
MIT. The upstream tree-sitter-language-pack library is also MIT-licensed.
See also
- Marketplace: kreuzberg-dev/plugins
- Upstream: kreuzberg-dev/tree-sitter-language-pack
- Sibling plugins: kreuzberg, kreuzcrawl, kreuzberg-cloud
