Skip to content

feat: new cli list-icons#2832

Merged
davydkov merged 1 commit into
mainfrom
cli-list-icons
Apr 3, 2026
Merged

feat: new cli list-icons#2832
davydkov merged 1 commit into
mainfrom
cli-list-icons

Conversation

@davydkov

@davydkov davydkov commented Apr 3, 2026

Copy link
Copy Markdown
Member
  • Add list-icons CLI command to list all available built-in icons with --format text|json and --group filter options
  • Updated SKILL, instructiong to use new CLI

@changeset-bot

changeset-bot Bot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0a2f75e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
likec4 Patch
@likec4/language-server Patch
@likec4/docs-astro Patch
@likec4/playground Patch
@likec4/language-services Patch
@likec4/mcp Patch
@likec4/vite-plugin Patch
likec4-vscode Patch
@likec4/style-preset Patch
@likec4/styles Patch
@likec4/config Patch
@likec4/core Patch
@likec4/diagram Patch
@likec4/generators Patch
@likec4/layouts Patch
@likec4/leanix-bridge Patch
@likec4/log Patch
@likec4/react Patch
@likec4/tsconfig Patch
@likec4/vscode-preview Patch

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

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A new list-icons CLI command is introduced to enumerate built-in icons with support for text and JSON output formats, plus optional group filtering. The language server's icons module is refactored to export grouped icon registries and exposed as a public subpath export.

Changes

Cohort / File(s) Summary
Changeset & Configuration
.changeset/add-list-icons-command.md, .claude/settings.json
Added changeset declaring patch updates for likec4 and @likec4/language-server packages. Configured Claude settings with schema reference and removed specific permissions entries.
Language Server Icons & Build
packages/language-server/build.config.ts, packages/language-server/package.json, packages/language-server/src/icons.ts
Exposed icons module as public subpath export (./icons) in package.json. Added module to build configuration. Created re-export layer for grouped icon types and registries.
Icons Generation
packages/language-server/scripts/generate-icons.ts
Refactored icon structure from inline object to top-level groupedIcons constant. Added exported IconGroup type, iconGroups array, GroupedIcons record type, and iconRegistry mapping to support grouped icon access.
CLI List-Icons Command
packages/likec4/src/cli/index.ts, packages/likec4/src/cli/list-icons/index.ts
Implemented new list-icons yargs command with --format (text/json) and --group filtering options. Integrated command into CLI pipeline. Supports grouped icon enumeration with formatted output.
Documentation
skills/likec4-dsl/SKILL.md, skills/likec4-dsl/references/cli.md, skills/likec4-dsl/references/style-tokens-colors.md
Added guidance on using likec4 list-icons command with examples and icon group references. Documented icon naming format (group:name) and approximate icon counts per group. Reformatted tables and lists for consistency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • fix: minor fixes #2785: Both PRs modify the CLI entrypoint (packages/likec4/src/cli/index.ts), altering import ordering and pipeline structure in overlapping areas.
  • feat: add format command #2667: Directly related through adding new CLI commands and modifying the likec4 CLI command pipeline structure.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete and does not follow the required template structure with checklist items. Complete the PR description using the provided template: include the checklist section with all required items checked/marked, confirm rebasing, commit message compliance, test coverage, and documentation updates.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: new cli list-icons' clearly and concisely describes the main change: adding a new CLI command for listing icons.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cli-list-icons

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 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 the as cast on line 24.

Per coding guidelines, casts with as should be avoided. The cast as 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0a4af22 and 0a2f75e.

📒 Files selected for processing (11)
  • .changeset/add-list-icons-command.md
  • .claude/settings.json
  • packages/language-server/build.config.ts
  • packages/language-server/package.json
  • packages/language-server/scripts/generate-icons.ts
  • packages/language-server/src/icons.ts
  • packages/likec4/src/cli/index.ts
  • packages/likec4/src/cli/list-icons/index.ts
  • skills/likec4-dsl/SKILL.md
  • skills/likec4-dsl/references/cli.md
  • skills/likec4-dsl/references/style-tokens-colors.md

@davydkov davydkov merged commit 302f020 into main Apr 3, 2026
17 checks passed
@davydkov davydkov deleted the cli-list-icons branch April 3, 2026 07:36
@likec4-ci likec4-ci Bot mentioned this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant