Compare commits

..
Author SHA1 Message Date
Eric f8dfcec367 Merge branch 'main' of https://github.com/lucide-icons/lucide into icon-usage-context 2026-10-19 15:01:32 +02:00
carl-lambertgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>Eric Fennis
0ab9c70d88 feat(icons): added graph-hub icon (#4974)
* feat(icons): added split-circles icon

* chore(icons): added cluster tag to `split-circles`

* refactor(icons): renamed `split-circles` to `hub-circles`

* refactor(icons): renamed `hub-circles` to `graph-hub`

* Apply batched suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix duplicate 'tags' key in graph-hub.json

Removed duplicate 'tags' key in graph-hub.json.

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-19 14:37:34 +02:00
26daed2537 feat(icons): added brain-off icon (#3535)
* Added icons/brain-off.svg

* Added icons/brain-off.json

* Update icons/brain-off.svg

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Update icons/brain-off.json

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Add use-cases for brain-off icon

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Update brain-circuit.svg

* Update brain-cog.svg

* Update brain-off.svg

* Update brain.svg

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Karsa <contact@karsa.org>
2026-10-19 14:28:50 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> fa238cf278 chore(deps): bump the react-deps group across 1 directory with 2 updates (#5026)
Bumps the react-deps group with 2 updates in the / directory: [react](https://github.com/react/react/tree/HEAD/packages/react) and [react-dom](https://github.com/react/react/tree/HEAD/packages/react-dom).


Updates `react` from 19.3.0 to 19.3.1
- [Release notes](https://github.com/react/react/releases)
- [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md)
- [Commits](https://github.com/react/react/commits/v19.3.1/packages/react)

Updates `react-dom` from 19.3.0 to 19.3.1
- [Release notes](https://github.com/react/react/releases)
- [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md)
- [Commits](https://github.com/react/react/commits/v19.3.1/packages/react-dom)

---
updated-dependencies:
- dependency-name: react
  dependency-version: 19.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: react-deps
- dependency-name: react-dom
  dependency-version: 19.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: react-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-19 12:08:22 +02:00
dependabot[bot]dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Eric Fennis
27f08704a1 chore(deps-dev): bump the svelte-deps group across 1 directory with 2 updates (#5028)
Bumps the svelte-deps group with 2 updates in the / directory: [@sveltejs/package](https://github.com/sveltejs/kit/tree/HEAD/packages/package) and [@sveltejs/kit](https://github.com/sveltejs/kit/tree/HEAD/packages/kit).


Updates `@sveltejs/package` from 3.0.0 to 3.0.1
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/main/packages/package/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/package@3.0.1/packages/package)

Updates `@sveltejs/kit` from 3.0.1 to 3.1.0
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/main/packages/kit/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/kit@3.1.0/packages/kit)

---
updated-dependencies:
- dependency-name: "@sveltejs/kit"
  dependency-version: 3.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: svelte-deps
- dependency-name: "@sveltejs/package"
  dependency-version: 3.0.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: svelte-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-10-19 12:07:56 +02:00
Ozgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>Eric FennisKarsa
7c165eb5df feat(icons): added line-height icon (#3039)
* Added icons/line-height.svg

* Added icons/line-height.json

* Update line-height.svg

* Update line-height.json

* Apply batched suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update line-height.json

* Update line-height.json

* Update line-height.json

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Co-authored-by: Karsa <contact@karsa.org>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-19 12:04:54 +02:00
dependabot[bot]dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Eric Fennis
296ab246a8 chore(deps-dev): bump react-native (#5030)
Bumps the react-native-deps group with 1 update: [react-native](https://github.com/react/react-native/tree/HEAD/packages/react-native).


Updates `react-native` from 0.87.1 to 0.88.0
- [Release notes](https://github.com/react/react-native/releases)
- [Changelog](https://github.com/react/react-native/blob/main/CHANGELOG.md)
- [Commits](https://github.com/react/react-native/commits/v0.88.0/packages/react-native)

---
updated-dependencies:
- dependency-name: react-native
  dependency-version: 0.88.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: react-native-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-10-19 11:54:20 +02:00
dependabot[bot]dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Eric Fennis
8300f598a0 chore(deps): bump the vue-deps group with 2 updates (#5027)
Bumps the vue-deps group with 2 updates: [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/HEAD/packages/plugin-vue) and [vue](https://github.com/vuejs/core).


Updates `@vitejs/plugin-vue` from 6.0.9 to 6.0.10
- [Release notes](https://github.com/vitejs/vite-plugin-vue/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-vue/commits/plugin-vue@6.0.10/packages/plugin-vue)

Updates `vue` from 3.5.43 to 3.5.44
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.5.43...v3.5.44)

---
updated-dependencies:
- dependency-name: "@vitejs/plugin-vue"
  dependency-version: 6.0.10
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: vue-deps
- dependency-name: vue
  dependency-version: 3.5.44
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vue-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-10-19 11:46:20 +02:00
Ozgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>Eric FennisKarsa
51be2dac03 feat(icons): added letter-spacing icon (#3038)
* Added icons/letter-spacing.svg

* Added icons/letter-spacing.json

* Update icons/letter-spacing.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update letter-spacing.svg

* Update letter-spacing.json

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Karsa <contact@karsa.org>
2026-10-19 11:39:10 +02:00
Noah Weidig 2333afad1f Update icon count comparison with Feather Icons (#5022) 2026-10-19 11:20:13 +02:00
Eric Fennis 6e1308ce19 fix(site): Fix build (#5033)
* Fix name

* Fix import
2026-10-19 11:16:40 +02:00
9a25bb6315 feat(icons): added bacon icon (#4694)
* feat(icons): add icons/avocado.svg

* feat(icons): add icons/avocado.json

* feat(icons): add icons/bacon.svg

* feat(icons): add icons/bacon.json

* chore: remove lab/avocado.svg after promoting to core

* chore: remove lab/avocado.json after promoting to core

* chore: remove lab/bacon.svg after promoting to core

* chore: remove lab/bacon.json after promoting to core

* docs(icons): apply metadata suggestions for avocado

* docs(icons): apply metadata suggestions for bacon

* Apply design from karsa

* Remove categories

* Update use-case descriptions for avocado and bacon icons

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Update avocado.json

* Update bacon.json

* Update avocado.json

* Update bacon.json

* Update avocado.json

* Update avocado.svg

* Update bacon.json

* Update avocado.json

* Update bacon.svg

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Karsa <contact@karsa.org>
2026-10-19 10:54:56 +02:00
Hitanshu Machhigithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>KarsaCopilot Autofix powered by AIHitanshu MachhiHitanshu MachhiEric Fennis
d123605682 feat(icons): added smartphone-user-round icon (#4586)
* add smartphone-user icon

* Update icons/smartphone-user.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update icons/smartphone-user.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update icons/smartphone-user.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update icons/smartphone-user.json

Co-authored-by: Karsa <contact@karsa.org>

* Update icons/smartphone-user.svg

Co-authored-by: Karsa <contact@karsa.org>

* update contribuers

* fix(icons): update smartphone-user icon

* rename: smartphone-user to smartphone-user-round

* Potential fix for pull request finding 'Add missing csandman attribution'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Refactor use-cases and tags in smartphone-user-round.json

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Update keywords and categories in smartphone icon JSON

* update requested changes in icon design

* add mittalyashu contributer of smartphone to contributors list

---------

Co-authored-by: Hitanshu Machhi <hitanshu.machhi-ext@mavenclinic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Karsa <contact@karsa.org>
Co-authored-by: Hitanshu Machhi <hitanshu.machhi@mindstix.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-10-19 10:36:42 +02:00
Ricardo Gonzalezgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>Eric Fennis
2ae6a3d489 feat(icons): added tombstone icon (#4929)
* feat(icons): added tombstone icon

* Update icons/tombstone.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update icons/tombstone.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-10-19 10:33:16 +02:00
Eric 1ef648145b adjust model 2026-10-09 12:05:24 +02:00
Claude 6983a6a175 feat(scripts): follow metadata instructions for described use-cases
Load the Use Cases section of .github/instructions/metadata.instructions.md
into the --describe prompt so generated use-cases match the repository
style, and make useCase an array of phrases per usage group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2D9GYbnSV56MAVVhHPRhH
2026-10-09 09:46:01 +00:00
Claude fba5e3f3cc feat(scripts): retry timeouts and save icon usage progress
Retry 408 responses (and other transient errors) with backoff, only waiting
for the rate-limit reset on 403/429. Requests that still fail are skipped
with a warning instead of aborting the run, and the OpenAI client retries
too. Each icon is now described as soon as its searches finish and
--output is rewritten after every icon, so an interrupted run keeps its
results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2D9GYbnSV56MAVVhHPRhH
2026-10-09 09:38:14 +00:00
Claude 58db0a0b0b Merge remote-tracking branch 'origin/icon-usage-context' into icon-usage-context 2026-10-09 07:00:29 +00:00
Claude 77ac5c4685 feat(scripts): add --output to write icon usage as JSON
Writes { [icon]: [...usage] } to a file: grouped use cases with --describe,
otherwise every individual usage context. Implies --context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2D9GYbnSV56MAVVhHPRhH
2026-10-09 07:00:21 +00:00
Eric 15c128336f Merge branch 'main' of https://github.com/lucide-icons/lucide into icon-usage-context 2026-10-09 08:50:01 +02:00
Claude 924b5fda27 feat(scripts): describe icon usage in context
Add --context and --describe to the icon usage script. --context extracts
how each matched icon is used (parent elements, labels, handlers, links,
snippet) and summarizes it per icon. --describe groups those usages into
use-case descriptions with an OpenAI model. Also adds --max-contexts and
--icons-file, accepts export names like Trash2, and allows a single icon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2D9GYbnSV56MAVVhHPRhH
2026-10-09 06:41:45 +00:00
Karsa ec3c3906f7 feat(scripts): added icon usage script 2026-08-31 17:54:23 +02:00
43 changed files with 3362 additions and 746 deletions
@@ -38,7 +38,7 @@ const pickIcons = [
'map-pinned',
'megaphone',
'moon',
'music',
'sixteenth-notes',
'phone',
'power-off',
'radio',
@@ -10,7 +10,7 @@ import {
sun,
moon,
camera,
music,
sixteenthNotes,
video,
globe,
layers,
@@ -44,7 +44,7 @@ import createElement from 'lucide/src/createElement';
import { IconNode } from 'lucide/src/types';
const icons: Component[] = [
heart, star, zap, code, feather, cloud, sun, moon, camera, music,
heart, star, zap, code, feather, cloud, sun, moon, camera, sixteenthNotes,
video, globe, layers, packageIcon, compass, command, terminal, database,
server, cpu, lock, key, shield, wifi, download, upload, search,
settings, users, mail, bell, calendar, clock, gitBranch, funnel,
+1 -1
View File
@@ -15,7 +15,7 @@ In an effort to expand the icon set while remaining true to the original minimal
### Why should I choose Lucide over Feather Icons?
- Lucide has expanded its icon set by 500+ in the last few years. Lucide now has over 1000 icons, while Feather has around 287 icons.
- Lucide has expanded its icon set by 1600+ in the last few years. Lucide now has over 1800 icons, while Feather has around 287 icons.
- Well maintained code base.
- Active community.
+3 -3
View File
@@ -72,9 +72,9 @@
"lucide": "workspace:*",
"lucide-react": "workspace:*",
"motion-v": "2.4.0",
"react": "19.3.0",
"react-dom": "19.3.0",
"react": "19.3.1",
"react-dom": "19.3.1",
"sandpack-vue3": "3.1.12",
"vue": "^3.5.43"
"vue": "^3.5.44"
}
}
+50
View File
@@ -0,0 +1,50 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"danielbayley",
"devkamani9313",
"karsa-mistmere"
],
"use-cases": [
"Representing fruit, guacamole, or healthy food in nutrition apps",
"Indicating salad, breakfast, or brunch ingredients",
"Showing vegetarian or vegan food options",
"Marking avocado toast as a menu item in restaurant or delivery apps",
"Denoting fresh produce or fruit section in grocery and supermarket apps",
"Signifying healthy fats or superfood in nutrition and wellness trackers",
"Labeling plant-based or vegetarian recipes in cooking websites and apps"
],
"tags": [
"fruit",
"snack",
"meal",
"lunch",
"ingredient",
"cooking",
"cookery",
"kitchen",
"cuisine",
"eating",
"healthy",
"nutrition",
"diet",
"guacamole",
"mexican",
"green",
"pit",
"seed",
"half",
"produce",
"vegetarian",
"vegan",
"grocery",
"supermarket",
"toast",
"superfood",
"plant based",
"ripe"
],
"categories": [
"food-beverage"
]
}
+14
View File
@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M13.465 3.464a5 5 0 017.07 0 5 5 0 010 7.072c-1.204 1.203-2.38 2.89-2.614 4.577A8 8 0 118.886 6.08c1.687-.235 3.375-1.41 4.579-2.615" />
<circle cx="10" cy="14" r="3" />
</svg>

After

Width:  |  Height:  |  Size: 391 B

+51
View File
@@ -0,0 +1,51 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"danielbayley",
"devkamani9313",
"karsa-mistmere"
],
"use-cases": [
"Representing breakfast items, rashers, or pork products",
"Indicating diner, brunch, or fast food menu items",
"Showing savory cooked meats or barbecue items",
"Labeling grocery or deli items in food apps",
"Marking breakfast sandwich or brunch special add-ons",
"Tagging cured or smoked meat ingredients in recipes"
],
"tags": [
"rashers",
"smoked",
"streaky",
"crispy",
"meat",
"fast food",
"junk food",
"snack",
"dish",
"restaurant",
"brunch",
"lunch",
"meal",
"savory",
"savoury",
"cookery",
"cooking",
"grilled",
"barbecue",
"barbeque",
"bbq",
"pig",
"pork",
"breakfast",
"cured",
"butcher",
"sandwich",
"protein",
"grocery",
"kitchen"
],
"categories": [
"food-beverage"
]
}
+14
View File
@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M2.795 16.804c-.789-.79-1.09-2.018-.442-2.928 1.933-2.713 4.414-1.05 6.145-5.378 1.868-4.67 4.608-2.366 6.592-6.107.218-.412.78-.53 1.11-.2l5.005 5.005c.789.79 1.09 2.018.442 2.928-1.933 2.713-4.414 1.05-6.145 5.378-1.868 4.67-4.608 2.366-6.591 6.107-.22.412-.78.53-1.11.2z" />
<path d="M4.5 18.5c2-5 5-2 7-7s5-2 7-7" />
</svg>

After

Width:  |  Height:  |  Size: 542 B

+10 -11
View File
@@ -9,17 +9,16 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z" />
<path d="M9 13a4.5 4.5 0 0 0 3-4" />
<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5" />
<path d="M3.477 10.896a4 4 0 0 1 .585-.396" />
<path d="M6 18a4 4 0 0 1-1.967-.516" />
<path d="M12 13h4" />
<path d="M12 18h6a2 2 0 0 1 2 2v1" />
<path d="M12 18h6a2 2 0 012 2v1" />
<path d="M12 8h8" />
<path d="M16 8V5a2 2 0 0 1 2-2" />
<circle cx="16" cy="13" r=".5" />
<circle cx="18" cy="3" r=".5" />
<circle cx="20" cy="21" r=".5" />
<circle cx="20" cy="8" r=".5" />
<path d="M12 9a4.17 4.17 0 01-3 4" />
<path d="M16 8V5a2 2 0 012-2" />
<path d="M6 18a4 4 0 01-2-7.465" />
<path d="M6.004 5.125a4 4 0 00-2.526 5.77" />
<path d="M6.294 6.294A3 3 0 1112 5v13a4 4 0 11-7.967-.518" />
<circle cx="16" cy="13" r="0.5" fill="currentColor" />
<circle cx="18" cy="3" r="0.5" fill="currentColor" />
<circle cx="20" cy="21" r="0.5" fill="currentColor" />
<circle cx="20" cy="8" r="0.5" fill="currentColor" />
</svg>

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 744 B

+7 -7
View File
@@ -12,15 +12,15 @@
<path d="m10.852 14.772-.383.923" />
<path d="m10.852 9.228-.383-.923" />
<path d="m13.148 14.772.382.924" />
<path d="m13.531 8.305-.383.923" />
<path d="m13.53 8.305-.382.923" />
<path d="m14.772 10.852.923-.383" />
<path d="m14.772 13.148.923.383" />
<path d="M17.598 6.5A3 3 0 1 0 12 5a3 3 0 0 0-5.63-1.446 3 3 0 0 0-.368 1.571 4 4 0 0 0-2.525 5.771" />
<path d="M17.998 5.125a4 4 0 0 1 2.525 5.771" />
<path d="M19.505 10.294a4 4 0 0 1-1.5 7.706" />
<path d="M4.032 17.483A4 4 0 0 0 11.464 20c.18-.311.892-.311 1.072 0a4 4 0 0 0 7.432-2.516" />
<path d="M4.5 10.291A4 4 0 0 0 6 18" />
<path d="M6.002 5.125a3 3 0 0 0 .4 1.375" />
<path d="M17.997 5.125a4 4 0 012.526 5.77" />
<path d="M18 18a4 4 0 002-7.464" />
<path d="M4.033 17.483A4 4 0 0011.46 20c.184-.31.896-.31 1.076 0a4 4 0 007.43-2.517" />
<path d="M6 18a4 4 0 01-2-7.464" />
<path d="M6.002 5.125a4 4 0 00-2.525 5.77" />
<path d="M6.293 6.294a3 3 0 01-.287-1.098l-.004-.07a3 3 0 015.968-.543c.05.02.057.01.059 0a3 3 0 015.968.542l-.004.071a3 3 0 01-.287 1.098" />
<path d="m9.228 10.852-.923-.383" />
<path d="m9.228 13.148-.923.383" />
<circle cx="12" cy="12" r="3" />

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 957 B

+33
View File
@@ -0,0 +1,33 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"karsa-mistmere",
"jguddas",
"it-is-not",
"jamiemlaw",
"ej52"
],
"use-cases": [
"Indicating disabled reasoning in an AI chat interface"
],
"tags": [
"medical",
"mind",
"mental",
"intellect",
"cerebral",
"consciousness",
"genius",
"artificial intelligence",
"ai",
"think",
"deep learning",
"machine learning",
"computing"
],
"categories": [
"medical",
"science",
"development"
]
}
+22
View File
@@ -0,0 +1,22 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M12 18v-6" />
<path d="M12 5v1.344" />
<path d="M17.707 6.293A3 3 0 1012 5a3 3 0 00-4.124-2.781" />
<path d="M17.997 5.125a4 4 0 012.526 5.77" />
<path d="M19.644 19.644A4 4 0 0112 18a4 4 0 11-7.967-.517" />
<path d="m2 2 20 20" />
<path d="M20 10.536a4 4 0 011.533 5.34" />
<path d="M3.477 10.895a4 4 0 011.876-5.542" />
<path d="M6 18a4 4 0 01-2-7.464" />
<path d="M9 13a4.17 4.17 0 002.166-1.5 4 4 0 00.138-.196" />
</svg>

After

Width:  |  Height:  |  Size: 656 B

+7 -7
View File
@@ -10,11 +10,11 @@
stroke-linejoin="round"
>
<path d="M12 18V5" />
<path d="M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4" />
<path d="M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5" />
<path d="M17.997 5.125a4 4 0 0 1 2.526 5.77" />
<path d="M18 18a4 4 0 0 0 2-7.464" />
<path d="M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517" />
<path d="M6 18a4 4 0 0 1-2-7.464" />
<path d="M6.003 5.125a4 4 0 0 0-2.526 5.77" />
<path d="M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4" />
<path d="M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294" />
<path d="M17.996 5.125a4 4 0 012.526 5.77" />
<path d="M18 18a4 4 0 002-7.465" />
<path d="M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517" />
<path d="M6 18a4 4 0 01-2-7.465" />
<path d="M6.004 5.125a4 4 0 00-2.526 5.77" />
</svg>

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 596 B

+36
View File
@@ -0,0 +1,36 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"Carlito-la-banane"
],
"use-cases": [
"Representing a load balancer in cloud infrastructure",
"Showing traffic distributed across multiple servers",
"Indicating a task split into parallel processes",
"Representing a load balancer in cloud service consoles",
"Showing incoming traffic distributed across multiple backends",
"Indicating a task split into parallel worker threads or processes",
"Marking fan-out patterns in system architecture or topology diagrams"
],
"tags": [
"load balancer",
"distribute",
"traffic",
"network",
"nodes",
"parallel",
"branch",
"hierarchy",
"routing",
"dispatcher",
"cluster",
"backend",
"fan-out",
"topology",
"orchestration"
],
"categories": [
"connectivity",
"development"
]
}
+19
View File
@@ -0,0 +1,19 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="7" r="4" />
<circle cx="4" cy="19" r="2" />
<circle cx="12" cy="19" r="2" />
<circle cx="20" cy="19" r="2" />
<path d="M8 7a4 4 0 0 0-4 4v6" />
<path d="M12 11v6" />
<path d="M16 7a4 4 0 0 1 4 4v6" />
</svg>

After

Width:  |  Height:  |  Size: 443 B

+24
View File
@@ -0,0 +1,24 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"madebyoz"
],
"use-cases": [
"Adjusting spacing between characters in text editors and design tools"
],
"tags": [
"tracking",
"kerning",
"design",
"lettering",
"text",
"letters",
"characters",
"font",
"typography",
"formatting"
],
"categories": [
"text"
]
}
+4 -2
View File
@@ -9,6 +9,8 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M22 7a4.95 4.95 0 0 0-8.6-3.4c-1.5 1.6-1.6 1.8-5 2.6a8 8 0 1 0 9.4 9.5c.7-3.4 1-3.6 2.6-5 1-1 1.6-2.3 1.6-3.7" />
<circle cx="10" cy="14" r="3.5" />
<path d="M15 14H9" />
<path d="M21 3v18" />
<path d="M3 3v18" />
<path d="m8 16 3.453-7.648a.6.6 0 011.094.001L16 16" />
</svg>

Before

Width:  |  Height:  |  Size: 370 B

After

Width:  |  Height:  |  Size: 337 B

+26
View File
@@ -0,0 +1,26 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"madebyoz"
],
"use-cases": [
"Adjusting spacing between lines in text editors and design tools"
],
"tags": [
"leading",
"text",
"letters",
"characters",
"font",
"typography",
"spacing",
"paragraph",
"formatting",
"editor",
"readability",
"typesetting"
],
"categories": [
"text"
]
}
+16
View File
@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M15 14H9" />
<path d="M21 21H3" />
<path d="M21 3H3" />
<path d="m8 16 3.453-7.648a.6.6 0 011.094.001L16 16" />
</svg>

After

Width:  |  Height:  |  Size: 337 B

+40
View File
@@ -0,0 +1,40 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"hitanshu-machhi",
"colebemis",
"csandman",
"ericfennis",
"karsa-mistmere",
"jguddas",
"mittalyashu"
],
"use-cases": [
"Representing a user profile in a mobile application",
"Indicating a mobile account or device owner",
"Showing mobile contact or identity settings",
"Displaying a user avatar in a mobile dashboard",
"Linking to a contact's profile from a mobile list",
"Indicating mobile sign-in or authentication screens",
"Marking a device as assigned to a user in device management apps"
],
"tags": [
"phone",
"cellphone",
"device",
"mobile",
"person",
"profile",
"account",
"avatar",
"contact",
"identity",
"owner",
"authentication"
],
"categories": [
"account",
"devices",
"people"
]
}
+16
View File
@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M10 22H6a2 2 0 01-2-2V4a2 2 0 012-2h10a2 2 0 012 2v4" />
<path d="M11 18h.01" />
<path d="M22 22a4 4 0 00-8 0" />
<circle cx="18" cy="15" r="3" />
</svg>

After

Width:  |  Height:  |  Size: 372 B

+41
View File
@@ -0,0 +1,41 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"jguddas",
"ryck"
],
"use-cases": [
"Marking death or game-over states in games, often paired with skull or ghost icons",
"Indicating cemetery or graveyard locations on maps",
"Marking deceased individuals in genealogy or family-tree applications",
"Flagging obsolete, deprecated, or retired items such as endpoints or pages"
],
"tags": [
"grave",
"gravestone",
"headstone",
"cemetery",
"graveyard",
"death",
"memorial",
"funeral",
"halloween",
"rip",
"obituary",
"deceased",
"epitaph",
"mourning",
"bereavement",
"condolence",
"deprecated",
"retired",
"archived",
"decommissioned"
],
"categories": [
"gaming",
"navigation",
"people",
"development"
]
}
+4 -2
View File
@@ -9,6 +9,8 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M22 8c-2 5-5 2-7 7s-5 2-7 7l-6-6c2-5 5-2 7-7s5-2 7-7Z" />
<path d="M5 19c2-5 5-2 7-7s5-2 7-7" />
<path d="M11 10h2" />
<path d="M19 21V10a7 7 0 00-14 0v11" />
<path d="M2 21h20" />
<path d="M9 14h6" />
</svg>

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 321 B

@@ -12,8 +12,8 @@
"dependencies": {
"lucide-react": "workspace:*",
"next": "16.3.8",
"react": "19.3.0",
"react-dom": "19.3.0"
"react": "19.3.1",
"react-dom": "19.3.1"
},
"devDependencies": {
"@types/react": "19.3.0",
@@ -14,8 +14,8 @@
"@react-router/serve": "8.3.1",
"isbot": "5.2.2",
"lucide-react": "workspace:*",
"react": "19.3.0",
"react-dom": "19.3.0",
"react": "19.3.1",
"react-dom": "19.3.1",
"react-router": "8.3.1"
},
"devDependencies": {
@@ -12,8 +12,8 @@
"dependencies": {
"@tanstack/react-router": "1.170.32",
"lucide-react": "workspace:*",
"react": "19.3.0",
"react-dom": "19.3.0"
"react": "19.3.1",
"react-dom": "19.3.1"
},
"devDependencies": {
"@tanstack/router-plugin": "1.168.35",
@@ -13,8 +13,8 @@
"@tanstack/react-router": "1.170.41",
"@tanstack/react-start": "1.168.60",
"lucide-react": "workspace:*",
"react": "19.3.0",
"react-dom": "19.3.0"
"react": "19.3.1",
"react-dom": "19.3.1"
},
"devDependencies": {
"@types/node": "^26.1.1",
+2 -2
View File
@@ -11,8 +11,8 @@
},
"dependencies": {
"lucide-react": "workspace:*",
"react": "19.3.0",
"react-dom": "19.3.0"
"react": "19.3.1",
"react-dom": "19.3.1"
},
"devDependencies": {
"@types/react": "19.3.0",
@@ -19,7 +19,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "^8.0.0",
"@sveltejs/kit": "^3.0.1",
"@sveltejs/kit": "^3.1.0",
"@sveltejs/vite-plugin-svelte": "^7.3.1",
"@vitest/browser-playwright": "5.0.3",
"playwright": "1.58.2",
+2 -2
View File
@@ -12,11 +12,11 @@
"dependencies": {
"@lucide/vue": "workspace:*",
"nuxt": "4.5.1",
"vue": "3.5.43",
"vue": "3.5.44",
"vue-router": "5.3.1"
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.8",
"@vitejs/plugin-vue": "^6.0.10",
"@vitest/browser-playwright": "5.0.3",
"typescript": "^6.0.3",
"vite": "^8.3.2",
+2 -2
View File
@@ -13,10 +13,10 @@
"@lucide/vue": "workspace:*",
"vike": "0.4.266",
"vike-vue": "0.9.13",
"vue": "3.5.43"
"vue": "3.5.44"
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.8",
"@vitejs/plugin-vue": "^6.0.10",
"@vitest/browser-playwright": "5.0.3",
"typescript": "^6.0.3",
"vite": "^8.3.2",
+2 -2
View File
@@ -11,12 +11,12 @@
},
"dependencies": {
"@lucide/vue": "workspace:*",
"vue": "3.5.43"
"vue": "3.5.44"
},
"devDependencies": {
"@tsconfig/node24": "^24.0.5",
"@types/node": "^26.1.1",
"@vitejs/plugin-vue": "^6.0.8",
"@vitejs/plugin-vue": "^6.0.10",
"@vitest/browser-playwright": "5.0.3",
"@vue/tsconfig": "^0.9.1",
"playwright": "1.58.2",
-26
View File
@@ -1,26 +0,0 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"danielbayley"
],
"tags": [
"fruit",
"snack",
"meal",
"lunch",
"ingredient",
"cooking",
"cookery",
"kitchen",
"cuisine",
"eating",
"healthy",
"nutrition",
"diet",
"guacamole",
"mexican"
],
"categories": [
"food-beverage"
]
}
-33
View File
@@ -1,33 +0,0 @@
{
"$schema": "../icon.schema.json",
"contributors": [
"danielbayley"
],
"tags": [
"rashers",
"smoked",
"streaky",
"crispy",
"meat",
"fast food",
"junk food",
"snack",
"dish",
"restaurant",
"brunch",
"lunch",
"meal",
"savory",
"savoury",
"cookery",
"cooking",
"grilled",
"barbecue",
"barbeque",
"bbq",
"pig"
],
"categories": [
"food-beverage"
]
}
+1
View File
@@ -32,6 +32,7 @@
"generate:sponsors": "node scripts/updateSponsors.mts",
"generate:contributors": "node ./scripts/updateContributors.mts icons/*.svg",
"generate:nextJSAliases": "node ./scripts/generateNextJSAliases.mts",
"icon-usage": "node ./scripts/iconUsage.mts",
"suggest:metadata": "node ./scripts/suggestMetaData.mts",
"suggest:metadata:debug": "node --env-file .env ./scripts/suggestMetaData.mts --debug",
"suggest:metadata:watch": "node --env-file .env --watch ./scripts/suggestMetaData.mts",
+3 -3
View File
@@ -75,9 +75,9 @@
"@types/react": "^19.3.0",
"@vitejs/plugin-react": "^6.1.2",
"jest-serializer-html": "^7.1.0",
"react": "19.3.0",
"react-dom": "19.3.0",
"react-native": "^0.87.1",
"react": "19.3.1",
"react-dom": "19.3.1",
"react-native": "^0.88.0",
"react-native-svg": "^15.15.5",
"rollup": "^4.63.1",
"rollup-plugin-dts": "^6.5.1",
+2 -2
View File
@@ -59,8 +59,8 @@
"@types/react": "^19.3.0",
"@vitejs/plugin-react": "^6.1.2",
"jest-serializer-html": "^7.1.0",
"react": "19.3.0",
"react-dom": "19.3.0",
"react": "19.3.1",
"react-dom": "19.3.1",
"rollup": "^4.63.1",
"rollup-plugin-dts": "^6.5.1",
"rollup-plugin-preserve-directives": "^0.4.0",
+1 -1
View File
@@ -65,7 +65,7 @@
"devDependencies": {
"@lucide/build-icons": "workspace:*",
"@lucide/helpers": "workspace:*",
"@sveltejs/package": "^3.0.0",
"@sveltejs/package": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^7.3.1",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/svelte": "^5.4.2",
+2 -2
View File
@@ -46,13 +46,13 @@
"@lucide/shared": "workspace:*",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/vue": "^8.1.0",
"@vitejs/plugin-vue": "^6.0.9",
"@vitejs/plugin-vue": "^6.0.10",
"@vue/test-utils": "2.5.1",
"rollup": "^4.63.1",
"rollup-plugin-dts": "^6.5.1",
"typescript": "^6.0.3",
"vite": "^8.3.2",
"vue": "^3.5.43"
"vue": "^3.5.44"
},
"peerDependencies": {
"vue": ">=3.0.1"
+617 -626
View File
File diff suppressed because it is too large Load Diff
+73
View File
@@ -0,0 +1,73 @@
# Lucide Icon Usage Estimator
Run with:
```sh
pnpm icon-usage trash trash-2
```
The default is a bounded first pass over `lucide-react`, with two GitHub search pages and up to 200 candidate files validated per query slice. Use `--all-packages` to include every supported package, or `--thorough` for the previous broader limits of 10 pages and 1,000 candidate files per query slice.
GitHub code search requires authentication, so set `GITHUB_TOKEN` or pass `--token-env <NAME>`.
Use `--verbose` or `-v` to print detailed progress logs to stderr, including queries, pages, cache hits, retries, content validation, and matches.
You can pass a single icon, and icon names may be kebab-case (`trash-2`) or export names (`Trash2`, `Trash2Icon`, `LucideTrash2`). Use `--icons-file <path>` to read names from a file with one name per line, such as a list of `lucide-react` exports.
## Usage In Context
```sh
pnpm icon-usage trash-2 --context
pnpm icon-usage trash-2 --describe
pnpm icon-usage --icons-file exports.txt --describe --max-contexts 30
```
`--context` extracts how each icon is used in every validated file: what kind of usage it is (a JSX/template element, a prop such as `icon={Trash2}`, a config object such as `{ title: 'Settings', icon: Settings }`, or a `data-lucide` attribute), the parent elements (for example `DropdownMenuItem` or `Button`), the enclosing component, label text (`aria-label`, `title`, visible text, i18n keys like `t('actions.delete')`), event handlers, links, and a short code snippet. Each usage gets a heuristic description such as `Trash2 in <DropdownMenuItem> labelled "Delete Project" within NavProjects`. Each icon gets a summary of the most common labels, parents and handlers, plus example links to the exact lines on GitHub.
`--describe` does the same, then sends the collected contexts to an OpenAI model (`OPENAI_API_KEY` required; `--model` or `OPENAI_MODEL` selects the model, `gpt-5-mini` by default). The model groups them into 1 to 4 use cases per icon. Each has a `useCase` array of 1 to 3 phrases for the `use-cases` field in `icons/*.json`, written following the "Use Cases" section of `.github/instructions/metadata.instructions.md` (loaded into the prompt at runtime), a description of where the icon appears in the UI, its approximate share of the sample, and example links. The icon's existing `use-cases` are included in the prompt. Responses are cached in the cache directory.
Use `--output <file>` (or `-o`) to write the results per icon to a JSON file shaped as `{ [icon]: [...usage] }`. With `--describe`, each entry is a use case (`useCase`, `description`, `sampleShare`, `examples`). Without it, each entry is an individual usage (`description`, `repository`, `url`, `kind`, `parents`, `component`, `labels`, `handlers`, `links`). `--output` implies `--context`, and the normal terminal, `--json` or `--csv` output is still printed.
```sh
pnpm icon-usage --icons-file exports.txt --describe --output usage.json
```
To keep runs bounded, searching for an icon stops once `--max-contexts` contexts (default 40) are collected, and at most two contexts are taken from each repository. When the limit is hit, the repository counts for that icon are a lower bound, and a warning says so. JSON output includes every context per match under `repositories.*.matches[].contexts`, and per-icon summaries and descriptions under `usage`.
Context extraction uses heuristics, not a full parser. It works best for JSX (React, Preact, Solid), Vue, Svelte and Astro templates in the same file as the import. Angular templates in separate `.html` files are not fetched.
## Method
The script uses GitHub REST `GET /search/code` with package-scoped, code-extension-scoped queries, then fetches each returned file and validates common Lucide import styles before counting a repository. Counts are deduplicated by `owner/repository`.
Output includes overall repository counts and per-package statistics. Per-package statistics are computed from validated matches for that package, so a repository using `trash` via `lucide-react` and `trash-2` via another package is represented correctly in both the overall totals and each package section.
Supported packages are `lucide-react`, `@lucide/vue`, `@lucide/svelte`, `@lucide/angular`, `@lucide/astro`, `lucide-preact`, `lucide-solid`, `lucide`, and `@lucide/lab`. The default package is `lucide-react` because all packages plus file-scope slicing is slow for broad icons; use `--all-packages` when that broader sample is needed.
Searches are split across relevant implementation file scopes using REST code search qualifiers such as `language:typescript`, `language:javascript`, `extension:vue`, and `extension:svelte`. Returned paths are still filtered by expected extensions before content is fetched, so Markdown and prompt/spec files are intentionally excluded by default because they frequently contain examples or generated implementation notes rather than live package usage.
By default, queries exclude forks, archived repositories, generated files, and vendored files using GitHub code search qualifiers. Use `--include-forks`, `--include-archived`, `--include-generated`, or `--include-vendored` to include them.
## GitHub API Limits
GitHub REST code search is authenticated and rate-limited to 10 requests per minute. Each query can return at most 1,000 results, with up to 100 results per page. Search only covers default branches and files smaller than 384 KB.
`total_count` and `incomplete_results` come from GitHub search and are recorded in JSON metadata. If a query exceeds the 1,000-result cap or returns `incomplete_results: true`, the script reports a warning and the result should be treated as incomplete rather than exhaustive.
GitHub's newer code search syntax is usable for public code search queries and supports qualifiers such as `NOT is:fork`, `NOT is:archived`, `NOT is:generated`, and `NOT is:vendored`, but the documented REST code search endpoint remains capped for result retrieval.
## Practical Strategy For Broad Icons
For common icons that hit search caps, use the script output as lower-bound or sampled evidence. The most defensible follow-up is to narrow query slices and cite them separately, for example by package, language/path, or repository cohorts, while preserving the JSON metadata for every query performed.
## Retries And Partial Results
GitHub requests that time out or fail temporarily (`408`, `429`, `5xx`, rate-limit `403`, network errors) are retried up to 6 times with backoff, honouring `Retry-After` and rate-limit reset headers. If a request still fails, that search slice or file is skipped with a warning instead of stopping the run. The OpenAI client used by `--describe` retries up to 5 times.
Every successful GitHub and OpenAI response is cached in the cache directory as soon as it arrives. If a run fails or is interrupted, running the same command again replays the cached responses without waiting, and only fetches what is missing.
With `--output`, each icon is finished (including `--describe`) before the next one starts, and the file is rewritten after every icon. An interrupted run therefore leaves a valid JSON file with every completed icon.
## Known Biases
Only public GitHub repositories visible to the token are observable. Private repositories and consumers outside GitHub are absent. GitHub is not representative of every Lucide consumer. Framework/package usage can differ materially. GitHub indexing may be incomplete or delayed. Generated or vendored code can still create false positives when GitHub does not identify it. Very common icons may exceed GitHub search-result caps.
File diff suppressed because it is too large Load Diff
+657
View File
@@ -0,0 +1,657 @@
// Extracts how an icon is used inside a source file (surrounding element,
// label text, handlers, config objects) and aggregates those usages into
// per-icon descriptions. Used by `iconUsage.mts` with `--context`/`--describe`.
export type UsageContext = {
line: number;
kind: 'element' | 'prop' | 'object' | 'reference' | 'data-attribute';
localName: string;
hostTag: string | null;
ancestors: string[];
component: string | null;
labels: string[];
i18nKeys: string[];
handlers: string[];
links: string[];
iconProps: string | null;
snippet: string;
description: string;
};
export type ContextMatch = {
repository: string;
path: string;
htmlUrl: string;
context: UsageContext;
};
export type IconContextSummary = {
contexts: number;
repositories: number;
topLabels: Array<{ value: string; count: number }>;
topHosts: Array<{ value: string; count: number }>;
topAncestors: Array<{ value: string; count: number }>;
topHandlers: Array<{ value: string; count: number }>;
kinds: Record<string, number>;
examples: Array<{ repository: string; htmlUrl: string; description: string }>;
};
const MAX_CONTEXTS_PER_FILE = 3;
const SNIPPET_LINES_BEFORE = 3;
const SNIPPET_LINES_AFTER = 3;
const LOOKBEHIND_CHARS = 2500;
const MAX_SNIPPET_LINE_LENGTH = 160;
const escapeRegExp = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const toKebabCase = (value: string) =>
value
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
.toLowerCase();
const unique = <T,>(values: T[]) => [...new Set(values)];
const clean = (value: string) => value.replace(/\s+/g, ' ').trim();
/**
* Resolves the identifiers a file uses for an icon, following `as` aliases
* and default imports of direct icon paths (e.g. `lucide-react/icons/trash`).
*/
export const localNamesFor = (
source: string,
packageName: string,
icon: string,
usageNames: string[],
) => {
const names = new Set<string>();
const escapedPackage = escapeRegExp(packageName);
const namedImportRegex = new RegExp(
`import\\s+(?:type\\s+)?\\{([\\s\\S]*?)\\}\\s+from\\s+['"]${escapedPackage}['"]`,
'g',
);
for (const match of source.matchAll(namedImportRegex)) {
for (const specifier of (match[1] ?? '').split(',')) {
const parts = specifier
.trim()
.replace(/^type\s+/, '')
.split(/\s+as\s+/);
if (!usageNames.includes(parts[0]?.trim() ?? '')) continue;
names.add((parts[1] ?? parts[0]).trim());
}
}
const directImportRegex = new RegExp(
`import\\s+([A-Za-z_$][\\w$]*)\\s+from\\s+['"]${escapeRegExp(`${packageName}/icons/${icon}`)}(?:\\.js)?['"]`,
'g',
);
for (const match of source.matchAll(directImportRegex)) names.add(match[1]);
// Packages without imports in the template (vanilla `lucide`, Angular) are
// referenced by their export names directly.
if (names.size === 0) usageNames.forEach((name) => names.add(name));
return [...names];
};
/** Character ranges that are import/export statements and must not count as usage. */
const statementRanges = (source: string) => {
const ranges: Array<[number, number]> = [];
const regex =
/(?:^|\n)\s*(?:import|export)\s+(?:type\s+)?(?:[\w$*\s,]*\{[\s\S]*?\}|[\w$*\s,]+?)\s*from\s*['"][^'"]+['"]/g;
for (const match of source.matchAll(regex)) {
ranges.push([match.index ?? 0, (match.index ?? 0) + match[0].length]);
}
return ranges;
};
type Tag = { name: string; start: number; end: number; attributes: string };
/**
* Finds the end of a JSX/HTML tag that starts at `start`, skipping over `{}`
* expressions, strings and arrow functions so `onClick={() => a > b}` does not
* end the tag early.
*/
const findTagEnd = (source: string, start: number, limit: number) => {
let depth = 0;
let quote: string | null = null;
for (let index = start + 1; index < limit; index += 1) {
const char = source[index];
if (quote) {
if (char === quote && source[index - 1] !== '\\') quote = null;
continue;
}
if (char === '"' || char === "'" || char === '`') quote = char;
else if (char === '{') depth += 1;
else if (char === '}') depth = Math.max(0, depth - 1);
else if (char === '>' && depth === 0 && source[index - 1] !== '=') return index;
else if (
char === '<' &&
depth === 0 &&
index > start + 1 &&
/[A-Za-z/]/.test(source[index + 1] ?? '')
)
return -1;
}
return -1;
};
const VOID_ELEMENTS = new Set([
'img',
'input',
'br',
'hr',
'meta',
'link',
'source',
'area',
'col',
'embed',
'wbr',
]);
/**
* Scans markup before `position` and returns the still-open elements
* (innermost last) plus the tag `position` sits inside, if any.
*/
const openElementsAt = (source: string, position: number) => {
const windowStart = Math.max(0, position - LOOKBEHIND_CHARS);
const stack: Tag[] = [];
let host: Tag | null = null;
const tagRegex = /<(\/?)([A-Za-z][\w.:-]*)/g;
tagRegex.lastIndex = windowStart;
let match: RegExpExecArray | null;
while ((match = tagRegex.exec(source)) && match.index < position) {
const [, closing, name] = match;
// `a < b` or generics like `Array<string>` are not markup.
const before = source[match.index - 1] ?? '';
if (!closing && /[\w$)\]]/.test(before)) continue;
const end = findTagEnd(source, match.index, Math.min(source.length, position + 2000));
if (end === -1) continue;
const tag = { name, start: match.index, end, attributes: source.slice(match.index, end + 1) };
if (end >= position) {
if (!closing) host = tag;
break;
}
if (closing) {
const openIndex = stack.map((item) => item.name).lastIndexOf(name);
if (openIndex !== -1) stack.splice(openIndex);
} else if (source[end - 1] !== '/' && !VOID_ELEMENTS.has(name.toLowerCase())) {
stack.push(tag);
}
tagRegex.lastIndex = end + 1;
}
return { stack, host };
};
const LABEL_ATTRIBUTES = [
'aria-label',
'title',
'label',
'tooltip',
'alt',
'placeholder',
'content',
'text',
'name',
];
const attributeValues = (markup: string, names: string[]) => {
const values: string[] = [];
const pattern = names.map(escapeRegExp).join('|');
const regex = new RegExp(
`(?:^|[\\s{,])(?:${pattern})\\s*[=:]\\s*(?:\\{\\s*)?(?:"([^"]{1,80})"|'([^']{1,80})'|\`([^\`$]{1,80})\`)`,
'g',
);
for (const match of markup.matchAll(regex)) {
const value = clean(match[1] ?? match[2] ?? match[3] ?? '');
if (value) values.push(value);
}
return values;
};
const handlerValues = (markup: string) => {
const values: string[] = [];
const regex =
/(?:^|[\s(])(on[A-Z]\w*|@[\w.-]+|v-on:[\w.-]+|\(click\)|on:\w+|onclick)\s*=\s*\{?\s*["']?(?:\(\)\s*=>\s*)?([\w$.]+)/g;
for (const match of markup.matchAll(regex)) {
if (match[2] && !['function', 'async', 'e', 'event'].includes(match[2])) {
values.push(`${match[1]}=${match[2]}`);
}
}
return values;
};
const linkValues = (markup: string) =>
attributeValues(markup, ['href', 'to', 'url', 'path', 'route', 'routerLink']);
const i18nKeys = (markup: string) => {
const keys: string[] = [];
const regex =
/\b(?:t|i18n\.t|\$t|translate|formatMessage|intl\.formatMessage)\(\s*(?:\{\s*id:\s*)?['"`]([\w.:-]{2,80})['"`]/g;
for (const match of markup.matchAll(regex)) keys.push(match[1]);
return keys;
};
/** Content range of an element (between its open and close tags), bounded in size. */
const elementContent = (source: string, parent: Tag | undefined, fallbackStart: number) => {
const start = parent ? parent.end + 1 : fallbackStart;
const closing = parent ? source.indexOf(`</${parent.name}`, start) : -1;
const end =
closing === -1 ? Math.min(source.length, start + 300) : Math.min(closing, start + 600);
return source.slice(start, end);
};
/** Visible text inside an element, with nested tags and expressions removed. */
const elementText = (source: string, parent: Tag | undefined, fallbackStart: number) => {
const content = elementContent(source, parent, fallbackStart);
const text = content
.replace(/<[^>]*>/g, ' ')
.replace(/\{[^{}]*\}/g, ' ')
.replace(/[{}]/g, ' ');
const value = clean(text);
if (!value || value.length > 80 || /[;=]|=>|\breturn\b/.test(value)) return [];
return [value];
};
const enclosingComponent = (source: string, position: number) => {
const before = source.slice(Math.max(0, position - 20000), position);
const regex =
/(?:function\s+([A-Z][\w$]*)|(?:const|let|var)\s+([A-Z][\w$]*)\s*(?::[^=]+)?=\s*(?:\([^)]*\)|[\w$]+)?\s*(?:=>|function)|class\s+([A-Z][\w$]*))/g;
let name: string | null = null;
for (const match of before.matchAll(regex)) name = match[1] ?? match[2] ?? match[3] ?? name;
return name;
};
const snippetAround = (lines: string[], lineIndex: number) =>
lines
.slice(Math.max(0, lineIndex - SNIPPET_LINES_BEFORE), lineIndex + SNIPPET_LINES_AFTER + 1)
.map((line) =>
line.length > MAX_SNIPPET_LINE_LENGTH ? `${line.slice(0, MAX_SNIPPET_LINE_LENGTH)}…` : line,
)
.join('\n');
/** Object literal around a reference such as `{ title: 'Settings', icon: Settings }`. */
const objectLiteralAround = (source: string, position: number) => {
let depth = 0;
let start = -1;
for (let index = position; index >= Math.max(0, position - 600); index -= 1) {
const char = source[index];
if (char === '}') depth += 1;
else if (char === '{') {
if (depth === 0) {
start = index;
break;
}
depth -= 1;
}
}
if (start === -1) return null;
depth = 0;
for (let index = start; index < Math.min(source.length, start + 1200); index += 1) {
const char = source[index];
if (char === '{') depth += 1;
else if (char === '}') {
depth -= 1;
if (depth === 0) return source.slice(start, index + 1);
}
}
return null;
};
const describe = (context: Omit<UsageContext, 'description' | 'snippet'>) => {
const parent = context.ancestors.at(-1);
const where =
context.kind === 'object'
? 'config object'
: context.kind === 'prop'
? `\`${context.hostTag}\` prop`
: parent
? `<${parent}>`
: context.kind === 'data-attribute'
? `<${context.hostTag ?? 'i'} data-lucide>`
: 'standalone element';
const parts = [`${context.localName} in ${where}`];
const label = context.labels[0] ?? context.i18nKeys[0];
if (label) parts.push(`labelled "${label}"`);
if (context.handlers.length > 0)
parts.push(`handling ${context.handlers.slice(0, 2).join(', ')}`);
if (context.links.length > 0) parts.push(`linking to ${context.links[0]}`);
if (context.iconProps && /spin|animate|loading/i.test(context.iconProps))
parts.push('(animated)');
if (context.component) parts.push(`within ${context.component}`);
return parts.join(' ');
};
/** Extracts up to a few usage contexts of an icon from a single source file. */
export const extractContexts = (
source: string,
packageName: string,
icon: string,
usageNames: string[],
): UsageContext[] => {
const localNames = localNamesFor(source, packageName, icon, usageNames);
const ranges = statementRanges(source);
const lines = source.split('\n');
const lineStarts: number[] = [];
lines.reduce((offset, line) => {
lineStarts.push(offset);
return offset + line.length + 1;
}, 0);
const lineAt = (position: number) => {
let low = 0;
let high = lineStarts.length - 1;
while (low < high) {
const mid = Math.ceil((low + high) / 2);
if (lineStarts[mid] <= position) low = mid;
else high = mid - 1;
}
return low;
};
const namePattern = unique([
...localNames.map(escapeRegExp),
// Vue templates may use kebab-case component names.
...(packageName === '@lucide/vue'
? localNames.map((name) => escapeRegExp(toKebabCase(name)))
: []),
]).join('|');
const occurrences: Array<{ position: number; name: string; dataAttribute: boolean }> = [];
for (const match of source.matchAll(
new RegExp(`(?<![\\w$.'"/-])(${namePattern})(?![\\w$-])`, 'g'),
)) {
occurrences.push({ position: match.index ?? 0, name: match[1], dataAttribute: false });
}
if (packageName === 'lucide') {
for (const match of source.matchAll(
new RegExp(`data-lucide\\s*=\\s*["']${escapeRegExp(icon)}["']`, 'g'),
)) {
occurrences.push({ position: match.index ?? 0, name: icon, dataAttribute: true });
}
}
const contexts: UsageContext[] = [];
const seenLines = new Set<number>();
for (const { position, name, dataAttribute } of occurrences.sort(
(a, b) => a.position - b.position,
)) {
if (contexts.length >= MAX_CONTEXTS_PER_FILE) break;
if (ranges.some(([start, end]) => position >= start && position < end)) continue;
const lineIndex = lineAt(position);
if (seenLines.has(lineIndex)) continue;
const lineText = lines[lineIndex];
if (/^\s*(\/\/|\*|\/\*)/.test(lineText)) continue;
// Registration calls such as `createIcons({ icons: { Trash } })` carry no context.
if (
/(?:createIcons\s*\(|LucideAngularModule\.pick\s*\(|addIcons\s*\(|icons\s*:\s*\{)[^}<]*$/.test(
source.slice(Math.max(0, position - 300), position),
)
)
continue;
const isElement = source[position - 1] === '<';
const { stack, host } = isElement
? openElementsAt(source, position - 1)
: openElementsAt(source, position);
const ownTag = isElement
? (() => {
const end = findTagEnd(source, position - 1, Math.min(source.length, position + 2000));
return end === -1 ? null : source.slice(position - 1, end + 1);
})()
: null;
let kind: UsageContext['kind'] = 'reference';
let hostTag: string | null = null;
let markupForSignals = '';
if (dataAttribute) {
kind = 'data-attribute';
hostTag = host?.name ?? null;
} else if (isElement) {
kind = 'element';
} else if (host) {
kind = 'prop';
hostTag = host.name;
markupForSignals = host.attributes;
} else {
const object = objectLiteralAround(source, position);
if (object && new RegExp(`[\\w$]+\\s*:\\s*${escapeRegExp(name)}\\b`).test(object)) {
kind = 'object';
markupForSignals = object;
}
}
const ancestors = stack.slice(-3).map((tag) => tag.name);
const parent = stack.at(-1);
const ancestorMarkup = stack
.slice(-2)
.map((tag) => tag.attributes)
.join(' ');
const signalMarkup = [markupForSignals, ancestorMarkup].join(' ');
const labels = unique([
...(kind === 'object' ? attributeValues(markupForSignals, LABEL_ATTRIBUTES) : []),
...attributeValues(
signalMarkup,
LABEL_ATTRIBUTES.filter((attr) => attr !== 'name'),
),
...(kind === 'element' || kind === 'data-attribute' || kind === 'prop'
? elementText(source, kind === 'prop' && host ? host : parent, position)
: []),
]).slice(0, 4);
const base = {
line: lineIndex + 1,
kind,
localName: name,
hostTag,
ancestors,
component: enclosingComponent(source, position),
labels,
i18nKeys: unique(
i18nKeys(
kind === 'object'
? markupForSignals
: `${signalMarkup} ${elementContent(source, kind === 'prop' && host ? host : parent, position)}`,
),
).slice(0, 3),
handlers: unique(handlerValues(signalMarkup)).slice(0, 3),
links: unique(linkValues(signalMarkup)).slice(0, 2),
iconProps: ownTag
? clean(ownTag.slice(name.length + 1, -1).replace(/\/$/, '')).slice(0, 120) || null
: null,
};
seenLines.add(lineIndex);
contexts.push({
...base,
snippet: snippetAround(lines, lineIndex),
description: describe(base),
});
}
return contexts;
};
const topValues = (values: string[], limit = 8) => {
const counts = new Map<string, number>();
for (const value of values) counts.set(value, (counts.get(value) ?? 0) + 1);
return [...counts.entries()]
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
.slice(0, limit)
.map(([value, count]) => ({ value, count }));
};
/** Aggregates the contexts collected for one icon into frequency tables. */
export const summarizeContexts = (matches: ContextMatch[]): IconContextSummary => {
const contexts = matches.map((match) => match.context);
const kinds: Record<string, number> = {};
for (const context of contexts) kinds[context.kind] = (kinds[context.kind] ?? 0) + 1;
// Prefer one example per repository so a single project cannot dominate.
const examples: IconContextSummary['examples'] = [];
const exampleRepos = new Set<string>();
for (const match of matches) {
if (exampleRepos.has(match.repository)) continue;
exampleRepos.add(match.repository);
examples.push({
repository: match.repository,
htmlUrl: `${match.htmlUrl}#L${match.context.line}`,
description: match.context.description,
});
if (examples.length >= 10) break;
}
return {
contexts: contexts.length,
repositories: new Set(matches.map((match) => match.repository)).size,
topLabels: topValues(
contexts.flatMap((context) =>
unique([...context.labels, ...context.i18nKeys].map((value) => value.toLowerCase())),
),
),
topHosts: topValues(contexts.flatMap((context) => (context.hostTag ? [context.hostTag] : []))),
topAncestors: topValues(contexts.flatMap((context) => context.ancestors.slice(-1))),
topHandlers: topValues(
contexts.flatMap((context) => context.handlers.map((handler) => handler.split('=')[0])),
),
kinds,
examples,
};
};
export type UsageDescription = {
useCase: string[];
description: string;
sampleShare: number;
examples: string[];
};
type DescribeOptions = {
icon: string;
matches: ContextMatch[];
summary: IconContextSummary;
existingUseCases: string[];
model: string;
maxPromptContexts: number;
readCache: (key: string) => Promise<UsageDescription[] | null>;
writeCache: (key: string, value: UsageDescription[]) => Promise<void>;
};
const METADATA_INSTRUCTIONS = new URL(
'../.github/instructions/metadata.instructions.md',
import.meta.url,
);
const FALLBACK_USE_CASE_GUIDELINES = `Write each use-case as a short phrase of roughly 4-12 words starting with a present participle verb (e.g. "Indicating a low battery charge level"), from the interface's perspective, naming the concrete context where useful. No trailing period, no first person, no marketing language, and never just the icon's name.`;
/**
* Returns the "Use Cases" section of the repository's metadata instructions
* (including its examples), so generated use-cases follow the same style.
*/
const loadUseCaseGuidelines = async () => {
try {
const fs = await import('node:fs/promises');
const instructions = await fs.readFile(METADATA_INSTRUCTIONS, 'utf8');
const start = instructions.indexOf('## Use Cases');
if (start === -1) return FALLBACK_USE_CASE_GUIDELINES;
const sections = instructions.slice(start).split(/\n(?=## )/);
return sections
.filter((section, index) => index === 0 || section.startsWith('## Examples'))
.join('\n')
.trim();
} catch {
return FALLBACK_USE_CASE_GUIDELINES;
}
};
/**
* Asks an OpenAI model to cluster the collected usage contexts into distinct,
* real-world use cases for the icon. Responses are cached by prompt hash.
*/
export const describeIconUsage = async ({
icon,
matches,
summary,
existingUseCases,
model,
maxPromptContexts,
readCache,
writeCache,
}: DescribeOptions): Promise<UsageDescription[]> => {
if (matches.length === 0) return [];
const samples = matches.slice(0, maxPromptContexts).map((match, index) => ({
id: index + 1,
repository: match.repository,
path: match.path,
component: match.context.component,
parents: match.context.ancestors,
labels: [...match.context.labels, ...match.context.i18nKeys],
handlers: match.context.handlers,
links: match.context.links,
snippet: match.context.snippet,
}));
const input = `You are maintaining the metadata for the Lucide icon library. Below are real usages of the \`${icon}\` icon found in public GitHub repositories, extracted from source code.
Group these usages by what the icon means in them, and describe each group.
Fields for each group:
- useCase: an array of 1-3 use-case phrases for this group, written exactly as the use-case guidelines below describe. Add more than one phrase only when the group covers genuinely distinct uses; never rephrase the same idea. Don't repeat a phrase across groups.
- description: one or two sentences describing how and where the icon appears in the UI (e.g. inside a ghost button in a table row, next to a "Delete" label).
- sampleShare: the approximate fraction (0-1) of the samples that belong to this group.
- examples: ids of up to 3 samples that best illustrate the group.
Rules:
- Return between 1 and 4 groups, most common first. Ignore samples without enough context to judge.
- The samples are your source material: extract the function the icon serves in the interface and discard implementation details such as component names, class names or file paths.
- Base everything on the samples; never invent use cases that are not supported by them.
- Match the style of the existing use-cases, and avoid duplicating them.
Use-case guidelines (from .github/instructions/metadata.instructions.md):
<guidelines>
${await loadUseCaseGuidelines()}
</guidelines>
Existing use-cases for "${icon}": ${JSON.stringify(existingUseCases)}
Aggregated signals:
${JSON.stringify({ topLabels: summary.topLabels, topParents: summary.topAncestors, topHandlers: summary.topHandlers, kinds: summary.kinds })}
Samples:
${JSON.stringify(samples, null, 1)}`;
const crypto = await import('node:crypto');
const cacheKey = crypto.createHash('sha256').update(`${model}\n${input}`).digest('hex');
const cached = await readCache(cacheKey);
if (cached) return cached;
const [{ default: OpenAI }, { zodTextFormat }, { default: z }] = await Promise.all([
import('openai'),
import('openai/helpers/zod'),
import('zod'),
]);
const schema = z.object({
useCases: z.array(
z.object({
useCase: z.array(z.string()),
description: z.string(),
sampleShare: z.number(),
examples: z.array(z.number()),
}),
),
});
// The SDK retries timeouts (408), rate limits and server errors with backoff.
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, maxRetries: 5 });
const response = await client.responses.create({
model,
input,
text: { format: zodTextFormat(schema, 'usage') },
});
const parsed = schema.parse(JSON.parse(response.output_text));
const descriptions = parsed.useCases.map((useCase) => ({
useCase: useCase.useCase,
description: useCase.description,
sampleShare: useCase.sampleShare,
examples: useCase.examples
.map((id) => matches[id - 1])
.filter(Boolean)
.map((match) => `${match.htmlUrl}#L${match.context.line}`),
}));
await writeCache(cacheKey, descriptions);
return descriptions;
};