anhedral 0.4.0 → 0.4.2

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 (52) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/README.md +76 -57
  4. package/SKILL.md +107 -12
  5. package/assets/anhedral-cli-init.svg +238 -0
  6. package/assets/images/svg/ably-symbol-color.svg +8 -0
  7. package/assets/images/svg/logo-white-subtract.svg +4 -0
  8. package/dist/architecture/index.d.ts +2 -2
  9. package/dist/architecture/index.js +1 -1
  10. package/dist/architecture/modules.d.ts +5 -1
  11. package/dist/architecture/modules.js +4 -1
  12. package/dist/bin.js +113 -84
  13. package/dist/cli.d.ts +7 -7
  14. package/dist/cli.js +62 -16
  15. package/dist/dependencies.d.ts +1 -0
  16. package/dist/dependencies.js +11 -8
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +1 -1
  19. package/dist/project.d.ts +30 -0
  20. package/dist/project.js +1 -0
  21. package/dist/prompts.d.ts +4 -3
  22. package/dist/prompts.js +29 -7
  23. package/dist/scaffold.d.ts +12 -24
  24. package/dist/scaffold.js +345 -124
  25. package/dist/templates/api.d.ts +1 -1
  26. package/dist/templates/api.js +67 -2
  27. package/dist/templates/assets-private-proxy.d.ts +1 -1
  28. package/dist/templates/desktop.d.ts +1 -1
  29. package/dist/templates/desktop.js +189 -36
  30. package/dist/templates/electron-updater.d.ts +1 -1
  31. package/dist/templates/electron-updater.js +1 -1
  32. package/dist/templates/extension.d.ts +1 -1
  33. package/dist/templates/extension.js +138 -14
  34. package/dist/templates/first-run.d.ts +2 -0
  35. package/dist/templates/first-run.js +167 -0
  36. package/dist/templates/mobile.d.ts +1 -1
  37. package/dist/templates/mobile.js +158 -17
  38. package/dist/templates/shared.d.ts +1 -1
  39. package/dist/templates/shared.js +64 -7
  40. package/dist/templates/web.d.ts +1 -1
  41. package/dist/templates/web.js +185 -28
  42. package/dist/version.d.ts +1 -1
  43. package/dist/version.js +1 -1
  44. package/docs/NORTHSTAR.md +114 -0
  45. package/docs/conventions.md +6 -4
  46. package/docs/engineering-principles.md +88 -0
  47. package/docs/master-stack-map.md +7 -0
  48. package/docs/output-tree-contract.md +16 -5
  49. package/docs/references/manual-scaffolding.md +22 -4
  50. package/docs/references/provisioning.md +434 -77
  51. package/package.json +10 -2
  52. package/scripts/render-master-stack-map.mjs +510 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,65 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.4.2 - 2026-07-23
