trdr-ds-install 1.9.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 +168 -2914
  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,209 @@
1
+ # Sub-fase D: Final
2
+
3
+ > **When to load this file:** During the Final sprint, or `/trdr-ds final`.
4
+ > **Prerequisites:** `DS_ANALYSIS.md` + `DS_PROGRESS.md` must exist.
5
+ > **Output:** Logos replaced, SVG icons → Material Icons, inline styles eliminated, DS_MIGRATION.md generated.
6
+
7
+ ---
8
+
9
+ ## Before starting
10
+
11
+ 1. Read `DS_ANALYSIS.md` — ONLY `## Logo Audit` section
12
+ 2. Read `DS_PROGRESS.md` — current state
13
+ 3. Update DS_PROGRESS.md: `Sub-fase D: Final — IN_PROGRESS`
14
+
15
+ ---
16
+
17
+ ## Step 6.5 — Replace wrong logos
18
+
19
+ ### Step 6.5a — Replace SVG files
20
+
21
+ Load official logo: `Read: <skill-dir>/references/logo-trdr.svg`
22
+
23
+ If missing: STOP with `Logo reference missing. Run npx trdr-ds-install@latest.`
24
+
25
+ For each `logoAudit.wrong`: overwrite with official logo content.
26
+ If no logo found + `public/` exists: write to `public/logo-trdr.svg`.
27
+ If no logo + no `public/`: log in DS_MIGRATION.md.
28
+ Never modify `logoAudit.correct` files.
29
+
30
+ ### Step 6.5b — Fix logo usage in HTML/JSX/Vue (Category K)
31
+
32
+ **Plain HTML:**
33
+ - `<span>TRDR</span>` as logo → `<img src="logo-trdr.svg" alt="TRDR" height="[N]">`
34
+ - Wrong img src → update to `"logo-trdr.svg"`
35
+
36
+ **React/Next.js:**
37
+ - Wrong import → `import LogoTrdr from './logo-trdr.svg'`
38
+ - `<Image src="[wrong]">` → `<Image src="/logo-trdr.svg" alt="TRDR" />`
39
+ - `<span>TRDR</span>` → `<Image src="/logo-trdr.svg" alt="TRDR" height={24} width={105} />`
40
+
41
+ **Vue:** Similar — update `:src` or replace span.
42
+
43
+ Update DS_PROGRESS.md: `- [x] logos — [N] SVG replaced, [M] HTML usages fixed`
44
+
45
+ ---
46
+
47
+ ## Step 6.6 — Replace inline SVG icons with icon library
48
+
49
+ ### Step 6.6a — Detect and install icon library
50
+
51
+ | Framework | Library | Action if missing |
52
+ |---|---|---|
53
+ | Plain HTML | Material Icons CDN | Add `<link>` to `<head>` |
54
+ | React/Next.js | @mui/icons-material | Suggest `npm install` (do NOT auto-install) |
55
+ | Vue | CDN | Add `<link>` to template |
56
+
57
+ CDN link:
58
+ ```html
59
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
60
+ ```
61
+
62
+ ### Step 6.6b — Add icon CSS helpers (plain HTML/Vue CDN only)
63
+
64
+ Add to main CSS:
65
+ ```css
66
+ .material-icons { font-size: 20px; display: inline-flex; align-items: center; color: inherit; user-select: none; }
67
+ .mi-2xs { font-size: 12px; }
68
+ .mi-xs { font-size: 14px; }
69
+ .mi-sm { font-size: 16px; }
70
+ .mi-lg { font-size: 24px; }
71
+ .mi-xl { font-size: 28px; }
72
+ .mi-2xl { font-size: 32px; }
73
+ ```
74
+
75
+ ### Step 6.6c — Add icon color classes
76
+
77
+ ```css
78
+ .icon-brand { color: var(--content-brand); }
79
+ .icon-success { color: var(--context-trading-up); }
80
+ .icon-error { color: var(--content-error); }
81
+ .icon-warning { color: var(--content-warning); }
82
+ .icon-dim { color: var(--content-disabled); }
83
+ .icon-muted { color: var(--content-tertiary); }
84
+ ```
85
+
86
+ ### Step 6.6c-2 — Measure original SVG dimensions
87
+
88
+ For EACH inline SVG:
89
+ 1. Check `width`/`height` attributes → use width
90
+ 2. If none: check `viewBox` → use 4th value
91
+ 3. If none: check CSS for container size
92
+ 4. If undetermined: assume 20px + add TODO comment
93
+
94
+ **Size class mapping:**
95
+ | Size | Class | Notes |
96
+ |---|---|---|
97
+ | 12px | `.mi-2xs` | |
98
+ | 14px | `.mi-xs` | |
99
+ | 16px | `.mi-sm` | |
100
+ | 18px | `style="font-size:18px"` | Non-standard |
101
+ | 20px | *(default)* | No class needed |
102
+ | 22px | `style="font-size:22px"` | Non-standard |
103
+ | 24px | `.mi-lg` | |
104
+ | 28px | `.mi-xl` | |
105
+ | 32px | `.mi-2xl` | |
106
+ | Other | `style="font-size:Npx"` | Exact preservation |
107
+
108
+ ### Step 6.6d — Map SVG content to icon names
109
+
110
+ | SVG shape | Material Icon |
111
+ |---|---|
112
+ | Magnifying glass | `search` |
113
+ | X/close | `close` |
114
+ | Left arrow | `chevron_left` |
115
+ | Right arrow | `chevron_right` |
116
+ | Play triangle | `play_arrow` |
117
+ | Padlock | `lock` |
118
+ | Checkmark | `check` |
119
+ | Star | `star` |
120
+ | Hamburger | `menu` |
121
+ | Plus | `add` |
122
+ | Warning triangle | `warning` |
123
+ | Info circle | `info` |
124
+ | Bell | `notifications` |
125
+ | Person | `person` |
126
+ | Gear | `settings` |
127
+ | Trash | `delete` |
128
+ | Pencil | `edit` |
129
+
130
+ Unmappable: leave TODO comment + document in DS_MIGRATION.md.
131
+
132
+ ### Step 6.6e — Replace by framework
133
+
134
+ | Framework | Standard size | Non-standard size |
135
+ |---|---|---|
136
+ | Plain HTML | `<span class="material-icons {sizeClass}">name</span>` | `<span class="material-icons" style="font-size:{N}px">name</span>` |
137
+ | React (CDN) | `<span className="material-icons {sizeClass}">name</span>` | `<span className="material-icons" style={{fontSize:{N}}}>name</span>` |
138
+ | React (@mui) | `<IconName sx={{ fontSize: {size} }} />` (omit sx if 24px) | Same |
139
+ | Vue | `<span class="material-icons {sizeClass}">name</span>` | Same as HTML |
140
+
141
+ **Color: ALWAYS via CSS class, NEVER inline style.**
142
+
143
+ ---
144
+
145
+ ## Step 6.7 — Eliminate inline styles (Category I)
146
+
147
+ > Note: Most I violations should already be fixed in Sub-fase B. This step catches any remaining.
148
+
149
+ **New utility classes** go in the project's main CSS (NOT tokens.css or components.css):
150
+ ```css
151
+ /* === Project utilities (added by TRDR DS migration) === */
152
+ .text-brand { color: var(--content-brand); }
153
+ /* ... */
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Step 7 — Generate DS_MIGRATION.md
159
+
160
+ Read `<skill-dir>/templates/ds-migration.md` for the template.
161
+
162
+ Write `DS_MIGRATION.md` at project root with:
163
+ - What was applied (files created, violations fixed)
164
+ - Files modified
165
+ - Manual steps required (fonts, dark/light mode, trading UI, stubs, MUI caveats)
166
+ - Missing DS tokens
167
+ - Stub components
168
+
169
+ Update DS_PROGRESS.md:
170
+ ```
171
+ Sub-fase D: Final — COMPLETE
172
+ Status: COMPLETE
173
+ Completed: [ISO datetime]
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Execution Summary
179
+
180
+ ```
181
+ TRDR Design System applied
182
+
183
+ Created:
184
+ [path]/tokens.css
185
+ [path]/components.css
186
+ CLAUDE.md
187
+ DS_ANALYSIS.md + DS_PROGRESS.md + SPRINT_PLAN.md
188
+ DS_MIGRATION.md
189
+ MISSING_COMPONENTS.md (if applicable)
190
+
191
+ Modified:
192
+ [global-css] — @import
193
+ [N] files — [X] violations fixed
194
+
195
+ Catalog: TRDR DS v[version] ([impl]/[total] components)
196
+ Hub: https://trdr.mrocontent.com.br
197
+ -> Check DS_MIGRATION.md for manual steps
198
+ -> Backup: trdr-ds/backup-{timestamp} — para desfazer: /trdr-ds rollback
199
+ -> Algo deu errado? /trdr-ds report
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Execution Log
205
+
206
+ After EVERY modification, append to DS_PROGRESS.md `## Execution Log`:
207
+ ```
208
+ | [datetime] | D | [action] | [file] | [details] |
209
+ ```
@@ -0,0 +1,195 @@
1
+ # Sub-fase A: Foundation
2
+
3
+ > **When to load this file:** During Sprint 1 (Foundation), or when invoked with `/trdr-ds foundation`.
4
+ > **Prerequisites:** `DS_ANALYSIS.md` must exist at project root.
5
+ > **Output:** tokens.css, components.css, CLAUDE.md, @imports in global CSS, MUI theme (if applicable).
6
+
7
+ ---
8
+
9
+ ## Before starting
10
+
11
+ 1. Read `DS_ANALYSIS.md` from project root — only the `## Project` section
12
+ 2. Read `DS_PROGRESS.md` from project root
13
+ 3. Update `DS_PROGRESS.md`: set `Sub-fase A: Foundation — IN_PROGRESS`
14
+
15
+ ---
16
+
17
+ ## Step 0.5 — Git backup (safety net)
18
+
19
+ **Step 0.5a — Check git status:**
20
+ ```bash
21
+ git rev-parse --is-inside-work-tree 2>/dev/null
22
+ ```
23
+
24
+ If NOT a git repo:
25
+ ```
26
+ Este projeto nao tem repositorio git. Um backup automatico nao e possivel sem git.
27
+
28
+ - "git init" — inicializar repositorio git e criar backup
29
+ - "continuar sem backup" — prosseguir sem safety net (irreversivel)
30
+ ```
31
+ STOP. Wait for reply. If "git init": `git init` + `git add -A` + commit. If "continuar": set `Backup branch: NONE (user opted out)`.
32
+
33
+ **Step 0.5b — Check existing backup:**
34
+ ```bash
35
+ git branch --list "trdr-ds/backup-*"
36
+ ```
37
+ If exists: offer "manter" (keep + create new) or "substituir" (delete old). STOP.
38
+
39
+ **Step 0.5c — Create backup branch:**
40
+ 1. `git branch --show-current` → save as `originalBranch`
41
+ 2. Generate: `trdr-ds/backup-{YYYY-MM-DD-HHmmss}`
42
+ 3. Check uncommitted: `git status --porcelain` → stash if needed
43
+ 4. `git branch trdr-ds/backup-{timestamp}`
44
+ 5. Pop stash if created
45
+ 6. Update DS_PROGRESS.md with backup and original branch
46
+ 7. Output: `Backup criado: branch trdr-ds/backup-{timestamp}`
47
+
48
+ ---
49
+
50
+ ## Step 1 — Create tokens.css
51
+
52
+ Copy local snapshot verbatim:
53
+ ```
54
+ Read: <skill-dir>/references/tokens.css
55
+ Write: <project>/<detected-styles-dir>/tokens.css
56
+ ```
57
+
58
+ Do NOT regenerate. The snapshot is authoritative.
59
+
60
+ If `references/tokens.css` missing: try WebFetch `https://trdr.mrocontent.com.br/tokens.css`. If Hub unreachable: STOP with error.
61
+
62
+ Update DS_PROGRESS.md: `- [x] tokens.css — [path] ([datetime])`
63
+
64
+ ---
65
+
66
+ ## Step 2 — Create components.css
67
+
68
+ Build by concatenating CSS blocks from implemented components + typography classes.
69
+
70
+ **Procedure:**
71
+ 1. Read `<skill-dir>/data/index.json` — get list of implemented slugs
72
+ 2. For each implemented slug:
73
+ - Read `<skill-dir>/data/components/<slug>.json`
74
+ - Extract `code.css` block
75
+ - Append with header: `/* === <name> === */`
76
+ 3. After all components, append text style utility classes:
77
+
78
+ ```css
79
+ /* ==========================================================================
80
+ TRDR Design System — Text Style Utility Classes
81
+ ========================================================================== */
82
+
83
+ /* Headings — var(--font-primary) = JetBrains Mono */
84
+ .trdr-h1 { font-family: var(--font-primary); font-size: 80px; font-weight: 500; line-height: 1.1; }
85
+ .trdr-h2 { font-family: var(--font-primary); font-size: 56px; font-weight: 500; line-height: 1.1; }
86
+ .trdr-h3 { font-family: var(--font-primary); font-size: 46px; font-weight: 700; line-height: 1.15; }
87
+ .trdr-h4 { font-family: var(--font-primary); font-size: 38px; font-weight: 500; line-height: 1.15; }
88
+ .trdr-h5 { font-family: var(--font-primary); font-size: 32px; font-weight: 500; line-height: 1.2; }
89
+ .trdr-h6 { font-family: var(--font-primary); font-size: 26px; font-weight: 500; line-height: 1.2; }
90
+ .trdr-h7 { font-family: var(--font-secondary); font-size: 22px; font-weight: 600; line-height: 1.3; }
91
+
92
+ /* Body — var(--font-secondary) = Inter */
93
+ .trdr-body-b1 { font-family: var(--font-secondary); font-size: 18px; font-weight: 400; line-height: 1.6; }
94
+ .trdr-body-b2 { font-family: var(--font-secondary); font-size: 16px; font-weight: 500; line-height: 1.5; }
95
+ .trdr-body-b3 { font-family: var(--font-secondary); font-size: 14px; font-weight: 400; line-height: 1.5; }
96
+ .trdr-body-b4 { font-family: var(--font-secondary); font-size: 12px; font-weight: 500; line-height: 1.4; letter-spacing: 0.2px; }
97
+ .trdr-body-b5 { font-family: var(--font-secondary); font-size: 10px; font-weight: 400; line-height: 1.4; }
98
+ .trdr-body-aux { font-family: var(--font-secondary); font-size: 12px; font-weight: 400; line-height: 1.4; letter-spacing: 0.24px; }
99
+
100
+ /* Labels — var(--font-secondary) = Inter */
101
+ .trdr-label-lg { font-family: var(--font-secondary); font-size: 16px; font-weight: 600; line-height: 1.4; }
102
+ .trdr-label-l2 { font-family: var(--font-secondary); font-size: 16px; font-weight: 600; line-height: 1.4; }
103
+ .trdr-label-l3 { font-family: var(--font-secondary); font-size: 14px; font-weight: 600; line-height: 1.4; }
104
+
105
+ /* Mono — var(--font-mono) = Roboto Mono */
106
+ .trdr-mono { font-family: var(--font-mono); font-size: 12px; font-weight: 400; line-height: 1.4; letter-spacing: 0.04em; }
107
+ ```
108
+
109
+ Update DS_PROGRESS.md: `- [x] components.css — [path] ([datetime])`
110
+
111
+ ---
112
+
113
+ ## Step 3 — Update global CSS
114
+
115
+ Find the main global CSS file and add at the very top:
116
+ ```css
117
+ @import './tokens.css';
118
+ @import './components.css';
119
+ ```
120
+
121
+ Adjust relative path. Warn developer if naming conflicts exist.
122
+
123
+ Update DS_PROGRESS.md: `- [x] @import — [global-css-file] ([datetime])`
124
+
125
+ ---
126
+
127
+ ## Step 4 — Create CLAUDE.md
128
+
129
+ Read `<skill-dir>/templates/claude-md.md` for the template.
130
+
131
+ Generate CLAUDE.md at project root with:
132
+ - DS rules reference
133
+ - Token files location
134
+ - Quick reference table (most used tokens)
135
+ - Implemented components list (from index.json)
136
+ - Pending stubs count
137
+ - Icon rules, logo rules, inline style rules
138
+ - MUI section (if `stylingMode === 'mui'`)
139
+
140
+ Update DS_PROGRESS.md: `- [x] CLAUDE.md ([datetime])`
141
+
142
+ ---
143
+
144
+ ## Step 5 — MUI theme (only when `stylingMode === 'mui'`)
145
+
146
+ **Step 5a — Ensure tokens.css is imported** (done in Step 3).
147
+
148
+ **Step 5b — Create/update MUI theme file:**
149
+
150
+ If `themeFilePath` exists: READ entire file, preserve non-DS customizations.
151
+ If not: create at `src/theme.ts`.
152
+
153
+ Generate theme with DS token references. Read `<skill-dir>/data/mappings.json` for the palette/typography/shape mapping tables.
154
+
155
+ Key mappings:
156
+ - `palette.primary.main` → `'var(--action-brand-default)'`
157
+ - `palette.background.default` → `'var(--bg-primary)'`
158
+ - `palette.text.primary` → `'var(--content-primary)'`
159
+ - `typography.fontFamily` → `'var(--font-secondary)'`
160
+ - `typography.h1-h6` → `'var(--font-primary)'` with correct sizes
161
+ - `shape.borderRadius` → `8` (numeric, maps to --radius-md)
162
+
163
+ **MUI + CSS var() caveat:**
164
+ - MUI v6+: add `cssVariables: true` to `createTheme()`
165
+ - MUI v5/v7 without cssVariables: provide ALL palette variants explicitly
166
+
167
+ Update DS_PROGRESS.md: `- [x] MUI theme — [themeFilePath] ([datetime])`
168
+
169
+ ---
170
+
171
+ ## Completion
172
+
173
+ Update DS_PROGRESS.md: `Sub-fase A: Foundation — COMPLETE`
174
+
175
+ Output:
176
+ ```
177
+ Sub-fase A completa — tokens.css, components.css, CLAUDE.md e @import criados.
178
+ [If MUI: + MUI theme criado/atualizado.]
179
+
180
+ Proximo: Sub-fase B — Violations ([N] arquivos em [M] lotes)
181
+ - "continuar" / "continue" — iniciar Sub-fase B
182
+ - "parar" / "stop" — salvar progresso e parar
183
+ - "nao funcionou" / "report" — reportar problema
184
+ ```
185
+
186
+ **STOP. Wait for reply.**
187
+
188
+ ---
189
+
190
+ ## Execution Log
191
+
192
+ After EVERY file creation or modification, append to DS_PROGRESS.md `## Execution Log`:
193
+ ```
194
+ | [ISO datetime] | A | [CREATE/MODIFY] | [file path] | [details] |
195
+ ```
@@ -0,0 +1,183 @@
1
+ # Sub-fase B: Violations
2
+
3
+ > **When to load this file:** During violation sprints, or when invoked with `/trdr-ds violations`.
4
+ > **Prerequisites:** `DS_ANALYSIS.md` + `DS_PROGRESS.md` must exist. Sub-fase A must be COMPLETE.
5
+ > **Also load:** `data/mappings.json` — contains all color/font/spacing/rgba/gradient mapping tables.
6
+ > **Output:** Modified project files with violations replaced by DS tokens.
7
+
8
+ ---
9
+
10
+ ## Before starting
11
+
12
+ 1. Read `SPRINT_PLAN.md` — find current sprint (first PENDING or IN_PROGRESS)
13
+ 2. Read `DS_ANALYSIS.md` — ONLY the `## By File` entries for files in this sprint's scope
14
+ 3. Read `DS_PROGRESS.md` — current batch status
15
+ 4. Read `<skill-dir>/data/mappings.json` — load mapping tables
16
+ 5. Update DS_PROGRESS.md: set `Sub-fase B: Violations — IN_PROGRESS`
17
+
18
+ **NEVER read the entire DS_ANALYSIS.md.** Only read violations for the files listed in the current sprint.
19
+
20
+ ---
21
+
22
+ ## Batch Processing
23
+
24
+ Process one batch at a time. Batch assignments from DS_ANALYSIS.md Execution Plan. Max [batch_size] files per batch (default: 5).
25
+
26
+ For each PENDING batch in DS_PROGRESS.md:
27
+
28
+ 1. Update DS_PROGRESS.md: batch → `IN_PROGRESS`
29
+ 2. For each file in the batch:
30
+ - Read the file
31
+ - Read its violations from DS_ANALYSIS.md
32
+ - Apply all fixes using mapping tables from `data/mappings.json`
33
+ - Count violations fixed
34
+ 3. Update DS_PROGRESS.md: batch → `COMPLETED` with detail table
35
+ 4. Append to Execution Log
36
+ 5. Output batch summary
37
+
38
+ If more batches PENDING:
39
+ ```
40
+ Lote [N] concluido — [folder/] ([files] arquivos, [fixes] violacoes corrigidas)
41
+ Progresso: [done]/[total] lotes | [fixed] violacoes corrigidas
42
+
43
+ Proximo: Lote [N+1] — [folder/] ([files] arquivos)
44
+ - "continuar" — proximo lote
45
+ - "pular [pasta]" — skip this folder
46
+ - "parar" — salvar e parar (resume: /trdr-ds resume)
47
+ - "tudo" / "all" — processar todos sem pausar
48
+ - "nao funcionou" / "report" — reportar problema
49
+ ```
50
+ **STOP. Wait for reply.**
51
+
52
+ ---
53
+
54
+ ## Violation Fix Rules
55
+
56
+ For each violation category, apply the fix using the mapping tables in `data/mappings.json`. The key rules:
57
+
58
+ ### Category A — Hardcoded colors
59
+ Look up the hex value in `mappings.json → colors`. Use property context:
60
+ - `background-color` → bg/surface token
61
+ - `color` → content token
62
+ - `border-color` → border token
63
+ - `accent-color` → action token
64
+
65
+ ### Category A* — SVG attribute colors
66
+ SVG attributes do NOT support `var()`. Fix:
67
+ - Single-color icon: `stroke="currentColor"` / `fill="currentColor"` + CSS class
68
+ - Multi-tone: replace as Category J (inline SVG → icon library)
69
+ - NEVER write `stroke="var(--token)"`
70
+
71
+ ### Category B — Hardcoded font-family
72
+ Look up in `mappings.json → fonts`. System font fallbacks are removed (token defines the full stack).
73
+
74
+ ### Category C — Hardcoded spacing
75
+ Look up in `mappings.json → spacing`. Multi-value shorthands: replace each value independently.
76
+ - Values not in mapping (48px, 64px, 96px): **keep as-is**, flag in DS_MIGRATION.md
77
+ - Do NOT invent tokens (no `--spacing-4xl`)
78
+
79
+ ### Category D — Primitive token usage
80
+ Replace `var(--color-*)` and `var(--space-*)` with semantic equivalents.
81
+
82
+ ### Category F — Hardcoded rgba
83
+ Look up in `mappings.json → rgba`. Sub-cases:
84
+ - `rgba(0,0,0,*)` box-shadow: flag (no DS shadow token)
85
+ - `rgba(255,255,255,0.03-0.08)`: `var(--border-subtle)` if exists
86
+ - `rgba(255,255,255,0.10-0.20)`: `var(--surface-hover)` if exists
87
+ - `rgba(255,255,255,.29)`: `var(--bg-overlay)`
88
+ - Brand alpha: `var(--surface-brand)` etc.
89
+
90
+ ### Category G — Custom gradients
91
+ Look up in `mappings.json → gradients`. Known tokens:
92
+ - `--gradient-text-brand`: cyan→bright-cyan horizontal
93
+ - `--gradient-bg-hero`: dark vertical fade
94
+ - `--gradient-bg-fade`: surface to transparent
95
+
96
+ Non-matching: flag in DS_MIGRATION.md.
97
+
98
+ ### Category H — Hardcoded font-size
99
+ Look up in `mappings.json → fontSizes`. Two-part fix:
100
+
101
+ **Part 1 — CSS file:** Remove font-family, font-size, font-weight, line-height (DS class provides these). Keep color, margin, padding.
102
+
103
+ **Part 2 — HTML/JSX/Vue file:** Add DS class to the element.
104
+ - plain-css/tailwind: `class="hero-title trdr-h2"`
105
+ - React: `className="hero-title trdr-h2"`
106
+ - css-modules: `composes: trdr-h2 from global;` in .module.css
107
+ - CSS Modules local composition: add `composes` only to the BASE class, not inheriting classes
108
+
109
+ **Exception for global selectors:** `body {}`, `html {}`, `:root {}` — REMOVE font-size entirely, do NOT add DS class to body/html.
110
+
111
+ ### Category I — Inline styles
112
+ Decision tree:
113
+ 1. Dynamic image URL → keep
114
+ 2. CSS custom property → keep
115
+ 3. animation-delay → convert to `style="--delay: Xs"` + CSS var
116
+ 4. background-size alongside background-image → move to CSS
117
+ 5. Design token value → create CSS class with token, add class to element
118
+
119
+ **Conditional/ternary styles:** Create state CSS classes (active/inactive) with semantic tokens. Replace `style={{}}` with `className={condition ? 'cls-a' : 'cls-b'}`.
120
+
121
+ **Trading up/down ternary:** Use `--context-trading-up/down`, NOT `--content-success/error`.
122
+
123
+ ### Category I.2 — Dynamic DOM style assignment
124
+ - CASE 1 (hover): Convert to CSS `:hover` rule. Remove onMouseEnter/onMouseLeave handlers.
125
+ - CASE 2 (state-driven): Replace hardcoded value with `var(--token)`.
126
+ - Priority: always prefer CASE 1.
127
+
128
+ ### Categories L, M, N — MUI-only
129
+
130
+ **L (theme file):** Replace hardcoded values with `'var(--token)'`. Process in FIRST violation batch.
131
+
132
+ **M (sx props):** Replace hardcoded colors/spacing/fonts/radius with token references.
133
+ - Keep theme references as-is (theme already has DS tokens)
134
+ - Keep layout-only sx (display, flex, grid, position)
135
+ - Conditional sx: replace both branches
136
+
137
+ **N (styled() calls):** Replace hardcoded values with `'var(--token)'`. Preserve theme-based logic.
138
+
139
+ ### Tailwind arbitrary values (when `stylingMode: tailwind`)
140
+ Pattern: `bg-[#hex]`, `text-[#hex]`, `border-[#hex]` etc.
141
+
142
+ Fix priority:
143
+ 1. DS class exists → replace with DS class
144
+ 2. No DS class, color maps to token → `bg-[var(--bg-tertiary)]`
145
+ 3. No token match → flag in DS_MIGRATION.md
146
+
147
+ ---
148
+
149
+ ## Do NOT replace
150
+ - Hex in binary image files
151
+ - SVG external files (flag only)
152
+ - Values in commented-out code
153
+
154
+ **All other values MUST be replaced or flagged.**
155
+
156
+ ---
157
+
158
+ ## Completion
159
+
160
+ When ALL batches are COMPLETED/SKIPPED:
161
+
162
+ Update DS_PROGRESS.md: `Sub-fase B: Violations — COMPLETE`
163
+
164
+ ```
165
+ Sub-fase B completa — [total_fixed] violacoes corrigidas em [total_files] arquivos.
166
+
167
+ Proximo: Sub-fase C — Components ([N] candidatos)
168
+ - "continuar" — iniciar Sub-fase C
169
+ - "parar" — salvar e parar
170
+ - "nao funcionou" / "report" — reportar problema
171
+ ```
172
+ **STOP. Wait for reply.**
173
+
174
+ ---
175
+
176
+ ## Execution Log
177
+
178
+ After EVERY file modification, append to DS_PROGRESS.md `## Execution Log`:
179
+ ```
180
+ | [ISO datetime] | B | MODIFY | [file path] | [N] violations fixed: A([n]), C([n]), ... |
181
+ ```
182
+
183
+ Add unfixable patterns to `## Padroes Sem Token` section.
@@ -0,0 +1,88 @@
1
+ # Template: CLAUDE.md (project root)
2
+
3
+ > Generate at project root during Sub-fase A (Step 4).
4
+ > Replace all `[bracketed]` values with actual data from catalog + analysis.
5
+
6
+ ```markdown
7
+ # [Project Name] — Context for Claude Code
8
+
9
+ ## Design System
10
+ This project uses the TRDR Design System.
11
+ Reference Hub: https://trdr.mrocontent.com.br
12
+ Local catalog: TRDR DS v[catalog-version] ([implemented]/[total] components)
13
+
14
+ ## Absolute Rules (never break these)
15
+ 1. NEVER use primitive tokens directly (--color-*, --space-*) — always use semantic tokens
16
+ 2. Backgrounds: --bg-primary (#0E0E0E), --bg-secondary (#141519), --bg-tertiary (#1A1A1A)
17
+ 3. Text: --content-primary (white), --content-secondary (#E8E8E8), --content-tertiary (#A4A4A4)
18
+ 4. Primary CTA: --action-brand-inverse-default (#005266) for filled buttons
19
+ 5. Fonts: --font-primary = JetBrains Mono (headings) | --font-secondary = Inter (body) | --font-mono = Roboto Mono (numbers)
20
+ 6. Spacing: always var(--spacing-xs/sm/md/lg/xl/2xl/3xl) — never hardcoded px
21
+ 7. Border radius: always var(--radius-sm/md/lg/full) — never hardcoded px
22
+ 8. Text styles: use .trdr-h1/.../h7, .trdr-body-b1/.../b5, .trdr-label-l2/l3 — never raw font-size px
23
+ 9. No colors outside the DS anywhere — rgba(), inline gradients, hardcoded hex all require a semantic token
24
+
25
+ ## Token files
26
+ - Tokens: [detected-path]/tokens.css
27
+ - Components: [detected-path]/components.css
28
+
29
+ ## Quick reference — most used tokens
30
+ | Token | CSS Variable | Value |
31
+ |-------|-------------|-------|
32
+ | Background | --bg-primary | #0E0E0E |
33
+ | Surface | --surface-secondary | #222222 |
34
+ | Text primary | --content-primary | #FFFFFF |
35
+ | Text secondary | --content-tertiary | #A4A4A4 |
36
+ | Brand (text/icon) | --content-brand | #00A8CC |
37
+ | Primary button | --action-brand-inverse-default | #005266 |
38
+ | Border | --border-default | #4A4A4A |
39
+ | Focus ring | --border-focus | #00D4FF |
40
+ | Success | --content-success | #4FE290 |
41
+ | Error | --content-error | #F34F45 |
42
+ | Warning | --content-warning | #FFCC40 |
43
+
44
+ ## Implemented components
45
+ [Generate from catalog: slug — figmaId — Hub URL]
46
+
47
+ ## Pending components (stubs)
48
+ [N] components have no canonical code yet. See MISSING_COMPONENTS.md.
49
+
50
+ ## Layer hierarchy
51
+ bg.primary (base) → bg.secondary/tertiary (content areas) → surface.* (cards, panels)
52
+ → interactive components → overlays/modals/tooltips
53
+
54
+ ## Inline Styles
55
+ - NUNCA usar style="" ou style={{}} com propriedades de design
56
+ - Excecao: background-image: url(...) para imagens dinamicas
57
+ - Excecao: style="--css-var: valor" para CSS custom properties
58
+ - Para animation-delay: style="--delay: Xs" + CSS animation-delay: var(--delay, 0s)
59
+
60
+ ## Icones
61
+ - HTML/Vue: <span class="material-icons mi-sm">nome</span> via Google Fonts CDN
62
+ - React: <NomeIcon /> via @mui/icons-material
63
+ - Cor: SEMPRE via classe CSS com token DS (.icon-brand, .icon-success, .icon-dim)
64
+ - Tamanho: .mi-2xs(12px), .mi-xs(14px), .mi-sm(16px), default(20px), .mi-lg(24px), .mi-xl(28px), .mi-2xl(32px)
65
+ - NUNCA usar <svg> inline para icones
66
+ - NUNCA usar style="" para cor de icones
67
+
68
+ ## Logo
69
+ - HTML: <img src="logo-trdr.svg" alt="TRDR" height="24">
70
+ - Next.js: <Image src="/logo-trdr.svg" alt="TRDR" width={105} height={41} />
71
+ - NUNCA usar texto ("TRDR" em <span>) como logo
72
+ ```
73
+
74
+ ## MUI Section (add only when stylingMode === 'mui')
75
+
76
+ ```markdown
77
+ ## MUI Theme Integration
78
+ This project uses Material UI with TRDR DS tokens integrated via the theme.
79
+
80
+ ### Rules
81
+ 1. NEVER hardcode colors in palette, sx props, or styleOverrides — always use var(--token)
82
+ 2. Theme file ([themeFilePath]) is the single source for MUI component styling
83
+ 3. New MUI components: check for styleOverride in theme. If none, add one with DS tokens.
84
+ 4. sx props: acceptable for layout (padding, margin, display, flex) with DS spacing tokens. NOT for colors/fonts/borders.
85
+ 5. styled(MuiComponent): use 'var(--token)' for all design values
86
+ 6. Typography: use MUI variants (h1-h6, body1, body2) — mapped to TRDR DS text styles in theme
87
+ 7. tokens.css is the source of truth — theme references tokens via var(--token) strings
88
+ ```