Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tree-sitter/tree-sitter/llms.txt
Use this file to discover all available pages before exploring further.
Publishing Your Grammar
Once your parser is stable and well-tested, you can publish it to make it available to others.Publishing Platforms
Publish your grammar to multiple registries to maximize discoverability:GitHub
Host your source code and releases
crates.io
Rust package registry
npm
JavaScript package registry
PyPI
Python package index
Automated Publishing
Use Tree-sitter’s reusable workflows to automate the publishing process.Setup GitHub Workflows
Create.github/workflows/publish.yml:
.github/workflows/publish.yml
Configure Secrets
Add repository secrets in GitHub Settings > Secrets and variables > Actions:CARGO_TOKEN
Get from crates.io/me > API Tokens
NPM_TOKEN
Generate with
npm token create or at npmjs.comPYPI_TOKEN
Create at pypi.org/manage/account
The workflow automatically regenerates the parser and publishes to all configured registries when you push a version tag.
Release Process
Follow these steps to release a new version:Semantic Versioning
Follow Semantic Versioning for predictable updates:Version Format
When to Increment
MAJOR
Incompatible grammar changes:
- Node type renames
- Structural changes
- Removed nodes
MINOR
New features:
- New node types
- New patterns
- Added fields
PATCH
Bug fixes:
- Parse errors fixed
- No structural changes
- Performance improvements
Pre-1.0 Versions
For0.y.z versions (pre-release), be more conservative:
Example:
0.1.0→0.2.0: Breaking grammar changes0.1.0→0.1.1: New features0.1.0→0.1.0-patch.1: Bug fixes only
Manual Publishing
If you prefer manual control, publish to each registry separately:Cargo (Rust)
npm (JavaScript)
PyPI (Python)
Pre-Release Checklist
Before publishing, ensure:Documentation is complete
Documentation is complete
- README explains how to use the parser
- Examples show common use cases
- Grammar rules are documented
- Field names are described
Tests are comprehensive
Tests are comprehensive
- All rules have test coverage
- Edge cases are tested
- Tests pass on all platforms
- CI/CD is green
Package metadata is correct
Package metadata is correct
- Version number is accurate
- License is specified
- Author information is filled in
- Repository URL is set
Code quality is high
Code quality is high
- No compiler warnings
- External scanner is well-tested
- Performance is acceptable
- Memory is properly managed
Repository Structure
A well-organized repository includes:README Template
Provide a clear README:README.md
Cargo
PyPI
Usage
Node.js
Rust
Python
Development
Contributing
Contributions are welcome! Please:- Fork the repository
- Create a feature branch
- Add tests for your changes
- Ensure all tests pass
- Submit a pull request
License
MIT License - see LICENSE file for detailsRegular Releases
Release updates regularly to:- Fix reported bugs
- Add requested features
- Improve performance
- Update documentation
Example: Python Grammar
The tree-sitter-python repository is an excellent example:- Comprehensive tests
- Automated publishing workflow
- Good documentation
- Active maintenance
- Multiple platform support
Next Steps
Congratulations on publishing your parser! Consider:- Adding query files for syntax highlighting
- Creating editor integrations (Neovim, Emacs, VSCode)
- Writing documentation about interesting grammar patterns
- Contributing to other Tree-sitter projects