feat: add chalk colors for improved terminal UI experience#107
Conversation
📝 WalkthroughWalkthroughA new ChangesCentralized color utility and CLI output styling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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
🧹 Nitpick comments (1)
src/commands/favorite.js (1)
46-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the success formatter for the add-success path.
This branch is a successful state, but it currently renders with
colors.warning, which conflicts with the new semantic color scheme.Proposed fix
- console.log(colors.warning('\n⭐ Added to favorites: ') + command); + console.log(colors.success('\n⭐ Added to favorites: ') + command);🤖 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 `@src/commands/favorite.js` around lines 46 - 48, The added-to-favorites success branch in favorite.js is using the warning formatter instead of the success semantic style. Update the `result.action === 'added'` path in the `favorite` command to use the success formatter from `colors` for the “Added to favorites” message, keeping the category line unchanged so the add-success state matches the new color scheme.
🤖 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 `@src/commands/init.js`:
- Around line 128-135: The .gitignore update logic in init.js is appending the
tracker ignore content twice when the file already exists, causing duplicate
comment blocks and entries. Update the code around the existing
fs.appendFileSync calls so the tracker block is written only once: keep the
combined cmd-tracker personal data entries in entriesToAdd/trackerEntry and
remove the extra append of trackerEntry, or otherwise ensure the .gitignore
content is assembled and appended as a single block in the init flow.
- Around line 148-149: The fallback `.gitignore` guidance is out of sync with
the files this initializer now treats as local-only. Update the manual
instruction in the init flow that logs via colors.warning/colors.info so it
tells users to ignore `.tracker/` as well as tracker-export.json and
tracker-export.csv whenever the automatic .gitignore update fails.
In `@src/commands/search.js`:
- Around line 79-82: The highlight logic in search.js is building a RegExp
directly from the user-provided searchTerm, which can throw or misbehave on
regex metacharacters. Update the command highlighting in the search flow to
escape searchTerm before passing it to new RegExp, while keeping the existing
item.command replace behavior and colors.warning.bold highlighting intact.
---
Nitpick comments:
In `@src/commands/favorite.js`:
- Around line 46-48: The added-to-favorites success branch in favorite.js is
using the warning formatter instead of the success semantic style. Update the
`result.action === 'added'` path in the `favorite` command to use the success
formatter from `colors` for the “Added to favorites” message, keeping the
category line unchanged so the add-success state matches the new color scheme.
🪄 Autofix (Beta)
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
Run ID: d981a5e5-17a4-4363-82e1-988967d74fdb
📒 Files selected for processing (10)
src/commands/clear.jssrc/commands/export.jssrc/commands/favorite.jssrc/commands/init.jssrc/commands/list.jssrc/commands/save.jssrc/commands/search.jssrc/commands/stats.jssrc/utils/colors.jssrc/utils/validator.js



What this PR does
Adds chalk library integration to colorize terminal output across all commands. This improves readability and gives a modern, polished feel to the CLI.
Changes
chalkas a dependencysrc/utils/colors.jsfor centralized color managementlist,search,stats,favorite, andclearcommands to use new colorsTechnical notes
chalkfor better cross-platform supportdevelop)Checklist
npm run lint→ 0 errors)developHow to test
Summary by CodeRabbit
New Features
Bug Fixes