anhedral 0.3.0 → 0.4.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.
@@ -0,0 +1,220 @@
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
+ ## 1. Start with user inputs
8
+
9
+ Before running `anhedral new` or opening a provider dashboard, ask the user:
10
+
11
+ 1. What is the project name? Derive one stable lowercase kebab-case resource
12
+ stem from it and show the proposed value.
13
+ 2. Do they already own a custom domain for this product? If yes, record the
14
+ exact domain, registrar, current DNS provider, and whether production email
15
+ already uses it. If no, ask for the desired domain and obtain explicit
16
+ approval before any paid purchase.
17
+ 3. Which surfaces and features do they want? If they want the complete product,
18
+ use every module. Otherwise record explicit modules.
19
+ 4. Which provider organizations/teams should own Cloudflare, Vercel, GitHub,
20
+ Neon, Clerk, RevenueCat, Ably, Expo, Apple, Google Play, and Chrome Web Store
21
+ resources that apply to the selected modules?
22
+ 5. Is this development, preview, or production? Never point a preview at live
23
+ users, billing, or production data without explicit direction.
24
+
25
+ Do not improvise names independently in provider dashboards. Maintain a small
26
+ resource ledger containing the project stem, display name, domain, selected
27
+ modules, provider team, resource name, hostname, environment, status, and next
28
+ user action. Never put credential values in the ledger.
29
+
30
+ ## 2. Discover agent capabilities
31
+
32
+ Inspect the environment before planning execution:
33
+
34
+ - If Computer Use or an authenticated browser-control tool is available, use it
35
+ for provider dashboards after the user requests provisioning.
36
+ - If subagents are available, keep the lead agent in control and delegate only
37
+ bounded, independent work. Good tasks are reading generated documentation,
38
+ checking current DNS records without changing them, and producing a
39
+ selection-specific environment-variable inventory.
40
+ - Do not give subagents passwords, session cookies, secret values, or concurrent
41
+ control of the same browser/profile. Do not let two agents mutate DNS or the
42
+ same provider resource.
43
+ - If neither capability exists, use generated CLI commands and give the user
44
+ exact dashboard instructions for the remaining steps.
45
+
46
+ Recommended subagent sequence:
47
+
48
+ 1. Lead: collect inputs, resolve modules, choose canonical names, and run init.
49
+ 2. Documentation subagent: read the generated `README.md`, `PRODUCTION.md`, and
50
+ package-local `.env.example` files; return the provider/resource checklist.
51
+ 3. DNS subagent: perform read-only registrar, nameserver, DNS, and hostname
52
+ collision checks; return existing records that must be preserved.
53
+ 4. Verification subagent: after provisioning, run read-only domain, health,
54
+ Worker, and configuration checks. The lead performs or approves mutations.
55
+
56
+ If subagents are unavailable, perform the same phases serially. Their absence is
57
+ not a blocker.
58
+
59
+ ## 3. Generate the project
60
+
61
+ Prefer the skill-guided CLI path:
62
+
63
+ ```sh
64
+ pnpm dlx anhedral@latest new <project-name> <explicit-modules...> --toolchain stable
65
+ cd <project-name>
66
+ ```
67
+
68
+ Omit module arguments only when the user chose the complete stack. Examples:
69
+
70
+ ```sh
71
+ pnpm dlx anhedral@latest new acme --web --api --db --auth --toolchain stable
72
+ pnpm dlx anhedral@latest new acme desktop electron-updater --toolchain stable
73
+ ```
74
+
75
+ Then:
76
+
77
+ 1. Read the generated `README.md` and `PRODUCTION.md` completely.
78
+ 2. Read `anhedral.json` and confirm the resolved module closure with the user.
79
+ 3. Copy only package-local environment examples that exist.
80
+ 4. Run `pnpm dlx anhedral@latest doctor`, `pnpm verify`, and `pnpm build` before
81
+ provisioning. Fix code-generation or build failures before creating cloud
82
+ resources.
83
+
84
+ ## 4. Authentication and secret boundaries
85
+
86
+ Computer Use may navigate dashboards, fill non-secret settings, create approved
87
+ resources, deploy, configure DNS, and verify results. Apply these hard stops:
88
+
89
+ - Stop at every sign-in, password, passkey, MFA, CAPTCHA, device-approval, or
90
+ provider-consent boundary. Tell the user which provider is requesting access
91
+ and wait for them to complete it. Resume only after they say it is complete.
92
+ - Stop immediately before a paid purchase, registrar transfer, destructive
93
+ replacement, production release, store submission, or other consequential
94
+ final confirmation. Show the exact action, target, and cost/impact and obtain
95
+ approval.
96
+ - Stop at the final **Create**, **Generate**, **Reveal**, or **Rotate secret**
97
+ action. Tell the user the exact button to click, exact variable name, and exact
98
+ local uncommitted environment file to receive the value. The user must paste
99
+ it directly into that file or the provider's secret field, never into chat.
100
+ - Never read a populated `.env` file back into tool output, screenshots, logs,
101
+ the resource ledger, or a subagent message. Validate names and presence with a
102
+ redacting parser or the generated application checks.
103
+ - Public identifiers such as publishable keys, project IDs, account IDs, bucket
104
+ names, and hostnames may be recorded where their generated examples expect
105
+ them. Treat any provider value marked secret as secret even if it appears in a
106
+ browser page.
107
+
108
+ When the user finishes a secret step, ask only for confirmation such as
109
+ "`CLERK_SECRET_KEY` is saved in `apps/api/.env`". Do not ask them to repeat the
110
+ value. Mirror production secrets into Vercel or another deployment provider by
111
+ having the user paste into that provider's protected environment-variable UI,
112
+ or by using an approved secret-input flow that never prints the value.
113
+
114
+ ## 5. Domain foundation
115
+
116
+ Use Cloudflare as authoritative DNS and Vercel as the web/API runtime. A domain
117
+ can remain registered at GoDaddy; changing nameservers is not a registrar
118
+ transfer.
119
+
120
+ 1. If the user has no domain, use Computer Use to search the approved registrar
121
+ (usually GoDaddy), select the exact domain, and fill registration settings.
122
+ Stop before the paid purchase confirmation. Ask the user to review price,
123
+ renewal terms, registrant, and organization ownership and submit it.
124
+ 2. Inventory existing DNS before changing nameservers. Preserve MX, TXT, SPF,
125
+ DKIM, DMARC, verification, CAA, and application records. A domain with active
126
+ email requires an explicit preservation review.
127
+ 3. Add the domain as a Cloudflare zone. Stop for Cloudflare authentication. Copy
128
+ the two assigned authoritative nameservers.
129
+ 4. At the registrar, replace the authoritative nameservers with Cloudflare's
130
+ exact values. Disable conflicting registrar DNSSEC/DS records first when
131
+ required; wait until Cloudflare reports the zone **Active**, then enable
132
+ DNSSEC in Cloudflare and publish the requested DS record at the registrar.
133
+ 5. Do not transfer registration unless the user separately requests it. A
134
+ transfer changes billing/registrar ownership and may be subject to locks.
135
+
136
+ Use distinct hostnames:
137
+
138
+ ```text
139
+ app.example.com Vercel web/API custom domain
140
+ assets.example.com assets-private-proxy Worker Custom Domain
141
+ updates.example.com desktop-updater Worker Custom Domain
142
+ ```
143
+
144
+ `app.example.com` is a Vercel project domain whose A/CNAME/TXT records are
145
+ managed in Cloudflare DNS. Add the domain to Vercel first, inspect the exact
146
+ records Vercel requests, then add those records in Cloudflare. Keep the Vercel
147
+ origin record DNS-only unless current Vercel guidance and the user's architecture
148
+ explicitly require another topology.
149
+
150
+ Worker hostnames are Cloudflare **Worker Custom Domains**, not CNAMEs to Vercel
151
+ or R2. Configure `custom_domain: true` in the generated Wrangler file and deploy;
152
+ Cloudflare creates the DNS record and certificate. Remove any conflicting A,
153
+ AAAA, or CNAME record before attaching the Worker hostname.
154
+
155
+ ## 6. Provision selected providers
156
+
157
+ Follow the generated `PRODUCTION.md`; it is the selection-specific authority.
158
+ Use this dependency order so downstream configuration receives real URLs and
159
+ public identifiers:
160
+
161
+ 1. **GitHub**: create or select the organization repository, review the initial
162
+ diff, and push. Stop before changing repository visibility or overwriting an
163
+ existing remote.
164
+ 2. **Neon (`db`)**: create separate development/preview/production projects or
165
+ branches. At connection-string generation, stop and have the user save the
166
+ pooled URL as `DATABASE_URL` in `packages/db/.env`, `apps/api/.env` when
167
+ required, and the protected Vercel API environment.
168
+ 3. **Clerk (`auth`)**: create development and production instances and configure
169
+ allowed origins, redirect URLs, and native/extension identifiers. Stop at key
170
+ generation/reveal. Put the secret key only in server environments and the
171
+ publishable key in each selected client's documented public variable.
172
+ 4. **RevenueCat and Ably (`billing`)**: create projects/apps, entitlement,
173
+ products, webhook URL/secret, and Ably API key. Stop at every secret creation.
174
+ Keep RevenueCat secret and Ably API keys server-only; clients receive only
175
+ documented public SDK keys or scoped Ably tokens.
176
+ 5. **Cloudflare R2 (`storage`)**: run the generated login, bucket, CORS, Worker
177
+ check, and Worker deploy commands. Keep R2 private and `r2.dev` disabled.
178
+ Stop when Cloudflare requests authentication or before creating S3/API token
179
+ secrets; have the user save them under the exact `R2_*` names. Attach
180
+ `assets.<domain>` as the generated Worker Custom Domain.
181
+ 6. **Vercel (`web`/`api`)**: link/import the root repository, select the generated
182
+ Services configuration, populate Development/Preview/Production variables,
183
+ deploy, then add `app.<domain>`. Inspect Vercel's exact DNS requirements and
184
+ create them in Cloudflare DNS. Verify domain status and TLS after propagation.
185
+ 7. **Electron updater (`electron-updater`)**: edit both generated
186
+ `updates.example.com` values, set the matching HTTPS origin in
187
+ `apps/desktop/electron-builder.env`, run
188
+ `pnpm desktop:updates:first-provision` exactly once, and verify the private R2 binding plus
189
+ Worker Custom Domain. Build/sign on each native OS and upload artifacts
190
+ before channel metadata with the generated publish command.
191
+ 8. **Expo/EAS and stores (`mobile`)**: create/link the EAS project, configure
192
+ public build variables and signing credentials, and build internal releases.
193
+ Stop at Apple/Google sign-in, credential, paid membership, agreement, and
194
+ store-submission boundaries.
195
+ 9. **Chrome Web Store (`extension`)**: configure a stable extension ID, test the
196
+ generated ZIP as trusted/unlisted, and complete listing/privacy fields. Stop
197
+ before developer registration payment and final store submission.
198
+
199
+ Create strong `CRON_SECRET` and webhook secrets through a password manager or a
200
+ local non-logging generator. The user places them directly into server and
201
+ deployment environments.
202
+
203
+ ## 7. Verify and hand off
204
+
205
+ After configuration:
206
+
207
+ 1. Run `pnpm verify`, `pnpm build`, and `anhedral doctor`.
208
+ 2. Verify Vercel deployment health, custom-domain status, DNS answers, and TLS.
209
+ 3. Verify every selected Worker accepts its intended GET/HEAD behavior, rejects
210
+ forbidden methods/hosts, and cannot expose or list the private bucket.
211
+ 4. Verify database migration status, auth redirect/sign-out, billing webhook and
212
+ entitlement refresh, storage upload/read policy, and scheduled jobs as
213
+ selected.
214
+ 5. Record resource names, URLs, provider teams, and remaining manual approvals.
215
+ Record no secrets.
216
+ 6. Stop before production/store release and give the user a concise checklist of
217
+ the exact final buttons or approvals still required.
218
+
219
+ Do not claim completion while a dashboard is merely open, DNS is still pending,
220
+ TLS is unissued, an environment value is absent, or verification has not run.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "anhedral",
3
- "version": "0.3.0",
4
- "description": "Generate a complete, readable TypeScript product stack with Next.js, Expo, Fastify, Neon, Drizzle, Clerk, R2, Electron, WXT, and Vercel.",
3
+ "version": "0.4.1",
4
+ "description": "Generate a complete, readable TypeScript product stack with Next.js, Expo, Fastify, Neon, Drizzle, Clerk, R2, Electron updates, WXT, and Vercel.",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -18,9 +18,14 @@
18
18
  "bin",
