Skip to content

chore: remove unused dependencies and Storybook (Onda 1 PR 1.2)#97

Merged
adm01-debug merged 1 commit into
mainfrom
chore/onda-1-pr-1.2-dead-deps
May 8, 2026
Merged

chore: remove unused dependencies and Storybook (Onda 1 PR 1.2)#97
adm01-debug merged 1 commit into
mainfrom
chore/onda-1-pr-1.2-dead-deps

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 8, 2026

🌊 Faxina Onda 1 — PR 1.2: Deps mortas + Storybook completo

DRAFT até PR #96 mergear — para evitar conflito no .gitignore. Vou marcar como Ready for Review depois que PR 1.1 estiver em main.

Refs: PR #96 (1.1 antecedente) | Auditoria de estado atual (Achado C2, P2)


🎯 O que muda

📉 35 pacotes removidos do package.json (130 → 95)

Tier A — Lovable residual (2 deps)

Dep Por quê
@lovable.dev/cloud-auth-js 0 imports em código operacional
lovable-tagger Era usado em vite.config.ts — removido junto

Tier B — Shadcn instalado mas não usado (6 deps)

Dep Por quê
@radix-ui/react-aspect-ratio 0 imports
@radix-ui/react-navigation-menu 0 imports
@radix-ui/react-visually-hidden visually-hidden.tsx é custom (Tailwind sr-only)
embla-carousel-react 0 imports
input-otp 0 imports
vaul 0 imports (matches em "vault" eram strings)

Tier C — Plugins Vite não configurados (3 deps)

Dep Por quê
vite-plugin-compression2 Não estava em vite.config.ts
vite-plugin-pwa Não estava em vite.config.ts
@vitejs/plugin-react-swc Vite usa @vitejs/plugin-react regular

Tier D — Mortos comprovados (12 deps)

Dep Por quê
web-vitals src/lib/web-vitals.ts é arquivo custom, não usa pacote
prop-types Projeto é TypeScript
serialize-javascript 0 imports
wait-on 0 refs em scripts
glob 0 imports (matches em "global" eram strings)
fast-check 0 imports
@tailwindcss/typography Não estava em tailwind.config.ts plugins
@hookform/resolvers 0 imports (react-hook-form em si fica)
@types/dompurify DOMPurify v3 tem types embutidos
jsdom Vitest usa happy-dom
lint-staged Sem config em package.json

Tier E — Storybook completo (12 deps + arquivos + configs)

Decisão técnica: REMOVER (justificativa em /workspace/notes/faxina-onda-1-decisoes-finais.md):

  • App interno SaaS, não biblioteca de componentes pública
  • Joaquim não escreve stories — todas geradas pelo Lovable
  • Custo de manutenção alto (12 deps próprias, breaking changes a cada major)
  • Reduz attack surface (CVEs em addons Storybook são frequentes)
  • Reversível: bunx storybook init reinstala em 30s

Pacotes removidos: storybook, @chromatic-com/storybook, @storybook/addon-{a11y,docs,essentials,interactions,links,onboarding,vitest}, @storybook/blocks, @storybook/react, @storybook/react-vite, eslint-plugin-storybook.

📂 Arquivos removidos (37)

  • .storybook/ (config completo: main.ts, preview.ts)
  • src/stories/ (Button, Header, Page + 17 assets)
  • src/components/ui/stories/ (10 stories de UI components)

⚙️ Configs atualizadas (3)

  • vite.config.ts: removido import + uso de lovable-tagger
  • eslint.config.js: removido eslint-plugin-storybook
  • package.json: removidos scripts storybook e build-storybook

⚠️ Falso positivo capturado durante stress-test

Durante o stress-test, a análise inicial sugeriu remover jspdf e jspdf-autotable, mas o build falhou:

Rollup failed to resolve import "jspdf-autotable" from
src/pages/AdminTelemetriaPage.tsx

Causa: import dinâmico (await import('jspdf')) não é detectado por grep estático.

