You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CLI command find should find in-code usages of ENV_VARS and export to .cfgu
Motivation
No response
Context
Looking into it, seems like AST is the natural solution, Regex may be valid for simple cases but in order to actually find and trace complex usage of in-code env vars I feel like we should be able to "understand" the code a lot more than just read it. @rannn505 suggested ast-grep lib for this task and or abstract ML/AI.
While ML/AI is obviously able to "understand" the code faster and better than any algo we could build, currently we can't afford the time developing it. ast-grep on it self, doesn't provide the necessary tools in my opinion, yet, it relies on 'tree-sitting' lib which seems perfectly fit to handle the job of parsing AST trees for various languages.
That being said, I've spent some time with tree-sitting parsing simple TS/JS code and playing with s-expressions queries, seems doable to cover a lot of use cases.
Our comunity can add and improve the queries to match more and more cases.
Below are screenshots of example code and queries
The text was updated successfully, but these errors were encountered:
Suggestion
CLI command
find
should find in-code usages of ENV_VARS and export to .cfguMotivation
No response
Context
Looking into it, seems like AST is the natural solution, Regex may be valid for simple cases but in order to actually find and trace complex usage of in-code env vars I feel like we should be able to "understand" the code a lot more than just read it.
@rannn505 suggested
ast-grep
lib for this task and or abstract ML/AI.While ML/AI is obviously able to "understand" the code faster and better than any algo we could build, currently we can't afford the time developing it.
ast-grep
on it self, doesn't provide the necessary tools in my opinion, yet, it relies on 'tree-sitting' lib which seems perfectly fit to handle the job of parsing AST trees for various languages.That being said, I've spent some time with
tree-sitting
parsing simple TS/JS code and playing with s-expressions queries, seems doable to cover a lot of use cases.Our comunity can add and improve the queries to match more and more cases.
Below are screenshots of example code and queries
The text was updated successfully, but these errors were encountered: