anhedral 0.4.2 → 0.6.1

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 (89) hide show
  1. package/README.md +35 -265
  2. package/assets/anhedral-cli-init-technical.svg +322 -0
  3. package/assets/anhedral-cli-init.svg +257 -173
  4. package/dist/bin.js +28 -191
  5. package/dist/dependencies.d.ts +7 -57
  6. package/dist/dependencies.js +96 -308
  7. package/dist/index.d.ts +2 -7
  8. package/dist/index.js +1 -4
  9. package/dist/platforms/desktop.js +401 -0
  10. package/dist/platforms/extension.js +401 -0
  11. package/dist/platforms/mobile.js +232 -0
  12. package/dist/project.d.ts +0 -26
  13. package/dist/standard-products.d.ts +2 -0
  14. package/dist/standard-products.js +6 -0
  15. package/dist/standard.d.ts +18 -0
  16. package/dist/standard.js +595 -0
  17. package/dist/version.d.ts +1 -1
  18. package/dist/version.js +1 -1
  19. package/docs/application-stack-standard.md +700 -0
  20. package/package.json +29 -51
  21. package/CHANGELOG.md +0 -178
  22. package/CONTRIBUTING.md +0 -77
  23. package/SECURITY.md +0 -37
  24. package/SKILL.md +0 -339
  25. package/assets/images/svg/ably-symbol-color.svg +0 -8
  26. package/bin/anhedral.js +0 -2
  27. package/dist/architecture/contributions.d.ts +0 -28
  28. package/dist/architecture/contributions.js +0 -125
  29. package/dist/architecture/index.d.ts +0 -12
  30. package/dist/architecture/index.js +0 -6
  31. package/dist/architecture/manifest.d.ts +0 -53
  32. package/dist/architecture/manifest.js +0 -283
  33. package/dist/architecture/modules.d.ts +0 -41
  34. package/dist/architecture/modules.js +0 -187
  35. package/dist/architecture/plan.d.ts +0 -58
  36. package/dist/architecture/plan.js +0 -145
  37. package/dist/architecture/templates.d.ts +0 -10
  38. package/dist/architecture/templates.js +0 -23
  39. package/dist/cli.d.ts +0 -32
  40. package/dist/cli.js +0 -281
  41. package/dist/composers/root.d.ts +0 -6
  42. package/dist/composers/root.js +0 -35
  43. package/dist/print.d.ts +0 -8
  44. package/dist/print.js +0 -48
  45. package/dist/prompts.d.ts +0 -6
  46. package/dist/prompts.js +0 -41
  47. package/dist/scaffold.d.ts +0 -64
  48. package/dist/scaffold.js +0 -2102
  49. package/dist/template-source.d.ts +0 -20
  50. package/dist/template-source.js +0 -180
  51. package/dist/templates/api.d.ts +0 -2
  52. package/dist/templates/api.js +0 -3187
  53. package/dist/templates/assets-private-proxy.d.ts +0 -3
  54. package/dist/templates/assets-private-proxy.js +0 -277
  55. package/dist/templates/desktop.js +0 -792
  56. package/dist/templates/electron-updater.d.ts +0 -3
  57. package/dist/templates/electron-updater.js +0 -358
  58. package/dist/templates/extension.js +0 -856
  59. package/dist/templates/first-run.d.ts +0 -2
  60. package/dist/templates/first-run.js +0 -167
  61. package/dist/templates/mobile.js +0 -861
  62. package/dist/templates/shared.d.ts +0 -2
  63. package/dist/templates/shared.js +0 -577
  64. package/dist/templates/web.d.ts +0 -2
  65. package/dist/templates/web.js +0 -569
  66. package/dist/toolchain.d.ts +0 -3
  67. package/dist/toolchain.js +0 -8
  68. package/dist/ui.d.ts +0 -33
  69. package/dist/ui.js +0 -199
  70. package/dist/workspace-config.d.ts +0 -11
  71. package/dist/workspace-config.js +0 -372
  72. package/docs/NORTHSTAR.md +0 -114
  73. package/docs/conventions.md +0 -94
  74. package/docs/engineering-principles.md +0 -88
  75. package/docs/master-stack-map.md +0 -199
  76. package/docs/output-tree-contract.md +0 -493
  77. package/docs/references/manual-scaffolding.md +0 -421
  78. package/docs/references/provisioning.md +0 -577
  79. package/scripts/render-master-stack-map.mjs +0 -510
  80. package/templates/api-fastify/apps/api/tsconfig.json +0 -20
  81. package/templates/catalog.json +0 -23
  82. package/templates/db-drizzle/packages/db/tsconfig.json +0 -14
  83. package/templates/desktop-electron/apps/desktop/tsconfig.json +0 -37
  84. package/templates/extension-wxt/apps/extension/tsconfig.json +0 -41
  85. package/templates/mobile-expo/apps/mobile/expo-env.d.ts +0 -1
  86. package/templates/web-next/apps/web/next-env.d.ts +0 -6
  87. /package/dist/{templates → platforms}/desktop.d.ts +0 -0
  88. /package/dist/{templates → platforms}/extension.d.ts +0 -0
  89. /package/dist/{templates → platforms}/mobile.d.ts +0 -0
