CLI reference
ts-pack downloads tree-sitter parsers and runs code intelligence from the command line.
Installation
Section titled “Installation”cargo install ts-pack-clibrew tap xberg-io/homebrew-tapbrew install xberg-io/homebrew-tap/ts-packVerify the install:
ts-pack --versionCommands
Section titled “Commands”| Command | What it does |
|---|---|
download |
Download parser libraries |
clean |
Remove cached parsers |
list |
List available languages |
info |
Show details about a language |
parse |
Parse a file and output the syntax tree |
process |
Run code intelligence on a file |
cache-dir |
Print the cache directory path |
init |
Create a language-pack.toml config file |
completions |
Generate shell completions |
ts-pack download
Section titled “ts-pack download”Download parser libraries to the local cache.
ts-pack download [LANGUAGES...] [OPTIONS]| Flag | Description |
|---|---|
--all |
Download all 306 parsers |
--groups <groups> |
Download by group (comma-separated: web, systems, scripting, data, jvm, functional) |
--fresh |
Clear the cache before downloading |
# Download specific parsersts-pack download python javascript typescript
# Download everythingts-pack download --all
# Re-download from scratch, ignoring the cachets-pack download python --fresh
# Download a groupts-pack download --groups web,systems
# Download whatever languages-pack.toml specifies (if one is found)ts-pack downloadWithout arguments and with no language-pack.toml present, the command exits with an error.
ts-pack clean
Section titled “ts-pack clean”Remove all cached parser libraries. Prompts for confirmation unless you pass --force.
ts-pack clean [OPTIONS]| Flag | Description |
|---|---|
--force |
Skip the confirmation prompt |
ts-pack clean # prompts: "Continue? [y/N]"ts-pack clean --force # no promptts-pack list
Section titled “ts-pack list”List available languages.
ts-pack list [OPTIONS]| Flag | Description |
|---|---|
--downloaded |
Show only locally cached parsers |
--manifest |
Show all languages from the remote manifest (default) |
--filter <text> |
Filter by substring |
ts-pack list # all available languagests-pack list --downloaded # only what's in the cachets-pack list --filter script # languages whose name contains "script"ts-pack info
Section titled “ts-pack info”Show details about a specific language.
ts-pack info <LANGUAGE>ts-pack info pythonOutput when the parser has downloaded:
Language: pythonKnown: trueDownloaded: trueCache path: /home/user/.cache/tree-sitter-language-pack/libtree_sitter_python.soBefore the parser downloads, Cache path shows the cache directory instead.
ts-pack parse
Section titled “ts-pack parse”Parse source code and output the syntax tree.
ts-pack parse <FILE> [OPTIONS]Use - as FILE to read from stdin (requires --language).
| Flag | Description |
|---|---|
--language <lang>, -l |
Language name. Auto-detected from the file extension if omitted. |
--format <fmt>, -f |
sexp (default) or json |
ts-pack parse src/main.pyts-pack parse src/main.py --format jsonecho "def hello(): pass" | ts-pack parse - --language pythonSample sexp output:
(module (function_definition name: (identifier) parameters: (parameters) body: (block (expression_statement (call ...)))))The JSON format wraps the sexp string alongside the language name and an has_errors boolean.
ts-pack process
Section titled “ts-pack process”Run code intelligence on a source file and output structured JSON.
ts-pack process <FILE> [OPTIONS]Use - as FILE to read from stdin. When reading from stdin, you must pass --language.
| Flag | Description |
|---|---|
--language <lang>, -l |
Language name. Auto-detected from extension if omitted. |
--all |
Enable all analysis features |
--structure |
Extract functions, classes, and methods |
--imports |
Extract import statements |
--exports |
Extract exported symbols |
--comments |
Extract comments |
--symbols |
Extract all identifiers |
--docstrings |
Extract docstrings |
--diagnostics |
Report syntax errors |
--chunk-size <n> |
Split output into chunks of at most n bytes |
Without any feature flags, the default extracts structure, imports, and exports.
# Full analysists-pack process src/app.py --all
# Structure onlyts-pack process src/app.py --structure
# Chunk a large file for LLM ingestionts-pack process large_module.py --chunk-size 800
# From stdincat src/main.go | ts-pack process - --language go --importsts-pack cache-dir
Section titled “ts-pack cache-dir”Print the effective cache directory path.
ts-pack cache-dir# Use in scriptsCACHE=$(ts-pack cache-dir)du -sh "$CACHE"ts-pack init
Section titled “ts-pack init”Create a language-pack.toml config file in the current directory.
ts-pack init [OPTIONS]| Flag | Description |
|---|---|
--cache-dir <path> |
Set a custom cache directory in the generated file |
--languages <langs> |
Comma-separated languages to pre-fill |
ts-pack initts-pack init --languages python,javascript,typescript,rustGenerated file (empty init):
# languages = ["python", "rust"]With --languages python,rust:
languages = ["python", "rust"]After init, run ts-pack download to fetch the listed parsers.
ts-pack completions
Section titled “ts-pack completions”Generate shell completion scripts.
ts-pack completions <SHELL>Supported: bash, zsh, fish, powershell, elvish.
ts-pack completions bash >> ~/.bash_completionts-pack completions zsh > ~/.zsh/completions/_ts-packts-pack completions fish > ~/.config/fish/completions/ts-pack.fishExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
Success |
1 |
Error — message printed to stderr |
Use in CI
Section titled “Use in CI”Pre-download parsers and cache them between runs:
- name: Install ts-pack run: cargo install ts-pack-cli
- name: Cache parsers uses: actions/cache@v4 with: path: ~/.cache/tree-sitter-language-pack key: tslp-${{ hashFiles('language-pack.toml') }}
- name: Download parsers run: ts-pack download
- name: Analyze run: ts-pack process src/main.py --all