Skip to main content

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.

The tree-sitter command-line interface is used to create, manage, test, and build Tree-sitter parsers. It provides a comprehensive set of tools for grammar development, testing, and deployment.

Configuration

The CLI is controlled by two configuration files:

Command Categories

Grammar Development

  • init - Initialize a grammar repository
  • init-config - Generate a default config file
  • generate - Generate a parser from grammar
  • build - Compile a parser

Testing and Debugging

  • test - Run a parser’s tests
  • parse - Parse files
  • fuzz - Fuzz a parser

Query and Analysis

  • query - Search files using a syntax tree query
  • highlight - Highlight a file
  • tags - Generate a list of tags

Tools

  • playground - Start local playground in the browser
  • version - Display or increment the version of a grammar
  • dump-languages - Print info about all known language parsers
  • complete - Generate shell completions

Getting Help

To see all available commands:
tree-sitter --help
To get help for a specific command:
tree-sitter <command> --help

Environment Variables

  • TREE_SITTER_JS_RUNTIME - JavaScript runtime to use for parser generation (default: node)
  • TREE_SITTER_ABI_VERSION - Language ABI version to generate
  • TREE_SITTER_WASI_SDK_PATH - Path to Wasi SDK for Wasm compilation
  • TREE_SITTER_EDITS - Maximum number of edits for fuzzing
  • TREE_SITTER_ITERATIONS - Number of iterations for fuzzing
  • NO_COLOR - Set to 1 to disable colored output
  • CC - C compiler to use for building
  • CFLAGS - Additional flags for C compiler