openuispec 0.1.45 → 0.1.46

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 (133) hide show
  1. package/README.md +2 -1
  2. package/cli/init.ts +5 -2
  3. package/examples/social-app/.mcp.json +10 -0
  4. package/examples/social-app/AGENTS.md +105 -0
  5. package/examples/social-app/CLAUDE.md +105 -0
  6. package/examples/social-app/README.md +19 -0
  7. package/examples/social-app/backend/.gitkeep +1 -0
  8. package/examples/social-app/generated/android/social-app/app/build.gradle.kts +92 -0
  9. package/examples/social-app/generated/android/social-app/app/src/main/AndroidManifest.xml +26 -0
  10. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/AppContainer.kt +20 -0
  11. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/MainActivity.kt +35 -0
  12. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/SocialAppApplication.kt +13 -0
  13. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/MockData.kt +98 -0
  14. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/AppPreferences.kt +19 -0
  15. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/DataStorePreferencesRepository.kt +68 -0
  16. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/PreferencesRepository.kt +15 -0
  17. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/model/Models.kt +34 -0
  18. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/MainShell.kt +390 -0
  19. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/components/Components.kt +234 -0
  20. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/components/ContractPrimitives.kt +641 -0
  21. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/navigation/RootComponent.kt +113 -0
  22. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/ChatDetailScreen.kt +212 -0
  23. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/CreatePostScreen.kt +113 -0
  24. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/DiscoverScreen.kt +137 -0
  25. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/EditProfileScreen.kt +180 -0
  26. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/HomeFeedScreen.kt +157 -0
  27. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/MessagesInboxScreen.kt +85 -0
  28. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/NotificationsScreen.kt +74 -0
  29. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/PostDetailScreen.kt +293 -0
  30. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/ProfileSelfScreen.kt +116 -0
  31. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SearchResultsScreen.kt +161 -0
  32. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SettingsScreen.kt +162 -0
  33. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SettingsStore.kt +95 -0
  34. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/UserProfileScreen.kt +123 -0
  35. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Color.kt +33 -0
  36. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Shape.kt +41 -0
  37. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Spacing.kt +20 -0
  38. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Theme.kt +82 -0
  39. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Type.kt +60 -0
  40. package/examples/social-app/generated/android/social-app/app/src/main/res/drawable/ic_launcher_foreground.xml +9 -0
  41. package/examples/social-app/generated/android/social-app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  42. package/examples/social-app/generated/android/social-app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  43. package/examples/social-app/generated/android/social-app/app/src/main/res/values/strings.xml +91 -0
  44. package/examples/social-app/generated/android/social-app/app/src/main/res/values/themes.xml +10 -0
  45. package/examples/social-app/generated/android/social-app/app/src/main/res/values-ru/strings.xml +79 -0
  46. package/examples/social-app/generated/android/social-app/app/src/main/res/values-uz/strings.xml +79 -0
  47. package/examples/social-app/generated/android/social-app/app/src/main/xml/AndroidManifest.xml +23 -0
  48. package/examples/social-app/generated/android/social-app/build.gradle.kts +6 -0
  49. package/examples/social-app/generated/android/social-app/gradle/libs.versions.toml +48 -0
  50. package/examples/social-app/generated/android/social-app/gradle/wrapper/gradle-wrapper.properties +8 -0
  51. package/examples/social-app/generated/android/social-app/gradle.properties +11 -0
  52. package/examples/social-app/generated/android/social-app/gradlew +25 -0
  53. package/examples/social-app/generated/android/social-app/settings.gradle.kts +23 -0
  54. package/examples/social-app/generated/web/social-app/index.html +12 -0
  55. package/examples/social-app/generated/web/social-app/package-lock.json +2517 -0
  56. package/examples/social-app/generated/web/social-app/package.json +27 -0
  57. package/examples/social-app/generated/web/social-app/src/app/App.tsx +58 -0
  58. package/examples/social-app/generated/web/social-app/src/components/Shell.tsx +247 -0
  59. package/examples/social-app/generated/web/social-app/src/components/cards.tsx +317 -0
  60. package/examples/social-app/generated/web/social-app/src/components/ui.tsx +328 -0
  61. package/examples/social-app/generated/web/social-app/src/flows/CreatePostFlow.tsx +86 -0
  62. package/examples/social-app/generated/web/social-app/src/i18n.tsx +59 -0
  63. package/examples/social-app/generated/web/social-app/src/lib/icons.tsx +85 -0
  64. package/examples/social-app/generated/web/social-app/src/lib/tokens.ts +70 -0
  65. package/examples/social-app/generated/web/social-app/src/lib/utils.ts +97 -0
  66. package/examples/social-app/generated/web/social-app/src/locales/en.json +67 -0
  67. package/examples/social-app/generated/web/social-app/src/locales/ru.json +67 -0
  68. package/examples/social-app/generated/web/social-app/src/locales/uz.json +67 -0
  69. package/examples/social-app/generated/web/social-app/src/main.tsx +16 -0
  70. package/examples/social-app/generated/web/social-app/src/screens/ChatDetailScreen.tsx +90 -0
  71. package/examples/social-app/generated/web/social-app/src/screens/DiscoverScreen.tsx +86 -0
  72. package/examples/social-app/generated/web/social-app/src/screens/EditProfileScreen.tsx +57 -0
  73. package/examples/social-app/generated/web/social-app/src/screens/HomeFeedScreen.tsx +113 -0
  74. package/examples/social-app/generated/web/social-app/src/screens/MessagesInboxScreen.tsx +52 -0
  75. package/examples/social-app/generated/web/social-app/src/screens/NotificationsScreen.tsx +41 -0
  76. package/examples/social-app/generated/web/social-app/src/screens/PostDetailScreen.tsx +115 -0
  77. package/examples/social-app/generated/web/social-app/src/screens/ProfileSelfScreen.tsx +57 -0
  78. package/examples/social-app/generated/web/social-app/src/screens/ProfileUserScreen.tsx +76 -0
  79. package/examples/social-app/generated/web/social-app/src/screens/SearchResultsScreen.tsx +96 -0
  80. package/examples/social-app/generated/web/social-app/src/screens/SettingsScreen.tsx +77 -0
  81. package/examples/social-app/generated/web/social-app/src/state/store.ts +592 -0
  82. package/examples/social-app/generated/web/social-app/src/styles.css +124 -0
  83. package/examples/social-app/generated/web/social-app/src/vite-env.d.ts +1 -0
  84. package/examples/social-app/generated/web/social-app/tsconfig.json +22 -0
  85. package/examples/social-app/generated/web/social-app/tsconfig.node.json +13 -0
  86. package/examples/social-app/generated/web/social-app/tsconfig.node.tsbuildinfo +1 -0
  87. package/examples/social-app/generated/web/social-app/tsconfig.tsbuildinfo +1 -0
  88. package/examples/social-app/generated/web/social-app/vite.config.d.ts +2 -0
  89. package/examples/social-app/generated/web/social-app/vite.config.js +6 -0
  90. package/examples/social-app/generated/web/social-app/vite.config.ts +7 -0
  91. package/examples/social-app/openuispec/README.md +56 -0
  92. package/examples/social-app/openuispec/contracts/.gitkeep +0 -0
  93. package/examples/social-app/openuispec/contracts/action_trigger.yaml +73 -0
  94. package/examples/social-app/openuispec/contracts/collection.yaml +43 -0
  95. package/examples/social-app/openuispec/contracts/data_display.yaml +47 -0
  96. package/examples/social-app/openuispec/contracts/feedback.yaml +49 -0
  97. package/examples/social-app/openuispec/contracts/input_field.yaml +41 -0
  98. package/examples/social-app/openuispec/contracts/nav_container.yaml +34 -0
  99. package/examples/social-app/openuispec/contracts/surface.yaml +41 -0
  100. package/examples/social-app/openuispec/flows/.gitkeep +0 -0
  101. package/examples/social-app/openuispec/flows/create_post.yaml +66 -0
  102. package/examples/social-app/openuispec/locales/.gitkeep +0 -0
  103. package/examples/social-app/openuispec/locales/en.json +67 -0
  104. package/examples/social-app/openuispec/locales/ru.json +67 -0
  105. package/examples/social-app/openuispec/locales/uz.json +67 -0
  106. package/examples/social-app/openuispec/openuispec.yaml +214 -0
  107. package/examples/social-app/openuispec/platform/.gitkeep +0 -0
  108. package/examples/social-app/openuispec/platform/android.yaml +30 -0
  109. package/examples/social-app/openuispec/platform/ios.yaml +19 -0
  110. package/examples/social-app/openuispec/platform/web.yaml +23 -0
  111. package/examples/social-app/openuispec/screens/.gitkeep +0 -0
  112. package/examples/social-app/openuispec/screens/chat_detail.yaml +53 -0
  113. package/examples/social-app/openuispec/screens/discover.yaml +78 -0
  114. package/examples/social-app/openuispec/screens/edit_profile.yaml +78 -0
  115. package/examples/social-app/openuispec/screens/home_feed.yaml +123 -0
  116. package/examples/social-app/openuispec/screens/messages_inbox.yaml +43 -0
  117. package/examples/social-app/openuispec/screens/notifications.yaml +29 -0
  118. package/examples/social-app/openuispec/screens/post_detail.yaml +86 -0
  119. package/examples/social-app/openuispec/screens/profile_self.yaml +53 -0
  120. package/examples/social-app/openuispec/screens/profile_user.yaml +60 -0
  121. package/examples/social-app/openuispec/screens/search_results.yaml +62 -0
  122. package/examples/social-app/openuispec/screens/settings.yaml +94 -0
  123. package/examples/social-app/openuispec/tokens/.gitkeep +0 -0
  124. package/examples/social-app/openuispec/tokens/color.yaml +76 -0
  125. package/examples/social-app/openuispec/tokens/elevation.yaml +31 -0
  126. package/examples/social-app/openuispec/tokens/icons.yaml +147 -0
  127. package/examples/social-app/openuispec/tokens/layout.yaml +37 -0
  128. package/examples/social-app/openuispec/tokens/motion.yaml +28 -0
  129. package/examples/social-app/openuispec/tokens/spacing.yaml +19 -0
  130. package/examples/social-app/openuispec/tokens/themes.yaml +31 -0
  131. package/examples/social-app/openuispec/tokens/typography.yaml +50 -0
  132. package/examples/social-app/package.json +12 -0
  133. package/package.json +1 -1
