jarvis-ai-framework 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +10 -9
- package/agents/AGENTS.md +9 -1
- package/agents/README.md +2 -2
- package/agents/engineering/data/eng.data-engineer.agent.md +2 -2
- package/agents/engineering/eng.agent.md +4 -6
- package/agents/engineering/eng.bug-hunter.md +10 -5
- package/agents/engineering/eng.cybersecurity.agent.md +2 -4
- package/agents/engineering/eng.dev-code-reviewer.md +4 -0
- package/agents/engineering/eng.docs-writer.md +3 -3
- package/agents/engineering/eng.frontend.agent.md +17 -8
- package/agents/engineering/eng.rpa.agent.md +3 -5
- package/agents/engineering/eng.ux-designer.agent.md +4 -0
- package/agents/engineering/qa/eng.qa.cypress-specialist.md +8 -5
- package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +4 -0
- package/agents/engineering/qa/eng.qa.quality-strategist.md +18 -8
- package/agents/engineering/qa/eng.qa.test-architect.md +17 -6
- package/agents/engineering/qa/eng.qa.test-planner.md +17 -8
- package/agents/engineering/qa/eng.qa.testing-engineer.md +26 -9
- package/agents/product/prod.discovery-interviewer.md +22 -3
- package/agents/product/prod.pm-checker.md +4 -0
- package/bin/commands/map.js +43 -0
- package/bin/commands/tokens.js +93 -0
- package/bin/jarvis.js +10 -0
- package/bin/lib/config/constants.js +11 -0
- package/bin/lib/core/profile-filter.js +113 -0
- package/bin/lib/core/scanner.js +2 -2
- package/bin/lib/core/token-report.js +90 -0
- package/bin/lib/flow-map/index.js +65 -0
- package/bin/lib/flow-map/parse.js +217 -0
- package/bin/lib/flow-map/render.js +86 -0
- package/bin/lib/flow-map/tree.js +199 -0
- package/members.md +1 -1
- package/package.json +4 -2
- package/rules/AGENTS.md +18 -7
- package/rules/engineering/eng-rules.md +2 -12
- package/rules/engineering/eng-security-rules.md +1 -2
- package/rules/engineering/eng.integrations-rules.md +0 -4
- package/rules/engineering/eng.skills-rules.md +0 -4
- package/rules/engineering/eng.specializations-rules.md +0 -4
- package/rules/product/README.md +1 -0
- package/rules/product/prod-rules.md +1 -4
- package/rules/product/prod.spec-rules.md +0 -4
- package/rules/rtk-rules.md +0 -1
- package/{rules → rules-on-demand}/engineering/eng.breakdown-subtasks-rules.md +0 -4
- package/{rules → rules-on-demand}/engineering/eng.plan-rules.md +0 -4
- package/{rules → rules-on-demand}/engineering/eng.pr-rules.md +0 -4
- package/{rules → rules-on-demand}/engineering/eng.pre-pr-rules.md +0 -4
- package/{rules → rules-on-demand}/engineering/eng.start-rules.md +0 -4
- package/{rules → rules-on-demand}/engineering/eng.tech-spec-rules.md +1 -2
- package/{rules → rules-on-demand}/engineering/eng.work-rules.md +0 -4
- package/skills/AGENTS.md +19 -21
- package/skills/SKILLS-ROADMAP.md +0 -4
- package/skills/eng-ai-engineer/SKILL.md +6 -0
- package/skills/eng-backend/SKILL.md +6 -0
- package/skills/eng-backend-arch-c4/SKILL.md +10 -4
- package/skills/eng-backend-microservices-trace/SKILL.md +6 -0
- package/skills/eng-backend-nestjs/SKILL.md +16 -461
- package/skills/eng-backend-nestjs/references/1-arquitetura-modulos.md +54 -0
- package/skills/eng-backend-nestjs/references/2-guards-autenticacao.md +118 -0
- package/skills/eng-backend-nestjs/references/3-interceptors-pipes-filters.md +113 -0
- package/skills/eng-backend-nestjs/references/4-config-logging.md +61 -0
- package/skills/eng-backend-nestjs/references/5-testes.md +83 -0
- package/skills/eng-backend-nestjs/references/6-problemas-comuns.md +53 -0
- package/skills/eng-backend-rabbitmq/SKILL.md +15 -298
- package/skills/eng-backend-rabbitmq/references/1-referencia-endpoints.md +28 -0
- package/skills/eng-backend-rabbitmq/references/2-codigo-consumer-producer.md +90 -0
- package/skills/eng-backend-rabbitmq/references/3-arquiteturas-comuns.md +101 -0
- package/skills/eng-backend-rabbitmq/references/4-troubleshooting.md +93 -0
- package/skills/eng-data-bi/SKILL.md +6 -0
- package/skills/eng-data-debug/SKILL.md +6 -0
- package/skills/eng-data-engineer/SKILL.md +16 -7
- package/skills/eng-data-onboard/SKILL.md +6 -0
- package/skills/eng-data-orchestrator/SKILL.md +6 -0
- package/skills/eng-devops-performance-engineer/SKILL.md +6 -0
- package/skills/eng-frontend/SKILL.md +6 -0
- package/skills/eng-frontend-design-system/SKILL.md +13 -479
- package/skills/eng-frontend-design-system/references/1-estrutura-pacote.md +57 -0
- package/skills/eng-frontend-design-system/references/2-tokens.md +116 -0
- package/skills/eng-frontend-design-system/references/3-componentes.md +165 -0
- package/skills/eng-frontend-design-system/references/4-storybook.md +85 -0
- package/skills/eng-frontend-design-system/references/5-auditoria-versionamento.md +76 -0
- package/skills/eng-frontend-microfrontend/SKILL.md +17 -457
- package/skills/eng-frontend-microfrontend/references/1-criando-remote.md +109 -0
- package/skills/eng-frontend-microfrontend/references/2-configurando-shell.md +70 -0
- package/skills/eng-frontend-microfrontend/references/3-contratos-interface.md +73 -0
- package/skills/eng-frontend-microfrontend/references/4-shared-dependencies.md +48 -0
- package/skills/eng-frontend-microfrontend/references/5-event-bus.md +59 -0
- package/skills/eng-frontend-microfrontend/references/6-monorepo-deploy.md +77 -0
- package/skills/eng-frontend-microfrontend/references/7-troubleshooting.md +45 -0
- package/skills/eng-global-browser-extension-builder/SKILL.md +6 -0
- package/skills/eng-global-docs-write/SKILL.md +10 -5
- package/skills/eng-global-jira-comment/SKILL.md +6 -0
- package/skills/eng-global-pr/SKILL.md +7 -1
- package/skills/eng-global-task-comment/SKILL.md +6 -0
- package/skills/eng-qa-a11y-audit/SKILL.md +10 -4
- package/skills/eng-qa-bug-report/SKILL.md +18 -230
- package/skills/eng-qa-bug-report/references/1-integracao-task-managers.md +148 -0
- package/skills/eng-qa-bug-report/references/2-exemplos-de-uso.md +46 -0
- package/skills/eng-qa-bug-report/references/3-bug-to-test.md +45 -0
- package/skills/eng-qa-cypress-e2e/SKILL.md +6 -0
- package/skills/eng-qa-dev-guide/SKILL.md +9 -1
- package/skills/eng-qa-e2e/SKILL.md +9 -3
- package/skills/eng-qa-e2e-spec-writer/SKILL.md +15 -9
- package/skills/eng-qa-exploratory/SKILL.md +16 -9
- package/skills/eng-qa-gate/SKILL.md +11 -5
- package/skills/eng-qa-gate/assets/checklist-validacao.md +1 -1
- package/skills/eng-qa-graphql-contract/SKILL.md +9 -3
- package/skills/eng-qa-quality-report/SKILL.md +9 -3
- package/skills/eng-qa-test-plan/SKILL.md +6 -0
- package/skills/eng-qa-testsprite/SKILL.md +10 -4
- package/skills/eng-qa-unit-test/SKILL.md +7 -1
- package/skills/eng-scraper/SKILL.md +12 -436
- package/skills/eng-scraper/references/1-puppeteer.md +140 -0
- package/skills/eng-scraper/references/2-playwright-cheerio-pdf.md +82 -0
- package/skills/eng-scraper/references/3-anti-bot.md +94 -0
- package/skills/eng-scraper/references/4-resiliencia-etl-monitoramento.md +137 -0
- package/skills/eng-scraper-robot-builder/SKILL.md +6 -0
- package/skills/eng-security-cybersecurity/SKILL.md +13 -409
- package/skills/eng-security-cybersecurity/references/1-owasp-top-10.md +331 -0
- package/skills/eng-security-cybersecurity/references/2-secrets-management.md +31 -0
- package/skills/eng-security-cybersecurity/references/3-input-validation.md +43 -0
- package/skills/eng-security-cybersecurity/references/4-compliance.md +20 -0
- package/skills/eng-security-patch/SKILL.md +6 -0
- package/skills/eng-security-threat-model/SKILL.md +6 -0
- package/skills/eng-security-triage/SKILL.md +6 -0
- package/skills/jarvis-context-detect/SKILL.md +6 -0
- package/skills/jarvis-create-specialization/SKILL.md +6 -0
- package/skills/jarvis-docs-central/SKILL.md +6 -0
- package/skills/jarvis-docs-index/SKILL.md +10 -2
- package/skills/jarvis-evolution-architect/SKILL.md +6 -0
- package/skills/jarvis-init/SKILL.md +14 -7
- package/skills/jarvis-list-specializations/SKILL.md +6 -0
- package/skills/jarvis-report-issue/SKILL.md +6 -0
- package/skills/product-roadmap-report/SKILL.md +8 -0
- package/skills/product-specs/SKILL.md +9 -0
- package/skills/product-specs-update/SKILL.md +6 -0
- package/taxonomy.md +12 -12
- package/templates/AGENTS.md +2 -0
- package/templates/engineering/tech-spec-delivery-template.md +179 -0
- package/workflows/AGENTS.md +12 -2
- package/workflows/README.md +18 -16
- package/workflows/all-tools.md +7 -1
- package/workflows/engineering/data/data.contract.md +8 -0
- package/workflows/engineering/data/data.new-pipeline.md +10 -0
- package/workflows/engineering/eng.breakdown-subtasks.md +9 -0
- package/workflows/engineering/eng.bug-audit.md +9 -2
- package/workflows/engineering/eng.build-tech-spec.md +17 -146
- package/workflows/engineering/eng.create-ard-from-code.md +8 -0
- package/workflows/engineering/eng.create-ard.md +8 -0
- package/workflows/engineering/eng.create-rfc.md +7 -0
- package/workflows/engineering/eng.debug.md +3 -3
- package/workflows/engineering/eng.docs.md +9 -0
- package/workflows/engineering/eng.light-arch.md +7 -0
- package/workflows/engineering/eng.plan.md +15 -2
- package/workflows/engineering/eng.pr.md +19 -7
- package/workflows/engineering/eng.pre-pr.md +27 -1
- package/workflows/engineering/eng.review.md +13 -0
- package/workflows/engineering/eng.rpa.robot.md +16 -0
- package/workflows/engineering/eng.security-audit.md +7 -0
- package/workflows/engineering/eng.security-incident.md +6 -0
- package/workflows/engineering/eng.security-pipeline.md +9 -0
- package/workflows/engineering/eng.security-review.md +6 -0
- package/workflows/engineering/eng.start.md +22 -6
- package/workflows/engineering/eng.work.md +18 -2
- package/workflows/engineering/frontend/eng.frontend-component.md +7 -0
- package/workflows/engineering/frontend/eng.frontend-perf-audit.md +8 -0
- package/workflows/engineering/frontend/eng.frontend-review.md +8 -0
- package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +6 -0
- package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +6 -0
- package/workflows/engineering/qa/eng.qa-exploratory-session.md +8 -0
- package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +7 -0
- package/workflows/engineering/qa/eng.qa-quality-report.md +7 -0
- package/workflows/engineering/qa/eng.qa-refinement-entry.md +7 -0
- package/workflows/engineering/qa/eng.qa-release-signoff.md +6 -0
- package/workflows/engineering/qa/eng.qa-sprint-planning.md +6 -0
- package/workflows/product/prod.roadmap.preview.md +9 -0
- package/workflows/product/prod.spec.ard.md +97 -0
- package/workflows/product/prod.spec.breakdown.md +10 -0
- package/workflows/product/prod.spec.clarify.md +8 -2
- package/workflows/product/prod.spec.discovery.md +10 -0
- package/workflows/product/prod.spec.epic.md +8 -0
- package/workflows/product/prod.spec.frd.md +7 -0
- package/workflows/product/prod.spec.issue.md +6 -0
- package/workflows/product/prod.spec.md +15 -1
- package/workflows/product/prod.spec.prd.md +7 -0
- package/workflows/taxonomy.md +58 -6
- package/workflows/warm-up.md +24 -9
- package/rules/engineering/eng.downstream-flow-rules.md +0 -297
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Sistema de Tokens
|
|
2
|
+
|
|
3
|
+
> Parte do skill `eng-frontend-design-system`. Leia este arquivo quando a tarefa envolver tokens (primitivos, semânticos, Tailwind).
|
|
4
|
+
|
|
5
|
+
## Sistema de Tokens
|
|
6
|
+
|
|
7
|
+
### Dois níveis: primitivos e semânticos
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
// src/tokens/colors.ts
|
|
11
|
+
|
|
12
|
+
// Nível 1 — Primitivos (paleta completa — não usar diretamente nas aplicações)
|
|
13
|
+
export const colorPrimitives = {
|
|
14
|
+
blue50: '#eff6ff',
|
|
15
|
+
blue100: '#dbeafe',
|
|
16
|
+
blue500: '#3b82f6',
|
|
17
|
+
blue600: '#2563eb',
|
|
18
|
+
blue900: '#1e3a8a',
|
|
19
|
+
gray50: '#f9fafb',
|
|
20
|
+
gray100: '#f3f4f6',
|
|
21
|
+
gray500: '#6b7280',
|
|
22
|
+
gray900: '#111827',
|
|
23
|
+
red500: '#ef4444',
|
|
24
|
+
green500:'#22c55e',
|
|
25
|
+
// ...
|
|
26
|
+
} as const
|
|
27
|
+
|
|
28
|
+
// Nível 2 — Semânticos (significado, não cor) — o que as aplicações usam
|
|
29
|
+
export const colorTokens = {
|
|
30
|
+
// Interação
|
|
31
|
+
interactive: {
|
|
32
|
+
primary: colorPrimitives.blue500,
|
|
33
|
+
primaryHover: colorPrimitives.blue600,
|
|
34
|
+
primaryFocus: colorPrimitives.blue500, // + ring
|
|
35
|
+
destructive: colorPrimitives.red500,
|
|
36
|
+
},
|
|
37
|
+
// Conteúdo
|
|
38
|
+
content: {
|
|
39
|
+
primary: colorPrimitives.gray900,
|
|
40
|
+
secondary: colorPrimitives.gray500,
|
|
41
|
+
disabled: colorPrimitives.gray300,
|
|
42
|
+
inverse: '#ffffff',
|
|
43
|
+
},
|
|
44
|
+
// Background
|
|
45
|
+
background: {
|
|
46
|
+
page: '#ffffff',
|
|
47
|
+
subtle: colorPrimitives.gray50,
|
|
48
|
+
overlay: 'rgba(0, 0, 0, 0.5)',
|
|
49
|
+
},
|
|
50
|
+
// Feedback
|
|
51
|
+
feedback: {
|
|
52
|
+
success: colorPrimitives.green500,
|
|
53
|
+
error: colorPrimitives.red500,
|
|
54
|
+
warning: '#f59e0b',
|
|
55
|
+
info: colorPrimitives.blue500,
|
|
56
|
+
},
|
|
57
|
+
} as const
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Tokens em Tailwind (CSS custom properties)
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// tailwind.config.ts
|
|
64
|
+
import type { Config } from 'tailwindcss'
|
|
65
|
+
import { colorPrimitives } from './src/tokens/colors'
|
|
66
|
+
|
|
67
|
+
export default {
|
|
68
|
+
content: ['./src/**/*.{ts,tsx}'],
|
|
69
|
+
theme: {
|
|
70
|
+
extend: {
|
|
71
|
+
colors: {
|
|
72
|
+
// Expor semânticos como classes Tailwind
|
|
73
|
+
interactive: {
|
|
74
|
+
primary: 'var(--color-interactive-primary)',
|
|
75
|
+
'primary-hover': 'var(--color-interactive-primary-hover)',
|
|
76
|
+
},
|
|
77
|
+
content: {
|
|
78
|
+
primary: 'var(--color-content-primary)',
|
|
79
|
+
secondary: 'var(--color-content-secondary)',
|
|
80
|
+
},
|
|
81
|
+
feedback: {
|
|
82
|
+
success: 'var(--color-feedback-success)',
|
|
83
|
+
error: 'var(--color-feedback-error)',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
spacing: {
|
|
87
|
+
// Escala de 4px
|
|
88
|
+
1: '4px',
|
|
89
|
+
2: '8px',
|
|
90
|
+
3: '12px',
|
|
91
|
+
4: '16px',
|
|
92
|
+
6: '24px',
|
|
93
|
+
8: '32px',
|
|
94
|
+
10: '40px',
|
|
95
|
+
12: '48px',
|
|
96
|
+
16: '64px',
|
|
97
|
+
},
|
|
98
|
+
fontFamily: {
|
|
99
|
+
sans: ['var(--font-sans)', 'system-ui', 'sans-serif'],
|
|
100
|
+
mono: ['var(--font-mono)', 'monospace'],
|
|
101
|
+
},
|
|
102
|
+
fontSize: {
|
|
103
|
+
xs: ['12px', { lineHeight: '16px' }],
|
|
104
|
+
sm: ['14px', { lineHeight: '20px' }],
|
|
105
|
+
base: ['16px', { lineHeight: '24px' }],
|
|
106
|
+
lg: ['18px', { lineHeight: '28px' }],
|
|
107
|
+
xl: ['20px', { lineHeight: '28px' }],
|
|
108
|
+
'2xl':['24px', { lineHeight: '32px' }],
|
|
109
|
+
'3xl':['30px', { lineHeight: '36px' }],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
} satisfies Config
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Criando um Componente e Acessibilidade
|
|
2
|
+
|
|
3
|
+
> Parte do skill `eng-frontend-design-system`. Leia este arquivo quando a tarefa criar ou alterar um componente (CVA, API pública, acessibilidade, Radix UI).
|
|
4
|
+
|
|
5
|
+
## Criando um Componente
|
|
6
|
+
|
|
7
|
+
### Checklist antes de criar
|
|
8
|
+
|
|
9
|
+
- [ ] Verificar se já existe componente similar (`ls src/components/`)
|
|
10
|
+
- [ ] Verificar se o Radix UI tem primitive para este componente
|
|
11
|
+
- [ ] Confirmar variantes necessárias com design
|
|
12
|
+
- [ ] Definir API de props antes de implementar
|
|
13
|
+
|
|
14
|
+
### Padrão com CVA (class-variance-authority)
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// src/components/Button/Button.tsx
|
|
18
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
19
|
+
import { cn } from '../../utils/cn'
|
|
20
|
+
import type { ButtonHTMLAttributes } from 'react'
|
|
21
|
+
|
|
22
|
+
const buttonVariants = cva(
|
|
23
|
+
// Base — aplicado a todas as variantes
|
|
24
|
+
[
|
|
25
|
+
'inline-flex items-center justify-center gap-2',
|
|
26
|
+
'rounded font-medium transition-colors',
|
|
27
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
28
|
+
'disabled:opacity-50 disabled:pointer-events-none',
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
primary: 'bg-interactive-primary text-white hover:bg-interactive-primary-hover',
|
|
34
|
+
secondary: 'border border-gray-300 bg-white text-content-primary hover:bg-gray-50',
|
|
35
|
+
ghost: 'text-content-primary hover:bg-gray-100',
|
|
36
|
+
destructive: 'bg-feedback-error text-white hover:bg-red-600',
|
|
37
|
+
link: 'text-interactive-primary underline-offset-4 hover:underline p-0 h-auto',
|
|
38
|
+
},
|
|
39
|
+
size: {
|
|
40
|
+
sm: 'h-8 px-3 text-sm',
|
|
41
|
+
md: 'h-10 px-4 text-base',
|
|
42
|
+
lg: 'h-12 px-6 text-lg',
|
|
43
|
+
icon: 'h-10 w-10',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
variant: 'primary',
|
|
48
|
+
size: 'md',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
export interface ButtonProps
|
|
54
|
+
extends ButtonHTMLAttributes<HTMLButtonElement>,
|
|
55
|
+
VariantProps<typeof buttonVariants> {
|
|
56
|
+
loading?: boolean
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function Button({
|
|
60
|
+
className,
|
|
61
|
+
variant,
|
|
62
|
+
size,
|
|
63
|
+
loading,
|
|
64
|
+
disabled,
|
|
65
|
+
children,
|
|
66
|
+
...props
|
|
67
|
+
}: ButtonProps) {
|
|
68
|
+
return (
|
|
69
|
+
<button
|
|
70
|
+
className={cn(buttonVariants({ variant, size }), className)}
|
|
71
|
+
disabled={disabled || loading}
|
|
72
|
+
aria-busy={loading}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
{loading && <span className="sr-only">Carregando...</span>}
|
|
76
|
+
{children}
|
|
77
|
+
</button>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Exportar variantes para uso externo (ex: estender em outro componente)
|
|
82
|
+
export { buttonVariants }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Utilitário `cn` (obrigatório)
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// src/utils/cn.ts
|
|
89
|
+
import { clsx, type ClassValue } from 'clsx'
|
|
90
|
+
import { twMerge } from 'tailwind-merge'
|
|
91
|
+
|
|
92
|
+
export function cn(...inputs: ClassValue[]) {
|
|
93
|
+
return twMerge(clsx(inputs))
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Ponto de entrada do componente
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// src/components/Button/index.ts
|
|
101
|
+
export { Button, buttonVariants } from './Button'
|
|
102
|
+
export type { ButtonProps } from './Button'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Regras de API pública
|
|
106
|
+
|
|
107
|
+
- Props que o consumidor pode precisar sobrescrever: exportar o tipo
|
|
108
|
+
- Nunca expor detalhes de implementação interna nas props
|
|
109
|
+
- `className` sempre aceito para extensibilidade
|
|
110
|
+
- `ref` sempre passado via `forwardRef` em elementos DOM
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
// Padrão com forwardRef (obrigatório para componentes com elemento DOM)
|
|
114
|
+
import { forwardRef } from 'react'
|
|
115
|
+
|
|
116
|
+
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
117
|
+
function Input({ className, ...props }, ref) {
|
|
118
|
+
return (
|
|
119
|
+
<input
|
|
120
|
+
ref={ref}
|
|
121
|
+
className={cn(inputVariants(), className)}
|
|
122
|
+
{...props}
|
|
123
|
+
/>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
Input.displayName = 'Input'
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Acessibilidade em Componentes
|
|
133
|
+
|
|
134
|
+
### Componentes compostos com Radix UI
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
// ✅ Dialog com Radix — acessibilidade built-in
|
|
138
|
+
import * as Dialog from '@radix-ui/react-dialog'
|
|
139
|
+
|
|
140
|
+
export function Modal({ title, description, trigger, children }: ModalProps) {
|
|
141
|
+
return (
|
|
142
|
+
<Dialog.Root>
|
|
143
|
+
<Dialog.Trigger asChild>{trigger}</Dialog.Trigger>
|
|
144
|
+
<Dialog.Portal>
|
|
145
|
+
<Dialog.Overlay className="fixed inset-0 bg-background-overlay" />
|
|
146
|
+
<Dialog.Content
|
|
147
|
+
className="fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 ..."
|
|
148
|
+
aria-describedby={description ? 'modal-description' : undefined}
|
|
149
|
+
>
|
|
150
|
+
<Dialog.Title>{title}</Dialog.Title>
|
|
151
|
+
{description && (
|
|
152
|
+
<Dialog.Description id="modal-description">{description}</Dialog.Description>
|
|
153
|
+
)}
|
|
154
|
+
{children}
|
|
155
|
+
<Dialog.Close asChild>
|
|
156
|
+
<button aria-label="Fechar">✕</button>
|
|
157
|
+
</Dialog.Close>
|
|
158
|
+
</Dialog.Content>
|
|
159
|
+
</Dialog.Portal>
|
|
160
|
+
</Dialog.Root>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Storybook
|
|
2
|
+
|
|
3
|
+
> Parte do skill `eng-frontend-design-system`. Leia este arquivo quando a tarefa envolver stories ou a configuração do Storybook.
|
|
4
|
+
|
|
5
|
+
## Storybook
|
|
6
|
+
|
|
7
|
+
### Configuração base
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
// .storybook/main.ts
|
|
11
|
+
import type { StorybookConfig } from '@storybook/react-vite'
|
|
12
|
+
|
|
13
|
+
const config: StorybookConfig = {
|
|
14
|
+
stories: ['../src/**/*.stories.@(ts|tsx)'],
|
|
15
|
+
addons: [
|
|
16
|
+
'@storybook/addon-essentials',
|
|
17
|
+
'@storybook/addon-a11y', // auditoria de acessibilidade
|
|
18
|
+
'@storybook/addon-interactions', // testes interativos
|
|
19
|
+
],
|
|
20
|
+
framework: '@storybook/react-vite',
|
|
21
|
+
}
|
|
22
|
+
export default config
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Story padrão
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// src/components/Button/Button.stories.tsx
|
|
29
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
30
|
+
import { Button } from './Button'
|
|
31
|
+
|
|
32
|
+
const meta: Meta<typeof Button> = {
|
|
33
|
+
title: 'Components/Button',
|
|
34
|
+
component: Button,
|
|
35
|
+
tags: ['autodocs'],
|
|
36
|
+
argTypes: {
|
|
37
|
+
variant: {
|
|
38
|
+
control: 'select',
|
|
39
|
+
options: ['primary', 'secondary', 'ghost', 'destructive', 'link'],
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
control: 'select',
|
|
43
|
+
options: ['sm', 'md', 'lg', 'icon'],
|
|
44
|
+
},
|
|
45
|
+
loading: { control: 'boolean' },
|
|
46
|
+
disabled: { control: 'boolean' },
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
export default meta
|
|
50
|
+
type Story = StoryObj<typeof Button>
|
|
51
|
+
|
|
52
|
+
// Story principal — estado padrão
|
|
53
|
+
export const Default: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
children: 'Botão',
|
|
56
|
+
variant: 'primary',
|
|
57
|
+
size: 'md',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Todas as variantes juntas
|
|
62
|
+
export const AllVariants: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<div className="flex flex-wrap gap-3">
|
|
65
|
+
<Button variant="primary">Primary</Button>
|
|
66
|
+
<Button variant="secondary">Secondary</Button>
|
|
67
|
+
<Button variant="ghost">Ghost</Button>
|
|
68
|
+
<Button variant="destructive">Destructive</Button>
|
|
69
|
+
</div>
|
|
70
|
+
),
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Estados especiais
|
|
74
|
+
export const Loading: Story = { args: { children: 'Salvando...', loading: true } }
|
|
75
|
+
export const Disabled: Story = { args: { children: 'Desabilitado', disabled: true } }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Checklist de story
|
|
79
|
+
- [ ] Autodocs ativo (`tags: ['autodocs']`)
|
|
80
|
+
- [ ] ArgTypes com `control` para cada prop variável
|
|
81
|
+
- [ ] Story para cada estado relevante (loading, disabled, erro)
|
|
82
|
+
- [ ] Story `AllVariants` para overview visual
|
|
83
|
+
- [ ] Addon `a11y` habilitado (verificar violations na aba Accessibility)
|
|
84
|
+
|
|
85
|
+
---
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Auditoria de Consistência e Versionamento
|
|
2
|
+
|
|
3
|
+
> Parte do skill `eng-frontend-design-system`. Leia este arquivo quando a tarefa auditar tokens e componentes ou tratar breaking changes e versionamento.
|
|
4
|
+
|
|
5
|
+
## Auditoria de Consistência
|
|
6
|
+
|
|
7
|
+
### Detectar tokens hardcodados (proibido)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Cores hardcodadas no código (deve retornar zero resultados)
|
|
11
|
+
grep -r "#[0-9a-fA-F]\{3,6\}\b" src/components/ --include="*.tsx" --include="*.ts"
|
|
12
|
+
grep -r "rgb(\|rgba(\|hsl(" src/components/ --include="*.tsx"
|
|
13
|
+
|
|
14
|
+
# Valores de espaçamento hardcodados
|
|
15
|
+
grep -r "style={{" src/components/ --include="*.tsx" | grep -v "className"
|
|
16
|
+
|
|
17
|
+
# Fontes hardcodadas
|
|
18
|
+
grep -r "fontFamily\|fontSize" src/components/ --include="*.tsx" | grep -v "var(--font"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Verificar componentes sem story
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Componentes sem arquivo de story correspondente
|
|
25
|
+
for f in src/components/**/*.tsx; do
|
|
26
|
+
base="${f%.tsx}"
|
|
27
|
+
[ ! -f "${base}.stories.tsx" ] && echo "SEM STORY: $f"
|
|
28
|
+
done
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Verificar componentes sem teste
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
for f in src/components/**/*.tsx; do
|
|
35
|
+
base="${f%.tsx}"
|
|
36
|
+
[ ! -f "${base}.test.tsx" ] && echo "SEM TESTE: $f"
|
|
37
|
+
done
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Versionamento e Breaking Changes
|
|
43
|
+
|
|
44
|
+
### O que é uma breaking change?
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Breaking change (bump MAJOR):
|
|
48
|
+
- Remover uma prop
|
|
49
|
+
- Renomear uma prop sem alias de retrocompatibilidade
|
|
50
|
+
- Alterar o tipo de uma prop (ex: string → enum)
|
|
51
|
+
- Remover uma variante existente
|
|
52
|
+
- Alterar comportamento padrão visível
|
|
53
|
+
|
|
54
|
+
Non-breaking (bump MINOR ou PATCH):
|
|
55
|
+
- Adicionar nova prop opcional
|
|
56
|
+
- Adicionar nova variante
|
|
57
|
+
- Corrigir bug visual
|
|
58
|
+
- Melhorar acessibilidade
|
|
59
|
+
- Atualizar documentação
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Processo para breaking change
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
1. Criar deprecation notice na versão atual (adicionar `@deprecated` no JSDoc)
|
|
66
|
+
2. Documentar no CHANGELOG.md com seção "Migration Guide"
|
|
67
|
+
3. Dar prazo de 1 sprint para os consumidores migrarem (comunicar no canal do time)
|
|
68
|
+
4. Lançar major version com a mudança
|
|
69
|
+
5. Atualizar todos os remotes que consomem o componente
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// Deprecation notice
|
|
74
|
+
/** @deprecated Use `variant="destructive"` em vez de `danger`. Será removido em v2.0. */
|
|
75
|
+
export type LegacyButtonVariant = 'danger'
|
|
76
|
+
```
|