feat: use tree-sitter to parse requirements.txt more correctly#391
feat: use tree-sitter to parse requirements.txt more correctly#391Strum355 wants to merge 1 commit intoguacsec:mainfrom
Conversation
cd46b6f to
d906a56
Compare
0c78fce to
62d1183
Compare
Review Summary by QodoReplace requirements.txt parsing with tree-sitter and add async support
WalkthroughsDescription• Replace manual requirements.txt parsing with tree-sitter for better accuracy • Add async/await support to provider methods for proper Promise handling • Implement tree-sitter-based requirement parsing with version extraction • Add web-tree-sitter and tree-sitter-requirements dependencies Diagramflowchart LR
A["Manual String Parsing"] -->|"Replace with"| B["Tree-Sitter Parser"]
B -->|"Extract"| C["Package Names & Versions"]
D["Sync Methods"] -->|"Convert to"| E["Async Methods"]
E -->|"Return"| F["Promise<Provided>"]
G["Dependencies"] -->|"Add"| H["web-tree-sitter<br/>tree-sitter-requirements"]
File Changes1. src/providers/requirements_parser.js
|
Code Review by Qodo
1. Missing await on install
|
62d1183 to
d7f26ca
Compare
| "tree-sitter-requirements": "github:Strum355/tree-sitter-requirements", | ||
| "web-tree-sitter": "^0.26.6", |
There was a problem hiding this comment.
3. Git dep uses git+ssh 🐞 Bug ⛯ Reliability
The added GitHub dependency resolves in package-lock.json to a git+ssh URL, which commonly fails in CI/user environments without GitHub SSH keys configured. This can block installation entirely.
Agent Prompt
## Issue description
The dependency `tree-sitter-requirements` is declared via GitHub shorthand. In `package-lock.json` it resolves to `git+ssh://git@github.com/...`, which frequently fails without SSH keys.
## Issue Context
This affects every `npm ci` / `npm install` consumer of this package.
## Fix Focus Areas
- package.json[56-57]
- package-lock.json[7507-7511]
## Suggested fix
- Update `package.json` to use an HTTPS git URL pinned to a commit/tag, e.g. `"tree-sitter-requirements": "git+https://github.com/Strum355/tree-sitter-requirements.git#<sha>"` (or a published semver npm package).
- Re-run `npm install` (or `npm ci` with regeneration as appropriate) to update `package-lock.json` so `resolved` uses `git+https` not `git+ssh`.
- Verify CI can install without SSH configuration.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
d7f26ca to
57aafed
Compare
Description
Replaced the original manual "parsing" of requirements.txt with a proper tree-sitter based approach. For more info on tree-sitter see https://tree-sitter.github.io/tree-sitter/
Related issues (if any): #242
Checklist
Additional information
Tested this with https://github.com/fabric8-analytics/fabric8-analytics-vscode-extension, some changes required there will be included in the PR that bumps the version of this library too