Solução: reinstalei jspdf e jspdf-autotable via bun add.

Lição aprendida: sempre rodar bun run build ANTES de commit de remoção de deps.


📊 Impacto

Métrica Antes Depois Δ
Total deps 130 95 −27%
Runtime deps 87 71 −18%
Dev deps 43 24 −44%
Arquivos 37 deletions
Linhas +191 / −2846 net −2655

Bonus: node_modules deve encolher ~30% (deps transitivas).


🧪 Stress-test executado pré-commit

# Validação Resultado
1 Análise sistemática dep-by-dep OK — 65 USED_IN_SRC, 26 CONFIG_OR_SCRIPTS, 39 candidatos a DEAD
2 Verificação caso a caso de duvidosas (8 deps) OK
3 bun install --frozen-lockfile OK (Checked 681 installs across 727 packages)
4 bun run build OK (built in 1m 24s)
5 Build identificou jspdf como import dinâmico Resolvido (re-adicionado)
6 bun.lock regenerado OK
7 Vercel preview deployment aguardando CI

🤝 Coordenação com PR #96 (PR 1.1)

Por que está como DRAFT:

PR 1.1 modifica .gitignore e essa branch foi criada antes de 1.1 mergear. Para evitar conflito:

  1. Espero PR chore: remove committed build artifacts and update .gitignore (Onda 1 PR 1.1) #96 mergear em main
  2. Faço git rebase main neste branch (vai pegar gitignore atualizado automaticamente)
  3. Marco como Ready for Review
  4. Aguardo CodeRabbit + Joaquim aprovarem
  5. Mergeio

🔄 Reversibilidade

Storybook pode ser reinstalado em 30 segundos com:

bunx storybook init --type react-vite

Reverter PR completo:

git revert <merge-commit-hash>

