fix: use node: protocol for imports #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
node:protocol for builtin modules (util, fs, path, url)Scout-detected fixes.
Greptile Overview
Greptile Summary
This PR modernizes Node.js imports using the
node:protocol and prefixes unused variables with underscores, but introduces a critical bug insrc/commands/api.ts.Critical Issue:
src/commands/api.ts:32- TheparseTypeScriptimport was accidentally removed, causingReferenceError: parseTypeScript is not definedat runtime when running theapicommandSafe Changes:
node:protocol additions for built-in modules (util,fs,path,url) are safe and follow modern Node.js best practicestypescript.ts:47maintains equivalent logic_commentContent,_error) follows linting conventions correctlyConfidence Score: 1/5
apicommand with a runtime errorsrc/commands/api.tscauses immediate runtime failure. While other changes are safe, this critical bug makes the PR unmergeablesrc/commands/api.tsmust restore theparseTypeScriptimport before mergingImportant Files Changed
node:protocol for built-inutilmodule - safe modernizationnode:protocol but accidentally removedparseTypeScriptimport, causing runtime error on line 32node:protocol, improved optional chaining, and prefixed unused variables with underscore - all changes safeSequence Diagram
sequenceDiagram participant CLI as cli.ts participant API as commands/api.ts participant Parser as parsers/typescript.ts participant FS as node:fs/path/url CLI->>CLI: Import parseArgs from node:util ✓ CLI->>API: Call generateApiDocs() API->>API: Import from node:fs/path/url ✓ API->>API: ❌ Missing parseTypeScript import API->>Parser: Call parseTypeScript() Note over API,Parser: ReferenceError thrown here Parser->>Parser: Import from node:fs/path ✓ Parser->>FS: File operations FS-->>Parser: Return data Parser-->>API: Return modules API-->>CLI: Complete