@@ -1,577 +0,0 @@
1
- # Agent-run Anhedral provisioning
2
-
3
- Use this checklist after the user asks a coding agent to create or provision an
4
- Anhedral project. Keep one lead agent responsible for the plan, names, secrets,
5
- and final verification.
6
-
7
- ## Contents
8
-
9
- 1. Start with user inputs
10
- 2. Bootstrap a workstation from zero
11
- 3. Resolve accounts, CLIs, and unavoidable browser work
12
- 4. Discover agent capabilities
13
- 5. Generate and verify the local project
14
- 6. Authentication and secret boundaries
15
- 7. Domain foundation
16
- 8. Provision selected providers
17
- 9. Verify and hand off
18
-
19
- ## 1. Start with user inputs
20
-
21
- Before running `anhedral new` or opening a provider dashboard, ask the user:
22
-
23
- 1. What is the project name? Derive one stable lowercase kebab-case resource
24
- stem from it and show the proposed value.
25
- 2. Do they already own a custom domain for this product? If yes, record the
26
- exact domain, registrar, current DNS provider, and whether production email
27
- already uses it. If no, ask for the desired domain and obtain explicit
28
- approval before any paid purchase.
29
- 3. Which surfaces and features do they want? If they want the complete product,
30
- use every module. Otherwise record explicit modules.
31
- 4. Which provider organizations/teams should own Cloudflare, Vercel, GitHub,
32
- Neon, Clerk, RevenueCat, Ably, Expo, Apple, Google Play, and Chrome Web Store
33
- resources that apply to the selected modules?
34
- 5. Is this development, preview, or production? Never point a preview at live
35
- users, billing, or production data without explicit direction.
36
-
37
- Do not improvise names independently in provider dashboards. Maintain a small
38
- resource ledger containing the project stem, display name, domain, selected
39
- modules, provider team, resource name, hostname, environment, status, and next
40
- user action. Never put credential values in the ledger.
41
-
42
- ## 2. Bootstrap a workstation from zero
43
-
44
- Inspect before installing anything:
45
-
46
- ```sh
47
- node --version
48
- npm --version
49
- pnpm --version
50
- git --version
51
- ```
52
-
53
- Use the current Node.js 24 LTS release for a new Anhedral workstation. It
54
- satisfies the generator and the stricter Expo/mobile engine range. If Node.js is
55
- missing, open `https://nodejs.org/en/download` with Computer Use, choose Node.js
56
- 24 LTS for the user's OS and architecture, and stop while the user runs the
57
- installer and approves administrator or operating-system prompts.
58
-
59
- npm arrives with Node.js. It can bootstrap pnpm, but it must not replace pnpm
60
- inside the generated workspace. Install the exact package-manager version
61
- declared by the Anhedral package:
62
-
63
- ```sh
64
- npm install --global pnpm@10.34.5
65
- ```
66
-
67
- Ask before global installation. If Git is absent, install it with the official
68
- installer or applicable OS package manager. Common interactive boundaries are:
69
-
70
- - macOS: `xcode-select --install` opens the Command Line Tools installer.
71
- - Windows: `winget install --id Git.Git -e` may raise UAC and installer prompts.
72
- - Debian/Ubuntu: `sudo apt-get install git` requires the user's administrator
73
- approval.
74
-
75
- Ask which real name and email the user wants before configuring Git identity.
76
- Do not invent or copy an account identity:
77
-
78
- ```sh
79
- git config --global user.name "<confirmed name>"
80
- git config --global user.email "<confirmed email>"
81
- ```
82
-
83
- Re-run the four version checks. A browser is also required for OAuth device
84
- flows, passkeys, MFA, CAPTCHA, terms, payments, dashboards, and store consoles.
85
-
86
- The generated project uses transient, pinned CLIs through `pnpm dlx`; do not
87
- globally install Anhedral, Vercel CLI, Neon CLI, Wrangler, EAS CLI, shadcn, or
88
- WXT. npm can launch Anhedral with `npx`, but the resulting monorepo and all
89
- documented lifecycle commands still require pnpm. Downloading the public
90
- Anhedral package requires no npm account or `npm login`. No Anhedral module
91
- requires Docker or a local Postgres installation.
92
-
93
- Conditional local tools:
94
-
95
- - GitHub CLI (`gh`) is recommended for repository creation and Git credential
96
- setup, but Git plus the GitHub website also works.
97
- - Clerk CLI and Ably CLI are optional management clients. They are not generated
98
- dependencies. Record the exact version if using them and never run
99
- `clerk init` over Anhedral's existing integration source.
100
- - EAS cloud builds need no local Xcode, Android Studio, Ruby, CocoaPods, or JDK.
101
- Install Xcode only for local iOS builds/manual Apple upload; install Android
102
- Studio and a JDK only for local Android builds or emulator work.
103
- - Build Electron artifacts on their target OS. macOS signing/notarization needs
104
- Xcode tooling; Windows signing needs a Windows runner and an
105
- organization-owned certificate.
106
- - Use Chrome or another Chromium browser to load and test an unpacked extension.
107
-
108
- ## 3. Resolve accounts, CLIs, and unavoidable browser work
109
-
110
- Create accounts only for selected modules. Prefer organization-owned teams,
111
- enable MFA, name at least two recovery owners for production, and record billing
112
- ownership without recording credentials.
113
-
114
- | Provider/account | Required when | CLI-covered work | Browser, Computer Use, or user-only work |
115
- | --- | --- | --- | --- |
116
- | GitHub | Recommended for every production project; required for the normal Git-triggered Vercel flow | `gh auth login`, repository creation, remote setup, push, environment/repository APIs | Account/org creation, SSO authorization, billing, visibility policy, branch-protection review |
117
- | Vercel | `web` or `api` deployment | Generated link, preview, production, inspect, domain-inspect commands; environment variables are also supported by Vercel CLI | Account/team creation, GitHub OAuth import, selecting the Services framework preset, plan/billing, some domain and environment review |
118
- | Neon | `db` directly or through `auth`, `billing`, or `storage` | Generated OAuth login and project creation; Neon CLI/API can manage branches and projects | Account/org creation, plan/billing, one-time safe placement of pooled connection strings, backup/restore policy review |
119
- | Clerk | `auth` directly or through dependent features | Supplemental Clerk CLI can log in, create/link apps, manage config, inspect deployment status, and call Clerk APIs | Workspace/team/billing, social-provider OAuth apps and consent, branding/security controls, DNS review, secret handling, physical-device verification |
120
- | RevenueCat | `billing` or `native-subscriptions` | Developer API v2 can create projects, apps, products, entitlements, offerings, and webhooks after a secret key exists | Initial account/key bootstrap in the normal path, store credential connection, Test Store/dashboard setup, plan/billing, purchase/paywall review |
121
- | Ably | `billing` | Supplemental Ably CLI can log in, create apps, configure rules, and create keys | Account/team/billing and safe one-time API-key handling |
122
- | Stripe | Only if the user explicitly chooses web subscriptions through RevenueCat Billing or a manual Stripe integration | Stripe CLI can log in, test webhooks, and manage supported resources | Business activation, identity/KYC, bank/tax details, terms, live-mode review; generated Anhedral billing contains no Stripe checkout or webhook |
123
- | Cloudflare | `storage`, `electron-updater`, or Cloudflare-authoritative DNS | Generated Wrangler login, R2 bucket/CORS commands, Worker checks/deploys, custom domains, and direct lifecycle commands | Account/zone creation, R2 purchase/enablement, domain purchase or registrar delegation, DNS/email preservation, one-time S3 key reveal, plan/billing |
124
- | Expo/EAS | `mobile` cloud build or distribution | Generated login, project init, builds, credential flows, and submissions | Expo account/team/billing and user participation in Apple/Google credential prompts |
125
- | Apple Developer + App Store Connect | iOS store release, iOS device signing, or signed/notarized macOS distribution | EAS can create/manage many signing assets and upload builds; Apple tools can notarize desktop builds | Paid membership, legal agreements, tax/banking, role grants, app record/metadata/privacy, TestFlight groups, final review/release decisions |
126
- | Google Play Console | Android store release | EAS builds/submits after a service account is connected | Developer registration/payment, app creation, policy/data-safety/content declarations, service-account authorization, testing/release controls |
127
- | Chrome Web Store | Public/trusted distribution of `extension` | Generated WXT verification and ZIP creation; Web Store APIs can automate later uploads after OAuth setup | Developer registration fee, contact verification, first listing, screenshots/privacy/permission declarations, reviewer instructions, final submission |
128
- | Domain registrar | Custom production domain; mandatory for generated Worker custom domains | Registrar-specific APIs may exist but are not an Anhedral dependency | Search/purchase, registrant data, payment, renewal, transfer locks, nameserver/DNSSEC changes and destructive confirmations |
129
- | Certificate authority | Public Windows desktop distribution | Signing can run in target-OS CI after credentials are installed | Organization validation, certificate purchase/issuance, hardware/cloud key custody, renewal |
130
-
131
- RevenueCat's Test Store supports development purchases without Apple, Google, or
132
- Stripe accounts. Native production purchases require the relevant app-store
133
- accounts. The generated `billing` module supplies entitlement reconciliation,
134
- webhook handling, Neon state, and Ably invalidation; it does not generate a web
135
- checkout. Record that distinction in the project ledger before provisioning.
136
-
137
- ## 4. Discover agent capabilities
138
-
139
- Inspect the environment before planning execution:
140
-
141
- - If Computer Use or an authenticated browser-control tool is available, use it
142
- for provider dashboards after the user requests provisioning.
143
- - If subagents are available, keep the lead agent in control and delegate only
144
- bounded, independent work. Good tasks are reading generated documentation,
145
- checking current DNS records without changing them, and producing a
146
- selection-specific environment-variable inventory.
147
- - Do not give subagents passwords, session cookies, secret values, or concurrent
148
- control of the same browser/profile. Do not let two agents mutate DNS or the
149
- same provider resource.
150
- - If neither capability exists, use generated CLI commands and give the user
151
- exact dashboard instructions for the remaining steps.
152
-
153
- Recommended subagent sequence:
154
-
155
- 1. Lead: collect inputs, resolve modules, choose canonical names, and run init.
156
- 2. Documentation subagent: read the generated `README.md`, `PRODUCTION.md`, and
157
- package-local `.env.example` files; return the provider/resource checklist.
158
- 3. DNS subagent: perform read-only registrar, nameserver, DNS, and hostname
159
- collision checks; return existing records that must be preserved.
160
- 4. Verification subagent: after provisioning, run read-only domain, health,
161
- Worker, and configuration checks. The lead performs or approves mutations.
162
-
163
- If subagents are unavailable, perform the same phases serially. Their absence is
164
- not a blocker.
165
-
166
- ## 5. Generate and verify the local project
167
-
168
- If the user wants the coding-agent workflow and the skill is not installed,
169
- install it after pnpm is available:
170
-
171
- ```sh
172
- pnpm dlx skills add https://github.com/anhedral/anhedral-init --skill anhedral-init
173
- ```
174
-
175
- The user must install and authenticate their chosen compatible coding-agent
176
- application separately. Anhedral also works without an agent. Prefer this
177
- explicit CLI path for generation:
178
-
179
- ```sh
180
- pnpm dlx anhedral@latest new <project-name> <explicit-modules...> --toolchain stable
181
- cd <project-name>
182
- ```
183
-
184
- Omit module arguments only when the user chose the complete stack. Examples:
185
-
186
- ```sh
187
- pnpm dlx anhedral@latest new acme --web --api --db --auth --toolchain stable
188
- pnpm dlx anhedral@latest new acme desktop electron-updater --toolchain stable
189
- ```
190
-
191
- Then:
192
-
193
- 1. Read `anhedral.json`, the root `package.json`, the generated `SKILL.md`,
194
- `README.md`, `PRODUCTION.md`, and every selected package's `.env.example`.
195
- Confirm the resolved module closure, account matrix, generated CLI scripts,
196
- and environment inventory with the user.
197
- 2. If modules were added to an existing project, remember that user-owned
198
- `README.md` and `PRODUCTION.md` are not regenerated. Reconcile them against
199
- `anhedral.json`, root scripts, managed `SKILL.md`, and environment examples
200
- before treating them as current.
201
- 3. Run `pnpm first-run`; it creates only missing package-local environment
202
- files and never replaces existing configuration.
203
- 4. Run `pnpm ready` and record the missing variable names by provider. Failure
204
- is expected before provisioning; never fill placeholders merely to make it
205
- pass.
206
- 5. Run `pnpm typecheck` and `pnpm anhedral:doctor`. Run provider-independent
207
- package checks that can succeed without credentials. Fix generator,
208
- installation, or type failures before creating cloud resources.
209
- 6. Create the organization-owned Git remote before Vercel import. With GitHub
210
- CLI installed, authenticate with `gh auth login`, confirm the intended
211
- account with `gh auth status`, then use `gh repo create` only after the user
212
- chooses the owner and visibility. Review the initial commit and push.
213
- 7. Provision development resources first using the next sections. Put real
214
- values directly into uncommitted package-local environment files. Generate
215
- and review the initial database migration, run `pnpm ready`, `pnpm verify`,
216
- `pnpm build`, and only then start `pnpm dev`.
217
- 8. Deploy and validate a preview before creating or connecting production
218
- resources. Keep development, preview, and production identities, databases,
219
- webhooks, keys, and billing data isolated.
220
-
221
- ## 6. Authentication and secret boundaries
222
-
223
- Computer Use may navigate dashboards, fill non-secret settings, create approved
224
- resources, deploy, configure DNS, and verify results. Apply these hard stops:
225
-
226
- - Stop at every sign-in, password, passkey, MFA, CAPTCHA, device-approval, or
227
- provider-consent boundary. Tell the user which provider is requesting access
228
- and wait for them to complete it. Resume only after they say it is complete.
229
- - Stop immediately before a paid purchase, registrar transfer, destructive
230
- replacement, production release, store submission, or other consequential
231
- final confirmation. Show the exact action, target, and cost/impact and obtain
232
- approval.
233
- - Stop at the final **Create**, **Generate**, **Reveal**, or **Rotate secret**
234
- action. Tell the user the exact button to click, exact variable name, and exact
235
- local uncommitted environment file to receive the value. The user must paste
236
- it directly into that file or the provider's secret field, never into chat.
237
- - Never read a populated `.env` file back into tool output, screenshots, logs,
238
- the resource ledger, or a subagent message. Validate names and presence with a
239
- redacting parser or the generated application checks.
240
- - Public identifiers such as publishable keys, project IDs, account IDs, bucket
241
- names, and hostnames may be recorded where their generated examples expect
242
- them. Treat any provider value marked secret as secret even if it appears in a
243
- browser page.
244
-
245
- Use this control sequence whenever a CLI opens a browser:
246
-
247
- 1. Run the selected generated login command and state which account/team it must
248
- authorize.
249
- 2. Yield control at the browser's sign-in, passkey, MFA, CAPTCHA, SSO, consent,
250
- or device-code confirmation.
251
- 3. After the user confirms completion, resume in the terminal and run the
252
- provider's identity/status command or a read-only list operation.
253
- 4. If the CLI cannot configure the remaining setting, open the exact dashboard
254
- page with Computer Use, narrate the non-secret fields being changed, and
255
- stop at any consequential final button.
256
- 5. Return to the CLI or a read-only browser view to verify the saved state. A
257
- successful click is not verification.
258
-
259
- Classify every remaining action accurately:
260
-
261
- - **CLI-covered:** safe to automate after authentication and approval.
262
- - **API-capable but not generated:** use only with explicit approval, a pinned
263
- client/version, and a redacting secret flow.
264
- - **Computer Use:** dashboard setup with no suitable generated command.
265
- - **User-only:** credentials, MFA, CAPTCHA, payments, legal agreements, secret
266
- reveal/copy, and final production/store decisions.
267
-
268
- When the user finishes a secret step, ask only for confirmation such as
269
- "`CLERK_SECRET_KEY` is saved in `apps/api/.env`". Do not ask them to repeat the
270
- value. Mirror production secrets into Vercel or another deployment provider by
271
- having the user paste into that provider's protected environment-variable UI,
272
- or by using an approved secret-input flow that never prints the value.
273
-
274
- ## 7. Domain foundation
275
-
276
- Use Cloudflare as authoritative DNS when `storage` or `electron-updater` is
277
- selected because the generated Workers require custom domains in an active
278
- Cloudflare zone. For web/API-only projects, retain the user's chosen DNS
279
- provider and create only the records Vercel reports. A domain can remain with
280
- its current registrar; changing nameservers is not a registrar transfer.
281
-
282
- 1. If the user has no domain, use Computer Use to search the approved registrar,
283
- select the exact domain, and fill registration settings.
284
- Stop before the paid purchase confirmation. Ask the user to review price,
285
- renewal terms, registrant, and organization ownership and submit it.
286
- 2. Inventory existing DNS before changing nameservers. Preserve MX, TXT, SPF,
287
- DKIM, DMARC, verification, CAA, and application records. A domain with active
288
- email requires an explicit preservation review.
289
- 3. When Cloudflare is required, add the domain as a Cloudflare zone. Stop for
290
- Cloudflare authentication, account selection, plan choice, and any purchase.
291
- Copy the two assigned authoritative nameservers.
292
- 4. At the registrar, use Computer Use to replace the authoritative nameservers
293
- with Cloudflare's exact values. Disable conflicting registrar DNSSEC/DS
294
- records first when required; wait until Cloudflare reports the zone
295
- **Active**, then enable DNSSEC in Cloudflare and publish the requested DS
296
- record at the registrar. Nameserver and DS changes are destructive DNS
297
- mutations: inventory and preserve email records first, obtain approval, and
298
- verify authoritative answers afterward.
299
- 5. Do not transfer registration unless the user separately requests it. A
300
- transfer changes billing/registrar ownership and may be subject to locks.
301
-
302
- Use distinct hostnames:
303
-
304
- ```text
305
- app.example.com Vercel web/API custom domain
306
- assets.example.com assets-private-proxy Worker Custom Domain
307
- updates.example.com desktop-updater Worker Custom Domain
308
- ```
309
-
310
- `app.example.com` is a Vercel project domain whose A/CNAME/TXT records are
311
- managed in Cloudflare DNS. Add the domain to Vercel first, inspect the exact
312
- records Vercel requests, then add those records in Cloudflare. Keep the Vercel
313
- origin record DNS-only unless current Vercel guidance and the user's architecture
314
- explicitly require another topology.
315
-
316
- Worker hostnames are Cloudflare **Worker Custom Domains**, not CNAMEs to Vercel
317
- or R2. Configure `custom_domain: true` in the generated Wrangler file and deploy;
318
- Cloudflare creates the DNS record and certificate. Remove any conflicting A,
319
- AAAA, or CNAME record before attaching the Worker hostname.
320
-
321
- ## 8. Provision selected providers
322
-
323
- For a newly generated project, use `PRODUCTION.md` together with
324
- `anhedral.json`, root scripts, and package-local environment examples. After
325
- `anhedral add`, the user-owned README and production guide may be stale; the
326
- manifest, managed skill, scripts, and environment examples determine the actual
327
- provider set.
328
-
329
- Use this dependency order so downstream configuration receives real URLs and
330
- public identifiers:
331
-
332
- 1. **GitHub and source control**
333
-
334
- - CLI: install GitHub CLI if selected, run `gh auth login`, stop at browser
335
- authorization, and verify the intended identity with `gh auth status`.
336
- Create the repository only after the user chooses the organization and
337
- visibility. Review the remote before pushing; never overwrite an existing
338
- remote or history.
339
- - Computer Use: create or select the organization, authorize SSO/GitHub App
340
- access, review repository visibility, configure protected environments and
341
- branch rules, and enable required checks.
342
- - User-only: organization billing, SSO/MFA, visibility policy, destructive
343
- repository replacement, and final access grants.
344
-
345
- 2. **Neon (`db`, including dependency-added database)**
346
-
347
- - CLI: run `pnpm neon:login`; Neon opens an OAuth flow. After the user
348
- authorizes it, run `pnpm neon:project:create --name <canonical-name>` for
349
- the first environment. Use the pinned Neon CLI recorded in
350
- `anhedral.json` for additional project/branch commands.
351
- - Create isolated development, preview, and production projects or branches.
352
- Prefer pooled connection strings for serverless Vercel traffic.
353
- - Computer Use/user-only: account and organization creation, plan/billing,
354
- backup/restore policy, IP restrictions, and the one-time safe placement of
355
- each connection string. The user saves `DATABASE_URL` directly in
356
- `packages/db/.env`, `apps/api/.env` when present, and protected deployment
357
- environments without pasting it into chat.
358
- - Local gate: run `pnpm db:generate`, inspect and commit the SQL and metadata,
359
- run `pnpm verify:db`, then run `pnpm db:migrate` against the intended
360
- development database. Never generate migrations in the deployment build.
361
-
362
- 3. **Clerk (`auth`)**
363
-
364
- - CLI/API-capable: the supplemental Clerk CLI can run `clerk auth login`,
365
- `clerk apps create`, `clerk link`, `clerk config pull/patch`,
366
- `clerk deploy`, `clerk deploy status`, and `clerk api`. Run it through a
367
- recorded version and do not run `clerk init`, because Anhedral already
368
- generated the SDK integration. Stop at its browser authorization.
369
- - Create development and production instances. Put `CLERK_SECRET_KEY` only
370
- in API/server environments. Put the publishable key into each selected
371
- client's exact public variable.
372
- - Computer Use: configure the root domain, DNS records, subdomain allowlist,
373
- authorized parties, production OAuth applications, redirect URLs,
374
- webhooks, email settings, native bundle/package identifiers, and extension
375
- sync host/CRX ID when selected. Clerk workspace membership, billing,
376
- analytics/logs, branding, and Protect settings remain dashboard work.
377
- - User-only: social-provider OAuth consent/credentials, passkeys/MFA, secret
378
- reveal/copy, and the final certificate/deployment confirmation. Verify the
379
- production instance with `clerk deploy status` or a read-only dashboard
380
- view and test on physical devices where applicable.
381
-
382
- 4. **RevenueCat and Ably (`billing`/`native-subscriptions`)**
383
-
384
- - Start development with RevenueCat's Test Store. It needs no Apple, Google,
385
- or Stripe account. Create the project, Test Store products, entitlement
386
- whose lookup key exactly matches `RC_ENTITLEMENT_ID`, current offering, and
387
- packages. Add platform apps only for selected purchase surfaces.
388
- - RevenueCat API v2 can automate projects, apps, products, entitlements,
389
- offerings, package/product attachments, and webhook integrations after a
390
- secret key exists. The normal blank-account path still requires dashboard
391
- signup and safe secret-key creation. Put `RC_SECRET_API_KEY` server-side and
392
- platform public keys only in their documented `EXPO_PUBLIC_RC_*` variables.
393
- - Configure the RevenueCat webhook only after an HTTPS preview API exists:
394
- `https://<preview-or-domain>/api/webhooks/revenuecat`. The user creates a
395
- high-entropy authorization value and places the same value in RevenueCat's
396
- Authorization header and the server's `RC_WEBHOOK_SECRET`; never expose it
397
- to the agent.
398
- - Supplemental Ably CLI: authenticate with `ably login`, verify the account,
399
- create/select an app with `ably apps create`/`ably apps switch`, and create
400
- the least-privilege server key with `ably auth keys create`. Because key
401
- creation can print a credential, the user must run or complete that step
402
- privately and save `ABLY_API_KEY` directly in server environments.
403
- - The generated API issues scoped per-user Ably tokens; do not put a root
404
- Ably key in clients. Set `CRON_SECRET` and verify the authenticated
405
- realtime outbox flush schedule.
406
- - Stripe is not required for Test Store or native store purchases. If the
407
- user chooses RevenueCat Billing or manual Stripe web subscriptions, stop
408
- and scope a separate implementation: account activation/KYC, products and
409
- prices, Checkout/Customer Portal, webhook verification, tax, refunds, and
410
- RevenueCat mapping are not generated by Anhedral.
411
-
412
- 5. **Cloudflare zone and R2 (`storage`)**
413
-
414
- - Computer Use/user-only prerequisite: create/select the Cloudflare account
415
- and active DNS zone, complete R2 purchase/enablement if requested, preserve
416
- existing DNS/email records, and finish nameserver/DNSSEC changes. Wrangler
417
- cannot replace registrar payment, registrant, or account-recovery work.
418
- - CLI: run `pnpm r2:login`, stop at OAuth, verify the account, then run
419
- `pnpm r2:bucket:create`, `pnpm r2:cors:list`, edit the complete user-owned
420
- CORS template, and run `pnpm r2:cors:set`. The set operation replaces the
421
- entire policy, so retain all approved origins.
422
- - Computer Use/user-only secret step: in R2, create an Object Read & Write S3
423
- token scoped to the selected bucket. The user clicks the final create
424
- button and privately stores the one-time Access Key ID and Secret Access
425
- Key under the exact `R2_*` variables. R2 must be enabled before these
426
- credentials can be generated.
427
- - Replace `assets.example.com` in the generated Wrangler file with the real
428
- hostname. Run `pnpm assets:proxy:check` and
429
- `pnpm assets:proxy:deploy`; Wrangler creates the Worker binding, managed
430
- DNS record, TLS certificate, and Worker Custom Domain.
431
- - Lifecycle rules are CLI-capable but currently have no generated root
432
- wrapper. Using the exact Wrangler version in `anhedral.json`, add and list
433
- a rule for `storage/staging/` whose expiration exceeds the application
434
- cleanup grace period. Treat any lifecycle replacement as destructive and
435
- preview/list existing rules first.
436
-
437
- ```sh
438
- pnpm dlx wrangler@<recorded-version> r2 bucket lifecycle list <bucket>
439
- pnpm dlx wrangler@<recorded-version> r2 bucket lifecycle add <bucket> staging-cleanup storage/staging/ --expire-days 1
440
- pnpm dlx wrangler@<recorded-version> r2 bucket lifecycle list <bucket>
441
- ```
442
-
443
- 6. **Vercel (`web`/`api`)**
444
-
445
- - CLI: run `pnpm deploy:vercel:link`; stop at OAuth/device authorization and
446
- explicitly confirm the team/project. Generated commands then cover preview,
447
- production, inspection, and domain inspection.
448
- - Computer Use: import/connect the GitHub repository for automatic preview
449
- deployments, keep the repository root, and select the **Services**
450
- framework preset. A `services` block in `vercel.json` is not sufficient
451
- unless the project setting is also Services.
452
- - Add Development, Preview, and Production environment values in protected
453
- fields. Vercel CLI supports environment management, but use an interactive
454
- secret-input flow or dashboard so values never appear in agent output.
455
- Keep server-only values out of public-prefixed variables.
456
- - Deploy Preview first. Verify `/api/health`, `/api/ready`, web routing,
457
- authentication, migrations, scheduled endpoints, and provider callbacks.
458
- Add `app.<domain>` only after preview is healthy, inspect the exact
459
- A/CNAME/TXT requirements, create those records at the authoritative DNS
460
- provider, and verify DNS plus TLS. Keep Vercel records DNS-only when
461
- Cloudflare is authoritative.
462
- - User-only: team billing, GitHub OAuth/SSO consent, production promotion,
463
- domain-conflict takeover, and destructive environment replacement.
464
-
465
- 7. **Complete URL-dependent provider configuration**
466
-
467
- After the preview URL and production hostname exist, return to Clerk,
468
- RevenueCat, CORS, OAuth providers, and store consoles. Replace temporary
469
- callback/origin values with exact HTTPS URLs, configure separate preview and
470
- production webhooks, redeploy public-key changes, and verify delivery logs.
471
-
472
- 8. **Electron updater (`electron-updater`)**
473
-
474
- - Replace both `updates.example.com` values, set the identical HTTPS origin
475
- in `apps/desktop/electron-builder.env`, run the generated Cloudflare login,
476
- and run `pnpm desktop:updates:first-provision` exactly once. Later deploys
477
- use `pnpm desktop:updates:worker:deploy`.
478
- - Wrangler covers the private bucket, Worker binding, custom domain, DNS, and
479
- TLS after the Cloudflare zone exists. Cloudflare account/R2 activation and
480
- registrar work retain the same Computer Use/user stops described above.
481
- - Build and sign on each target OS. Apple Developer enrollment, notarization
482
- agreements/credentials, Windows certificate purchase and organization
483
- validation, hardware/cloud key custody, and CI secret entry require the
484
- user or provider UI.
485
- - Upload signed immutable installers and blockmaps before mutable channel
486
- metadata with `pnpm desktop:updates:publish`. Test upgrade and rollback from
487
- a previously installed signed release.
488
-
489
- 9. **Expo/EAS and stores (`mobile`)**
490
-
491
- - CLI: run `pnpm mobile:eas:login`, stop for Expo authentication, verify the
492
- account/team, then run `pnpm mobile:eas:init`. Commit the EAS project ID and
493
- configuration. Build internal iOS/Android artifacts with the generated
494
- preview scripts before store builds.
495
- - EAS can generate/manage signing credentials and cloud builds. The user must
496
- participate in Apple/Google credential prompts; never relay passwords,
497
- MFA, private keys, service-account JSON, or signing certificates through
498
- chat.
499
- - Computer Use/user-only for Apple: enroll in the paid Developer Program,
500
- accept legal agreements, configure tax/banking and roles, create the App
501
- Store Connect app record and bundle ID, complete metadata/privacy/export
502
- compliance, manage TestFlight groups, and make final review/release choices.
503
- - Computer Use/user-only for Google: register/pay for Play Console, create the
504
- app/package, complete policy/data-safety/content declarations, create and
505
- authorize the service account, configure testers/tracks, and make final
506
- rollout choices. EAS CLI can upload the service-account key privately and
507
- submit builds; use the current Expo guidance for whether the first release
508
- still needs a console step.
509
- - Run generated production build and submit commands only after internal
510
- device testing. TestFlight processing/review and Play review/rollout are
511
- external asynchronous gates, not successful CLI completion.
512
-
513
- 10. **Chrome Web Store (`extension`)**
514
-
515
- - CLI: run `pnpm verify:extension` and `pnpm extension:zip`, then load the
516
- unpacked production output in Chrome and test permissions, auth, API calls,
517
- service-worker wakeup, and sign-out.
518
- - Computer Use/user-only: register the developer account, verify the contact
519
- email, accept the agreement, pay the fee, create the first item, upload the
520
- ZIP, fill listing/screenshots/category/regions, justify permissions,
521
- complete privacy/limited-use declarations, provide reviewer instructions,
522
- and submit.
523
- - Publish first to trusted testers or unlisted visibility. Capture the stable
524
- store-assigned CRX ID, reconcile Clerk and backend allowlists, rebuild if
525
- needed, and test the store-installed artifact before production review.
526
-
527
- 11. **Desktop distribution without updater**
528
-
529
- Build platform-specific artifacts on macOS, Windows, and Linux runners.
530
- Computer Use/user involvement remains necessary for Apple Developer and
531
- notarization enrollment, Windows certificate purchase/validation, OS
532
- trust prompts, and distribution-channel listing or final release. An
533
- unsigned local package is not equivalent to a production-ready desktop
534
- release.
535
-
536
- Create strong `CRON_SECRET` and webhook secrets through a password manager or a
537
- local non-logging generator. The user places them directly into server and
538
- deployment environments.
539
-
540
- ## 9. Verify and hand off
541
-
542
- Track these end-to-end completion gates:
543
-
544
- 1. **Workstation ready:** supported Node.js, exact pnpm, npm, Git, browser, and
545
- only the selected native tools are present; real Git identity is confirmed.
546
- 2. **Generated safely:** modules and dependency closure are confirmed,
547
- installation completed, `anhedral.json` is healthy, environment files are
548
- uncommitted, and no provider was created under the wrong personal/team
549
- account.
550
- 3. **Development ready:** development provider values are present, `pnpm ready`
551
- succeeds, reviewed database migrations are committed/applied,
552
- `pnpm verify`, `pnpm build`, and `pnpm anhedral:doctor` succeed, and the
553
- generated starter feature works end to end through a signed-in user.
554
- 4. **Preview ready:** Git-triggered or manual Vercel preview is healthy;
555
- `/api/health` and `/api/ready` pass; preview auth, database, webhooks,
556
- scheduled jobs, CORS, Workers, and selected client API URLs use isolated
557
- preview resources.
558
- 5. **Production infrastructure ready:** provider teams and billing owners are
559
- correct, production secrets are protected, migration state is current,
560
- custom-domain DNS resolves, TLS is issued, Clerk certificates/auth work,
561
- Workers have correct bindings/domains, and logs show successful health and
562
- callback probes.
563
- 6. **Distribution ready:** internal EAS/TestFlight/Play builds, trusted Chrome
564
- Web Store artifact, and signed desktop installers/updater are tested as
565
- selected. Store metadata, privacy declarations, reviewer credentials, tax
566
- and legal agreements, signing/notarization, rollback, and staged rollout are
567
- complete.
568
- 7. **Handoff ready:** record resource names, public IDs, URLs, teams, owners,
569
- renewal/recovery responsibilities, runbooks, and remaining external review
570
- statuses. Record no secrets. Give the user the exact final buttons or
571
- approvals still pending.
572
-
573
- Do not claim completion while a dashboard is merely open, DNS is still pending,
574
- TLS is unissued, an environment value is absent, or verification has not run.
575
- Likewise, a successful CLI upload is not an approved store release, a Vercel
576
- deployment URL is not a healthy application, and a generated project is not a
577
- provisioned product.