Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research: CLI Scanner (find) #338

Open
RonConfigu opened this issue Jan 3, 2024 · 0 comments
Open

Research: CLI Scanner (find) #338

RonConfigu opened this issue Jan 3, 2024 · 0 comments
Labels
feat New feature or request

Comments

@RonConfigu
Copy link
Contributor

Suggestion

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

image
image

@RonConfigu RonConfigu added the feat New feature or request label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant