Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mehen.ophi.dev/llms.txt

Use this file to discover all available pages before exploring further.

The languages that go through tree-sitter (Go, Kotlin, C, PowerShell, plus the Markdown text extensions used by mehen-markdown) are parsed via pinned tree-sitter-<lang> crates. Grammars change over time and need periodic updates — both for bug fixes and to keep up with new syntax. Grammars can be updated on Linux and macOS natively, or on Windows using WSL.

Currently pinned tree-sitter grammars

The pin lives in xtask/Cargo.toml (consumed by the kind-enum generator) and in the owning crates/mehen-<lang>/Cargo.toml (consumed by the analyzer at runtime). Most grammars are routed through [workspace.dependencies] in the root Cargo.toml and referenced as { workspace = true } from both call sites; some, like tree-sitter-c, are inline-pinned because only one analyzer consumes them.
GrammarUsed by
tree-sitter-cmehen-c
tree-sitter-gomehen-go
tree-sitter-kotlin-sgmehen-kotlin
tree-sitter-pwshmehen-powershell
tree-sitter-markdown-textmehen-markdown (auxiliary)
The Python, TypeScript / JavaScript / TSX / JSX, PHP, Ruby, and Rust analyzers do not use tree-sitter; they have no grammar.rs and need no kind-enum regeneration. Markdown’s primary parser is pulldown-cmark; the tree-sitter Markdown grammar is only used for ancillary text extensions.

Update process

1

Bump the pin

Update all locations the grammar is pinned. For workspace-routed grammars, that’s the line in root Cargo.toml [workspace.dependencies]. For inline-pinned grammars, both xtask/Cargo.toml and the owning crates/mehen-<lang>/Cargo.toml:
tree-sitter-c = "=x.xx.x"
2

Regenerate kind enums

cargo xtask tree-sitter generate --all
This rewrites every tree-sitter-backed crate’s grammar.rs from the pinned grammar’s node-kind table. CI runs cargo xtask tree-sitter check-generated to ensure pinned-grammar bumps without a regenerate are caught at PR time.
3

Fix breakage

New node kinds may appear (and need handling), and existing node kinds may be renamed or restructured. Update analyzer code accordingly.
4

Run validation

cargo nextest run --all-features
cargo insta test --workspace --all-features --check --unreferenced reject \
    --test-runner nextest --no-test-runner-fallback --disable-nextest-doctest
cargo clippy --all-targets --all-features --locked
5

Open a PR

Commit the updated Cargo.toml, Cargo.lock, and any regenerated grammar.rs files.

Automation

Dependabot raises grammar bump PRs automatically. The regenerate-grammars workflow detects those PRs (branch name contains tree-sitter) and runs cargo xtask tree-sitter generate --all plus the test suite, then commits the regenerated files back to the PR branch. Reviewers should still verify analyzer code still handles any renamed kinds.

See also