anhedral 0.11.2 → 0.13.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 +171 -18
- package/dist/bin.js +48 -493
- package/dist/capabilities.d.ts +3 -3
- package/dist/capability-contract.js +16 -1
- package/dist/cli-arguments.d.ts +8 -0
- package/dist/cli-arguments.js +32 -0
- package/dist/cli-commands.d.ts +3 -0
- package/dist/cli-commands.js +114 -0
- package/dist/cli-delivery.d.ts +3 -0
- package/dist/cli-delivery.js +172 -0
- package/dist/cli-output.js +231 -205
- package/dist/command-schema.js +8 -2
- package/dist/command.js +9 -11
- package/dist/delivery-evidence.d.ts +62 -0
- package/dist/delivery-evidence.js +186 -0
- package/dist/delivery.d.ts +3 -40
- package/dist/delivery.js +7 -182
- package/dist/dependencies.d.ts +7 -1
- package/dist/dependencies.js +15 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mobile-delivery.d.ts +21 -44
- package/dist/mobile-delivery.js +127 -80
- package/dist/platforms/mobile.d.ts +1 -1
- package/dist/platforms/mobile.js +44 -3
- package/dist/project-state.js +4 -1
- package/dist/provider-auth.js +9 -3
- package/dist/providers/adapters.js +9 -3
- package/dist/providers/runtime.js +11 -0
- package/dist/readiness.js +4 -2
- package/dist/registry/add.js +40 -7
- package/dist/registry/options.js +12 -0
- package/dist/registry/presets.d.ts +4 -0
- package/dist/registry/presets.js +41 -0
- package/dist/registry/resolve.d.ts +3 -1
- package/dist/registry/resolve.js +40 -14
- package/dist/registry/types.d.ts +1 -0
- package/dist/registry/usage.js +1 -1
- package/dist/runtime-policy.js +4 -1
- package/dist/scaffold/api.js +10 -2
- package/dist/scaffold/auth.d.ts +1 -1
- package/dist/scaffold/auth.js +22 -6
- package/dist/scaffold/backend.d.ts +6 -0
- package/dist/scaffold/backend.js +224 -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 +216 -0
- package/dist/scaffold/cloudflare-services.d.ts +8 -0
- package/dist/scaffold/cloudflare-services.js +198 -0
- package/dist/scaffold/compose.js +2 -0
- package/dist/scaffold/database.js +19 -2
- package/dist/scaffold/documentation.js +11 -6
- package/dist/scaffold/expo-auth.d.ts +3 -0
- package/dist/scaffold/expo-auth.js +192 -0
- package/dist/scaffold/expo-billing.d.ts +3 -0
- package/dist/scaffold/expo-billing.js +292 -0
- package/dist/scaffold/expo-runtime.d.ts +3 -0
- package/dist/scaffold/expo-runtime.js +134 -0
- package/dist/scaffold/integrations.d.ts +2 -1
- package/dist/scaffold/integrations.js +7 -2
- package/dist/scaffold/stream.d.ts +2 -0
- package/dist/scaffold/stream.js +114 -0
- package/dist/scaffold/void.js +13 -5
- package/dist/scaffold/web.js +2 -0
- package/dist/scaffold/workspace.js +6 -1
- package/dist/service-readers.js +1 -1
- package/dist/services-command.js +8 -6
- package/dist/ship.d.ts +15 -15
- package/dist/ship.js +3 -1
- package/dist/stack-registry.d.ts +13 -2
- package/dist/stack-registry.js +152 -16
- package/dist/transaction-lock.d.ts +15 -0
- package/dist/transaction-lock.js +227 -0
- package/dist/transaction.js +2 -208
- package/dist/vercel-project.d.ts +101 -0
- package/dist/vercel-project.js +305 -0
- package/dist/vercel.d.ts +3 -36
- package/dist/vercel.js +3 -300
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +122 -0
- package/docs/software-factory.md +402 -7
- package/docs/stack-standard.md +226 -49
- package/docs/verification.md +557 -0
- package/package.json +7 -7
- package/docs/cli-design.md +0 -67
- package/docs/plugin-ui.md +0 -102
- package/docs/provider-configuration.md +0 -116
- package/docs/void-verification.md +0 -185
package/README.md
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/anhedral)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> 🚧 **Under construction.** Anhedral is in active development; features and APIs may change.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Anhedral creates TypeScript application workspaces and helps deliver them to your own cloud accounts. Start with a minimal universal frontend, add the services your product needs, and keep the source code, infrastructure, data and billing under your control.
|
|
10
|
+
|
|
11
|
+
The default is a **minimal Expo web/iOS/Android app** with React Native Reusables using shadcn conventions, NativeWind, shared styling, TypeScript, pnpm and Turborepo. Cloudflare hosts its static web export. Add API, accounts, data, files, payments or AI when needed; the resolver supplies dependencies. `--preset full-product` selects the complete compatible product foundation without activating services.
|
|
10
12
|
|
|
11
13
|
## Start locally
|
|
12
14
|
|
|
@@ -24,23 +26,162 @@ cd my-app
|
|
|
24
26
|
pnpm dev
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
Initialization
|
|
29
|
+
Initialization creates the selected frontend and API foundations, downloads any required pinned upstream starter and installs dependencies. It does not provision cloud services or deploy the app. Follow the generated README for local addresses and any setup required by your selection. You can also run the CLI with `pnpm dlx anhedral@latest`; pin a version for repeatable automation.
|
|
30
|
+
|
|
31
|
+
## Progressive stack
|
|
32
|
+
|
|
33
|
+
Plain init creates only the Expo client, styling and tooling. Add capabilities for
|
|
34
|
+
real requirements, or use `--preset full-product` for the complete compatible
|
|
35
|
+
foundation. [See the concise stack page](docs/anhedral-stack.md).
|
|
36
|
+
|
|
37
|
+
```mermaid
|
|
38
|
+
%%{init: {"flowchart": {"curve": "linear", "nodeSpacing": 35, "rankSpacing": 50, "padding": 18}}}%%
|
|
39
|
+
flowchart TB
|
|
40
|
+
subgraph minimal["1 · Minimal default"]
|
|
41
|
+
client["Expo · web / iOS / Android<br/>React Native Reusables · shadcn conventions<br/>NativeWind · shared tokens"]
|
|
42
|
+
web["Cloudflare static web Worker"]
|
|
43
|
+
client -->|"web export"| web
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
subgraph optional["2 · Optional capabilities · choose independently"]
|
|
47
|
+
backend["Hono API · Cloudflare Workers<br/>Public contracts · authorization"]
|
|
48
|
+
core["Data, accounts and files<br/>Drizzle / D1 · Better Auth · private R2 · KV"]
|
|
49
|
+
compute["AI, analytics and processing<br/>Workers AI · Analytics Engine · Basin<br/>Images · Queues · Cron · Workflows"]
|
|
50
|
+
media["Realtime and video<br/>Durable Object rooms · RealtimeKit<br/>Stream live / uploaded video"]
|
|
51
|
+
payments["Payments<br/>Stripe web · RevenueCat native<br/>Shared entitlements enforced by Hono"]
|
|
52
|
+
clients["Additional client<br/>WXT browser side panel"]
|
|
53
|
+
operations["External operations<br/>Resend email · Sentry monitoring"]
|
|
54
|
+
backend -.-> core
|
|
55
|
+
backend -.-> compute
|
|
56
|
+
backend -.-> media
|
|
57
|
+
backend -.-> payments
|
|
58
|
+
backend -.-> operations
|
|
59
|
+
clients -.->|"when a backend is needed"| backend
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
web ~~~ clients
|
|
63
|
+
web -.->|"add API service binding"| backend
|
|
64
|
+
client -.->|"native HTTPS when selected"| backend
|
|
65
|
+
|
|
66
|
+
subgraph full["3 · Full-product preset · selection summary"]
|
|
67
|
+
preset["Minimal app + all capabilities above<br/>22 selected products · no provider activation"]
|
|
68
|
+
end
|
|
69
|
+
core ~~~ preset
|
|
70
|
+
compute ~~~ preset
|
|
71
|
+
media ~~~ preset
|
|
72
|
+
payments ~~~ preset
|
|
73
|
+
operations ~~~ preset
|
|
74
|
+
```
|
|
28
75
|
|
|
29
|
-
|
|
76
|
+
| Need | Selection | Added automatically |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| Minimal client | Plain init / `--preset minimal` | Expo, NativeWind, shared tokens and workspace tooling |
|
|
79
|
+
| Server logic | `--expo --hono` | Hono API and public contracts |
|
|
80
|
+
| Persistence | `--d1` | Hono and Drizzle/D1 |
|
|
81
|
+
| Accounts | `--better-auth` | Hono, a database and browser/native auth |
|
|
82
|
+
| AI | `--workers-ai` | Hono and AI binding; no implicit accounts or billing |
|
|
83
|
+
| Full product | `--preset full-product` | All compatible Cloudflare layers, WXT, payments, email and monitoring |
|
|
84
|
+
|
|
85
|
+
The full preset includes Expo, WXT side panel, Hono, Better Auth, D1, R2, KV,
|
|
86
|
+
Stripe, RevenueCat, Workers AI, Analytics Engine, Basin/Pipelines, Images,
|
|
87
|
+
RealtimeKit, Durable Object rooms, uploaded/live Stream video, Queues, Cron,
|
|
88
|
+
Workflows, Resend and Sentry. Bindings and helpers still need product logic,
|
|
89
|
+
provider setup and real acceptance. Init never provisions or activates services.
|
|
30
90
|
|
|
31
|
-
|
|
91
|
+
```sh
|
|
92
|
+
anhedral init complete --preset full-product --dry-run --json
|
|
93
|
+
anhedral add better-auth --cwd my-app --dry-run --json
|
|
94
|
+
anhedral add workers-ai images --cwd my-app --dry-run --json
|
|
95
|
+
anhedral add stripe revenuecat --cwd my-app --dry-run --json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Additions preserve edited source and reject conflicting regeneration or backend
|
|
99
|
+
relocation. Auth additions expose `/sign-in` and `/account` for product navigation.
|
|
100
|
+
|
|
101
|
+
## Choose the applications
|
|
102
|
+
|
|
103
|
+
Expo on Cloudflare is the minimal universal default. **Next.js on Vercel**
|
|
104
|
+
(`--next`) is the usual explicit web alternative; **Vinext on Cloudflare**
|
|
105
|
+
(`--vinext`) is also available. `--hono`, `--wxt` and `--electron` alone select
|
|
106
|
+
standalone applications; combine them with `--expo` when desired. Explicit Neon
|
|
107
|
+
or Clerk replace the full preset's D1 or Better Auth selections. OpenNext remains
|
|
108
|
+
an explicit compatibility profile (`--next --hosting=cloudflare`).
|
|
109
|
+
|
|
110
|
+
Every workspace uses pnpm and Turborepo with shared TypeScript/ESLint configuration
|
|
111
|
+
and one root lockfile. Public contracts appear with Hono; server auth, database
|
|
112
|
+
and billing packages appear only when selected. Root `pnpm dev` serves exported
|
|
113
|
+
Expo web on 3000 and Hono on 8787 when present. Native Metro uses
|
|
114
|
+
`pnpm --dir apps/mobile start`. Browser changes need a re-export; this is not HMR.
|
|
115
|
+
Keep SDK 57 pinned and provide build-time paths for static dynamic routes.
|
|
116
|
+
|
|
117
|
+
## Choose data and identity
|
|
118
|
+
|
|
119
|
+
| Selection | Generates | Selection rule |
|
|
120
|
+
| --------------- | --------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
121
|
+
| `--d1` | Shared Drizzle/SQLite database package and migrations | Cloudflare runtime; alternative to Neon |
|
|
122
|
+
| `--neon` | Shared Drizzle/PostgreSQL package using Neon HTTP | Server required; separate direct migration connection |
|
|
123
|
+
| `--better-auth` | Auth factory, database schema and server auth routes | Adds D1 when no database is selected; can use Neon |
|
|
124
|
+
| `--clerk` | Managed web identity integration and/or backend authentication helper | Alternative to Better Auth; server required |
|
|
125
|
+
| `--local-data` | Device-local persistence interface | Implement platform adapters and synchronization |
|
|
126
|
+
|
|
127
|
+
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.
|
|
128
|
+
|
|
129
|
+
## Choose services and integrations
|
|
130
|
+
|
|
131
|
+
Private R2 and every service below are optional; full-product selects the complete compatible set. The generated scope column distinguishes bindings and Workers from SDK factories and integration guidance.
|
|
132
|
+
|
|
133
|
+
| Selection | Purpose | Generated scope |
|
|
134
|
+
| ----------------- | --------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
135
|
+
| `--r2` | Private files | R2 Worker binding and authorization guidance |
|
|
136
|
+
| `--analytics-engine` | Custom event analytics | Dataset binding and privacy-safe server event helper |
|
|
137
|
+
| `--images` | Image processing | Images binding and private raw-byte transform helper |
|
|
138
|
+
| `--realtimekit` | Audio/video conferencing | Meeting/participant-token helpers; client SDK/UI remains product work |
|
|
139
|
+
| `--video` | Uploaded video | Private Stream upload helper; implement processing checks and signed playback |
|
|
140
|
+
| `--kv` | Cache/configuration | Eventually consistent Worker binding |
|
|
141
|
+
| `--realtime` | WebSocket rooms | Separate Durable Object Worker; implement room authorization |
|
|
142
|
+
| `--neon-realtime` | Live PostgreSQL query results | Server/client factories and Drizzle adapter; adds Neon; manual branch activation |
|
|
143
|
+
| `--stream` | One-to-many live video | Cloudflare Stream WHIP/WHEP; server management factory; manual activation and product UI |
|
|
144
|
+
| `--queues` | Background jobs | Producer, consumer and dead-letter configuration; implement processing/idempotency |
|
|
145
|
+
| `--cron` | Scheduled work | Separate Worker with an hourly starter schedule |
|
|
146
|
+
| `--workflows` | Durable multi-step work | Separate Worker with a starter validation step |
|
|
147
|
+
| `--workers-ai` | Cloudflare inference | Worker AI binding; implement model calls |
|
|
148
|
+
| `--openai` | Direct OpenAI integration | Server SDK factory in `packages/ai` |
|
|
149
|
+
| `--ai-sdk` | AI streaming/provider abstraction | AI SDK exports with an OpenAI provider; alternative to `--openai` |
|
|
150
|
+
| `--resend` | Transactional email | Server SDK factory in `packages/email` |
|
|
151
|
+
| `--stripe` | Payments/subscriptions | Hono Checkout/portal/webhooks, DB projection and server entitlement guard |
|
|
152
|
+
| `--revenuecat` | Cross-store entitlements | Native purchase/restore/manage plus Hono webhooks and shared entitlement projection |
|
|
153
|
+
| `--sentry` | Error/crash monitoring | Integration boundary and redaction fields; initialize platform SDKs |
|
|
154
|
+
| `--posthog` | Product analytics | Server analytics factory |
|
|
155
|
+
| `--basin` | Cloudflare analytical events | Private stream binding and event helper |
|
|
156
|
+
| `--styling` | Shared design tokens | Light/dark tokens and Tailwind preset; automatically included with Expo/WXT |
|
|
157
|
+
|
|
158
|
+
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).
|
|
159
|
+
|
|
160
|
+
### Composition rules
|
|
161
|
+
|
|
162
|
+
- Choose one web framework, one database and one identity provider; D1 and Better Auth are the defaults when data/identity is needed. `--openai` and `--ai-sdk` are alternatives.
|
|
163
|
+
- Database/auth, Stream and Neon Realtime selections need a compatible server. For mobile with PostgreSQL, use `--expo --hono --neon`.
|
|
164
|
+
- New server capabilities introduce Hono on Cloudflare, including for Next.js/Vercel. Existing apps retain runtime ownership during `add`.
|
|
165
|
+
- New Expo workspaces, explicit OpenNext, Queues, Basin, Images and Analytics Engine use Wrangler for the Cloudflare workspace. Other supported Cloudflare selections use Void. `add` rejects changes that switch an existing engine or relocate runtime source.
|
|
166
|
+
- Neon Realtime requires Neon and manual Realtime configuration. Stripe and RevenueCat are independently optional; WXT is an optional browser-extension interface.
|
|
167
|
+
|
|
168
|
+
Examples:
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
# Web with database-backed identity; Better Auth adds D1.
|
|
172
|
+
anhedral init my-app --better-auth
|
|
32
173
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
| Default web app | `anhedral init my-app` |
|
|
36
|
-
| Web with D1 and Better Auth | `anhedral init my-app --vinext --d1 --better-auth` |
|
|
37
|
-
| Web and shared API with PostgreSQL | `anhedral init my-app --vinext --hono --neon` |
|
|
38
|
-
| Native Next.js on Vercel | `anhedral init my-app --next` |
|
|
39
|
-
| Expo mobile app | `anhedral init my-app --expo` |
|
|
40
|
-
| Electron desktop app | `anhedral init my-app --electron` |
|
|
41
|
-
| WXT browser extension | `anhedral init my-app --wxt` |
|
|
174
|
+
# Universal web/iOS/Android, shared API and PostgreSQL.
|
|
175
|
+
anhedral init my-app --expo --neon
|
|
42
176
|
|
|
43
|
-
|
|
177
|
+
# Vercel web with a Cloudflare API and private files.
|
|
178
|
+
anhedral init my-app --next --r2
|
|
179
|
+
|
|
180
|
+
# Live broadcasts with independent room messaging and SQL subscriptions.
|
|
181
|
+
anhedral init my-app --stream --neon-realtime --realtime
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Inspect the full catalog and preview later additions:
|
|
44
185
|
|
|
45
186
|
```sh
|
|
46
187
|
anhedral registry list
|
|
@@ -58,10 +199,20 @@ Implement the product, configure selected integrations and review database migra
|
|
|
58
199
|
```sh
|
|
59
200
|
anhedral auth --status --json
|
|
60
201
|
anhedral doctor --providers --json
|
|
202
|
+
# Select the intended account and audience, then commit source/configuration.
|
|
203
|
+
anhedral connect --audience private --allow-email owner@example.com
|
|
204
|
+
git add .
|
|
205
|
+
git commit -m "Implement application and delivery configuration"
|
|
61
206
|
anhedral ship --dry-run --json
|
|
207
|
+
anhedral ship --json
|
|
208
|
+
anhedral verify --json
|
|
62
209
|
```
|
|
63
210
|
|
|
64
|
-
|
|
211
|
+
Replace the example member with the intended user. Private Cloudflare hosting requires Zero Trust and scoped Access permissions; native Vercel uses its own connect options in the factory. Implement a meaningful `test:live` script before `verify`. Actual shipping can create resources, apply reviewed deployment migrations and publish code. Provider permissions, account eligibility and usage charges still apply. A generated starter or successful deployment does not establish a working product.
|
|
212
|
+
|
|
213
|
+
Cloudflare and Vercel have automated delivery and provider evidence checks. Mixed delivery runs Cloudflare before Vercel and can partially succeed. Expo native shipping with an explicit platform 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.
|
|
214
|
+
|
|
215
|
+
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).
|
|
65
216
|
|
|
66
217
|
## Use with Codex
|
|
67
218
|
|
|
@@ -74,7 +225,7 @@ Select **Try now**, or start with:
|
|
|
74
225
|
|
|
75
226
|
> Create a new project using [@Anhedral](plugin://anhedral@anhedral). Start by explaining the stack and asking me what it should be about.
|
|
76
227
|
|
|
77
|
-
The plugin
|
|
228
|
+
The plugin ships six focused skills: Init, Dev, Design, Auth, Billing and Hosting. They guide implementation using the same stack and workflow. Its optional inspector shows project structure, setup, recorded delivery evidence and explicit service controls. Opening it does not deploy the app. The CLI works independently.
|
|
78
229
|
|
|
79
230
|
## Read next
|
|
80
231
|
|
|
@@ -83,7 +234,9 @@ The plugin guides implementation using the same stack and workflow. Its optional
|
|
|
83
234
|
| [Stack standard](docs/stack-standard.md) | What should the application contain, and how should it fit together? |
|
|
84
235
|
| [Software factory](docs/software-factory.md) | How do I turn a brief into a tested, delivered and maintainable product? |
|
|
85
236
|
|
|
86
|
-
|
|
237
|
+
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.
|
|
238
|
+
|
|
239
|
+
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.
|
|
87
240
|
|
|
88
241
|
## Work on the CLI
|
|
89
242
|
|