openuispec 0.1.27 → 0.1.29

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 (123) hide show
  1. package/README.md +52 -55
  2. package/cli/configure-target.ts +416 -0
  3. package/cli/index.ts +14 -3
  4. package/cli/init.ts +241 -55
  5. package/cli/target-presets.json +746 -0
  6. package/docs/implementation-notes.md +47 -10
  7. package/docs/release-notes-v0.1.26.md +1 -1
  8. package/docs/release-notes-v0.1.28.md +25 -0
  9. package/docs/stress-test-maturity-report.md +1 -1
  10. package/drift/index.ts +31 -11
  11. package/examples/taskflow/AGENTS.md +113 -0
  12. package/examples/taskflow/CLAUDE.md +113 -0
  13. package/examples/taskflow/backend/.gitkeep +1 -0
  14. package/examples/taskflow/generated/android/TaskFlow/README.md +43 -0
  15. package/examples/taskflow/generated/android/TaskFlow/app/build.gradle.kts +76 -0
  16. package/examples/taskflow/generated/android/TaskFlow/app/proguard-rules.pro +1 -0
  17. package/examples/taskflow/generated/android/TaskFlow/app/src/main/AndroidManifest.xml +21 -0
  18. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/MainActivity.kt +19 -0
  19. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/TaskFlowApp.kt +283 -0
  20. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/model/DomainModels.kt +106 -0
  21. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/model/SampleData.kt +57 -0
  22. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/components/Common.kt +109 -0
  23. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/HomeScreen.kt +112 -0
  24. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/ProjectsScreen.kt +61 -0
  25. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/SettingsScreen.kt +82 -0
  26. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/TaskDetailScreen.kt +111 -0
  27. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/sheets/Sheets.kt +77 -0
  28. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Color.kt +30 -0
  29. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Theme.kt +86 -0
  30. package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Type.kt +57 -0
  31. package/examples/taskflow/generated/android/TaskFlow/app/src/main/res/values/strings.xml +155 -0
  32. package/examples/taskflow/generated/android/TaskFlow/app/src/main/res/values/themes.xml +4 -0
  33. package/examples/taskflow/generated/android/TaskFlow/build.gradle.kts +5 -0
  34. package/examples/taskflow/generated/android/TaskFlow/gradle/gradle-daemon-jvm.properties +12 -0
  35. package/examples/taskflow/generated/android/TaskFlow/gradle/wrapper/gradle-wrapper.jar +0 -0
  36. package/examples/taskflow/generated/android/TaskFlow/gradle/wrapper/gradle-wrapper.properties +7 -0
  37. package/examples/taskflow/generated/android/TaskFlow/gradle.properties +4 -0
  38. package/examples/taskflow/generated/android/TaskFlow/gradlew +18 -0
  39. package/examples/taskflow/generated/android/TaskFlow/gradlew.bat +12 -0
  40. package/examples/taskflow/generated/android/TaskFlow/settings.gradle.kts +18 -0
  41. package/examples/taskflow/generated/ios/TaskFlow/README.md +21 -0
  42. package/examples/taskflow/generated/ios/TaskFlow/Resources/en.lproj/Localizable.strings +115 -0
  43. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/App/TaskFlowApp.swift +24 -0
  44. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Components/AppChrome.swift +150 -0
  45. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Flows/TaskEditorSheet.swift +220 -0
  46. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Models/DomainModels.swift +122 -0
  47. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/CalendarView.swift +21 -0
  48. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/HomeView.swift +201 -0
  49. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProfileEditView.swift +48 -0
  50. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProjectDetailView.swift +59 -0
  51. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProjectsView.swift +63 -0
  52. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/SettingsView.swift +85 -0
  53. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/TaskDetailView.swift +219 -0
  54. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Support/AppModel.swift +320 -0
  55. package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Support/AppSupport.swift +41 -0
  56. package/examples/taskflow/generated/ios/TaskFlow/project.yml +26 -0
  57. package/examples/taskflow/generated/web/TaskFlow/README.md +19 -0
  58. package/examples/taskflow/generated/web/TaskFlow/index.html +12 -0
  59. package/examples/taskflow/generated/web/TaskFlow/package-lock.json +1908 -0
  60. package/examples/taskflow/generated/web/TaskFlow/package.json +24 -0
  61. package/examples/taskflow/generated/web/TaskFlow/src/App.tsx +58 -0
  62. package/examples/taskflow/generated/web/TaskFlow/src/AppShell.tsx +55 -0
  63. package/examples/taskflow/generated/web/TaskFlow/src/components/Common.tsx +82 -0
  64. package/examples/taskflow/generated/web/TaskFlow/src/components/Modals.tsx +191 -0
  65. package/examples/taskflow/generated/web/TaskFlow/src/components/Nav.tsx +41 -0
  66. package/examples/taskflow/generated/web/TaskFlow/src/generated/messages.ts +131 -0
  67. package/examples/taskflow/generated/web/TaskFlow/src/hooks.ts +25 -0
  68. package/examples/taskflow/generated/web/TaskFlow/src/i18n.ts +39 -0
  69. package/examples/taskflow/generated/web/TaskFlow/src/locales.en.json +111 -0
  70. package/examples/taskflow/generated/web/TaskFlow/src/main.tsx +13 -0
  71. package/examples/taskflow/generated/web/TaskFlow/src/screens/HomeScreen.tsx +111 -0
  72. package/examples/taskflow/generated/web/TaskFlow/src/screens/ProjectsScreen.tsx +82 -0
  73. package/examples/taskflow/generated/web/TaskFlow/src/screens/SettingsScreens.tsx +132 -0
  74. package/examples/taskflow/generated/web/TaskFlow/src/screens/TaskDetail.tsx +105 -0
  75. package/examples/taskflow/generated/web/TaskFlow/src/store.ts +216 -0
  76. package/examples/taskflow/generated/web/TaskFlow/src/styles.css +617 -0
  77. package/examples/taskflow/generated/web/TaskFlow/src/types.ts +64 -0
  78. package/examples/taskflow/generated/web/TaskFlow/src/utils.ts +78 -0
  79. package/examples/taskflow/generated/web/TaskFlow/tsconfig.json +21 -0
  80. package/examples/taskflow/generated/web/TaskFlow/vite.config.ts +6 -0
  81. package/examples/taskflow/openuispec/README.md +54 -0
  82. package/examples/taskflow/{openuispec.yaml → openuispec/openuispec.yaml} +2 -0
  83. package/examples/todo-orbit/AGENTS.md +48 -22
  84. package/examples/todo-orbit/CLAUDE.md +48 -22
  85. package/examples/todo-orbit/backend/.gitkeep +1 -0
  86. package/examples/todo-orbit/openuispec/README.md +9 -4
  87. package/examples/todo-orbit/openuispec/openuispec.yaml +2 -0
  88. package/package.json +1 -1
  89. package/prepare/index.ts +811 -25
  90. package/schema/openuispec.schema.json +10 -0
  91. package/schema/semantic-lint.ts +36 -12
  92. package/schema/validate.ts +9 -4
  93. package/status/index.ts +16 -3
  94. /package/examples/taskflow/{contracts → openuispec/contracts}/README.md +0 -0
  95. /package/examples/taskflow/{contracts → openuispec/contracts}/action_trigger.yaml +0 -0
  96. /package/examples/taskflow/{contracts → openuispec/contracts}/collection.yaml +0 -0
  97. /package/examples/taskflow/{contracts → openuispec/contracts}/data_display.yaml +0 -0
  98. /package/examples/taskflow/{contracts → openuispec/contracts}/feedback.yaml +0 -0
  99. /package/examples/taskflow/{contracts → openuispec/contracts}/input_field.yaml +0 -0
  100. /package/examples/taskflow/{contracts → openuispec/contracts}/nav_container.yaml +0 -0
  101. /package/examples/taskflow/{contracts → openuispec/contracts}/surface.yaml +0 -0
  102. /package/examples/taskflow/{contracts → openuispec/contracts}/x_media_player.yaml +0 -0
  103. /package/examples/taskflow/{flows → openuispec/flows}/create_task.yaml +0 -0
  104. /package/examples/taskflow/{flows → openuispec/flows}/edit_task.yaml +0 -0
  105. /package/examples/taskflow/{locales → openuispec/locales}/en.json +0 -0
  106. /package/examples/taskflow/{platform → openuispec/platform}/android.yaml +0 -0
  107. /package/examples/taskflow/{platform → openuispec/platform}/ios.yaml +0 -0
  108. /package/examples/taskflow/{platform → openuispec/platform}/web.yaml +0 -0
  109. /package/examples/taskflow/{screens → openuispec/screens}/calendar.yaml +0 -0
  110. /package/examples/taskflow/{screens → openuispec/screens}/home.yaml +0 -0
  111. /package/examples/taskflow/{screens → openuispec/screens}/profile_edit.yaml +0 -0
  112. /package/examples/taskflow/{screens → openuispec/screens}/project_detail.yaml +0 -0
  113. /package/examples/taskflow/{screens → openuispec/screens}/projects.yaml +0 -0
  114. /package/examples/taskflow/{screens → openuispec/screens}/settings.yaml +0 -0
  115. /package/examples/taskflow/{screens → openuispec/screens}/task_detail.yaml +0 -0
  116. /package/examples/taskflow/{tokens → openuispec/tokens}/color.yaml +0 -0
  117. /package/examples/taskflow/{tokens → openuispec/tokens}/elevation.yaml +0 -0
  118. /package/examples/taskflow/{tokens → openuispec/tokens}/icons.yaml +0 -0
  119. /package/examples/taskflow/{tokens → openuispec/tokens}/layout.yaml +0 -0
  120. /package/examples/taskflow/{tokens → openuispec/tokens}/motion.yaml +0 -0
  121. /package/examples/taskflow/{tokens → openuispec/tokens}/spacing.yaml +0 -0
  122. /package/examples/taskflow/{tokens → openuispec/tokens}/themes.yaml +0 -0
  123. /package/examples/taskflow/{tokens → openuispec/tokens}/typography.yaml +0 -0
