Repository navigation
Conversation
- Add lib/themes.js with 5 built-in themes: default, minimal, high-contrast, dracula, monokai - Add --theme <name> global flag for switching color themes - Add --verbose flag for extra diagnostic info (MATCH, LENGTH, KEY) - Update formatter.js to accept theme and verbose options - Support ERRLENS_THEME and ERRLENS_VERBOSE env vars for runtime injection - Update README with new CLI options, theme docs, and verbose mode - All existing --json and --lang flags remain fully functional
📝 WalkthroughWalkthroughErrLens adds five color themes and verbose diagnostics. The CLI accepts ChangesTheme and verbose output
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant ThemeResolver
participant Formatter
CLI->>ThemeResolver: Validate and resolve --theme
CLI->>Formatter: Format error with theme and verbose options
Formatter->>ThemeResolver: Resolve formatting theme
ThemeResolver-->>Formatter: Return theme styles
Formatter-->>CLI: Return formatted output
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 117-120: Update bin/index.js sites 117-120 and 167-179 to resolve
themeName within each command action and replace fixed Chalk styling with the
selected theme’s headerText, unknownText, and rawText styles; apply headerText
to the analysis header and the appropriate fallback styles to no-match and raw
output paths.
In `@lib/auto.js`:
- Around line 13-15: Update the uncaughtException handler to normalize thrown
objects using their stack string before falling back to message or String(err),
matching the err.stack handling used by lib/injector.js. Ensure the resulting
stack text is passed to findError instead of "[object Object]".
In `@README.md`:
- Line 115: Update the `--theme <name>` Color Themes link so its target resolves
correctly: either remove the broken fragment and use a valid link target, or add
a stable `color-themes` anchor associated with the Color Themes heading.
Preserve the documented navigation to that section.
🪄 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: b3ee983b-c5e2-4ef9-a993-dbd675748dd1
📒 Files selected for processing (6)
README.mdbin/index.jslib/auto.jslib/formatter.jslib/injector.jslib/themes.js
| console.log( | ||
| chalk.red.bold("\n❌ Crash detected (No known fix in database):") | ||
| chalk.red.bold( | ||
| "\n❌ Crash detected (No known fix in database):" | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Apply the selected theme to CLI fallback output.
themeName reaches formatError, but these CLI paths still use fixed Chalk colors. Resolve the theme in each command action and use headerText, unknownText, and rawText.
bin/index.js#L117-L120: Replace the fixed no-match error style with the selected theme’s fallback styles.bin/index.js#L167-L179: Replace the fixed analysis header and no-match styles with the selected theme’s header and fallback styles.
📍 Affects 1 file
bin/index.js#L117-L120(this comment)bin/index.js#L167-L179
🤖 Prompt for 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.
In `@bin/index.js` around lines 117 - 120, Update bin/index.js sites 117-120 and
167-179 to resolve themeName within each command action and replace fixed Chalk
styling with the selected theme’s headerText, unknownText, and rawText styles;
apply headerText to the analysis header and the appropriate fallback styles to
no-match and raw output paths.
| process.on("uncaughtException", (err) => { | ||
| // Use the message for the search, guard against non-Error throws | ||
| const msg = (err && err.message) ? err.message : String(err); | ||
| const msg = err && err.message ? err.message : String(err); | ||
| const { count, matches } = findError(msg); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use the stack string for object errors.
If code throws { stack: "TypeError: ..." }, this handler passes "[object Object]" to findError. lib/injector.js already searches err.stack. Use the same normalization here.
Proposed fix
- const msg = err && err.message ? err.message : String(err);
+ const msg =
+ err !== null && typeof err === "object"
+ ? err.stack || err.message || String(err)
+ : String(err ?? "unknown error");📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| process.on("uncaughtException", (err) => { | |
| // Use the message for the search, guard against non-Error throws | |
| const msg = (err && err.message) ? err.message : String(err); | |
| const msg = err && err.message ? err.message : String(err); | |
| const { count, matches } = findError(msg); | |
| process.on("uncaughtException", (err) => { | |
| const msg = | |
| err !== null && typeof err === "object" | |
| ? err.stack || err.message || String(err) | |
| : String(err ?? "unknown error"); | |
| const { count, matches } = findError(msg); |
🤖 Prompt for 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.
In `@lib/auto.js` around lines 13 - 15, Update the uncaughtException handler to
normalize thrown objects using their stack string before falling back to message
or String(err), matching the err.stack handling used by lib/injector.js. Ensure
the resulting stack text is passed to findError instead of "[object Object]".
| | Flag | Description | | ||
| |------|-------------| | ||
| | `--json` | Output raw JSON (no colors, no boxes) — perfect for CI/CD pipelines | | ||
| | `--theme <name>` | Pick a color theme (see [Color Themes](#-color-themes) below) | |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the Color Themes link target.
The #-color-themes fragment does not resolve to the heading at Line 196. Remove the fragment link or add a stable color-themes anchor.
Proposed fix
-| `--theme <name>` | Pick a color theme (see [Color Themes](`#-color-themes`) below) |
+| `--theme <name>` | Pick a color theme (see the Color Themes section below) |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | `--theme <name>` | Pick a color theme (see [Color Themes](#-color-themes) below) | | |
| | `--theme <name>` | Pick a color theme (see the Color Themes section below) | |
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 115-115: Link fragments should be valid
(MD051, link-fragments)
🤖 Prompt for 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.
In `@README.md` at line 115, Update the `--theme <name>` Color Themes link so its
target resolves correctly: either remove the broken fragment and use a valid
link target, or add a stable `color-themes` anchor associated with the Color
Themes heading. Preserve the documented navigation to that section.
Source: Linters/SAST tools
There was a problem hiding this comment.
Pull request overview
This PR improves ErrLens’ CLI/terminal user experience by introducing configurable color themes, a verbose diagnostics mode, and corresponding updates across CLI entrypoints, runtime injection helpers, and documentation.
Changes:
- Added a new
lib/themes.jsmodule with built-in theme definitions plusresolveTheme()/isValidTheme()helpers. - Extended CLI (
bin/index.js) and runtime helpers (lib/auto.js,lib/injector.js) to support--theme,--verbose, andERRLENS_THEME/ERRLENS_VERBOSE. - Updated
lib/formatter.jsto style output via theme tokens and optionally include verbose match metadata; refreshed README accordingly.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new --theme / --verbose flags, env vars, and theme list. |
| lib/themes.js | Introduces theme registry and lookup/validation helpers. |
| lib/formatter.js | Applies theme-based chalk styling and adds verbose metadata rendering. |
| lib/auto.js | Adds env-driven theme/verbose support for automatic crash analysis output. |
| lib/injector.js | Adds env-driven theme/verbose support for runtime injection handlers. |
| bin/index.js | Adds global --theme / --verbose flags and validates theme names before formatting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| | Flag | Description | | ||
| |------|-------------| | ||
| | `--json` | Output raw JSON (no colors, no boxes) — perfect for CI/CD pipelines | | ||
| | `--theme <name>` | Pick a color theme (see [Color Themes](#-color-themes) below) | |
| Verbose output adds: | ||
| - **MATCH:** the exact substring that triggered the database lookup | ||
| - **LENGTH:** character count of the match phrase | ||
| - **KEY:** the internal database key used |
| const chalkImport = require("chalk"); | ||
| const chalk = chalkImport.default || chalkImport; |
Summary
Closes #54
Adds color themes, verbose diagnostic mode, and overall CLI polish to ErrLens.
Changes
New: lib/themes.js
esolveTheme() and isValidTheme() helpers for safe lookup
Updated: �in/index.js
Updated: lib/formatter.js
Updated: lib/auto.js and lib/injector.js
Updated: README.md
Testing
All existing functionality verified:
Summary by CodeRabbit
New Features
--themeand--verboseCLI options.Bug Fixes
Documentation