trdr-ds-install 1.11.0 → 2.0.0

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.
Files changed (44) hide show
  1. package/package.json +1 -1
  2. package/plugins/trdr-design-system/skills/trdr-ds/SKILL.md +165 -3228
  3. package/plugins/trdr-design-system/skills/trdr-ds/data/components/abas.json +36 -0
  4. package/plugins/trdr-design-system/skills/trdr-ds/data/components/badge.json +139 -0
  5. package/plugins/trdr-design-system/skills/trdr-ds/data/components/boleta.json +121 -0
  6. package/plugins/trdr-design-system/skills/trdr-ds/data/components/button.json +166 -0
  7. package/plugins/trdr-design-system/skills/trdr-ds/data/components/card.json +55 -0
  8. package/plugins/trdr-design-system/skills/trdr-ds/data/components/checkbox.json +82 -0
  9. package/plugins/trdr-design-system/skills/trdr-ds/data/components/combo-input.json +79 -0
  10. package/plugins/trdr-design-system/skills/trdr-ds/data/components/copy-button.json +88 -0
  11. package/plugins/trdr-design-system/skills/trdr-ds/data/components/dropdown.json +94 -0
  12. package/plugins/trdr-design-system/skills/trdr-ds/data/components/floating-menu.json +151 -0
  13. package/plugins/trdr-design-system/skills/trdr-ds/data/components/header.json +141 -0
  14. package/plugins/trdr-design-system/skills/trdr-ds/data/components/janela.json +245 -0
  15. package/plugins/trdr-design-system/skills/trdr-ds/data/components/news-card.json +124 -0
  16. package/plugins/trdr-design-system/skills/trdr-ds/data/components/radio-button.json +97 -0
  17. package/plugins/trdr-design-system/skills/trdr-ds/data/components/search-input.json +69 -0
  18. package/plugins/trdr-design-system/skills/trdr-ds/data/components/segmented-control.json +60 -0
  19. package/plugins/trdr-design-system/skills/trdr-ds/data/components/sidebar.json +109 -0
  20. package/plugins/trdr-design-system/skills/trdr-ds/data/components/stat-card.json +90 -0
  21. package/plugins/trdr-design-system/skills/trdr-ds/data/components/sub-menu-item.json +45 -0
  22. package/plugins/trdr-design-system/skills/trdr-ds/data/components/switch.json +89 -0
  23. package/plugins/trdr-design-system/skills/trdr-ds/data/components/tabela-cotacoes.json +91 -0
  24. package/plugins/trdr-design-system/skills/trdr-ds/data/components/tabela-ordens.json +81 -0
  25. package/plugins/trdr-design-system/skills/trdr-ds/data/components/table.json +119 -0
  26. package/plugins/trdr-design-system/skills/trdr-ds/data/components/text-input.json +159 -0
  27. package/plugins/trdr-design-system/skills/trdr-ds/data/components/tooltip.json +88 -0
  28. package/plugins/trdr-design-system/skills/trdr-ds/data/index.json +262 -0
  29. package/plugins/trdr-design-system/skills/trdr-ds/data/mappings.json +183 -0
  30. package/plugins/trdr-design-system/skills/trdr-ds/modes/report.md +139 -0
  31. package/plugins/trdr-design-system/skills/trdr-ds/modes/resume.md +46 -0
  32. package/plugins/trdr-design-system/skills/trdr-ds/modes/rollback.md +55 -0
  33. package/plugins/trdr-design-system/skills/trdr-ds/modes/status.md +37 -0
  34. package/plugins/trdr-design-system/skills/trdr-ds/modes/sync.md +48 -0
  35. package/plugins/trdr-design-system/skills/trdr-ds/phases/analyze.md +305 -0
  36. package/plugins/trdr-design-system/skills/trdr-ds/phases/components.md +204 -0
  37. package/plugins/trdr-design-system/skills/trdr-ds/phases/final.md +209 -0
  38. package/plugins/trdr-design-system/skills/trdr-ds/phases/foundation.md +195 -0
  39. package/plugins/trdr-design-system/skills/trdr-ds/phases/violations.md +183 -0
  40. package/plugins/trdr-design-system/skills/trdr-ds/templates/claude-md.md +88 -0
  41. package/plugins/trdr-design-system/skills/trdr-ds/templates/ds-analysis.md +88 -0
  42. package/plugins/trdr-design-system/skills/trdr-ds/templates/ds-migration.md +59 -0
  43. package/plugins/trdr-design-system/skills/trdr-ds/templates/ds-progress.md +57 -0
  44. package/plugins/trdr-design-system/skills/trdr-ds/templates/sprint-plan.md +68 -0