package/README.md CHANGED
@@ -82,10 +82,11 @@ This replaces the old approach of writing instructions in CLAUDE.md and hoping t
82
82
  | **Claude Code** | `.mcp.json` | Always |
83
83
  | **Codex** | `.codex/config.toml` | Always |
84
84
  | **VS Code / Copilot** | `.vscode/mcp.json` | If `.vscode/` exists |
85
+ | **Gemini CLI** | `.gemini/settings.json` | If `.gemini/` exists |
85
86
 
86
87
  Manual setup (if needed):
87
88
 
88
- **Claude Code** (`.mcp.json`), **VS Code / Copilot** (`.vscode/mcp.json`):
89
+ **Claude Code** (`.mcp.json`), **VS Code / Copilot** (`.vscode/mcp.json`), **Gemini CLI** (`.gemini/settings.json`):
89
90
  ```json
90
91
  {
91
92
  "mcpServers": {
package/cli/init.ts CHANGED
@@ -501,12 +501,14 @@ const EXPECTED_MCP_CONFIG = {
501
501
  * MCP config files by agent:
502
502
  * .mcp.json — Claude Code (project scope)
503
503
  * .vscode/mcp.json — VS Code / Copilot Chat
504
+ * .gemini/settings.json — Gemini CLI (if .gemini/ exists)
504
505
  *
505
506
  * All use the same { mcpServers: { openuispec: { command, args } } } shape.
506
507
  */
507
508
  const JSON_MCP_PATHS = [
508
509
  ".mcp.json",
509
510
  join(".vscode", "mcp.json"),
511
+ join(".gemini", "settings.json"),
510
512
  ];
511
513
 
512
514
  /** Codex uses TOML: .codex/config.toml */
@@ -542,8 +544,9 @@ function configureMcp(cwd: string, showRestart: boolean, quiet: boolean = false)
542
544
  for (const relPath of JSON_MCP_PATHS) {
543
545
  const configPath = join(cwd, relPath);
544
546
 
545
- // .vscode/mcp.json: only write if .vscode/ already exists
546
- if (relPath.startsWith(".vscode") && !existsSync(join(cwd, ".vscode"))) continue;
547
+ // Optional dirs: only write config if the parent directory already exists
548
+ const optionalParent = [".vscode", ".gemini"].find((d) => relPath.startsWith(d));
549
+ if (optionalParent && !existsSync(join(cwd, optionalParent))) continue;
547
550
 
548
551
  try {
549
552
  let config: Record<string, any> = {};
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "openuispec": {
4
+ "command": "openuispec",
5
+ "args": [
6
+ "mcp"
7
+ ]
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,105 @@
1
+ <!-- openuispec-rules-start -->
2
+ <!-- openuispec-rules-version: 0.1.45 -->
3
+ # OpenUISpec — AI Assistant Rules
4
+ # ================================
5
+ # This project uses OpenUISpec to define UI as a semantic spec.
6
+ # Spec files are the single source of truth for all UI across platforms.
7
+ # Targets: "ios", "android", "web"
8
+
9
+ ## MANDATORY — UI work requires OpenUISpec tools
10
+
11
+ When the user's request involves UI — screens, navigation, layout, tokens, flows, localization,
12
+ or any visual/structural change — you MUST use the OpenUISpec tools before writing any code.
13
+
14
+ ### MCP Tools (use these when available)
15
+
16
+ Call these MCP tools directly. They return structured JSON with everything you need.
17
+
18
+ **Pre-generation:**
19
+ 1. Call `openuispec_prepare` with the target platform — returns spec context, platform config, constraints.
20
+ 2. Call `openuispec_read_specs` to load spec file contents. Use these as the AUTHORITATIVE source.
21
+ 3. If spec changes are needed, update spec files FIRST, then call `openuispec_check`.
22
+ 4. Generate or update the platform UI code based on the spec contents.
23
+
24
+ **Post-generation (EVERY TIME after writing UI code):**
25
+ 5. Call `openuispec_check` to validate spec integrity.
26
+ 6. Call `openuispec_read_specs` for the screens/contracts you just generated code for.
27
+ 7. Audit your generated code against the spec. For each screen, verify:
28
+ - Every field/action in the spec has a corresponding UI element
29
+ - Token values (colors, spacing, radii) match exactly — no approximations
30
+ - Contract `must_handle` states are all implemented (loading, error, empty, etc.)
31
+ - Adaptive breakpoints match the spec's `size_classes`
32
+ - Locale keys match `$t:` references
33
+ - Navigation targets match flow definitions
34
+ 8. Report any real gaps found and fix them before finishing.
35
+
36
+ **Creating new spec files:**
37
+ - Call `openuispec_spec_types` to discover available spec types.
38
+ - Call `openuispec_spec_schema` with the specific type to get the full JSON schema.
39
+ - Write the spec file following the schema exactly.
40
+
41
+ **Other tools:**
42
+ - `openuispec_status` — cross-target summary, good starting point
43
+ - `openuispec_drift` with `explain: true` — property-level spec changes
44
+ - `openuispec_validate` — schema-only validation by group
45
+
46
+ ### CLI fallback (when MCP is not available)
47
+
48
+ If MCP tools are not available, use these CLI commands with `--json` flag:
49
+ - `openuispec prepare --target <t> --json` — build AI-ready work bundle
50
+ - `openuispec check --target <t> --json` — composite validation
51
+ - `openuispec status --json` — cross-target status
52
+ - `openuispec drift --target <t> --explain --json` — semantic drift
53
+ - `openuispec validate [group...] --json` — schema validation
54
+
55
+ ### Other CLI commands
56
+ - `openuispec init` — scaffold a new spec project
57
+ - `openuispec drift --snapshot --target <t>` — snapshot current state (only after UI code is updated)
58
+ - `openuispec configure-target <t>` — configure target platform stack
59
+ - `openuispec update-rules` — update AI rules to match installed package version
60
+
61
+ ## Spec format reference
62
+
63
+ The spec format, schemas, and generation rules are in the installed `openuispec` package.
64
+ You MUST read the reference files before creating or editing spec files — do NOT guess the format.
65
+
66
+ **Find the package:** `node_modules/openuispec/` or run `npm root -g` → `<prefix>/openuispec/`.
67
+ **Online fallback:** `https://openuispec.rsteam.uz/llms-full.txt`
68
+
69
+ **Reference files (read in order):**
70
+ 1. `README.md` — schema tables, file format, root wrapper keys
71
+ 2. `spec/openuispec-v0.1.md` — full specification
72
+ 3. `examples/taskflow/openuispec/` — complete working example
73
+ 4. `schema/` — JSON Schemas for every file type
74
+
75
+ ## Spec location
76
+ - Spec root: `openuispec/` — read `openuispec/openuispec.yaml` first for actual paths.
77
+ - Default dirs: tokens/, screens/, flows/, contracts/, platform/, locales/
78
+
79
+ ## When to start from spec vs platform code
80
+
81
+ **Spec-first** (use `openuispec_prepare` or `openuispec prepare`):
82
+ - Screen structure, navigation, fields, actions, validation, data binding changes
83
+ - Token, variant, contract, flow, or localization changes
84
+ - Changes affecting multiple platforms
85
+ - Requests in product/UI terms
86
+
87
+ **Platform-first** (skip spec tools):
88
+ - Platform-specific polish (iOS-only, Android-only, web-only)
89
+ - Local bug fixes that don't alter shared semantic behavior
90
+
91
+ ## If spec directories are empty (first-time setup)
92
+
93
+ Read `spec/openuispec-v0.1.md` from the package first, then:
94
+ 1. Scan codebase for UI screens → create `openuispec/screens/<name>.yaml` as `status: stub`
95
+ 2. Extract tokens (colors, fonts, spacing) → `openuispec/tokens/`
96
+ 3. Create contract extensions → `openuispec/contracts/`
97
+ 4. Create locale files → `openuispec/locales/<locale>.json`
98
+ 5. Fill in `data_model`, `api.endpoints` in `openuispec/openuispec.yaml`
99
+
100
+ ## Rules
101
+ - Do not snapshot drift unless the UI code has also been updated.
102
+ - Do not modify generated UI without checking whether the spec must change first.
103
+ - Do not use `configure-target --defaults` as silent approval — ask the user to confirm.
104
+ - Always read spec format from the installed package, not from cached/memorized content.
105
+ <!-- openuispec-rules-end -->
@@ -0,0 +1,105 @@
1
+ <!-- openuispec-rules-start -->
2
+ <!-- openuispec-rules-version: 0.1.45 -->
3
+ # OpenUISpec — AI Assistant Rules
4
+ # ================================
5
+ # This project uses OpenUISpec to define UI as a semantic spec.
6
+ # Spec files are the single source of truth for all UI across platforms.
7
+ # Targets: "ios", "android", "web"
8
+
9
+ ## MANDATORY — UI work requires OpenUISpec tools
10
+
11
+ When the user's request involves UI — screens, navigation, layout, tokens, flows, localization,
12
+ or any visual/structural change — you MUST use the OpenUISpec tools before writing any code.
13
+
14
+ ### MCP Tools (use these when available)
15
+
16
+ Call these MCP tools directly. They return structured JSON with everything you need.
17
+
18
+ **Pre-generation:**
19
+ 1. Call `openuispec_prepare` with the target platform — returns spec context, platform config, constraints.
20
+ 2. Call `openuispec_read_specs` to load spec file contents. Use these as the AUTHORITATIVE source.
21
+ 3. If spec changes are needed, update spec files FIRST, then call `openuispec_check`.
22
+ 4. Generate or update the platform UI code based on the spec contents.
23
+
24
+ **Post-generation (EVERY TIME after writing UI code):**
25
+ 5. Call `openuispec_check` to validate spec integrity.
26
+ 6. Call `openuispec_read_specs` for the screens/contracts you just generated code for.
27
+ 7. Audit your generated code against the spec. For each screen, verify:
28
+ - Every field/action in the spec has a corresponding UI element
29
+ - Token values (colors, spacing, radii) match exactly — no approximations
30
+ - Contract `must_handle` states are all implemented (loading, error, empty, etc.)
31
+ - Adaptive breakpoints match the spec's `size_classes`
32
+ - Locale keys match `$t:` references
33
+ - Navigation targets match flow definitions
34
+ 8. Report any real gaps found and fix them before finishing.
35
+
36
+ **Creating new spec files:**
37
+ - Call `openuispec_spec_types` to discover available spec types.
38
+ - Call `openuispec_spec_schema` with the specific type to get the full JSON schema.
39
+ - Write the spec file following the schema exactly.
40
+
41
+ **Other tools:**
42
+ - `openuispec_status` — cross-target summary, good starting point
43
+ - `openuispec_drift` with `explain: true` — property-level spec changes
44
+ - `openuispec_validate` — schema-only validation by group
45
+
46
+ ### CLI fallback (when MCP is not available)
47
+
48
+ If MCP tools are not available, use these CLI commands with `--json` flag:
49
+ - `openuispec prepare --target <t> --json` — build AI-ready work bundle
50
+ - `openuispec check --target <t> --json` — composite validation
51
+ - `openuispec status --json` — cross-target status
52
+ - `openuispec drift --target <t> --explain --json` — semantic drift
53
+ - `openuispec validate [group...] --json` — schema validation
54
+
55
+ ### Other CLI commands
56
+ - `openuispec init` — scaffold a new spec project
57
+ - `openuispec drift --snapshot --target <t>` — snapshot current state (only after UI code is updated)
58
+ - `openuispec configure-target <t>` — configure target platform stack
59
+ - `openuispec update-rules` — update AI rules to match installed package version
60
+
61
+ ## Spec format reference
62
+
63
+ The spec format, schemas, and generation rules are in the installed `openuispec` package.
64
+ You MUST read the reference files before creating or editing spec files — do NOT guess the format.
65
+
66
+ **Find the package:** `node_modules/openuispec/` or run `npm root -g` → `<prefix>/openuispec/`.
67
+ **Online fallback:** `https://openuispec.rsteam.uz/llms-full.txt`
68
+
69
+ **Reference files (read in order):**
70
+ 1. `README.md` — schema tables, file format, root wrapper keys
71
+ 2. `spec/openuispec-v0.1.md` — full specification
72
+ 3. `examples/taskflow/openuispec/` — complete working example
73
+ 4. `schema/` — JSON Schemas for every file type
74
+
75
+ ## Spec location
76
+ - Spec root: `openuispec/` — read `openuispec/openuispec.yaml` first for actual paths.
77
+ - Default dirs: tokens/, screens/, flows/, contracts/, platform/, locales/
78
+
79
+ ## When to start from spec vs platform code
80
+
81
+ **Spec-first** (use `openuispec_prepare` or `openuispec prepare`):
82
+ - Screen structure, navigation, fields, actions, validation, data binding changes
83
+ - Token, variant, contract, flow, or localization changes
84
+ - Changes affecting multiple platforms
85
+ - Requests in product/UI terms
86
+
87
+ **Platform-first** (skip spec tools):
88
+ - Platform-specific polish (iOS-only, Android-only, web-only)
89
+ - Local bug fixes that don't alter shared semantic behavior
90
+
91
+ ## If spec directories are empty (first-time setup)
92
+
93
+ Read `spec/openuispec-v0.1.md` from the package first, then:
94
+ 1. Scan codebase for UI screens → create `openuispec/screens/<name>.yaml` as `status: stub`
95
+ 2. Extract tokens (colors, fonts, spacing) → `openuispec/tokens/`
96
+ 3. Create contract extensions → `openuispec/contracts/`
97
+ 4. Create locale files → `openuispec/locales/<locale>.json`
98
+ 5. Fill in `data_model`, `api.endpoints` in `openuispec/openuispec.yaml`
99
+
100
+ ## Rules
101
+ - Do not snapshot drift unless the UI code has also been updated.
102
+ - Do not modify generated UI without checking whether the spec must change first.
103
+ - Do not use `configure-target --defaults` as silent approval — ask the user to confirm.
104
+ - Always read spec format from the installed package, not from cached/memorized content.
105
+ <!-- openuispec-rules-end -->
@@ -0,0 +1,19 @@
1
+ # social-app
2
+
3
+ Test project for exercising the local [`openuispec`](../openuispec) checkout.
4
+
5
+ ## Structure
6
+
7
+ - `openuispec/` contains the spec scaffold.
8
+ - `AGENTS.md` and `CLAUDE.md` include the OpenUISpec assistant rules generated by the local CLI.
9
+
10
+ ## Commands
11
+
12
+ ```bash
13
+ npm run validate
14
+ npm run validate:semantic
15
+ npm run status
16
+ npm run openuispec -- init
17
+ ```
18
+
19
+ The scripts call the local `../openuispec` repo directly, so this project can be used without installing `openuispec` globally.
@@ -0,0 +1,92 @@
1
+ plugins {
2
+ alias(libs.plugins.android.application)
3
+ alias(libs.plugins.compose.compiler)
4
+ kotlin("plugin.serialization")
5
+ }
6
+
7
+ android {
8
+ namespace = "com.social.app"
9
+ compileSdk = 36
10
+
11
+ defaultConfig {
12
+ applicationId = "com.social.app"
13
+ minSdk = 26
14
+ targetSdk = 36
15
+ versionCode = 1
16
+ versionName = "1.0"
17
+
18
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19
+ vectorDrawables {
20
+ useSupportLibrary = true
21
+ }
22
+ }
23
+
24
+ buildTypes {
25
+ release {
26
+ isMinifyEnabled = false
27
+ proguardFiles(
28
+ getDefaultProguardFile("proguard-android-optimize.txt"),
29
+ "proguard-rules.pro"
30
+ )
31
+ }
32
+ }
33
+ compileOptions {
34
+ sourceCompatibility = JavaVersion.VERSION_11
35
+ targetCompatibility = JavaVersion.VERSION_11
36
+ }
37
+ kotlin {
38
+ compilerOptions {
39
+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
40
+ }
41
+ }
42
+ buildFeatures {
43
+ compose = true
44
+ }
45
+ packaging {
46
+ resources {
47
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
48
+ }
49
+ }
50
+ }
51
+
52
+ dependencies {
53
+ implementation(libs.androidx.core.ktx)
54
+ implementation(libs.androidx.lifecycle.runtime.ktx)
55
+ implementation(libs.androidx.activity.compose)
56
+ implementation(platform(libs.androidx.compose.bom))
57
+ implementation(libs.androidx.ui)
58
+ implementation(libs.androidx.ui.graphics)
59
+ implementation(libs.androidx.ui.tooling.preview)
60
+ implementation(libs.androidx.material3)
61
+ implementation(libs.androidx.material.icons.extended)
62
+ implementation(libs.google.material)
63
+ implementation(libs.coil.compose)
64
+ implementation(libs.coil.network)
65
+
66
+ // Decompose
67
+ implementation(libs.decompose)
68
+ implementation(libs.decompose.extensions.compose)
69
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
70
+
71
+ // MVIKotlin
72
+ implementation(libs.mvikotlin)
73
+ implementation(libs.mvikotlin.main)
74
+ implementation(libs.mvikotlin.logging)
75
+ implementation("com.arkivanov.mvikotlin:mvikotlin-extensions-coroutines:4.3.0")
76
+
77
+ // Essenty
78
+ implementation(libs.essenty.lifecycle)
79
+ implementation(libs.essenty.instancekeeper)
80
+
81
+ // DataStore
82
+ implementation(libs.androidx.datastore.preferences)
83
+ implementation(libs.androidx.datastore.core)
84
+
85
+ testImplementation("junit:junit:4.13.2")
86
+ androidTestImplementation("androidx.test.ext:junit:1.2.1")
87
+ androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
88
+ androidTestImplementation(platform(libs.androidx.compose.bom))
89
+ androidTestImplementation("androidx.compose.ui:ui-test-junit4")
90
+ debugImplementation(libs.androidx.ui.tooling)
91
+ debugImplementation("androidx.compose.ui:ui-test-manifest")
92
+ }
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+ <uses-permission android:name="android.permission.INTERNET" />
5
+
6
+ <application
7
+ android:name=".SocialAppApplication"
8
+ android:allowBackup="true"
9
+ android:icon="@mipmap/ic_launcher"
10
+ android:label="@string/nav_home"
11
+ android:roundIcon="@mipmap/ic_launcher_round"
12
+ android:supportsRtl="true"
13
+ android:theme="@style/Theme.SocialApp">
14
+ <activity
15
+ android:name=".MainActivity"
16
+ android:exported="true"
17
+ android:label="@string/nav_home"
18
+ android:theme="@style/Theme.SocialApp">
19
+ <intent-filter>
20
+ <action android:name="android.intent.action.MAIN" />
21
+ <category android:name="android.intent.category.LAUNCHER" />
22
+ </intent-filter>
23
+ </activity>
24
+ </application>
25
+
26
+ </manifest>
@@ -0,0 +1,20 @@
1
+ package com.social.app
2
+
3
+ import android.content.Context
4
+ import com.arkivanov.decompose.ComponentContext
5
+ import com.arkivanov.mvikotlin.core.store.StoreFactory
6
+ import com.social.app.data.preferences.DataStorePreferencesRepository
7
+ import com.social.app.data.preferences.PreferencesRepository
8
+ import com.social.app.ui.navigation.DefaultRootComponent
9
+ import com.social.app.ui.navigation.RootComponent
10
+ import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
11
+ import com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory
12
+
13
+ class AppContainer(
14
+ context: Context,
15
+ ) {
16
+ val preferencesRepository: PreferencesRepository = DataStorePreferencesRepository(context.applicationContext)
17
+ val storeFactory: StoreFactory = LoggingStoreFactory(DefaultStoreFactory())
18
+
19
+ fun createRootComponent(componentContext: ComponentContext): RootComponent = DefaultRootComponent(componentContext)
20
+ }
@@ -0,0 +1,35 @@
1
+ package com.social.app
2
+
3
+ import android.os.Bundle
4
+ import androidx.activity.ComponentActivity
5
+ import androidx.activity.compose.setContent
6
+ import androidx.activity.enableEdgeToEdge
7
+ import androidx.compose.runtime.collectAsState
8
+ import androidx.compose.runtime.getValue
9
+ import com.arkivanov.decompose.defaultComponentContext
10
+ import com.social.app.data.preferences.AppPreferences
11
+ import com.social.app.ui.MainShell
12
+ import com.social.app.ui.theme.SocialAppTheme
13
+
14
+ class MainActivity : ComponentActivity() {
15
+ override fun onCreate(savedInstanceState: Bundle?) {
16
+ super.onCreate(savedInstanceState)
17
+ val appContainer = (application as SocialAppApplication).appContainer
18
+ val root = appContainer.createRootComponent(defaultComponentContext())
19
+
20
+ enableEdgeToEdge()
21
+ setContent {
22
+ val preferences by appContainer.preferencesRepository.preferences.collectAsState(initial = AppPreferences())
23
+
24
+ SocialAppTheme(
25
+ themeMode = preferences.themeMode,
26
+ ) {
27
+ MainShell(
28
+ root = root,
29
+ preferencesRepository = appContainer.preferencesRepository,
30
+ storeFactory = appContainer.storeFactory,
31
+ )
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,13 @@
1
+ package com.social.app
2
+
3
+ import android.app.Application
4
+
5
+ class SocialAppApplication : Application() {
6
+ lateinit var appContainer: AppContainer
7
+ private set
8
+
9
+ override fun onCreate() {
10
+ super.onCreate()
11
+ appContainer = AppContainer(this)
12
+ }
13
+ }
@@ -0,0 +1,98 @@
1
+ package com.social.app.data
2
+
3
+ import com.social.app.model.*
4
+
5
+ object MockData {
6
+ val users = listOf(
7
+ User(
8
+ id = "user_me",
9
+ handle = "rustam",
10
+ displayName = "Rustam Abdurahmonov",
11
+ avatarUrl = "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=320&q=80",
12
+ bio = "Designing interface systems that feel editorial, human, and alive.",
13
+ followers = 1240,
14
+ following = 184
15
+ ),
16
+ User(
17
+ id = "u_9921",
18
+ handle = "elara_vox",
19
+ displayName = "Elara Vance",
20
+ avatarUrl = "https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&w=256&q=80",
21
+ bio = "Digital Architect | Exploring the intersection of AR and urban spaces 🏙️",
22
+ followers = 12400,
23
+ following = 842,
24
+ isFollowed = true
25
+ ),
26
+ User(
27
+ id = "u_4432",
28
+ handle = "kai_zen",
29
+ displayName = "Kai Nakamura",
30
+ avatarUrl = "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=256&q=80",
31
+ bio = "Sustainable tech & minimalist living. 🌿 Tokyo -> Berlin",
32
+ followers = 3100,
33
+ following = 1100
34
+ )
35
+ )
36
+
37
+ val posts = listOf(
38
+ Post(
39
+ id = "p_77102",
40
+ authorId = "u_9921",
41
+ authorName = "Elara Vance",
42
+ authorHandle = "elara_vox",
43
+ authorAvatar = "https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&w=256&q=80",
44
+ body = "The new Neo-Tokyo district looks incredible in the morning light. The AR overlays are finally syncing perfectly with the physical architecture. #FutureCity #DigitalTwin #2026",
45
+ mediaUrl = "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?auto=format&fit=crop&w=1080&q=80",
46
+ likeCount = 1432,
47
+ commentCount = 42,
48
+ timestamp = "4 hours ago",
49
+ liked = true
50
+ ),
51
+ Post(
52
+ id = "p_77103",
53
+ authorId = "u_4432",
54
+ authorName = "Kai Nakamura",
55
+ authorHandle = "kai_zen",
56
+ authorAvatar = "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=256&q=80",
57
+ body = "Workspace evolution. Keeping it clean and focused this year.",
58
+ mediaUrl = "https://images.unsplash.com/photo-1497366216548-37526070297c?auto=format&fit=crop&w=1080&q=80",
59
+ likeCount = 890,
60
+ commentCount = 15,
61
+ timestamp = "9 hours ago"
62
+ ),
63
+ Post(
64
+ id = "p_1",
65
+ authorId = "user_me",
66
+ authorName = "Rustam Abdurahmonov",
67
+ authorHandle = "rustam",
68
+ authorAvatar = "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=320&q=80",
69
+ body = "Spent the morning photographing a cafe before it opened. The cups were already warm, the chairs still slightly crooked. Those in-between moments always feel the most honest.",
70
+ mediaUrl = "https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?auto=format&fit=crop&w=1200&q=80",
71
+ likeCount = 243,
72
+ commentCount = 12,
73
+ timestamp = "1 day ago"
74
+ )
75
+ )
76
+
77
+ val stories = listOf(
78
+ Story(id = "s_1", authorId = "u_9921", authorName = "Elara Vance", previewUrl = "https://images.unsplash.com/photo-1550745165-9bc0b252726f?auto=format&fit=crop&w=720&q=80"),
79
+ Story(id = "s_2", authorId = "u_4432", authorName = "Kai Nakamura", previewUrl = "https://images.unsplash.com/photo-1511467687858-23d96c32e4ae?auto=format&fit=crop&w=720&q=80"),
80
+ Story(id = "s_3", authorId = "user_me", authorName = "Rustam", previewUrl = "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=320&q=80")
81
+ )
82
+
83
+ val trends = listOf(
84
+ Trend(id = "t_1", label = "Editorial UI", postCount = 8420),
85
+ Trend(id = "t_2", label = "Warm Brutalism", postCount = 4135),
86
+ Trend(id = "t_3", label = "Motion Details", postCount = 2940),
87
+ Trend(id = "t_4", label = "Design Systems", postCount = 8677)
88
+ )
89
+
90
+ val notifications = listOf(
91
+ Notification(id = "n_1", type = "like", actorName = "Elara Vance", actorAvatar = "https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&w=256&q=80", message = "liked your post", timestamp = "34m ago"),
92
+ Notification(id = "n_2", type = "comment", actorName = "Kai Nakamura", actorAvatar = "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=256&q=80", message = "commented on your post", timestamp = "7h ago"),
93
+ Notification(id = "n_3", type = "follow", actorName = "Elara Vance", actorAvatar = "https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&w=256&q=80", message = "started following you", timestamp = "1d ago")
94
+ )
95
+ }
96
+
97
+ data class Trend(val id: String, val label: String, val postCount: Int)
98
+ data class Notification(val id: String, val type: String, val actorName: String, val actorAvatar: String?, val message: String, val timestamp: String)
@@ -0,0 +1,19 @@
1
+ package com.social.app.data.preferences
2
+
3
+ enum class ThemeMode(val storageValue: String) {
4
+ System("system"),
5
+ Light("light"),
6
+ Dark("dark");
7
+
8
+ companion object {
9
+ fun fromStorageValue(value: String?): ThemeMode =
10
+ entries.firstOrNull { it.storageValue == value } ?: System
11
+ }
12
+ }
13
+
14
+ data class AppPreferences(
15
+ val themeMode: ThemeMode = ThemeMode.System,
16
+ val pushNotifications: Boolean = true,
17
+ val messagePreviews: Boolean = true,
18
+ val autoTranslate: Boolean = false,
19
+ )
@@ -0,0 +1,68 @@
1
+ package com.social.app.data.preferences
2
+
3
+ import android.content.Context
4
+ import androidx.datastore.core.DataStore
5
+ import androidx.datastore.preferences.core.Preferences
6
+ import androidx.datastore.preferences.core.booleanPreferencesKey
7
+ import androidx.datastore.preferences.core.edit
8
+ import androidx.datastore.preferences.core.emptyPreferences
9
+ import androidx.datastore.preferences.core.stringPreferencesKey
10
+ import androidx.datastore.preferences.preferencesDataStore
11
+ import java.io.IOException
12
+ import kotlinx.coroutines.flow.Flow
13
+ import kotlinx.coroutines.flow.catch
14
+ import kotlinx.coroutines.flow.map
15
+
16
+ private val Context.socialAppDataStore: DataStore<Preferences> by preferencesDataStore(name = "social_app_preferences")
17
+
18
+ class DataStorePreferencesRepository(
19
+ private val context: Context,
20
+ ) : PreferencesRepository {
21
+ override val preferences: Flow<AppPreferences> =
22
+ context.socialAppDataStore.data
23
+ .catch { exception ->
24
+ if (exception is IOException) {
25
+ emit(emptyPreferences())
26
+ } else {
27
+ throw exception
28
+ }
29
+ }.map { storedPreferences ->
30
+ AppPreferences(
31
+ themeMode = ThemeMode.fromStorageValue(storedPreferences[Keys.ThemeMode]),
32
+ pushNotifications = storedPreferences[Keys.PushNotifications] ?: true,
33
+ messagePreviews = storedPreferences[Keys.MessagePreviews] ?: true,
34
+ autoTranslate = storedPreferences[Keys.AutoTranslate] ?: false,
35
+ )
36
+ }
37
+
38
+ override suspend fun updateThemeMode(themeMode: ThemeMode) {
39
+ context.socialAppDataStore.edit { storedPreferences ->
40
+ storedPreferences[Keys.ThemeMode] = themeMode.storageValue
41
+ }
42
+ }
43
+
44
+ override suspend fun updatePushNotifications(enabled: Boolean) {
45
+ context.socialAppDataStore.edit { storedPreferences ->
46
+ storedPreferences[Keys.PushNotifications] = enabled
47
+ }
48
+ }
49
+
50
+ override suspend fun updateMessagePreviews(enabled: Boolean) {
51
+ context.socialAppDataStore.edit { storedPreferences ->
52
+ storedPreferences[Keys.MessagePreviews] = enabled
53
+ }
54
+ }
55
+
56
+ override suspend fun updateAutoTranslate(enabled: Boolean) {
57
+ context.socialAppDataStore.edit { storedPreferences ->
58
+ storedPreferences[Keys.AutoTranslate] = enabled
59
+ }
60
+ }
61
+
62
+ private object Keys {
63
+ val ThemeMode = stringPreferencesKey("theme_mode")
64
+ val PushNotifications = booleanPreferencesKey("push_notifications")
65
+ val MessagePreviews = booleanPreferencesKey("message_previews")
66
+ val AutoTranslate = booleanPreferencesKey("auto_translate")
67
+ }
68
+ }