anhedral 0.12.0 → 0.15.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.
- package/README.md +35 -172
- package/assets/patches/audit-deps.mjs +12 -2
- package/assets/ui/LICENSE.shadcn +21 -0
- package/assets/ui/UPSTREAM.json +33 -0
- package/assets/ui/native/button.tsx +85 -0
- package/assets/ui/native/card.tsx +33 -0
- package/assets/ui/native/dialog.tsx +75 -0
- package/assets/ui/native/input.tsx +27 -0
- package/assets/ui/native/label.tsx +4 -0
- package/assets/ui/native/layout.tsx +26 -0
- package/assets/ui/native/text.tsx +20 -0
- package/assets/ui/native/theme-switcher.tsx +22 -0
- package/assets/ui/theme-storage.ts +25 -0
- package/assets/ui/theme.tsx +66 -0
- package/assets/ui/web/button.tsx +59 -0
- package/assets/ui/web/input.tsx +21 -0
- package/assets/ui/web/label.tsx +19 -0
- package/dist/capabilities.d.ts +5 -5
- package/dist/capabilities.js +3 -21
- package/dist/capability-contract.d.ts +3 -3
- package/dist/capability-contract.js +11 -39
- package/dist/cli-delivery.d.ts +1 -1
- package/dist/cli-delivery.js +5 -65
- package/dist/cli-output.js +3 -3
- package/dist/command-schema.js +35 -80
- package/dist/command.js +9 -11
- package/dist/delivery-evidence.d.ts +1 -1
- package/dist/delivery-evidence.js +7 -36
- package/dist/delivery.d.ts +2 -8
- package/dist/delivery.js +23 -102
- package/dist/dependencies.d.ts +12 -58
- package/dist/dependencies.js +67 -189
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/inspector-model.d.ts +2 -2
- package/dist/integration-service-readers.d.ts +1 -2
- package/dist/integration-service-readers.js +3 -84
- package/dist/lifecycle-model.d.ts +1 -1
- package/dist/lifecycle-model.js +1 -1
- package/dist/mobile-delivery.d.ts +1 -1
- package/dist/mobile-delivery.js +4 -0
- package/dist/platforms/mobile.d.ts +1 -1
- package/dist/platforms/mobile.js +64 -114
- package/dist/platforms/web.d.ts +3 -0
- package/dist/platforms/web.js +299 -0
- package/dist/project-config.d.ts +1 -1
- package/dist/project-config.js +0 -1
- package/dist/project-inspector.js +5 -36
- package/dist/project-state.d.ts +1 -3
- package/dist/project-state.js +6 -86
- package/dist/provider-auth.js +3 -32
- package/dist/provider-readiness.d.ts +1 -1
- package/dist/provider-readiness.js +5 -24
- package/dist/providers/adapters.js +9 -178
- package/dist/providers/api.d.ts +1 -1
- package/dist/providers/api.js +3 -3
- package/dist/providers/config.js +2 -48
- package/dist/providers/definitions.d.ts +1 -204
- package/dist/providers/definitions.js +0 -85
- package/dist/providers/provision.d.ts +1 -1
- package/dist/providers/receipts.js +1 -11
- package/dist/providers/recovery-verification.js +1 -61
- package/dist/providers/runtime.js +15 -35
- package/dist/providers/state.js +1 -7
- package/dist/provision.d.ts +5 -13
- package/dist/provision.js +4 -80
- package/dist/readiness.d.ts +1 -1
- package/dist/readiness.js +3 -6
- package/dist/registry/add.js +11 -38
- package/dist/registry/bootstrap.d.ts +3 -2
- package/dist/registry/bootstrap.js +4 -13
- package/dist/registry/commands.js +8 -10
- package/dist/registry/context.js +0 -1
- package/dist/registry/options.js +8 -26
- package/dist/registry/resolve.d.ts +3 -2
- package/dist/registry/resolve.js +26 -82
- package/dist/registry/types.d.ts +2 -7
- package/dist/registry/usage.js +2 -2
- package/dist/runtime-policy.d.ts +0 -2
- package/dist/runtime-policy.js +0 -13
- package/dist/scaffold/api.js +10 -2
- package/dist/scaffold/auth.d.ts +1 -2
- package/dist/scaffold/auth.js +57 -116
- package/dist/scaffold/backend.d.ts +2 -0
- package/dist/scaffold/backend.js +39 -0
- package/dist/scaffold/billing-config.d.ts +1 -0
- package/dist/scaffold/billing-config.js +73 -0
- package/dist/scaffold/billing-contracts.d.ts +2 -0
- package/dist/scaffold/billing-contracts.js +48 -0
- package/dist/scaffold/billing-providers.d.ts +1 -0
- package/dist/scaffold/billing-providers.js +249 -0
- package/dist/scaffold/billing-schema.d.ts +1 -0
- package/dist/scaffold/billing-schema.js +34 -0
- package/dist/scaffold/billing-security.d.ts +1 -0
- package/dist/scaffold/billing-security.js +46 -0
- package/dist/scaffold/billing-server.d.ts +1 -0
- package/dist/scaffold/billing-server.js +139 -0
- package/dist/scaffold/billing-store.d.ts +1 -0
- package/dist/scaffold/billing-store.js +72 -0
- package/dist/scaffold/billing.d.ts +2 -0
- package/dist/scaffold/billing.js +208 -0
- package/dist/scaffold/bootstrap.d.ts +2 -3
- package/dist/scaffold/bootstrap.js +37 -43
- package/dist/scaffold/compose.js +2 -12
- package/dist/scaffold/database.d.ts +1 -1
- package/dist/scaffold/database.js +20 -111
- package/dist/scaffold/documentation.d.ts +0 -1
- package/dist/scaffold/documentation.js +22 -82
- package/dist/scaffold/expo-auth.d.ts +3 -0
- package/dist/scaffold/expo-auth.js +203 -0
- package/dist/scaffold/expo-billing.d.ts +3 -0
- package/dist/scaffold/expo-billing.js +257 -0
- package/dist/scaffold/expo-runtime.d.ts +3 -0
- package/dist/scaffold/expo-runtime.js +43 -0
- package/dist/scaffold/integrations.d.ts +1 -2
- package/dist/scaffold/integrations.js +9 -5
- package/dist/scaffold/managed-email.d.ts +3 -0
- package/dist/scaffold/managed-email.js +47 -0
- package/dist/scaffold/native-ui.d.ts +2 -0
- package/dist/scaffold/native-ui.js +69 -0
- package/dist/scaffold/password-reset.d.ts +1 -0
- package/dist/scaffold/password-reset.js +99 -0
- package/dist/scaffold/private-files.d.ts +2 -0
- package/dist/scaffold/private-files.js +78 -0
- package/dist/scaffold/stack-documentation.d.ts +0 -1
- package/dist/scaffold/stack-documentation.js +3 -49
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/styling.js +20 -28
- package/dist/scaffold/web-billing.d.ts +2 -0
- package/dist/scaffold/web-billing.js +48 -0
- package/dist/scaffold/workspace.js +53 -189
- package/dist/service-deletion.js +1 -1
- package/dist/service-descriptor.js +5 -12
- package/dist/service-model.d.ts +1 -1
- package/dist/service-operations.js +2 -32
- package/dist/service-readers.js +1 -32
- package/dist/services-command.d.ts +1 -1
- package/dist/services-command.js +3 -9
- package/dist/ship.d.ts +3 -316
- package/dist/ship.js +13 -143
- package/dist/stack-registry.d.ts +2 -43
- package/dist/stack-registry.js +80 -308
- package/dist/standard.js +7 -14
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +23 -0
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/software-factory.md +25 -499
- package/docs/stack-standard.md +48 -226
- package/docs/verification.md +433 -0
- package/package.json +22 -21
- package/dist/neon-service-data.d.ts +0 -8
- package/dist/neon-service-data.js +0 -117
- package/dist/platforms/desktop.d.ts +0 -2
- package/dist/platforms/desktop.js +0 -415
- package/dist/platforms/extension.d.ts +0 -2
- package/dist/platforms/extension.js +0 -328
- package/dist/scaffold/lint.d.ts +0 -4
- package/dist/scaffold/lint.js +0 -56
- package/dist/scaffold/neon-realtime.d.ts +0 -2
- package/dist/scaffold/neon-realtime.js +0 -97
- package/dist/scaffold/services.d.ts +0 -5
- package/dist/scaffold/services.js +0 -108
- package/dist/scaffold/stream.d.ts +0 -2
- package/dist/scaffold/stream.js +0 -114
- package/dist/scaffold/void.d.ts +0 -4
- package/dist/scaffold/void.js +0 -256
- package/dist/scaffold/web.d.ts +0 -2
- package/dist/scaffold/web.js +0 -128
- package/dist/vercel-project.d.ts +0 -101
- package/dist/vercel-project.js +0 -305
- package/dist/vercel.d.ts +0 -67
- package/dist/vercel.js +0 -581
- package/dist/vinext.d.ts +0 -2
- package/dist/vinext.js +0 -86
- package/dist/void-execution.d.ts +0 -10
- package/dist/void-execution.js +0 -94
- package/dist/void-migrations.d.ts +0 -6
- package/dist/void-migrations.js +0 -110
- package/dist/void-state.d.ts +0 -16
- package/dist/void-state.js +0 -65
- package/dist/void.d.ts +0 -3
- package/dist/void.js +0 -5
package/README.md
CHANGED
|
@@ -1,192 +1,55 @@
|
|
|
1
|
-
# Anhedral
|
|
1
|
+
# Anhedral CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/anhedral)
|
|
5
|
-
[](LICENSE)
|
|
3
|
+
Anhedral CLI is the starter foundation for applications built with Anhedral. It brings web, iOS, Android, backend services, authentication, data storage, and shared design foundations into one maintained application stack. Generated projects contain editable source, established architectural boundaries, and the configuration and development conventions needed to build on that foundation.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
The CLI gives each application a consistent starting point that Anhedral Agents and developers can extend together, carrying a shared architecture from initial setup into ongoing development and cloud delivery.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
Anhedral Platform is the shared workspace for collaboration, planning, and software delivery. Anhedral Agents is the orchestration layer for programming agents, isolated development environments, and source management. Anhedral Cloud is the managed hosting and application services layer. See the [Anhedral product family](https://www.anhedral.com/work) for how they fit together.
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Anhedral is open source under the [Apache License 2.0](LICENSE).
|
|
10
|
+
Generated applications are editable source that developers can customize and license for their products.
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
One command creates one stack:
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
- **Next.js App Router** for the web, with DOM shadcn UI and Cloudflare OpenNext.
|
|
15
|
+
- **Expo** for iOS and Android, with the Anhedral-maintained native shadcn port using StyleSheet and shared tokens.
|
|
16
|
+
- **Hono** on Cloudflare Workers for application APIs and authorization.
|
|
17
|
+
- **Drizzle / D1** for SQL persistence and explicit migrations.
|
|
18
|
+
- **Private R2** for authenticated, owner-scoped files.
|
|
19
|
+
- Supporting Better Auth sessions, shared public contracts and design tokens.
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
anhedral init my-app --dry-run --json
|
|
21
|
+
The only optional additions are **Stripe** for web billing and **RevenueCat** for native purchases. They can be selected independently or together. Provider accounts, activation, product configuration and acceptance remain explicit work.
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
<picture>
|
|
24
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/anhedral-stack.png">
|
|
25
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/assets/anhedral-stack-light.png">
|
|
26
|
+
<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="docs/assets/anhedral-stack-light.png" width="1200">
|
|
27
|
+
</picture>
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Plain `anhedral init my-app` creates a Vinext web application. It includes no database, application identity provider, billing, email or analytics service.
|
|
32
|
-
|
|
33
|
-
| Area | Default |
|
|
34
|
-
| ------------- | ----------------------------------------------------------------------------------------------- |
|
|
35
|
-
| Application | Vinext and React on Cloudflare Workers |
|
|
36
|
-
| UI | TypeScript, Tailwind, shadcn/ui conventions and Lucide |
|
|
37
|
-
| Workspace | pnpm workspaces and Turborepo, even for one application |
|
|
38
|
-
| Tooling | Shared TypeScript and ESLint configuration packages; root checks and dependency audit |
|
|
39
|
-
| Delivery | Void for supported Cloudflare selections |
|
|
40
|
-
| Source | Deployable code in `apps/*`, reusable code in `packages/*` |
|
|
41
|
-
| Configuration | One root `anhedral.json` and `pnpm-lock.yaml`; secrets and local delivery history stay separate |
|
|
42
|
-
|
|
43
|
-
The registry has four foundation entries: `workspace`, `typescript`, `eslint` and `ui`. The first three accompany every project; the shared UI foundation accompanies web applications.
|
|
44
|
-
|
|
45
|
-
## Choose the applications
|
|
46
|
-
|
|
47
|
-
Combine these flags after `anhedral init my-app`. Vinext and Next.js are alternatives; web, API, mobile, desktop and extension applications can otherwise coexist.
|
|
48
|
-
|
|
49
|
-
| Selection | Generates |
|
|
50
|
-
| ----------------------------- | ----------------------------------------------------------------------------------- |
|
|
51
|
-
| Default, or `--vinext` | Vinext web application on Cloudflare Workers |
|
|
52
|
-
| `--next` | Native Next.js web application on Vercel |
|
|
53
|
-
| `--next --hosting=cloudflare` | Next.js on Workers through OpenNext |
|
|
54
|
-
| `--hono` | Shared Hono API Worker with OpenAPI/Zod contracts |
|
|
55
|
-
| `--expo` | Expo/React Native, Expo Router, NativeWind and React Native Reusables configuration |
|
|
56
|
-
| `--electron` | Electron/React desktop application, Vite and packaging configuration |
|
|
57
|
-
| `--wxt` | WXT/React Chrome side-panel extension |
|
|
58
|
-
|
|
59
|
-
Explicit application flags replace the default application selection. `--expo` generates mobile alone; `--vinext --expo` selects both. If you select only add-ons, such as `--neon`, the resolver includes a default web application. Use web server routes for a web-only backend, or select Hono for an API shared by several clients.
|
|
60
|
-
|
|
61
|
-
## Choose data and identity
|
|
62
|
-
|
|
63
|
-
| Selection | Generates | Selection rule |
|
|
64
|
-
| --------------- | --------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
65
|
-
| `--d1` | Shared Drizzle/SQLite database package and migrations | Cloudflare runtime; alternative to Neon |
|
|
66
|
-
| `--neon` | Shared Drizzle/PostgreSQL package using Neon HTTP | Server required; separate direct migration connection |
|
|
67
|
-
| `--better-auth` | Auth factory, database schema and server auth routes | Adds D1 when no database is selected; can use Neon |
|
|
68
|
-
| `--clerk` | Managed web identity integration and/or backend authentication helper | Alternative to Better Auth; server required |
|
|
69
|
-
| `--local-data` | Device-local persistence interface | Implement platform adapters and synchronization |
|
|
70
|
-
|
|
71
|
-
Database code lives in `packages/db`, including schemas and explicit migration tooling. Browser and device clients call server endpoints. Hosting audience protection and application resource authorization are separate from selecting an identity provider.
|
|
72
|
-
|
|
73
|
-
## Choose services and integrations
|
|
74
|
-
|
|
75
|
-
These are optional foundations. The generated scope column distinguishes bindings and Workers from SDK factories and integration guidance.
|
|
76
|
-
|
|
77
|
-
| Selection | Purpose | Generated scope |
|
|
78
|
-
| ----------------- | --------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
79
|
-
| `--r2` | Private files | R2 Worker binding and authorization guidance |
|
|
80
|
-
| `--kv` | Cache/configuration | Eventually consistent Worker binding |
|
|
81
|
-
| `--realtime` | WebSocket rooms | Separate Durable Object Worker; implement room authorization |
|
|
82
|
-
| `--neon-realtime` | Live PostgreSQL query results | Server/client factories and Drizzle adapter; adds Neon; manual branch activation |
|
|
83
|
-
| `--stream` | One-to-many live video | Cloudflare Stream WHIP/WHEP; server management factory; manual activation and product UI |
|
|
84
|
-
| `--queues` | Background jobs | Producer, consumer and dead-letter configuration; implement processing/idempotency |
|
|
85
|
-
| `--cron` | Scheduled work | Separate Worker with an hourly starter schedule |
|
|
86
|
-
| `--workflows` | Durable multi-step work | Separate Worker with a starter validation step |
|
|
87
|
-
| `--workers-ai` | Cloudflare inference | Worker AI binding; implement model calls |
|
|
88
|
-
| `--openai` | Direct OpenAI integration | Server SDK factory in `packages/ai` |
|
|
89
|
-
| `--ai-sdk` | AI streaming/provider abstraction | AI SDK exports with an OpenAI provider; alternative to `--openai` |
|
|
90
|
-
| `--resend` | Transactional email | Server SDK factory in `packages/email` |
|
|
91
|
-
| `--stripe` | Payments/subscriptions | Server SDK factory in `packages/billing` |
|
|
92
|
-
| `--revenuecat` | Cross-store entitlements | Integration guidance; explicitly requires `--stripe`; install platform SDKs |
|
|
93
|
-
| `--sentry` | Error/crash monitoring | Integration boundary and redaction fields; initialize platform SDKs |
|
|
94
|
-
| `--posthog` | Product analytics | Server analytics factory |
|
|
95
|
-
| `--basin` | Cloudflare analytical events | Private stream binding and event helper |
|
|
96
|
-
| `--styling` | Shared design tokens | Light/dark tokens and Tailwind preset; automatically included with Expo/WXT |
|
|
97
|
-
|
|
98
|
-
Live video (`--stream`), room messaging (`--realtime`) and live SQL (`--neon-realtime`) can coexist. See [live video setup and limits](docs/stack-standard.md#live-video-with-cloudflare-stream). PostHog and Basin can coexist with separate packages. Workers AI can accompany either AI SDK choice. Provider setup supports selected resources for Neon, Clerk, Resend, Stripe, RevenueCat, Sentry, PostHog and OpenAI; credentials, permissions and remaining owner steps are described in the [provider reference](docs/software-factory.md#provider-configuration).
|
|
99
|
-
|
|
100
|
-
### Composition rules
|
|
101
|
-
|
|
102
|
-
- Choose one web framework, one database and one identity provider. `--openai` and `--ai-sdk` are alternatives.
|
|
103
|
-
- Database/auth, Stream and Neon Realtime selections need a compatible server. For mobile with PostgreSQL, use `--expo --hono --neon`.
|
|
104
|
-
- Native Next.js/Vercel plus Worker-bound capabilities such as D1 or R2 automatically adds Hono on Cloudflare.
|
|
105
|
-
- Explicit OpenNext, Queues or Basin uses Wrangler for the Cloudflare workspace. Other supported Cloudflare selections use Void. `add` rejects changes that switch an existing engine or relocate runtime source.
|
|
106
|
-
- Neon Realtime requires Neon and manual Realtime configuration. RevenueCat requires an explicit Stripe selection.
|
|
107
|
-
|
|
108
|
-
Examples:
|
|
29
|
+
CLI 0.15 is a source preview and is not yet published to npm. Build this repository
|
|
30
|
+
with `pnpm install --frozen-lockfile && pnpm build`, then use its local CLI.
|
|
31
|
+
For the examples below, replace `anhedral` with `node /path/to/anhedral-cli/dist/bin.js`
|
|
32
|
+
until the matching version is published.
|
|
109
33
|
|
|
110
34
|
```sh
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
# Web, shared API, mobile and PostgreSQL.
|
|
115
|
-
anhedral init my-app --vinext --hono --expo --neon
|
|
116
|
-
|
|
117
|
-
# Vercel web with a Cloudflare API and private files.
|
|
118
|
-
anhedral init my-app --next --r2
|
|
119
|
-
|
|
120
|
-
# Live broadcasts with independent room messaging and SQL subscriptions.
|
|
121
|
-
anhedral init my-app --stream --neon-realtime --realtime
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Inspect the full catalog and preview later additions:
|
|
125
|
-
|
|
126
|
-
```sh
|
|
127
|
-
anhedral registry list
|
|
128
|
-
anhedral registry view resend --json
|
|
129
|
-
anhedral add resend --cwd my-app --dry-run --json
|
|
130
|
-
anhedral add resend --cwd my-app
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Generated entry points live in `apps/*`, shared code in `packages/*`, and Anhedral configuration in one root `anhedral.json`. Read the [source-only full-stack example](https://github.com/anhedral/anhedral-cli/tree/main/examples/full-stack) to see a larger project without creating services.
|
|
134
|
-
|
|
135
|
-
## Build and deliver
|
|
136
|
-
|
|
137
|
-
Implement the product, configure selected integrations and review database migrations. Then use the [software factory](docs/software-factory.md) to check provider access, connect the intended account and audience, commit source, ship and verify real user flows.
|
|
138
|
-
|
|
139
|
-
```sh
|
|
140
|
-
anhedral auth --status --json
|
|
141
|
-
anhedral doctor --providers --json
|
|
142
|
-
# Select the intended account and audience, then commit source/configuration.
|
|
143
|
-
anhedral connect --audience private --allow-email owner@example.com
|
|
144
|
-
git add .
|
|
145
|
-
git commit -m "Implement application and delivery configuration"
|
|
146
|
-
anhedral ship --dry-run --json
|
|
147
|
-
anhedral ship --json
|
|
148
|
-
anhedral verify --json
|
|
35
|
+
node /path/to/anhedral-cli/dist/bin.js init my-app
|
|
36
|
+
cd my-app
|
|
37
|
+
pnpm dev
|
|
149
38
|
```
|
|
150
39
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
Cloudflare and Vercel have automated delivery and provider evidence checks. Mixed delivery runs Cloudflare before Vercel and can partially succeed. Expo shipping returns verified EAS build artifacts; store submission is separate. Electron and extension projects include local build/package tooling, with signing and distribution handled through their platform workflows.
|
|
154
|
-
|
|
155
|
-
Use the [stack standard](docs/stack-standard.md) for destinations, compatibility, migration ownership, environment files and the remaining implementation requirements for every option. Exact dependency versions live in the [source catalog](https://github.com/anhedral/anhedral-cli/blob/main/src/dependencies.ts).
|
|
156
|
-
|
|
157
|
-
## Use with Codex
|
|
40
|
+
Initialization writes source locally, installs dependencies and initializes Git unless requested otherwise. Generation does not create cloud resources, apply remote migrations or deploy.
|
|
158
41
|
|
|
159
42
|
```sh
|
|
160
|
-
|
|
161
|
-
|
|
43
|
+
anhedral init my-app --dry-run --json
|
|
44
|
+
anhedral init my-app --stripe --revenuecat
|
|
45
|
+
anhedral add stripe --cwd my-app --dry-run --json
|
|
46
|
+
anhedral add stripe --cwd my-app
|
|
162
47
|
```
|
|
163
48
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
> Create a new project using [@Anhedral](plugin://anhedral@anhedral). Start by explaining the stack and asking me what it should be about.
|
|
49
|
+
Use `--skip-install --no-git` for source-only generation. This mode requires no network. Keep the project CLI version pinned before applying additions; edited-source conflicts are preserved rather than overwritten.
|
|
167
50
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
## Read next
|
|
171
|
-
|
|
172
|
-
| Document | Use it to answer |
|
|
173
|
-
| -------------------------------------------- | ------------------------------------------------------------------------ |
|
|
174
|
-
| [Stack standard](docs/stack-standard.md) | What should the application contain, and how should it fit together? |
|
|
175
|
-
| [Software factory](docs/software-factory.md) | How do I turn a brief into a tested, delivered and maintainable product? |
|
|
176
|
-
|
|
177
|
-
The [verification record](docs/verification.md) keeps dated code reviews, provider evidence and remaining acceptance gaps together. Provider setup, CLI behavior, dashboard development and the release process are sections of the software factory.
|
|
178
|
-
|
|
179
|
-
Use `anhedral --help` and `anhedral help <command>` for command options. `--cwd` selects the project; `--json` produces structured output. Use its [provider configuration](docs/software-factory.md#provider-configuration), [CLI behavior](docs/software-factory.md#cli-behavior), [Codex dashboard](docs/software-factory.md#project-dashboard) and [release process](docs/software-factory.md#maintain-and-release-the-cli) sections for details.
|
|
180
|
-
|
|
181
|
-
## Work on the CLI
|
|
182
|
-
|
|
183
|
-
```sh
|
|
184
|
-
pnpm install --frozen-lockfile
|
|
185
|
-
pnpm build
|
|
186
|
-
node dist/bin.js init ../my-test-app --dry-run --json
|
|
187
|
-
pnpm test:all
|
|
188
|
-
```
|
|
51
|
+
Deployable applications live in `apps/web`, `apps/mobile` and `apps/api`; shared contracts, database, auth and styling live in `packages`. The API owns data access and authorization. Clients never receive provider management credentials.
|
|
189
52
|
|
|
190
|
-
|
|
53
|
+
Read the [stack standard](docs/stack-standard.md), [development and delivery workflow](docs/software-factory.md), [architecture diagram](docs/anhedral-stack.md), and [verification record](docs/verification.md).
|
|
191
54
|
|
|
192
|
-
|
|
55
|
+
Version 0.15 separates Next.js web from Expo native. Web uses the full App Router with SSR and React Server Components through OpenNext; Expo has no browser build. The focused catalog retains only Stripe and RevenueCat additions. Existing applications are not automatically migrated or reinitialized; retain their pinned older CLI until a reviewed migration is available. Historical versions remain in Git history and release tags.
|
|
@@ -63,8 +63,18 @@ export function verifyAuditReport(report, { status, patchedCoordinates = [] } =
|
|
|
63
63
|
)
|
|
64
64
|
)
|
|
65
65
|
fail('Incomplete advisory details; no advisory exception was applied.');
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
// pnpm emits separate peer/workspace instances with the same version.
|
|
67
|
+
// Keep every instance in severity counts; only an identical version/path
|
|
68
|
+
// repeated within this advisory is ambiguous report data.
|
|
69
|
+
const affectedPaths = new Set();
|
|
70
|
+
for (const item of finding.findings) {
|
|
71
|
+
for (const dependencyPath of item.paths) {
|
|
72
|
+
const coordinate = JSON.stringify([item.version, dependencyPath]);
|
|
73
|
+
if (affectedPaths.has(coordinate))
|
|
74
|
+
fail('Duplicate affected version/path in advisory details.');
|
|
75
|
+
affectedPaths.add(coordinate);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
68
78
|
counts[finding.severity] += finding.findings.length;
|
|
69
79
|
}
|
|
70
80
|
for (const severity of severities) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 shadcn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"style": "base-nova",
|
|
3
|
+
"retrieved": "2026-10-21",
|
|
4
|
+
"files": {
|
|
5
|
+
"button": {
|
|
6
|
+
"source": "https://ui.shadcn.com/r/styles/base-nova/button.json",
|
|
7
|
+
"sha256": "bc0b97cbd544328a0e2e4b3ab5996373a9cc26994815111c1effb6d7ca98081c"
|
|
8
|
+
},
|
|
9
|
+
"input": {
|
|
10
|
+
"source": "https://ui.shadcn.com/r/styles/base-nova/input.json",
|
|
11
|
+
"sha256": "b4d1fa668ce203a2d78af7eb23e3769de303d46c983e3e40bed7018423efccb2"
|
|
12
|
+
},
|
|
13
|
+
"card": {
|
|
14
|
+
"source": "https://ui.shadcn.com/r/styles/base-nova/card.json",
|
|
15
|
+
"sha256": "a3b2cb98311bb9ce9475b6cf07d28b9a8eaac282ea6ff51ea77d1d3516947e54"
|
|
16
|
+
},
|
|
17
|
+
"label": {
|
|
18
|
+
"source": "https://ui.shadcn.com/r/styles/base-nova/label.json",
|
|
19
|
+
"sha256": "ef2ca2ddbd0eb67f3a0f59ee5d970c213172a8edc7bb2b28c9d69020bc6ba950"
|
|
20
|
+
},
|
|
21
|
+
"dialog": {
|
|
22
|
+
"source": "https://ui.shadcn.com/r/styles/base-nova/dialog.json",
|
|
23
|
+
"sha256": "ace3d5ba732f66e14bd1062306f9022a32040f7c168a697ebb483b4e80cbd7fd"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"adaptations": [
|
|
27
|
+
"The Base Nova web Button uses the local cn utility, an explicit React client boundary and a public variant export.",
|
|
28
|
+
"Native components are Anhedral-maintained React Native ports, isolated from DOM components and without React Native Reusables.",
|
|
29
|
+
"Native themes derive their colors from the generated shared semantic tokens; no separate native palette is installed.",
|
|
30
|
+
"Native Dialog restores focus to its actionable trigger on both iOS dismissal and Android close transitions.",
|
|
31
|
+
"Recovered Input and Label use the local cn utility; Input delegates keyboard focus styling to the existing shared global focus rule."
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Pressable, Text, StyleSheet, type View, type PressableProps } from 'react-native';
|
|
2
|
+
import { Children, type ReactNode, type Ref } from 'react';
|
|
3
|
+
import { useTheme } from '../theme';
|
|
4
|
+
export type ButtonProps = Omit<PressableProps, 'children'> & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
ref?: Ref<View>;
|
|
7
|
+
variant?: 'default' | 'outline' | 'secondary' | 'ghost' | 'destructive' | 'link';
|
|
8
|
+
size?: 'default' | 'sm' | 'lg' | 'icon';
|
|
9
|
+
};
|
|
10
|
+
const sizes = {
|
|
11
|
+
default: { minHeight: 44 },
|
|
12
|
+
sm: { minHeight: 44 },
|
|
13
|
+
lg: { minHeight: 48 },
|
|
14
|
+
icon: { minHeight: 44, minWidth: 44 },
|
|
15
|
+
};
|
|
16
|
+
export function Button({
|
|
17
|
+
children,
|
|
18
|
+
variant = 'default',
|
|
19
|
+
size = 'default',
|
|
20
|
+
style,
|
|
21
|
+
disabled,
|
|
22
|
+
accessibilityState,
|
|
23
|
+
...props
|
|
24
|
+
}: ButtonProps) {
|
|
25
|
+
const { colors } = useTheme();
|
|
26
|
+
const backgrounds = {
|
|
27
|
+
default: colors.primary,
|
|
28
|
+
secondary: colors.secondary,
|
|
29
|
+
outline: colors.background,
|
|
30
|
+
ghost: 'transparent',
|
|
31
|
+
destructive: 'transparent',
|
|
32
|
+
link: 'transparent',
|
|
33
|
+
};
|
|
34
|
+
const foregrounds = {
|
|
35
|
+
default: colors['primary-foreground'],
|
|
36
|
+
secondary: colors.foreground,
|
|
37
|
+
outline: colors.foreground,
|
|
38
|
+
ghost: colors.foreground,
|
|
39
|
+
destructive: colors.destructive,
|
|
40
|
+
link: colors.primary,
|
|
41
|
+
};
|
|
42
|
+
const surface = {
|
|
43
|
+
backgroundColor: backgrounds[variant],
|
|
44
|
+
borderColor: variant === 'outline' ? colors.border : 'transparent',
|
|
45
|
+
};
|
|
46
|
+
return (
|
|
47
|
+
<Pressable
|
|
48
|
+
{...props}
|
|
49
|
+
accessibilityRole="button"
|
|
50
|
+
accessibilityState={{ ...accessibilityState, disabled: !!disabled }}
|
|
51
|
+
disabled={disabled}
|
|
52
|
+
style={(state) => [
|
|
53
|
+
styles.button,
|
|
54
|
+
sizes[size],
|
|
55
|
+
surface,
|
|
56
|
+
disabled && styles.disabled,
|
|
57
|
+
state.pressed && styles.pressed,
|
|
58
|
+
typeof style === 'function' ? style(state) : style,
|
|
59
|
+
]}
|
|
60
|
+
>
|
|
61
|
+
{Children.map(children, (child) =>
|
|
62
|
+
typeof child === 'string' || typeof child === 'number' ? (
|
|
63
|
+
<Text style={[styles.label, { color: foregrounds[variant] }]}>{child}</Text>
|
|
64
|
+
) : (
|
|
65
|
+
child
|
|
66
|
+
),
|
|
67
|
+
)}
|
|
68
|
+
</Pressable>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const styles = StyleSheet.create({
|
|
72
|
+
button: {
|
|
73
|
+
borderRadius: 8,
|
|
74
|
+
borderWidth: 1,
|
|
75
|
+
paddingHorizontal: 12,
|
|
76
|
+
paddingVertical: 10,
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
gap: 6,
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
justifyContent: 'center',
|
|
81
|
+
},
|
|
82
|
+
label: { fontSize: 14, fontWeight: '500' },
|
|
83
|
+
disabled: { opacity: 0.5 },
|
|
84
|
+
pressed: { opacity: 0.75 },
|
|
85
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { View, type ViewProps } from 'react-native';
|
|
2
|
+
import { Text, type TextProps } from './text';
|
|
3
|
+
import { useTheme } from '../theme';
|
|
4
|
+
export function Card({ style, ...props }: ViewProps) {
|
|
5
|
+
const { colors } = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<View
|
|
8
|
+
{...props}
|
|
9
|
+
style={[
|
|
10
|
+
{
|
|
11
|
+
backgroundColor: colors.card,
|
|
12
|
+
borderWidth: 1,
|
|
13
|
+
borderColor: colors.border,
|
|
14
|
+
borderRadius: 12,
|
|
15
|
+
paddingVertical: 16,
|
|
16
|
+
gap: 16,
|
|
17
|
+
},
|
|
18
|
+
style,
|
|
19
|
+
]}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export function CardContent({ style, ...props }: ViewProps) {
|
|
24
|
+
return <View {...props} style={[{ paddingHorizontal: 16, gap: 12 }, style]} />;
|
|
25
|
+
}
|
|
26
|
+
export const CardHeader = CardContent;
|
|
27
|
+
export const CardFooter = CardContent;
|
|
28
|
+
export function CardTitle(props: TextProps) {
|
|
29
|
+
return <Text variant="title" {...props} />;
|
|
30
|
+
}
|
|
31
|
+
export function CardDescription(props: TextProps) {
|
|
32
|
+
return <Text variant="muted" {...props} />;
|
|
33
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Modal, View, Pressable, AccessibilityInfo, findNodeHandle, Platform } from 'react-native';
|
|
2
|
+
import { useEffect, useRef, type ReactNode } from 'react';
|
|
3
|
+
import { Button } from './button';
|
|
4
|
+
import { Text } from './text';
|
|
5
|
+
import { useTheme } from '../theme';
|
|
6
|
+
export function Dialog({
|
|
7
|
+
open,
|
|
8
|
+
onOpenChange,
|
|
9
|
+
title,
|
|
10
|
+
description,
|
|
11
|
+
children,
|
|
12
|
+
triggerLabel,
|
|
13
|
+
}: {
|
|
14
|
+
open: boolean;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
triggerLabel: string;
|
|
20
|
+
}) {
|
|
21
|
+
const { colors } = useTheme();
|
|
22
|
+
const trigger = useRef<View>(null);
|
|
23
|
+
const heading = useRef<View>(null);
|
|
24
|
+
function focus(ref: typeof heading) {
|
|
25
|
+
const node = findNodeHandle(ref.current);
|
|
26
|
+
if (node) AccessibilityInfo.setAccessibilityFocus(node);
|
|
27
|
+
}
|
|
28
|
+
const previousOpen = useRef(open);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const closed = previousOpen.current && !open;
|
|
31
|
+
previousOpen.current = open;
|
|
32
|
+
// RN Modal.onDismiss is iOS-only. Android removes the Modal in this commit.
|
|
33
|
+
if (!closed || Platform.OS === 'ios') return;
|
|
34
|
+
const frame = requestAnimationFrame(() => focus(trigger));
|
|
35
|
+
return () => cancelAnimationFrame(frame);
|
|
36
|
+
}, [open]);
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<Button ref={trigger} onPress={() => onOpenChange(true)}>
|
|
40
|
+
{triggerLabel}
|
|
41
|
+
</Button>
|
|
42
|
+
<Modal
|
|
43
|
+
visible={open}
|
|
44
|
+
transparent
|
|
45
|
+
animationType="fade"
|
|
46
|
+
onShow={() => focus(heading)}
|
|
47
|
+
onDismiss={() => focus(trigger)}
|
|
48
|
+
onRequestClose={() => onOpenChange(false)}
|
|
49
|
+
>
|
|
50
|
+
<View
|
|
51
|
+
style={{ flex: 1, justifyContent: 'center', padding: 24, backgroundColor: '#00000066' }}
|
|
52
|
+
>
|
|
53
|
+
<Pressable
|
|
54
|
+
accessibilityLabel="Close dialog"
|
|
55
|
+
onPress={() => onOpenChange(false)}
|
|
56
|
+
style={{ position: 'absolute', inset: 0 }}
|
|
57
|
+
/>
|
|
58
|
+
<View
|
|
59
|
+
accessibilityViewIsModal
|
|
60
|
+
style={{ backgroundColor: colors.popover, padding: 20, borderRadius: 12, gap: 16 }}
|
|
61
|
+
>
|
|
62
|
+
<View ref={heading} accessible accessibilityRole="header" accessibilityLabel={title}>
|
|
63
|
+
<Text variant="title">{title}</Text>
|
|
64
|
+
</View>
|
|
65
|
+
{description && <Text variant="muted">{description}</Text>}
|
|
66
|
+
{children}
|
|
67
|
+
<Button variant="outline" onPress={() => onOpenChange(false)}>
|
|
68
|
+
Close
|
|
69
|
+
</Button>
|
|
70
|
+
</View>
|
|
71
|
+
</View>
|
|
72
|
+
</Modal>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TextInput, type TextInputProps } from 'react-native';
|
|
2
|
+
import { useTheme } from '../theme';
|
|
3
|
+
export type InputProps = TextInputProps & { invalid?: boolean };
|
|
4
|
+
export function Input({ style, invalid, ...props }: InputProps) {
|
|
5
|
+
const { colors } = useTheme();
|
|
6
|
+
return (
|
|
7
|
+
<TextInput
|
|
8
|
+
{...props}
|
|
9
|
+
placeholderTextColor={colors['muted-foreground']}
|
|
10
|
+
selectionColor={colors.primary}
|
|
11
|
+
style={[
|
|
12
|
+
{
|
|
13
|
+
minHeight: 44,
|
|
14
|
+
borderWidth: 1,
|
|
15
|
+
borderColor: invalid ? colors.destructive : colors.input,
|
|
16
|
+
backgroundColor: colors.background,
|
|
17
|
+
color: colors.foreground,
|
|
18
|
+
borderRadius: 8,
|
|
19
|
+
paddingHorizontal: 12,
|
|
20
|
+
paddingVertical: 10,
|
|
21
|
+
fontSize: 16,
|
|
22
|
+
},
|
|
23
|
+
style,
|
|
24
|
+
]}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ScrollView, View, type ViewProps } from 'react-native';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { useTheme } from '../theme';
|
|
5
|
+
export function Stack({ style, ...props }: ViewProps) {
|
|
6
|
+
return <View {...props} style={[{ gap: 12 }, style]} />;
|
|
7
|
+
}
|
|
8
|
+
export function Screen({ children }: { children: ReactNode }) {
|
|
9
|
+
const insets = useSafeAreaInsets();
|
|
10
|
+
const { colors } = useTheme();
|
|
11
|
+
return (
|
|
12
|
+
<ScrollView
|
|
13
|
+
style={{ flex: 1, backgroundColor: colors.background }}
|
|
14
|
+
contentContainerStyle={{
|
|
15
|
+
paddingTop: insets.top + 24,
|
|
16
|
+
paddingBottom: insets.bottom + 24,
|
|
17
|
+
paddingHorizontal: 20,
|
|
18
|
+
flexGrow: 1,
|
|
19
|
+
}}
|
|
20
|
+
keyboardShouldPersistTaps="handled"
|
|
21
|
+
automaticallyAdjustKeyboardInsets
|
|
22
|
+
>
|
|
23
|
+
<View style={{ width: '100%', maxWidth: 640, alignSelf: 'center', gap: 24 }}>{children}</View>
|
|
24
|
+
</ScrollView>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Text as NativeText, StyleSheet, type TextProps as NativeTextProps } from 'react-native';
|
|
2
|
+
import { useTheme } from '../theme';
|
|
3
|
+
export type TextProps = NativeTextProps & {
|
|
4
|
+
variant?: 'heading' | 'title' | 'body' | 'muted' | 'caption' | 'label';
|
|
5
|
+
};
|
|
6
|
+
const typography = StyleSheet.create({
|
|
7
|
+
heading: { fontSize: 24, lineHeight: 32, fontWeight: '600' },
|
|
8
|
+
title: { fontSize: 16, lineHeight: 22, fontWeight: '500' },
|
|
9
|
+
body: { fontSize: 14, lineHeight: 20, fontWeight: '400' },
|
|
10
|
+
muted: { fontSize: 14, lineHeight: 20, fontWeight: '400' },
|
|
11
|
+
caption: { fontSize: 12, lineHeight: 20, fontWeight: '400' },
|
|
12
|
+
label: { fontSize: 14, lineHeight: 20, fontWeight: '500' },
|
|
13
|
+
});
|
|
14
|
+
export function Text({ variant = 'body', style, ...props }: TextProps) {
|
|
15
|
+
const { colors } = useTheme();
|
|
16
|
+
const color = ['muted', 'caption'].includes(variant)
|
|
17
|
+
? colors['muted-foreground']
|
|
18
|
+
: colors.foreground;
|
|
19
|
+
return <NativeText {...props} style={[typography[variant], { color }, style]} />;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Stack } from './layout';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
import { Text } from './text';
|
|
4
|
+
import { useTheme } from '../theme';
|
|
5
|
+
export function ThemeSwitcher() {
|
|
6
|
+
const { preference, setPreference } = useTheme();
|
|
7
|
+
return (
|
|
8
|
+
<Stack>
|
|
9
|
+
<Text variant="label">Appearance</Text>
|
|
10
|
+
{(['system', 'light', 'dark'] as const).map((value) => (
|
|
11
|
+
<Button
|
|
12
|
+
key={value}
|
|
13
|
+
variant={preference === value ? 'secondary' : 'ghost'}
|
|
14
|
+
accessibilityState={{ selected: preference === value }}
|
|
15
|
+
onPress={() => setPreference(value)}
|
|
16
|
+
>
|
|
17
|
+
{value === 'system' ? 'System' : value === 'light' ? 'Light' : 'Dark'}
|
|
18
|
+
</Button>
|
|
19
|
+
))}
|
|
20
|
+
</Stack>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Appearance } from 'react-native';
|
|
2
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
|
+
import * as SystemUI from 'expo-system-ui';
|
|
4
|
+
const key = 'anhedral-theme';
|
|
5
|
+
export async function readPreference() {
|
|
6
|
+
try {
|
|
7
|
+
return await AsyncStorage.getItem(key);
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function savePreference(value: string) {
|
|
13
|
+
try {
|
|
14
|
+
await AsyncStorage.setItem(key, value);
|
|
15
|
+
} catch {
|
|
16
|
+
/* Preferences remain usable without storage. */
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function applyTheme(mode: 'light' | 'dark', background: string, preference: string) {
|
|
20
|
+
Appearance.setColorScheme(preference === 'system' ? 'unspecified' : mode);
|
|
21
|
+
void SystemUI.setBackgroundColorAsync(background).catch(() => {});
|
|
22
|
+
}
|
|
23
|
+
export function subscribePreference(_listener: (value: unknown) => void) {
|
|
24
|
+
return () => {};
|
|
25
|
+
}
|