@atomazing-org/design-system 2.0.1 → 3.7.2

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 (28) hide show
  1. package/AGENTS.md +92 -0
  2. package/README.MD +263 -335
  3. package/dist/index.d.ts +11 -15
  4. package/dist/index.js +22 -22
  5. package/dist/presets/index.d.ts +15 -2
  6. package/dist/presets/index.js +315 -313
  7. package/dist/themePresets-CwgG5XEL.d.ts +65 -0
  8. package/dist/themePresets-CwgG5XEL.js +1 -0
  9. package/migrations/README.UPDATE.md +34 -20
  10. package/migrations/docs/migrations/design-system/README.md +48 -17
  11. package/migrations/docs/migrations/design-system/routes/adopt-existing/AEROCRM-EXAMPLE.md +197 -0
  12. package/migrations/docs/migrations/design-system/routes/adopt-existing/RUNBOOK.md +185 -25
  13. package/migrations/docs/migrations/design-system/routes/adopt-existing/migration.spec.json +84 -20
  14. package/migrations/docs/migrations/design-system/routes/greenfield/RUNBOOK.md +57 -25
  15. package/migrations/docs/migrations/design-system/routes/greenfield/migration.spec.json +37 -14
  16. package/migrations/docs/migrations/design-system/routes/mui4-to-latest/RUNBOOK.md +136 -77
  17. package/migrations/docs/migrations/design-system/routes/mui4-to-latest/migration.spec.json +104 -29
  18. package/migrations/docs/migrations/design-system/shared/WORKING-RULES.md +194 -0
  19. package/migrations/docs/migrations/design-system/shared/acceptance.md +76 -20
  20. package/migrations/docs/migrations/design-system/shared/common-regressions.md +218 -0
  21. package/migrations/docs/migrations/design-system/shared/gates.md +39 -3
  22. package/migrations/docs/migrations/design-system/shared/manual-qa-matrix.md +70 -0
  23. package/migrations/docs/migrations/design-system/shared/phase-exit-criteria.md +129 -0
  24. package/migrations/docs/migrations/design-system/shared/phases.md +377 -0
  25. package/migrations/skills/design-system-consumer-agent/SKILL.md +84 -0
  26. package/migrations/skills/design-system-migration-agent/SKILL.md +75 -9
  27. package/package.json +14 -4
  28. package/dist/typography-B-BeIk0v.d.ts +0 -120
@@ -1,34 +1,194 @@
1
- # Маршрут: Рефакторинг на актуальном MUI + применение дизайн-системы (adopt-existing)
1
+ # Route: adopt-existing
2
2
 
3
- ## Когда использовать
3
+ Use this route when the target app already runs on modern MUI and needs to adopt
4
+ or normalize `@atomazing-org/design-system` without a legacy Material UI v4 jump.
4
5
 
5
- - Проект уже использует `@mui/material` (v5/v6/v7).
6
- - Нужна унификация темы/типографики/палитры через `@atomazing-org/design-system`.
7
- - Основная работа — убрать хардкоды токенов и перейти на `theme.*`.
6
+ ## Use This Route When
8
7
 
9
- ## Результат
8
+ - the project already depends on `@mui/material`
9
+ - the project already has a theme setup, token layer, or design-system usage to normalize
10
+ - the migration is about aligning an existing app, not bootstrapping a new one
10
11
 
11
- - `ThemeProviderWrapper` — единственный источник настроек темы.
12
- - Токены из проекта либо удалены, либо превращены в thin-adapter вокруг `theme`.
12
+ ## Target Outcome
13
13
 
14
- ## Шаги
14
+ - `ThemeProviderWrapper` is the only app-level source of truth for theme state
15
+ - old design-system integration points are removed or normalized
16
+ - token usage moves toward `theme.*`
17
+ - the app boots cleanly after migration, not just compiles
15
18
 
16
- 1) Preflight: тесты и сборка зелёные.
17
- 2) Установить `@atomazing-org/design-system` и peer deps (если не установлены).
18
- 3) Подключить `ThemeProviderWrapper` на корне приложения.
19
- 4) Сделать инвентаризацию токенов:
20
- - где лежат цвета/типографика/spacing/радиусы;
21
- - какие алиасы используются чаще всего.
22
- 5) Заполнить mapping (CSV/JSON) и применить безопасные замены.
23
- 6) Прогнать gates + тесты + сборку.
19
+ Use `../../shared/phases.md` as the canonical step-by-step phase checklist, then
20
+ apply the route-specific requirements below.
24
21
 
