| Crates.io | type-sitter-cli |
| lib.rs | type-sitter-cli |
| version | 0.8.0 |
| created_at | 2023-05-08 12:10:51.234218+00 |
| updated_at | 2025-08-12 22:26:16.388468+00 |
| description | CLI for type-sitter (generate typed wrappers for tree-sitter grammars from node-types.json and queries) |
| homepage | |
| repository | https://github.com/Jakobeha/type-sitter/ |
| max_upload_size | |
| id | 859726 |
| size | 2,897,807 |
See type-sitter for background information, and type-sitter#cli-tool for a guide on how to use that applied to most cases. This is the command-line tool which generates typed-safe wrappers for tree-sitter nodes.
Remember, if -o isn't specified it defaults to src/type_sitter.
# Generate bindings for the `yak-sitter` feature
type-sitter-cli vendor/tree-sitter-foobar-lang --use-yak-sitter
echo "pub mod foobar_lang;\n" > src/type_sitter.rs
# You can generate bindings for multiple grammars in the same directory
type-sitter-cli vendor/tree-sitter-typescript --use-yak-sitter
echo "pub mod typescript;\n" >> src/type_sitter.rs
# Generate only node types or queries
type-sitter-cli vendor/tree-sitter-rust/src/node-types.json --use-yak-sitter
echo "pub mod rust;\n" >> src/type_sitter.rs # src/type_sitter/rust.rs contains only node types
type-sitter-cli vendor/tree-sitter-json/queries/json --use-yak-sitter
echo "pub mod json;\n" >> src/type_sitter.rs # src/type_sitter/json.rs contains only queries
# To see help for the CLI program
type-sitter-cli --help
type-sitter-cli doesn't generate the root module for generated sources itself, you must do so manually. e.g.
if the root module is the default (src/type_sitter), either create src/type_sitter.rs or src/type_sitter/mod.rs
and add pub mod <my_language>; to it.type_sitter.type-sitter dependency in your Cargo.toml. Also, make sure use-default-features is
set to false, because the default features includes the proc macros, which the CLI is an alternative to.tree-sitter.0.22.