📋 Próximos PRs da Onda 1

  1. ✅ PR 1.1 (chore: remove committed build artifacts and update .gitignore (Onda 1 PR 1.1) #96) — Lixo commitado (em review)
  2. 🔄 PR 1.2 (esta) — Deps mortas + Storybook (DRAFT)
  3. ⏳ PR 1.3 — ESLint --fix automático
  4. ⏳ PR 1.4 — console.*logger

Decisões persistidas em /workspace/notes/faxina-onda-1-decisoes-finais.md.


🤖 Gerado por Claude Opus 4.7 via Claude Code MCP
👤 Solicitado por: Joaquim (Promo Brindes)
📅 Data: 2026-05-08

Summary by CodeRabbit

Release Notes

  • Chores
    • Removido Storybook: a plataforma integrada para desenvolvimento e documentação de componentes foi completamente desativada do projeto, incluindo todas as dependências, configurações de build, scripts de execução e históricos de documentação de componentes.
    • Reorganizado o registro interno de componentes para melhor estruturação.
    • Removidos plugins e configurações de desenvolvimento relacionados.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zapp-web Ready Ready Preview, Comment May 8, 2026 9:03pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

Walkthrough

Este PR remove a integração completa do Storybook do projeto. Todas as configurações de build (.storybook/), plugin Vite, plugin ESLint, scripts npm, devDependencies, histórias de componentes (.stories.tsx/.stories.ts), componentes de exemplo (src/stories/), estilos de demo e documentação MDX são eliminados. O registry.json é reorganizado semanticamente sem alteração de dados. Não há novos recursos ou lógica implementada.

Changes

Desativação e Remoção do Storybook

Layer / File(s) Sumário
Configuração de Build
.storybook/main.ts, .storybook/preview.ts, vite.config.ts
Configuração Storybook inteira removida. Plugin componentTagger removido do Vite. Build pipeline simplificado.
Ferramentas e Linting
eslint.config.js
Plugin ESLint do Storybook removido; storybook.configs["flat/recommended"] não está mais incluída.
Dependências e Scripts
package.json
Scripts storybook e build-storybook removidos. DevDependencies Storybook eliminadas. Scripts ds:fix, ds:check, ds:test adicionados. Versioning jspdf atualizado para caret range, jspdf-autotable bumpado.
Histórias de Componentes UI
src/components/ui/stories/Button.stories.tsx, src/components/ui/stories/Card.stories.tsx, src/components/ui/stories/Input.stories.tsx, src/components/ui/stories/Introduction.stories.tsx, src/components/ui/stories/Link.stories.tsx, src/components/ui/stories/dialog.stories.tsx, src/components/ui/stories/select.stories.tsx, src/components/ui/stories/textarea.stories.tsx, src/components/ui/stories/tooltip.stories.tsx
Todos os .stories.tsx UI removidos. Meta configurations, argTypes, story exports e decoradores eliminados.
Histórias de Exemplo
src/stories/Button.stories.ts, src/stories/Header.stories.ts, src/stories/Page.stories.ts
Demo stories removidas. Meta, Primary/Secondary/Large/Small exports, LoggedIn/LoggedOut stories e play interactions deletadas.
Componentes e Páginas de Demo
src/stories/Button.tsx, src/stories/Header.tsx, src/stories/Page.tsx, src/stories/Configure.mdx
Componentes React de exemplo e página MDX removidos. Interfaces ButtonProps, HeaderProps, tipos User e componentes Button, Header, Page, RightArrow eliminados.
Estilos de Demo
src/stories/button.css, src/stories/header.css, src/stories/page.css
CSS dos componentes de exemplo removidos: .storybook-button, .storybook-header, .storybook-page e todos seus modificadores deletados.
Reorganização do Registry
src/components/ui/registry.json
Blocos de componentes reordenados: dialog e icon-button para topo; alert, avatar, toast reorganizados; button e toggle centralizados; tooltip, badge, sheet em sequência final. Variantes de componentes preservadas.

Estimated code review effort

🎯 2 (Simples) | ⏱️ ~12 minutos

Remoção homogênea sem lógica complexa. Validar: (1) nenhuma dependência viva referencia Storybook; (2) build/dev pipeline funciona; (3) registry reorg não quebra renderização. Sem bugs, segurança ou issues de performance introduzidos.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título descreve precisamente a mudança principal: remoção de dependências não utilizadas e da suite Storybook.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 chore/onda-1-pr-1.2-dead-deps

Comment @coderabbitai help to get the list of available commands and usage tips.

Remove deps comprovadamente não usadas + Storybook completo.

## Deps removidas (35 pacotes)

### Tier A — Lovable residual (2)
- @lovable.dev/cloud-auth-js  (0 imports)
- lovable-tagger              (era usado em vite.config — também removido daí)

### Tier B — Shadcn instalado mas não usado (6)
- @radix-ui/react-aspect-ratio
- @radix-ui/react-navigation-menu
- @radix-ui/react-visually-hidden  (visually-hidden.tsx é custom Tailwind sr-only)
- embla-carousel-react
- input-otp
- vaul

### Tier C — Plugins Vite não configurados (3)
- vite-plugin-compression2     (não estava em vite.config)
- vite-plugin-pwa              (não estava em vite.config)
- @vitejs/plugin-react-swc     (vite usa @vitejs/plugin-react regular)

### Tier D — Mortos (12)
- web-vitals                   (src/lib/web-vitals.ts é arquivo CUSTOM, não usa pacote)
- prop-types                   (projeto é TypeScript)
- serialize-javascript
- wait-on
- glob
- fast-check
- @tailwindcss/typography      (não estava em tailwind.config plugins)
- @hookform/resolvers          (0 imports — react-hook-form fica)
- @types/dompurify             (dompurify v3 tem types embutidos)
- jsdom                        (vitest usa happy-dom)
- lint-staged                  (sem config em package.json)

### Tier E — Storybook completo (12)
Decisão técnica: REMOVER (custo > benefício pra app interno SaaS):
- storybook
- @chromatic-com/storybook
- @storybook/addon-a11y
- @storybook/addon-docs
- @storybook/addon-essentials
- @storybook/addon-interactions
- @storybook/addon-links
- @storybook/addon-onboarding
- @storybook/addon-vitest
- @storybook/blocks
- @storybook/react
- @storybook/react-vite
- eslint-plugin-storybook

## Arquivos removidos (37)

- .storybook/main.ts
- .storybook/preview.ts
- src/stories/  (Button, Header, Page + assets)
- src/components/ui/stories/  (10 stories)

## Configs atualizadas

- vite.config.ts: removido import + uso de lovable-tagger
- eslint.config.js: removido eslint-plugin-storybook + plugin
- package.json: removidos scripts 'storybook' e 'build-storybook'

## Não removidos (falsos positivos detectados)

A análise inicial sugeriu remover jspdf e jspdf-autotable, mas
o build falhou — eles são importados dinamicamente em
src/pages/AdminTelemetriaPage.tsx (await import('jspdf')).
Mantidos no package.json.

## Stress-test executado

- bun install --frozen-lockfile: OK
- bun run build:                 OK (built in 1m 24s)
- Vercel preview vai validar deploy de produção

## Resultado

- Total deps: 130 → 95 (-27%)
- Pacotes removidos no node_modules: ~250 (estimativa, deps transitivas)
- Tempo de bun install esperado mais rápido
- Superficie de attack surface reduzida (menos deps = menos CVEs)

## Reversibilidade

Storybook pode ser reinstalado a qualquer momento com:
  bunx storybook init

Refs: docs/auditorias/2026-05-08-1548-auditoria-profunda.md (Achado C2, P2)
Refs: /workspace/notes/faxina-onda-1-decisoes-finais.md (decisões finais)
@adm01-debug adm01-debug marked this pull request as ready for review May 8, 2026 21:02
@adm01-debug adm01-debug force-pushed the chore/onda-1-pr-1.2-dead-deps branch from f7ed472 to e3f6f0d Compare May 8, 2026 21:02
Copilot AI review requested due to automatic review settings May 8, 2026 21:02
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3f6f0d22c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json
Comment on lines 124 to 125
"husky": "^9.1.7",
"lint-staged": "^17.0.2",
"lovable-tagger": "^1.1.13",
"playwright": "^1.59.1",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the pre-commit dependency

Removing lint-staged leaves .husky/pre-commit running bun run lint-staged, but there is no package script by that name and the binary is no longer installed. I checked the hook and bun run --help confirms bun run <script> executes package scripts/files; in this checkout bun run lint-staged --help now exits with error: Script not found "lint-staged", so every developer commit with hooks enabled will fail until the dependency is restored or the hook is updated.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/components/ui/registry.json`:
- Around line 17-33: The variant arrays in registry.json (the "variant" key)
contain many duplicate "hover" entries which can create duplicate options or key
collisions in consumers; edit each "variant" array (e.g., the arrays shown
around the occurrences in the diff) to remove repeated values so each value is
unique, or—if hover represents a separate UI state—move hover into a dedicated
field (e.g., "state" or "pseudo") and keep "variant" as the unique set of
styling variants; ensure every "variant" array across the file contains only
unique entries after your change.
- Around line 269-276: The sheet.variants.side array contains invalid
non-direction entries ("sm")—remove the two "sm" values so sheet.variants.side
only includes valid directions ("top", "bottom", "left", "right"); locate the
sheet.variants.side symbol in the registry.json and edit the array to contain
the four proper directions, ensuring no stray tokens like "sm" remain that would
break variant resolution or produce invalid classes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 400956ef-67ba-4d9d-b5fa-7b558d55c893

📥 Commits

Reviewing files that changed from the base of the PR and between dee8f18 and e3f6f0d.

⛔ Files ignored due to path filters (16)
  • bun.lock is excluded by !**/*.lock, !**/*.lock
  • src/stories/assets/accessibility.png is excluded by !**/*.png
  • src/stories/assets/accessibility.svg is excluded by !**/*.svg
  • src/stories/assets/addon-library.png is excluded by !**/*.png
  • src/stories/assets/assets.png is excluded by !**/*.png
  • src/stories/assets/context.png is excluded by !**/*.png
  • src/stories/assets/discord.svg is excluded by !**/*.svg
  • src/stories/assets/docs.png is excluded by !**/*.png
  • src/stories/assets/figma-plugin.png is excluded by !**/*.png
  • src/stories/assets/github.svg is excluded by !**/*.svg
  • src/stories/assets/share.png is excluded by !**/*.png
  • src/stories/assets/styling.png is excluded by !**/*.png
  • src/stories/assets/testing.png is excluded by !**/*.png
  • src/stories/assets/theming.png is excluded by !**/*.png
  • src/stories/assets/tutorials.svg is excluded by !**/*.svg
  • src/stories/assets/youtube.svg is excluded by !**/*.svg
📒 Files selected for processing (26)
  • .storybook/main.ts
  • .storybook/preview.ts
  • eslint.config.js
  • package.json
  • src/components/ui/registry.json
  • src/components/ui/stories/Button.stories.tsx
  • src/components/ui/stories/Card.stories.tsx
  • src/components/ui/stories/Input.stories.tsx
  • src/components/ui/stories/Introduction.stories.tsx
  • src/components/ui/stories/Link.stories.tsx
  • src/components/ui/stories/dialog.stories.tsx
  • src/components/ui/stories/select.stories.tsx
  • src/components/ui/stories/textarea.stories.tsx
  • src/components/ui/stories/tooltip.stories.tsx
  • src/stories/Button.stories.ts
  • src/stories/Button.tsx
  • src/stories/Configure.mdx
  • src/stories/Header.stories.ts
  • src/stories/Header.tsx
  • src/stories/Page.stories.ts
  • src/stories/Page.tsx
  • src/stories/assets/avif-test-image.avif
  • src/stories/button.css
  • src/stories/header.css
  • src/stories/page.css
  • vite.config.ts
💤 Files with no reviewable changes (23)
  • src/stories/button.css
  • .storybook/preview.ts
  • src/stories/Page.tsx
  • src/components/ui/stories/Introduction.stories.tsx
  • src/stories/Header.stories.ts
  • src/stories/Button.tsx
  • src/stories/header.css
  • .storybook/main.ts
  • vite.config.ts
  • src/components/ui/stories/tooltip.stories.tsx
  • src/stories/Page.stories.ts
  • eslint.config.js
  • src/stories/Configure.mdx
  • src/stories/page.css
  • src/components/ui/stories/select.stories.tsx
  • src/components/ui/stories/Button.stories.tsx
  • src/stories/Header.tsx
  • src/components/ui/stories/dialog.stories.tsx
  • src/components/ui/stories/textarea.stories.tsx
  • src/components/ui/stories/Link.stories.tsx
  • src/components/ui/stories/Input.stories.tsx
  • src/stories/Button.stories.ts
  • src/components/ui/stories/Card.stories.tsx

Comment on lines 17 to 33
"variant": [
"default",
"hover",
"hover",
"destructive",
"hover",
"hover",
"outline",
"hover",
"hover",
"hover",
"secondary",
"hover",
"hover",
"ghost",
"hover",
"hover",
"link",
"hover",
"whatsapp",
"hover",
"hover",
"glowPurple",
"hover",
"hover",
"glowGradient",
"hover",
"neon",
"hover",
"hover",
"neonOutline",
"hover",
"outline",
"hover",
"hover",
"success",
"destructive",
"hover",
"muted",
"hover"
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Duplicidade de valores nas variantes pode causar comportamento incorreto no consumer

Há repetição massiva de "hover" nas listas de variant (ex.: Line 20/22/24, Line 128+ e Line 248+). Isso costuma gerar opções duplicadas na UI e colisão de chave quando o valor é tratado como identificador único.

Sugestão: manter apenas valores únicos em cada array de variantes (ou separar estado hover em outro campo, se esse for o modelo esperado).

Diff sugerido (exemplo de normalização)
   "icon-button": {
     "name": "icon-button",
     "variants": {
       "variant": [
         "default",
-        "hover",
-        "hover",
         "secondary",
-        "hover",
         "ghost",
-        "hover",
-        "hover",
         "outline",
-        "hover",
-        "hover",
         "destructive",
-        "hover",
         "muted",
-        "hover"
+        "hover"
       ],
   "badge": {
     "name": "badge",
     "variants": {
       "variant": [
         "default",
-        "hover",
         "secondary",
-        "hover",
         "destructive",
-        "hover",
         "outline",
-        "hover",
         "subtle",
         "success",
         "warning",
         "info",
         "whatsapp",
-        "hover",
         "glowPurple",
         "hover"
       ]
     }
   },

Also applies to: 126-163, 246-263

🤖 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/components/ui/registry.json` around lines 17 - 33, The variant arrays in
registry.json (the "variant" key) contain many duplicate "hover" entries which
can create duplicate options or key collisions in consumers; edit each "variant"
array (e.g., the arrays shown around the occurrences in the diff) to remove
repeated values so each value is unique, or—if hover represents a separate UI
state—move hover into a dedicated field (e.g., "state" or "pseudo") and keep
"variant" as the unique set of styling variants; ensure every "variant" array
across the file contains only unique entries after your change.

Comment on lines +269 to 276
"side": [
"top",
"bottom",
"left",
"sm",
"default",
"lg"
"right",
"sm"
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

sheet.variants.side contém valores inválidos para direção

Em side, os valores "sm" nas Lines 273 e 275 não representam direção e parecem ter sido inseridos por engano. Isso pode quebrar resolução de variante de sheet (ou gerar classe inválida).

Diff sugerido
   "sheet": {
     "name": "sheet",
     "variants": {
       "side": [
         "top",
         "bottom",
         "left",
-        "sm",
-        "right",
-        "sm"
+        "right"
       ]
     }
   }
📝 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.

Suggested change
"side": [
"top",
"bottom",
"left",
"sm",
"default",
"lg"
"right",
"sm"
]
"side": [
"top",
"bottom",
"left",
"right"
]
🤖 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/components/ui/registry.json` around lines 269 - 276, The
sheet.variants.side array contains invalid non-direction entries ("sm")—remove
the two "sm" values so sheet.variants.side only includes valid directions
("top", "bottom", "left", "right"); locate the sheet.variants.side symbol in the
registry.json and edit the array to contain the four proper directions, ensuring
no stray tokens like "sm" remain that would break variant resolution or produce
invalid classes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes unused dependencies and fully deletes the Storybook setup (configs + example/UI stories) to reduce maintenance and dependency surface area.

Changes:

  • Removed Storybook scripts, devDependencies, ESLint integration, and deleted .storybook/ + story files/assets.
  • Removed lovable-tagger usage from vite.config.ts.
  • Updated src/components/ui/registry.json contents (auto-generated component variant registry).

Reviewed changes

Copilot reviewed 25 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vite.config.ts Drops lovable-tagger import/usage from Vite plugins.
package.json Removes Storybook + other unused deps and drops Storybook scripts.
eslint.config.js Removes eslint-plugin-storybook integration.
.storybook/preview.ts Deleted Storybook preview configuration.
.storybook/main.ts Deleted Storybook main configuration.
src/stories/Page.tsx Deleted Storybook example page component.
src/stories/Page.stories.ts Deleted Storybook story for example page.
src/stories/page.css Deleted Storybook example page styles.
src/stories/Header.tsx Deleted Storybook example header component.
src/stories/Header.stories.ts Deleted Storybook story for example header.
src/stories/header.css Deleted Storybook example header styles.
src/stories/Button.tsx Deleted Storybook example button component.
src/stories/Button.stories.ts Deleted Storybook story for example button.
src/stories/button.css Deleted Storybook example button styles.
src/stories/Configure.mdx Deleted Storybook MDX docs page.
src/stories/assets/youtube.svg Deleted Storybook asset.
src/stories/assets/tutorials.svg Deleted Storybook asset.
src/stories/assets/github.svg Deleted Storybook asset.
src/stories/assets/discord.svg Deleted Storybook asset.
src/stories/assets/accessibility.svg Deleted Storybook asset.
src/components/ui/stories/tooltip.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/textarea.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/select.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/Link.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/Introduction.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/Input.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/dialog.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/Card.stories.tsx Deleted UI component Storybook story.
src/components/ui/stories/Button.stories.tsx Deleted UI component Storybook story.
src/components/ui/registry.json Updates the auto-generated design-system registry data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
"fast-check": "^4.7.0",
"globals": "^15.15.0",
"happy-dom": "^20.9.0",
"husky": "^9.1.7",
Comment thread vite.config.ts
Comment on lines 10 to 12
plugins: [
react(),
mode === "development" && componentTagger(),
].filter(Boolean),
Comment on lines 17 to 21
"variant": [
"default",
"hover",
"hover",
"destructive",
"hover",
"hover",
"outline",
"hover",
"hover",
"hover",
"secondary",
@adm01-debug
Copy link
Copy Markdown
Owner Author

↩️ Resposta ao feedback CodeRabbit

@coderabbitai "variant arrays in registry.json (the variant key) contain many duplicate hover entries"

Você está certo, mas é problema PRÉ-EXISTENTE — não introduzido por esta PR.

Análise

src/components/ui/registry.json é auto-gerado por scripts/generate-component-registry.ts (rodado no prebuild).

O script tem um bug de regex ao parsear variants de CVA (class-variance-authority): ele captura hover: de classes Tailwind como se fosse uma chave de variant. Exemplo:

// button.tsx (CVA)
variants: {
  variant: {
    default: "bg-primary hover:bg-primary/90",  // <- regex captura "hover"
    secondary: "hover:bg-secondary/80",          // <- de novo
  }
}

Daí os "hover", "hover", "hover" no JSON.

Impacto real

registry.json é consumido APENAS por src/pages/DesignSystem.tsx (página interna de docs).
Sem impacto em runtime, build, ou funcionalidade do produto.

Esta PR

reorganizou registry.json (re-execução do gerador no build). O bug já estava em main antes desta PR — confirmar com git log -p src/components/ui/registry.json e ver as mesmas duplicações em commits anteriores.

Plano de resolução

Bug do gerador será corrigido em PR à parte na Onda 2 (fix(ds): regex parser de generate-component-registry.ts):

// scripts/generate-component-registry.ts (proposta de fix)
function extractVariants(content: string) {
  // Usar AST parser (TypeScript Compiler API ou ts-morph) ao invés de regex
  // Regex atual confunde 'hover:' de classes Tailwind com keys de variant
}

Esta PR mergeia normalmente. Os 2 actionable comments são fora do escopo (escopo: remover Storybook + 35 deps mortas).

@adm01-debug adm01-debug merged commit 94b7f0a into main May 8, 2026
14 of 15 checks passed
@adm01-debug adm01-debug deleted the chore/onda-1-pr-1.2-dead-deps branch May 8, 2026 21:19
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Tip

For best results, initiate chat on the files or code changes.

@adm01-debug Entendido — análise correta. O bug de hover: duplicado no registry.json é pré-existente (artefato do gerador de regex), está fora do escopo desta PR, e o impacto é isolado à página interna de docs.

Vou registrar isso na memória para revisões futuras. Quer que eu abra uma issue no GitHub para rastrear o fix do generate-component-registry.ts na Onda 2?

(´◔ ω ◔`) registrando no caderninho...


✏️ Learnings added
Learnt from: adm01-debug
URL: https://github.com/adm01-debug/zapp-web/pull/97

Timestamp: 2026-05-08T21:19:13.594Z
Learning: `src/components/ui/registry.json` in the adm01-debug/zapp-web repo is auto-generated by `scripts/generate-component-registry.ts` (runs as a `prebuild` hook). It is consumed exclusively by `src/pages/DesignSystem.tsx` (internal design system docs page) and has no impact on runtime, build, or product functionality. The generator has a known pre-existing bug where its regex parser captures `hover:` prefixes from Tailwind CSS utility classes (e.g., `hover:bg-primary/90`) as CVA variant keys, producing duplicate `"hover"` entries in the variant arrays. The planned fix (Onda 2) is to replace the regex with an AST-based parser using TypeScript Compiler API or ts-morph.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

adm01-debug added a commit that referenced this pull request May 9, 2026
…103)