25
- ## Стратегия переносов (рекомендуется)
22
+ ## Large-Project Execution Model
26
23
 
27
- - Сначала цвета поверхностей и текстов (фон/текст/бордер/brand).
28
- - Затем типографика (перевод на variants или `theme.typography`).
29
- - Затем компонентные размеры/spacing.
30
- ## Shared gates (repo)
24
+ - keep the app runnable at the end of every phase
25
+ - keep one main change class per phase:
26
+ - dependency alignment
27
+ - root theme unification
28
+ - runtime cleanup
29
+ - shared infrastructure
30
+ - token and wrapper cleanup
31
+ - domain waves
32
+ - final gate pass
33
+ - do not mix shell rewrites, broad token cleanup, and bundler hygiene changes into one unvalidated batch
34
+ - checkpoint each phase with a commit or equivalent rollback point before continuing
31
35
 
32
- Use common gate definitions from:
33
- - `../../shared/gates.md`
34
- - `../../shared/acceptance.md`
36
+ ## Required Workflow (Phases)
37
+
38
+ 1. Inventory and segmentation
39
+ - map current design-system usage, theme entrypoints, local token modules, shared shell code, shared overlays, and protected routes
40
+ - split the repo into shared-infrastructure scope plus domain migration waves
41
+ 2. Baseline and safety net
42
+ - run the normal validation commands that exist in the repo
43
+ - record pre-existing red checks separately from migration defects
44
+ - add or tighten smoke coverage for:
45
+ - the application shell
46
+ - at least one protected content route when route guards exist
47
+ - at least one stable overlay interaction when overlays are in scope
48
+ 3. Update dependencies
49
+ - add or upgrade `@atomazing-org/design-system`
50
+ - ensure peer runtimes are compatible
51
+ - align adjacent runtime packages before moving deeper into UI cleanup
52
+ 4. Align provider wiring and public API usage
53
+ - connect `ThemeProviderWrapper` at the app root
54
+ - remove competing root theme providers unless they are thin wrappers around the design system
55
+ - replace removed or old root imports
56
+ - stop deep-importing design-system internals
57
+ - remove parallel theme state when it conflicts with design-system state
58
+ - move preset selection into one explicit app-level theme module instead of leaving it split across generic constants passthrough files
59
+ 5. Runtime boot cleanup
60
+ - start the app with the repo's normal dev/start command
61
+ - open the first route in a real browser
62
+ - fix startup console errors before continuing
63
+ - fix migration-caused startup warnings before continuing
64
+ - specifically resolve duplicated runtime singleton warnings for `react`, `react-dom`, `@emotion/react`, and `@emotion/styled`
65
+ - remove module-scope code that depends on browser APIs, storage, or i18n locale activation
66
+ - move browser event listeners such as `beforeinstallprompt` or `matchMedia` subscriptions into effects with cleanup
67
+ - if smoke or test mode disables auth redirect, seed a deterministic user with enough roles to exercise protected routes
68
+ 6. Shared infrastructure stabilization
69
+ - verify the structural app shell still matches the pre-migration layout on desktop and mobile
70
+ - verify the app background still comes from the selected preset and is not replaced by a hardcoded app-shell or page-wrapper background
71
+ - if a layout container is simplified or rewritten, explicitly preserve its `display`, column or row template, `min-width`, `min-height`, `overflow`, and scroll behavior
72
+ - if shared containers combine `width: 100%` with internal padding, normalize them with explicit `box-sizing: border-box` or remove the forced width so the content pane does not overflow horizontally
73
+ - if shell workspaces, route wrappers, or page roots were touched, verify the main content still fills the available content region instead of collapsing into partial-width cards or broken dashboard stacks
74
+ - audit compact shared UI such as chart legends, chips, segmented filters, and metric badges for preset drift; if they now read as ad hoc chip chrome, rebuild them with neutral MUI composition
75
+ - if analytics dashboards or metric cards were touched, keep label and value typography clearly separated and make sure dashboard cards do not inherit accidental full-width spans or inconsistent gap rhythms on desktop
76
+ - restore shared overlays with stable dialog semantics:
77
+ - dialogs, drawers, and bottom sheets should wire `aria-labelledby` and `aria-describedby`
78
+ - close buttons should keep explicit accessible labels
79
+ - decorative overlay handles should stay hidden from assistive tech
80
+ - if an overlay owns keyboard-filtered search results, expose `combobox` and `listbox` semantics instead of generic wrapper markup
81
+ - inspect shared UI primitives for placeholder regressions:
82
+ - empty `Box` or `Stack` shells where charts or progress bars used to render
83
+ - pass-through wrappers that dropped padding, borders, hover states, or sizing
84
+ - simplified nav, dialog, drawer, and card components that no longer preserve spacing or alignment
85
+ - root shells or route wrappers that set `background` or `backgroundColor` and hide the preset background
86
+ 7. Token, typography, and wrapper cleanup
87
+ - replace legacy token files and hardcoded theme values with `theme.palette`, `theme.typography`, and design-system contracts
88
+ - normalize visible text so headings, body copy, helper text, and compact labels use explicit `Typography` variants instead of raw JSX text
89
+ - wrap raw text inside `Button`, `ToggleButton`, `MenuItem`, `Chip`, and `Alert` with `Typography component="span"`
90
+ - add explicit `variant` to every `Typography` and choose variants semantically instead of relying on defaults
91
+ - replace consumer-owned substitute primitives with MUI equivalents when the code only reimplements a stock MUI control such as `IconButton`, `FormLabel`, `FormHelperText`, or `Skeleton`
92
+ - remove zero-value wrappers that only rename stock MUI primitives or surfaces without adding meaningful behavior
93
+ - remove zero-value surface wrappers that only forward to MUI `Card`, `Paper`, or similar components without adding real behavior
94
+ - replace palette alpha suffix hacks with theme helpers such as `alpha()`
95
+ - if consumer surfaces use app-owned gradient washes, decorative shadows, or other preset-competing chrome, simplify them back to standard MUI surfaces unless the component is an intentional preset-preview exception
96
+ - if raw visual token drift is broad, add or tighten a repo-local design-contract lint or script gate and keep it green
97
+ - if the repo has no typography contract check and text regressions are widespread, add a small lint or script gate so future migrations cannot reintroduce raw text or variantless typography
98
+ - if the repo keeps a design-contract lint, expand it to catch decorative gradients, direct shadow styling, palette alpha suffix hacks, and any file-local allowlist drift
99
+ - if codemods, bulk replacements, or file rewrites touched localized copy, keep files in UTF-8, scan for mojibake or replacement characters, and verify at least one real localized route renders readable text
100
+ 8. Shared workflow extraction and bundler hygiene
101
+ - if multiple pages share the same workflow shell, extract a shared layout contract and keep role-specific differences in header or section composition
102
+ - if local barrels introduce circular chunk warnings for app internals, replace those imports with direct local module imports
103
+ - if Workbox or PWA config references assets that the app does not actually emit, align the glob patterns with the real static files instead of leaving the warning in place
104
+ - if Vite reports oversized local chunks, add targeted `manualChunks` or lazy boundaries before considering any warning-limit change
105
+ 9. Domain waves
106
+ - migrate feature areas after shared infrastructure is stable
107
+ - keep each wave small enough to validate independently
108
+ - re-run the relevant smoke and route checks after each wave before moving on
109
+ 10. Re-run the shared gates and route checks
110
+ - lint, tests, and build where available
111
+ - browser startup verification
112
+ - verify smoke checks cover page content on protected routes, not only the surrounding shell
113
+ - verify smoke coverage still includes stable entrypoints for shell-critical overlays such as notifications or command palette when overlay infrastructure changed
114
+
115
+ ## Common Failure Modes
116
+
117
+ - removed or no-longer-public root imports still referenced from app code
118
+ - module-scope i18n translation calls before locale activation
119
+ - module-scope `window`, `document`, `navigator`, or storage access
120
+ - duplicate Emotion or React runtime copies in Vite, Next.js, or module federation setups
121
+ - preset selection hidden behind generic constants passthrough layers instead of one explicit app theme module
122
+ - structural layout containers replaced with plain wrappers that drop grid or flex behavior
123
+ - lost `min-width`, `min-height`, or `overflow` constraints that previously kept sidebar and content regions stable
124
+ - shared padded containers keep `width: 100%` under content-box sizing, so the workspace silently protrudes past the visible right edge
125
+ - route roots or page containers lose fill behavior, so the workspace shows partial-width cards, collapsed analytics grids, or unused content area
126
+ - analytics metric labels and values collapse to the same text scale, so dashboard numbers no longer stand out from titles or helper text
127
+ - dashboard cards keep an old `gridColumn: 1 / -1` or mixed gap contract, so one analytics panel falls onto its own row while neighboring cards use a different rhythm
128
+ - protected routes only tested in guest mode, so smoke checks exercise `NotFound` instead of real product screens
129
+ - shared charts, cards, drawers, or segmented controls reduced to pass-through wrappers or empty placeholder nodes
130
+ - compact legends, analytics chips, metric badges, or segmented filters drift into consumer-owned chip chrome that visibly fights the preset
131
+ - root app containers hardcode their own page background and visually cancel the active preset background
132
+ - dialogs, drawers, or bottom sheets lose semantic labeling during wrapper refactors
133
+ - browser event listeners attach from render flow and duplicate behavior across rerenders
134
+ - search overlays filter results visually but expose no combobox or listbox semantics
135
+ - raw JSX text left inside app layout wrappers, buttons, chips, or menu items after refactors
136
+ - `Typography` used without an explicit semantic `variant`, which makes text hierarchy drift across screens
137
+ - zero-value wrapper components preserved even though they only rename stock MUI controls
138
+ - zero-value surface wrappers preserved even though direct MUI `Card` or `Paper` usage would be clearer
139
+ - app-owned gradient or shadow chrome left on consumer surfaces after the design system already defines surface character
140
+ - palette alpha suffix hacks such as `${theme.palette.primary.main}1a` left in shared styling instead of `alpha()`
141
+ - codemods or encoding fixes leave mojibake, replacement characters, or broken non-Latin text in screens, fixtures, or mock data
142
+ - repeated workflow pages keep copied layout shells instead of sharing one structural contract
143
+ - local barrel re-exports create circular chunk warnings for app internals during build
144
+ - stale Workbox or PWA asset globs point to files the app does not emit
145
+ - oversized local vendor or app chunks are left unresolved even though targeted chunk splitting is possible
146
+
147
+ ## Practical Fix Patterns
148
+
149
+ - import only from `@atomazing-org/design-system` or `@atomazing-org/design-system/presets`
150
+ - move browser-only or locale-dependent work out of module scope and into runtime-safe component or hook code
151
+ - if the bundler loads duplicate React or Emotion runtimes, add the repo's equivalent of runtime dedupe or singleton sharing
152
+ - move preset selection into a dedicated app theme module such as `src/theme/appThemes.ts`
153
+ - when refactoring shell components, treat layout wrappers as behavior, not decoration
154
+ - if a shell exposes a workspace pane, keep route roots and page containers on explicit flex growth with preserved `min-width`, `min-height`, and width constraints so the page actually fills the workspace
155
+ - if a shared card, page root, or shell content container must both fill width and keep internal padding, use `box-sizing: border-box` so the padding does not enlarge the rendered width past the workspace
156
+ - seed a deterministic smoke user when route guards would otherwise hide the real target screens
157
+ - search for placeholder regressions in shared UI and restore explicit visual contracts before closeout
158
+ - if compact legends, chips, or segmented filters drift away from the preset, rebuild them from `Stack`, markers, and `Typography` instead of preserving ad hoc chip styling
159
+ - if analytics metrics lose hierarchy, restore distinct label, value, and helper text scales with explicit typography tokens instead of leaving them on one visual level
160
+ - if dashboard cards should share one desktop row, remove accidental full-width spans and keep one explicit grid gap contract across all analytics panels
161
+ - if a consumer abstraction only restyles a stock MUI primitive, collapse it into a thin MUI wrapper instead of preserving a hand-built substitute
162
+ - delete zero-value wrapper components that only rename MUI primitives or surfaces
163
+ - delete zero-value surface wrappers that only forward to MUI `Card` or `Paper`
164
+ - replace palette suffix hacks with `alpha()` or equivalent theme helpers
165
+ - keep decorative gradients and shadow styling out of normal consumer surfaces; if a preview component is the exception, document it and allowlist it explicitly
166
+ - keep root shells transparent unless they are true surfaces, so the preset background remains visible
167
+ - wire overlay titles and descriptions through stable ids instead of relying on incidental text nodes inside dialogs or drawers
168
+ - use labeled close controls and proper `combobox` or `listbox` semantics for search overlays with keyboard navigation
169
+ - move browser event subscriptions into effects with cleanup before validating runtime behavior
170
+ - add a browser screenshot or visual smoke check for the desktop shell and at least one protected content route before closing the migration
171
+ - use stable overlay entrypoints for smoke checks instead of forcing flaky tests through incidental modal access paths
172
+ - add an overflow assertion for the desktop content pane and at least one routed page root when shell or page-level layout containers are touched
173
+ - add or keep a typography contract check so visible text and action labels cannot regress back to raw text nodes
174
+ - add or keep a design-contract check when raw colors, font sizes, radius values, or opacity drift is widespread
175
+ - after bulk replacements or encoding-sensitive edits, run a mojibake scan and verify one localized route in a real browser before closing the migration
176
+ - extract shared workflow page shells into one layout component and use direct local imports if barrels introduce chunk-cycle warnings
177
+ - update Workbox or PWA asset globs to match the actual emitted icon and manifest files
178
+ - use targeted vendor chunk groups or additional lazy boundaries to resolve consumer-owned chunk warnings instead of just raising the warning limit
179
+
180
+ ## Example
181
+
182
+ See `./AEROCRM-EXAMPLE.md` for a full `adopt-existing` migration that includes:
183
+
184
+ - upgrading an existing consumer from `@atomazing-org/design-system@1.2.9` to `2.0.1`
185
+ - replacing an outdated root import
186
+ - fixing a startup-breaking Lingui initialization bug
187
+ - fixing duplicate Emotion runtime loading in Vite
188
+ - restoring a broken desktop `sidebar + content` shell after a layout wrapper regression
189
+ - restoring page-root fill behavior after tickets and analytics screens stopped occupying the full workspace
190
+ - fixing shared workspace overflow caused by padded full-width containers under content-box sizing
191
+ - reworking analytics legend chips that drifted away from the preset into neutral preset-aligned legend composition
192
+ - restoring analytics metric hierarchy and removing an accidental full-width dashboard card span so desktop analytics panels align again
193
+ - restoring dialog, drawer, and command-palette semantics after overlay wrappers drifted
194
+ - repairing broken Cyrillic text and mock data after encoding drift introduced unreadable strings
@@ -1,53 +1,117 @@
1
1
  {
2
2
  "$schema": "../../schema/migration.spec.schema.json",
3
3
  "id": "adopt-existing",
4
- "title": "Adopt @atomazing-org/design-system in an existing MUI project",
4
+ "title": "Adopt @atomazing-org/design-system in an existing modern MUI project",
5
5
  "detect": {
6
6
  "packageJson": {
7
7
  "anyDependencies": ["@mui/material"]
8
8
  }
9
9
  },
10
- "entryConditions": ["проект уже на @mui/material"],
10
+ "entryConditions": [
11
+ "the project already uses @mui/material",
12
+ "the migration is normalizing an existing app instead of bootstrapping a new one"
13
+ ],
11
14
  "exitConditions": [
12
- "ThemeProviderWrapper подключён",
13
- "нет запрещённых токенов/импортов",
14
- "tests/build зелёные"
15
+ "ThemeProviderWrapper is connected at the app root",
16
+ "forbidden token imports and outdated design-system imports are removed",
17
+ "the app boots without browser console startup errors",
18
+ "migration-caused startup warnings are fixed",
19
+ "tests and build are green"
15
20
  ],
16
21
  "steps": [
17
22
  {
18
- "name": "Preflight",
19
- "run": ["npm ci", "npm test", "npm run build"]
23
+ "name": "Inventory and baseline",
24
+ "manualReview": [
25
+ "Map current design-system usage, theme entrypoints, local token modules, shared shell code, shared overlays, and protected routes.",
26
+ "Record pre-existing failing checks separately from migration defects.",
27
+ "Split the repo into shared-infrastructure scope and domain migration waves before broad edits begin.",
28
+ "Run the target repository baseline checks with its package manager (for example lint, tests, and build when available)."
29
+ ]
30
+ },
31
+ {
32
+ "name": "Add safety net",
33
+ "manualReview": [
34
+ "Add or tighten smoke coverage for the application shell before broad refactors.",
35
+ "If route guards exist, ensure at least one protected content route can be validated as a real screen.",
36
+ "If shared overlays will be touched, add at least one stable overlay interaction to smoke coverage."
37
+ ]
20
38
  },
21
39
  {
22
40
  "name": "Add design-system deps",
23
- "run": [
24
- "node migrations/scripts/migrations/design-system/actions/update-package-json.mjs --add @atomazing-org/design-system:<SET_VERSION>"
41
+ "manualReview": [
42
+ "Edit package.json directly and add or upgrade @atomazing-org/design-system to <SET_VERSION>.",
43
+ "Align peer runtime package versions as needed and keep the repository package manager conventions intact."
25
44
  ]
26
45
  },
27
46
  {
28
47
  "name": "Install deps",
29
- "run": ["npm install"]
48
+ "manualReview": [
49
+ "Install dependencies with the target repository package manager (npm, pnpm, yarn, or bun)."
50
+ ]
51
+ },
52
+ {
53
+ "name": "Root theme unification",
54
+ "manualReview": [
55
+ "Connect ThemeProviderWrapper at the application root.",
56
+ "Remove or collapse any competing root ThemeProvider so the design system becomes the single theme source of truth.",
57
+ "Replace outdated or removed design-system root imports with the correct public API or local app abstractions.",
58
+ "Move preset selection into one explicit app-level theme module instead of leaving it scattered across generic constants layers."
59
+ ]
30
60
  },
31
61
  {
32
- "name": "Manual integration",
62
+ "name": "Runtime boot cleanup",
33
63
  "manualReview": [
34
- "Подключите ThemeProviderWrapper в корне приложения.",
35
- "Удалите/упростите существующий ThemeProvider, чтобы не было конфликтов."
64
+ "Start the app with the repo's normal dev/start command and open the first route in a real browser.",
65
+ "Fix startup console errors before continuing.",
66
+ "Fix migration-caused startup warnings before continuing, especially duplicate runtime singleton warnings for react, react-dom, @emotion/react, and @emotion/styled.",
67
+ "Remove module-scope code that requires browser APIs, storage, or i18n locale activation.",
68
+ "Move browser event listeners into effects with cleanup instead of render paths or module scope.",
69
+ "If smoke mode disables auth redirect, seed a deterministic role-bearing user so protected routes can render real content."
36
70
  ]
37
71
  },
38
72
  {
39
- "name": "Token cleanup",
73
+ "name": "Shared infrastructure stabilization",
40
74
  "manualReview": [
41
- "Заполните migrations/scripts/migrations/design-system/shared/token-gate.config.json под ваш проект.",
42
- "Подготовьте CSV mapping и примените apply-replacements-from-csv.mjs."
75
+ "Stabilize the application shell, route wrappers, and shared layout containers before domain-by-domain work.",
76
+ "Restore dialog, drawer, bottom-sheet, and search-overlay semantics before broad feature cleanup.",
77
+ "Preserve display, grid or flex templates, min-width, min-height, overflow, and scroll behavior when refactoring shell containers.",
78
+ "If shell workspaces, route wrappers, or page roots were touched, verify the main content still fills the available content region and that dashboard or workflow grids did not collapse into partial-width stacks.",
79
+ "Audit compact shared UI such as chart legends, chips, segmented filters, and metric badges for preset drift; replace ad hoc chip-like chrome with neutral MUI composition when needed.",
80
+ "Search for placeholder regressions in shared UI and restore explicit visual contracts before closeout."
81
+ ]
82
+ },
83
+ {
84
+ "name": "Token and primitive cleanup",
85
+ "manualReview": [
86
+ "Prepare targeted replacements for legacy tokens and review the diff file by file.",
87
+ "Normalize visible text to Typography with explicit semantic variants.",
88
+ "Remove zero-value wrapper components and zero-value surface wrappers.",
89
+ "Replace palette alpha suffix hacks with alpha() and simplify decorative consumer surface chrome.",
90
+ "If bulk replacements or file rewrites touched localized copy, scan for mojibake or replacement characters and verify non-Latin UI text still renders readable strings."
91
+ ]
92
+ },
93
+ {
94
+ "name": "Shared workflow extraction and bundler hygiene",
95
+ "manualReview": [
96
+ "If multiple pages share the same workflow shell, extract one shared layout contract and keep role-specific behavior in headers and sections.",
97
+ "If local barrels introduce circular chunk warnings for app internals, switch to direct local imports for those modules.",
98
+ "Fix consumer-owned build warnings such as stale PWA asset globs or oversized local chunks through config and chunking changes, not warning suppression."
99
+ ]
100
+ },
101
+ {
102
+ "name": "Domain migration waves",
103
+ "manualReview": [
104
+ "Migrate feature areas in waves after shared infrastructure is stable.",
105
+ "Keep each wave small enough to validate independently.",
106
+ "Re-run the relevant smoke or route checks after each wave before moving to the next domain."
43
107
  ]
44
108
  },
45
109
  {
46
110
  "name": "Quality gates",
47
- "run": [
48
- "node migrations/scripts/migrations/design-system/gates/no-hardcoded-tokens.mjs --root src --config migrations/scripts/migrations/design-system/shared/token-gate.config.json",
49
- "npm test",
50
- "npm run build"
111
+ "manualReview": [
112
+ "Re-run the target repository closeout gates with its package manager: lint, tests, and build (when available).",
113
+ "Run repo-local token and design-contract checks when they exist (for example lint:design-contract).",
114
+ "Manually verify no forbidden hardcoded token modules or identifiers remain for the target app (for example with rg searches)."
51
115
  ]
52
116
  }
53
117
  ]
@@ -1,29 +1,61 @@
1
- # Маршрут: Установка с нуля (greenfield)
2
-
3
- ## Когда использовать
4
-
5
- - Новый проект.
6
- - Нет унаследованных token-файлов и старой темы.
7
-
8
- ## Результат
9
-
10
- - `ThemeProviderWrapper` подключён на корне.
11
- - (Опционально) настроены список динамических тем и UI-переключатели.
12
-
13
- ## Шаги
14
-
15
- 1) Установить зависимости.
16
- 2) Обернуть приложение в `ThemeProviderWrapper`.
17
- 3) (Опционально) передать список тем `themes` и/или `colorPaletteOverride`.
18
- 4) (Опционально) добавить UI для переключения темы и dark mode.
19
- 5) Прогнать тесты и сборку.
20
-
21
- ## SSR / Next.js
22
-
23
- Если проект на Next.js:
24
- - провайдер разместить в клиентской границе (`"use client"`).
25
- ## Shared gates (repo)
1
+ # Route: greenfield
2
+
3
+ Use this route when the target app is new and does not need a legacy theme or
4
+ token migration before adopting `@atomazing-org/design-system`.
5
+
6
+ ## Use This Route When
7
+
8
+ - the project is new or lightly scaffolded
9
+ - there is no inherited token layer to normalize
10
+ - there is no legacy MUI v4 migration path to perform first
11
+
12
+ ## Target Outcome
13
+
14
+ - `ThemeProviderWrapper` is connected at the app root
15
+ - preset choice lives in one explicit app-level theme module when the app exposes multiple presets
16
+ - theme switching, if added, uses `useThemeSettings()`
17
+ - the app boots cleanly with the new provider wiring
18
+
19
+ Use `../../shared/phases.md` as the canonical step-by-step phase checklist, then
20
+ apply the route-specific requirements below.
21
+
22
+ ## Required Workflow (Phases)
23
+
24
+ 1. Baseline the repo
25
+ - confirm the repo installs and the normal validation commands can run
26
+ - record any pre-existing setup failures separately from integration defects
27
+ 2. Add dependencies
28
+ - add `@atomazing-org/design-system`
29
+ - add `@mui/material`, `@mui/icons-material`, `@emotion/react`, and `@emotion/styled` when the scaffold does not already include them
30
+ 3. Connect the root provider
31
+ - wrap the app root with `ThemeProviderWrapper`
32
+ - do not add a competing root `ThemeProvider`
33
+ - if the app will expose multiple presets, keep selection in one explicit app-level theme module
34
+ 4. Add optional theme controls
35
+ - if the app needs theme switching or dark-mode controls, wire them through `useThemeSettings()`
36
+ - keep UI labels and visible text aligned with the typography contract from the start
37
+ 5. Runtime-safe integration
38
+ - if the app uses SSR or Next.js, keep provider wiring inside a client boundary
39
+ - keep browser-only APIs out of module scope
40
+ - start the app and verify the first route boots cleanly in a real browser
41
+ - if the app shell exposes a dedicated workspace or content pane, verify the first route root actually fills that region instead of shrinking to intrinsic content width
42
+ - if the app ships non-Latin copy or seeds localized mocks, keep files in UTF-8 and verify the first route does not render mojibake or replacement characters
43
+ 6. Run quality gates
44
+ - run the repo's validation commands
45
+ - verify build, tests, and runtime startup are clean before closeout
46
+
47
+ ## Common Failure Modes
48
+
49
+ - adding `ThemeProviderWrapper` while leaving a second competing root theme provider in place
50
+ - keeping preset choice scattered across constants passthrough files instead of one app theme module
51
+ - adding browser-only logic at module scope during initial provider setup
52
+ - first-route page roots or layout containers not stretching to fill the intended workspace
53
+ - localized starter copy or mock data landing in the repo with mojibake because file encoding was not validated
54
+ - declaring greenfield success on build output alone without an actual browser startup check
55
+
56
+ ## Shared Gates
26
57
 