@@ -0,0 +1,78 @@
1
+ import type { Filter, Project, Task } from "./types";
2
+
3
+ export function matchesFilter(task: Task, filter: Filter) {
4
+ const due = task.dueDate ? new Date(task.dueDate) : null;
5
+ const today = new Date();
6
+ today.setHours(0, 0, 0, 0);
7
+ if (filter === "all") return true;
8
+ if (filter === "done") return task.status === "done";
9
+ if (filter === "today") return Boolean(due && due.toDateString() === today.toDateString() && task.status !== "done");
10
+ return Boolean(due && due > today && task.status !== "done");
11
+ }
12
+
13
+ export function matchesQuery(task: Task, projects: Project[], query: string) {
14
+ if (!query.trim()) return true;
15
+ const projectName = projects.find((project) => project.id === task.projectId)?.name ?? "";
16
+ return [task.title, task.description ?? "", projectName, task.tags.join(" ")]
17
+ .join(" ")
18
+ .toLowerCase()
19
+ .includes(query.toLowerCase());
20
+ }
21
+
22
+ export function buildCounts(tasks: Task[]) {
23
+ return {
24
+ all: tasks.length,
25
+ today: tasks.filter((task) => matchesFilter(task, "today")).length,
26
+ upcoming: tasks.filter((task) => matchesFilter(task, "upcoming")).length,
27
+ done: tasks.filter((task) => task.status === "done").length
28
+ };
29
+ }
30
+
31
+ export function parseTags(value: string) {
32
+ return value
33
+ .split(",")
34
+ .map((item) => item.trim())
35
+ .filter(Boolean);
36
+ }
37
+
38
+ export function initials(name: string) {
39
+ return name
40
+ .split(" ")
41
+ .slice(0, 2)
42
+ .map((part) => part[0]?.toUpperCase() ?? "")
43
+ .join("");
44
+ }
45
+
46
+ export function relativeDate(value: string) {
47
+ const date = new Date(value);
48
+ const today = new Date();
49
+ today.setHours(0, 0, 0, 0);
50
+ const target = new Date(date);
51
+ target.setHours(0, 0, 0, 0);
52
+ const diff = Math.round((target.getTime() - today.getTime()) / 86400000);
53
+ if (diff === 0) return "Today";
54
+ if (diff === 1) return "Tomorrow";
55
+ if (diff === -1) return "Yesterday";
56
+ if (diff > 1) return `in ${diff} days`;
57
+ return `${Math.abs(diff)} days ago`;
58
+ }
59
+
60
+ export function formatDate(value: string) {
61
+ return new Date(value).toLocaleDateString("en-US", {
62
+ month: "short",
63
+ day: "numeric",
64
+ year: "numeric"
65
+ });
66
+ }
67
+
68
+ export function addDays(days: number) {
69
+ const next = new Date();
70
+ next.setDate(next.getDate() + days);
71
+ return next.toISOString();
72
+ }
73
+
74
+ export function daysAgo(days: number) {
75
+ const previous = new Date();
76
+ previous.setDate(previous.getDate() - days);
77
+ return previous.toISOString();
78
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "allowJs": false,
7
+ "skipLibCheck": true,
8
+ "esModuleInterop": true,
9
+ "allowSyntheticDefaultImports": true,
10
+ "strict": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "module": "ESNext",
13
+ "moduleResolution": "Node",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
18
+ },
19
+ "include": ["src"],
20
+ "references": []
21
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ export default defineConfig({
5
+ plugins: [react()]
6
+ });
@@ -0,0 +1,54 @@
1
+ # TaskFlow — OpenUISpec
2
+
3
+ This directory contains the **OpenUISpec** semantic UI specification for **TaskFlow**.
4
+
5
+ **Start here:** read `openuispec.yaml` — it defines the project structure, data model, API endpoints, and generation targets (**ios, android, web**).
6
+
7
+ ## Directory structure
8
+
9
+ | Directory | Contents |
10
+ |-----------|----------|
11
+ | `tokens/` | Design tokens — colors, typography, spacing, elevation, motion, icons, themes |
12
+ | `screens/` | Screen definitions — one YAML file per screen |
13
+ | `flows/` | Navigation flows — multi-step user journeys |
14
+ | `contracts/` | Component contracts — standard extensions and custom (`x_` prefixed) |
15
+ | `platform/` | Platform overrides — per-target (iOS, Android, Web) behaviors |
16
+ | `locales/` | Localization — i18n strings (JSON, ICU MessageFormat) |
17
+
18
+ ## IMPORTANT — Read the specification before working with spec files
19
+
20
+ The spec format, file schemas, and generation rules are defined in the installed `openuispec` package.
21
+ You MUST read these reference files before creating, editing, or generating from any spec file.
22
+ Do NOT guess the file format — skipping this step will produce invalid YAML that fails validation.
23
+
24
+ **Find the package in this order:**
25
+ 1. `node_modules/openuispec/` (project dependency)
26
+ 2. Run `npm root -g` → `<prefix>/openuispec/` (global install)
27
+ 3. Online: `https://openuispec.rsteam.uz/llms-full.txt` (if not installed)
28
+
29
+ **Reference files inside the package (read in this order):**
30
+ 1. `README.md` — schema tables, file format reference, root wrapper keys
31
+ 2. `spec/openuispec-v0.1.md` — full specification (contracts, layout, expressions, etc.)
32
+ 3. `examples/taskflow/openuispec/` — complete working example with all file types
33
+ 4. `schema/` — JSON Schemas for validation
34
+
35
+ ## CLI commands
36
+
37
+ ```bash
38
+ openuispec validate # Validate spec files against schemas
39
+ openuispec validate semantic # Check semantic cross-references
40
+ openuispec validate screens # Validate only screens
41
+ openuispec configure-target ios [--defaults] # Configure target stack defaults
42
+ openuispec status # Show which targets are behind
43
+ openuispec drift --target ios --explain # Explain semantic spec drift since ios baseline
44
+ openuispec prepare --target ios # Build the target work bundle
45
+ openuispec drift --snapshot --target ios # Snapshot current state + git baseline after ios output exists
46
+ ```
47
+
48
+ The target work bundle has two modes:
49
+ - `bootstrap` when no snapshot exists yet, for first-time generation
50
+ - `update` after a snapshot exists, for drift-based target updates
51
+
52
+ ## Learn more
53
+
54
+ Docs: https://openuispec.rsteam.uz
@@ -31,6 +31,8 @@ i18n:
31
31
 
32
32
  generation:
33
33
  targets: [ios, android, web]
34
+ code_roots:
35
+ backend: "../backend/"
34
36
  output_format:
35
37
  ios: { language: swift, framework: swiftui, min_version: "17.0" }
36
38
  android: { language: kotlin, framework: compose, min_sdk: 26 }
@@ -1,5 +1,5 @@
1
1
  <!-- openuispec-rules-start -->
2
- <!-- openuispec-rules-version: 0.1.23 -->
2
+ <!-- openuispec-rules-version: 0.1.28 -->
3
3
  # OpenUISpec — AI Assistant Rules
4
4
  # ================================
5
5
  # This project uses OpenUISpec to define UI as a semantic spec.
@@ -20,7 +20,7 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
20
20
  **Reference files inside the package (read in this order):**
21
21
  1. `README.md` — schema tables, file format reference, root wrapper keys
22
22
  2. `spec/openuispec-v0.1.md` — full specification (contracts, layout, expressions, adaptive, etc.)
23
- 3. `examples/taskflow/` — complete working example with all file types
23
+ 3. `examples/taskflow/openuispec/` — complete working example with all file types
24
24
  4. `schema/` — JSON Schemas for every file type
25
25
 
26
26
  These files are updated with each package version. Always read from the installed package,
@@ -55,33 +55,59 @@ This means the project has existing UI code but hasn't been specced yet. Your jo
55
55
  type: scroll_vertical
56
56
  ```
57
57
  4. **Extract tokens** — scan for colors, fonts, spacing and create files in `openuispec/tokens/`.
58
- 5. **Update the manifest** — fill in `data_model` and `api.endpoints` in `openuispec/openuispec.yaml`.
59
-
60
- ## Making UI changes
61
- 1. Read the relevant spec files before modifying any UI code.
62
- 2. If the change requires a spec update, modify the spec FIRST, then update code.
63
- 3. Never modify generated code without updating the spec.
64
- 4. When adding a new screen, create the corresponding spec file.
65
- 5. When removing a screen, remove the spec file and update flow references.
66
-
67
- ## After modifying spec files
68
- 1. Run `openuispec validate` to check specs against the schema.
69
- 2. Run `openuispec validate semantic`.
70
- 3. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
71
- 4. Run `openuispec prepare --target <target>` to build the target update bundle.
72
- 5. **Update the generated code** for each affected platform to match the new spec.
73
- 6. Run `openuispec drift --snapshot --target <target>` to baseline the updated state.
74
- 7. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
75
- 8. Run `openuispec status` to see which other targets are still behind.
58
+ 5. **Update the manifest** — fill in `data_model`, `api.endpoints`, and `generation.code_roots.backend` in `openuispec/openuispec.yaml`.
59
+
60
+ ## OpenUISpec Source Of Truth
61
+
62
+ OpenUISpec spec files are the primary source of truth for UI behavior across platforms.
63
+
64
+ ### Start from spec when:
65
+ - the request changes screen structure
66
+ - the request changes navigation
67
+ - the request changes fields, actions, validation, or data binding
68
+ - the request changes tokens, variants, contracts, flows, or localization
69
+ - the request affects more than one platform
70
+ - the request is phrased in product/UI terms rather than platform-code terms
71
+
72
+ Spec-first workflow:
73
+ 1. Read `openuispec/openuispec.yaml` and the relevant spec files first.
74
+ 2. Update the spec first.
75
+ 3. Update the affected generated/native UI code to match the spec.
76
+ 4. Run `openuispec validate`.
77
+ 5. Run `openuispec validate semantic`.
78
+ 6. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
79
+ 7. Run `openuispec prepare --target <target>` to build the target work bundle for that target. In `bootstrap` mode it provides first-generation constraints; in `update` mode it provides drift-based update scope.
80
+ 8. Verify the affected UI targets build/run if possible.
81
+ 9. Only then run `openuispec drift --snapshot --target <target>` for affected targets, after that target output directory exists.
82
+ 10. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
83
+ 11. Use `openuispec status` to see which other targets are still behind the updated spec.
84
+
85
+ ### Start from platform code when:
86
+ - the change is platform-specific polish
87
+ - the change is a local bug fix that does not alter shared semantic behavior
88
+ - the request explicitly asks for an iOS-only, Android-only, or web-only adjustment
89
+
90
+ Platform-first workflow:
91
+ 1. Update native/platform code.
92
+ 2. If the change affects shared semantics, sync the spec afterward.
93
+ 3. If the change is intentionally platform-specific, document it in `platform/*.yaml` when appropriate.
94
+
95
+ ### Never do this:
96
+ - Do not snapshot drift immediately after changing spec unless the UI code has also been updated.
97
+ - Do not treat `openuispec drift` as proof that generated UI matches the spec.
98
+ - Do not skip `--explain` / `prepare` when another platform needs to catch up with shared spec changes.
99
+ - Do not modify generated UI without checking whether the spec must change first.
76
100
 
77
101
  ## CLI commands
78
102
  - `openuispec init` — scaffold a new spec project
79
103
  - `openuispec validate [group...]` — validate spec files against schemas
80
104
  - `openuispec validate semantic` — run semantic cross-reference linting
105
+ - `openuispec configure-target <t> [--defaults]` — configure target stack defaults
81
106
  - `openuispec drift --target <t>` — check for spec drift
82
107
  - `openuispec drift --target <t> --explain` — explain semantic spec drift since the target baseline
83
- - `openuispec drift --snapshot --target <t>` — snapshot current state
84
- - `openuispec prepare --target <t>` — build an AI-ready target update bundle
108
+ - `openuispec drift --snapshot --target <t>` — snapshot current state after the target output exists
109
+ - `openuispec prepare --target <t>` — build the target work bundle
110
+ - `openuispec status` — show cross-target baseline/drift status
85
111
  - `openuispec update-rules` — update AI rules to match installed package version
86
112
  - `openuispec drift --all` — include stubs in drift check
87
113
  <!-- openuispec-rules-end -->
@@ -1,5 +1,5 @@
1
1
  <!-- openuispec-rules-start -->
2
- <!-- openuispec-rules-version: 0.1.23 -->
2
+ <!-- openuispec-rules-version: 0.1.28 -->
3
3
  # OpenUISpec — AI Assistant Rules
4
4
  # ================================
5
5
  # This project uses OpenUISpec to define UI as a semantic spec.
@@ -20,7 +20,7 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
20
20
  **Reference files inside the package (read in this order):**
21
21
  1. `README.md` — schema tables, file format reference, root wrapper keys
22
22
  2. `spec/openuispec-v0.1.md` — full specification (contracts, layout, expressions, adaptive, etc.)
23
- 3. `examples/taskflow/` — complete working example with all file types
23
+ 3. `examples/taskflow/openuispec/` — complete working example with all file types
24
24
  4. `schema/` — JSON Schemas for every file type
25
25
 
26
26
  These files are updated with each package version. Always read from the installed package,
@@ -55,33 +55,59 @@ This means the project has existing UI code but hasn't been specced yet. Your jo
55
55
  type: scroll_vertical
56
56
  ```
57
57
  4. **Extract tokens** — scan for colors, fonts, spacing and create files in `openuispec/tokens/`.
58
- 5. **Update the manifest** — fill in `data_model` and `api.endpoints` in `openuispec/openuispec.yaml`.
59
-
60
- ## Making UI changes
61
- 1. Read the relevant spec files before modifying any UI code.
62
- 2. If the change requires a spec update, modify the spec FIRST, then update code.
63
- 3. Never modify generated code without updating the spec.
64
- 4. When adding a new screen, create the corresponding spec file.
65
- 5. When removing a screen, remove the spec file and update flow references.
66
-
67
- ## After modifying spec files
68
- 1. Run `openuispec validate` to check specs against the schema.
69
- 2. Run `openuispec validate semantic`.
70
- 3. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
71
- 4. Run `openuispec prepare --target <target>` to build the target update bundle.
72
- 5. **Update the generated code** for each affected platform to match the new spec.
73
- 6. Run `openuispec drift --snapshot --target <target>` to baseline the updated state.
74
- 7. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
75
- 8. Run `openuispec status` to see which other targets are still behind.
58
+ 5. **Update the manifest** — fill in `data_model`, `api.endpoints`, and `generation.code_roots.backend` in `openuispec/openuispec.yaml`.
59
+
60
+ ## OpenUISpec Source Of Truth
61
+
62
+ OpenUISpec spec files are the primary source of truth for UI behavior across platforms.
63
+
64
+ ### Start from spec when:
65
+ - the request changes screen structure
66
+ - the request changes navigation
67
+ - the request changes fields, actions, validation, or data binding
68
+ - the request changes tokens, variants, contracts, flows, or localization
69
+ - the request affects more than one platform
70
+ - the request is phrased in product/UI terms rather than platform-code terms
71
+
72
+ Spec-first workflow:
73
+ 1. Read `openuispec/openuispec.yaml` and the relevant spec files first.
74
+ 2. Update the spec first.
75
+ 3. Update the affected generated/native UI code to match the spec.
76
+ 4. Run `openuispec validate`.
77
+ 5. Run `openuispec validate semantic`.
78
+ 6. Run `openuispec drift --target <target> --explain` to inspect semantic changes since that target's baseline.
79
+ 7. Run `openuispec prepare --target <target>` to build the target work bundle for that target. In `bootstrap` mode it provides first-generation constraints; in `update` mode it provides drift-based update scope.
80
+ 8. Verify the affected UI targets build/run if possible.
81
+ 9. Only then run `openuispec drift --snapshot --target <target>` for affected targets, after that target output directory exists.
82
+ 10. Run `openuispec drift --target <target> --explain` again to confirm no spec changes remain for that target.
83
+ 11. Use `openuispec status` to see which other targets are still behind the updated spec.
84
+
85
+ ### Start from platform code when:
86
+ - the change is platform-specific polish
87
+ - the change is a local bug fix that does not alter shared semantic behavior
88
+ - the request explicitly asks for an iOS-only, Android-only, or web-only adjustment
89
+
90
+ Platform-first workflow:
91
+ 1. Update native/platform code.
92
+ 2. If the change affects shared semantics, sync the spec afterward.
93
+ 3. If the change is intentionally platform-specific, document it in `platform/*.yaml` when appropriate.
94
+
95
+ ### Never do this:
96
+ - Do not snapshot drift immediately after changing spec unless the UI code has also been updated.
97
+ - Do not treat `openuispec drift` as proof that generated UI matches the spec.
98
+ - Do not skip `--explain` / `prepare` when another platform needs to catch up with shared spec changes.
99
+ - Do not modify generated UI without checking whether the spec must change first.
76
100
 
77
101
  ## CLI commands
78
102
  - `openuispec init` — scaffold a new spec project
79
103
  - `openuispec validate [group...]` — validate spec files against schemas
80
104
  - `openuispec validate semantic` — run semantic cross-reference linting
105
+ - `openuispec configure-target <t> [--defaults]` — configure target stack defaults
81
106
  - `openuispec drift --target <t>` — check for spec drift
82
107
  - `openuispec drift --target <t> --explain` — explain semantic spec drift since the target baseline
83
- - `openuispec drift --snapshot --target <t>` — snapshot current state
84
- - `openuispec prepare --target <t>` — build an AI-ready target update bundle
108
+ - `openuispec drift --snapshot --target <t>` — snapshot current state after the target output exists
109
+ - `openuispec prepare --target <t>` — build the target work bundle
110
+ - `openuispec status` — show cross-target baseline/drift status
85
111
  - `openuispec update-rules` — update AI rules to match installed package version
86
112
  - `openuispec drift --all` — include stubs in drift check
87
113
  <!-- openuispec-rules-end -->
@@ -27,9 +27,9 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
27
27
  3. Online: `https://openuispec.rsteam.uz/llms-full.txt` (if not installed)
28
28
 
29
29
  **Reference files inside the package (read in this order):**
30
- 1. `README.md` — schema tables, file format reference, root keys
30
+ 1. `README.md` — schema tables, file format reference, root wrapper keys
31
31
  2. `spec/openuispec-v0.1.md` — full specification (contracts, layout, expressions, etc.)
32
- 3. `examples/taskflow/` — complete working example with all file types
32
+ 3. `examples/taskflow/openuispec/` — complete working example with all file types
33
33
  4. `schema/` — JSON Schemas for validation
34
34
 
35
35
  ## CLI commands
@@ -38,12 +38,17 @@ Do NOT guess the file format — skipping this step will produce invalid YAML th
38
38
  openuispec validate # Validate spec files against schemas
39
39
  openuispec validate semantic # Check semantic cross-references
40
40
  openuispec validate screens # Validate only screens
41
+ openuispec configure-target ios [--defaults] # Configure target stack defaults
41
42
  openuispec status # Show which targets are behind
42
43
  openuispec drift --target ios --explain # Explain semantic spec drift since ios baseline
43
- openuispec prepare --target ios # Build an AI-ready ios update bundle
44
- openuispec drift --snapshot --target ios # Snapshot current state + git baseline
44
+ openuispec prepare --target ios # Build the target work bundle
45
+ openuispec drift --snapshot --target ios # Snapshot current state + git baseline after ios output exists
45
46
  ```
46
47
 
48
+ The target work bundle has two modes:
49
+ - `bootstrap` when no snapshot exists yet, for first-time generation
50
+ - `update` after a snapshot exists, for drift-based target updates
51
+
47
52
  If a target snapshot was created before baseline metadata was added, `--explain` and `status` will ask you to re-run `openuispec drift --snapshot --target <target>` for that target.
48
53
 
49
54
  ## Learn more
@@ -29,6 +29,8 @@ generation:
29
29
  # ios: "../ios-app/" # relative to this file
30
30
  # android: "../android-app/"
31
31
  # web: "../web-ui/"
32
+ code_roots:
33
+ backend: "../backend/"
32
34
  output_format:
33
35
  ios: { language: swift, framework: swiftui, min_version: "17.0" }
34
36
  android: { language: kotlin, framework: compose, min_sdk: 26 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openuispec",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A semantic UI specification format for AI-native, platform-native app development",