10
+
11
+ ### Added
12
+
13
+ - Add idempotent `pnpm first-run` setup plus a secret-safe `pnpm ready` gate with
14
+ human and JSON output, required/optional variable awareness, and truthful exit
15
+ status.
16
+ - Generate a working items feature across Drizzle, Zod contracts, Fastify
17
+ routes, the shared API client, and idiomatic Next.js, Expo, Electron, and WXT
18
+ interfaces for every selected client.
19
+ - Add explicit `--all`, automatic Git initialization for `new`, dependency-resolution previews, confirmation, exact generated lifecycle scripts, UI-provider command previews, and actionable `doctor` recommendations.
20
+ - Add a published DX north star that defines measurable discovery, creation,
21
+ configuration, development, extension, diagnosis, upgrade, and shipping
22
+ journeys.
23
+
24
+ ### Changed
25
+
26
+ - Default interactive creation to a focused web app with optional capabilities while preserving the complete-stack default for noninteractive compatibility.
27
+ - Replace deprecated Turborepo development commands, make cache outputs package-specific, and let typechecks depend on upstream typechecks instead of builds.
28
+ - Track bundled UI primitives in the project manifest and make generated onboarding, deployment, provider, and source-location guidance selection-aware.
29
+ - Include status, generator version, project root, resolved modules, and next
30
+ steps in machine-readable plans; make human lifecycle output concise unless a
31
+ dry-run or verbose path listing is requested.
32
+
33
+ ### Fixed
34
+
35
+ - Allow Next.js client API factories to render safely during production prerendering while preserving HTTPS enforcement for non-loopback production endpoints.
36
+ - Make generated lifecycle commands reproducible even though Anhedral is intentionally not installed in application dependencies.
37
+ - Forward arguments through generated pnpm lifecycle scripts without inserting a literal `--` that the Anhedral or provider CLI would reject.
38
+ - Treat generated Clerk placeholder keys as unconfigured on every client instead
39
+ of mounting providers with knowingly invalid values.
40
+ - Keep Electron starter features synchronized with Clerk sign-in changes instead
41
+ of treating an opened account dialog as an authenticated session.
42
+ - Put reviewed database migration generation, Git staging, verification, and
43
+ application in one consistent onboarding order.
44
+ - Detect required environment variables that were deleted from an existing
45
+ package-local configuration file.
46
+
47
+ ### Security
48
+
49
+ - Scope generated starter-item reads and writes to the authenticated Clerk user
50
+ whenever authentication is selected.
51
+ - Reject local home-directory paths and email addresses in source and packed
52
+ release artifacts while continuing to allow documentation placeholders and
53
+ public GitHub noreply contributor identities.
54
+
55
+ ## 0.4.1 - 2026-07-22
56
+
57
+ ### Added
58
+
59
+ - Add the public launch artwork, reusable stack-map renderer, and expanded brand asset library to the repository and published package.
60
+
61
+ ### Changed
62
+
63
+ - Present Anhedral as a cross-platform, modular product stack that lets teams build once, ship everywhere, and scale without repeating framework setup.
64
+ - Automatically create patch versions for ordinary changes merged to `main`, while preserving explicitly declared minor and major releases.
65
+ - Keep project upgrades compatible across automatic patch releases and retain the supported 0.3-to-0.4 ownership migration.
66
+ - Publish from the exact generated release commit and attach npm provenance now that the source repository is public.
67
+
9
68
  ## 0.4.0 - 2026-07-22
10
69
 
11
70
  ### Added
package/CONTRIBUTING.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Contributing
2
2
 
3
+ Changes should follow the repository's
4
+ [engineering principles](docs/engineering-principles.md): explicit behavior,
5
+ one source of truth, narrow namespaces, visible failures, and focused tests.
6
+
3
7
  ## Local setup
4
8
 
5
9
  Anhedral requires Node.js 20.19+ or 22.12+ and pnpm 10.34.5.