27
58
  Use common gate definitions from:
59
+
28
60
  - `../../shared/gates.md`
29
61
  - `../../shared/acceptance.md`
@@ -2,35 +2,58 @@
2
2
  "$schema": "../../schema/migration.spec.schema.json",
3
3
  "id": "greenfield",
4
4
  "title": "Greenfield install of @atomazing-org/design-system",
5
- "detect": {
6
- "packageJson": {
7
- "allDependencies": []
8
- }
9
- },
10
- "entryConditions": ["проект инициализирован (package.json существует)"],
11
- "exitConditions": ["ThemeProviderWrapper подключён", "tests/build зелёные"],
5
+ "entryConditions": ["package.json exists"],
6
+ "exitConditions": [
7
+ "ThemeProviderWrapper is connected at the app root",
8
+ "the app boots cleanly on the first route",
9
+ "tests and build are green"
10
+ ],
12
11
  "steps": [
12
+ {
13
+ "name": "Baseline",
14
+ "manualReview": [
15
+ "Confirm the repo installs and the normal validation commands can run.",
16
+ "Record any pre-existing setup failures separately from integration defects."
17
+ ]
18
+ },
13
19
  {
14
20
  "name": "Add deps",
15
- "run": [
16
- "node migrations/scripts/migrations/design-system/actions/update-package-json.mjs --add @atomazing-org/design-system:<SET_VERSION> --add @mui/material:^7 --add @mui/icons-material:^7 --add @emotion/react:^11 --add @emotion/styled:^11"
21
+ "manualReview": [
22
+ "Edit package.json directly and add @atomazing-org/design-system:<SET_VERSION>, @mui/material:^7, @mui/icons-material:^7, @emotion/react:^11, and @emotion/styled:^11.",
23
+ "Preserve the target repository package manager conventions and lockfile strategy."
17
24
  ]
18
25
  },
19
26
  {
20
27
  "name": "Install deps",
21
- "run": ["npm install"]
28
+ "manualReview": [
29
+ "Install dependencies with the target repository package manager (npm, pnpm, yarn, or bun)."
30
+ ]
22
31
  },
23
32
  {
24
33
  "name": "Manual integration",
25
34
  "manualReview": [
26
- "Подключите ThemeProviderWrapper в корне приложения.",
27
- "Если Next.js убедитесь, что это client boundary (\"use client\")."
35
+ "Connect ThemeProviderWrapper at the application root.",
36
+ "If the app exposes multiple presets, keep selection in one explicit app-level theme module.",
37
+ "If Next.js or another SSR framework is in use, ensure the provider lives in a client boundary."
38
+ ]
39
+ },
40
+ {
41
+ "name": "Runtime boot verification",
42
+ "manualReview": [
43
+ "Start the app with the repo's normal dev/start command and open the first route in a real browser.",
44
+ "Fix startup console errors before closeout.",
45
+ "Keep browser-only APIs out of module scope during initial provider integration.",
46
+ "If the app shell exposes a dedicated workspace or content pane, verify the first route root fills that region instead of shrinking to intrinsic content width.",
47
+ "If the app ships non-Latin copy or localized mocks, scan for mojibake or replacement characters and verify readable text on the first route."
28
48
  ]
29
49
  },
30
50
  {
31
51
  "name": "Quality",
32
- "run": ["npm test", "npm run build"]
52
+ "manualReview": [
53
+ "Run the target repository quality gates with its package manager: lint, tests, and build (when available).",
54
+ "If the repository provides smoke, style-contract, design-contract, or typography-contract checks, include them in closeout."
55
+ ]
33
56
  }
34
57
  ],
35
- "gates": ["tests", "build"]
58
+ "gates": ["lint", "tests", "build"]
36
59
  }