ui-design-workbench-cli 0.5.0__py3-none-any.whl

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 (73) hide show
  1. android_resource_resolver.py +370 -0
  2. android_xml_support.py +230 -0
  3. apple_resource_resolver.py +141 -0
  4. coverage_report.py +134 -0
  5. fidelity_adapter_api.py +89 -0
  6. fidelity_adapters.py +508 -0
  7. fidelity_core.py +241 -0
  8. fidelity_platform_adapters.py +902 -0
  9. ir_contracts.py +76 -0
  10. native_render_android.py +160 -0
  11. native_render_apple.py +165 -0
  12. native_render_contracts.py +148 -0
  13. native_render_registry.py +86 -0
  14. quality_common.py +217 -0
  15. render_preview.py +1797 -0
  16. scan_ui.py +1485 -0
  17. scoped_context.py +458 -0
  18. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/SKILL.md +52 -0
  19. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/adapter-api.md +20 -0
  20. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/agent-integrations.md +39 -0
  21. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/cache-protocol.md +61 -0
  22. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/design-modes.md +109 -0
  23. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/fidelity.md +53 -0
  24. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/ir-schema.md +412 -0
  25. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/native-rendering.md +40 -0
  26. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/platform-profiles.json +84 -0
  27. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/platform-standards.md +131 -0
  28. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/platforms.md +40 -0
  29. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/quality-automation.md +77 -0
  30. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/review-workflow.md +135 -0
  31. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/ui-guidance-mode.md +22 -0
  32. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/ui-policy-schema.md +83 -0
  33. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/ui-reviewer.md +175 -0
  34. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/validation.md +34 -0
  35. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/references/workbench-ui.md +108 -0
  36. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/schemas/native-render-state.schema.json +71 -0
  37. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/schemas/ui-agent-job.schema.json +36 -0
  38. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/schemas/ui-graph.schema.json +46 -0
  39. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/schemas/ui-ir.patch.schema.json +36 -0
  40. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/schemas/ui-ir.schema.json +296 -0
  41. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/schemas/uidw-config.schema.json +68 -0
  42. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/android_resource_resolver.py +370 -0
  43. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/android_xml_support.py +230 -0
  44. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/apple_resource_resolver.py +141 -0
  45. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/coverage_report.py +134 -0
  46. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/fidelity_adapter_api.py +89 -0
  47. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/fidelity_adapters.py +508 -0
  48. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/fidelity_core.py +241 -0
  49. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/fidelity_platform_adapters.py +902 -0
  50. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/generate_interaction_matrix.py +166 -0
  51. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/ir_contracts.py +76 -0
  52. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/merge_review_state.py +267 -0
  53. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/native_render_android.py +160 -0
  54. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/native_render_apple.py +165 -0
  55. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/native_render_contracts.py +148 -0
  56. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/native_render_registry.py +86 -0
  57. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/quality_common.py +217 -0
  58. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/render_preview.py +1797 -0
  59. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/scan_ui.py +1485 -0
  60. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/scoped_context.py +458 -0
  61. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/smoke_preview.js +978 -0
  62. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/uidw.py +2821 -0
  63. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/uidw_mcp.py +282 -0
  64. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/validate_platform_profiles.py +93 -0
  65. ui_design_workbench_cli-0.5.0.data/data/share/ui-design-workbench/scripts/visual_regression.py +141 -0
  66. ui_design_workbench_cli-0.5.0.dist-info/METADATA +133 -0
  67. ui_design_workbench_cli-0.5.0.dist-info/RECORD +73 -0
  68. ui_design_workbench_cli-0.5.0.dist-info/WHEEL +5 -0
  69. ui_design_workbench_cli-0.5.0.dist-info/entry_points.txt +3 -0
  70. ui_design_workbench_cli-0.5.0.dist-info/top_level.txt +20 -0
  71. uidw.py +2821 -0
  72. uidw_mcp.py +282 -0
  73. validate_platform_profiles.py +93 -0