package/README.md CHANGED
@@ -1,14 +1,23 @@
1
1
  # Anhedral
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/anhedral.svg)](https://www.npmjs.com/package/anhedral)
4
- [![node](https://img.shields.io/node/v/anhedral.svg)](https://www.npmjs.com/package/anhedral)
4
+ [![Node.js ^20.19.0 or >=22.12.0](https://img.shields.io/badge/Node.js-%5E20.19.0%20%7C%7C%20%3E%3D22.12.0-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)
5
5
 
6
6
  Anhedral generates a complete, production-oriented TypeScript stack whose source code stays understandable and customizable.
7
7
 
8
- > **Three-second version:** Start with the full TypeScript stack. Keep every escape hatch.
8
+ > **Build once. Ship everywhere. Scale is built in.** Pick the platforms,
9
+ > frameworks, and features your product needs; Anhedral assembles them into a
10
+ > production-ready TypeScript workspace for web, iOS, Android, desktop, APIs,
11
+ > and browser extensions. Start free, skip months of repetitive setup and
12
+ > integration work, and focus on what makes your app unique.
13
+
14
+ ![Anhedral Init Stack architecture diagram](assets/anhedral-cli-init.svg)
9
15
 
10
16
  Anhedral is not a new programming language and generated applications do not run inside a proprietary application framework. It assembles well-documented tools, connects their difficult integration boundaries, and leaves developers with ordinary Next.js, Expo Router, Fastify, Drizzle, Electron, and WXT projects.
11
17
 
18
+ The measurable product and developer-experience contract is documented in the
19
+ [Anhedral DX north star](docs/NORTHSTAR.md).
20
+
12
21
  Anhedral is open source under the [Apache License 2.0](LICENSE). You may use,
13
22
  modify, and distribute it subject to that license, including its notice and
14
23
  redistribution requirements. Generated applications remain ordinary project
@@ -38,21 +47,33 @@ release submissions. Paste secrets directly into the instructed uncommitted
38
47
 
39
48
  ## Create an application directly
40
49
 
41
- Create the complete stack:
50
+ In an interactive terminal, start Anhedral and choose the surfaces and
51
+ capabilities you need:
42
52
 
43
53
  ```sh
44
54
  pnpm dlx anhedral@latest new my-product
45
55
  cd my-product
46
56
  ```
47
57
 
58
+ The suggested selection is a focused web app, and Anhedral shows the complete
59
+ resolved stack before it writes anything. To explicitly create every supported
60
+ surface and capability, use:
61
+
62
+ ```sh
63
+ pnpm dlx anhedral@latest new my-product --all
64
+ ```
65
+
48
66
  The generated `README.md` contains the exact next steps for the selected stack.
49
- For the complete stack, copy the package-local environment examples, configure
50
- the selected managed providers—including a Neon `DATABASE_URL`—and create the
51
- reviewed initial migration before running `pnpm dev`. Anhedral intentionally
52
- does not generate a local Postgres substitute or pretend that production
53
- provider credentials already exist.
67
+ Run `pnpm first-run` to create missing local environment files without
68
+ overwriting anything, then use `pnpm ready` for a secret-safe readiness check.
69
+ For the complete stack, configure the selected managed providers—including a
70
+ Neon `DATABASE_URL`—and create the reviewed initial migration before running
71
+ `pnpm dev`. Anhedral intentionally does not generate a local Postgres substitute
72
+ or pretend that production provider credentials already exist.
54
73
 
55
- With no module flags, `new` includes every supported application surface and backend capability. Generate a focused stack by naming only what the product needs:
74
+ In noninteractive environments, no module flags retain the complete-stack
75
+ default for compatibility. Prefer `--all` when that is your intent, or name
76
+ only what the product needs:
56
77
 
57
78
  ```sh
58
79
  pnpm dlx anhedral@latest new my-product --web --api --db --auth
@@ -100,47 +121,40 @@ Whole directories are omitted when their module is not selected. Generated docum
100
121
 
101
122
  ## Developer experience
102
123
 
103
- Developers use each tool normally:
124
+ Database-backed client stacks include a working `items` feature on day one. It
125
+ connects the Drizzle table, Zod request/response contracts, Fastify list/create
126
+ routes, typed client calls, and an idiomatic UI for every selected surface. Use
127
+ it to verify the stack, then rename or replace these ordinary user-owned files
128
+ with the product idea:
104
129
 
105
- ```tsx
106
- // apps/web/app/projects/page.tsx
107
- import { ProjectList } from '@/components/projects/project-list';
108
-
109
- export default function ProjectsPage() {
110
- return <ProjectList />;
111
- }
130
+ ```text
131
+ packages/db/src/app-schema.ts
132
+ packages/contracts/src/app.ts
133
+ apps/api/src/routes/app.ts
134
+ packages/api-client/src/app.ts
135
+ apps/web/components/item-list.tsx
136
+ apps/mobile/components/item-list.tsx
137
+ apps/desktop/src/renderer/components/item-list.tsx
138
+ apps/extension/src/components/item-list.tsx
112
139
  ```
113
140
 
141
+ Only paths for selected clients are generated. Shared contracts and API calls
142
+ stay consistent while presentation follows Next.js, React Native, Electron, or
143
+ browser-extension conventions.
144
+
114
145
  ```ts
115
146
  // packages/contracts/src/app.ts
116
147
  import { z } from 'zod';
117
148
 
118
- export const ProjectSchema = z.object({ id: z.string(), name: z.string() });
119
- export const ProjectListSchema = z.array(ProjectSchema);
120
- ```
121
-
122
- ```ts
123
- // packages/db/src/app-schema.ts
124
- import { pgTable, text } from 'drizzle-orm/pg-core';
125
-
126
- export const projects = pgTable('projects', {
127
- id: text('id').primaryKey(),
128
- name: text('name').notNull(),
149
+ export const ItemSchema = z.object({
150
+ id: z.string().uuid(),
151
+ name: z.string(),
152
+ createdAt: z.string().datetime(),
129
153
  });
154
+ export const ItemListSchema = z.array(ItemSchema);
130
155
  ```
131
156
 
132
- ```ts
133
- // apps/api/src/routes/app.ts
134
- import type { FastifyPluginAsync } from 'fastify';
135
- import { db } from '@shared/db';
136
- import { projects } from '@shared/db/schema';
137
-
138
- export const appRoutes: FastifyPluginAsync = async (app) => {
139
- app.get('/projects', async () => db.select().from(projects));
140
- };
141
- ```
142
-
143
- The convention is a conventional vertical flow, not an Anhedral DSL:
157
+ The flow is a normal TypeScript architecture, not an Anhedral DSL:
144
158
 
145
159
  ```text
146
160
  contracts -> database/service -> Fastify route -> typed API client -> frontend
@@ -164,7 +178,7 @@ contracts -> database/service -> Fastify route -> typed API client -> frontend
164
178
  | Authentication | Clerk | Connected frontend and backend identity/session flows |
165
179
  | UI | shadcn/ui + React Native Reusables | Accessible source code the application owns |
166
180
  | Storage | private Cloudflare R2 | Signed uploads and controlled asset delivery |
167
- | Billing/realtime | RevenueCat + Ably | Durable entitlements and client invalidation |
181
+ | Billing/realtime | RevenueCat + Stripe + Ably | Unified billing entitlements and realtime invalidation |
168
182
  | Desktop | Electron | Predictable cross-platform TypeScript desktop runtime |
169
183
  | Desktop updates | electron-updater + private R2 + Worker | Signed automatic updates through a product-owned custom domain |
170
184
  | Extension | WXT | Browser-extension entrypoints, builds, and packaging |
@@ -177,29 +191,32 @@ Anhedral does **not** generate or require local Postgres. Database-enabled proje
177
191
  ```text
178
192
  anhedral new <directory> [modules...] Generate a new readable workspace
179
193
  anhedral init [modules...] Generate in the current empty directory
180
- anhedral add <module...> Add connected stack capabilities
181
- anhedral ui add <component...> Add source-owned UI components
182
- anhedral upgrade Transactionally upgrade a supported project
183
- anhedral doctor Check ownership and generator drift
194
+ anhedral new <directory> --all Explicitly select the complete stack
195
+ pnpm anhedral:add <module...> Add connected stack capabilities
196
+ pnpm anhedral:ui <component...> Add source-owned UI components
197
+ pnpm anhedral:upgrade Transactionally upgrade a supported project
198
+ pnpm anhedral:doctor Check ownership and generator drift
184
199
  ```
185
200
 
186
201
  Useful examples:
187
202
 
188
203
  ```sh
189
- anhedral add storage --dry-run
190
- anhedral add desktop extension
191
- anhedral add electron-updater
192
- anhedral ui add button dialog
193
- anhedral ui add data-table --target web --dry-run
194
- anhedral upgrade --dry-run
195
- anhedral doctor --json
204
+ pnpm anhedral:add storage --dry-run
205
+ pnpm anhedral:add desktop extension
206
+ pnpm anhedral:add electron-updater
207
+ pnpm anhedral:ui button dialog
208
+ pnpm anhedral:ui data-table --target web --dry-run
209
+ pnpm anhedral:upgrade --dry-run
210
+ pnpm anhedral:doctor --json
196
211
  ```
197
212
 
198
- `--dry-run` builds the complete plan without changing the project. `--json` emits machine-readable output. `--verbose` streams child-tool diagnostics.
213
+ `--dry-run` builds the structural plan without changing the project. For `ui add`, it also shows the exact provider command; registry-generated file paths are resolved only when the plan is applied. `--json` emits machine-readable output. `--verbose` streams child-tool diagnostics.
199
214
 
200
215
  Application lifecycle commands remain visible in the generated root `package.json`:
201
216
 
202
217
  ```sh
218
+ pnpm first-run
219
+ pnpm ready
203
220
  pnpm dev
204
221
  pnpm dev:all
205
222
  pnpm dev:web
@@ -223,18 +240,18 @@ Anhedral owns initial assembly and safe structural additions. It does not own pr
223
240
 
224
241
  - `README.md`, `PRODUCTION.md`, application features, pages, routes, services, and domain code are developer-owned.
225
242
  - Root workspace configuration is mergeable.
226
- - Integration substrate is recorded in `anhedral.json`; `anhedral add` refuses to overwrite modified managed files.
243
+ - Integration substrate is recorded in `anhedral.json`; `pnpm anhedral:add` refuses to overwrite modified managed files.
227
244
  - UI components are copied into the application so developers can edit them normally.
228
245
  - Provider integrations use ordinary SDKs and configuration files with no hidden control plane.
229
246
 
230
247
  Before a structural change:
231
248
 
232
249
  ```sh
233
- anhedral doctor
234
- anhedral add <module> --dry-run
250
+ pnpm anhedral:doctor
251
+ pnpm anhedral:add <module> --dry-run
235
252
  ```
236
253
 
237
- When `doctor` reports that a project was generated by a supported older release, run `anhedral upgrade --dry-run`, inspect the plan, and then run `anhedral upgrade`. Version 0.4 supports transactional upgrades from 0.3 projects while preserving user-owned extension seams. If a 0.3 project changed a file that was generator-managed, the upgrade stops instead of overwriting it. Preserve the change in source control, restore that managed file to its recorded 0.3 content, run the upgrade, and then move the product behavior into the new user-owned `app.ts`, `app-schema.ts`, page, component, or `app-window.ts` seam.
254
+ When `doctor` reports that a project was generated by a supported older release, run `pnpm anhedral:upgrade --dry-run`, inspect the plan, and then run `pnpm anhedral:upgrade`. Version 0.4 supports transactional upgrades from 0.3 projects while preserving user-owned extension seams. If a 0.3 project changed a file that was generator-managed, the upgrade stops instead of overwriting it. Preserve the change in source control, restore that managed file to its recorded 0.3 content, run the upgrade, and then move the product behavior into the new user-owned `app.ts`, `app-schema.ts`, page, component, or `app-window.ts` seam.
238
255
 
239
256
  ## Documentation contract
240
257
 
@@ -250,6 +267,8 @@ The generator's exact output contract is documented in [docs/output-tree-contrac
250
267
 
251
268
  The complete lifecycle, runtime, cloud, command, and coding-agent topology is in
252
269
  the [Anhedral master stack map](docs/master-stack-map.md).
270
+ The repository's implementation policy is the
271
+ [Zen of Anhedral](docs/engineering-principles.md).
253
272
 
254
273
  ## Module dependency rules
255
274
 
package/SKILL.md CHANGED
@@ -11,7 +11,70 @@ For every new project or provisioning request, begin by asking for the project
11
11
  name and whether the user already owns a custom domain for it. Do not run init
12
12
  or create provider resources until those answers establish canonical names.
13
13
 
14
- Use Node.js 20.19+ or 22.12+ and pnpm. `new` creates a destination directory; `init` works in an empty current directory where `.git`, `.gitignore`, and `.DS_Store` are allowed.
14
+ `new` creates a destination directory; `init` works in an empty current
15
+ directory where `.git`, `.gitignore`, and `.DS_Store` are allowed.
16
+
17
+ ## Bootstrap a blank workstation
18
+
19
+ Do not assume Node.js, npm, pnpm, Git, a browser, provider CLIs, or native build
20
+ tools are installed. After collecting the project name and domain status, audit
21
+ the workstation before generation:
22
+
23
+ ```sh
24
+ node --version
25
+ npm --version
26
+ pnpm --version
27
+ git --version
28
+ ```
29
+
30
+ For a new installation, recommend the current Node.js 24 LTS release. The
31
+ generator itself accepts `^20.19.0 || >=22.12.0`, but mobile projects require
32
+ `^22.13.0 || ^24.3.0 || >=25`; Node.js 24 LTS is the single supported choice
33
+ that covers every Anhedral module without using an end-of-life line.
34
+
35
+ If Node.js is absent, use Computer Use to open `https://nodejs.org/en/download`,
36
+ select the current Node.js 24 LTS installer for the user's operating system and
37
+ architecture, and stop for the user at the installer, administrator-password,
38
+ or operating-system approval boundary. npm is bundled with Node.js and may be
39
+ used to install pnpm, but npm is not the package manager for a generated
40
+ workspace. Installing the public Anhedral package does not require an npm
41
+ account or `npm login`.
42
+
43
+ Install the exact pnpm release recorded by this generator's
44
+ `package.json#packageManager` (currently `pnpm@10.34.5`):
45
+
46
+ ```sh
47
+ npm install --global pnpm@10.34.5
48
+ ```
49
+
50
+ Ask before a global or administrator-level installation. Verify the four
51
+ commands above again after installation. Install Git with the operating-system
52
+ package manager or official installer when it is missing; stop for UAC,
53
+ administrator credentials, Xcode Command Line Tools approval, or a license
54
+ prompt. Configure the user's real Git name and email only after asking what
55
+ identity they want commits to use.
56
+
57
+ A modern browser is required for OAuth device flows and provider dashboards.
58
+ No global Vercel, Neon, Wrangler, EAS, shadcn, or Anhedral installation is
59
+ required: generated scripts invoke reviewed CLI versions through `pnpm dlx`.
60
+ GitHub CLI is recommended for repository creation. Clerk CLI and Ably CLI are
61
+ optional supplemental control planes; use them only after the corresponding
62
+ module is selected, record the resolved version, and do not run `clerk init`
63
+ inside an Anhedral project because the integration source already exists.
64
+
65
+ Native tools are conditional:
66
+
67
+ - EAS cloud builds do not require local Xcode or Android Studio.
68
+ - Local iOS builds and manual App Store uploads require macOS and Xcode.
69
+ - Local Android builds/emulators require Android Studio and a compatible JDK.
70
+ - Signed Electron releases must be built on each target OS; macOS notarization
71
+ needs Xcode tooling and Apple credentials, while Windows distribution needs
72
+ an organization-owned code-signing certificate and Windows runner.
73
+ - Extension development requires a Chromium browser; store publication does
74
+ not require another build CLI beyond the generated WXT scripts.
75
+
76
+ Anhedral intentionally requires neither Docker nor local Postgres. Database
77
+ modules use managed Neon.
15
78
 
16
79
  ## Choose the construction path
17
80
 
@@ -38,7 +101,10 @@ native-subscriptions -> mobile + billing
38
101
  electron-updater -> desktop
39
102
  ```
40
103
 
41
- With no module flags, generate the full stack.
104
+ With no module flags in an interactive terminal, Anhedral prompts and suggests
105
+ a focused web app. In a noninteractive environment, no flags retain the full
106
+ stack for compatibility. Use `--all` when the complete stack is intentional,
107
+ or pass explicit modules for reproducible automation.
42
108
 
43
109
  ## Master stack map
44
110
 
@@ -78,10 +144,12 @@ domain, provider-order, and verification gates.
78
144
  The lead agent must:
79
145
 
80
146
  1. Ask for project name and existing/custom-domain status first.
81
- 2. Discover whether Computer Use/browser control and subagents are available.
82
- 3. Resolve modules and show the user canonical project/resource names.
83
- 4. Run the explicit CLI command, then read the generated `PRODUCTION.md`.
84
- 5. Provision only selected providers, pausing for sign-in, MFA, secret
147
+ 2. Audit and bootstrap the workstation, then discover whether Computer
148
+ Use/browser control and subagents are available.
149
+ 3. Resolve modules, required accounts, and canonical project/resource names.
150
+ 4. Run the explicit CLI command, then read the generated `PRODUCTION.md`,
151
+ `anhedral.json`, root scripts, and package-local environment examples.
152
+ 5. Provision only selected providers in dependency order, pausing for sign-in, MFA, secret
85
153
  generation, purchases, and final submissions exactly as the reference says.
86
154
  6. Keep secrets out of chat and tool output; have the user paste them directly
87
155
  into uncommitted environment files and protected provider fields.
@@ -92,8 +160,15 @@ The lead agent must:
92
160
  ```sh
93
161
  pnpm dlx anhedral@latest new my-product
94
162
  cd my-product
163
+ pnpm first-run
164
+ pnpm ready
95
165
  ```
96
166
 
167
+ `first-run` creates only missing package-local environment files and never
168
+ overwrites existing configuration. `ready` reports missing filenames and
169
+ required variable names without printing values; resolve every blocker before
170
+ starting affected services.
171
+
97
172
  Prefer explicit modules when the user requests a smaller stack:
98
173
 
99
174
  ```sh
@@ -131,7 +206,7 @@ Use the native source conventions:
131
206
  - Product client-safe HTTP methods belong in `packages/api-client/src/app.ts`.
132
207
  - Product Drizzle tables belong in `packages/db/src/app-schema.ts`; generate and review SQL migrations.
133
208
 
134
- Implement an end-to-end feature as `contracts -> database/service -> route -> API client -> frontend`. Frontends may import contracts and client-safe packages, never API services, database connections, or server environments. This stack uses managed Neon and intentionally has no local Postgres service.
209
+ Implement an end-to-end feature as `contracts -> database/service -> route -> API client -> frontend`. The generated `items` feature demonstrates that same path on every selected client—Next.js, Expo, Electron, and WXT—using one contract and API client with platform-native UI. Frontends may import contracts and client-safe packages, never API services, database connections, or server environments. This stack uses managed Neon and intentionally has no local Postgres service.
135
210
 
136
211
  ## Add modules safely
137
212
 
@@ -152,6 +227,13 @@ Require the manifest generator version to match the running CLI. Regenerate proj
152
227
 
153
228
  Do not rewrite a generated project's README or custom workflows while adding modules. Preserve custom package fields and mergeable root configuration.
154
229
 
230
+ `README.md` and `PRODUCTION.md` are user-owned and are not regenerated by
231
+ `anhedral add`. After adding modules, do not assume those two files describe the
232
+ new provider set. Reconcile them against `anhedral.json`, the managed project
233
+ `SKILL.md`, root `package.json` scripts, and every package-local `.env.example`;
234
+ then update the user-owned documentation explicitly with the developer's
235
+ approval.
236
+
155
237
  For manual projects without a trustworthy schema-v5 `anhedral.json`, add modules with the manual reference instead. Never fabricate manifest ownership records, template provenance, UI installation records, or hashes. A manually authored workspace is valid as an application workspace but is not CLI-managed until it has been regenerated by a matching Anhedral version.
156
238
 
157
239
  ## Add UI components
@@ -181,16 +263,20 @@ Explain that warnings can represent mergeable or user-owned drift, while modifie
181
263
 
182
264
  ## Configure the generated project
183
265
 
184
- Copy environment examples, fill only selected provider values, install, and verify:
266
+ Create only missing local environment files, fill selected provider values, and
267
+ verify readiness:
185
268
 
186
269
  ```sh
187
- cp apps/api/.env.example apps/api/.env
188
- cp packages/db/.env.example packages/db/.env
189
270
  pnpm install
271
+ pnpm first-run
272
+ pnpm ready
190
273
  pnpm verify
191
274
  ```
192
275
 
193
- Copy only examples that exist for the selected surfaces. Client packages use package-local runtime files (for example, copy `apps/web/.env.example` to `apps/web/.env.local` and `apps/desktop/.env.example` to `apps/desktop/.env`); the root `.env.example` is an inventory, not a runtime environment file.
276
+ `first-run` copies only examples that exist for selected surfaces and never
277
+ overwrites an existing file. Client packages use package-local runtime files
278
+ (for example, `apps/web/.env.local` and `apps/desktop/.env`); the root
279
+ `.env.example` is an inventory, not a runtime environment file.
194
280
 
195
281
  Common selected keys are:
196
282
 
@@ -218,6 +304,15 @@ Treat the root `vercel.json` as the only Vercel Services configuration. It uses
218
304
 
219
305
  For billing, keep Neon authoritative: RevenueCat reconciliation writes the subscription revision and realtime outbox atomically, Ably carries only per-user invalidations, and every client refetches the entitlement. Schedule the authenticated outbox flush every five minutes and verify purchase, webhook, reconnect, and foreground recovery paths.
220
306
 
307
+ The generated billing substrate does not implement Stripe Checkout, Stripe
308
+ webhooks, or a web purchase screen. RevenueCat's Test Store can exercise the
309
+ entitlement flow without Apple, Google, or Stripe accounts. Native purchases
310
+ require `native-subscriptions` plus Apple/Google store setup. If the user wants
311
+ web subscriptions through RevenueCat Billing or a manual Stripe integration,
312
+ treat that as an explicit product feature with additional account, checkout,
313
+ webhook, tax, and customer-portal work; do not claim the generated billing
314
+ module already completed it.
315
+
221
316
  Use `apps/mobile` for EAS, `pnpm desktop:build` for a current-host Electron artifact, matching platform-specific desktop scripts in CI, and `pnpm extension:zip` for the WXT archive.
222
317
 
223
318
  For `electron-updater`, provision the generated private R2 bucket and
@@ -227,7 +322,7 @@ platform and publish artifacts before mutable channel metadata.
227
322
 
228
323
  For storage, generate `apps/assets-private-proxy` plus `cloudflare/r2-cors.template.json` and keep the R2 bucket private. The Worker must be named `assets-private-proxy`, bind the normalized `<project>-assets` bucket as `ASSETS`, disable `workers.dev`, and own `assets.<domain>` as a Worker Custom Domain. Presigned uploads continue on the R2 S3 API hostname. Root every key below `R2_PREFIX=storage`; expose only `storage/confirmed/` through the Worker and reject staging plus `generation-inputs`. Authenticated private reads must verify upload ownership and return a presigned GET URL bounded by `R2_PROXY_READ_URL_TTL_SECONDS`.
229
324
 
230
- When explaining domains, distinguish DNS delegation from registrar transfer. A GoDaddy registration can use Cloudflare authoritative nameservers immediately; transferring registration/billing to Cloudflare Registrar is optional and subject to eligibility locks. Keep Vercel app/API A or CNAME records DNS-only in Cloudflare, while Worker Custom Domains stay Cloudflare-managed and proxied.
325
+ When explaining domains, distinguish DNS delegation from registrar transfer. A domain can use Cloudflare authoritative nameservers while remaining with its current registrar; transferring registration/billing to Cloudflare Registrar is optional and subject to eligibility locks. Keep Vercel app/API A or CNAME records DNS-only in Cloudflare, while Worker Custom Domains stay Cloudflare-managed and proxied.
231
326
 
232
327
  ## Verify outcomes
233
328