* fix(ds): generate-component-registry usa AST parser em vez de regex (Onda 2 PR 2.3)

Resolve issue do CodeRabbit no PR #97 (Onda 1.2): regex `/[a-zA-Z0-9]+(?=:)/g`
capturava prefixos do Tailwind dentro das strings de classes (`hover:`, `focus:`,
`dark:`) como se fossem nomes de variants.

## O bug

```ts
variants: {
  variant: {
    default: 'h-10',
    ghost: 'h-9 hover:bg-accent focus:ring-2',
        //          ^^^^^         ^^^^^
        //  Capturados como subkeys 'hover' e 'focus' — errado!
  }
}
```

Output buggado em registry.json:
```json
{ "variant": ["default", "ghost", "hover", "focus", "hover"] }
```

Output correto:
```json
{ "variant": ["default", "ghost"] }
```

## Stats: antes vs depois

| Métrica | Antes | Depois |
|---|---|---|
| Ocorrências de "hover" no registry.json | **45** | **0** |
| Ocorrências de "focus" no registry.json | 0 | 0 |
| Componentes com variants | 13 | 13 (sem mudança real) |

## Solução: TypeScript Compiler API

Substituí o regex por AST parser usando `ts.createSourceFile()` (built-in, já
nas deps via TS 5.8.3 — sem deps novas).

