I have a fascination with command-line tools. Perhaps it's their perceived simplicity — just some text keyed into the terminal can do so much, from manipulating text to running and managing full-blown systems. Specifically, I keep an eye out for tools I can use to improve my workflow and get things done quicker. For example, I frequently use ripgrep to search for text across my codebase, and combine it with a text replacement tool like sd to make changes quickly. One such tool that I've long been fascinated by is ast-grep. Similar to ripgrep, it searches for text, but with an added awareness of the abstract syntax tree. I was sure it could be useful, but I didn't have a suitable problem yet. Until now! The problem was simple: I had to rename the use of a variable through the codebase. The name of the variable was common, as in it appeared as substrings of other text in the codebase as well, and had sufficiently different uses such that I couldn't think of a regex that would work. So I turned to ast-grep for help, and using it was as cool as I thought it would be! I wrote about my first use of the tool here: https://lnkd.in/g_y7AvtD