api
無料Use tree-sitter-language-pack api reference documentation.
日本語の概要は準備中です。原文の説明を表示しています。
Parse and extract code intelligence from 372 programming languages using tree-sitter grammars. Use when writing code that parses source, extracts structure/imports/exports/symbols/docstrings/comments, detects a language, runs syntax diagnostics, or produces syntax-aware chunks for LLMs — in Rust, Python, Node.js/TypeScript, or the ts-pack CLI. Covers installation, the CLI surface, the SDK surface, and parser-cache management.
日本語の概要は準備中です。原文の説明を表示しています。
実行スコア 未検証
インストール方法を見るインストールする前に、エージェントに与えられる指示の中身を確認できます。
tree-sitter-language-pack is a polyglot code parsing and analysis library with a high-performance Rust core and polyglot bindings for 15 languages — Python, Node.js/TypeScript, Ruby, Go, Java, C#, PHP, Elixir, Dart, Kotlin (Android), Swift, Zig, and WebAssembly, plus a C ABI and JNI. It compiles 372 tree-sitter grammars into efficient parsers and exposes code intelligence on top of them.
ts-pack CLI.Use this skill when writing code that parses source in any supported language, extracts code metadata, chunks code for an LLM, detects a language, or validates syntax.
Reach for tree-sitter-language-pack when you need a real syntax tree or structured code metadata — building a code index, feeding code to an LLM in semantically coherent chunks, linting for syntax errors across many languages, or detecting a file's language. For plain text extraction from documents (PDF, Office, HTML), use Xberg instead.
ts-pack) — quick one-shot parsing and extraction over files,
parser-cache management, and shell/CI pipelines. parse and process
print to stdout (process always emits JSON). Auto-detects the language
from the file extension.ts-pack mcp) — exposes parse/process/detect_language
(plus language and cache tools) as agent tools, so an MCP client can parse
and analyze code directly with no shell-out.
This plugin auto-registers it; see the tree-sitter-language-pack-using-the-mcp-server skill.Prefer the CLI for ad-hoc work in an agent session; prefer the SDK when the result feeds back into a larger program; prefer the MCP server when the agent should call parsing directly as a tool.
brew install xberg-io/tap/ts-pack
# or run without a persistent install (the CLI proxy package self-installs the binary):
npx @xberg-io/ts-pack-cli --help
# or download a prebuilt binary from the latest GitHub release:
# https://github.com/xberg-io/tree-sitter-language-pack/releases/latest
# or install from crates.io:
cargo install ts-pack-cli
# binary is installed as `ts-pack`
pip install tree-sitter-language-pack
# or: uv add tree-sitter-language-pack
npm install @xberg-io/tree-sitter-language-pack
# or: pnpm add @xberg-io/tree-sitter-language-pack
# Cargo.toml
[dependencies]
tree-sitter-language-pack = { version = "1", features = ["download"] }
Other bindings: Ruby (gem install tree_sitter_language_pack), Go, Java,
C#, PHP, Elixir, Dart, Kotlin (Android), Swift, Zig, and WebAssembly
(npm install @xberg-io/tree-sitter-language-pack-wasm). See
https://github.com/xberg-io/tree-sitter-language-pack.
ts-pack has these subcommands:
| Command | Purpose |
|---|---|
parse <file> | Parse a file into a syntax tree (`--format sexp |
process <file> | Run the code-intelligence pipeline, emit JSON. |
detect* | No standalone command — parse/process auto-detect from the extension. Use the SDK for content detection. |
list | List available languages (--downloaded, --manifest, --filter). |
info <language> | Show whether a language is known and cached. |
download [langs...] | Download parser libraries (--all, --groups, --fresh). |
clean | Remove all cached parser libraries (--force). |
cache-dir | Print the effective cache directory. |
init | Write a language-pack.toml config (--languages, --cache-dir). |
completions <shell> | Generate shell completions. |
mcp | Start the MCP server (--transport stdio). |
* Language detection is implicit in parse/process. There is no
detect or validate subcommand; diagnostics come from
process --diagnostics.
ts-pack parse src/main.rs # s-expression tree (auto-detect)
ts-pack parse src/main.rs --format json # { language, sexp, has_errors }
ts-pack parse - --language python # read from stdin, explicit language
# Defaults to structure + imports + exports when no feature flags are given:
ts-pack process src/app.ts
# Pick features explicitly:
ts-pack process src/app.ts --structure --imports --symbols --docstrings
# Everything:
ts-pack process src/app.ts --all
# Syntax-aware chunks (bytes) for an LLM:
ts-pack process src/app.ts --chunk-size 2000
# Syntax diagnostics:
ts-pack process src/app.ts --diagnostics
process always prints JSON. Top-level keys: language, metrics,
structure, imports, exports, comments, docstrings, symbols,
diagnostics, and chunks (when --chunk-size is set).
from tree_sitter_language_pack import process, ProcessConfig, detect_language_from_path
config = ProcessConfig("python", symbols=True, docstrings=True) # structure/imports/exports default to True
result = process(source_code, config)
for item in result.structure: # ProcessResult is an object, not a dict
print(item.kind, item.name, item.span.start_line)
# Path-based detection (use detect_language_from_content for raw text;
# see the detecting-languages skill):
lang = detect_language_from_path("src/app.py")
import { process, detectLanguageFromPath } from "@xberg-io/tree-sitter-language-pack";
const lang = detectLanguageFromPath("src/app.ts");
const result = process(source, { language: lang ?? "typescript", structure: true, imports: true });
Parsers download on demand the first time a language is used and are cached locally. For offline or CI runs, prefetch:
ts-pack download python rust typescript # specific languages
ts-pack download --all # everything
ts-pack download --groups all # by group (see manifest_groups())
ts-pack list --downloaded # what is cached
ts-pack cache-dir # where the cache lives
ts-pack clean --force # wipe the cache
See the tree-sitter-language-pack-managing-parsers skill for the full cache workflow.
tree-sitter-language-pack-parsing-source — parse a file into a syntax tree / s-expression.tree-sitter-language-pack-extracting-code-structure — process with structure/imports/exports/
symbols/docstrings.tree-sitter-language-pack-chunking-for-llms — --chunk-size syntax-aware splitting.tree-sitter-language-pack-detecting-languages — detect by path, extension, or content.tree-sitter-language-pack-managing-parsers — download/clean/list/info parser-cache management.tree-sitter-language-pack-using-the-mcp-server — call parse/process/detect_language over MCP
instead of the CLI.Full documentation: https://github.com/xberg-io/tree-sitter-language-pack
まだレビューはありません。使ってみた感想をお寄せください。
ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。
まだコメントはありません。最初のコメントを書いてみませんか。
Use tree-sitter-language-pack api reference documentation.
日本語の概要は準備中です。原文の説明を表示しています。
Use tree-sitter-language-pack cli reference documentation.
日本語の概要は準備中です。原文の説明を表示しています。
Use tree-sitter-language-pack mcp reference documentation.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user wants to split source code into chunks for an LLM context window without breaking syntax mid-construct. Covers `ts-pack process --chunk-size`, why syntax-aware splits beat fixed-byte splits, picking a size, and the chunk JSON shape.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user wants to know which programming language a file or snippet is. Covers implicit detection in `ts-pack parse`/`process`, confirming support with `ts-pack list`/`info`, and the SDK detection functions for path, extension, and raw content.
日本語の概要は準備中です。原文の説明を表示しています。
Use when the user wants structured code metadata from a source file — functions, classes, imports, exports, symbols, docstrings, comments, or syntax diagnostics. Covers `ts-pack process` feature flags, the JSON result shape, and the default feature set.
日本語の概要は準備中です。原文の説明を表示しています。