@@ -0,0 +1,84 @@
1
+ {
2
+ "version": 2,
3
+ "profiles": {
4
+ "material3": {
5
+ "family": "android",
6
+ "label": "Android · Material 3",
7
+ "standardRefPrefixes": ["material3.", "project."],
8
+ "minimumTarget": {"width": 48, "height": 48},
9
+ "requiredInteractionStates": ["default", "pressed", "focused", "disabled"],
10
+ "requirements": ["system-back", "edge-to-edge-insets", "dynamic-color-aware", "scalable-type"]
11
+ },
12
+ "apple-hig": {
13
+ "family": "ios",
14
+ "label": "iOS · Apple HIG",
15
+ "standardRefPrefixes": ["apple.", "project."],
16
+ "minimumTarget": {"width": 44, "height": 44},
17
+ "requiredInteractionStates": ["default", "highlighted", "focused", "disabled"],
18
+ "requirements": ["safe-area-insets", "dynamic-type", "system-back", "reduced-motion"]
19
+ },
20
+ "web-platform": {
21
+ "family": "web",
22
+ "label": "Web · semantic HTML, WCAG 2.2 AA, APG",
23
+ "standardRefPrefixes": ["html.", "aria.", "project."],
24
+ "minimumTarget": {"width": 24, "height": 24},
25
+ "recommendedTouchTarget": {"width": 44, "height": 44},
26
+ "requiredInteractionStates": ["default", "hover", "focus-visible", "active", "disabled"],
27
+ "requirements": ["keyboard-complete", "focus-visible", "semantic-landmarks", "reflow-320-css-px"]
28
+ },
29
+ "windows-fluent": {
30
+ "family": "windows",
31
+ "label": "Windows · Fluent, WinUI and Windows accessibility",
32
+ "standardRefPrefixes": ["windows.", "winui.", "project."],
33
+ "minimumTarget": {"width": 40, "height": 40},
34
+ "requiredInteractionStates": ["default", "pointer-over", "pressed", "focused", "disabled"],
35
+ "requirements": ["keyboard-complete", "visible-focus", "narrator-uia", "text-scaling", "high-contrast", "resizable-window", "multi-input"],
36
+ "referenceUrls": [
37
+ "https://learn.microsoft.com/windows/apps/design/",
38
+ "https://learn.microsoft.com/windows/apps/develop/input/guidelines-for-targeting",
39
+ "https://learn.microsoft.com/windows/apps/develop/input/keyboard-interactions",
40
+ "https://learn.microsoft.com/windows/apps/design/accessibility/"
41
+ ]
42
+ },
43
+ "macos-hig": {
44
+ "family": "macos",
45
+ "label": "macOS · Apple HIG",
46
+ "standardRefPrefixes": ["macos.", "apple.", "project."],
47
+ "minimumTarget": {"width": 28, "height": 28},
48
+ "documentedMinimumTarget": {"width": 20, "height": 20},
49
+ "requiredInteractionStates": ["default", "pressed", "focused", "disabled", "inactive-window"],
50
+ "requirements": ["menu-bar-commands", "keyboard-shortcuts", "full-keyboard-access", "voiceover", "resizable-window", "active-inactive-window", "reduced-motion", "increase-contrast"],
51
+ "referenceUrls": [
52
+ "https://developer.apple.com/design/human-interface-guidelines/designing-for-macos/",
53
+ "https://developer.apple.com/design/human-interface-guidelines/accessibility",
54
+ "https://developer.apple.com/design/human-interface-guidelines/focus-and-selection/"
55
+ ]
56
+ },
57
+ "flutter-adaptive": {
58
+ "family": "flutter",
59
+ "label": "Flutter · Material, Cupertino and adaptive layout",
60
+ "standardRefPrefixes": ["flutter.", "material3.", "cupertino.", "project."],
61
+ "minimumTarget": {"width": 48, "height": 48},
62
+ "requiredInteractionStates": ["default", "hovered", "focused", "pressed", "disabled"],
63
+ "requirements": ["adaptive-layout", "platform-semantics", "scalable-text", "safe-area-insets", "keyboard-complete", "reduced-motion"],
64
+ "referenceUrls": [
65
+ "https://docs.flutter.dev/ui/adaptive-responsive",
66
+ "https://docs.flutter.dev/ui/accessibility-and-internationalization/accessibility"
67
+ ]
68
+ }
69
+ },
70
+ "frameworkAdapters": {
71
+ "android-compose": {"families": ["android"], "profiles": ["material3"]},
72
+ "android-views": {"families": ["android"], "profiles": ["material3"]},
73
+ "swiftui": {"families": ["ios"], "profiles": ["apple-hig"]},
74
+ "uikit": {"families": ["ios"], "profiles": ["apple-hig"]},
75
+ "web": {"families": ["web"], "profiles": ["web-platform"]},
76
+ "react-web": {"families": ["web"], "profiles": ["web-platform"]},
77
+ "windows-winui": {"families": ["windows"], "profiles": ["windows-fluent"]},
78
+ "windows-wpf": {"families": ["windows"], "profiles": ["windows-fluent"]},
79
+ "windows-xaml": {"families": ["windows"], "profiles": ["windows-fluent"]},
80
+ "swiftui-macos": {"families": ["macos"], "profiles": ["macos-hig"]},
81
+ "appkit": {"families": ["macos"], "profiles": ["macos-hig"]},
82
+ "flutter": {"families": ["flutter"], "profiles": ["flutter-adaptive"]}
83
+ }
84
+ }
@@ -0,0 +1,131 @@
1
+ # Platform standards profile
2
+
3
+ Last verified: 2026-08-27. Use official sources when a decision depends on newer OS behavior, an experimental component, or a library version. Never upgrade project dependencies merely because newer guidance exists.
4
+
5
+ The executable profile catalog is [platform-profiles.json](platform-profiles.json). Keep profile IDs, standard-reference prefixes, target sizes, and framework adapters there; prose in this file explains judgment and never overrides a stricter machine gate. Validate every final IR with `scripts/validate_platform_profiles.py` or the combined coverage gate described in [quality-automation.md](quality-automation.md).
6
+
7
+ ## Selection order
8
+
9
+ 1. Explicit product requirements and user-approved brand constraints.
10
+ 2. The repository's installed UI framework, design system, tokens, and established interaction patterns.
11
+ 3. The target platform's official components and navigation conventions.
12
+ 4. Accessibility and adaptive-layout requirements.
13
+ 5. A custom solution only when the previous layers cannot satisfy the task; record a `design.decisions` entry explaining why.
14
+
15
+ Reconstruction preserves current behavior and reports standards gaps instead of silently redesigning. Generation and redesign use the platform baseline unless the existing project system intentionally overrides it.
16
+
17
+ ## Android mobile and tablet
18
+
19
+ Default profile ID: `material3`.
20
+
21
+ - For new Android UI, default to Material 3 components and theming. In Compose, derive color, typography, and shape from `MaterialTheme`; in Views, stay with the project's installed Material Components stack rather than introducing Compose without permission.
22
+ - Prefer the installed stable APIs. Use Material 3 Expressive or experimental APIs only when already enabled or explicitly approved.
23
+ - Map top-level and hierarchical navigation to Material/Android patterns already used by the project. Do not import iOS tab, sheet, or toolbar behavior merely for visual novelty.
24
+ - Use adaptive layouts based on window size, not a hard-coded phone model. Consider navigation bar/rail and list-detail/supporting-pane patterns where the information architecture warrants them.
25
+ - Interactive touch targets should be at least 48×48 dp, even if the visible icon is smaller.
26
+ - Support font scaling, screen readers, keyboard, mouse, stylus, RTL, dark theme, system insets, loading/error/empty states, and back behavior.
27
+
28
+ Official sources:
29
+
30
+ - [Material Design 3 in Compose](https://developer.android.com/develop/ui/compose/designsystems/material3)
31
+ - [Adaptive Android guidance](https://developer.android.com/develop/adaptive-apps/guides/adaptive-dos-and-donts)
32
+ - [Android accessibility and 48 dp targets](https://developer.android.com/design/ui/mobile/guides/foundations/accessibility)
33
+
34
+ ## iOS
35
+
36
+ Default profile ID: `apple-hig`.
37
+
38
+ - Prefer native SwiftUI/UIKit controls, navigation, sheets, alerts, menus, pickers, toolbars, tab bars, system typography, semantic colors, materials, and standard gestures.
39
+ - A tab bar navigates between top-level areas; actions belong in a toolbar or content. Preserve navigation state within tabs.
40
+ - Respect safe areas, system margins, Dynamic Type, localization expansion, RTL, orientation, and input methods beyond touch.
41
+ - Use a 44×44 pt default control target for iOS. Do not shrink it merely to make a dense layout fit.
42
+ - Do not simulate Material ripples, FABs, Android back behavior, or Android component geometry unless the product explicitly chooses a cross-platform custom system.
43
+ - Use current system materials, including newer visual treatments, only when the deployment target and existing implementation support them. Do not draw a speculative imitation in HTML.
44
+
45
+ Official sources:
46
+
47
+ - [Apple Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines)
48
+ - [Apple layout and safe-area guidance](https://developer.apple.com/design/human-interface-guidelines/layout)
49
+ - [Apple accessibility guidance and control sizes](https://developer.apple.com/design/human-interface-guidelines/accessibility)
50
+ - [Apple tab bar guidance](https://developer.apple.com/design/human-interface-guidelines/tab-bars)
51
+ - [Apple toolbar guidance](https://developer.apple.com/design/human-interface-guidelines/toolbars)
52
+
53
+ ## macOS
54
+
55
+ Default profile ID: `macos-hig`.
56
+
57
+ - Prefer native SwiftUI/AppKit windows, split views, sidebars, inspectors, tables, toolbars, menus, sheets, popovers, search fields, system typography, semantic colors, and standard command placement.
58
+ - Treat the menu bar and keyboard shortcuts as first-class command surfaces. Important commands remain discoverable in menus even when a toolbar or contextual shortcut also exposes them.
59
+ - Support resizable, movable, minimizable, full-screen, multiwindow, active, and inactive window states where the product architecture permits them. Do not freeze a desktop workflow into a phone-sized fixed canvas.
60
+ - Design for precise pointer input, keyboard-only workflows, Full Keyboard Access, VoiceOver, drag and drop, contextual menus, and focus rings. Hover may supplement meaning but cannot be the only way to expose a required action.
61
+ - Use 28×28 pt as the default control target for generated and redesigned macOS UI. The documented 20×20 pt minimum requires a recorded exception, adequate spacing, low error consequence, and verification with the actual control/input context.
62
+ - Preserve platform conventions for destructive commands, default/cancel actions, document state, app/window lifecycle, and active/inactive emphasis. Do not copy iOS tab bars, oversized touch geometry, or mobile-only sheets into a desktop Mac workflow without an explicit reason.
63
+ - Respect Reduce Motion, Increase Contrast, Differentiate Without Color, text enlargement, localization expansion, RTL where applicable, and multiple display scales.
64
+
65
+ Official sources:
66
+
67
+ - [Designing for macOS](https://developer.apple.com/design/human-interface-guidelines/designing-for-macos/)
68
+ - [Apple accessibility guidance and macOS control sizes](https://developer.apple.com/design/human-interface-guidelines/accessibility)
69
+ - [Apple focus and selection guidance](https://developer.apple.com/design/human-interface-guidelines/focus-and-selection/)
70
+ - [Apple menu guidance](https://developer.apple.com/design/human-interface-guidelines/menus)
71
+ - [Apple toolbar guidance](https://developer.apple.com/design/human-interface-guidelines/toolbars)
72
+
73
+ ## Web
74
+
75
+ Default profile ID: `web-platform`.
76
+
77
+ - Start with semantic HTML and native elements. Use ARIA only when native semantics cannot express the required widget.
78
+ - Target WCAG 2.2 AA unless the repository or user requires a stronger level. Preserve visible focus, logical tab order, keyboard operation, names/roles/values, contrast, zoom/reflow, error identification, and reduced motion.
79
+ - Custom widgets follow the corresponding WAI-ARIA Authoring Practices pattern, including its keyboard model and focus management. APG is informative guidance, while WCAG and ARIA are normative standards.
80
+ - Pointer targets must meet WCAG 2.2 AA target sizing or a documented exception. The baseline audit uses 24×24 CSS px; prefer larger targets for primary touch interfaces when product density permits.
81
+ - Use responsive content-driven breakpoints and appropriate maximum content widths. Do not imitate an Android or iOS screen when the target is a desktop web application.
82
+ - Preserve browser expectations for links, forms, history, selection, copy/paste, autofill, and keyboard shortcuts.
83
+
84
+ Official sources:
85
+
86
+ - [WCAG 2.2 Recommendation](https://www.w3.org/TR/WCAG22/)
87
+ - [WCAG 2.2 target-size guidance](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html)
88
+ - [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
89
+ - [APG keyboard-interface guidance](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/)
90
+
91
+ ## Windows
92
+
93
+ Default profile ID: `windows-fluent`.
94
+
95
+ - Prefer the UI stack already installed by the repository: normally WinUI 3 with Windows App SDK for a new native app, or the existing WPF/Win32 stack for an established product. Do not migrate frameworks merely to satisfy the profile.
96
+ - Use Fluent/Windows control and navigation conventions, system typography, theme resources, standard title-bar/window behavior, dialogs, teaching tips, command bars, menus, and NavigationView patterns when they match the task.
97
+ - Support mouse, touch, pen, keyboard, gamepad/remote where relevant, Narrator, UI Automation, access keys, keyboard accelerators, visible focus, high contrast, text scaling, display scaling, and reduced motion.
98
+ - Use 40×40 effective pixels as the default touch target for generated and redesigned interactive elements. Pointer-dense UI may use a smaller visible control only when the hit target, spacing, frequency, and error consequence remain safe and the exception is recorded.
99
+ - Treat window resizing, snap layouts, multiple displays, DPI changes, compact/expanded layouts, activation/deactivation, and title-bar insets as normal states. Recompute custom title-bar interactive regions after size, scale, or presenter changes.
100
+ - Keep command placement and shortcuts consistent with Windows expectations. Do not import macOS traffic-light controls, iOS navigation stacks, or Android FAB/ripple behavior without an intentional cross-platform-system decision.
101
+ - Prefer standard WinUI text and controls so Windows text-size and accessibility settings work without custom reimplementation. Validate wrapping, clipping, contrast, and geometry at supported display and text scales.
102
+
103
+ Official sources:
104
+
105
+ - [Windows app design guidance](https://learn.microsoft.com/windows/apps/design/)
106
+ - [Windows touch target guidance](https://learn.microsoft.com/windows/apps/develop/input/guidelines-for-targeting)
107
+ - [Windows keyboard interactions](https://learn.microsoft.com/windows/apps/develop/input/keyboard-interactions)
108
+ - [Windows focus navigation](https://learn.microsoft.com/windows/apps/develop/input/focus-navigation)
109
+ - [Windows accessibility guidance](https://learn.microsoft.com/windows/apps/design/accessibility/)
110
+ - [Windows text scaling](https://learn.microsoft.com/windows/apps/develop/input/text-scaling)
111
+ - [Windows title bar guidance](https://learn.microsoft.com/windows/apps/develop/title-bar)
112
+
113
+ ## Flutter
114
+
115
+ Default profile ID: `flutter-adaptive`.
116
+
117
+ - Preserve the project's existing Material, Cupertino, or custom widget system; do not replace it merely to make the HTML projection easier.
118
+ - Resolve adaptive behavior, safe areas, scalable text, localization, platform semantics, keyboard/focus behavior, and responsive breakpoints explicitly.
119
+ - Treat custom painters, runtime layout delegates, platform channels, and builder output without deterministic fixtures as unsupported evidence gaps.
120
+ - The HTML output is a structural projection. Native Flutter golden/device evidence is required before calling it visually verified.
121
+
122
+ ## IR evidence
123
+
124
+ For generated or redesigned interactive nodes, use:
125
+
126
+ - `standardRef`: one reference such as `material3.Button`, `apple.Button`, `macos.Toolbar`, `windows.NavigationView`, `flutter.Text`, `html.button`, or `aria.dialog`;
127
+ - `standardRefs`: per-platform references for shared nodes;
128
+ - `decisionId`: an ID from `design.decisions` when a custom component is necessary;
129
+ - `semantics.role`, `semantics.label`, and `semantics.targetSize`.
130
+
131
+ Project-system references use `project.ComponentName` and require a valid project standard profile. A custom decision is not permission to ignore accessibility or expected platform behavior.
@@ -0,0 +1,40 @@
1
+ # Platform discovery rules
2
+
3
+ Read only the section matching platforms reported by `scan_ui.py`.
4
+
5
+ ## Web and React
6
+
7
+ Prioritize route declarations, page/layout files, exported PascalCase components, JSX/TSX, CSS modules, global styles, theme providers, design-token JSON, and public assets. Preserve imported project components instead of flattening them into generic HTML controls. Extract visible strings, prop defaults, variants, and navigation calls.
8
+
9
+ ## Android Compose
10
+
11
+ Prioritize `@Composable` functions, `NavHost`/`composable` routes, `MaterialTheme`, `Modifier` chains, preview fixtures, `Row`, `Column`, `Box`, lazy containers, text, images, icons, and project design-system components. Read `res/values`, vector drawables, fonts, and raster resources. Treat custom `Canvas`, subcomposition, and runtime measurement as unsupported until mapped.
12
+
13
+ ## Android Views
14
+
15
+ Prioritize `res/layout`, navigation XML, styles/themes, drawables, Activities, Fragments, adapters, and view binding. Translate XML constraints into IR layout relationships; do not render Android widgets with browser defaults. Record custom Views as project-specific components.
16
+
17
+ ## SwiftUI and UIKit
18
+
19
+ For SwiftUI, prioritize types conforming to `View`, `body`, stacks, grids, modifiers, `NavigationStack`, `NavigationLink`, previews, assets, and environment-driven themes. For UIKit, prioritize Storyboard/XIB, view controllers, Auto Layout constraints, appearance configuration, and asset catalogs. Mark custom drawing and implicit system metrics approximate unless a renderer mapping exists.
20
+
21
+ ## macOS SwiftUI and AppKit
22
+
23
+ Detect macOS targets from `Package.swift` platform declarations, Xcode target metadata, `import AppKit`, `#if os(macOS)`, `NSApplication`, `NSWindow`, `NSViewController`, `WindowGroup`, `Settings`, `Commands`, and `MenuBarExtra`. For SwiftUI, prioritize scenes, windows, commands, split views, tables, toolbars, inspectors, focus, and environment-driven active/inactive states. For AppKit, prioritize NSWindow/NSWindowController, NSViewController, NSToolbar, NSMenu, NSSplitView, NSTableView, Auto Layout, bindings, and asset catalogs. Do not classify a macOS Storyboard/XIB as UIKit or reuse iOS navigation assumptions.
24
+
25
+ ## Windows
26
+
27
+ Detect WinUI 3 and Windows App SDK through `.csproj`, `Microsoft.WindowsAppSDK`, `Microsoft.UI.Xaml`, `AppWindow`, XAML pages/windows, NavigationView, CommandBar, and resource dictionaries. Detect WPF through `UseWPF`, `System.Windows`, Window/Page/UserControl XAML, routed commands, styles, templates, and VisualStateManager. Read theme dictionaries, control templates, title-bar integration, window-size handlers, keyboard accelerators/access keys, UI Automation properties, high-contrast resources, and scale-aware assets. Keep WinUI, WPF, Win32, and hybrid web content distinct; do not translate XAML controls as browser-default HTML.
28
+
29
+ ## Flutter
30
+
31
+ Prioritize `Widget` subclasses, `build`, `MaterialApp`/`CupertinoApp`, `ThemeData`, `Navigator`/`GoRouter`, rows, columns, stacks, flex, lists, assets, and `pubspec.yaml`. Use explicit fixture values for builders. Mark custom painters and runtime layout delegates unsupported until mapped.
32
+
33
+ ## Shared rules
34
+
35
+ - Search navigation and theme definitions before individual leaf components.
36
+ - Reuse literal strings and local assets; do not invent product copy.
37
+ - Trace design-system wrappers to their defaults before choosing a renderer variant.
38
+ - Keep alternate themes and responsive variants as explicit preview states.
39
+ - For desktop targets, inventory window sizes, activation, menus, commands, keyboard shortcuts, pointer/keyboard focus, and multiwindow behavior as first-class states.
40
+ - If a platform uses generated code, prefer authored source and configuration over generated output.
@@ -0,0 +1,77 @@
1
+ # Quality automation
2
+
3
+ Use these deterministic gates for every final reconstruction, generation, redesign, or expert-review bundle. They inspect IR and standalone HTML only; they never run the target application. Ordinary `workbench` and `check` runs use **projection** mode: they verify evidence transfer and workbench behavior without judging the product UI. UI/UX heuristics run only in **review** mode after an explicit review request.
4
+
5
+ ## 1. Platform profile
6
+
7
+ `references/platform-profiles.json` is the machine-readable source for profile IDs, standard-reference prefixes, minimum targets, required interaction states, and framework adapters. The validation matrix covers Android, iOS, macOS, Windows, Flutter, and Web.
8
+
9
+ ```powershell
10
+ python <skill-dir>/scripts/validate_platform_profiles.py <review-dir>/ui-ir.json --output <review-dir>/platform-profile-report.json --strict
11
+ ```
12
+
13
+ Fix a blocked report in IR. A `project` profile is valid only with a non-empty reason and project evidence.
14
+
15
+ ## 2. Coverage gate
16
+
17
+ Run after the final IR update and before delivery:
18
+
19
+ ```powershell
20
+ python <skill-dir>/scripts/coverage_report.py <review-dir>/ui-ir.json --mode projection --output <review-dir>/ui-coverage.json --markdown <review-dir>/ui-coverage.md --strict
21
+ ```
22
+
23
+ Projection mode gates screen-tree uniqueness, discovered screens/routes/navigation, component mappings, appearance, profiles, and source/evidence transfer. It never gates target size, contrast, spacing, accessibility, or other UI-quality heuristics. Use `--mode review` only after an explicit review request; for generated/redesigned review artifacts it additionally gates semantics, standards, target size, contrast, and required state coverage. Do not average away a failed category; every active gate must pass or remain an explicit delivery blocker.
24
+
25
+ ## 3. Interaction scenario plan
26
+
27
+ Generate the review plan from declared actions and states:
28
+
29
+ ```powershell
30
+ python <skill-dir>/scripts/generate_interaction_matrix.py <review-dir>/ui-ir.json --output <review-dir>/ui-interaction-matrix.json
31
+ ```
32
+
33
+ The plan covers single, repeated, reverse, chained, and boundary actions plus workbench zoom, menu, and panel continuity. `--max-pairs` bounds cross-control combinations without dropping individual control checks. Use `--merge-output <new-ir.json>` only when the plan should travel inside `review.scenarioPlan`; never overwrite the input IR. Generated scenarios are a plan, not proof of execution. Record actual results separately in `review.audit.interactionChecks`.
34
+
35
+ ## 4. Reproducible snapshots
36
+
37
+ Capture both pixels and DOM geometry at the approved viewport:
38
+
39
+ ```powershell
40
+ node <skill-dir>/scripts/smoke_preview.js <review-dir>/ui-preview.html --mode projection --output <review-dir>/ui-diagnostics.json --screenshot <review-dir>/candidate.png --geometry-output <review-dir>/candidate-geometry.json --capture-view overview --capture-screen home --capture-left-panel open --capture-right-panel open --capture-inspector-tab review --viewport-width 1440 --viewport-height 960
41
+ ```
42
+
43
+ Use `--capture-review-section summary|problems|changes` to capture each review workspace deterministically. A production reviewer workbench needs at least Summary at primary and compact widths plus Problems and Changes after representative decisions or imports.
44
+
45
+ Repeat for every primary and compact viewport. The `--capture-*` options restore a canonical view, screen, panel, and inspector state after smoke interactions, so regression screenshots do not accidentally capture the test residue. At widths up to 980 px, an explicitly open right panel closes the left panel to preserve the production mutual-exclusion invariant. Compare a candidate only with a deliberately approved baseline captured at the same viewport and state:
46
+
47
+ The smoke workflow must also validate the portable agent handoff without launching an agent: an absolute artifact path, provider-neutral prompt/job, immutable-baseline/source guards, selected finding IDs for proposal jobs, and visible copy/refresh recovery controls. For `--agent codex`, additionally validate the optional `codex://new` URL. No adapter may require a bridge server, localhost port, or background process.
48
+
49
+ ```powershell
50
+ python <skill-dir>/scripts/visual_regression.py --baseline <baseline.png> --candidate <candidate.png> --baseline-geometry <baseline-geometry.json> --candidate-geometry <candidate-geometry.json> --output <visual-regression.json> --diff-image <visual-diff.png> --strict
51
+ ```
52
+
53
+ Pixel thresholds tolerate small antialiasing differences; geometry defaults to a one-CSS-pixel tolerance for the generated workbench shell and reconstruction mapping. Never treat source-authored spacing, wrapping, contrast, target size, or accessibility as a product problem in projection mode. Never replace an approved baseline automatically. A product finding may be created only during an explicit review.
54
+
55
+ Pixel comparison uses Pillow (`PIL`). If the default Python runtime lacks it, use the bundled workspace Python runtime that provides Pillow; do not silently skip the regression gate.
56
+
57
+ The workbench review shell has four committed golden states (Summary at wide and compact widths, Problems, and Changes). Verify them after changing the renderer, review navigation, or panel CSS:
58
+
59
+ ```powershell
60
+ python <skill-dir>/scripts/verify_workbench_goldens.py
61
+ ```
62
+
63
+ Use `--approve` only after visually inspecting every new PNG. This is an explicit maintainer action; normal verification never replaces a baseline.
64
+
65
+ ## Delivery gate
66
+
67
+ A production review bundle contains:
68
+
69
+ - `ui-ir.json` and `ui-preview.html`;
70
+ - `platform-profile-report.json`;
71
+ - `ui-coverage.json` and optional Markdown summary;
72
+ - `ui-interaction-matrix.json` for stateful work;
73
+ - `ui-diagnostics.json` for primary and compact profiles;
74
+ - candidate screenshots and geometry snapshots;
75
+ - `visual-regression.json` plus a diff image when pixels changed.
76
+
77
+ Report each non-pass result. A successful script invocation is not equivalent to a passing report.
@@ -0,0 +1,135 @@
1
+ # Component registry and review workflow
2
+
3
+ Use this reference when a task includes project-component reuse, Before/After comparison, comments, or staged design approval.
4
+
5
+ ## Component catalog
6
+
7
+ `scan_ui.py` emits conservative `componentCatalog.components` candidates. The inventory is not a usable design system until each relevant entry has been inspected recursively.
8
+
9
+ For every project component used by a screen:
10
+
11
+ 1. Inspect its implementation, default parameters, variants, states, reached tokens, assets, semantics, and platform dependency.
12
+ 2. Update the catalog entry with `inspection: mapped`, its actual `variants`, `states`, and `tokenRefs`, plus a renderer mapping such as `{"nodeType":"button","confidence":"high"}`.
13
+ 3. Set the corresponding node's `componentRef` to the catalog entry ID.
14
+ 4. Use `inspection: excluded` only with a non-empty `reason`, for example a preview-only wrapper or a component unrelated to rendered UI.
15
+ 5. Mark `componentCatalog.status: ready` only when every component used in the review scope is mapped or reasonedly excluded.
16
+
17
+ When `componentCatalog.enforce` is true, the renderer blocks an uninspected catalog or project component use without a mapped `componentRef`. New project components require a design decision explaining why existing catalog entries are insufficient.
18
+
19
+ ## Review versions
20
+
21
+ Base `nodes` are the immutable `Before` snapshot. Store proposals as sparse overrides rather than overwriting base nodes:
22
+
23
+ ```json
24
+ {
25
+ "review": {
26
+ "sessionId": "checkout-review-2026-08-24",
27
+ "revision": "checkout-review-v1",
28
+ "baselineVersion": "baseline",
29
+ "activeVersion": "proposal-1",
30
+ "versionDecision": "pending",
31
+ "versions": [
32
+ {
33
+ "id": "baseline",
34
+ "label": "Before",
35
+ "kind": "baseline",
36
+ "status": "approved",
37
+ "nodeOverrides": {}
38
+ },
39
+ {
40
+ "id": "proposal-1",
41
+ "label": "After · clearer checkout action",
42
+ "kind": "proposal",
43
+ "parent": "baseline",
44
+ "status": "proposal",
45
+ "summary": "Clarifies the primary action without changing checkout behavior.",
46
+ "findingIds": ["finding-checkout-action-priority"],
47
+ "decisionIds": ["decision-checkout-action"],
48
+ "nodeOverrides": {
49
+ "checkout-action": {
50
+ "text": "Review order",
51
+ "style": {"background": "$colors.primary"}
52
+ }
53
+ }
54
+ }
55
+ ],
56
+ "annotations": []
57
+ }
58
+ }
59
+ ```
60
+
61
+ Version inheritance follows `parent`; later overrides merge node fields and merge `layout` and `style`. Keep IDs stable across iterations. Create a new proposal version for a materially different alternative instead of mutating an already reviewed version.
62
+
63
+ Set `review.revision` to a stable human-readable revision for the review bundle. The renderer combines it with a target-content hash that covers screens, nodes, themes, versions, and audit data but excludes the renderer/workbench schema. Store the workbench and diagnostics-engine versions separately. Re-rendering or upgrading the HTML shell preserves review runs, selections, decisions, annotations, and view context when target content is unchanged. It preserves runtime diagnostics only when their engine version matches; otherwise it removes technical findings and requires a fresh run without discarding human review state. A legacy snapshot from the same `review.revision` lineage is migrated automatically once and stamped with the separate target revision. When target content really changes, do not silently replay stale references: keep the old snapshot intact until the reviewer migrates compatible state or discards it. Never migrate runtime findings across target revisions; recompute them.
64
+
65
+ The HTML workbench provides split and overlay comparisons, highlights overridden nodes, and stores local review state in browser storage. Its canvas-first shell uses a narrow navigation rail, searchable screen tree, one compact document bar with the active ordinary-view version, a floating view palette with one pointer escape action, zoom-only bottom-right controls, and a contextual right panel. Properties and Comments activate their matching canvas modes from the rail, while Problems visibility is controlled inside the Problems panel rather than duplicated in the bottom palette. Compare is a dedicated view with explicit left/right version selectors. Side panels are independently collapsible and resizable on wide screens and mutually exclusive overlays at compact widths. `Approve version` means design approval only; it never authorizes source changes. Read [workbench-ui.md](workbench-ui.md) for the complete shell contract.
66
+
67
+ Workbench menus are transient, mutually exclusive surfaces: opening one closes the previous menu, and selecting an action, clicking outside, pressing `Escape`, or changing view closes the open menu. In `All screens`, zoom applies to one shared overview canvas; it must not change the per-screen preview scale, grid geometry, or relative card positions.
68
+
69
+ ## Diagnostics Runner
70
+
71
+ Every review preview exposes a local Diagnostics Runner in the right panel. Configure it through `review.diagnostics`, run it after the final render, and export its report with the review state. For every fixed `{width,height}` profile, the renderer loads an isolated same-document sandbox at that real CSS viewport size; do not emulate a narrow profile by merely recording a label. The runner changes workbench states only temporarily and restores the starting screen, view, version, zoom, comparison mode, selected node, active highlight, scroll positions, and node states when it finishes.
72
+
73
+ The primary `Review` entry point is one button, `Запустить ревью`. It runs the configured scenarios across every assembled screen and fixed profile, replaces the previous runtime-generated set with evidence-backed cards for the current non-pass results, removes cards whose checks now pass, focuses that generated set in the findings list, and leaves the technical report under the collapsed `Диагностика` section. A repeated run reuses deterministic diagnostic finding IDs instead of duplicating cards. The launcher must show scope, running state, final issue count, and a clear rerun label.
74
+
75
+ The Review panel uses three isolated workspaces: `Проверка`, `Проблемы`, and `Исправление`. Проверка reports exact screen/profile/check/state coverage and named run history. Проблемы groups automated failures by causal scenario and screen, keeps systemic findings ahead of instances, and supports source/screen/severity filtering plus bulk decisions. Исправление shows one concise current-state summary, result import, version comparison, design approval, and the source-planning boundary; it must not repeat another step diagram. A single sticky primary action advances to the next valid stage.
76
+
77
+ Never claim `all states` from screen count alone. Enumerate every declared `node.states` variant for each included screen and deterministic viewport profile, execute it, and report tested versus expected combinations. Keep unavailable loading/error/offline/localization/RTL or assistive-technology conditions as explicit gaps. `Current screen` scope may reduce runtime; `All screens` remains the default final-review scope.
78
+
79
+ After a completed local run, enable `Подготовить AI-ревью`. The generated HTML embeds its absolute review-directory path and creates a portable prompt/job for any filesystem-capable agent. A user still reviews and sends the prompt. With the optional `--agent codex` renderer adapter, the same job can also be prepared through the official `codex://new?prompt=...&path=...` deep link. Keep `ui-expert-review-request.json` as a portable fallback containing the complete IR, screen IDs, active version, runtime report, existing findings and decisions.
80
+
81
+ The workbench accepts either a complete returned UI IR or `ui-design-workbench-expert-review-result` with `requestRevision`, `project`, `summary`, `findings`, `versions`, and `resolvedFindingIds`. Continue accepting the legacy `ui-code-preview-expert-review-result` so existing review jobs remain importable. Reject an explicit mismatched request revision or project. Merge nodes, stable finding IDs, and sparse proposal versions without replacing baseline nodes; register new versions in Changes, make the latest imported proposal the active ordinary-view version and the default right side of Compare, record an import-history entry, and open Changes. Import never authorizes source edits.
82
+
83
+ For an explicit review headless/local pass, open the generated file with `?diagnostics=run&diagnostic-mode=review`; the runner starts automatically and exposes the same report in the diagnostics panel. This remains an offline HTML check and does not execute the application. Ordinary reconstruction uses `diagnostic-mode=projection` and never creates review findings.
84
+
85
+ The dependency-free Node helper performs that pass and writes a reusable report:
86
+
87
+ ```powershell
88
+ node <skill-dir>/scripts/smoke_preview.js <review-dir>/ui-preview.html --mode review --output <review-dir>/ui-diagnostics.json
89
+ ```
90
+
91
+ Add `--screenshot <review-dir>/workbench.png --geometry-output <review-dir>/workbench-geometry.json --viewport-width 1440 --viewport-height 960` for reproducible pixel and DOM-geometry QA. Repeat at a compact width before delivery. Compare approved and candidate snapshots with `scripts/visual_regression.py` as described in [quality-automation.md](quality-automation.md).
92
+
93
+ Set `CHROME_PATH` when Chrome, Edge, or Chromium is outside the common Windows, macOS, or Linux locations. Add `--fail-on-findings` for CI gating; without it, detected UI problems are reported but do not make the helper itself fail.
94
+
95
+ Projection scenarios check screen/node IR-to-DOM transfer, source-evidenced variant rendering, navigation-target references, zoom-label/reset synchronization, stable overview-card geometry and scroll bounds, menu exclusivity, and the workbench's theme/state controls. They do not inspect product contrast, keyboard access, target size, typography quality, spacing, overlap, overflow, or user-flow reachability and cannot create findings. Review mode adds those UI/UX checks. Navigation reachability is assessed only when the IR declares an entry screen through `scenario.entryScreenIds` or `screen.navigationEntry`; otherwise review diagnostics validate target references without inventing a start node. Group repeated review non-pass checks by scenario and screen into one systemic runtime finding with measured instances. Exported review findings merge into `review.audit.findings`, so they remain actionable in the next revision.
96
+
97
+ ## Expert audit findings
98
+
99
+ When `review.audit` exists, its findings appear above user annotations. Every failed `interactionCheck` or `layoutCheck`, and every `uxAssessment` with `status: finding`, links to one or more concrete cards through `findingIds`. Audit rows show the linked count and provide `Показать проблемы` plus `Все в исправление`; they are evidence summaries, not separate invisible work items.
100
+
101
+ Each finding has one stable review number used in both the Problems list and its canvas marker. A reliably mapped screen/node receives a numbered circle; clicking it opens one anchored description card and the top-right collapse action restores the circle. Current finding filters and the Problems visibility toggle update list and canvas together. Each finding can focus its affected screen/node and, when linked to `proposalVersionId`, open the dedicated Compare view. A proposal declares visually addressed corrections in `resolvedFindingIds`; this is proposal coverage, not proof that project files changed. Baseline markers render only on the immutable reviewed version and on the original side of Compare. The reviewer chooses `Выбрать для применения`, `Не исправлять`, or `Позже`. The correction queue reports how many selected findings already have a proposal, how many need a new one, and how many were applied and verified. `Создать вариант макета` prepares an agent task scoped to the review directory. The task includes selected finding IDs, active and baseline versions, annotations, review scope, and `sourceChangeAllowed: false`; it may create up to two alternatives only when a real UX tradeoff exists. `Скопировать задание` and `ui-fix-request.json` remain portable fallbacks.
102
+
103
+ The queue communicates six concrete outcomes: `Найдено → Выбрано → Учтено в новом макете → Подтверждено → Применено → Проверено`. The safe path previews corrections first and exposes `Применить исправления` only on step 3, after every selected preview-solvable finding is addressed in the active proposal and the user approves it. Approval still leaves the persistent status `в проект не применён`. A separate advanced source action is the explicit fast-path authorization: it prepares one implementation job for every current finding and bypasses proposal approval. Implementation jobs set `sourceChangeAllowed: true`, include `projectRoot`, stable finding IDs, annotations, and source targets, and must change real project files rather than merely rebuilding the proposal.
104
+
105
+ After implementation, run incremental `uidw sync` and only targeted checks for affected screens, finding IDs, and project modules. Record a finding-level `verification` only for passing targeted checks; legacy `status: resolved`, a prepared handoff, proposal coverage, or proposal approval is not completion. Do not automatically repeat the full AI review; that is an explicit user action. The agent's final chat response must be a plain numbered list of every selected finding with screen, problem, implemented fix, changed files, verification result, and any remaining blocker. Keep this textual report in chat, not as a duplicate HTML block.
106
+
107
+ Use [ui-reviewer.md](ui-reviewer.md) for evidence, severity, coverage, and proposal rules. Keep expert findings separate from user annotations: findings are the AI reviewer's reasoned analysis, while annotations are reviewer feedback on the current or proposed design.
108
+
109
+ ## Annotation lifecycle
110
+
111
+ Annotations use statuses `new`, `in-progress`, `proposed`, `accepted`, `rejected`, or `resolved` and stay anchored to `screenId`, `nodeId`, and `versionId`. Preserve the source snapshot included by the workbench.
112
+
113
+ Process comments incrementally:
114
+
115
+ 1. Explicitly save or copy `ui-review-state.json` from the preview. The File menu also restores this file directly; saving is never automatic.
116
+ 2. Merge it into a new IR file. The merge preserves the exported runtime report as `review.diagnosticsReport`, appends validated `runtimeFindings` to `review.audit.findings`, and records the feedback revision, so an agent can reconcile failed checks with findings and proposals:
117
+
118
+ ```powershell
119
+ python <skill-dir>/scripts/merge_review_state.py <review-dir>/ui-ir.json <review-dir>/ui-review-state.json --output <review-dir>/ui-ir-reviewed.json
120
+ ```
121
+
122
+ 3. Select one coherent group of `new` comments. Mark them `in-progress` before proposing changes.
123
+ 4. Add a child proposal version containing only the required node overrides and link its decisions to the relevant annotations with `proposalVersionId` and a short response.
124
+ 5. Render again. The reviewer accepts or rejects each annotation and the version separately.
125
+ 6. Mark an annotation `resolved` only after its proposal is accepted. Rejected proposals remain in history and are never silently replaced.
126
+
127
+ Do not edit application source during review or proposal generation. After the user explicitly chooses `Применить в проекте` or `Исправить всё в проекте`, implement only the authorized findings and list their affected source mappings and verification results in chat.
128
+
129
+ ## Offline boundary
130
+
131
+ The preview remains a standalone local HTML file and makes no network requests. It can copy or download a portable task and may optionally navigate to a provider's official local deep link. This requires no bridge server, localhost port, CLI process, or background service. Preparing or navigating is not submission: the workbench must ask the user to send the prompt and never claim that AI review or remediation started.
132
+
133
+ The agent task is restricted to the generated review directory. It may update `ui-ir.json`, regenerate `ui-preview.html`, and write validation artifacts, but it must not modify the source project or immutable baseline. When complete, the user returns to the preview and chooses `Обновить макет`. Export/copy of `ui-agent-job.json`, `ui-fix-request.json`, and `ui-expert-review-request.json` remains the recovery path when a native adapter is unavailable.
134
+
135
+ `merge_review_state.py` accepts `ui-review-state.json`, the legacy `ui-review-feedback.json`, or the wrapped `ui-fix-request.json`. For a fix request it also preserves the selected IDs and requested action as `review.correctionRequest` before a new proposal is authored.
@@ -0,0 +1,22 @@
1
+ # Optional UI guidance mode
2
+
3
+ Use this lightweight path only when `ui-context.json` reports `uiMode.enabled: true` and the user requests an ordinary UI-related source change. It prevents platform-inappropriate improvisation without turning every UI task into a design audit.
4
+
5
+ ## Task contract
6
+
7
+ 1. Keep the user's requested behavior and scope authoritative. Do not add a redesign, new dependency, mockup, review bundle, or unrelated cleanup.
8
+ 2. Resolve the target platform and existing UI stack from cached context and the directly affected source. Read only that platform section of [platform-standards.md](platform-standards.md) and any discovered project UI policy.
9
+ 3. Prefer existing project components, tokens, assets, typography, spacing, navigation, and state patterns. Platform guidance fills gaps; it does not erase an intentional project design system.
10
+ 4. Check the affected control or screen for relevant states, adaptive behavior, input method, focus/semantics, accessibility, localization pressure, and platform navigation/action placement. Ignore categories the change cannot affect.
11
+ 5. Implement in the real source only when the user's request authorizes implementation. Run the smallest relevant repository validation and report any deliberate standards exception or unresolved evidence.
12
+
13
+ ## Platform routing
14
+
15
+ - Android: existing Compose/Views stack, Material guidance compatible with that stack, system back/navigation, touch targets, state and accessibility semantics.
16
+ - iOS: existing SwiftUI/UIKit stack, Apple navigation and presentation patterns, Dynamic Type, safe areas, and semantic controls.
17
+ - macOS: existing SwiftUI/AppKit stack, window/menu/toolbar conventions, keyboard commands, compact pointer geometry, and active/inactive state.
18
+ - Windows: existing WinUI/WPF/other installed stack, Fluent-compatible command placement, keyboard/focus/high-contrast behavior, resizable-window layout, and pointer/touch differences.
19
+ - Flutter: existing Material/Cupertino/adaptive stack, platform-aware navigation and semantics, scalable text, safe areas, and responsive layout.
20
+ - Web: existing framework and design system, semantic HTML, WCAG 2.2 AA, keyboard/focus behavior, responsive layout, and established component primitives.
21
+
22
+ The mode is advisory and scoped. It does not claim that the whole product was reviewed or made compliant.
@@ -0,0 +1,83 @@
1
+ # Project UI policy
2
+
3
+ An optional `.codex/ui-policy.json` makes design choices repeatable across tasks. Do not create or change it inside a repository without explicit approval. `ui-policy.json` at the repository root is also recognized.
4
+
5
+ ```json
6
+ {
7
+ "version": 1,
8
+ "platforms": {
9
+ "android": {
10
+ "standardProfile": "material3",
11
+ "implementation": "compose",
12
+ "allowExperimental": false,
13
+ "minimumTarget": 48,
14
+ "adaptive": true
15
+ },
16
+ "ios": {
17
+ "standardProfile": "apple-hig",
18
+ "implementation": "swiftui",
19
+ "minimumTarget": 44,
20
+ "preferSystemComponents": true
21
+ },
22
+ "macos": {
23
+ "standardProfile": "macos-hig",
24
+ "implementation": "swiftui",
25
+ "minimumTarget": 28,
26
+ "documentedMinimumTarget": 20,
27
+ "preferSystemComponents": true,
28
+ "requireMenuCommands": true,
29
+ "resizableWindows": true
30
+ },
31
+ "windows": {
32
+ "standardProfile": "windows-fluent",
33
+ "implementation": "winui3",
34
+ "minimumTarget": 40,
35
+ "inputs": ["mouse", "keyboard", "touch", "pen"],
36
+ "requireVisibleFocus": true,
37
+ "requireHighContrast": true,
38
+ "resizableWindows": true
39
+ },
40
+ "flutter": {
41
+ "standardProfile": "flutter-adaptive",
42
+ "implementation": "flutter",
43
+ "minimumTarget": 48,
44
+ "adaptive": true,
45
+ "preferPlatformSemantics": true
46
+ },
47
+ "web": {
48
+ "standardProfile": "web-platform",
49
+ "wcagTarget": "2.2 AA",
50
+ "minimumTarget": 24,
51
+ "preferNativeHtml": true
52
+ }
53
+ },
54
+ "brand": {
55
+ "tokenSources": ["design/tokens.json"],
56
+ "componentRoots": ["ui/components"],
57
+ "assetRoots": ["assets"],
58
+ "allowInventedCopy": false
59
+ },
60
+ "rules": {
61
+ "preferProjectComponents": true,
62
+ "allowNewDependencies": false,
63
+ "allowCrossPlatformVisualParity": false,
64
+ "requireStateMatrix": true,
65
+ "forbiddenPatterns": [
66
+ "unapproved gradients",
67
+ "decorative glass effects",
68
+ "icon-only destructive actions",
69
+ "navigation controls used as actions"
70
+ ]
71
+ }
72
+ }
73
+ ```
74
+
75
+ ## Resolution
76
+
77
+ - Explicit user instructions override the policy for the current task; record the override.
78
+ - Repository instructions and installed framework constraints remain authoritative for implementation.
79
+ - Missing policy values fall back to [platform-standards.md](platform-standards.md), not to model preference.
80
+ - Numeric minimums may be stricter than platform defaults but must not be weaker than required accessibility baselines without a documented standards exception.
81
+ - Paths are repository-relative. The policy identifies authoritative sources; it does not duplicate token or component contents.
82
+
83
+ Copy the resolved policy into `design.policySnapshot` in review IR. Include `policyFile` so annotations and later tasks can trace the decision source. Never silently mutate the policy during preview iteration.