feat: new cli list-icons#2832
Conversation
🦋 Changeset detectedLatest commit: 0a2f75e The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
🧹 Nitpick comments (2)
packages/language-server/scripts/generate-icons.ts (1)
56-57: Unnecessary spread operator.
Object.entries()already returns an array, so wrapping it in[...]is redundant.♻️ Suggested refactor
-const icons = [...Object.entries(groupedIcons)] +const icons = Object.entries(groupedIcons) .flatMap(([group, names]) => names.map((name) => group + ':' + name))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/language-server/scripts/generate-icons.ts` around lines 56 - 57, The code creates "icons" by spreading Object.entries(groupedIcons) into a new array unnecessarily; remove the spread and use Object.entries(groupedIcons).flatMap(... ) directly so replace "const icons = [...Object.entries(groupedIcons)].flatMap(([group, names]) => names.map((name) => group + ':' + name))" with "const icons = Object.entries(groupedIcons).flatMap(([group, names]) => names.map((name) => group + ':' + name))" to eliminate the redundant array copy while keeping the same behavior.packages/likec4/src/cli/list-icons/index.ts (1)
23-42: Consider avoiding theascast on line 24.Per coding guidelines, casts with
asshould be avoided. The castas IconGroup[]can be eliminated by leveraging type inference.♻️ Suggested refactor
handler: args => { - const groups = args.group ? [args.group] as IconGroup[] : iconGroups + const groups: readonly IconGroup[] = args.group ? [args.group] : iconGroups switch (true) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/likec4/src/cli/list-icons/index.ts` around lines 23 - 42, The local variable groups uses an unnecessary 'as' cast; remove the cast on the expression that builds groups from args.group and instead give groups an explicit IconGroup[] type so TypeScript infers correctly (i.e., declare groups as type IconGroup[] and assign either a single-element array from args.group or iconGroups). Update the handler's groups declaration near args.group/iconGroups/iconRegistry to use that explicit type and drop the 'as IconGroup[]' cast.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/language-server/scripts/generate-icons.ts`:
- Around line 56-57: The code creates "icons" by spreading
Object.entries(groupedIcons) into a new array unnecessarily; remove the spread
and use Object.entries(groupedIcons).flatMap(... ) directly so replace "const
icons = [...Object.entries(groupedIcons)].flatMap(([group, names]) =>
names.map((name) => group + ':' + name))" with "const icons =
Object.entries(groupedIcons).flatMap(([group, names]) => names.map((name) =>
group + ':' + name))" to eliminate the redundant array copy while keeping the
same behavior.
In `@packages/likec4/src/cli/list-icons/index.ts`:
- Around line 23-42: The local variable groups uses an unnecessary 'as' cast;
remove the cast on the expression that builds groups from args.group and instead
give groups an explicit IconGroup[] type so TypeScript infers correctly (i.e.,
declare groups as type IconGroup[] and assign either a single-element array from
args.group or iconGroups). Update the handler's groups declaration near
args.group/iconGroups/iconRegistry to use that explicit type and drop the 'as
IconGroup[]' cast.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ab288b6d-90ea-4f60-af4e-03cf4b7379eb
📒 Files selected for processing (11)
.changeset/add-list-icons-command.md.claude/settings.jsonpackages/language-server/build.config.tspackages/language-server/package.jsonpackages/language-server/scripts/generate-icons.tspackages/language-server/src/icons.tspackages/likec4/src/cli/index.tspackages/likec4/src/cli/list-icons/index.tsskills/likec4-dsl/SKILL.mdskills/likec4-dsl/references/cli.mdskills/likec4-dsl/references/style-tokens-colors.md
list-iconsCLI command to list all available built-in icons with--format text|jsonand--groupfilter options