19
19
  "dist",
20
20
  "docs/conventions.md",
21
+ "assets/anhedral-cli-init.svg",
22
+ "assets/images/svg/ably-symbol-color.svg",
23
+ "assets/images/svg/logo-white-subtract.svg",
24
+ "docs/master-stack-map.md",
21
25
  "docs/output-tree-contract.md",
26
+ "docs/references",
27
+ "scripts/render-master-stack-map.mjs",
22
28
  "templates",
23
- "references",
24
29
  "SKILL.md",
25
30
  "CHANGELOG.md",
26
31
  "CONTRIBUTING.md",
@@ -83,7 +88,8 @@
83
88
  "release:pack": "pnpm build && node scripts/create-release-artifact.mjs && node scripts/check-release-secrets.mjs release-artifact/metadata.json",
84
89
  "release:artifact:verify": "node scripts/verify-release-artifact.mjs release-artifact/metadata.json && node scripts/check-release-secrets.mjs release-artifact/metadata.json",
85
90
  "release:artifact:smoke": "node tests/test-packed-cli.js release-artifact/metadata.json",
86
- "demo:refresh": "pnpm build && node tests/refresh-demo.js"
91
+ "demo:refresh": "pnpm build && node tests/refresh-demo.js",
92
+ "docs:stack-map": "node scripts/render-master-stack-map.mjs"
87
93
  },
88
94
  "keywords": [
89
95
  "cli",
@@ -100,11 +106,12 @@
100
106
  "wxt",
101
107
  "vercel"
102
108
  ],
103
- "license": "UNLICENSED",
109
+ "license": "Apache-2.0",
104
110
  "packageManager": "pnpm@10.34.5",
105
111
  "devDependencies": {
106
112
  "@types/node": "20.19.43",
107
113
  "c8": "11.0.0",
114
+ "simple-icons": "16.27.0",
108
115
  "typescript": "5.9.3"
109
116
  }
110
117
  }