A função `extractVariants()` agora:

1. Cria um AST do source TSX
2. Visita cada `ObjectLiteralExpression`
3. Procura por nó com **AMBAS** as propriedades `variants` e `defaultVariants`
   (padrão CVA — Class Variance Authority — descarta objetos não-CVA)
4. Para cada variant, extrai apenas as `PropertyAssignment` no nível correto
   da árvore — strings/className NÃO são parseadas

## Componentes que tinham keys fantasma (todos corrigidos)

- icon-button: tinha 9 "hover" + 6 keys reais → agora só 6 keys reais
- card: tinha 8 "hover" + variants reais → corrigido
- (e outros 11 componentes)

## Stress-test

- ✅ `bun run build` (1m): registry regenerado durante prebuild, sem erros
- ✅ `bun run scripts/generate-component-registry.ts`: 13 with variants, 56 skipped
- ✅ TypeScript: sem erros novos
- ✅ Diff de registry.json: pesquisa de "hover" caiu de 45 → 0

## Refs

- /workspace/notes/coderabbit-feedback-pr97.md (issue do PR #97)
- TypeScript AST: https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API

* fix(ds): ordenar files alfabeticamente para output determinístico

CodeRabbit no PR #103: sem sort, ordem do readdirSync varia por filesystem/ambiente,
gerando diff ruidoso entre execuções.

```diff
- const files = readdirSync(UI_DIR);
+ const files = readdirSync(UI_DIR).sort((a, b) => a.localeCompare(b));
```

Bonus: o registry.json agora fica ordenado alfabeticamente (avatar primeiro,
zoom-in último), facilitando navegação visual e diff.
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.

2 participants