anhedral 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +82 -34
  2. package/assets/stack/ai-schema.ts.txt +5 -0
  3. package/assets/stack/ai.ts.txt +30 -0
  4. package/assets/stack/api-index.ts.txt +15 -0
  5. package/assets/stack/auth-features.ts.txt +4 -0
  6. package/assets/stack/auth-journal.json.txt +13 -0
  7. package/assets/stack/auth-migration.sql.txt +53 -0
  8. package/assets/stack/auth-routes.ts.txt +11 -0
  9. package/assets/stack/auth-schema.ts.txt +64 -0
  10. package/assets/stack/auth-snapshot.json.txt +346 -0
  11. package/assets/stack/auth.ts.txt +32 -0
  12. package/assets/stack/billing-mode.ts.txt +8 -0
  13. package/assets/stack/billing-schema.ts.txt +11 -0
  14. package/assets/stack/desktop.rs.txt +21 -0
  15. package/assets/stack/entitlement-guard.ts.txt +32 -0
  16. package/assets/stack/entitlements.ts.txt +8 -0
  17. package/assets/stack/events-schema.ts.txt +12 -0
  18. package/assets/stack/events.ts.txt +59 -0
  19. package/assets/stack/mobile-auth.ts.txt +25 -0
  20. package/assets/stack/mobile-billing.tsx.txt +63 -0
  21. package/assets/stack/mobile-session.tsx.txt +83 -0
  22. package/assets/stack/native-button.tsx.txt +108 -0
  23. package/assets/stack/native-global.css.txt +4 -0
  24. package/assets/stack/native-lib-utils.ts.txt +5 -0
  25. package/assets/stack/native-metro.config.js.txt +6 -0
  26. package/assets/stack/native-nativewind-env.d.ts.txt +1 -0
  27. package/assets/stack/native-tailwind.config.js.txt +73 -0
  28. package/assets/stack/native-text.tsx.txt +89 -0
  29. package/assets/stack/purchases.ts.txt +65 -0
  30. package/assets/stack/revenuecat.ts.txt +88 -0
  31. package/assets/stack/rtc-schema.ts.txt +10 -0
  32. package/assets/stack/rtc.ts.txt +122 -0
  33. package/assets/stack/security.ts.txt +31 -0
  34. package/assets/stack/storage.ts.txt +36 -0
  35. package/assets/stack/stripe.ts.txt +126 -0
  36. package/assets/stack/web-sign-in.tsx.txt +51 -0
  37. package/assets/ui/LICENSE.react-native-reusables +21 -0
  38. package/assets/ui/UPSTREAM.json +0 -11
  39. package/assets/ui/catalog.json +891 -0
  40. package/assets/ui/extensions/registry.json +6 -0
  41. package/dist/bin.js +7 -12
  42. package/dist/capabilities.d.ts +4 -33
  43. package/dist/capabilities.js +2 -66
  44. package/dist/capability-catalog.d.ts +83 -0
  45. package/dist/capability-catalog.js +121 -0
  46. package/dist/capability-command.d.ts +3 -0
  47. package/dist/capability-command.js +188 -0
  48. package/dist/capability-editor.d.ts +17 -0
  49. package/dist/capability-editor.js +97 -0
  50. package/dist/capability-recipes.d.ts +4 -0
  51. package/dist/capability-recipes.js +520 -0
  52. package/dist/capability-references.d.ts +4 -0
  53. package/dist/capability-references.js +7 -0
  54. package/dist/cli-commands.d.ts +1 -2
  55. package/dist/cli-commands.js +10 -104
  56. package/dist/cli-output.d.ts +1 -2
  57. package/dist/cli-output.js +6 -251
  58. package/dist/command-schema.js +39 -322
  59. package/dist/dependencies.d.ts +29 -9
  60. package/dist/dependencies.js +57 -64
  61. package/dist/index.d.ts +1 -42
  62. package/dist/index.js +1 -27
  63. package/dist/platforms/web.d.ts +1 -1
  64. package/dist/platforms/web.js +27 -75
  65. package/dist/project-config.d.ts +2 -13
  66. package/dist/project-config.js +10 -82
  67. package/dist/registry/options.js +1 -5
  68. package/dist/registry/resolve.d.ts +1 -1
  69. package/dist/registry/resolve.js +4 -10
  70. package/dist/registry/usage.js +3 -9
  71. package/dist/scaffold/backend.js +0 -3
  72. package/dist/scaffold/database.js +2 -1
  73. package/dist/scaffold/documentation.js +56 -25
  74. package/dist/scaffold/stack-documentation.js +1 -1
  75. package/dist/scaffold/storage.d.ts +2 -0
  76. package/dist/scaffold/storage.js +21 -0
  77. package/dist/scaffold/workspace.js +21 -22
  78. package/dist/stack-registry.d.ts +2 -10
  79. package/dist/stack-registry.js +12 -98
  80. package/dist/standard.js +1 -11
  81. package/dist/ui-catalog.d.ts +26 -0
  82. package/dist/ui-catalog.js +31 -0
  83. package/dist/ui-command.d.ts +3 -0
  84. package/dist/ui-command.js +219 -0
  85. package/dist/ui-project.d.ts +22 -0
  86. package/dist/ui-project.js +110 -0
  87. package/dist/version.d.ts +1 -1
  88. package/dist/version.js +1 -1
  89. package/docs/anhedral-stack.md +12 -23
  90. package/docs/assets/anhedral-stack-light.png +0 -0
  91. package/docs/assets/anhedral-stack.png +0 -0
  92. package/docs/capabilities.md +110 -0
  93. package/docs/native-ui.md +47 -0
  94. package/docs/software-factory.md +35 -50
  95. package/docs/stack-standard.md +19 -70
  96. package/docs/ui.md +33 -0
  97. package/docs/verification.md +6 -876
  98. package/package.json +21 -16
  99. package/assets/ui/native/button.tsx +0 -85
  100. package/assets/ui/native/card.tsx +0 -33
  101. package/assets/ui/native/dialog.tsx +0 -75
  102. package/assets/ui/native/input.tsx +0 -27
  103. package/assets/ui/native/label.tsx +0 -4
  104. package/assets/ui/native/layout.tsx +0 -26
  105. package/assets/ui/native/text.tsx +0 -20
  106. package/assets/ui/native/theme-switcher.tsx +0 -22
  107. package/assets/ui/theme-storage.ts +0 -25
  108. package/assets/ui/theme.tsx +0 -66
  109. package/dist/access.d.ts +0 -10
  110. package/dist/access.js +0 -93
  111. package/dist/auth-schema-snapshot.d.ts +0 -346
  112. package/dist/auth-schema-snapshot.js +0 -347
  113. package/dist/auth-schema.d.ts +0 -1
  114. package/dist/auth-schema.js +0 -57
  115. package/dist/capability-contract.d.ts +0 -47
  116. package/dist/capability-contract.js +0 -129
  117. package/dist/catalog-model.d.ts +0 -24
  118. package/dist/catalog-model.js +0 -1
  119. package/dist/catalog-registration.d.ts +0 -16
  120. package/dist/catalog-registration.js +0 -22
  121. package/dist/catalog-snapshot.d.ts +0 -5
  122. package/dist/catalog-snapshot.js +0 -97
  123. package/dist/cli-delivery.d.ts +0 -3
  124. package/dist/cli-delivery.js +0 -112
  125. package/dist/cloudflare.d.ts +0 -25
  126. package/dist/cloudflare.js +0 -226
  127. package/dist/delivery-evidence.d.ts +0 -62
  128. package/dist/delivery-evidence.js +0 -157
  129. package/dist/delivery.d.ts +0 -82
  130. package/dist/delivery.js +0 -489
  131. package/dist/inspector-model.d.ts +0 -123
  132. package/dist/inspector-model.js +0 -1
  133. package/dist/integration-service-readers.d.ts +0 -12
  134. package/dist/integration-service-readers.js +0 -92
  135. package/dist/lifecycle-model.d.ts +0 -15
  136. package/dist/lifecycle-model.js +0 -20
  137. package/dist/lifecycle.d.ts +0 -11
  138. package/dist/lifecycle.js +0 -91
  139. package/dist/management.d.ts +0 -3
  140. package/dist/management.js +0 -47
  141. package/dist/mobile-delivery.d.ts +0 -77
  142. package/dist/mobile-delivery.js +0 -370
  143. package/dist/platforms/mobile.d.ts +0 -2
  144. package/dist/platforms/mobile.js +0 -156
  145. package/dist/project-catalog.d.ts +0 -41
  146. package/dist/project-catalog.js +0 -288
  147. package/dist/project-inspector.d.ts +0 -4
  148. package/dist/project-inspector.js +0 -671
  149. package/dist/project-lifecycle.d.ts +0 -25
  150. package/dist/project-lifecycle.js +0 -57
  151. package/dist/project-state.d.ts +0 -47
  152. package/dist/project-state.js +0 -480
  153. package/dist/provider-auth.d.ts +0 -41
  154. package/dist/provider-auth.js +0 -180
  155. package/dist/provider-readiness.d.ts +0 -30
  156. package/dist/provider-readiness.js +0 -85
  157. package/dist/providers/adapters.d.ts +0 -17
  158. package/dist/providers/adapters.js +0 -103
  159. package/dist/providers/api.d.ts +0 -29
  160. package/dist/providers/api.js +0 -253
  161. package/dist/providers/config.d.ts +0 -15
  162. package/dist/providers/config.js +0 -136
  163. package/dist/providers/definitions.d.ts +0 -115
  164. package/dist/providers/definitions.js +0 -42
  165. package/dist/providers/provision.d.ts +0 -24
  166. package/dist/providers/provision.js +0 -76
  167. package/dist/providers/receipts.d.ts +0 -20
  168. package/dist/providers/receipts.js +0 -56
  169. package/dist/providers/recovery-verification.d.ts +0 -7
  170. package/dist/providers/recovery-verification.js +0 -52
  171. package/dist/providers/recovery.d.ts +0 -30
  172. package/dist/providers/recovery.js +0 -34
  173. package/dist/providers/runtime.d.ts +0 -10
  174. package/dist/providers/runtime.js +0 -234
  175. package/dist/providers/schema.d.ts +0 -28
  176. package/dist/providers/schema.js +0 -49
  177. package/dist/providers/state.d.ts +0 -55
  178. package/dist/providers/state.js +0 -283
  179. package/dist/provision.d.ts +0 -47
  180. package/dist/provision.js +0 -208
  181. package/dist/r2-service-data.d.ts +0 -2
  182. package/dist/r2-service-data.js +0 -136
  183. package/dist/readiness.d.ts +0 -23
  184. package/dist/readiness.js +0 -117
  185. package/dist/registry/add.d.ts +0 -24
  186. package/dist/registry/add.js +0 -210
  187. package/dist/registry/bootstrap.d.ts +0 -3
  188. package/dist/registry/bootstrap.js +0 -5
  189. package/dist/registry/commands.d.ts +0 -3
  190. package/dist/registry/commands.js +0 -83
  191. package/dist/registry/preview.d.ts +0 -11
  192. package/dist/registry/preview.js +0 -91
  193. package/dist/registry/receipt.d.ts +0 -3
  194. package/dist/registry/receipt.js +0 -68
  195. package/dist/repository.d.ts +0 -24
  196. package/dist/repository.js +0 -96
  197. package/dist/scaffold/auth.d.ts +0 -2
  198. package/dist/scaffold/auth.js +0 -76
  199. package/dist/scaffold/billing-config.d.ts +0 -1
  200. package/dist/scaffold/billing-config.js +0 -73
  201. package/dist/scaffold/billing-contracts.d.ts +0 -2
  202. package/dist/scaffold/billing-contracts.js +0 -48
  203. package/dist/scaffold/billing-providers.d.ts +0 -1
  204. package/dist/scaffold/billing-providers.js +0 -249
  205. package/dist/scaffold/billing-schema.d.ts +0 -1
  206. package/dist/scaffold/billing-schema.js +0 -34
  207. package/dist/scaffold/billing-security.d.ts +0 -1
  208. package/dist/scaffold/billing-security.js +0 -46
  209. package/dist/scaffold/billing-server.d.ts +0 -1
  210. package/dist/scaffold/billing-server.js +0 -139
  211. package/dist/scaffold/billing-store.d.ts +0 -1
  212. package/dist/scaffold/billing-store.js +0 -72
  213. package/dist/scaffold/billing.d.ts +0 -2
  214. package/dist/scaffold/billing.js +0 -208
  215. package/dist/scaffold/expo-auth.d.ts +0 -3
  216. package/dist/scaffold/expo-auth.js +0 -203
  217. package/dist/scaffold/expo-billing.d.ts +0 -3
  218. package/dist/scaffold/expo-billing.js +0 -257
  219. package/dist/scaffold/expo-runtime.d.ts +0 -3
  220. package/dist/scaffold/expo-runtime.js +0 -43
  221. package/dist/scaffold/integrations.d.ts +0 -2
  222. package/dist/scaffold/integrations.js +0 -11
  223. package/dist/scaffold/managed-email.d.ts +0 -3
  224. package/dist/scaffold/managed-email.js +0 -47
  225. package/dist/scaffold/native-ui.d.ts +0 -2
  226. package/dist/scaffold/native-ui.js +0 -69
  227. package/dist/scaffold/password-reset.d.ts +0 -1
  228. package/dist/scaffold/password-reset.js +0 -99
  229. package/dist/scaffold/private-files.d.ts +0 -2
  230. package/dist/scaffold/private-files.js +0 -78
  231. package/dist/scaffold/web-billing.d.ts +0 -2
  232. package/dist/scaffold/web-billing.js +0 -48
  233. package/dist/service-deletion.d.ts +0 -29
  234. package/dist/service-deletion.js +0 -195
  235. package/dist/service-descriptor.d.ts +0 -10
  236. package/dist/service-descriptor.js +0 -71
  237. package/dist/service-model.d.ts +0 -49
  238. package/dist/service-model.js +0 -8
  239. package/dist/service-operations.d.ts +0 -29
  240. package/dist/service-operations.js +0 -48
  241. package/dist/service-readers.d.ts +0 -8
  242. package/dist/service-readers.js +0 -216
  243. package/dist/services-command.d.ts +0 -39
  244. package/dist/services-command.js +0 -96
  245. package/dist/ship.d.ts +0 -35
  246. package/dist/ship.js +0 -107
@@ -0,0 +1,110 @@
1
+ import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync, } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { UI_CATALOG } from './ui-catalog.js';
4
+ export function detectUiTargets(cwd, selector) {
5
+ let root = realpathSync(cwd);
6
+ let targets = [];
7
+ function inspect(directory) {
8
+ const file = path.join(directory, 'package.json');
9
+ if (!existsSync(file))
10
+ return;
11
+ const manifest = JSON.parse(readFileSync(file, 'utf8'));
12
+ const dependencies = { ...manifest.devDependencies, ...manifest.dependencies };
13
+ if (dependencies.next)
14
+ targets.push({ root: directory, platform: 'web', manifest });
15
+ if (dependencies.expo)
16
+ targets.push({ root: directory, platform: 'native', manifest });
17
+ }
18
+ for (;;) {
19
+ inspect(root);
20
+ if (!targets.length && existsSync(path.join(root, 'apps'))) {
21
+ for (const entry of readdirSync(path.join(root, 'apps'), { withFileTypes: true }))
22
+ if (entry.isDirectory() && !entry.isSymbolicLink())
23
+ inspect(path.join(root, 'apps', entry.name));
24
+ }
25
+ if (targets.length || existsSync(path.join(root, '.git')))
26
+ break;
27
+ const parent = path.dirname(root);
28
+ if (parent === root)
29
+ break;
30
+ root = parent;
31
+ }
32
+ if (selector && selector !== 'all')
33
+ targets = targets.filter((target) => target.platform === selector);
34
+ if (!targets.length)
35
+ throw Error('No matching Next.js or Expo application found. Use --cwd to select an application.');
36
+ if (targets.length > 1 && selector !== 'all')
37
+ throw Error('Multiple UI applications found. Select --web, --native, --all, or use --cwd for one application.');
38
+ if (new Set(targets.map((target) => target.root)).size !== targets.length)
39
+ throw Error('Web and native UI must use separate application directories.');
40
+ return targets;
41
+ }
42
+ export function inspectUiTarget(target) {
43
+ const issues = [];
44
+ const file = path.join(target.root, 'components.json');
45
+ const config = existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : null;
46
+ if (!config)
47
+ issues.push('Missing components.json. Run anhedral ui init for this application.');
48
+ if (config && (!config.aliases?.ui || !config.aliases?.utils || !config.tailwind?.css))
49
+ issues.push('components.json needs UI/utils aliases and a Tailwind CSS entry.');
50
+ const marker = path.join(target.root, '.anhedral-ui.json');
51
+ if (existsSync(marker) && JSON.parse(readFileSync(marker, 'utf8')).platform !== target.platform)
52
+ issues.push('Existing Anhedral UI configuration targets another platform.');
53
+ if (target.platform === 'native') {
54
+ const dependencies = { ...target.manifest.devDependencies, ...target.manifest.dependencies };
55
+ for (const dependency of [
56
+ 'class-variance-authority',
57
+ 'clsx',
58
+ 'tailwind-merge',
59
+ 'tailwindcss-animate',
60
+ '@rn-primitives/portal',
61
+ ])
62
+ if (!dependencies[dependency])
63
+ issues.push(`Missing RNR baseline dependency: ${dependency}. Complete the upstream setup first.`);
64
+ if (!/^\D*4\./.test(dependencies.nativewind ?? ''))
65
+ issues.push('Set up NativeWind 4 using the RNR manual guide before native UI installation.');
66
+ if (!['metro.config.js', 'metro.config.cjs', 'metro.config.ts'].some((name) => existsSync(path.join(target.root, name))))
67
+ issues.push('Missing Metro configuration. Complete the upstream NativeWind setup first.');
68
+ if (config?.rsc)
69
+ issues.push('Native components.json must set rsc to false.');
70
+ }
71
+ return {
72
+ root: target.root,
73
+ platform: target.platform,
74
+ configurationReady: issues.length === 0,
75
+ issues,
76
+ runtimeAcceptance: 'not evaluated',
77
+ guide: target.platform === 'native'
78
+ ? 'https://reactnativereusables.com/docs/installation/manual'
79
+ : 'https://ui.shadcn.com/docs/installation/next',
80
+ };
81
+ }
82
+ /** New metadata and attribution only; never overwrite consumer-owned files. */
83
+ export function initializeUiMetadata(root, platform) {
84
+ const file = path.join(root, '.anhedral-ui.json');
85
+ if (existsSync(file)) {
86
+ const existing = JSON.parse(readFileSync(file, 'utf8'));
87
+ if (existing.platform !== platform)
88
+ throw Error('Existing Anhedral UI configuration targets another platform.');
89
+ }
90
+ else
91
+ writeFileSync(file, JSON.stringify({
92
+ schemaVersion: 1,
93
+ platform,
94
+ catalogRevision: UI_CATALOG.revision,
95
+ nativeStyling: platform === 'native' ? UI_CATALOG.nativeStyling : undefined,
96
+ sourceOwned: true,
97
+ automaticUpdates: false,
98
+ }, null, 2) + '\n', { flag: 'wx' });
99
+ const licenses = path.join(root, 'ANHEDRAL_UI_LICENSES');
100
+ mkdirSync(licenses, { recursive: true });
101
+ for (const name of platform === 'native'
102
+ ? ['LICENSE.react-native-reusables', 'LICENSE.shadcn']
103
+ : ['LICENSE.shadcn']) {
104
+ const destination = path.join(licenses, name);
105
+ if (!existsSync(destination))
106
+ writeFileSync(destination, readFileSync(new URL(`../assets/ui/${name}`, import.meta.url)), {
107
+ flag: 'wx',
108
+ });
109
+ }
110
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const GENERATOR_VERSION = "0.15.0";
1
+ export declare const GENERATOR_VERSION = "0.17.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const GENERATOR_VERSION = '0.15.0';
1
+ export const GENERATOR_VERSION = '0.17.0';
@@ -1,23 +1,12 @@
1
- # Anhedral application stack
2
-
3
- <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="assets/anhedral-stack.png">
5
- <source media="(prefers-color-scheme: light)" srcset="assets/anhedral-stack-light.png">
6
- <img alt="Next.js web and Expo iOS/Android connect to Hono, Drizzle/D1 and private R2. Stripe and RevenueCat are optional payment additions." src="assets/anhedral-stack-light.png" width="1200">
7
- </picture>
8
-
9
- Every application starts with **Next.js web + Expo native + Hono + Drizzle/D1 + private R2**. Better Auth,
10
- shared contracts and design tokens support the foundation. Stripe and RevenueCat are
11
- the only optional additions; either can be selected independently.
12
-
13
- Hono owns authentication, authorization, data and private files. The Next.js App Router supports SSR and React Server Components through Cloudflare
14
- OpenNext. Web uses DOM shadcn UI; Expo iOS/Android uses the Anhedral native shadcn
15
- port. UI implementations share contracts and tokens, not browser/native primitives.
16
- Web API transport uses the `ANHEDRAL_API` service binding; native clients use the
17
- configured HTTPS API. Stripe checkout and RevenueCat purchases reconcile to
18
- shared server-enforced entitlements.
19
-
20
- Source generation is separate from resource provisioning, migrations and deployment.
21
- See the [stack standard](stack-standard.md) and [development workflow](software-factory.md).
22
- The editable [diagram source](https://github.com/anhedral/anhedral-cli/blob/main/docs/assets/render-stack.mjs)
23
- produces both themes from the same layout.
1
+ # Stack diagram
2
+
3
+ The [README](https://github.com/anhedral/anhedral-cli#readme) shows the complete
4
+ progressive scaffold. [Stack standard](stack-standard.md) owns architecture and
5
+ [capabilities](capabilities.md) owns composition and acceptance.
6
+
7
+ Regenerate the 1920 × 1080 light/dark SVGs with
8
+ `node docs/assets/render-stack.mjs`; add `--png` to export the README PNGs. This
9
+ uses checked-in vendor logo data offline. Supply `sharp` through the checkout or
10
+ `DOCS_NODE_MODULES`. Commit both themes/formats together. Keep vendor attribution
11
+ and the website's neutral theme adaptations when refreshing its shared layout.
12
+ The CLI README retains its navy artwork.
Binary file
@@ -0,0 +1,110 @@
1
+ # Progressive stack additions
2
+
3
+ New projects start with Next.js, OpenNext for Cloudflare Workers and Anhedral UI. Add only the parts required by the product. Nothing is called a commercial tier, and the specific “if needed” decisions remain open.
4
+
5
+ ```sh
6
+ anhedral init my-app
7
+ cd my-app
8
+ anhedral stack list
9
+ anhedral add hono --dry-run --json
10
+ anhedral add hono
11
+ anhedral add database-auth
12
+ anhedral stack status --json
13
+ ```
14
+
15
+ `anhedral add` writes editable source and local configuration, then installs dependencies unless `--skip-install` is selected. It does not create provider resources, install credentials, run migrations, deploy, publish clients, update installed plugins or register a managed project. These are source composition commands, separate from Anhedral Cloud operations.
16
+
17
+ ## Capabilities
18
+
19
+ | Name | Adds | Required source capabilities |
20
+ | --- | --- | --- |
21
+ | `hono` | API Worker, web proxy/service binding, health route | Next.js foundation |
22
+ | `database-auth` | Drizzle/D1, Better Auth, schema/migration tooling, web sign-in starter | `hono` |
23
+ | `r2` | Private R2 binding and authenticated owner-scoped file routes | `database-auth` |
24
+ | `stripe` | Stripe SDK, Checkout subscription starter, signed webhook receipts, canonical access checks | `database-auth` |
25
+ | `realtime` | Authenticated D1-backed events and resumable SSE | `database-auth` |
26
+ | `rtc` | Cloudflare Realtime SFU session/track adapter with ownership checks | `database-auth` |
27
+ | `ai` | Workers AI binding, authenticated text-generation route and atomic daily quota | `database-auth` |
28
+ | `expo` | Expo app and Better Auth/SecureStore client | `database-auth` |
29
+ | `native-ui` | NativeWind 4, shared theme CSS, RNR Button/Text starter, portal/root adapter, UI catalog metadata | `expo` |
30
+ | `revenuecat` | Native subscription SDK/UI, scoped webhooks and server-side entitlement reconciliation | `expo`, `stripe` |
31
+ | `wxt` | WXT React extension, scoped API host permission and editable popup | `database-auth` |
32
+ | `side-panel` | Chromium Side Panel entrypoint and background registration | `wxt` |
33
+ | `gpui` | Rust/GPUI desktop application and native build scripts | `database-auth` |
34
+
35
+ The progression is Next.js → Hono → database/auth, followed by independently selected branches. These are Anhedral's source-builder rules, not intrinsic restrictions of those technologies. `anhedral ui` still requires only the target Next.js or Expo application; it has no backend prerequisite. See [UI commands](ui.md).
36
+
37
+ ```sh
38
+ anhedral add expo native-ui --dry-run --json
39
+ anhedral add side-panel --with-dependencies --dry-run --json
40
+ anhedral add r2 stripe
41
+ anhedral add realtime rtc ai
42
+ ```
43
+
44
+ Missing prerequisites stop the command before writes. Explicitly list the parents in the same command, or choose `--with-dependencies` to include them in dependency order. There is no `add all` shortcut that silently chooses every optional branch.
45
+
46
+ ## Protecting existing applications
47
+
48
+ Additions require an Anhedral workspace with a Next.js foundation. They do not reinitialize it. All selected recipes are planned in memory before any installation. A late collision rejects the entire plan. JSON/JSONC changes preserve unrelated keys and comments; existing bindings and dependency pins that conflict require reconciliation. New source files never replace existing files.
49
+
50
+ CLI-owned composition adapters are fingerprinted in `anhedral.json`. Their edits are protected too: if an adapter was customized, a later addition stops rather than replacing it. Add business routes in `apps/api/src/index.ts`, custom binding/variable types in `custom-environment.ts`, auth methods in `auth-features.ts`/`auth.ts`, and native product UI in `apps/mobile/App.tsx`. Keep additional application behavior outside composition adapters.
51
+
52
+ Source writes use the existing journaled transaction/recovery implementation. Dependency resolution/install follows source commit; if installation fails, the CLI reports a post-commit error and retains the source for review and retry. Reviewed dependency patches are configured before the frozen install. `--skip-install` leaves dependency resolution/patch staging to a subsequent normal CLI installation or explicit consumer setup. `--dry-run` makes no writes or network requests, including transaction metadata.
53
+
54
+ Repeated additions leave source unchanged; the normal command still resolves and installs dependencies so it can recover from an earlier install failure. Use `--skip-install` for a source-only no-op. There is no removal command, provider deletion or implicit D1/R2 data deletion. An inconsistent parent/child declaration is rejected. Earlier full-stack generators and arbitrary custom layouts are not automatically adopted or overlaid; inspect their source and reconcile conflicts explicitly.
55
+
56
+ ## Source state and activation
57
+
58
+ `stack list` shows the complete catalog. `stack status` reports `locked`, `available`, `installed` or `incomplete` source state. `stack doctor` exits unsuccessfully when declared source is missing. Neither command inspects live providers or proves deployment/activation. An installed capability can still need credentials, migrations, resource IDs and runtime verification.
59
+
60
+ The intended operational sequence remains source selection → resource provisioning → bindings/secrets/migrations → runtime validation/deployment → verified active service. Client binaries run on their target platforms, independently of Cloudflare server deployments.
61
+
62
+ ## Configuration and local validation
63
+
64
+ Run dependency installation, inspect the generated files, then run `pnpm check`. The normal `add` path resolves lockfiles, stages any applicable reviewed patches and performs a frozen install. The consumer's `audit:deps` retains raw findings and accepts only the existing reviewed exact patches. Source-only generation does not apply a patch to a dependency that has not been resolved yet.
65
+
66
+ For API development, use the web service binding in production and `API_INTERNAL_URL=http://127.0.0.1:8787` in `apps/web/.env.local` locally. Copy selected API values from `apps/api/.dev.vars.example` to `.dev.vars`; never put server secrets in client public variables. Set a sufficiently long auth secret and the actual `PUBLIC_APP_URL` before enabling identity-dependent features.
67
+
68
+ D1's initial resource ID is deliberately a placeholder. Configure the actual D1 identity and private R2 bucket yourself. Keep R2 public access disabled. Generate and review additional SQL, then deliberately apply it to an isolated local database:
69
+
70
+ ```sh
71
+ pnpm db:generate
72
+ pnpm db:migrate --local
73
+ ```
74
+
75
+ Builds and startup never migrate. Remote migration requires explicit `--remote` and deliberate resource selection. No configured database is migrated by this repository's tests.
76
+
77
+ Better Auth starts with email/password disabled, and no OAuth, passkeys, MFA or organization plugins silently activated. Enable chosen methods explicitly after configuring their credentials, email/policies, schemas and client flows. The included sign-in UI is an email/password example, not automatic method activation. Regenerate/review migrations when adding auth plugins.
78
+
79
+ ## Payments
80
+
81
+ The included routes form a subscription starter, rather than a complete commerce product. Choose the allowed Stripe price and RevenueCat entitlement. `BILLING_PROVIDER` selects `stripe`, `revenuecat` or `either` for the shared server access guard. The default billing environment is `sandbox`; a deliberate `BILLING_ENVIRONMENT=live` selection must match the provider key and webhook environment. The CLI sets neither live credentials nor live mode.
82
+
83
+ Checkout derives identity from the authenticated session, uses a server-selected price and requires an idempotency key. Stripe verifies the untouched body/signature through the web proxy. RevenueCat validates its configured authorization header, app scope and environment. D1 receipts deduplicate delivery. Webhook order, redirects and SDK callbacks never grant access.
84
+
85
+ The server re-reads canonical provider state, checks identity/product/environment/expiry, and fails closed on unavailable or unconfigured providers. Reuse `requireSession` and `requireEntitlement` on paid application routes. `/api/billing/access` demonstrates that guard. SDK account changes are serialized; native sign-out disconnects purchases before clearing the app session. One-time fulfillment, credits, tax, marketplace/Connect, pricing and store-policy decisions remain application work.
86
+
87
+ Use provider test credentials and store sandboxes for acceptance. No real charge, live activation, signing or store submission is part of `add` or these tests.
88
+
89
+ ## Events, RTC and AI
90
+
91
+ Events are durable, owner-scoped D1 records. SSE uses `(created_at, id)` cursors and `Last-Event-ID`; batches do not advance past undelivered records. The starter is a private event feed, not an automatic room/membership model. Choose retention and application topics deliberately.
92
+
93
+ The initial RTC adapter uses Cloudflare Realtime SFU. It provides session creation, tracks, renegotiation and close operations, keeps app secrets server-side, bounds session allocation and checks session ownership. Remote tracks are limited to the same authenticated user's sessions. A multi-user product must add its reviewed room/membership rules and WebRTC client flow. Configure provider lifecycle/retention and validate media behavior before rollout; an adapter install is not a working conference UI.
94
+
95
+ Workers AI requires explicit model and daily quota configuration. Authentication and an atomic D1 counter gate requests; failed provider calls consume quota as well. No model or provider resource is activated by generation. Alternative realtime/AI provider choices remain application decisions.
96
+
97
+ ## Additional clients
98
+
99
+ Expo uses public API configuration and SecureStore-backed Better Auth cookies. Set the device-reachable `EXPO_PUBLIC_API_URL`, and add the exact generated scheme origin to the API's `AUTH_TRUSTED_ORIGINS`. Native API helpers preserve the verified session; a browser Origin cannot be bypassed by an `expo-origin` header. Rebuild native clients when native dependencies/configuration change; Expo exports do not establish device or store acceptance.
100
+
101
+ `native-ui` adds a bounded Button/Text bootstrap from RNR, not the legacy native fork. Shared semantic CSS is imported from `packages/styling`. Use `anhedral ui add` for other components and retain MIT attribution. The audit configuration treats the two upstream button variant exports as intentional public UI APIs. Its narrow runner/peer dependency entries account for Babel/NativeWind usage that static import analysis cannot see; source, duplication and complexity checks remain enabled.
102
+
103
+ WXT defaults to Chromium Manifest V3, with an explicit API-origin host permission. Side Panel support is Chromium-specific. Configure extension authentication and browser acceptance separately; no extension is installed into a user's browser by the CLI.
104
+
105
+ GPUI uses the upstream `runtime_shaders` feature, without a vendored fork or web renderer. Rust and platform libraries are required. Its application is a native starter; backend account UX, packaging, signing and distribution belong to the product. Commit the generated Cargo lockfile after resolving native dependencies.
106
+
107
+
108
+ ## Repository acceptance fixture
109
+
110
+ After generating/installing a local consumer under this CLI checkout's `.artifacts/`, mark it with `.anhedral-fixture.json` containing `{"fixture":true}` and run `node tests/test-capability-runtime.mjs <fixture-directory>`. The fixture must include R2, Stripe, RevenueCat, events, RTC and AI source. This test refuses other paths, applies SQL only to isolated Miniflare D1, blocks unexpected outbound requests, and restores its temporary auth-method opt-in. Its billing providers are local read-only fixtures. Keep this marker out of deployed application source. Keep revision-scoped build results and limitations in the CLI repository’s `docs/agent-notes/`.
@@ -0,0 +1,47 @@
1
+ # Archived native port
2
+
3
+ The exhaustive Anhedral shadcn-to-React-Native port is superseded by the
4
+ [source-owned UI catalog and installer](ui.md). Its assets, generator, dependency
5
+ set, test harness and parity tooling are no longer part of the active CLI.
6
+ Existing generated applications remain consumer-owned and are not rewritten.
7
+
8
+ New applications start with Next.js. Add an Expo client with `anhedral add expo`,
9
+ then its RNR/NativeWind integration with `anhedral add native-ui`. Use
10
+ `anhedral ui add` for selected platform components. Programmatic initialization
11
+ with the retired `expo` product now fails before writes with this migration path.
12
+
13
+ ## Recovery
14
+
15
+ The October 26, 2026 local archive preserves the unfinished port, including all
16
+ uncommitted tracked and untracked source, at commit
17
+ `4033cab2f068ebc021803d6730e9e04cbc274081` under
18
+ `refs/archive/2026-10-26/old-port`. The clean pre-cleanup staging baseline is
19
+ `630315094dc6bcf71414aa002bedf0dbba09fb86`. These are source identities, not release
20
+ or native acceptance certifications.
21
+
22
+ The independently restorable archive contains `repository.bundle`, source tarballs,
23
+ binary diffs, original Git status, per-file SHA-256 manifests, selected ignored
24
+ local evidence and restoration scripts/results. It is retained outside the npm
25
+ package and plugin. The archive is local; these refs are not promised on GitHub.
26
+ The maintainer's archive location and verification results are recorded in the
27
+ existing development notes.
28
+
29
+ From a supplied archive directory, restore into a new directory:
30
+
31
+ ```sh
32
+ git clone --no-checkout /path/to/archive/repository.bundle restored-native-port
33
+ git -C restored-native-port checkout --detach 4033cab2f068ebc021803d6730e9e04cbc274081
34
+ ```
35
+
36
+ The bundle also retains available refs and stashes. Inspect `git bundle list-heads`
37
+ and fetch selected refs explicitly into a separate recovery repository when needed;
38
+ ordinary cloning imports branch/tag refs, not every archival or stash ref.
39
+
40
+ Use the archive's `verify_restore.py` to verify source and evidence against their
41
+ manifests. Read `evidence-exclusions.json` for omitted reproducible caches and native
42
+ binaries; original ignored material remains in the retained old checkout.
43
+
44
+ Recover selected components only for a concrete product requirement. Review their
45
+ dependencies, provenance and compatibility with the current NativeWind/RNR runtime,
46
+ then validate the consuming application on iOS and Android. Do not merge the old
47
+ branch wholesale or revive exhaustive registry parity as a release gate.
@@ -1,54 +1,39 @@
1
- # Software factory
1
+ # Scaffold workflow
2
2
 
3
- Anhedral CLI supplies the starter foundation for applications built with Anhedral. Developers and Anhedral Agents extend its editable source; Anhedral Platform brings collaboration and delivery oversight together, and Anhedral Cloud hosts applications and their managed services. The workflow below describes the technical steps supporting that foundation.
4
-
5
- Use one maintained architecture: Next.js web + Expo native + Hono + Drizzle/D1 + private R2, supporting Better Auth and shared styling. Stripe and RevenueCat are the only optional additions. The [stack standard](stack-standard.md) owns architectural boundaries.
6
-
7
- ## Generate
8
-
9
- Use the pinned CLI version, supported Node runtime and generated pnpm version. Preview with `anhedral init my-app --dry-run --json`; generate with the same options. `--skip-install --no-git` writes source without network or a repository. Normal initialization may install dependencies and initialize Git, but never provisions cloud resources, migrates a remote database or deploys.
10
-
11
- ```sh
12
- anhedral init my-app
13
- anhedral init paid-app --stripe --revenuecat
14
- ```
15
-
16
- Review generated README, AGENTS, anhedral.json, environment templates, migration files and scripts. Secrets belong only in ignored private runtime files. Preserve useful existing applications rather than reinitializing them.
17
-
18
- ## Develop and validate
19
-
20
- Run generated `pnpm dev` for Next.js web and Hono. Start Expo Metro separately for iOS/Android with the generated mobile command. Web uses the full App Router, including SSR and React Server Components; production builds run through Cloudflare OpenNext rather than static export. The OpenNext Worker forwards API requests through `ANHEDRAL_API`; native clients use the configured HTTPS origin. Keep web DOM shadcn components separate from the Anhedral native shadcn port, sharing contracts and design tokens.
21
-
22
- Build complete vertical slices with persistent data, validation, owner authorization, error/loading states and meaningful tests. Verify session isolation and denied private-file access. Apply migrations explicitly to isolated local fixtures. Builds and tests must never migrate a configured remote database.
23
-
24
- Run `pnpm check`, `anhedral doctor --json` and `anhedral inspect --json`. Local inspection reports declared configuration and recorded evidence, not live provider health. Compile/export success is not device or production acceptance.
25
-
26
- ## Add payments
27
-
28
- ```sh
29
- anhedral add stripe --cwd my-app --dry-run --json
30
- anhedral add stripe --cwd my-app
31
- anhedral add revenuecat --cwd my-app
32
- ```
33
-
34
- Only these two additions are supported. Use the exact project generator version and preserve edited-source fingerprints; review conflicts instead of forcing replacement. Configure provider scope, plans, environment and credentials before acceptance. Test retries, duplicate/reordered webhooks, account switching, refunds/revocation and expiry. Native purchases require an actual device build and store sandbox configuration.
35
-
36
- ## Provision and deliver
37
-
38
- Use the CLI help for exact flags. Authenticate the selected Cloudflare/provider accounts explicitly, inspect plans, and provision only authorized resources. Commit resolved tracked configuration before delivery. Keep management credentials out of application code and logs. Secret installation, provider activation, DNS ownership and any spending approvals remain explicit operator steps.
39
-
40
- Cloudflare delivery checks clean-source provenance, account identity, selected audience and recorded releases. Retain those safeguards. A deployment exit code alone does not prove the intended application works. Migrations are explicit; no automatic remote database migration during checks/startup. Native builds and store distribution are separate workflows.
41
-
42
- Verify the actual deployed web URL and target device against product acceptance criteria, including anonymous rejection and cross-account isolation. Record source SHA, exact artifact identity, commands, outcomes and remaining limitations. Rollback does not restore data or undo migrations; review data compatibility independently.
3
+ 1. Preview an empty destination with `anhedral init my-app --dry-run --json`, then
4
+ run `anhedral init my-app` and `pnpm dev` inside it.
5
+ 2. Read the generated README, AGENTS, `anhedral.json`, environment examples and
6
+ Wrangler configuration. Use their recorded tool versions.
7
+ 3. Preview and add [capabilities](capabilities.md) as needed. Configure selected
8
+ providers/auth methods, apply reviewed migrations and validate actual runtime
9
+ behavior before deployment. Source installation is not provider activation.
10
+ 4. Extend [source-owned UI](ui.md), implement features and run consumer checks.
43
11
 
44
12
  ## Evidence-driven maintenance
45
13
 
46
- Before deleting code, trace runtime entrypoints, published exports, generated consumers, plugin tools and maintained examples. Keep changes scoped to an explicit behavior. The 0.14 scope reduction deliberately removes unsupported alternatives; it does not authorize deleting customer source, remote resources, credentials or historical verification.
47
-
48
- Preserve operational checks, secret protection, lock/recovery safeguards and independent provider evidence. For generator changes, check emitted source and packed package behavior. For provider changes, distinguish isolated contract fixtures from live acceptance. Passing static tests cannot establish production operation.
49
-
50
- ## Maintain and release the CLI
51
-
52
- Follow repository AGENTS and CONTRIBUTING instructions. Use short-lived codex branches from staging and reviewable PRs into staging. Main accepts release promotions; no direct development pushes. Preserve reviewed release artifacts, npm provenance, plugin source integrity and protected publishing. Saving code to GitHub is separate from publishing npm, deploying customer applications, or installing a plugin.
53
-
54
- Run build, typecheck, formatting/source hygiene, static security, relevant unit/generated runtime tests and packed-consumer tests. The Codex plugin has its own build/check and independently packaged runtime. A local CLI build does not update an installed plugin. Keep package version, source generator version and plugin marketplace reference synchronized.
14
+ Inspect current Git state and preserve unrelated work. Verify runtime entrypoints,
15
+ exports, generated consumers and operational safeguards before removing source;
16
+ static findings and passing tests alone do not prove a path is unused.
17
+
18
+ Update the existing owning guide with behavior changes. Keep exact versions and
19
+ defaults in manifests/source, not duplicated narratives. Store dated development,
20
+ audit and verification notes in
21
+ [docs/agent-notes](https://github.com/anhedral/anhedral-cli/tree/main/docs/agent-notes),
22
+ with revision, checks, failures and remaining gaps. Keep raw reports in ignored
23
+ `.artifacts/`. Historical notes are not current instructions.
24
+
25
+ Canonical docs live in `docs/`; `pnpm build` refreshes bundled plugin references.
26
+ Generated app guidance lives in `src/scaffold/documentation.ts`. Preserve shipped
27
+ reference paths, source-generation safety, dependency patch gates, UI provenance,
28
+ licenses and exact-artifact packaging. A build does not publish npm or update an
29
+ installed plugin. See [Contributing](https://github.com/anhedral/anhedral-cli/blob/main/.github/CONTRIBUTING.md)
30
+ for staging, release identity and validation tiers.
31
+
32
+ ## Next/OpenNext runtime gate
33
+
34
+ Relevant generator/build changes compile an isolated foundation and exercise it
35
+ in workerd. Run `pnpm test:next-runtime` for SSR/RSC, Server Actions/cookies,
36
+ prerendering and static cache checks. Hono proxy contracts have separate tests.
37
+ The harness owns the module-size budget and short-lived `.artifacts/next-runtime/`
38
+ receipts. Review measurement changes before adjusting limits. The smoke never
39
+ deploys or migrates a configured database; it is not production acceptance.
@@ -1,72 +1,21 @@
1
1
  # Stack standard
2
2
 
3
- Anhedral generates one application architecture. The public CLI is maintained as an open-source application factory, separate from the hosted Anhedral platform control plane.
4
-
5
- ## Default application
6
-
7
- | Owner | Responsibility |
8
- | --- | --- |
9
- | apps/web | Next.js App Router web application, DOM shadcn UI, SSR/RSC and Cloudflare OpenNext |
10
- | apps/mobile | Expo iOS/Android application and the Anhedral native shadcn port using StyleSheet and shared tokens |
11
- | apps/api | Hono Worker, authentication, application routes and authorization |
12
- | packages/contracts | Framework-independent schemas, JSON contracts and transport |
13
- | packages/db | Drizzle/D1 schema and explicit migrations |
14
- | packages/auth | Better Auth server construction and session contracts |
15
- | packages/styling | Shared colors, spacing and light/dark tokens |
16
-
17
- Plain `anhedral init my-app` includes Next.js web, Expo native, Hono, D1, private R2, supporting Better Auth and styling. TypeScript, pnpm, Turborepo and shared checks are supporting infrastructure. There is no frontend, database, hosting or preset selection menu.
18
-
19
- D1 is the supported database. Neon/PostgreSQL is not an available addition in this release. A future migration would require schema conversion, data movement and validation; it is not a connection-string change.
20
-
21
- ## Private files
22
-
23
- R2 is accessed through the API's authenticated owner-scoped file routes, never public bucket access or client storage credentials. Authorize every object operation server-side. Bound upload sizes and reject caller-controlled ownership; test anonymous and cross-user rejection as well as successful upload/download/delete. Buckets and database bindings are provisioned explicitly after source generation.
24
-
25
- ## Identity
26
-
27
- Better Auth is supporting core infrastructure rather than a selectable catalog alternative. Use its verified session subject for file ownership and billing identity. Application identity is separate from provider-management authentication and hosted Platform accounts. Keep auth secrets on the server, configure trusted origins, and apply reviewed auth migrations explicitly. Native session handling and HTTPS device origins need their own acceptance.
28
-
29
- ## Only two optional additions
30
-
31
- | Addition | Scope |
32
- | --- | --- |
33
- | stripe | Authenticated web checkout/customer portal, webhooks, reconciliation and server entitlements |
34
- | revenuecat | Native purchase/restore/manage adapters, provider reconciliation and shared server entitlements |
35
-
36
- ```sh
37
- anhedral init my-app --stripe
38
- anhedral init my-app --revenuecat
39
- anhedral init my-app --stripe --revenuecat
40
- anhedral add stripe --cwd my-app --dry-run --json
41
- anhedral add revenuecat --cwd my-app
42
- ```
43
-
44
- Stripe and RevenueCat are independent. Configure products, prices/offerings, environment, application IDs, credentials and webhook endpoints in the intended accounts. Use server-verified provider state for access; client purchase callbacks and redirects never grant entitlements. Preserve replay handling, durable reconciliation, expiry and fail-closed behavior. No real payment or provider activation occurs during generation.
45
-
46
- ## Runtime boundaries
47
-
48
- Hono owns privileged behavior. Applications do not import each other's source. Shared schema/transport stays framework-independent. Use request-scoped database and service factories. Private responses must not enter shared caches. No credentials or raw secrets in clients, generated source, logs or Git.
49
-
50
- Cloudflare Workers host the OpenNext web application and Hono API. The web Worker calls Hono through its `ANHEDRAL_API` service binding. Next server rendering and actions adapt requests to Hono; they never own database/auth-server access. Web UI uses DOM shadcn components; native UI uses the Anhedral-maintained shadcn port. Both share contracts and design tokens. Native signing, device/store acceptance and store submission remain separate from OpenNext deployment. See [workflow](software-factory.md) for supported commands and evidence boundaries.
51
-
52
- ## Version compatibility
53
-
54
- Version 0.15 replaces Expo web with full Next.js App Router through OpenNext and keeps Expo for iOS/Android only. The former broad catalog remains retired. Core records are always present; only Stripe and RevenueCat can be selected as additions. Registry inspection may show supporting records; it does not make those records independently selectable additions. Legacy application source and provider resources are never deleted or migrated by this change. Preserve old CLI pins for old projects and retain dated verification as historical evidence.
55
-
56
- ## Managed authentication email
57
-
58
- New apps include a server-only `packages/managed-email` adapter and web/native
59
- verification and password-reset screens. Anhedral operations may provision the API
60
- Worker's `ANHEDRAL_EMAIL` service binding, `ANHEDRAL_EMAIL_SCOPE` UUID and secret
61
- `ANHEDRAL_EMAIL_CAPABILITY`; provider keys and sender configuration stay in the
62
- broker. Its scope must match the app's public Better Auth origin and exact native
63
- scheme. Do not expose these values through Next public variables or Expo config.
64
-
65
- No broker configuration preserves standalone sign-in behavior. Partial setup fails
66
- closed. Complete setup requires verified email and enables reset delivery with
67
- session revocation. Do not remove broker configuration to bypass verification;
68
- existing unverified sessions need an explicit revocation plan when enabling the
69
- policy for an existing deployment. Initialization does not provision email or send
70
- messages. Test with an isolated sink; a receipt proves acceptance, not inbox delivery.
71
- Existing hosted execution images remain pinned until a separate verified image
72
- release; publishing the CLI does not replace them or rewrite saved apps.
3
+ Start with Next.js App Router, OpenNext for Cloudflare Workers and source-owned
4
+ Anhedral UI. Add Hono, then Drizzle/D1 and Better Auth. Add private R2, payments,
5
+ realtime, AI and other clients as required. The [README](https://github.com/anhedral/anhedral-cli#readme) lists every
6
+ addition; [capabilities](capabilities.md) owns prerequisites and safety.
7
+
8
+ Hono owns privileged data and application authorization. Next server actions
9
+ adapt forms and call the API. Share framework-independent contracts and tokens
10
+ without cross-importing application source. Keep R2 private and enforce identity,
11
+ ownership and limits before exposing files. Apply reviewed database migrations
12
+ explicitly, separately from builds and startup.
13
+
14
+ UI source belongs to the consumer: official shadcn for web, React Native Reusables
15
+ for Expo and a small reviewed native extension layer. Preserve licenses, semantic
16
+ tokens and local edits. See [UI commands](ui.md).
17
+
18
+ The CLI writes editable source/configuration; consumers configure services,
19
+ credentials and deployment. Platform separately owns its managed operations.
20
+ Existing applications, legacy native work and runtime artifacts retain their
21
+ reviewed pins until deliberately adopted and validated.
package/docs/ui.md ADDED
@@ -0,0 +1,33 @@
1
+ # Anhedral UI
2
+
3
+ One CLI routes source installation to official shadcn for Next.js and React Native Reusables for Expo. It owns the catalog and a small native extension registry, rather than a fork of either library. New `anhedral init` applications already have web UI configuration and three starter components.
4
+
5
+ ```sh
6
+ anhedral ui list --json
7
+ anhedral ui init --web
8
+ anhedral ui add button card --web
9
+ anhedral ui add button --native
10
+ anhedral ui diff button --native
11
+ anhedral ui doctor --all
12
+ anhedral ui add card --all --dry-run --json
13
+ ```
14
+
15
+ All commands accept the global `--cwd`, `--json` and `--quiet` options. `--web`, `--native` and `--all` are mutually exclusive. Without a selector, a single detected Next.js or Expo app is used; ambiguous workspaces require selection. Detection supports an app itself or applications immediately under a workspace's `apps/` directory. Web and native use separate directories.
16
+
17
+ `list` reads the packaged catalog without network access. `doctor` checks static configuration and exits unsuccessfully for missing setup; it does not claim runtime acceptance. `--dry-run` previews init/add/diff without network or writes. Every selected target is preflighted before installation starts. Upstream installation can still fail after an earlier target succeeds; source installation is not a cross-project transaction, so review Git changes before retrying.
18
+
19
+ `init --web` delegates new configuration to pinned shadcn with Base UI defaults. Existing `components.json` is validated and preserved. `init --native` requires a prepared Expo/NativeWind 4 project using the [RNR manual setup](https://reactnativereusables.com/docs/installation/manual). It does not create Expo, rewrite Metro/root layouts, choose device permissions or add a second styling engine. Complete RNR's dependencies, CSS variables, Tailwind/Metro configuration, aliases, `cn` helper and portal host first. It can create the conventional native `components.json`, then adds Anhedral metadata and attribution without replacing existing files.
20
+
21
+ `add` validates canonical names against the catalog. Native chooses a packaged reviewed Anhedral extension when declared, otherwise RNR's NativeWind item, otherwise fails clearly before installing. The extension registry starts empty. Web uses official shadcn items. The pinned shadcn CLI owns registry dependency resolution and copying source. We do not use the universal-only `@shadcn/registry` installer for component projects.
22
+
23
+ `add` never requests `--overwrite`; upstream protects existing component files. `diff` delegates to shadcn's `add --diff` preview. Commit or inspect consumer changes before updating, and reconcile changes explicitly. Native `diff` availability follows the upstream CLI and registry behavior; it is not a custom merge engine.
24
+
25
+ ## Ownership and provenance
26
+
27
+ `assets/ui/catalog.json` records the catalog revision, upstream sources, dependency metadata and pinned installer. Availability is not parity or runtime certification. RNR URLs are live upstream endpoints; the catalog's recorded source revision describes the inventory, not an immutable downloaded artifact. Review registry changes before installing into sensitive consumers.
28
+
29
+ `.anhedral-ui.json` records platform, catalog revision and source ownership; it does not automatically update components. `ANHEDRAL_UI_LICENSES/` retains the relevant MIT notice. No Anhedral runtime package is introduced. Theme through consumer CSS variables and existing tokens. Future native extensions require a focused product need, upstream provenance/license and native consumer evidence; broad parity is not a release prerequisite.
30
+
31
+ Validate web flows in a browser. Validate native interactions in Android/iOS development builds, including accessibility, overlays, keyboard and lifecycle. Typechecking or an Expo web export does not establish device acceptance. The retired exhaustive port is preserved outside the active CLI; `docs/native-ui.md` records its recovery identity and migration path.
32
+
33
+ For a generated Anhedral workspace, `anhedral add expo` creates the native application after its core source prerequisites, and `anhedral add native-ui` prepares its NativeWind/RNR integration without replacing product UI. The UI component commands remain independent of backend activation. See [stack additions](capabilities.md).