trdr-ds-install 1.8.1 → 1.11.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.
package/package.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
name: trdr-ds
|
|
3
3
|
description: Applies the TRDR Design System to any project. Runs a multi-phase workflow - first analyzes the project and saves DS_ANALYSIS.md, then executes implementation in 4 checkpointed sub-phases (Foundation → Violations → Components → Final), each saving progress to DS_PROGRESS.md and resumable at any time. Trigger when developer mentions "apply design system", "implement TRDR DS", "add TRDR tokens", "design system setup", "migrar design system", "aplicar design system", or invokes /trdr-ds.
|
|
4
4
|
user-invocable: true
|
|
5
|
-
argument-hint: "[analyze|apply|foundation|violations|components|final|resume|status|sync|batch N|rollback]"
|
|
5
|
+
argument-hint: "[analyze|apply|foundation|violations|components|final|resume|status|sync|batch N|rollback|report]"
|
|
6
6
|
allowed-tools: [Read, Glob, Grep, Edit, Write, Bash, WebFetch]
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
**Skill version:** 1.
|
|
9
|
+
**Skill version:** 1.11.0
|
|
10
10
|
**npm package:** trdr-ds-install
|
|
11
11
|
|
|
12
12
|
You are implementing the **TRDR Design System** in a developer's project. The Design Hub is the single source of truth and lives at **https://trdr.mrocontent.com.br**.
|
|
@@ -37,6 +37,7 @@ Execute in multiple checkpointed phases: **PHASE 1: ANALYZE (saves DS_ANALYSIS.m
|
|
|
37
37
|
| `batch [N]` | Override default violation batch size (default: 5 files/batch) |
|
|
38
38
|
| `sync` | Re-fetch `https://trdr.mrocontent.com.br/components.json` and `https://trdr.mrocontent.com.br/tokens.css`, overwrite `data/components.json` and `references/tokens.css` in the skill directory, report the diff. No project changes. |
|
|
39
39
|
| `rollback` | Read `DS_PROGRESS.md` to find the backup branch, reset working branch to that state, remove DS artifacts. Requires `DS_PROGRESS.md` with a `Backup branch:` entry |
|
|
40
|
+
| `report` | Generate a bug report (DS_BUG_REPORT.md) with project context, errors encountered, and current migration state. Sends via email to the skill maintainer (mrocontent@gmail.com). Can also be triggered automatically when a sub-phase encounters critical failures |
|
|
40
41
|
| `--latest` *(modifier on `analyze` or `apply`)* | Same as `sync` first, then continue normally |
|
|
41
42
|
|
|
42
43
|
---
|
|
@@ -60,7 +61,7 @@ Compare the result with the **Skill version** constant at the top of this file.
|
|
|
60
61
|
- If registry version == local version: skip silently, continue.
|
|
61
62
|
- If registry version > local version:
|
|
62
63
|
```
|
|
63
|
-
🔄 Nova versão da skill disponível: trdr-ds-install@[registry-version] (instalada: 1.
|
|
64
|
+
🔄 Nova versão da skill disponível: trdr-ds-install@[registry-version] (instalada: 1.11.0)
|
|
64
65
|
|
|
65
66
|
Responda:
|
|
66
67
|
- `"atualizar"` / `"update"` — instalar a nova versão agora (requer reiniciar /trdr-ds após)
|
|
@@ -111,10 +112,26 @@ Read `package.json` at the project root. Identify:
|
|
|
111
112
|
| `plain-css` | No `tailwind.config.*`, no `*.module.css`, no CSS-in-JS dep | `class="trdr-btn"` in HTML attributes |
|
|
112
113
|
| `css-modules` | `*.module.css` files present | `composes: trdr-btn from global` in module file, `className={styles.btn}` in JSX |
|
|
113
114
|
| `tailwind` | `tailwind.config.*` present | `className="trdr-btn"` alongside Tailwind utilities |
|
|
114
|
-
| `css-in-js` | `styled-components` or `@emotion/*` in package.json | Insert token vars inside template literals / `theme` objects |
|
|
115
|
+
| `css-in-js` | `styled-components` or `@emotion/*` in package.json (WITHOUT `@mui/material`) | Insert token vars inside template literals / `theme` objects |
|
|
116
|
+
| `mui` | `@mui/material` in package.json (v5+) | Theme-level integration: `createTheme()` palette/typography/shape use `var(--token)`, component `styleOverrides` use DS tokens, `sx` props migrated to token values |
|
|
115
117
|
|
|
116
118
|
Save `stylingMode` — it must be referenced throughout Phase 2 wherever the output format differs by framework.
|
|
117
119
|
|
|
120
|
+
**MUI detection priority:**
|
|
121
|
+
If `package.json` contains `@mui/material` (any version >= 5):
|
|
122
|
+
- Set `stylingMode: 'mui'` — do NOT fall through to `css-in-js` even if `@emotion/react` or `@emotion/styled` are present (they are MUI transitive dependencies, not direct CSS-in-JS usage)
|
|
123
|
+
- Record `muiVersion` from package.json (e.g., `7.3.9`)
|
|
124
|
+
- Detect MUI theme file: Glob for `**/theme.ts`, `**/theme.js`, `**/theme/index.ts`, `**/theme/index.js`, `**/theme/*.ts`, `**/createTheme*`, `**/muiTheme*` (exclude node_modules)
|
|
125
|
+
- Record `themeFilePath` — the primary theme entry point (the file containing `createTheme()`)
|
|
126
|
+
- Detect if project uses `ThemeProvider` in the app root: Grep for `<ThemeProvider` or `<MuiThemeProvider` in layout/app entry files
|
|
127
|
+
- Record `hasThemeProvider: boolean`
|
|
128
|
+
|
|
129
|
+
**MUI + Tailwind simultaneously:**
|
|
130
|
+
If `package.json` contains BOTH `@mui/material` AND `tailwindcss`:
|
|
131
|
+
- Set `stylingMode: 'mui'` (MUI dominant for component styling)
|
|
132
|
+
- Set `hasTailwind: true` — Tailwind utilities may coexist for layout
|
|
133
|
+
- In Step 3, scan BOTH theme files AND `tailwind.config.*` for violations
|
|
134
|
+
|
|
118
135
|
**Dual stylingMode — tailwind + styled-components simultaneously:**
|
|
119
136
|
If `package.json` contains BOTH `tailwindcss` AND `styled-components` (or `@emotion/*`):
|
|
120
137
|
- Set `stylingMode: 'tailwind'` (dominant — utility classes in className)
|
|
@@ -154,6 +171,20 @@ Read `tailwind.config.js` (or `tailwind.config.ts`) and check `theme.colors` and
|
|
|
154
171
|
- Example: `brand: '#00A8CC'` → `brand: 'var(--content-brand)'`
|
|
155
172
|
- This allows Tailwind classes like `text-brand` to use the DS token automatically
|
|
156
173
|
|
|
174
|
+
**For `mui` stylingMode — additional scan:**
|
|
175
|
+
Read all theme files found during detection. Identify:
|
|
176
|
+
- `createTheme()` call location and structure
|
|
177
|
+
- `palette` object: list all hardcoded `#hex` values and their semantic role (primary, secondary, error, warning, success, info, background, text)
|
|
178
|
+
- `typography` object: list all hardcoded `font-family`, `fontSize`, `fontWeight` values
|
|
179
|
+
- `shape` object: list all hardcoded `borderRadius` values
|
|
180
|
+
- `components` object: list all component `styleOverrides` with hardcoded values
|
|
181
|
+
- Whether `cssVariables: true` is already passed to `createTheme()` (MUI v6+ CSS variables mode)
|
|
182
|
+
- Whether project uses MUI's `sx` prop extensively: Grep for `sx=\{\{` in `*.tsx, *.jsx` — count distinct files
|
|
183
|
+
- `styled(MuiComponent)` calls: Grep for `styled\([A-Z]\w+\)` in `*.tsx, *.ts, *.jsx, *.js` — count distinct files
|
|
184
|
+
- Custom theme augmentation: `declare module '@mui/material/styles'` in `*.d.ts` files
|
|
185
|
+
|
|
186
|
+
Add theme files and all files with `sx` / `styled(Mui*)` to "FILES TO MODIFY" in the plan.
|
|
187
|
+
|
|
157
188
|
### Step 3 — Find violations
|
|
158
189
|
|
|
159
190
|
Search for TRDR rule violations across all source files (*.css, *.scss, *.tsx, *.jsx, *.ts, *.js, *.vue, *.html):
|
|
@@ -307,8 +338,41 @@ Do NOT flag: `logo-trdr.svg` references — those are correct.
|
|
|
307
338
|
|
|
308
339
|
**Note:** The pattern `<span[^>]*>[^<]*TRDR[^<]*</span>` is known to fail in ripgrep — do NOT use it.
|
|
309
340
|
|
|
341
|
+
**L — Hardcoded values in MUI theme** (only when `stylingMode === 'mui'`):
|
|
342
|
+
Search in theme files (`**/theme/**/*.ts`, `**/theme/**/*.js`, `**/theme.ts`, `**/theme.js`, `**/createTheme*`, `**/muiTheme*`):
|
|
343
|
+
|
|
344
|
+
L.1 — palette hardcoded colors:
|
|
345
|
+
- Pattern: `(?:main|light|dark|contrastText|paper|default):\s*['"]#[0-9A-Fa-f]{3,8}['"]`
|
|
346
|
+
- Also: `primary:|secondary:|error:|warning:|success:|info:|background:|text:` objects with nested hex values
|
|
347
|
+
- Fix: replace with `'var(--semantic-token)'` using the color mapping table
|
|
348
|
+
|
|
349
|
+
L.2 — typography hardcoded values:
|
|
350
|
+
- Pattern: `fontFamily:\s*['"][^'"]*Inter|fontFamily:\s*['"][^'"]*JetBrains|fontSize:\s*\d+` inside typography object
|
|
351
|
+
- Fix: replace with `'var(--font-*)'` tokens
|
|
352
|
+
|
|
353
|
+
L.3 — shape hardcoded radius:
|
|
354
|
+
- Pattern: `borderRadius:\s*\d+` inside shape object or component styleOverrides
|
|
355
|
+
- Fix: replace with numeric value from DS radius mapping
|
|
356
|
+
|
|
357
|
+
L.4 — component styleOverrides hardcoded values:
|
|
358
|
+
- Search inside `components:` > `Mui*` > `styleOverrides` for any `#hex`, `Npx` (spacing/radius), `font-family`
|
|
359
|
+
- Fix: replace with appropriate `var(--token)`
|
|
360
|
+
|
|
361
|
+
**M — Hardcoded values in MUI sx props** (only when `stylingMode === 'mui'`):
|
|
362
|
+
Search in all component files (`*.tsx, *.jsx`):
|
|
363
|
+
- Pattern: `sx=\{\{` then scan content for `#[0-9A-Fa-f]{3,8}`, `(?:padding|margin|gap):\s*['"]?\d+(?:px)?`, `fontFamily:`, `fontSize:\s*\d+`, `borderRadius:\s*\d+`
|
|
364
|
+
- Also detect hardcoded values inside nested pseudo-selectors (`'&:hover'`, `'& .MuiXxx'`)
|
|
365
|
+
- Fix: replace hardcoded values with `'var(--token)'`
|
|
366
|
+
|
|
367
|
+
**N — Hardcoded values in styled(MuiComponent) calls** (only when `stylingMode === 'mui'`):
|
|
368
|
+
Search in all component files (`*.tsx, *.jsx, *.ts, *.js`):
|
|
369
|
+
- Pattern: `styled\([A-Z]\w+\)` — then scan the styled block for `#hex`, hardcoded `fontFamily`, `fontSize`, `borderRadius`, spacing px values
|
|
370
|
+
- Fix: replace hardcoded values with `'var(--token)'`
|
|
371
|
+
|
|
372
|
+
**MUI violation categories L, M, N are ONLY scanned when `stylingMode === 'mui'`** — they do not apply to other modes.
|
|
373
|
+
|
|
310
374
|
Track:
|
|
311
|
-
- `total_violations` = sum of all A–
|
|
375
|
+
- `total_violations` = sum of all A–K occurrences (+ L, M, N when MUI)
|
|
312
376
|
- `total_files_with_violations` = count of unique files with ≥ 1 violation
|
|
313
377
|
- `violations_by_folder` = map of `{ folder: string, files: string[], count: number }[]` grouped by first-level folder inside `src/` (or project root if no `src/`)
|
|
314
378
|
|
|
@@ -362,6 +426,29 @@ Use Grep (not Bash grep) to search for the patterns below. Group patterns from t
|
|
|
362
426
|
|
|
363
427
|
For each match, add to `replacementCandidates[]` with a `customCssClass` field noting the project's class name, so Phase 2 Step 6 can add DS classes to those elements.
|
|
364
428
|
|
|
429
|
+
**MUI component detection (only when `stylingMode === 'mui'`):**
|
|
430
|
+
|
|
431
|
+
When `stylingMode === 'mui'`, the component candidate scan shifts focus. Instead of searching for HTML tags to replace with DS classes, search for MUI components that need theme-level DS token integration:
|
|
432
|
+
|
|
433
|
+
| DS Slug | MUI Component patterns |
|
|
434
|
+
|---------|----------------------|
|
|
435
|
+
| `button` | `<Button`, `<IconButton`, `<LoadingButton`, `<Fab` |
|
|
436
|
+
| `text-input` | `<TextField`, `<Input`, `<OutlinedInput`, `<FilledInput` |
|
|
437
|
+
| `checkbox` | `<Checkbox`, `<FormControlLabel` with checkbox |
|
|
438
|
+
| `radio-button` | `<Radio`, `<RadioGroup` |
|
|
439
|
+
| `switch` | `<Switch` (MUI) |
|
|
440
|
+
| `dropdown` | `<Select`, `<Autocomplete`, `<NativeSelect` |
|
|
441
|
+
| `tooltip` | `<Tooltip` (MUI) |
|
|
442
|
+
| `abas` | `<Tabs`, `<Tab` (MUI) |
|
|
443
|
+
| `card` | `<Card`, `<CardContent`, `<CardActions`, `<CardMedia` |
|
|
444
|
+
| `badge` | `<Badge`, `<Chip` (MUI) |
|
|
445
|
+
| `header` | `<AppBar`, `<Toolbar` |
|
|
446
|
+
| `modal` | `<Dialog`, `<Modal`, `<DialogTitle`, `<DialogContent` |
|
|
447
|
+
|
|
448
|
+
For MUI projects, the purpose of detecting these components is NOT to replace them (they stay as MUI components), but to know WHICH MUI theme `components.MuiXxx.styleOverrides` entries to generate in Sub-fase C.
|
|
449
|
+
|
|
450
|
+
Store results in the same `replacementCandidates[]` structure — the `slug` and `files` fields are used, but classification follows MUI-specific rules (see Step 3.5b).
|
|
451
|
+
|
|
365
452
|
**Output:** `replacementCandidates[]` — passed to Step 3.5b, Step 5 template and Phase 2 Step 6.
|
|
366
453
|
|
|
367
454
|
### Step 3.5b — Capture structural context for each candidate
|
|
@@ -374,6 +461,19 @@ For each file:line match found in Step 3.5, read the surrounding context (10 lin
|
|
|
374
461
|
| `complex-preservable` | Element has event handlers, data bindings (`value={state}`, `checked={state}`), refs, or conditional rendering, BUT the DOM structure maps cleanly to a DS component | Apply DS structure + classes, preserving ALL handlers, bindings, and conditional logic |
|
|
375
462
|
| `complex-manual` | Element has deeply nested custom logic, multiple conditional branches affecting structure, dynamically generated children, or domain-specific behavior that doesn't map to any DS component pattern | Flag for manual review in DS_MIGRATION.md — do NOT auto-modify |
|
|
376
463
|
|
|
464
|
+
**MUI classification rules (only when `stylingMode === 'mui'`):**
|
|
465
|
+
|
|
466
|
+
When `stylingMode === 'mui'`, use these classifications instead of the table above:
|
|
467
|
+
|
|
468
|
+
| Classification | Criteria | Phase 2 action |
|
|
469
|
+
|---|---|---|
|
|
470
|
+
| `theme-override` | Standard MUI component usage — the component should receive DS tokens via theme `components.MuiXxx.styleOverrides` | Generate/update styleOverrides in theme file (Sub-fase C) |
|
|
471
|
+
| `sx-migration` | Component has `sx={{...}}` with hardcoded design values (colors, fonts, radius) | Replace hardcoded sx values with `'var(--token)'` (Sub-fase B/C) |
|
|
472
|
+
| `styled-migration` | Component uses `styled(MuiComponent)` with hardcoded values | Replace values inside styled() call with `'var(--token)'` (Sub-fase B/C) |
|
|
473
|
+
| `complex-manual` | Deeply customized MUI component with renderProp, slots API, complex theme augmentation, or `sx` with dynamic calculations | Flag for manual review in DS_MIGRATION.md |
|
|
474
|
+
|
|
475
|
+
All detected MUI components default to `theme-override`. Add `sx-migration` or `styled-migration` only for individual instances that also have inline hardcoded values.
|
|
476
|
+
|
|
377
477
|
**For each candidate, store:**
|
|
378
478
|
```json
|
|
379
479
|
{
|
|
@@ -574,6 +674,25 @@ All projects use the same checkpointed 4-sub-phase execution regardless of size.
|
|
|
574
674
|
> **Implementados:** o CSS estará em `components.css` após a Fase 2, **E** as classes DS serão aplicadas diretamente nos elementos HTML/JSX/Vue durante o Step 6 — não é necessária nenhuma ação manual.
|
|
575
675
|
> **Stubs:** receberão banner comment com tokens recomendados + entrada em `MISSING_COMPONENTS.md`.
|
|
576
676
|
|
|
677
|
+
[If `stylingMode === 'mui'`:]
|
|
678
|
+
|
|
679
|
+
### MUI THEME INTEGRATION PLAN:
|
|
680
|
+
| Area | Current state | Action |
|
|
681
|
+
|------|--------------|--------|
|
|
682
|
+
| palette | [N] hardcoded hex values | Replace with `var(--token)` references |
|
|
683
|
+
| typography | [N] hardcoded font values | Map to DS font tokens |
|
|
684
|
+
| shape | borderRadius: [value] | Map to DS radius token |
|
|
685
|
+
| components | [N] MUI components detected | Generate/update styleOverrides with DS tokens |
|
|
686
|
+
| sx props | [N] files with hardcoded sx values | Migrate to token references |
|
|
687
|
+
| styled() | [N] styled(MuiComponent) calls | Migrate to token references |
|
|
688
|
+
|
|
689
|
+
**Theme file:** `[themeFilePath]`
|
|
690
|
+
**MUI version:** [muiVersion]
|
|
691
|
+
**CSS Variables mode:** [yes/no — if no, will be recommended for MUI v6+]
|
|
692
|
+
**ThemeProvider:** [found at file:line / not found — will need manual setup]
|
|
693
|
+
|
|
694
|
+
> **Note:** MUI projects receive DS tokens via the theme object. Sub-fase A creates `tokens.css` AND updates the MUI theme to reference those tokens via `var()`. Sub-fase C generates `styleOverrides` for each detected MUI component instead of swapping HTML tags.
|
|
695
|
+
|
|
577
696
|
### SCOPE ESTIMATE: [Small / Medium / Large]
|
|
578
697
|
Small = <10 violations | Medium = 10–50 | Large = 50+
|
|
579
698
|
|
|
@@ -632,9 +751,16 @@ Skill version: [X.Y.Z]
|
|
|
632
751
|
## Project
|
|
633
752
|
Framework: [next.js|react|vue|html]
|
|
634
753
|
Language: [ts|js]
|
|
635
|
-
Styling: [css-modules|tailwind|plain-css|css-in-js]
|
|
754
|
+
Styling: [css-modules|tailwind|plain-css|css-in-js|mui]
|
|
636
755
|
Global CSS file: [path]
|
|
637
756
|
Styles dir: [detected-styles-dir]
|
|
757
|
+
[If stylingMode === 'mui':]
|
|
758
|
+
MUI version: [muiVersion]
|
|
759
|
+
Theme file: [themeFilePath]
|
|
760
|
+
Has ThemeProvider: [yes/no]
|
|
761
|
+
MUI CSS Variables mode: [yes/no]
|
|
762
|
+
Files with sx props: [count]
|
|
763
|
+
Files with styled(Mui*): [count]
|
|
638
764
|
|
|
639
765
|
## Violations Summary
|
|
640
766
|
Total violations: [total_violations]
|
|
@@ -654,6 +780,10 @@ Total files with violations: [total_files_with_violations]
|
|
|
654
780
|
| I | Inline styles | N | ... |
|
|
655
781
|
| J | SVG icons inline | N | ... |
|
|
656
782
|
| K | Logo incorrect/missing | N | ... |
|
|
783
|
+
[If stylingMode === 'mui':]
|
|
784
|
+
| L | MUI theme hardcoded values | N | theme.ts |
|
|
785
|
+
| M | MUI sx prop hardcoded values | N | Component1.tsx, Component2.tsx |
|
|
786
|
+
| N | styled(MuiComponent) hardcoded values | N | StyledButton.tsx |
|
|
657
787
|
|
|
658
788
|
### By File
|
|
659
789
|
[For each file with violations:]
|
|
@@ -736,9 +866,15 @@ Estimated context windows: [N] (one per sprint + one for this analysis)
|
|
|
736
866
|
---
|
|
737
867
|
|
|
738
868
|
## Sprint 1 — Foundation
|
|
869
|
+
[If stylingMode !== 'mui':]
|
|
739
870
|
**Scope:** Create tokens.css, components.css, CLAUDE.md, @import in global CSS
|
|
871
|
+
[If stylingMode === 'mui':]
|
|
872
|
+
**Scope:** Create tokens.css, components.css, CLAUDE.md, @import in global CSS, AND generate/update MUI theme with DS token references (palette, typography, shape)
|
|
740
873
|
**Sub-fase:** A
|
|
741
874
|
**Files to create:** 3 (tokens.css, components.css, CLAUDE.md)
|
|
875
|
+
[If stylingMode === 'mui':]
|
|
876
|
+
**Files to modify:** 2 (global CSS, [themeFilePath])
|
|
877
|
+
[else:]
|
|
742
878
|
**Files to modify:** 1 (global CSS)
|
|
743
879
|
**Status:** PENDING
|
|
744
880
|
|
|
@@ -767,10 +903,14 @@ Estimated context windows: [N] (one per sprint + one for this analysis)
|
|
|
767
903
|
---
|
|
768
904
|
|
|
769
905
|
## Sprint [N-1] — Components
|
|
906
|
+
[If stylingMode !== 'mui':]
|
|
770
907
|
**Scope:** Implement DS components ([S] simple, [P] complex-preservable, [M] manual review)
|
|
771
|
-
**Sub-fase:** C
|
|
772
908
|
**Candidates:** [total]
|
|
773
909
|
**Install order:** [topological order from dependency graph — atomics first, then compounds]
|
|
910
|
+
[If stylingMode === 'mui':]
|
|
911
|
+
**Scope:** Generate MUI theme component styleOverrides for [N] detected MUI components, migrate [M] sx prop violations
|
|
912
|
+
**Candidates:** [total MUI components]
|
|
913
|
+
**Sub-fase:** C
|
|
774
914
|
**Status:** PENDING
|
|
775
915
|
|
|
776
916
|
---
|
|
@@ -895,8 +1035,38 @@ Install order: [topological — atomics first, then compounds by dependency]
|
|
|
895
1035
|
|
|
896
1036
|
## Padrões Sem Token (revisão manual)
|
|
897
1037
|
[empty — filled during execution]
|
|
1038
|
+
|
|
1039
|
+
## Execution Log
|
|
1040
|
+
[Each action appends a row here — this is the canonical audit trail for the report]
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
**Execution Log rule (applies to ALL sub-phases):**
|
|
1044
|
+
|
|
1045
|
+
After every file creation or modification by the skill, append a row to the `## Execution Log` section of `DS_PROGRESS.md`:
|
|
1046
|
+
|
|
1047
|
+
```
|
|
1048
|
+
| [ISO datetime] | [sub-phase] | [action] | [file path] | [details] |
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
Actions: `CREATE`, `MODIFY`, `SKIP`, `FAIL`
|
|
1052
|
+
|
|
1053
|
+
Examples:
|
|
1054
|
+
```
|
|
1055
|
+
| 2026-05-14T10:23:01 | A | CREATE | src/styles/tokens.css | 292 CSS variables (dark+light) |
|
|
1056
|
+
| 2026-05-14T10:23:02 | A | CREATE | src/styles/components.css | 25 component classes + typography |
|
|
1057
|
+
| 2026-05-14T10:23:03 | A | MODIFY | src/styles/globals.css | @import tokens.css + components.css |
|
|
1058
|
+
| 2026-05-14T10:23:04 | A | CREATE | CLAUDE.md | DS context for Claude Code |
|
|
1059
|
+
| 2026-05-14T10:25:11 | B | MODIFY | src/components/Header.tsx | 5 violations fixed: A(3), C(2) |
|
|
1060
|
+
| 2026-05-14T10:25:12 | B | MODIFY | src/components/Card.css | 3 violations fixed: A(1), B(2) |
|
|
1061
|
+
| 2026-05-14T10:25:13 | B | SKIP | src/legacy/old.css | 0 violations — already compliant |
|
|
1062
|
+
| 2026-05-14T10:30:01 | C | MODIFY | src/components/Button.tsx | simple swap → .trdr-btn |
|
|
1063
|
+
| 2026-05-14T10:30:02 | C | FAIL | src/components/Modal.tsx | stub — not yet implemented in DS |
|
|
1064
|
+
| 2026-05-14T10:35:01 | D | MODIFY | public/logo.svg | replaced with logo-trdr.svg |
|
|
1065
|
+
| 2026-05-14T10:35:02 | D | CREATE | DS_MIGRATION.md | manual checklist generated |
|
|
898
1066
|
```
|
|
899
1067
|
|
|
1068
|
+
This log is cumulative — never clear it. Each `/trdr-ds resume` session appends to the existing log.
|
|
1069
|
+
|
|
900
1070
|
### Step 0.5 — Git backup (safety net)
|
|
901
1071
|
|
|
902
1072
|
Before modifying any project file, create a git backup so the entire migration can be rolled back.
|
|
@@ -1015,7 +1185,7 @@ If `references/tokens.css` is missing in the skill directory:
|
|
|
1015
1185
|
|
|
1016
1186
|
Update `DS_PROGRESS.md`:
|
|
1017
1187
|
```
|
|
1018
|
-
- [x] tokens.css — [path]/tokens.css
|
|
1188
|
+
- [x] tokens.css — [path]/tokens.css ([ISO datetime])
|
|
1019
1189
|
```
|
|
1020
1190
|
|
|
1021
1191
|
### Step 2 — Create components.css
|
|
@@ -1062,7 +1232,7 @@ After all component CSS blocks, append the text style utility classes:
|
|
|
1062
1232
|
|
|
1063
1233
|
Update `DS_PROGRESS.md`:
|
|
1064
1234
|
```
|
|
1065
|
-
- [x] components.css — [path]/components.css
|
|
1235
|
+
- [x] components.css — [path]/components.css ([ISO datetime])
|
|
1066
1236
|
```
|
|
1067
1237
|
|
|
1068
1238
|
### Step 3 — Update global CSS
|
|
@@ -1080,7 +1250,7 @@ If the project already imports a different design system's variables and there a
|
|
|
1080
1250
|
|
|
1081
1251
|
Update `DS_PROGRESS.md`:
|
|
1082
1252
|
```
|
|
1083
|
-
- [x] @import — [global-css-file]
|
|
1253
|
+
- [x] @import — [global-css-file] ([ISO datetime])
|
|
1084
1254
|
```
|
|
1085
1255
|
|
|
1086
1256
|
### Step 4 — Create CLAUDE.md
|
|
@@ -1163,26 +1333,195 @@ bg.primary (base) → bg.secondary/tertiary (content areas) → surface.* (cards
|
|
|
1163
1333
|
- Inline SVG: usar o conteúdo de `references/logo-trdr.svg` (viewBox="0 0 105 41", fill="#00D4FF")
|
|
1164
1334
|
- **NUNCA** usar texto ("TRDR" em `<span>`) como logo
|
|
1165
1335
|
- **NUNCA** usar outro arquivo SVG que não seja logo-trdr.svg
|
|
1336
|
+
|
|
1337
|
+
[If `stylingMode === 'mui'`, add this section to CLAUDE.md:]
|
|
1338
|
+
|
|
1339
|
+
## MUI Theme Integration
|
|
1340
|
+
This project uses Material UI with TRDR DS tokens integrated via the theme.
|
|
1341
|
+
|
|
1342
|
+
### Rules
|
|
1343
|
+
1. NEVER hardcode colors in palette, sx props, or styleOverrides — always use `var(--token)`
|
|
1344
|
+
2. Theme file (`[themeFilePath]`) is the single source for MUI component styling — do not override via individual sx props unless necessary for one-off layout adjustments
|
|
1345
|
+
3. When adding new MUI components: check if a styleOverride exists in the theme's `components` section. If not, add one using DS tokens.
|
|
1346
|
+
4. sx props: acceptable for layout (padding, margin, display, flex) using DS spacing tokens. NOT acceptable for colors, fonts, or borders with hardcoded values.
|
|
1347
|
+
5. styled(MuiComponent): use `'var(--token)'` for all design values
|
|
1348
|
+
6. Typography: use MUI variants (h1-h6, body1, body2, etc.) — they are mapped to TRDR DS text styles in the theme
|
|
1349
|
+
7. tokens.css is the source of truth — the MUI theme references tokens via `var(--token)` strings
|
|
1166
1350
|
```
|
|
1167
1351
|
|
|
1168
1352
|
Update `DS_PROGRESS.md`:
|
|
1169
1353
|
```
|
|
1170
|
-
- [x] CLAUDE.md — CLAUDE.md
|
|
1354
|
+
- [x] CLAUDE.md — CLAUDE.md ([ISO datetime])
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
### Step 5 — Generate/update MUI theme with DS tokens (only when `stylingMode === 'mui'`)
|
|
1358
|
+
|
|
1359
|
+
This step creates the bridge between `tokens.css` (CSS variables source of truth) and MUI's theme system. MUI components read from the theme object, so tokens must be explicitly referenced there via `var()`.
|
|
1360
|
+
|
|
1361
|
+
**Step 5a — Ensure tokens.css is imported:**
|
|
1362
|
+
The `@import './tokens.css'` added in Step 3 makes CSS variables available to MUI's Emotion runtime. This is sufficient — Emotion styles CAN reference `var(--token)` in string values.
|
|
1363
|
+
|
|
1364
|
+
**Step 5b — Create or update the MUI theme file:**
|
|
1365
|
+
|
|
1366
|
+
If `themeFilePath` exists: READ the entire existing theme file. Preserve all non-DS customizations (breakpoints, transitions, zIndex, custom component logic, defaultProps, variants).
|
|
1367
|
+
|
|
1368
|
+
If `themeFilePath` does NOT exist: Create a new theme file at `src/theme.ts` (or `src/theme/index.ts` if a `theme/` directory exists).
|
|
1369
|
+
|
|
1370
|
+
Generate/update the theme with DS token references:
|
|
1371
|
+
|
|
1372
|
+
```typescript
|
|
1373
|
+
import { createTheme } from '@mui/material/styles';
|
|
1374
|
+
|
|
1375
|
+
const theme = createTheme({
|
|
1376
|
+
// cssVariables: true, — recommended for MUI v6+ (enables native CSS variable support)
|
|
1377
|
+
palette: {
|
|
1378
|
+
mode: 'dark',
|
|
1379
|
+
primary: {
|
|
1380
|
+
main: 'var(--action-brand-default)', // #00D4FF
|
|
1381
|
+
dark: 'var(--action-brand-active)', // #007D99
|
|
1382
|
+
contrastText: 'var(--content-inverse)', // #1A1A1A
|
|
1383
|
+
},
|
|
1384
|
+
secondary: {
|
|
1385
|
+
main: 'var(--action-secondary-default)', // #4A4A4A
|
|
1386
|
+
dark: 'var(--action-secondary-active)', // #A4A4A4
|
|
1387
|
+
contrastText: 'var(--content-primary)', // #FFFFFF
|
|
1388
|
+
},
|
|
1389
|
+
error: {
|
|
1390
|
+
main: 'var(--content-error)', // #F34F45
|
|
1391
|
+
},
|
|
1392
|
+
warning: {
|
|
1393
|
+
main: 'var(--content-warning)', // #FFCC40
|
|
1394
|
+
},
|
|
1395
|
+
success: {
|
|
1396
|
+
main: 'var(--content-success)', // #4FE290
|
|
1397
|
+
},
|
|
1398
|
+
info: {
|
|
1399
|
+
main: 'var(--content-info)', // #CCFDFF
|
|
1400
|
+
},
|
|
1401
|
+
background: {
|
|
1402
|
+
default: 'var(--bg-primary)', // #0E0E0E
|
|
1403
|
+
paper: 'var(--bg-secondary)', // #141519
|
|
1404
|
+
},
|
|
1405
|
+
text: {
|
|
1406
|
+
primary: 'var(--content-primary)', // #FFFFFF
|
|
1407
|
+
secondary: 'var(--content-secondary)', // #E8E8E8
|
|
1408
|
+
disabled: 'var(--content-disabled)', // #4A4A4A
|
|
1409
|
+
},
|
|
1410
|
+
divider: 'var(--border-default)', // #4A4A4A
|
|
1411
|
+
action: {
|
|
1412
|
+
hover: 'var(--surface-hover, rgba(255,255,255,0.08))',
|
|
1413
|
+
selected: 'var(--surface-brand)',
|
|
1414
|
+
disabled: 'var(--content-disabled)',
|
|
1415
|
+
disabledBackground: 'var(--surface-disabled)',
|
|
1416
|
+
},
|
|
1417
|
+
},
|
|
1418
|
+
typography: {
|
|
1419
|
+
fontFamily: 'var(--font-secondary)', // Inter
|
|
1420
|
+
h1: { fontFamily: 'var(--font-primary)', fontSize: 80, fontWeight: 500, lineHeight: 1.1 },
|
|
1421
|
+
h2: { fontFamily: 'var(--font-primary)', fontSize: 56, fontWeight: 500, lineHeight: 1.1 },
|
|
1422
|
+
h3: { fontFamily: 'var(--font-primary)', fontSize: 46, fontWeight: 700, lineHeight: 1.15 },
|
|
1423
|
+
h4: { fontFamily: 'var(--font-primary)', fontSize: 38, fontWeight: 500, lineHeight: 1.15 },
|
|
1424
|
+
h5: { fontFamily: 'var(--font-primary)', fontSize: 32, fontWeight: 500, lineHeight: 1.2 },
|
|
1425
|
+
h6: { fontFamily: 'var(--font-primary)', fontSize: 26, fontWeight: 500, lineHeight: 1.2 },
|
|
1426
|
+
subtitle1: { fontFamily: 'var(--font-secondary)', fontSize: 22, fontWeight: 600, lineHeight: 1.3 },
|
|
1427
|
+
body1: { fontFamily: 'var(--font-secondary)', fontSize: 16, fontWeight: 400, lineHeight: 1.5 },
|
|
1428
|
+
body2: { fontFamily: 'var(--font-secondary)', fontSize: 14, fontWeight: 400, lineHeight: 1.5 },
|
|
1429
|
+
caption: { fontFamily: 'var(--font-secondary)', fontSize: 12, fontWeight: 400, lineHeight: 1.4 },
|
|
1430
|
+
overline: { fontFamily: 'var(--font-secondary)', fontSize: 10, fontWeight: 400, lineHeight: 1.4 },
|
|
1431
|
+
button: { fontFamily: 'var(--font-secondary)', fontWeight: 600, textTransform: 'none' as const },
|
|
1432
|
+
},
|
|
1433
|
+
shape: {
|
|
1434
|
+
borderRadius: 8, // --radius-md = 8px — MUI shape.borderRadius must be numeric
|
|
1435
|
+
},
|
|
1436
|
+
components: {
|
|
1437
|
+
// styleOverrides are generated in Sub-fase C
|
|
1438
|
+
},
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
export default theme;
|
|
1442
|
+
```
|
|
1443
|
+
|
|
1444
|
+
**MUI palette role → DS token mapping table:**
|
|
1445
|
+
|
|
1446
|
+
| MUI palette key | DS token | Hex reference |
|
|
1447
|
+
|---|---|---|
|
|
1448
|
+
| `palette.primary.main` | `var(--action-brand-default)` | #00D4FF |
|
|
1449
|
+
| `palette.primary.dark` | `var(--action-brand-active)` | #007D99 |
|
|
1450
|
+
| `palette.primary.contrastText` | `var(--content-inverse)` | #1A1A1A |
|
|
1451
|
+
| `palette.secondary.main` | `var(--action-secondary-default)` | #4A4A4A |
|
|
1452
|
+
| `palette.secondary.dark` | `var(--action-secondary-active)` | #A4A4A4 |
|
|
1453
|
+
| `palette.error.main` | `var(--content-error)` | #F34F45 |
|
|
1454
|
+
| `palette.warning.main` | `var(--content-warning)` | #FFCC40 |
|
|
1455
|
+
| `palette.success.main` | `var(--content-success)` | #4FE290 |
|
|
1456
|
+
| `palette.info.main` | `var(--content-info)` | #CCFDFF |
|
|
1457
|
+
| `palette.background.default` | `var(--bg-primary)` | #0E0E0E |
|
|
1458
|
+
| `palette.background.paper` | `var(--bg-secondary)` | #141519 |
|
|
1459
|
+
| `palette.text.primary` | `var(--content-primary)` | #FFFFFF |
|
|
1460
|
+
| `palette.text.secondary` | `var(--content-secondary)` | #E8E8E8 |
|
|
1461
|
+
| `palette.text.disabled` | `var(--content-disabled)` | #4A4A4A |
|
|
1462
|
+
| `palette.divider` | `var(--border-default)` | #4A4A4A |
|
|
1463
|
+
|
|
1464
|
+
**MUI typography variant → DS token mapping table:**
|
|
1465
|
+
|
|
1466
|
+
| MUI variant | DS equivalent | Font family token |
|
|
1467
|
+
|---|---|---|
|
|
1468
|
+
| `h1` | `.trdr-h1` | `var(--font-primary)` — 80px/500 |
|
|
1469
|
+
| `h2` | `.trdr-h2` | `var(--font-primary)` — 56px/500 |
|
|
1470
|
+
| `h3` | `.trdr-h3` | `var(--font-primary)` — 46px/700 |
|
|
1471
|
+
| `h4` | `.trdr-h4` | `var(--font-primary)` — 38px/500 |
|
|
1472
|
+
| `h5` | `.trdr-h5` | `var(--font-primary)` — 32px/500 |
|
|
1473
|
+
| `h6` | `.trdr-h6` | `var(--font-primary)` — 26px/500 |
|
|
1474
|
+
| `subtitle1` | `.trdr-h7` | `var(--font-secondary)` — 22px/600 |
|
|
1475
|
+
| `body1` | `.trdr-body-b2` | `var(--font-secondary)` — 16px/500 |
|
|
1476
|
+
| `body2` | `.trdr-body-b3` | `var(--font-secondary)` — 14px/400 |
|
|
1477
|
+
| `caption` | `.trdr-body-b4` | `var(--font-secondary)` — 12px/500 |
|
|
1478
|
+
| `overline` | `.trdr-body-b5` | `var(--font-secondary)` — 10px/400 |
|
|
1479
|
+
| `button` | `.trdr-label-l3` | `var(--font-secondary)` — 14px/600 |
|
|
1480
|
+
|
|
1481
|
+
**MUI shape/radius → DS token mapping table:**
|
|
1482
|
+
|
|
1483
|
+
| Value (px) | DS token (for CSS) | MUI shape (numeric) |
|
|
1484
|
+
|---|---|---|
|
|
1485
|
+
| `0` | `var(--radius-none)` | `0` |
|
|
1486
|
+
| `2` | `var(--radius-xs)` | `2` |
|
|
1487
|
+
| `4` | `var(--radius-sm)` | `4` |
|
|
1488
|
+
| `8` | `var(--radius-md)` | `8` |
|
|
1489
|
+
| `12` | — (no DS token) | `12` |
|
|
1490
|
+
| `16` | `var(--radius-lg)` | `16` |
|
|
1491
|
+
| `20` | `var(--radius-xl)` | `20` |
|
|
1492
|
+
| `9999` | `var(--radius-full)` | `9999` |
|
|
1493
|
+
|
|
1494
|
+
**Important MUI + CSS var() caveat:**
|
|
1495
|
+
MUI accepts string values for palette colors. `'var(--token)'` works for rendering in MUI v5+. However, MUI internally uses `palette.primary.main` for color calculations (alpha, lighten, darken). When `main` is a `var()` string, those calculations produce invalid CSS.
|
|
1496
|
+
|
|
1497
|
+
**Solution by MUI version:**
|
|
1498
|
+
- **MUI v6+**: Add `cssVariables: true` to `createTheme()` — MUI handles CSS variables natively, calculations work
|
|
1499
|
+
- **MUI v5 / v7 without cssVariables mode**: Provide `main`, `light`, `dark`, and `contrastText` ALL explicitly using DS tokens. Do NOT rely on MUI's auto-generated `light`/`dark` variants. Document this caveat in `CLAUDE.md` and `DS_MIGRATION.md`.
|
|
1500
|
+
|
|
1501
|
+
**Step 5c — Update DS_PROGRESS.md:**
|
|
1502
|
+
```
|
|
1503
|
+
- [x] MUI theme — [themeFilePath] (palette, typography, shape with DS tokens)
|
|
1171
1504
|
```
|
|
1172
1505
|
|
|
1173
1506
|
Update `DS_PROGRESS.md`: set `Sub-fase A: Foundation — ✅ COMPLETE`.
|
|
1174
1507
|
|
|
1175
1508
|
Output:
|
|
1176
1509
|
```
|
|
1510
|
+
[If stylingMode === 'mui':]
|
|
1511
|
+
✅ Sub-fase A completa — tokens.css, components.css, CLAUDE.md, @import e MUI theme criados/atualizados.
|
|
1512
|
+
|
|
1513
|
+
[else:]
|
|
1177
1514
|
✅ Sub-fase A completa — tokens.css, components.css, CLAUDE.md e @import criados.
|
|
1178
1515
|
|
|
1179
1516
|
Próximo: Sub-fase B — Violations ([total_files_with_violations] arquivos em [N] lotes de até [batch_size] cada)
|
|
1180
1517
|
Responda:
|
|
1181
1518
|
- "continuar" / "continue" — iniciar Sub-fase B
|
|
1182
1519
|
- "parar" / "stop" — salvar progresso e parar aqui
|
|
1520
|
+
- "não funcionou" / "report" — reportar problema ao maintainer
|
|
1183
1521
|
```
|
|
1184
1522
|
|
|
1185
1523
|
**STOP HERE. Wait for developer reply before starting Sub-fase B.**
|
|
1524
|
+
If the developer indicates the implementation didn't work (see DEVELOPER DISSATISFACTION DETECTION below), trigger REPORT MODE.
|
|
1186
1525
|
|
|
1187
1526
|
---
|
|
1188
1527
|
|
|
@@ -1202,10 +1541,16 @@ For each batch listed as PENDING in `DS_PROGRESS.md` § Sub-fase B:
|
|
|
1202
1541
|
2. For each file in the batch:
|
|
1203
1542
|
- Apply all applicable violation fixes (see mapping tables below)
|
|
1204
1543
|
- Count violations fixed
|
|
1205
|
-
3. Update `DS_PROGRESS.md` — change batch status to `COMPLETED
|
|
1544
|
+
3. Update `DS_PROGRESS.md` — change batch status to `COMPLETED` with per-file detail:
|
|
1206
1545
|
```
|
|
1207
1546
|
### Lote [N] — [folder/] ([N] arquivos) — COMPLETED
|
|
1547
|
+
Completed: [ISO datetime]
|
|
1208
1548
|
Violações corrigidas: [N] | Arquivos: [N]/[N]
|
|
1549
|
+
|
|
1550
|
+
| Arquivo | Violações | Categorias | Tokens aplicados |
|
|
1551
|
+
|---------|-----------|------------|------------------|
|
|
1552
|
+
| src/components/Header.tsx | 5 | A(3), C(2) | --content-brand, --spacing-md, --bg-primary |
|
|
1553
|
+
| src/components/Card.css | 3 | A(1), B(2) | --surface-secondary, --font-primary, --font-secondary |
|
|
1209
1554
|
```
|
|
1210
1555
|
Add any unfixable patterns to the "Padrões Sem Token" section of `DS_PROGRESS.md`.
|
|
1211
1556
|
4. Output batch summary:
|
|
@@ -1223,12 +1568,14 @@ For each batch listed as PENDING in `DS_PROGRESS.md` § Sub-fase B:
|
|
|
1223
1568
|
- "pular [pasta]" — skip this folder and go to the next batch
|
|
1224
1569
|
- "parar" / "stop" — save progress and stop here (resume later with `/trdr-ds resume`)
|
|
1225
1570
|
- "tudo" / "all" — process all remaining batches without pausing
|
|
1571
|
+
- "não funcionou" / "report" — reportar problema ao maintainer
|
|
1226
1572
|
```
|
|
1227
1573
|
**Wait for developer reply.**
|
|
1228
1574
|
|
|
1229
1575
|
If reply is `"tudo"` / `"all"`: process all remaining batches without pausing (update DS_PROGRESS.md after each).
|
|
1230
1576
|
If reply is `"pular [pasta]"`: mark that batch as SKIPPED in DS_PROGRESS.md and move to the next.
|
|
1231
1577
|
If reply is `"parar"`: set `Status: PAUSED` in DS_PROGRESS.md. STOP. Do not proceed to Step 6 or 7.
|
|
1578
|
+
If the developer indicates the implementation didn't work (see DEVELOPER DISSATISFACTION DETECTION below), trigger REPORT MODE.
|
|
1232
1579
|
|
|
1233
1580
|
6. After ALL batches are COMPLETED (or skipped):
|
|
1234
1581
|
|
|
@@ -1242,9 +1589,11 @@ For each batch listed as PENDING in `DS_PROGRESS.md` § Sub-fase B:
|
|
|
1242
1589
|
Responda:
|
|
1243
1590
|
- "continuar" / "continue" — iniciar Sub-fase C
|
|
1244
1591
|
- "parar" / "stop" — salvar progresso e parar aqui
|
|
1592
|
+
- "não funcionou" / "report" — reportar problema ao maintainer
|
|
1245
1593
|
```
|
|
1246
1594
|
|
|
1247
1595
|
**STOP HERE. Wait for developer reply before starting Sub-fase C.**
|
|
1596
|
+
If the developer indicates the implementation didn't work (see DEVELOPER DISSATISFACTION DETECTION below), trigger REPORT MODE.
|
|
1248
1597
|
|
|
1249
1598
|
---
|
|
1250
1599
|
|
|
@@ -1298,6 +1647,32 @@ For each batch listed as PENDING in `DS_PROGRESS.md` § Sub-fase B:
|
|
|
1298
1647
|
- Example: `margin: 12px 0 8px` → `margin: var(--spacing-md) 0 var(--spacing-sm)`
|
|
1299
1648
|
- If one value has no token: replace only the mappable ones; keep the others as-is and flag
|
|
1300
1649
|
|
|
1650
|
+
**MUI sx spacing shorthand mapping** (only when `stylingMode === 'mui'`):
|
|
1651
|
+
|
|
1652
|
+
When fixing violations in MUI `sx` props, MUI uses a numeric spacing multiplier (default 8px base). Use this mapping:
|
|
1653
|
+
|
|
1654
|
+
| sx prop | MUI value | Pixels | DS token (for string replacement) |
|
|
1655
|
+
|---|---|---|---|
|
|
1656
|
+
| `p`, `m`, `gap`, etc. | `0.5` | 4px | `'var(--spacing-xs)'` |
|
|
1657
|
+
| `p`, `m`, `gap`, etc. | `1` | 8px | `'var(--spacing-sm)'` |
|
|
1658
|
+
| `p`, `m`, `gap`, etc. | `1.5` | 12px | `'var(--spacing-md)'` |
|
|
1659
|
+
| `p`, `m`, `gap`, etc. | `2` | 16px | `'var(--spacing-lg)'` |
|
|
1660
|
+
| `p`, `m`, `gap`, etc. | `2.5` | 20px | `'var(--spacing-xl)'` |
|
|
1661
|
+
| `p`, `m`, `gap`, etc. | `3` | 24px | `'var(--spacing-2xl)'` |
|
|
1662
|
+
| `p`, `m`, `gap`, etc. | `4` | 32px | `'var(--spacing-3xl)'` |
|
|
1663
|
+
|
|
1664
|
+
Prefer keeping MUI numeric scale when the project consistently uses it (`p: 2`, `m: 1`). Only use `'var(--spacing-*)'` string replacement when the sx value uses hardcoded px string (e.g., `padding: '16px'` instead of `p: 2`).
|
|
1665
|
+
|
|
1666
|
+
**MUI-specific violation processing** (only when `stylingMode === 'mui'`):
|
|
1667
|
+
|
|
1668
|
+
In addition to standard A-K violations in CSS/JSX files, process these MUI-specific violations during batch processing:
|
|
1669
|
+
|
|
1670
|
+
- **Category L** (theme file): Read the theme file. For each hardcoded `#hex`, font-family, fontSize, or borderRadius value, look up in the mapping tables and replace with `'var(--token)'`. If no DS token match exists, flag in DS_MIGRATION.md.
|
|
1671
|
+
- **Category M** (sx props): For each file with `sx={{}}` containing hardcoded values, replace colors with `'var(--token)'`, spacing with token or MUI scale, fonts with `'var(--font-*)'`, radius with `'var(--radius-*)'`.
|
|
1672
|
+
- **Category N** (styled() calls): For each `styled(MuiComponent)()` call with hardcoded values, replace with `'var(--token)'` in the style object.
|
|
1673
|
+
|
|
1674
|
+
Theme files (Category L) should be processed in the FIRST violation batch, before component files, so that theme-level tokens are in place before scanning individual components.
|
|
1675
|
+
|
|
1301
1676
|
**Ambiguous colors:** Use property context to decide — `background-color` → bg/surface token, `color` → content token, `border-color` → border token, `accent-color` → action token.
|
|
1302
1677
|
|
|
1303
1678
|
**Tailwind arbitrary value colors** (only when `stylingMode: tailwind`):
|
|
@@ -1442,6 +1817,292 @@ When a CSS class has a `font-size` that maps to a DS text style, the fix is **tw
|
|
|
1442
1817
|
|
|
1443
1818
|
Update `DS_PROGRESS.md`: set `Sub-fase C: Components — IN_PROGRESS`.
|
|
1444
1819
|
|
|
1820
|
+
**If `stylingMode === 'mui'`: skip directly to Step 6-MUI below.** MUI projects do NOT use Pass 1/2/3 (HTML tag replacement). All visual changes come from MUI theme styleOverrides + sx prop migration.
|
|
1821
|
+
|
|
1822
|
+
### Step 6-MUI — Generate MUI component styleOverrides (only when `stylingMode === 'mui'`)
|
|
1823
|
+
|
|
1824
|
+
#### Step 6-MUI.0 — DS slug to MUI component mapping
|
|
1825
|
+
|
|
1826
|
+
| DS Component (slug) | MUI Component | Theme key |
|
|
1827
|
+
|---|---|---|
|
|
1828
|
+
| `button` | Button, IconButton, LoadingButton | `MuiButton`, `MuiIconButton`, `MuiLoadingButton` |
|
|
1829
|
+
| `text-input` | TextField, OutlinedInput, FilledInput | `MuiTextField`, `MuiOutlinedInput` |
|
|
1830
|
+
| `checkbox` | Checkbox | `MuiCheckbox` |
|
|
1831
|
+
| `radio-button` | Radio | `MuiRadio` |
|
|
1832
|
+
| `switch` | Switch | `MuiSwitch` |
|
|
1833
|
+
| `dropdown` | Select, Autocomplete | `MuiSelect`, `MuiAutocomplete` |
|
|
1834
|
+
| `tooltip` | Tooltip | `MuiTooltip` |
|
|
1835
|
+
| `abas` | Tabs, Tab | `MuiTabs`, `MuiTab` |
|
|
1836
|
+
| `card` | Card, CardContent, CardActions | `MuiCard`, `MuiCardContent` |
|
|
1837
|
+
| `badge` | Badge, Chip | `MuiBadge`, `MuiChip` |
|
|
1838
|
+
| `header` | AppBar, Toolbar | `MuiAppBar`, `MuiToolbar` |
|
|
1839
|
+
| `modal` | Dialog, DialogTitle, DialogContent | `MuiDialog`, `MuiDialogTitle`, `MuiDialogContent` |
|
|
1840
|
+
|
|
1841
|
+
#### Step 6-MUI.1 — Generate styleOverrides block
|
|
1842
|
+
|
|
1843
|
+
For each MUI component detected in `replacementCandidates[]`:
|
|
1844
|
+
|
|
1845
|
+
1. Read the corresponding DS component from `data/components.json` — look up by slug.
|
|
1846
|
+
2. Extract the visual properties (colors, spacing, typography, border-radius) from its `code.css` block.
|
|
1847
|
+
3. Translate each CSS property into a MUI `styleOverrides` entry using DS tokens.
|
|
1848
|
+
|
|
1849
|
+
**Reference template for common MUI components:**
|
|
1850
|
+
|
|
1851
|
+
```typescript
|
|
1852
|
+
components: {
|
|
1853
|
+
MuiButton: {
|
|
1854
|
+
styleOverrides: {
|
|
1855
|
+
root: {
|
|
1856
|
+
fontFamily: 'var(--font-secondary)',
|
|
1857
|
+
fontWeight: 600,
|
|
1858
|
+
textTransform: 'none' as const,
|
|
1859
|
+
borderRadius: 'var(--radius-sm)',
|
|
1860
|
+
transition: 'all 0.15s ease',
|
|
1861
|
+
'&:focus-visible': {
|
|
1862
|
+
outline: '2px solid var(--border-focus)',
|
|
1863
|
+
outlineOffset: '2px',
|
|
1864
|
+
},
|
|
1865
|
+
},
|
|
1866
|
+
containedPrimary: {
|
|
1867
|
+
backgroundColor: 'var(--action-brand-inverse-default)',
|
|
1868
|
+
color: 'var(--content-primary)',
|
|
1869
|
+
'&:hover': { backgroundColor: 'var(--action-brand-inverse-hover)' },
|
|
1870
|
+
'&:active': { backgroundColor: 'var(--action-brand-inverse-active)' },
|
|
1871
|
+
'&.Mui-disabled': {
|
|
1872
|
+
backgroundColor: 'var(--action-brand-inverse-disabled)',
|
|
1873
|
+
color: 'var(--content-disabled)',
|
|
1874
|
+
},
|
|
1875
|
+
},
|
|
1876
|
+
outlinedPrimary: {
|
|
1877
|
+
borderColor: 'var(--action-brand-default)',
|
|
1878
|
+
color: 'var(--action-brand-default)',
|
|
1879
|
+
'&:hover': {
|
|
1880
|
+
borderColor: 'var(--action-brand-hover)',
|
|
1881
|
+
backgroundColor: 'var(--action-brand-alpha)',
|
|
1882
|
+
},
|
|
1883
|
+
},
|
|
1884
|
+
textPrimary: {
|
|
1885
|
+
color: 'var(--action-brand-default)',
|
|
1886
|
+
'&:hover': { backgroundColor: 'var(--action-brand-alpha)' },
|
|
1887
|
+
},
|
|
1888
|
+
},
|
|
1889
|
+
},
|
|
1890
|
+
MuiTextField: {
|
|
1891
|
+
styleOverrides: {
|
|
1892
|
+
root: {
|
|
1893
|
+
'& .MuiOutlinedInput-root': {
|
|
1894
|
+
fontFamily: 'var(--font-secondary)',
|
|
1895
|
+
fontSize: 14,
|
|
1896
|
+
color: 'var(--content-primary)',
|
|
1897
|
+
'& fieldset': { borderColor: 'var(--border-default)' },
|
|
1898
|
+
'&:hover fieldset': { borderColor: 'var(--border-strong)' },
|
|
1899
|
+
'&.Mui-focused fieldset': { borderColor: 'var(--border-focus)' },
|
|
1900
|
+
'&.Mui-error fieldset': { borderColor: 'var(--content-error)' },
|
|
1901
|
+
},
|
|
1902
|
+
'& .MuiInputLabel-root': {
|
|
1903
|
+
color: 'var(--content-tertiary)',
|
|
1904
|
+
fontFamily: 'var(--font-secondary)',
|
|
1905
|
+
'&.Mui-focused': { color: 'var(--content-brand)' },
|
|
1906
|
+
},
|
|
1907
|
+
},
|
|
1908
|
+
},
|
|
1909
|
+
},
|
|
1910
|
+
MuiCard: {
|
|
1911
|
+
styleOverrides: {
|
|
1912
|
+
root: {
|
|
1913
|
+
backgroundColor: 'var(--bg-secondary)',
|
|
1914
|
+
borderRadius: 'var(--radius-md)',
|
|
1915
|
+
border: '1px solid var(--border-subtle)',
|
|
1916
|
+
},
|
|
1917
|
+
},
|
|
1918
|
+
},
|
|
1919
|
+
MuiTooltip: {
|
|
1920
|
+
styleOverrides: {
|
|
1921
|
+
tooltip: {
|
|
1922
|
+
backgroundColor: 'var(--bg-inverse)',
|
|
1923
|
+
color: 'var(--content-inverse)',
|
|
1924
|
+
fontFamily: 'var(--font-secondary)',
|
|
1925
|
+
fontSize: 12,
|
|
1926
|
+
borderRadius: 'var(--radius-sm)',
|
|
1927
|
+
},
|
|
1928
|
+
arrow: { color: 'var(--bg-inverse)' },
|
|
1929
|
+
},
|
|
1930
|
+
},
|
|
1931
|
+
MuiSwitch: {
|
|
1932
|
+
styleOverrides: {
|
|
1933
|
+
root: { width: 44, height: 24, padding: 0 },
|
|
1934
|
+
switchBase: {
|
|
1935
|
+
padding: 4,
|
|
1936
|
+
'&.Mui-checked': {
|
|
1937
|
+
color: 'var(--content-primary)',
|
|
1938
|
+
'& + .MuiSwitch-track': {
|
|
1939
|
+
backgroundColor: 'var(--action-brand-default)',
|
|
1940
|
+
opacity: 1,
|
|
1941
|
+
},
|
|
1942
|
+
},
|
|
1943
|
+
},
|
|
1944
|
+
track: {
|
|
1945
|
+
borderRadius: 'var(--radius-full)',
|
|
1946
|
+
backgroundColor: 'var(--surface-primary)',
|
|
1947
|
+
opacity: 1,
|
|
1948
|
+
},
|
|
1949
|
+
thumb: { width: 16, height: 16 },
|
|
1950
|
+
},
|
|
1951
|
+
},
|
|
1952
|
+
MuiCheckbox: {
|
|
1953
|
+
styleOverrides: {
|
|
1954
|
+
root: {
|
|
1955
|
+
color: 'var(--border-default)',
|
|
1956
|
+
'&.Mui-checked': { color: 'var(--action-brand-default)' },
|
|
1957
|
+
'&.Mui-disabled': { color: 'var(--content-disabled)' },
|
|
1958
|
+
},
|
|
1959
|
+
},
|
|
1960
|
+
},
|
|
1961
|
+
MuiRadio: {
|
|
1962
|
+
styleOverrides: {
|
|
1963
|
+
root: {
|
|
1964
|
+
color: 'var(--border-default)',
|
|
1965
|
+
'&.Mui-checked': { color: 'var(--action-brand-default)' },
|
|
1966
|
+
},
|
|
1967
|
+
},
|
|
1968
|
+
},
|
|
1969
|
+
MuiTabs: {
|
|
1970
|
+
styleOverrides: {
|
|
1971
|
+
indicator: { backgroundColor: 'var(--action-brand-default)' },
|
|
1972
|
+
},
|
|
1973
|
+
},
|
|
1974
|
+
MuiTab: {
|
|
1975
|
+
styleOverrides: {
|
|
1976
|
+
root: {
|
|
1977
|
+
fontFamily: 'var(--font-secondary)',
|
|
1978
|
+
fontWeight: 600,
|
|
1979
|
+
textTransform: 'none',
|
|
1980
|
+
color: 'var(--content-tertiary)',
|
|
1981
|
+
'&.Mui-selected': { color: 'var(--content-brand)' },
|
|
1982
|
+
},
|
|
1983
|
+
},
|
|
1984
|
+
},
|
|
1985
|
+
MuiChip: {
|
|
1986
|
+
styleOverrides: {
|
|
1987
|
+
root: {
|
|
1988
|
+
fontFamily: 'var(--font-secondary)',
|
|
1989
|
+
borderRadius: 'var(--radius-sm)',
|
|
1990
|
+
},
|
|
1991
|
+
colorPrimary: {
|
|
1992
|
+
backgroundColor: 'var(--surface-brand)',
|
|
1993
|
+
color: 'var(--content-brand)',
|
|
1994
|
+
},
|
|
1995
|
+
colorSuccess: {
|
|
1996
|
+
backgroundColor: 'var(--surface-success)',
|
|
1997
|
+
color: 'var(--content-success)',
|
|
1998
|
+
},
|
|
1999
|
+
colorWarning: {
|
|
2000
|
+
backgroundColor: 'var(--surface-warning)',
|
|
2001
|
+
color: 'var(--content-warning)',
|
|
2002
|
+
},
|
|
2003
|
+
colorError: {
|
|
2004
|
+
backgroundColor: 'var(--surface-error)',
|
|
2005
|
+
color: 'var(--content-error)',
|
|
2006
|
+
},
|
|
2007
|
+
},
|
|
2008
|
+
},
|
|
2009
|
+
MuiDialog: {
|
|
2010
|
+
styleOverrides: {
|
|
2011
|
+
paper: {
|
|
2012
|
+
backgroundColor: 'var(--bg-secondary)',
|
|
2013
|
+
borderRadius: 'var(--radius-md)',
|
|
2014
|
+
border: '1px solid var(--border-subtle)',
|
|
2015
|
+
},
|
|
2016
|
+
},
|
|
2017
|
+
},
|
|
2018
|
+
MuiAppBar: {
|
|
2019
|
+
styleOverrides: {
|
|
2020
|
+
root: {
|
|
2021
|
+
backgroundColor: 'var(--bg-secondary)',
|
|
2022
|
+
borderBottom: '1px solid var(--border-subtle)',
|
|
2023
|
+
boxShadow: 'none',
|
|
2024
|
+
},
|
|
2025
|
+
},
|
|
2026
|
+
},
|
|
2027
|
+
MuiSelect: {
|
|
2028
|
+
styleOverrides: {
|
|
2029
|
+
root: {
|
|
2030
|
+
fontFamily: 'var(--font-secondary)',
|
|
2031
|
+
fontSize: 14,
|
|
2032
|
+
},
|
|
2033
|
+
},
|
|
2034
|
+
},
|
|
2035
|
+
},
|
|
2036
|
+
```
|
|
2037
|
+
|
|
2038
|
+
**IMPORTANT:** This template is a REFERENCE. For each project:
|
|
2039
|
+
1. Only include `MuiXxx` entries for components actually detected in `replacementCandidates[]`
|
|
2040
|
+
2. Read the DS component's `code.css` for accurate token values — the template above covers the most common tokens, but individual components may have specific values
|
|
2041
|
+
3. If the DS component has variants (e.g., button primary/secondary/ghost), map each to the appropriate MUI variant prop or className
|
|
2042
|
+
|
|
2043
|
+
#### Step 6-MUI.2 — Insert styleOverrides into theme file
|
|
2044
|
+
|
|
2045
|
+
Read the existing theme file (`themeFilePath`). Find the `components: {}` block (or create it if absent). Merge the generated styleOverrides:
|
|
2046
|
+
|
|
2047
|
+
- If a `MuiXxx` key already exists in the theme: **MERGE** the DS overrides into the existing overrides, preserving any project-specific customizations that do not conflict with DS tokens
|
|
2048
|
+
- If a `MuiXxx` key does NOT exist: ADD the DS override block
|
|
2049
|
+
- **NEVER** overwrite project-specific `defaultProps`, `variants`, or slot customizations
|
|
2050
|
+
|
|
2051
|
+
#### Step 6-MUI.3 — Process individual sx prop violations
|
|
2052
|
+
|
|
2053
|
+
For components with `sx-migration` classification in `replacementCandidates[]`:
|
|
2054
|
+
|
|
2055
|
+
1. Read each sx prop with hardcoded values
|
|
2056
|
+
2. Replace with token references:
|
|
2057
|
+
```tsx
|
|
2058
|
+
// Before
|
|
2059
|
+
<Box sx={{ backgroundColor: '#141519', padding: '16px', borderRadius: '8px' }}>
|
|
2060
|
+
// After
|
|
2061
|
+
<Box sx={{ backgroundColor: 'var(--bg-secondary)', padding: 'var(--spacing-lg)', borderRadius: 'var(--radius-md)' }}>
|
|
2062
|
+
```
|
|
2063
|
+
3. If the sx prop becomes empty after migration (all values now come from theme), consider removing it
|
|
2064
|
+
4. Preserve all layout-related sx values (display, flex, grid, position) as-is
|
|
2065
|
+
|
|
2066
|
+
#### Step 6-MUI.4 — Process styled(MuiComponent) violations
|
|
2067
|
+
|
|
2068
|
+
For components with `styled-migration` classification:
|
|
2069
|
+
|
|
2070
|
+
1. Replace hardcoded values inside `styled()` calls with `'var(--token)'`
|
|
2071
|
+
2. Preserve all theme-based logic (`theme.breakpoints`, `theme.palette.*` references, `theme.spacing()`)
|
|
2072
|
+
3. If the styled() call uses `({ theme }) =>` destructuring: theme references will now pull from the updated theme with DS tokens — this is correct and expected
|
|
2073
|
+
|
|
2074
|
+
#### Step 6-MUI.5 — Skip HTML tag replacement
|
|
2075
|
+
|
|
2076
|
+
Do NOT run Pass 1/2/3 (HTML tag replacement) for MUI projects. Jump directly to updating DS_PROGRESS.md after completing Steps 6-MUI.1 through 6-MUI.4.
|
|
2077
|
+
|
|
2078
|
+
Document in `DS_PROGRESS.md` each styleOverride generated and each sx prop migrated:
|
|
2079
|
+
```
|
|
2080
|
+
## Sub-fase C: Components — ✅ COMPLETE
|
|
2081
|
+
- [x] MuiButton — styleOverrides (containedPrimary, outlinedPrimary, textPrimary)
|
|
2082
|
+
- [x] MuiTextField — styleOverrides (root, label, fieldset states)
|
|
2083
|
+
- [x] MuiCard — styleOverrides (root)
|
|
2084
|
+
- [x] sx migrations: [N] files, [M] values replaced
|
|
2085
|
+
- [x] styled() migrations: [N] files
|
|
2086
|
+
```
|
|
2087
|
+
|
|
2088
|
+
Output:
|
|
2089
|
+
```
|
|
2090
|
+
✅ Sub-fase C completa — [N] MUI component styleOverrides gerados, [M] sx props migrados.
|
|
2091
|
+
|
|
2092
|
+
Próximo: Sub-fase D — Final (logos, ícones, DS_MIGRATION.md)
|
|
2093
|
+
Responda:
|
|
2094
|
+
- "continuar" / "continue" — iniciar Sub-fase D
|
|
2095
|
+
- "parar" / "stop" — salvar progresso e parar aqui
|
|
2096
|
+
- "não funcionou" / "report" — reportar problema ao maintainer
|
|
2097
|
+
```
|
|
2098
|
+
|
|
2099
|
+
**STOP HERE. Wait for developer reply before starting Sub-fase D.**
|
|
2100
|
+
If the developer indicates the implementation didn't work (see DEVELOPER DISSATISFACTION DETECTION below), trigger REPORT MODE.
|
|
2101
|
+
|
|
2102
|
+
---
|
|
2103
|
+
|
|
2104
|
+
**For non-MUI projects (`stylingMode !== 'mui'`), continue with the standard Step 6 below:**
|
|
2105
|
+
|
|
1445
2106
|
### Step 6 — Implement DS components in project files
|
|
1446
2107
|
|
|
1447
2108
|
#### Step 6.0 — Resolve dependency order
|
|
@@ -1746,9 +2407,11 @@ Próximo: Sub-fase D — Final (logos + ícones + DS_MIGRATION.md)
|
|
|
1746
2407
|
Responda:
|
|
1747
2408
|
- "continuar" / "continue" — finalizar migração
|
|
1748
2409
|
- "parar" / "stop" — salvar progresso e parar aqui
|
|
2410
|
+
- "não funcionou" / "report" — reportar problema ao maintainer
|
|
1749
2411
|
```
|
|
1750
2412
|
|
|
1751
2413
|
**STOP HERE. Wait for developer reply before starting Sub-fase D.**
|
|
2414
|
+
If the developer indicates the implementation didn't work (see DEVELOPER DISSATISFACTION DETECTION below), trigger REPORT MODE.
|
|
1752
2415
|
|
|
1753
2416
|
---
|
|
1754
2417
|
|
|
@@ -2082,6 +2745,52 @@ Group new classes in a clearly labelled block at the bottom of the project's CSS
|
|
|
2082
2745
|
/* ... */
|
|
2083
2746
|
```
|
|
2084
2747
|
|
|
2748
|
+
**MUI sx prop migration (only when `stylingMode === 'mui'`):**
|
|
2749
|
+
|
|
2750
|
+
MUI's `sx` prop is the idiomatic way to style MUI components. Unlike inline `style={{}}`, `sx` props should NOT be eliminated — they should be migrated to use DS tokens.
|
|
2751
|
+
|
|
2752
|
+
**Decision tree for MUI `sx` props:**
|
|
2753
|
+
|
|
2754
|
+
1. **Value already uses theme reference** (`theme.palette.primary.main`, `theme.spacing(2)`) → keep as-is (theme was updated with DS tokens in Sub-fase A)
|
|
2755
|
+
|
|
2756
|
+
2. **Hardcoded color** → replace with token:
|
|
2757
|
+
```tsx
|
|
2758
|
+
// Before
|
|
2759
|
+
sx={{ color: '#00A8CC' }}
|
|
2760
|
+
// After
|
|
2761
|
+
sx={{ color: 'var(--content-brand)' }}
|
|
2762
|
+
```
|
|
2763
|
+
|
|
2764
|
+
3. **Hardcoded spacing with string px** → replace with token:
|
|
2765
|
+
```tsx
|
|
2766
|
+
// Before
|
|
2767
|
+
sx={{ padding: '16px', gap: '8px' }}
|
|
2768
|
+
// After
|
|
2769
|
+
sx={{ padding: 'var(--spacing-lg)', gap: 'var(--spacing-sm)' }}
|
|
2770
|
+
```
|
|
2771
|
+
|
|
2772
|
+
4. **Hardcoded fontFamily** → remove (theme typography handles this globally)
|
|
2773
|
+
|
|
2774
|
+
5. **Hardcoded borderRadius** → replace with token:
|
|
2775
|
+
```tsx
|
|
2776
|
+
// Before
|
|
2777
|
+
sx={{ borderRadius: '12px' }}
|
|
2778
|
+
// After
|
|
2779
|
+
sx={{ borderRadius: 'var(--radius-md)' }}
|
|
2780
|
+
```
|
|
2781
|
+
|
|
2782
|
+
6. **Conditional sx values** → replace both branches:
|
|
2783
|
+
```tsx
|
|
2784
|
+
// Before
|
|
2785
|
+
sx={{ color: isActive ? '#00D4FF' : '#A4A4A4' }}
|
|
2786
|
+
// After
|
|
2787
|
+
sx={{ color: isActive ? 'var(--content-brand)' : 'var(--content-tertiary)' }}
|
|
2788
|
+
```
|
|
2789
|
+
|
|
2790
|
+
7. **Layout-only sx** (display, flex, grid, position, width, height) → keep as-is (not DS concern)
|
|
2791
|
+
|
|
2792
|
+
Do NOT convert `sx` props to CSS classes — `sx` is idiomatic MUI and is acceptable when using DS tokens.
|
|
2793
|
+
|
|
2085
2794
|
---
|
|
2086
2795
|
|
|
2087
2796
|
### Step 7 — Generate DS_MIGRATION.md
|
|
@@ -2118,6 +2827,13 @@ Hub: https://trdr.mrocontent.com.br
|
|
|
2118
2827
|
- [ ] **Stubs**: Review MISSING_COMPONENTS.md and decide whether to wait for canonical implementation in the Hub or hand-roll using the listed tokens
|
|
2119
2828
|
- [ ] **Skipped files**: [list any files excluded from migration]
|
|
2120
2829
|
|
|
2830
|
+
[If `stylingMode === 'mui'`, add these additional manual steps:]
|
|
2831
|
+
- [ ] **MUI CSS Variables mode**: If MUI version >= 6, add `cssVariables: true` to `createTheme()` for native CSS variable support. Without it, MUI's internal color calculations (alpha, lighten, darken) may produce invalid CSS when palette values are `var()` strings.
|
|
2832
|
+
- [ ] **MUI palette auto-generation**: Verify that `primary.light`, `primary.dark`, and `primary.contrastText` are all explicitly set with DS tokens. MUI auto-generates these from `main`, which fails when `main` is a `var()` string.
|
|
2833
|
+
- [ ] **MUI theme composition**: If the project composes themes across multiple files (`createTheme()` + `deepmerge`), verify that DS token references are preserved in the final merged theme.
|
|
2834
|
+
- [ ] **MUI component slots**: Complex MUI components (DataGrid, DatePicker, Autocomplete) have many internal slots not covered by the standard styleOverrides. Review these manually if used in the project.
|
|
2835
|
+
- [ ] **sx props audit**: Run a quick grep for `sx=\{\{.*#[0-9A-Fa-f]` to verify no hardcoded hex values remain in sx props.
|
|
2836
|
+
|
|
2121
2837
|
## Missing DS tokens (flagged — no semantic token available)
|
|
2122
2838
|
| Pattern | File | Suggestion |
|
|
2123
2839
|
|---------|------|-----------|
|
|
@@ -2170,6 +2886,7 @@ Hub: https://trdr.mrocontent.com.br
|
|
|
2170
2886
|
→ Stubs not yet canonical: see MISSING_COMPONENTS.md
|
|
2171
2887
|
→ Backup branch: `trdr-ds/backup-{timestamp}` — para desfazer: `/trdr-ds rollback`
|
|
2172
2888
|
→ Para remover o backup após validar: `git branch -D trdr-ds/backup-{timestamp}`
|
|
2889
|
+
→ Algo deu errado? `/trdr-ds report` para enviar um bug report ao maintainer
|
|
2173
2890
|
```
|
|
2174
2891
|
|
|
2175
2892
|
---
|
|
@@ -2325,6 +3042,275 @@ If either fetch fails, report which one and exit. Do NOT touch the snapshot if t
|
|
|
2325
3042
|
|
|
2326
3043
|
---
|
|
2327
3044
|
|
|
3045
|
+
## REPORT MODE (when invoked as `/trdr-ds report` or triggered automatically)
|
|
3046
|
+
|
|
3047
|
+
This mode generates a structured bug report and sends it to the skill maintainer via email.
|
|
3048
|
+
|
|
3049
|
+
**Maintainer email:** `mrocontent@gmail.com`
|
|
3050
|
+
|
|
3051
|
+
### When it triggers automatically
|
|
3052
|
+
|
|
3053
|
+
After each sub-phase (A, B, C, D) completes — or fails to complete — evaluate these conditions:
|
|
3054
|
+
|
|
3055
|
+
| Condition | Severity | Auto-report? |
|
|
3056
|
+
|-----------|----------|--------------|
|
|
3057
|
+
| Sub-phase crashed or could not complete (e.g., missing files, parse errors, Hub unreachable after local snapshot also missing) | CRITICAL | ✅ Yes |
|
|
3058
|
+
| Build fails after sub-phase changes (if detectable via `npm run build` or framework equivalent) | CRITICAL | ✅ Yes |
|
|
3059
|
+
| More than 30% of violations in a batch could not be mapped to any DS token (flagged as "no match") | HIGH | ✅ Yes |
|
|
3060
|
+
| Component replacement produced malformed JSX/HTML (unclosed tags, syntax errors caught by grep) | CRITICAL | ✅ Yes |
|
|
3061
|
+
| Rollback was invoked (indicates the migration went wrong enough to revert) | HIGH | ✅ Yes |
|
|
3062
|
+
|
|
3063
|
+
When auto-report triggers, inform the developer:
|
|
3064
|
+
```
|
|
3065
|
+
⚠️ A skill detectou problemas críticos nesta migração.
|
|
3066
|
+
Um bug report será gerado e enviado ao maintainer (mrocontent@gmail.com).
|
|
3067
|
+
|
|
3068
|
+
Deseja incluir observações adicionais no report?
|
|
3069
|
+
- Escreva seu comentário e pressione Enter
|
|
3070
|
+
- "pular" / "skip" — enviar sem comentários extras
|
|
3071
|
+
```
|
|
3072
|
+
**Wait for reply.** Save the developer's comment (if any) as `developerNotes` for inclusion in the report.
|
|
3073
|
+
|
|
3074
|
+
### Manual invocation (`/trdr-ds report`)
|
|
3075
|
+
|
|
3076
|
+
When invoked manually, the developer may optionally describe the problem:
|
|
3077
|
+
- `/trdr-ds report` — generates report from current state
|
|
3078
|
+
- `/trdr-ds report Violações não foram aplicadas nos arquivos .vue` — includes the description
|
|
3079
|
+
|
|
3080
|
+
Ask the developer:
|
|
3081
|
+
```
|
|
3082
|
+
📝 Bug report — descreva o problema que encontrou com a skill:
|
|
3083
|
+
(Se já descreveu no comando, pressione Enter para confirmar)
|
|
3084
|
+
```
|
|
3085
|
+
**Wait for reply.** Save as `developerNotes`.
|
|
3086
|
+
|
|
3087
|
+
### Step R1 — Collect project context
|
|
3088
|
+
|
|
3089
|
+
Gather the following data silently (no output to the developer):
|
|
3090
|
+
|
|
3091
|
+
1. **Project info:**
|
|
3092
|
+
- `package.json` → name, framework, framework version, stylingMode detected
|
|
3093
|
+
- Node.js version: `node --version`
|
|
3094
|
+
- OS: read from environment (platform)
|
|
3095
|
+
- Skill version: read from top of this file
|
|
3096
|
+
|
|
3097
|
+
2. **Migration state:**
|
|
3098
|
+
- Read `DS_ANALYSIS.md` (if exists) — extract: total violations, categories breakdown, total files
|
|
3099
|
+
- Read `DS_PROGRESS.md` (if exists) — extract: current status, which sub-phases completed, which pending, and the full `## Execution Log` section (per-file audit trail with timestamps)
|
|
3100
|
+
- Read `SPRINT_PLAN.md` (if exists) — extract: sprint progress
|
|
3101
|
+
- Read `DS_MIGRATION.md` (if exists) — extract: manual items count
|
|
3102
|
+
|
|
3103
|
+
3. **Error context:**
|
|
3104
|
+
- If auto-triggered: capture the specific error/condition that triggered the report
|
|
3105
|
+
- If manual: use `developerNotes`
|
|
3106
|
+
- Last 3 files modified by the skill (from `DS_PROGRESS.md` batch logs)
|
|
3107
|
+
- If build failed: capture the first 50 lines of build error output
|
|
3108
|
+
|
|
3109
|
+
4. **Snapshot versions:**
|
|
3110
|
+
- `data/components.json` → `generatedAt` and count of implemented components
|
|
3111
|
+
- `references/tokens.css` → count of CSS variables (grep `--` in `:root`)
|
|
3112
|
+
|
|
3113
|
+
### Step R2 — Generate DS_BUG_REPORT.md
|
|
3114
|
+
|
|
3115
|
+
Write `DS_BUG_REPORT.md` at the project root:
|
|
3116
|
+
|
|
3117
|
+
```markdown
|
|
3118
|
+
# TRDR DS — Bug Report
|
|
3119
|
+
|
|
3120
|
+
**Date:** [ISO datetime]
|
|
3121
|
+
**Skill version:** [version from SKILL.md]
|
|
3122
|
+
**Report type:** [AUTOMATIC | MANUAL]
|
|
3123
|
+
**Severity:** [CRITICAL | HIGH | MEDIUM]
|
|
3124
|
+
|
|
3125
|
+
---
|
|
3126
|
+
|
|
3127
|
+
## Problem Description
|
|
3128
|
+
|
|
3129
|
+
[developerNotes — or auto-trigger condition description]
|
|
3130
|
+
|
|
3131
|
+
## Project Context
|
|
3132
|
+
|
|
3133
|
+
| Field | Value |
|
|
3134
|
+
|-------|-------|
|
|
3135
|
+
| Project | [package.json name] |
|
|
3136
|
+
| Framework | [framework] [version] |
|
|
3137
|
+
| Styling mode | [stylingMode] |
|
|
3138
|
+
| Node.js | [version] |
|
|
3139
|
+
| OS | [platform] |
|
|
3140
|
+
|
|
3141
|
+
## Migration State
|
|
3142
|
+
|
|
3143
|
+
| Sub-phase | Status |
|
|
3144
|
+
|-----------|--------|
|
|
3145
|
+
| Analysis | [✅ COMPLETE / ⏳ PENDING / ❌ FAILED] |
|
|
3146
|
+
| A — Foundation | [status] |
|
|
3147
|
+
| B — Violations | [status — N/M batches done] |
|
|
3148
|
+
| C — Components | [status — N/M candidates done] |
|
|
3149
|
+
| D — Final | [status] |
|
|
3150
|
+
|
|
3151
|
+
**Overall status:** [from DS_PROGRESS.md]
|
|
3152
|
+
**Backup branch:** [branch name or N/A]
|
|
3153
|
+
|
|
3154
|
+
## Violation Summary
|
|
3155
|
+
|
|
3156
|
+
| Category | Found | Fixed | Unfixable |
|
|
3157
|
+
|----------|-------|-------|-----------|
|
|
3158
|
+
| A — Hardcoded colors | [n] | [n] | [n] |
|
|
3159
|
+
| B — Hardcoded fonts | [n] | [n] | [n] |
|
|
3160
|
+
| C — Hardcoded spacing | [n] | [n] | [n] |
|
|
3161
|
+
| ... | ... | ... | ... |
|
|
3162
|
+
|
|
3163
|
+
## Error Details
|
|
3164
|
+
|
|
3165
|
+
[If build failed: first 50 lines of error output]
|
|
3166
|
+
[If unmapped violations: list of values that had no token match]
|
|
3167
|
+
[If component replacement failed: file path + what went wrong]
|
|
3168
|
+
|
|
3169
|
+
## Files Affected
|
|
3170
|
+
|
|
3171
|
+
[List of last files modified by the skill, from DS_PROGRESS.md]
|
|
3172
|
+
|
|
3173
|
+
## Snapshot Info
|
|
3174
|
+
|
|
3175
|
+
- Components catalog: [generatedAt] — [N] implemented / [M] total
|
|
3176
|
+
- Tokens CSS: [N] variables
|
|
3177
|
+
|
|
3178
|
+
## Execution Log
|
|
3179
|
+
|
|
3180
|
+
[Copy the entire `## Execution Log` section from DS_PROGRESS.md here — this is the full audit trail of every file the skill created, modified, skipped, or failed on, with timestamps]
|
|
3181
|
+
|
|
3182
|
+
| Timestamp | Phase | Action | File | Details |
|
|
3183
|
+
|-----------|-------|--------|------|---------|
|
|
3184
|
+
| ... | ... | ... | ... | ... |
|
|
3185
|
+
|
|
3186
|
+
## Developer Notes
|
|
3187
|
+
|
|
3188
|
+
> [Raw text from the developer, if provided]
|
|
3189
|
+
```
|
|
3190
|
+
|
|
3191
|
+
### Step R3 — Send via email (Resend API)
|
|
3192
|
+
|
|
3193
|
+
Execute via Bash:
|
|
3194
|
+
|
|
3195
|
+
```bash
|
|
3196
|
+
node -e "
|
|
3197
|
+
const https = require('https');
|
|
3198
|
+
|
|
3199
|
+
const report = require('fs').readFileSync('DS_BUG_REPORT.md', 'utf8');
|
|
3200
|
+
const projectName = '[project-name-from-package.json]';
|
|
3201
|
+
const severity = '[CRITICAL|HIGH|MEDIUM]';
|
|
3202
|
+
const skillVersion = '[version]';
|
|
3203
|
+
|
|
3204
|
+
const data = JSON.stringify({
|
|
3205
|
+
from: 'TRDR DS Skill <onboarding@resend.dev>',
|
|
3206
|
+
to: ['mrocontent@gmail.com'],
|
|
3207
|
+
subject: '[TRDR DS ' + severity + '] Bug report — ' + projectName + ' (v' + skillVersion + ')',
|
|
3208
|
+
text: report
|
|
3209
|
+
});
|
|
3210
|
+
|
|
3211
|
+
const req = https.request({
|
|
3212
|
+
hostname: 'api.resend.com',
|
|
3213
|
+
path: '/emails',
|
|
3214
|
+
method: 'POST',
|
|
3215
|
+
headers: {
|
|
3216
|
+
'Authorization': 'Bearer ' + process.env.RESEND_API_KEY,
|
|
3217
|
+
'Content-Type': 'application/json',
|
|
3218
|
+
'Content-Length': Buffer.byteLength(data)
|
|
3219
|
+
}
|
|
3220
|
+
}, (res) => {
|
|
3221
|
+
let body = '';
|
|
3222
|
+
res.on('data', c => body += c);
|
|
3223
|
+
res.on('end', () => {
|
|
3224
|
+
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
3225
|
+
console.log('OK: ' + body);
|
|
3226
|
+
} else {
|
|
3227
|
+
console.log('FAIL (' + res.statusCode + '): ' + body);
|
|
3228
|
+
}
|
|
3229
|
+
});
|
|
3230
|
+
});
|
|
3231
|
+
req.write(data);
|
|
3232
|
+
req.end();
|
|
3233
|
+
"
|
|
3234
|
+
```
|
|
3235
|
+
|
|
3236
|
+
**If `RESEND_API_KEY` is not set in the environment:**
|
|
3237
|
+
```
|
|
3238
|
+
⚠️ RESEND_API_KEY não encontrada no ambiente.
|
|
3239
|
+
O report foi salvo em DS_BUG_REPORT.md mas não pôde ser enviado por email.
|
|
3240
|
+
|
|
3241
|
+
Para configurar:
|
|
3242
|
+
1. Obtenha sua API key em https://resend.com/api-keys
|
|
3243
|
+
2. Adicione ao ambiente: export RESEND_API_KEY="re_xxxxxxxx"
|
|
3244
|
+
3. Ou adicione no .env do projeto e execute novamente /trdr-ds report
|
|
3245
|
+
```
|
|
3246
|
+
|
|
3247
|
+
**If the email send fails (non-2xx response):**
|
|
3248
|
+
```
|
|
3249
|
+
⚠️ Falha ao enviar email (HTTP [status]): [response body]
|
|
3250
|
+
O report foi salvo localmente em DS_BUG_REPORT.md.
|
|
3251
|
+
Envie manualmente para mrocontent@gmail.com.
|
|
3252
|
+
```
|
|
3253
|
+
|
|
3254
|
+
### Step R4 — Output to developer
|
|
3255
|
+
|
|
3256
|
+
```
|
|
3257
|
+
[If email sent successfully:]
|
|
3258
|
+
✅ Bug report gerado e enviado.
|
|
3259
|
+
|
|
3260
|
+
📄 DS_BUG_REPORT.md (salvo no projeto)
|
|
3261
|
+
📧 Email enviado para mrocontent@gmail.com
|
|
3262
|
+
🏷️ Severidade: [CRITICAL|HIGH|MEDIUM]
|
|
3263
|
+
|
|
3264
|
+
O maintainer será notificado e entrará em contato.
|
|
3265
|
+
|
|
3266
|
+
[If email failed:]
|
|
3267
|
+
📄 Bug report salvo em DS_BUG_REPORT.md
|
|
3268
|
+
⚠️ Email não enviado — veja instruções acima.
|
|
3269
|
+
|
|
3270
|
+
[In both cases:]
|
|
3271
|
+
→ Para continuar a migração: /trdr-ds resume
|
|
3272
|
+
→ Para reverter: /trdr-ds rollback
|
|
3273
|
+
```
|
|
3274
|
+
|
|
3275
|
+
### DEVELOPER DISSATISFACTION DETECTION
|
|
3276
|
+
|
|
3277
|
+
At every STOP checkpoint and at any point during the conversation, if the developer expresses that the implementation didn't work correctly, trigger REPORT MODE automatically. Match any of these patterns (case-insensitive, partial match):
|
|
3278
|
+
|
|
3279
|
+
| Pattern (PT) | Pattern (EN) |
|
|
3280
|
+
|--------------|--------------|
|
|
3281
|
+
| "não funcionou" | "didn't work" |
|
|
3282
|
+
| "não deu certo" | "it's broken" |
|
|
3283
|
+
| "deu errado" | "went wrong" |
|
|
3284
|
+
| "ficou errado" | "messed up" |
|
|
3285
|
+
| "quebrou" | "broke" |
|
|
3286
|
+
| "não aplicou" | "didn't apply" |
|
|
3287
|
+
| "não tá certo" | "not right" |
|
|
3288
|
+
| "tá errado" | "it's wrong" |
|
|
3289
|
+
| "report" | "bug report" |
|
|
3290
|
+
|
|
3291
|
+
When detected:
|
|
3292
|
+
1. Acknowledge the developer's feedback
|
|
3293
|
+
2. Execute REPORT MODE (Steps R1–R4) with `reportType: MANUAL` and `severity: HIGH`
|
|
3294
|
+
3. Use the developer's message as `developerNotes` — ask for additional details if the message is too vague (less than 10 characters)
|
|
3295
|
+
4. After sending the report, offer the developer options to continue:
|
|
3296
|
+
```
|
|
3297
|
+
Responda:
|
|
3298
|
+
- "rollback" — reverter todas as mudanças
|
|
3299
|
+
- "continuar" — tentar prosseguir mesmo assim
|
|
3300
|
+
- "parar" — salvar progresso e parar aqui
|
|
3301
|
+
```
|
|
3302
|
+
|
|
3303
|
+
### Auto-report integration points
|
|
3304
|
+
|
|
3305
|
+
When auto-report is triggered during a sub-phase, execute Steps R1–R4 **after** saving progress to `DS_PROGRESS.md` but **before** the STOP checkpoint. The sub-phase continues normally after the report — the developer can still choose to continue, stop, or rollback.
|
|
3306
|
+
|
|
3307
|
+
Add to `DS_PROGRESS.md` when a report is sent:
|
|
3308
|
+
```
|
|
3309
|
+
Bug report: DS_BUG_REPORT.md (sent [ISO datetime] — [AUTOMATIC|MANUAL] — [severity])
|
|
3310
|
+
```
|
|
3311
|
+
|
|
3312
|
+
---
|
|
3313
|
+
|
|
2328
3314
|
## LIVE HUB REFERENCE (canonical fallback)
|
|
2329
3315
|
|
|
2330
3316
|
When the developer asks about a component, token, or rule that is not in the local snapshot, fetch from the Hub:
|