Skip to content

feat: TypeScript error pattern support (closes #84) - #98

Merged
naheel0 merged 2 commits into
BeyteFlow:mainfrom
naheel0:feat/ts-support
Aug 10, 2026
Merged

naheel0 merged 2 commits into
BeyteFlow:mainfrom
naheel0:feat/ts-support

Conversation

@naheel0

@naheel0 naheel0 commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

What

Adds TypeScript error pattern matching to errlens, closing #84.

Changes

  • lib/database.json: Added ~20 TS-specific error patterns (TS2322, TS2339, TS2345, TS2305, TS7006, TS2551, TS2554, TS2304, TS2531, TS2532, TS2349, TS2769, TS2694, TS18046, TS7053, TS2464, TS1005, TS1128, TS1434) — all use plain substring matching (no regex)
  • locales/en.json: Added matching translation keys for all TS error patterns
  • bin/index.js: Added .ts file extension detection with runner resolution ( s-node → sx → sc fallback)
  • test/test-ts.js: 14-test suite covering all TS error patterns — 14/14 passing

Notes

  • All match fields use plain substrings (not regex), consistent with how matcher.js works (lowerInput.includes(matchPhrase))
  • Existing JS/Python/Go/Rust/Java/C/C++ patterns are unaffected
  • TypeScript errors in errlens analyze now produce human-readable explanations, causes, and fix suggestions

Summary by CodeRabbit

  • New Features

    • Added support for running TypeScript and JavaScript files through the errlens run command.
    • Added guidance when no supported TypeScript runner is installed.
    • Expanded TypeScript error detection and explanations across common compiler diagnostics.
    • Added English localization for TypeScript error messages.
  • Tests

    • Added coverage for matching representative TypeScript compiler errors.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d8d42bca-eb89-4635-8968-92fd04c61b45

📥 Commits

Reviewing files that changed from the base of the PR and between 5ebb77a and fc2a5ba.

📒 Files selected for processing (4)
  • bin/index.js
  • lib/database.json
  • locales/en.json
  • test/test-ts.js
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/test-ts.js
  • bin/index.js
  • lib/database.json
  • locales/en.json

📝 Walkthrough

Walkthrough

The CLI now runs .ts and .mts files through tsx or ts-node. The diagnostic database and English locale now include TypeScript compiler errors. A test script validates 14 TypeScript diagnostic matches.

Changes

TypeScript support

Layer / File(s) Summary
TypeScript runner selection and execution
bin/index.js
The run command detects TypeScript files, selects tsx or ts-node, provides installation guidance when neither exists, and preserves direct Node execution for JavaScript files.
TypeScript diagnostic catalog and localization
lib/database.json, locales/en.json
The diagnostic database and English locale now cover TypeScript type, module, syntax, control-flow, iterator, configuration, argument, overload, and global-type errors.
TypeScript diagnostic matching tests
test/test-ts.js
The test script checks 14 representative compiler messages and exits with status 1 when any expected match fails.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Suggested reviewers: jaseel0

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: adding TypeScript error pattern support, and it references the related issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bin/index.js`:
- Around line 112-116: Update the child-process launch around isTsFile,
resolveTsRunner, and execArgs so TypeScript files invoke the resolved runner
executable directly (or via npx --no-install) with filePath, while JavaScript
files continue using process.execPath. Adjust the command and arguments
consistently for both branches.

In `@lib/database.json`:
- Around line 520-525: Differentiate the TS2305 and TS2694 diagnostics by
assigning each a unique match phrase so matching by name cannot merge their
guidance: update lib/database.json lines 520-525 for TS2694 and lines 456-461
for TS2305. Replace the corresponding generic and duplicate localization keys in
locales/en.json lines 214-218 and 249-253 with keys for those unique phrases.
Update test/test-ts.js lines 7-14 to assert one result and the expected
diagnostic name for both cases.
- Around line 584-589: Update the database entry for “Cannot find global type”
from TS2309 to TS2318, preserving its existing match, explanation, fixes, and
example. Locate the related diagnostic-code test and replace its expected TS2309
value with TS2318.
- Around line 512-517: Update the TS2488 diagnostic configuration in
lib/database.json (lines 512-517) so match includes the emitted
“[Symbol.iterator]()” token; rename the corresponding localization keys in
locales/en.json (lines 244-248) to the corrected phrase, and update the TS2488
assertion in test/test-ts.js (line 13) to verify that token is present.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e17b071e-90f1-4e6e-b891-a24dd855822e

📥 Commits

Reviewing files that changed from the base of the PR and between 20b801f and 5ebb77a.

📒 Files selected for processing (4)
  • bin/index.js
  • lib/database.json
  • locales/en.json
  • test/test-ts.js

Comment thread bin/index.js Resolved
Comment thread lib/database.json Resolved
Comment thread lib/database.json Resolved
Comment thread lib/database.json Resolved
- bin/index.js: spawn TS runner via 'npx --no-install' instead of treating the runner name as a Node script path; keep JS files on process.execPath
- lib/database.json: give TS2305 (module...) and TS2694 (namespace...) unique match phrases so guidance is no longer merged; use emitted '[Symbol.iterator]()' token for TS2488; correct TS2309 -> TS2318 ('Cannot find global type')
- locales/en.json: rename duplicate localization keys to the new unique match phrases
- test/test-ts.js: assert exactly-one match and the expected diagnostic name for the differentiated cases
@naheel0

naheel0 commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@naheel0
naheel0 merged commit 4465ede into BeyteFlow:main Aug 10, 2026
5 checks passed
@naheel0
naheel0 deleted the feat/ts-support branch August 10, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant