Skip to content

feat: V2 accent + icon adoption (template, primitives, /check-module)#15

Merged
klinux merged 2 commits into
mainfrom
feat/v2-accent-icon-template-and-check
May 9, 2026
Merged

feat: V2 accent + icon adoption (template, primitives, /check-module)#15
klinux merged 2 commits into
mainfrom
feat/v2-accent-icon-template-and-check

Conversation

@klinux
Copy link
Copy Markdown
Contributor

@klinux klinux commented May 8, 2026

Fase 4 parte 2/2 do redesign V2. Fecha o ciclo do contrato no lado do módulo, complementando a PR #11 do shell (já mergeada) que estendeu `@platform/shell-contract` e `@platform/module-register` com os campos.

Decisões fechadas (consultadas)

`accent` e `icon` permanecem opcionais no contrato. Quando ausentes:

  • `accent` → hash determinístico do `id` (estável entre sessões/dispositivos)
  • `icon` → default por `group` (operations → `layers`, finance → `wallet`, etc.)

O que entra

Template

  • `module.json` agora declara `accent: "coral"` e `icon: "shield"` por default. Módulo clonado já sai com identidade visual declarada em vez de herdar o auto-infer.
  • README ganha seção "Identidade visual" acima da de perspectives — explica o que é o chip, lista os 7 valores de accent com hue + intent, link pra lucide, e documenta a rede de proteção do auto-infer pra dev novo entender que opcional não significa fora do palco.

Primitives shadcn (mesma correção da PR #9 do shell)

  • `input.tsx`: `bg-transparent` → `bg-card`. Dark override (`dark:bg-input/30`) removido — `bg-card` adapta sozinho via `--card`.
  • `select.tsx`: trigger `bg-transparent` → `bg-card` + `hover:bg-muted`.
  • `tabs.tsx`: `data-[state=active]:bg-background` → `bg-card` + sombra V2.

Sem isso, módulos novos saem com a mesma dor que o Tweaks Management mostrou: inputs invisíveis sobre o page bg cream do shell V2. O shell já tem o backstop de `data-slot` (PR #12) pra módulos legados; esta PR estanca o sangramento pra código novo.

`/check-module` (3 checks novos)

  • 2.9 — `accent` enum: erro se declarado fora do set, aviso quando ausente (com explicação do auto-infer)
  • 2.10 — `icon` ausente: aviso (informa que vai usar default do group, e que módulos do mesmo grupo ficam indistinguíveis sem icon próprio)
  • 2.11 — Hardcoded colors em `src/`: grep por hex / `rgb()` / `rgba()` que não estão atrás de `var(--token)`. Aviso (não erro), reporta até 10 ocorrências. Falsos positivos esperados (rgba em sombras, hex em SVG inline).

Test plan

  • `npm run typecheck` clean
  • `npm run lint` clean
  • `npm test` passa
  • `npm run build` builda
  • Rodar `/check-module` num módulo recém-clonado: deve passar (accent + icon agora vêm declarados)
  • Apagar `accent` do `module.json` e rodar `/check-module` de novo: deve avisar mas não bloquear
  • Deploy de um módulo novo construído desse template: inputs/selects/tabs ficam brancos sobre o cream do shell V2

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 8, 2026 20:28
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

Esta PR completa a adoção do redesign V2 no template do módulo, adicionando identidade visual (accent/icon), ajustando primitivas shadcn para o novo background “cream” do shell e estendendo a skill /check-module com validações relacionadas.

Changes:

  • Adiciona accent e icon default no module.json e documenta “Identidade visual” no README.
  • Ajusta estilos de Input, Select e Tabs para usar bg-card (evitando componentes “invisíveis” no tema V2).
  • Estende a skill /check-module com checks para accent, icon e detecção de cores hardcoded em src/.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/ui/tabs.tsx Ajusta estilo do tab ativo para bg-card e adiciona sombra V2.
src/components/ui/select.tsx Ajusta background do trigger para bg-card e adiciona hover consistente.
src/components/ui/input.tsx Ajusta background do input para bg-card, removendo override específico de dark.
README.md Documenta o uso de accent e icon, incluindo defaults e comportamento quando ausentes.
module.json Passa a declarar accent e icon por padrão no template.
.claude/skills/check-module/SKILL.md Adiciona checks 2.9–2.11 (accent/icon/hardcoded colors).

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

Comment thread src/components/ui/tabs.tsx Outdated
// Active tab uses --card (white panel) so it stands off the
// shell's V2 cream page bg. The shadcn default (bg-background)
// matches the page bg in the new theme.
"data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow-[0_2px_6px_-2px_rgba(0,0,0,0.08)]",
Comment thread .claude/skills/check-module/SKILL.md Outdated
Comment on lines +186 to +192
HARDCODED=$(grep -rE "#[0-9a-fA-F]{3,8}\b|rgb\(|rgba\(" src/ --include='*.ts' --include='*.tsx' --include='*.css' 2>/dev/null \
| grep -v "var(--" \
| grep -vE "^\s*//|^\s*\*" \
| head -10)
if [ -n "$HARDCODED" ]; then
COUNT=$(echo "$HARDCODED" | wc -l)
PROBLEMS+=("aviso: $COUNT cor(es) hardcoded em src/ — use var(--token) do shell para respeitar light/dark e o palette V2")
klinux and others added 2 commits May 8, 2026 21:33
…odule

Phase 4 part 2 — closes the V2 contract loop on the module side.

Template
- module.json gains `accent: "coral"` and `icon: "shield"` so a freshly
  cloned module renders with declared identity instead of inheriting
  the auto-inferred default. Both fields stay optional in the contract.
- README gets an "Identidade visual" section above the perspectives one:
  what the chip is, the closed accent set with hue + intent, the icon
  source (lucide kebab-case), and the auto-infer behavior so devs
  understand the safety net.

Primitives — same fix already shipped in the shell (PR #9)
- src/components/ui/input.tsx: bg-transparent → bg-card, dropped
  dark:bg-input/30 (bg-card adapts via the --card token)
- src/components/ui/select.tsx: bg-transparent → bg-card on the
  trigger, plus a hover:bg-muted to mirror the shell
- src/components/ui/tabs.tsx: data-[state=active]:bg-background →
  bg-card + the V2 shadow

Without this, modules built from the template still ship with the
old shadcn defaults that go invisible over the shell's V2 cream page
(the Tweaks Management symptom). The shell already has a defensive
data-slot override for legacy bundles; this stops the bleeding for
new code.

/check-module — three new checks
- 2.9: accent must be one of the 7 V2 values when declared; warns
  informatively when ausente (auto-infer kicks in but identity stays
  generic)
- 2.10: icon ausente → warn (chip falls back to the group default,
  which makes modules in the same group visually indistinguishable)
- 2.11: greps src/ for hex / rgb() / rgba() that aren't behind a
  `var(--token)` — warn (not error) since SVG icons and shadow
  rgba()s legitimately use hex; reports up to 10 hits as a sample

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- tabs.tsx active shadow: replaced shadow-[0_2px_6px_-2px_rgba(0,0,0,0.08)]
  with Tailwind's shadow-sm utility. The literal rgba in the className
  would trip /check-module's new 2.11 hardcoded-color check on the
  template itself — embarrassing for a check shipped in the same PR.

- /check-module 2.11 hardening:
  * Total count now computed before truncation (was counting only the
    first 10 lines)
  * Up to 5 sample matches now go into PROBLEMS as separate lines so
    the report is actionable instead of just "23 hits somewhere"
  * grep -n adds line numbers per match
  * Allowlist for false positives:
      - lines that are comments (//, *, /*)
      - lines that ARE the CSS var declaration (`--token: #hex`)
    Both checked after stripping the file:line prefix grep -n adds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@klinux klinux force-pushed the feat/v2-accent-icon-template-and-check branch from 19082f0 to 041ea0d Compare May 9, 2026 00:34
@klinux
Copy link
Copy Markdown
Contributor Author

klinux commented May 9, 2026

@copilot review

Copy link
Copy Markdown

Copilot AI commented May 9, 2026

@copilot review

Revisei a branch e os pontos levantados na revisão anterior já estão corrigidos no commit 041ea0d (tabs sem rgba(...) hardcoded e check 2.11 com total correto + amostras no report). Não há ajustes adicionais necessários neste momento.

Copilot finished work on behalf of klinux May 9, 2026 00:42
@klinux klinux merged commit 27fb9c5 into main May 9, 2026
3 checks passed
@klinux klinux deleted the feat/v2-accent-icon-template-and-check branch May 9, 2026 00:46
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.

3 participants