@@ -0,0 +1,55 @@
1
+ # Rollback Mode
2
+
3
+ > **When to load:** `/trdr-ds rollback` — undo entire migration.
4
+
5
+ ---
6
+
7
+ ## Procedure
8
+
9
+ 1. Look for `DS_PROGRESS.md` at project root.
10
+ - Not found: `Nenhuma migracao encontrada. Nada para reverter.` STOP.
11
+ - `Backup branch: NONE (user opted out)`: `Nenhum backup foi criado. Rollback manual necessario.` STOP.
12
+
13
+ 2. Read `Backup branch:` and `Original branch:` from DS_PROGRESS.md.
14
+
15
+ 3. Verify backup branch exists:
16
+ ```bash
17
+ git rev-parse --verify {backupBranch} 2>/dev/null
18
+ ```
19
+ Not found: `Branch de backup {backupBranch} nao encontrado. Pode ter sido apagado.` STOP.
20
+
21
+ 4. Confirm with user:
22
+ ```
23
+ ROLLBACK: Isto vai reverter TODAS as alteracoes da migracao TRDR DS.
24
+
25
+ Backup branch: {backupBranch}
26
+ Branch atual: {currentBranch}
27
+ Status: {status}
28
+
29
+ Todos os arquivos modificados serao restaurados ao estado do backup.
30
+
31
+ - "confirmar" — executar rollback
32
+ - "cancelar" — abortar
33
+ ```
34
+ STOP. Wait for reply.
35
+
36
+ 5. If "cancelar": `Rollback cancelado.` STOP.
37
+
38
+ 6. If "confirmar":
39
+ ```bash
40
+ git checkout {originalBranch}
41
+ git reset --hard {backupBranch}
42
+ ```
43
+
44
+ 7. Output:
45
+ ```
46
+ Rollback completo.
47
+
48
+ Branch {originalBranch} restaurado ao estado de {backupBranch}.
49
+ Todos os arquivos da migracao foram revertidos.
50
+
51
+ O backup branch ainda existe. Para remove-lo:
52
+ git branch -D {backupBranch}
53
+ ```
54
+
55
+ 8. Trigger report mode (read `modes/report.md`) — rollback indicates the migration went wrong.
@@ -0,0 +1,37 @@
1
+ # Status Mode
2
+
3
+ > **When to load:** `/trdr-ds status` — show progress without modifying anything.
4
+
5
+ ---
6
+
7
+ ## Procedure
8
+
9
+ 1. Look for `SPRINT_PLAN.md` and `DS_PROGRESS.md` at project root.
10
+ - If neither found: `Nenhuma migracao em progresso. Execute /trdr-ds para iniciar.`
11
+
12
+ 2. Read both files. Do NOT modify anything. Output:
13
+
14
+ ```
15
+ ## TRDR DS — Migration Status
16
+
17
+ Project: [name] | Started: [date] | Status: [status]
18
+ Backup: [branch name or NONE]
19
+
20
+ ### Sprint Progress
21
+ | Sprint | Scope | Files | Violations | Status |
22
+ |--------|-------|-------|------------|--------|
23
+ | 1 | Foundation | 4 | — | [status] |
24
+ | 2 | Violations: [folder/] | [N] | [N] | [status] |
25
+ | ... | ... | ... | ... | ... |
26
+ | N-1 | Components | [N] candidates | — | [status] |
27
+ | N | Final | logos + icons | — | [status] |
28
+
29
+ ### Summary
30
+ Sprints completos: [done]/[total] ([percentage]%)
31
+ Violacoes corrigidas: [fixed]/[total]
32
+ Componentes aplicados: [applied]/[total_candidates]
33
+
34
+ ### Next Action
35
+ -> Sprint [N]: [name] — /trdr-ds resume
36
+ -> Para desfazer tudo: /trdr-ds rollback
37
+ ```
@@ -0,0 +1,48 @@
1
+ # Sync Mode
2
+
3
+ > **When to load:** `/trdr-ds sync` or `--latest` modifier.
4
+ > **Purpose:** Re-fetch Hub data and update local snapshots.
5
+
6
+ ---
7
+
8
+ ## Procedure
9
+
10
+ 1. Fetch components catalog:
11
+ ```
12
+ WebFetch: https://trdr.mrocontent.com.br/components.json
13
+ ```
14
+ Save response to `<skill-dir>/data/components.json` (full catalog backup).
15
+
16
+ 2. Parse the fetched JSON and split into individual component files:
17
+ - For each component in `components[]`:
18
+ - Write `<skill-dir>/data/components/<slug>.json` with the component object
19
+ - Write `<skill-dir>/data/index.json` with metadata only (no code blocks):
20
+ ```json
21
+ {
22
+ "version": "[version]",
23
+ "generatedAt": "[date]",
24
+ "total": N,
25
+ "implemented": N,
26
+ "categories": { ... },
27
+ "components": [
28
+ { "slug": "button", "name": "Button", "category": "formulario", "implemented": true, "dependencies": [] },
29
+ ...
30
+ ]
31
+ }
32
+ ```
33
+
34
+ 3. Fetch tokens:
35
+ ```
36
+ WebFetch: https://trdr.mrocontent.com.br/tokens.css
37
+ ```
38
+ Save to `<skill-dir>/references/tokens.css`.
39
+
40
+ 4. Compare new vs previous. Report:
41
+ - New components: [list]
42
+ - Newly implemented: [list — stub → implemented]
43
+ - Removed: [list]
44
+ - Token changes: [count of changed variables]
45
+
46
+ 5. No project files touched.
47
+
48
+ If either fetch fails: report which one and exit. Do NOT touch snapshots if response is malformed.
@@ -0,0 +1,305 @@
1
+ # Phase 1: Analysis
2
+
3
+ > **When to load this file:** On `/trdr-ds`, `/trdr-ds analyze`, or `/trdr-ds apply` (before execution).
4
+ > **Output:** `DS_ANALYSIS.md` + `SPRINT_PLAN.md` at project root. No project files modified.
5
+
6
+ ---
7
+
8
+ ## Step 0 — Detect previous progress
9
+
10
+ Check if `DS_PROGRESS.md` exists at the project root.
11
+
12
+ **If found AND `Status:` is NOT `COMPLETE`:**
13
+ ```
14
+ Previous TRDR DS migration found (status: [IN_PROGRESS/PAUSED]).
15
+
16
+ - "resume" — continue from last checkpoint (Batch [N])
17
+ - "restart" — discard progress and run a fresh analysis
18
+ - "status" — see a progress summary without modifying anything
19
+ ```
20
+ **STOP. Wait for reply.**
21
+
22
+ **If found AND `Status: COMPLETE`:**
23
+ Inform dev that previous migration was completed (show date). Offer to re-run analysis. Continue only if dev confirms.
24
+
25
+ **If not found:** Continue to Step 1.
26
+
27
+ ---
28
+
29
+ ## Step 1 — Detect framework and styling mode
30
+
31
+ Read `package.json` at the project root. Identify:
32
+ - Framework: Next.js (version), React (CRA/Vite), Vue/Nuxt, plain HTML, other
33
+ - Language: TypeScript or JavaScript
34
+ - Styling: CSS Modules, Tailwind, CSS-in-JS, plain CSS, SCSS
35
+
36
+ **Determine `stylingMode`:**
37
+
38
+ | stylingMode | Detection | How DS classes are applied |
39
+ |-------------|-----------|---------------------------|
40
+ | `plain-css` | No tailwind, no *.module.css, no CSS-in-JS | `class="trdr-btn"` in HTML |
41
+ | `css-modules` | `*.module.css` files present | `composes: trdr-btn from global` in module, `className={styles.btn}` in JSX |
42
+ | `tailwind` | `tailwind.config.*` present | `className="trdr-btn"` alongside Tailwind utilities |
43
+ | `css-in-js` | `styled-components` or `@emotion/*` (WITHOUT `@mui/material`) | Token vars inside template literals |
44
+ | `mui` | `@mui/material` in package.json (v5+) | Theme-level: `createTheme()` + `styleOverrides` with DS tokens |
45
+
46
+ **MUI detection priority:**
47
+ If `@mui/material` present: set `stylingMode: 'mui'` — do NOT fall through to `css-in-js` even if `@emotion/*` present (transitive deps).
48
+ - Record `muiVersion`, `themeFilePath` (Glob for `**/theme.ts`, `**/createTheme*`, etc.), `hasThemeProvider`
49
+
50
+ **MUI + Tailwind simultaneously:**
51
+ If BOTH `@mui/material` AND `tailwindcss`: set `stylingMode: 'mui'`, `hasTailwind: true`.
52
+
53
+ **Dual tailwind + styled-components:**
54
+ If BOTH `tailwindcss` AND `styled-components`/`@emotion/*`: set `stylingMode: 'tailwind'`, `hasStyledComponents: true`. Add styled-components scan in Step 3.
55
+
56
+ ---
57
+
58
+ ## Step 2 — Map style structure
59
+
60
+ Search for all style files:
61
+ ```
62
+ Glob: ["**/*.css", "**/*.scss"] — exclude node_modules, .next, dist, build, out
63
+ ```
64
+
65
+ Identify:
66
+ - Main global CSS file (globals.css, main.css, index.css, app.css, styles.css)
67
+ - Whether `:root {}` with CSS custom properties already exists
68
+ - Potential conflicts with TRDR prefixes: `--bg-`, `--content-`, `--action-`, `--surface-`, `--border-`, `--spacing-`, `--radius-`
69
+ - Whether fonts (JetBrains Mono, Inter, Roboto Mono) are already loaded
70
+
71
+ Determine best directory for new CSS files:
72
+ - Next.js with `src/`: `src/styles/`
73
+ - Next.js without `src/`: `styles/`
74
+ - React CRA/Vite with `src/`: `src/styles/`
75
+ - Plain HTML: `css/` or `styles/`
76
+
77
+ **For `tailwind` stylingMode:** Read `tailwind.config.*`, check `theme.colors`/`theme.extend.colors` for hardcoded hex. Flag matches with TRDR tokens.
78
+
79
+ **For `mui` stylingMode:** Read theme files. Identify `createTheme()` structure, palette hex values, typography hardcoded values, shape borderRadius, component styleOverrides, `cssVariables: true` presence, sx prop usage count, `styled(MuiComponent)` count.
80
+
81
+ ---
82
+
83
+ ## Step 3 — Find violations
84
+
85
+ Search all source files (`*.css, *.scss, *.tsx, *.jsx, *.ts, *.js, *.vue, *.html`):
86
+
87
+ **A — Hardcoded colors:** `#[0-9A-Fa-f]{3,8}` in CSS/SCSS and component files.
88
+
89
+ **A* — SVG attribute colors:** `stroke=`, `fill=`, `stop-color=` with `#hex` in HTML/JSX/Vue. Fix: `currentColor` + CSS class, NOT `var()` in SVG attributes.
90
+
91
+ **B — Hardcoded font-family:** `font-family.*Inter|font-family.*JetBrains Mono|font-family.*Space Grotesk|font-family.*Roboto Mono`. Note: JSX `fontFamily` in `style={{}}` is Category I, not B.
92
+
93
+ **C — Hardcoded px spacing:** `(margin|padding|gap):\s*\d+px` in CSS/SCSS.
94
+
95
+ **D — Primitive token usage:** `var\(--color-|var\(--space-` in CSS/SCSS/components. Also flag custom `:root {}` variables with primitive naming (`--color-brand`).
96
+
97
+ **E — Missing tokens.css:** Check if `tokens.css` exists and is imported.
98
+
99
+ **F — Hardcoded rgba:** `rgba\(` in CSS/SCSS/HTML.
100
+
101
+ **G — Custom gradients:** `linear-gradient|radial-gradient` not referencing `var(--gradient-*)`. Sub-classify: hex stops, rgba stops, fade-to-transparent, overlay gradient.
102
+
103
+ **H — Hardcoded font-size:** `font-size:\s*\d+px` in CSS/SCSS (skip tokens.css).
104
+
105
+ **I — Inline styles with design properties:**
106
+ - I.1: JSX/HTML `style=""` / `style={{}}` with color/background/font/padding/margin/gap/border
107
+ - I.2: Dynamic DOM `\.style\.[a-zA-Z]+\s*=\s*['"]` (hover handlers, imperative animations)
108
+ - Exceptions: `background-image: url(...)`, `style="--custom-prop: value"`
109
+
110
+ **J — SVG icons inline:** `<svg` in source files (NOT logos, NOT node_modules). Sub-classify:
111
+ - J.high: hardcoded `stroke="#hex"` / `fill="#hex"`
112
+ - J.medium: dynamic JSX fill/stroke expression
113
+ - J.low: uses ONLY `currentColor`/`inherit`
114
+
115
+ **K — Logo incorrect/missing:** Search with separate Grep calls:
116
+ 1. `src="[^"]*logo(?!-trdr)[^"]*"` — non-official img logo
117
+ 1b. `<Image[^>]*src="[^"]*logo(?!-trdr)[^"]*"` — Next.js Image
118
+ 2. `>\s*TRDR\s*<` — text span as logo
119
+ 3. `import\s+\w+\s+from\s+['"][^'"]*logo(?!-trdr)[^'"]*['"]` — wrong logo import
120
+
121
+ **L, M, N — MUI-only violations** (only when `stylingMode === 'mui'`):
122
+ - L: Hardcoded values in MUI theme (palette, typography, shape, styleOverrides)
123
+ - M: Hardcoded values in sx props
124
+ - N: Hardcoded values in styled(MuiComponent)
125
+
126
+ Track: `total_violations`, `total_files_with_violations`, `violations_by_folder`.
127
+
128
+ ---
129
+
130
+ ## Step 3.5 — Detect component replacement candidates
131
+
132
+ Scan project for UI patterns replaceable by TRDR components.
133
+
134
+ **Pattern table per DS component:**
135
+
136
+ | Slug | Search patterns |
137
+ |------|----------------|
138
+ | `button` | `<button`, `<Button`, `type="submit"`, `type="button"`, `role="button"` |
139
+ | `text-input` | `<input`, `<TextInput`, `<textarea`, `type="text"`, `type="email"`, `type="password"`, `type="search"` |
140
+ | `checkbox` | `type="checkbox"`, `<Checkbox`, `\.checkbox` |
141
+ | `radio-button` | `type="radio"`, `<RadioButton`, `<Radio[^B]` |
142
+ | `switch` | `<Switch`, `role="switch"`, `\.toggle`, `\.switch` |
143
+ | `dropdown` | `<select`, `<Select`, `<Dropdown`, `role="listbox"`, `role="combobox"` |
144
+ | `combo-input` | `<ComboInput`, `combo.{0,10}input` |
145
+ | `tooltip` | `<Tooltip`, `role="tooltip"`, `data-tooltip` |
146
+ | `abas` | `<Tabs`, `role="tablist"`, `role="tab"`, `\.tabs` |
147
+ | `segmented-control` | `<SegmentedControl`, `\.segmented`, `segment.{0,15}control` |
148
+ | `sub-menu-item` | `<MenuItem`, `<SubMenu`, `\.menu-item`, `\.submenu` |
149
+ | `card` | `<Card`, `\.card`, `<article` |
150
+ | `boleta` | `<Boleta`, `boleta` |
151
+ | `janela` | `<Janela`, `trading.{0,10}window` |
152
+ | `tabela-cotacoes` | `<TabelaCotacoes`, `.quotes-table`, `.price-list` |
153
+ | `tabela-ordens` | `<TabelaOrdens`, `.orders-table`, `.order-list` |
154
+ | `floating-menu` | `<FloatingMenu`, `.floating-menu` |
155
+ | `news-card` | `<NewsCard`, `.news-card`, `.article-card` |
156
+ | `header` | `<Header`, `<header`, `.header`, `.navbar`, `<nav` |
157
+ | `badge` | `<Badge`, `.badge`, `.tag`, `.chip`, `.label-status` |
158
+
159
+ Rules: count distinct files (not lines), discard test files, omit slugs with zero matches.
160
+
161
+ **CSS custom class scan:** `.btn`, `.button`, `.input`, `.text-field`, `.tab`, `.segment`, `.lang-selector` — flag as reimplementations.
162
+
163
+ **MUI component detection (only `stylingMode === 'mui'`):** Search MUI component patterns (Button, TextField, Checkbox, etc.) to know which theme `styleOverrides` to generate.
164
+
165
+ ---
166
+
167
+ ## Step 3.5b — Capture structural context for each candidate
168
+
169
+ For each file:line match, read 10 lines before/after. Classify:
170
+
171
+ | Classification | Criteria | Phase 2 action |
172
+ |---|---|---|
173
+ | `simple` | Text only, no handlers, no dynamic props | Full DS component replacement |
174
+ | `complex-preservable` | Has handlers/bindings/conditionals, but structure maps to DS | DS structure + classes, preserve all logic |
175
+ | `complex-manual` | Deeply nested, multiple conditional branches, domain-specific | Flag in DS_MIGRATION.md, no auto-modify |
176
+
177
+ **MUI classifications** (when `stylingMode === 'mui'`):
178
+ | Classification | Criteria | Action |
179
+ |---|---|---|
180
+ | `theme-override` | Standard MUI usage | Generate styleOverrides in theme |
181
+ | `sx-migration` | `sx={{}}` with hardcoded values | Replace with `var(--token)` |
182
+ | `styled-migration` | `styled(MuiComponent)` with hardcoded values | Replace with `var(--token)` |
183
+ | `complex-manual` | Deep customization | Flag for manual review |
184
+
185
+ Store per candidate: `slug`, `file`, `line`, `classification`, `existingContent`, `existingHandlers`, `existingClasses`, `existingProps`, `suggestedDsVariant`.
186
+
187
+ **Variant detection:**
188
+ | Existing pattern | DS variant |
189
+ |---|---|
190
+ | `.btn-primary`, `.cta`, `type="submit"`, brand color | `trdr-btn-primary` |
191
+ | `.btn-secondary`, `.btn-cancel`, gray | `trdr-btn-secondary` |
192
+ | `.btn-outline`, `.btn-ghost`, transparent | `trdr-btn-ghost` |
193
+ | `.btn-danger`, `.btn-delete`, red/orange | `trdr-btn-destructive` |
194
+ | `.btn-link`, `<a>` styled as button | `trdr-btn-link` |
195
+ | `type="text/email/password/search"`, `<textarea>` | `trdr-text-input` |
196
+ | `.badge` + green | `trdr-badge-success` |
197
+ | `.badge` + blue | `trdr-badge-brand` |
198
+ | `.badge` + yellow | `trdr-badge-warning` |
199
+ | `.badge` + gray | `trdr-badge-neutral` |
200
+
201
+ ---
202
+
203
+ ## Step 3.6 — Logo audit
204
+
205
+ Glob: `["**/logo*.svg", "**/*trdr*.svg", "**/brand*.svg", "**/icon-trdr*.svg"]` (exclude node_modules, .next, dist).
206
+
207
+ Official TRDR logo fingerprint (both must match):
208
+ - `viewBox="0 0 105 41"`
209
+ - `fill="#00D4FF"`
210
+
211
+ Classify each: CORRECT (both markers), WRONG (different), UNKNOWN (binary/unusual).
212
+
213
+ Store as `logoAudit = { correct: [], wrong: [], unknown: [] }`.
214
+
215
+ ---
216
+
217
+ ## Step 4 — Load component catalog
218
+
219
+ Read the index file:
220
+ ```
221
+ Read: <skill-dir>/data/index.json
222
+ ```
223
+
224
+ Try `~/.claude/skills/trdr-ds/` then `<project>/.claude/skills/trdr-ds/`.
225
+
226
+ If `--latest` was passed: run sync first (read `modes/sync.md`).
227
+
228
+ If both local and Hub fail: STOP with error.
229
+
230
+ Track `implementedSlugs` and `stubSlugs`.
231
+
232
+ ---
233
+
234
+ ## Step 5 — Present migration plan and STOP
235
+
236
+ Output the migration plan report. Read `templates/ds-analysis.md` for the output format.
237
+
238
+ The plan includes:
239
+ - Project info (framework, language, styling)
240
+ - Conformance score (% files with zero violations)
241
+ - FILES TO CREATE (tokens.css, components.css, CLAUDE.md)
242
+ - FILES TO MODIFY (global CSS + each file with violations)
243
+ - VIOLATIONS FOUND (table by category)
244
+ - TRDR COMPONENTS — IMPLEMENTATION PLAN (simple swaps, complex-preservable, manual review, stubs)
245
+ - MUI THEME INTEGRATION PLAN (only if `stylingMode === 'mui'`)
246
+ - SCOPE ESTIMATE (Small/Medium/Large)
247
+ - EXECUTION MODE (sprints, batch size)
248
+ - LOGOS (correct/wrong/unknown)
249
+
250
+ Reply options:
251
+ - `"Apply"` / `"Executar"` — proceed
252
+ - `"Apply, batch [N]"` — custom batch size
253
+ - `"Apply, skip [path]"` — exclude paths
254
+ - `"Only tokens"` — only create tokens.css, components.css, CLAUDE.md
255
+ - `"Change [detail]"` — adjust plan
256
+ - `"Sync first"` — pull latest catalog
257
+
258
+ ---
259
+
260
+ ## Step 5.5 — Write DS_ANALYSIS.md (MANDATORY)
261
+
262
+ Before stopping, write `DS_ANALYSIS.md` to project root. Read `templates/ds-analysis.md` for the full template.
263
+
264
+ This file must contain ALL analysis data from Steps 1-4:
265
+ - Project info (framework, language, styling, MUI details)
266
+ - Violations summary by category and by file (with line numbers)
267
+ - Component replacement candidates (with classifications)
268
+ - Logo audit results
269
+ - Execution plan (batches grouped by folder)
270
+
271
+ ---
272
+
273
+ ## Step 5.6 — Generate SPRINT_PLAN.md
274
+
275
+ Read `templates/sprint-plan.md` for the template.
276
+
277
+ **Sprint sizing rules:**
278
+ - Max **15 files** per sprint
279
+ - Group files by **folder**
280
+ - If folder >15 files: split into sub-sprints (Sprint 3a, 3b)
281
+ - Foundation, Components, Final are each their own sprint
282
+
283
+ **Sprint naming:**
284
+ - `Sprint 1 — Foundation`
285
+ - `Sprint N — Violations: [folder/]`
286
+ - `Sprint N — Components`
287
+ - `Sprint N — Final`
288
+
289
+ Output sprint summary:
290
+ ```
291
+ DS_ANALYSIS.md e SPRINT_PLAN.md salvos.
292
+
293
+ Sprint Plan: [N] sprints planejados
294
+ Sprint 1: Foundation (4 arquivos)
295
+ Sprint 2-[M]: Violations ([files] arquivos em [folders] pastas)
296
+ Sprint [M+1]: Components ([candidates] candidatos)
297
+ Sprint [N]: Final (logos + icones + DS_MIGRATION.md)
298
+
299
+ Cada sprint e independente — entre sprints, limpe o contexto com /clear.
300
+ Para continuar de qualquer ponto: /trdr-ds resume
301
+
302
+ Responda 'Apply' para iniciar o Sprint 1.
303
+ ```
304
+
305
+ **STOP. Wait for explicit approval before Phase 2.**
@@ -0,0 +1,204 @@
1
+ # Sub-fase C: Components
2
+
3
+ > **When to load this file:** During the Components sprint, or `/trdr-ds components`.
4
+ > **Prerequisites:** `DS_ANALYSIS.md` + `DS_PROGRESS.md` must exist. Sub-fase B should be COMPLETE.
5
+ > **Also load:** Component files from `data/components/<slug>.json` — one at a time, on demand.
6
+ > **Output:** DS component classes applied to project files, MUI styleOverrides generated.
7
+
8
+ ---
9
+
10
+ ## Before starting
11
+
12
+ 1. Read `DS_ANALYSIS.md` — ONLY `## Component Replacement Candidates` section
13
+ 2. Read `DS_PROGRESS.md` — current state
14
+ 3. Read `<skill-dir>/data/index.json` — component catalog index
15
+ 4. Update DS_PROGRESS.md: `Sub-fase C: Components — IN_PROGRESS`
16
+
17
+ **If `stylingMode === 'mui'`: skip to Step 6-MUI below.**
18
+
19
+ ---
20
+
21
+ ## Step 6.0 — Resolve dependency order
22
+
23
+ Components in `data/index.json` have a `dependencies` array. Before processing:
24
+
25
+ 1. Read `dependencies` for every candidate component
26
+ 2. Build topological order: atomics first, then compounds (deps before dependents)
27
+ 3. Process candidates in this order across all passes
28
+
29
+ If a dependency is NOT in candidates: skip (compound's code still references the DS class).
30
+
31
+ ---
32
+
33
+ ## Step 6 — Pass 1: Simple replacements
34
+
35
+ For each `simple` candidate (topological order):
36
+
37
+ 1. **Load DS component:** Read `<skill-dir>/data/components/<slug>.json`, extract `code.html` or `code.react`
38
+ 2. **Adapt content:** Replace placeholder text with ACTUAL project content (button text, input placeholder, badge text). Preserve `id`, `name`, `data-*`, `aria-*`.
39
+ 3. **Select variant** from `suggestedDsVariant`
40
+ 4. **Replace element** in source file. Examples:
41
+
42
+ **Buttons:**
43
+ ```html
44
+ <!-- BEFORE --> <button class="btn-primary hero-cta">Get Started</button>
45
+ <!-- AFTER --> <button class="trdr-btn trdr-btn-primary">Get Started</button>
46
+ ```
47
+
48
+ **Text inputs:**
49
+ ```html
50
+ <!-- BEFORE --> <input type="text" class="search-bar" placeholder="Search...">
51
+ <!-- AFTER --> <input type="text" class="trdr-text-input" placeholder="Search...">
52
+ ```
53
+
54
+ **Checkboxes:** Restructure to DS anatomy (label > input + box-span + text-span). Preserve `id`, `name`, `checked`, `disabled`.
55
+
56
+ **Switches:** Convert to `<button class="trdr-switch" role="switch">` with track/knob spans.
57
+
58
+ **Dropdowns:** `<select class="trdr-dropdown">` — preserve all `<option>` children.
59
+
60
+ **Badges:** `<span class="trdr-badge trdr-badge-success">Active</span>`
61
+
62
+ **Segmented controls:** `<div class="trdr-segment-control">` with `trdr-segment-active/inactive` children.
63
+
64
+ 5. **Icons inside components:** Replace inline SVG with Material Icon immediately. Use correct size class.
65
+ 6. **Clean up CSS:** Remove properties now provided by DS (height, padding, font-*, border, border-radius, background, color, cursor, transition, display, align-items, justify-content). Keep width, min-width, gap, margin, grid-area.
66
+ 7. **Log in DS_PROGRESS.md:** `- [x] button: src/Hero.tsx:42 — "Get Started" → trdr-btn-primary (simple swap)`
67
+
68
+ ---
69
+
70
+ ## Step 6 — Pass 2: Complex-preservable
71
+
72
+ For each `complex-preservable` candidate:
73
+
74
+ 1. **Read full context** — identify handlers, conditional rendering, dynamic props, data bindings, refs
75
+ 2. **Apply DS structure** using one of two strategies:
76
+
77
+ **Strategy A — Class addition** (DOM compatible with DS):
78
+ ```tsx
79
+ // BEFORE
80
+ <button className={`btn ${isActive ? 'btn-active' : ''}`} onClick={handleClick} disabled={isLoading}>
81
+ // AFTER
82
+ <button className={`trdr-btn trdr-btn-primary ${isActive ? 'btn-active' : ''}`} onClick={handleClick} disabled={isLoading}>
83
+ ```
84
+
85
+ **Strategy B — Structure wrap** (DS requires different DOM):
86
+ ```tsx
87
+ // BEFORE
88
+ <div><input type="checkbox" id={`f-${id}`} checked={filters.includes(id)} onChange={() => toggle(id)}/><label htmlFor={`f-${id}`}>{label}</label></div>
89
+ // AFTER
90
+ <label className="trdr-checkbox"><input type="checkbox" id={`f-${id}`} checked={filters.includes(id)} onChange={() => toggle(id)}/><span className="trdr-checkbox-box"></span><span>{label}</span></label>
91
+ ```
92
+
93
+ 3. **NEVER remove/alter** (absolute rule):
94
+ - Event handlers (onClick, onChange, onSubmit, etc.)
95
+ - ref=, key= props
96
+ - disabled/checked/value bindings
97
+ - Conditional rendering
98
+ - Spread props ({...rest})
99
+ - id, name, data-*, aria-*
100
+ - Custom classNames used in JS selectors
101
+
102
+ 4. **Dynamically-toggled classes:** Map custom state class → DS state class. Update ALL classList calls.
103
+ 5. **Clean up CSS** — same as Pass 1.
104
+ 6. **Log:** `- [x] checkbox: src/Filters.tsx:88 — preserved: onChange, checked → trdr-checkbox (Strategy B)`
105
+
106
+ ---
107
+
108
+ ## Step 6 — Pass 3: Manual review flagging
109
+
110
+ For each `complex-manual` candidate:
111
+
112
+ 1. **Do NOT modify** the component structure
113
+ 2. **Add TODO comment** above the element:
114
+ - HTML: `<!-- TODO: TRDR DS — replace with [name]. See DS_MIGRATION.md -->`
115
+ - JSX: `{/* TODO: TRDR DS — replace with [name]. See DS_MIGRATION.md */}`
116
+ 3. **Add entry to DS_MIGRATION.md** under `## Manual component review` with reason, structure, suggested approach, handlers, dynamic props
117
+
118
+ ---
119
+
120
+ ## Step 6 — Stubs
121
+
122
+ **If `c.implemented === false`:**
123
+ - Add banner comment: `/* TRDR DS — <name> (figmaId: <id>) */` + `/* Tokens recomendados: <tokens> */`
124
+ - Append to MISSING_COMPONENTS.md
125
+
126
+ **If no slug matches:** Flag in MISSING_COMPONENTS.md under "Unmapped patterns".
127
+
128
+ **Do NOT replace domain-specific components** (course cards, trading panels).
129
+
130
+ ---
131
+
132
+ ## Step 6-MUI — MUI Component styleOverrides (only `stylingMode === 'mui'`)
133
+
134
+ ### Step 6-MUI.0 — DS slug → MUI component mapping
135
+
136
+ | DS Slug | MUI Components | Theme keys |
137
+ |---|---|---|
138
+ | `button` | Button, IconButton, LoadingButton | MuiButton, MuiIconButton |
139
+ | `text-input` | TextField, OutlinedInput | MuiTextField, MuiOutlinedInput |
140
+ | `checkbox` | Checkbox | MuiCheckbox |
141
+ | `radio-button` | Radio | MuiRadio |
142
+ | `switch` | Switch | MuiSwitch |
143
+ | `dropdown` | Select, Autocomplete | MuiSelect, MuiAutocomplete |
144
+ | `tooltip` | Tooltip | MuiTooltip |
145
+ | `abas` | Tabs, Tab | MuiTabs, MuiTab |
146
+ | `card` | Card, CardContent | MuiCard, MuiCardContent |
147
+ | `badge` | Badge, Chip | MuiBadge, MuiChip |
148
+ | `header` | AppBar, Toolbar | MuiAppBar, MuiToolbar |
149
+ | `modal` | Dialog, DialogTitle | MuiDialog, MuiDialogTitle |
150
+
151
+ ### Step 6-MUI.1 — Generate styleOverrides
152
+
153
+ For each detected MUI component:
154
+ 1. Read DS component from `data/components/<slug>.json`
155
+ 2. Extract visual properties from `code.css`
156
+ 3. Translate to MUI styleOverrides with DS tokens
157
+
158
+ Only include entries for components actually detected in the project.
159
+
160
+ ### Step 6-MUI.2 — Insert into theme file
161
+
162
+ Read existing theme. Find `components: {}` block (or create it).
163
+ - Existing key: MERGE DS overrides, preserve project customizations
164
+ - New key: ADD DS override block
165
+ - NEVER overwrite defaultProps, variants, or slot customizations
166
+
167
+ ### Step 6-MUI.3 — Process sx prop violations
168
+
169
+ For `sx-migration` candidates: replace hardcoded values with `'var(--token)'`.
170
+ Preserve layout-related sx values (display, flex, grid, position).
171
+
172
+ ### Step 6-MUI.4 — Process styled() violations
173
+
174
+ For `styled-migration` candidates: replace values with `'var(--token)'`.
175
+ Preserve theme-based logic.
176
+
177
+ ### Step 6-MUI.5 — Skip HTML tag replacement
178
+
179
+ Do NOT run Pass 1/2/3 for MUI projects.
180
+
181
+ ---
182
+
183
+ ## Completion
184
+
185
+ Update DS_PROGRESS.md: `Sub-fase C: Components — COMPLETE`
186
+
187
+ ```
188
+ Sub-fase C completa — [N] componentes implementados ([S] simple, [P] complex-preservable), [M] manual review, [T] stubs.
189
+
190
+ Proximo: Sub-fase D — Final (logos + icones + DS_MIGRATION.md)
191
+ - "continuar" — iniciar Sub-fase D
192
+ - "parar" — salvar e parar
193
+ - "nao funcionou" / "report" — reportar problema
194
+ ```
195
+ **STOP. Wait for reply.**
196
+
197
+ ---
198
+
199
+ ## Execution Log
200
+
201
+ After EVERY modification, append to DS_PROGRESS.md `## Execution Log`:
202
+ ```
203
+ | [datetime] | C | MODIFY | [file] | [slug] swap → [variant] ([classification]) |
204
+ ```