tree-sitter-manager
tree-sitter-manager
Reusable Crystal runtime for Tree-sitter grammar discovery, installation, loading, parsing, and cache management.
The command-line interface, TUI, highlighting, themes, and renderers live in the companion tree-sitter-manager-cli application. Keeping them separate means applications such as Chiasmus can use grammar management without pulling in terminal UI dependencies.
Installation
Add the dependency to your shard.yml:
dependencies:
tree-sitter-manager:
github: dsisnero/tree-sitter-manager
Run shards install.
Usage
Library
require "tree-sitter-manager"
TreeSitterManager::GrammarManager.init
result = TreeSitterManager::GrammarManager.instance.ensure_grammar_async("crystal").receive
The public entry point intentionally exposes only the reusable runtime. It has no CLI, TUI, theme, renderer, or highlighting dependencies.
CLI and TUI
Install or develop the companion tree-sitter-manager-cli application for the interactive commands and syntax-highlighting interface.
# Highlight a file
tree-sitter-manager highlight file.cr
# With a specific theme and format
tree-sitter-manager highlight file.cr --theme nord::nord --format html
# List themes, languages, queries
tree-sitter-manager themes
tree-sitter-manager languages
tree-sitter-manager queries crystal
# Stats and diagnostics
tree-sitter-manager stats
tree-sitter-manager doctor
# Generate shell completions
tree-sitter-manager completions bash > /etc/bash_completion.d/tree-sitter-manager
TUI
tsm-tui # Opens file picker
tsm-tui file.cr # Opens file directly
Key bindings: q quit, t/T cycle theme, / search theme, ↑/↓ scroll, Ctrl+o open file, ? toggle help.
Runtime storage
The core uses standard XDG locations under tree-sitter-manager, for example ~/.cache/tree-sitter-manager/grammars.
The CLI application owns its presentation configuration.
The companion CLI owns its own presentation configuration and query assets.
Documentation
| Document | Purpose |
|---|---|
| Architecture | System design, data flow, package responsibilities |
| Development | Prerequisites, setup, daily workflow |
| Coding Guidelines | Code style, error handling, naming conventions |
| Testing | Test commands, conventions, patterns |
| PR Workflow | Commits, PRs, branch naming, review process |
Development
shards install
shards build # Build the core verification target
crystal spec # Run tests
crystal tool format # Format code
ameba src spec bin # Lint
Contributing
- Fork it (https://github.com/dsisnero/tree-sitter-manager/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
License
MIT
Contributors
- Dominic Sisneros — creator and maintainer
tree-sitter-manager
- 0
- 0
- 0
- 1
- 2
- 7 days ago
- July 11, 2026
MIT License
Thu, 30 Jul 2026 04:18:05 GMT