Zellij
A terminal workspace with panes, tabs and sessions, and on-screen hints so you don't need to memorise keys.
Instead of tmux and GNU screen
Search, lint and rewrite code by its syntax tree, using patterns that look like ordinary code.
0% recommend it · 1 vote
One vote per person. No account needed.
ast-grep matches code with patterns written in the target language itself, with `$VAR` placeholders, so `console.log($$$ARGS)` finds every call however it's formatted. The same engine runs one-off rewrites, YAML lint rules you can add to CI, and an interactive mode for reviewing each change. It's written in Rust on top of tree-sitter and supports many languages.
Write the pattern in the target language, with $VAR for one node and $$$ARGS for many.
-r replaces matches using the captured variables, across a whole codebase.
-i shows each proposed change and asks before applying it.
Define rules with messages and fixes, then run ast-grep scan locally or in CI.
Built on tree-sitter, covering JavaScript, TypeScript, Python, Go, Rust, Java and many more.
Written in Rust and runs in parallel across files.
ast-grep run -p 'console.log($$$ARGS)' -l ts # find every console.log call
ast-grep run -p 'var $A = $B' -r 'let $A = $B' -l js -i # rewrite, confirming each change
ast-grep run -p '$A && $A()' -r '$A?.()' -l ts -U # apply all changes without promptingThe binary is also installed as sg on most platforms, though some Linux systems already use that name.
Create a project with ast-grep new, then add rules as YAML files:
id: no-await-in-loop
language: TypeScript
severity: warning
message: Avoid await inside loops; collect the promises and use Promise.all.
rule:
pattern: await $EXPR
inside:
any:
- kind: for_statement
- kind: while_statement
stopBy: endast-grep scan then checks the whole project and exits non-zero on errors, which makes it easy to add to CI next to your usual linter.
inside or has) need the YAML rule format and some learning.brew install ast-grep # or: npm install -g @ast-grep/cli / pip install ast-grep-cli
ast-grep run -p 'console.log($$$ARGS)' -l ts
ast-grep run -p 'var $A = $B' -r 'let $A = $B' -l js -i Similar pattern matching, with a large security rule registry and a commercial platform.
Language-light structural matching that works on almost any text.
Full programmatic codemods for JavaScript and TypeScript, more powerful but more code to write.
Fastest for plain text search, when structure doesn't matter.
Other tools that share topics with ast-grep.
A terminal workspace with panes, tabs and sessions, and on-screen hints so you don't need to memorise keys.
Instead of tmux and GNU screen
A fast, cross-shell prompt that shows your git status, language versions and more.
Instead of Oh My Zsh themes, Powerlevel10k, and hand-written PS1 strings
A Git-compatible version control system where your working copy is always a commit and every operation can be undone.
Instead of The git CLI, interactive rebase and git stash