anhedral 0.3.0 → 0.4.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/CHANGELOG.md +22 -0
- package/CONTRIBUTING.md +4 -1
- package/LICENSE +201 -26
- package/README.md +71 -13
- package/SECURITY.md +4 -2
- package/SKILL.md +78 -11
- package/dist/architecture/contributions.js +7 -0
- package/dist/architecture/modules.d.ts +2 -2
- package/dist/architecture/modules.js +11 -3
- package/dist/bin.js +17 -5
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +4 -1
- package/dist/composers/root.js +1 -0
- package/dist/dependencies.d.ts +2 -0
- package/dist/dependencies.js +8 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/prompts.d.ts +1 -1
- package/dist/scaffold.d.ts +8 -0
- package/dist/scaffold.js +306 -38
- package/dist/templates/api.js +8 -0
- package/dist/templates/desktop.js +78 -11
- package/dist/templates/electron-updater.d.ts +3 -0
- package/dist/templates/electron-updater.js +358 -0
- package/dist/templates/shared.js +23 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/conventions.md +4 -1
- package/docs/master-stack-map.md +192 -0
- package/docs/output-tree-contract.md +45 -5
- package/{references → docs/references}/manual-scaffolding.md +24 -7
- package/docs/references/provisioning.md +220 -0
- package/package.json +5 -4
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Anhedral master stack map
|
|
2
|
+
|
|
3
|
+
This is the canonical whole-stack map for Anhedral. It shows the ordered flow
|
|
4
|
+
from skill-led planning through deterministic generation, source layout,
|
|
5
|
+
connected capabilities, cloud provisioning, command-driven operations, agent
|
|
6
|
+
experience, and production verification.
|
|
7
|
+
|
|
8
|
+
Read top to bottom. Arrows represent lifecycle order, not runtime network calls.
|
|
9
|
+
Runtime and provider connections are stated explicitly inside each stage.
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
+==========================================================================================================================+
|
|
13
|
+
| ANHEDRAL MASTER STACK MAP |
|
|
14
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
15
|
+
|OUTCOME One readable TypeScript codebase and one command surface connecting every application, cloud resource, release |
|
|
16
|
+
|path, runbook, and coding agent. |
|
|
17
|
+
|PRINCIPLE Ordinary framework code, source ownership, and generated integration boundaries. Anhedral assembles the stack; |
|
|
18
|
+
|it is not the application runtime. |
|
|
19
|
+
+==========================================================================================================================+
|
|
20
|
+
|
|
|
21
|
+
v
|
|
22
|
+
+==========================================================================================================================+
|
|
23
|
+
| 1 SELECT + PLAN |
|
|
24
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
25
|
+
|SKILL FIRST Install and invoke $anhedral-init. Ask for project name and custom-domain status before generating or |
|
|
26
|
+
|provisioning. |
|
|
27
|
+
|CREATE anhedral new <directory> | anhedral init EXTEND anhedral add <modules> | anhedral ui add <components> |
|
|
28
|
+
|INSPECT anhedral doctor AUTOMATE --dry-run | --json | --verbose | --skip-install |
|
|
29
|
+
|SURFACES web | mobile | api | desktop | extension |
|
|
30
|
+
|FEATURES db | auth | billing | storage | native-subscriptions | electron-updater |
|
|
31
|
+
|UI shadcn/ui for DOM clients | React Native Reusables for Expo | NativeWind or Uniwind |
|
|
32
|
+
|CLOSURE auth -> api + db | billing -> auth | storage -> auth | native-subscriptions -> mobile + billing | |
|
|
33
|
+
|electron-updater -> desktop |
|
|
34
|
+
+==========================================================================================================================+
|
|
35
|
+
|
|
|
36
|
+
v
|
|
37
|
+
+==========================================================================================================================+
|
|
38
|
+
| 2 GENERATE SAFELY |
|
|
39
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
40
|
+
|PIPELINE Resolve modules -> select immutable templates -> verify SHA-256 catalog -> stage files -> compose typed |
|
|
41
|
+
|contributions. |
|
|
42
|
+
|PIPELINE Run pinned UI providers only in staging -> record provenance and ownership -> atomic commit -> one root pnpm |
|
|
43
|
+
|install. |
|
|
44
|
+
|REFUSES traversal | symlinks | nested repositories/workspaces | caches | oversized files | unowned collisions | managed |
|
|
45
|
+
|drift. |
|
|
46
|
+
|OWNERSHIP Product source plus README/PRODUCTION are user-owned | root configuration is mergeable | integration substrate |
|
|
47
|
+
|is managed. |
|
|
48
|
+
|STATE anhedral.json records modules, versions, template/UI provenance, styling, file hashes, modes, and ownership. |
|
|
49
|
+
|WHY Deterministic, inspectable generation and safe incremental adds without replacing user work. |
|
|
50
|
+
+==========================================================================================================================+
|
|
51
|
+
|
|
|
52
|
+
v
|
|
53
|
+
+==========================================================================================================================+
|
|
54
|
+
| 3 ONE PNPM + TURBOREPO TYPESCRIPT WORKSPACE |
|
|
55
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
56
|
+
|apps/web Next.js App Router + React + shadcn/ui. WHY: SSR, routing, server-first web, and source-owned UI. |
|
|
57
|
+
|apps/mobile Expo Router + React Native Reusables. WHY: one native TypeScript product for iOS and Android. |
|
|
58
|
+
|apps/api Fastify + validation/security plugins. WHY: thin routes, services, structured logs, and explicit boundaries. |
|
|
59
|
+
|apps/desktop Electron + Vite + sandboxed React renderer. WHY: cross-platform desktop with a narrow privileged bridge. |
|
|
60
|
+
|apps/extension WXT + React + MV3 entrypoints. WHY: browser permissions, side panel/background, builds, and packaging. |
|
|
61
|
+
|apps/assets-private-proxy Cloudflare Worker + private R2 binding. WHY: controlled GET/HEAD media delivery without bucket |
|
|
62
|
+
|listing. |
|
|
63
|
+
|apps/desktop-updater-worker Cloudflare Worker + private R2 binding. WHY: custom-domain Electron metadata, ranges, and |
|
|
64
|
+
|downloads. |
|
|
65
|
+
|packages/contracts Zod schemas. WHY: one validated network contract shared across every boundary. |
|
|
66
|
+
|packages/api-client Typed client-safe HTTP. WHY: one request path for web, mobile, desktop, and extension. |
|
|
67
|
+
|packages/db Drizzle schema + reviewed SQL migrations. WHY: readable TypeScript schema and explicit release artifacts. |
|
|
68
|
+
|packages/realtime Ably client. WHY: scoped invalidation events while clients refetch authoritative state. |
|
|
69
|
+
+==========================================================================================================================+
|
|
70
|
+
|
|
|
71
|
+
v
|
|
72
|
+
+==========================================================================================================================+
|
|
73
|
+
| 4 CONNECTED PRODUCT CAPABILITIES |
|
|
74
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
75
|
+
|REQUESTS Zod contract -> service/Drizzle query -> Fastify route -> typed API client -> every selected client. |
|
|
76
|
+
|IDENTITY Clerk sessions in clients -> verified server identity; never trust a client-supplied user ID. |
|
|
77
|
+
|DATABASE Fastify -> Drizzle -> managed Neon Postgres with isolated dev/preview/production; no generated local Postgres. |
|
|
78
|
+
|STORAGE API presigns R2 PUT -> client uploads -> API confirms -> Worker streams confirmed assets or owner-authorized |
|
|
79
|
+
|reads. |
|
|
80
|
+
|BILLING Expo purchase -> RevenueCat -> signed webhook -> Neon entitlement + transactional outbox. |
|
|
81
|
+
|REALTIME Outbox -> scoped Ably event -> every client refetches the authoritative entitlement. |
|
|
82
|
+
|DESKTOP UPDATE Signed native build -> artifacts then latest metadata -> private R2 -> updates.<domain> Worker -> |
|
|
83
|
+
|electron-updater. |
|
|
84
|
+
|SECURITY Server-only secrets | exact CORS | rate limits/headers | Electron isolation | least privilege | private buckets. |
|
|
85
|
+
+==========================================================================================================================+
|
|
86
|
+
|
|
|
87
|
+
v
|
|
88
|
+
+==========================================================================================================================+
|
|
89
|
+
| 5 PROVISION + CONFIGURE THE CLOUD |
|
|
90
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
91
|
+
|DOMAIN Buy/confirm domain -> add Cloudflare zone -> preserve mail records -> delegate nameservers -> activate DNSSEC. |
|
|
92
|
+
|GITHUB + CI Organization repository, protected environments, pinned Actions, PR checks, branches, and release artifacts. |
|
|
93
|
+
|NEON Projects/branches per environment, pooled DATABASE_URL, backups, reviewed migrations, and controlled deploy gates. |
|
|
94
|
+
|CLERK Development/production instances, publishable/secret keys, domains, OAuth, redirects, webhooks, native and CRX IDs. |
|
|
95
|
+
|CLOUDFLARE Authoritative DNS, private R2 buckets, scoped tokens, CORS/lifecycle, Worker bindings, logs, and custom |
|
|
96
|
+
|domains. |
|
|
97
|
+
|VERCEL Services deployment for web/API, rewrites, environment scopes, preview/production, cron endpoints, domains, and |
|
|
98
|
+
|TLS. |
|
|
99
|
+
|REVENUECAT + ABLY Products, offerings, entitlements, store credentials, signed webhook, scoped realtime, and retry cron. |
|
|
100
|
+
|EAS + STORES Expo project, credentials, internal builds, TestFlight/Play testing, metadata, privacy, review, and rollout. |
|
|
101
|
+
|BROWSER STORE Stable extension ID, least host permissions, OAuth sync, privacy disclosure, trusted testing, and review. |
|
|
102
|
+
|DESKTOP Native-OS signing/notarization, electron-builder installers, private update channel, upgrade tests, and rollback. |
|
|
103
|
+
|DNS app.<domain> points from Cloudflare DNS to Vercel and stays DNS-only; assets/updates are Cloudflare Worker Custom |
|
|
104
|
+
|Domains. |
|
|
105
|
+
|AGENT STOPS User handles sign-in/MFA, purchases, secret generation/reveal, destructive confirmations, and final |
|
|
106
|
+
|submissions. |
|
|
107
|
+
+==========================================================================================================================+
|
|
108
|
+
|
|
|
109
|
+
v
|
|
110
|
+
+==========================================================================================================================+
|
|
111
|
+
| 6 GENERATED package.json COMMAND SURFACE |
|
|
112
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
113
|
+
|WORKSPACE dev | build | typecheck | verify WHY: run and validate exactly the selected monorepo. |
|
|
114
|
+
|APP LOOPS dev:web | dev:mobile | dev:api | dev:desktop | dev:extension |
|
|
115
|
+
|APP CHECKS verify:web | verify:mobile | verify:api | verify:desktop | verify:extension |
|
|
116
|
+
|VERCEL deploy:vercel:{link,preview,production,inspect,domain:inspect} WHY: connect, release, diagnose, and configure DNS. |
|
|
117
|
+
|MOBILE mobile:eas:{login,init} | mobile:build:{internal,production}:{ios,android} | mobile:submit:{ios,android} |
|
|
118
|
+
|DATABASE neon:{login,project:create} | db:{generate,migrate,check,studio} | verify:db |
|
|
119
|
+
|STORAGE r2:{login,bucket:create,cors:list,cors:set} | assets:proxy:{check,dev,deploy} | verify:assets-proxy |
|
|
120
|
+
|UPDATES desktop:updates:{cloudflare:login,bucket:create,provision,publish} |
|
|
121
|
+
|UPDATES desktop:updates:worker:{check,dev,deploy,types} | desktop:updates:build:{mac,win,linux} | verify:desktop-updates |
|
|
122
|
+
|DESKTOP desktop:build | verify:desktop EXTENSION extension:zip | verify:extension |
|
|
123
|
+
|STRUCTURE anhedral doctor | add/ui --dry-run WHY: detect drift and preview safe structural changes. |
|
|
124
|
+
+==========================================================================================================================+
|
|
125
|
+
|
|
|
126
|
+
v
|
|
127
|
+
+==========================================================================================================================+
|
|
128
|
+
| 7 DEVELOPER, AGENT + COMPUTER-USE EXPERIENCE |
|
|
129
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
130
|
+
|DOCS README.md first run/source map | docs/DEVELOPMENT.md recipes | docs/STACK.md tool map | PRODUCTION.md cloud runbook. |
|
|
131
|
+
|CONTROL SKILL.md agent workflow | ANHEDRAL.md ownership notes | anhedral.json source of truth | .env.example inventories. |
|
|
132
|
+
|CODING AGENT Ask name/domain -> resolve modules -> generate -> read docs/manifest -> doctor -> provision -> verify -> |
|
|
133
|
+
|hand off. |
|
|
134
|
+
|SUBAGENTS Lead owns mutations; delegate docs/env inventory, read-only DNS checks, and final verification without secrets. |
|
|
135
|
+
|COMPUTER USE Drive provider consoles after user authentication; configure accounts, domains, OAuth, DNS, stores, and |
|
|
136
|
+
|rollout. |
|
|
137
|
+
|SECRET HANDOFF Stop before Generate/Reveal/Create; name the variable/file; user pastes directly into uncommitted |
|
|
138
|
+
|env/provider UI. |
|
|
139
|
+
|UI DX Source-owned components, target routing, accessibility, ordinary framework APIs, and no hidden proprietary runtime. |
|
|
140
|
+
|OPERATIONS DX Exact root commands, selection-aware docs/scripts, machine-readable plans, provider ledger, and explicit |
|
|
141
|
+
|stop gates. |
|
|
142
|
+
+==========================================================================================================================+
|
|
143
|
+
|
|
|
144
|
+
v
|
|
145
|
+
+==========================================================================================================================+
|
|
146
|
+
| 8 VERIFY, RELEASE + OPERATE |
|
|
147
|
+
+--------------------------------------------------------------------------------------------------------------------------+
|
|
148
|
+
|LOCAL Smallest package check -> typecheck -> full verify -> build -> doctor; never weaken a failing gate. |
|
|
149
|
+
|DATABASE Generate -> review/commit SQL -> drift gate -> controlled migrate -> health/readiness checks. |
|
|
150
|
+
|RUNTIME API coverage, auth/CORS, billing replay/order, Ably reconnect, R2 upload/read/range/cache, Worker method/host |
|
|
151
|
+
|security. |
|
|
152
|
+
|CLIENTS Next build | Expo compatibility/device checks | packaged Electron smoke/upgrade | live WXT MV3 worker in Chrome. |
|
|
153
|
+
|INFRA Confirm provider team/resource names, protected env presence, DNS answers, TLS, Vercel health, Worker bindings, and |
|
|
154
|
+
|logs. |
|
|
155
|
+
|CI Pinned toolchain, strict pnpm policy, allowed build scripts, OSV audit, secret scan, deterministic outputs, and |
|
|
156
|
+
|release checks. |
|
|
157
|
+
|RELEASES Vercel preview/prod | TestFlight/Play tracks | browser-store trusted/review | signed desktop staged update |
|
|
158
|
+
|channel. |
|
|
159
|
+
|RECOVERY Transaction rollback, provider backups, database rollback plan, staged/phased rollout, telemetry, and documented |
|
|
160
|
+
|owners. |
|
|
161
|
+
+==========================================================================================================================+
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Runtime connection summary
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
web / mobile / desktop / extension
|
|
168
|
+
|
|
|
169
|
+
v
|
|
170
|
+
packages/api-client
|
|
171
|
+
|
|
|
172
|
+
v
|
|
173
|
+
Fastify API + Zod contracts
|
|
174
|
+
| | |
|
|
175
|
+
v v v
|
|
176
|
+
Clerk identity Neon private R2
|
|
177
|
+
|
|
|
178
|
+
v
|
|
179
|
+
RevenueCat entitlement
|
|
180
|
+
|
|
|
181
|
+
v
|
|
182
|
+
Ably event
|
|
183
|
+
|
|
|
184
|
+
v
|
|
185
|
+
clients refetch state
|
|
186
|
+
|
|
187
|
+
signed desktop release -> private update R2 -> updates.<domain> Worker -> electron-updater
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The runtime summary is intentionally smaller than the lifecycle map. It shows
|
|
191
|
+
only application data flow; DNS, provisioning, release gates, and agent actions
|
|
192
|
+
remain in the master map above.
|
|
@@ -21,10 +21,10 @@ node tests/update-output-tree-contracts.js
|
|
|
21
21
|
|
|
22
22
|
| Scenario | Apps | Features | Contract | Entries | Tree SHA-256 |
|
|
23
23
|
| --- | --- | --- | --- | ---: | --- |
|
|
24
|
-
| `expo-extension` | web, mobile, api, desktop, extension | database, auth, billing, storage, nativeSubscriptions | deterministic golden |
|
|
25
|
-
| `web-api-minimal` | web, api | database, auth | deterministic golden |
|
|
26
|
-
| `api-only` | api | | deterministic golden |
|
|
27
|
-
| `add-desktop-flow` | api, desktop | database, auth | deterministic golden |
|
|
24
|
+
| `expo-extension` | web, mobile, api, desktop, extension | database, auth, billing, storage, nativeSubscriptions, electronUpdater | deterministic golden | 145 | `ffe0feed203c4cdfaeeadba03dd2acc93855296699570d81f856b989f45cde23` |
|
|
25
|
+
| `web-api-minimal` | web, api | database, auth | deterministic golden | 65 | `25303118c1ee766afbfd9a707b5b16c25ad587021a62a68238696dda7cbc4385` |
|
|
26
|
+
| `api-only` | api | | deterministic golden | 32 | `a405e93cea274273bf46605e934e4a9be21018513b04c47c83ed1b1b8c9f187e` |
|
|
27
|
+
| `add-desktop-flow` | api, desktop | database, auth | deterministic golden | 67 | `d6804478404c2bb62945f6a7dbb9d1184ebe75d3594b83347cab76e785b21051` |
|
|
28
28
|
|
|
29
29
|
## expo-extension
|
|
30
30
|
|
|
@@ -55,6 +55,8 @@ expo-extension-sample/
|
|
|
55
55
|
│ │ │ ├── env.ts
|
|
56
56
|
│ │ │ ├── index.ts
|
|
57
57
|
│ │ │ ├── realtime.ts
|
|
58
|
+
│ │ │ ├── routes/
|
|
59
|
+
│ │ │ │ └── app.ts
|
|
58
60
|
│ │ │ ├── routes.ts
|
|
59
61
|
│ │ │ └── storage.ts
|
|
60
62
|
│ │ ├── tests/
|
|
@@ -72,13 +74,16 @@ expo-extension-sample/
|
|
|
72
74
|
│ ├── desktop/
|
|
73
75
|
│ │ ├── .env.example
|
|
74
76
|
│ │ ├── components.json
|
|
77
|
+
│ │ ├── electron-builder.env.example
|
|
75
78
|
│ │ ├── index.html
|
|
76
79
|
│ │ ├── package.json
|
|
77
80
|
│ │ ├── postcss.config.mjs
|
|
78
81
|
│ │ ├── scripts/
|
|
79
|
-
│ │ │
|
|
82
|
+
│ │ │ ├── dev.mjs
|
|
83
|
+
│ │ │ └── publish-updates.mjs
|
|
80
84
|
│ │ ├── src/
|
|
81
85
|
│ │ │ ├── main/
|
|
86
|
+
│ │ │ │ ├── app-window.ts
|
|
82
87
|
│ │ │ │ ├── main.ts
|
|
83
88
|
│ │ │ │ └── preload.cts
|
|
84
89
|
│ │ │ └── renderer/
|
|
@@ -96,6 +101,13 @@ expo-extension-sample/
|
|
|
96
101
|
│ │ ├── tsconfig.json
|
|
97
102
|
│ │ ├── tsconfig.main.json
|
|
98
103
|
│ │ └── vite.config.ts
|
|
104
|
+
│ ├── desktop-updater-worker/
|
|
105
|
+
│ │ ├── package.json
|
|
106
|
+
│ │ ├── src/
|
|
107
|
+
│ │ │ └── index.js
|
|
108
|
+
│ │ ├── tests/
|
|
109
|
+
│ │ │ └── worker.test.js
|
|
110
|
+
│ │ └── wrangler.jsonc
|
|
99
111
|
│ ├── extension/
|
|
100
112
|
│ │ ├── .env.example
|
|
101
113
|
│ │ ├── README.md
|
|
@@ -176,6 +188,7 @@ expo-extension-sample/
|
|
|
176
188
|
│ └── tsconfig.json
|
|
177
189
|
├── cloudflare/
|
|
178
190
|
│ ├── README.md
|
|
191
|
+
│ ├── desktop-updates.md
|
|
179
192
|
│ └── r2-cors.template.json
|
|
180
193
|
├── docs/
|
|
181
194
|
│ ├── DEVELOPMENT.md
|
|
@@ -185,11 +198,15 @@ expo-extension-sample/
|
|
|
185
198
|
│ ├── api-client/
|
|
186
199
|
│ │ ├── package.json
|
|
187
200
|
│ │ ├── src/
|
|
201
|
+
│ │ │ ├── app.ts
|
|
202
|
+
│ │ │ ├── generated.ts
|
|
188
203
|
│ │ │ └── index.ts
|
|
189
204
|
│ │ └── tsconfig.json
|
|
190
205
|
│ ├── contracts/
|
|
191
206
|
│ │ ├── package.json
|
|
192
207
|
│ │ ├── src/
|
|
208
|
+
│ │ │ ├── app.ts
|
|
209
|
+
│ │ │ ├── generated.ts
|
|
193
210
|
│ │ │ └── index.ts
|
|
194
211
|
│ │ └── tsconfig.json
|
|
195
212
|
│ ├── db/
|
|
@@ -199,6 +216,8 @@ expo-extension-sample/
|
|
|
199
216
|
│ │ │ └── .gitkeep
|
|
200
217
|
│ │ ├── package.json
|
|
201
218
|
│ │ ├── src/
|
|
219
|
+
│ │ │ ├── app-schema.ts
|
|
220
|
+
│ │ │ ├── generated-schema.ts
|
|
202
221
|
│ │ │ ├── index.ts
|
|
203
222
|
│ │ │ ├── migrate.ts
|
|
204
223
|
│ │ │ └── schema.ts
|
|
@@ -242,6 +261,8 @@ web-api-minimal/
|
|
|
242
261
|
│ │ │ ├── auth.ts
|
|
243
262
|
│ │ │ ├── env.ts
|
|
244
263
|
│ │ │ ├── index.ts
|
|
264
|
+
│ │ │ ├── routes/
|
|
265
|
+
│ │ │ │ └── app.ts
|
|
245
266
|
│ │ │ └── routes.ts
|
|
246
267
|
│ │ ├── tests/
|
|
247
268
|
│ │ │ ├── env.test.ts
|
|
@@ -278,11 +299,15 @@ web-api-minimal/
|
|
|
278
299
|
│ ├── api-client/
|
|
279
300
|
│ │ ├── package.json
|
|
280
301
|
│ │ ├── src/
|
|
302
|
+
│ │ │ ├── app.ts
|
|
303
|
+
│ │ │ ├── generated.ts
|
|
281
304
|
│ │ │ └── index.ts
|
|
282
305
|
│ │ └── tsconfig.json
|
|
283
306
|
│ ├── contracts/
|
|
284
307
|
│ │ ├── package.json
|
|
285
308
|
│ │ ├── src/
|
|
309
|
+
│ │ │ ├── app.ts
|
|
310
|
+
│ │ │ ├── generated.ts
|
|
286
311
|
│ │ │ └── index.ts
|
|
287
312
|
│ │ └── tsconfig.json
|
|
288
313
|
│ └── db/
|
|
@@ -292,6 +317,8 @@ web-api-minimal/
|
|
|
292
317
|
│ │ └── .gitkeep
|
|
293
318
|
│ ├── package.json
|
|
294
319
|
│ ├── src/
|
|
320
|
+
│ │ ├── app-schema.ts
|
|
321
|
+
│ │ ├── generated-schema.ts
|
|
295
322
|
│ │ ├── index.ts
|
|
296
323
|
│ │ ├── migrate.ts
|
|
297
324
|
│ │ └── schema.ts
|
|
@@ -329,6 +356,8 @@ api-only/
|
|
|
329
356
|
│ │ ├── application.ts
|
|
330
357
|
│ │ ├── env.ts
|
|
331
358
|
│ │ ├── index.ts
|
|
359
|
+
│ │ ├── routes/
|
|
360
|
+
│ │ │ └── app.ts
|
|
332
361
|
│ │ └── routes.ts
|
|
333
362
|
│ ├── tests/
|
|
334
363
|
│ │ ├── env.test.ts
|
|
@@ -343,6 +372,8 @@ api-only/
|
|
|
343
372
|
│ └── contracts/
|
|
344
373
|
│ ├── package.json
|
|
345
374
|
│ ├── src/
|
|
375
|
+
│ │ ├── app.ts
|
|
376
|
+
│ │ ├── generated.ts
|
|
346
377
|
│ │ └── index.ts
|
|
347
378
|
│ └── tsconfig.json
|
|
348
379
|
├── pnpm-workspace.yaml
|
|
@@ -377,6 +408,8 @@ add-desktop-flow/
|
|
|
377
408
|
│ │ │ ├── auth.ts
|
|
378
409
|
│ │ │ ├── env.ts
|
|
379
410
|
│ │ │ ├── index.ts
|
|
411
|
+
│ │ │ ├── routes/
|
|
412
|
+
│ │ │ │ └── app.ts
|
|
380
413
|
│ │ │ └── routes.ts
|
|
381
414
|
│ │ ├── tests/
|
|
382
415
|
│ │ │ ├── env.test.ts
|
|
@@ -393,6 +426,7 @@ add-desktop-flow/
|
|
|
393
426
|
│ │ └── dev.mjs
|
|
394
427
|
│ ├── src/
|
|
395
428
|
│ │ ├── main/
|
|
429
|
+
│ │ │ ├── app-window.ts
|
|
396
430
|
│ │ │ ├── main.ts
|
|
397
431
|
│ │ │ └── preload.cts
|
|
398
432
|
│ │ └── renderer/
|
|
@@ -416,11 +450,15 @@ add-desktop-flow/
|
|
|
416
450
|
│ ├── api-client/
|
|
417
451
|
│ │ ├── package.json
|
|
418
452
|
│ │ ├── src/
|
|
453
|
+
│ │ │ ├── app.ts
|
|
454
|
+
│ │ │ ├── generated.ts
|
|
419
455
|
│ │ │ └── index.ts
|
|
420
456
|
│ │ └── tsconfig.json
|
|
421
457
|
│ ├── contracts/
|
|
422
458
|
│ │ ├── package.json
|
|
423
459
|
│ │ ├── src/
|
|
460
|
+
│ │ │ ├── app.ts
|
|
461
|
+
│ │ │ ├── generated.ts
|
|
424
462
|
│ │ │ └── index.ts
|
|
425
463
|
│ │ └── tsconfig.json
|
|
426
464
|
│ └── db/
|
|
@@ -430,6 +468,8 @@ add-desktop-flow/
|
|
|
430
468
|
│ │ └── .gitkeep
|
|
431
469
|
│ ├── package.json
|
|
432
470
|
│ ├── src/
|
|
471
|
+
│ │ ├── app-schema.ts
|
|
472
|
+
│ │ ├── generated-schema.ts
|
|
433
473
|
│ │ ├── index.ts
|
|
434
474
|
│ │ ├── migrate.ts
|
|
435
475
|
│ │ └── schema.ts
|
|
@@ -23,7 +23,7 @@ Record these values before editing:
|
|
|
23
23
|
- `projectName`: a valid npm package name; use it for the root package and child package prefixes.
|
|
24
24
|
- `displayName`: human-readable product name; escape it for every JSON, JavaScript, HTML, and Markdown context.
|
|
25
25
|
- requested app surfaces: `web`, `mobile`, `api`, `desktop`, `extension`.
|
|
26
|
-
- requested features: `db`, `auth`, `billing`, `storage`, `native-subscriptions`.
|
|
26
|
+
- requested features: `db`, `auth`, `billing`, `storage`, `native-subscriptions`, `electron-updater`.
|
|
27
27
|
- toolchain policy: exact tested versions for reproducibility, or current compatible versions when the user explicitly wants upgrades.
|
|
28
28
|
|
|
29
29
|
Resolve the transitive closure before writing files:
|
|
@@ -33,9 +33,10 @@ auth -> api + db
|
|
|
33
33
|
billing -> auth -> api + db
|
|
34
34
|
storage -> auth -> api + db
|
|
35
35
|
native-subscriptions -> mobile + billing -> auth + api + db
|
|
36
|
+
electron-updater -> desktop
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
If no modules were specified, select all five surfaces and all
|
|
39
|
+
If no modules were specified, select all five surfaces and all six features. Never create a feature without its prerequisites. Keep normalized order `web, mobile, api, desktop, extension, db, auth, billing, storage, native-subscriptions, electron-updater` when displaying or recording a plan.
|
|
39
40
|
|
|
40
41
|
Choose Node `^20.19.0 || >=22.12.0` unless mobile is selected. Expo mobile requires `^22.13.0 || ^24.3.0 || >=25`. Use one root pnpm workspace and one root lockfile; never leave nested lockfiles, workspaces, `.git` directories, or `node_modules` inside apps.
|
|
41
42
|
|
|
@@ -50,13 +51,14 @@ api: fastify 5.8.5, @fastify/cors 11.1.0, @fastify/compress 8.3.0,
|
|
|
50
51
|
@fastify/helmet 13.0.2, @fastify/rate-limit 10.3.0,
|
|
51
52
|
@clerk/fastify 3.1.51, @aws-sdk/client-s3 3.1047.0,
|
|
52
53
|
@aws-sdk/s3-request-presigner 3.1047.0, ably 2.24.0, vitest 4.1.0
|
|
53
|
-
web: next 16.2.
|
|
54
|
+
web: next 16.2.11, react/react-dom 19.2.3, @clerk/nextjs 7.5.18,
|
|
54
55
|
@clerk/ui 1.25.3, tailwindcss and @tailwindcss/postcss 4.1.18
|
|
55
56
|
mobile: expo 56.0.16, expo-router 56.2.15, react-native 0.85.3,
|
|
56
57
|
@clerk/expo 3.7.5, expo-secure-store 56.0.4,
|
|
57
58
|
react-native-purchases/react-native-purchases-ui 10.4.2
|
|
58
59
|
desktop: electron 43.1.1, electron-builder 26.15.3, vite 7.3.6,
|
|
59
|
-
@vitejs/plugin-react 5.2.0, @clerk/clerk-js 6.25.3
|
|
60
|
+
@vitejs/plugin-react 5.2.0, @clerk/clerk-js 6.25.3,
|
|
61
|
+
electron-updater 6.8.9 when electron-updater is selected
|
|
60
62
|
extension: wxt 0.20.27, @wxt-dev/module-react 1.2.2,
|
|
61
63
|
@clerk/chrome-extension 3.1.52, tailwindcss 3.4.19
|
|
62
64
|
shared UI: clsx 2.1.1, tailwind-merge 3.4.0
|
|
@@ -120,6 +122,11 @@ Create only selected branches of this tree. A bracketed condition makes the file
|
|
|
120
122
|
apps/desktop/src/renderer/lib/api.ts [desktop + api]
|
|
121
123
|
apps/desktop/src/renderer/lib/auth.ts [desktop + auth]
|
|
122
124
|
apps/desktop/src/renderer/hooks/use-entitlement.ts [desktop + billing]
|
|
125
|
+
apps/desktop/electron-builder.env.example [electron-updater]
|
|
126
|
+
apps/desktop/scripts/publish-updates.mjs [electron-updater]
|
|
127
|
+
apps/desktop-updater-worker/{package.json,wrangler.jsonc} [electron-updater]
|
|
128
|
+
apps/desktop-updater-worker/src/index.js [electron-updater]
|
|
129
|
+
cloudflare/desktop-updates.md [electron-updater]
|
|
123
130
|
apps/extension/{package.json,tsconfig.json,wxt.config.ts,postcss.config.cjs,tailwind.config.cjs,components.json,.env.example,README.md} [extension]
|
|
124
131
|
apps/extension/src/{styles/main.css,lib/utils.ts} [extension]
|
|
125
132
|
apps/extension/src/components/ui/button.tsx [extension]
|
|
@@ -129,7 +136,7 @@ Create only selected branches of this tree. A bracketed condition makes the file
|
|
|
129
136
|
apps/extension/src/hooks/use-entitlement.ts [extension + billing]
|
|
130
137
|
```
|
|
131
138
|
|
|
132
|
-
Do not create `anhedral.json` manually. Its schema-
|
|
139
|
+
Do not create `anhedral.json` manually. Its schema-v5 hashes, modes, ownership classes, template and UI-provider provenance, module resolution, generator version, and toolchain channel form a trust boundary for `add` and `doctor`. Invented records are worse than no manifest. Also omit `ANHEDRAL.md`, whose CLI-management claims would be false for a manual workspace.
|
|
133
140
|
|
|
134
141
|
## 3. Create root configuration
|
|
135
142
|
|
|
@@ -137,13 +144,23 @@ Do not create `anhedral.json` manually. Its schema-v4 hashes, modes, ownership c
|
|
|
137
144
|
|
|
138
145
|
Create a private `package.json` with version `0.1.0`, the selected Node engine, the pnpm version being used, `turbo` as an exact dev dependency, and `workspaces` containing `apps/*` when any app exists and `packages/*` when API or database exists.
|
|
139
146
|
|
|
140
|
-
Always add `build: turbo build` and `typecheck: turbo typecheck`. Set `dev` to
|
|
147
|
+
Always add `build: turbo build` and `typecheck: turbo typecheck`. Set `dev` to
|
|
148
|
+
the primary product loop: run the first selected client in canonical module
|
|
149
|
+
order plus API when present, or API alone for a backend-only project. When the
|
|
150
|
+
project has additional app surfaces, add `dev:all` to run every selected app in
|
|
151
|
+
parallel. Each command uses `turbo dev --parallel` with explicit
|
|
152
|
+
`--filter=./apps/<surface>` arguments. Add only selected scripts:
|
|
141
153
|
|
|
142
154
|
```text
|
|
143
155
|
web: dev:web, verify:web = typecheck + build
|
|
144
156
|
mobile: dev:mobile, verify:mobile = typecheck + build:web
|
|
145
157
|
api: dev:api, verify:api = test:coverage + build
|
|
146
158
|
desktop: dev:desktop, desktop:build, verify:desktop = typecheck + build
|
|
159
|
+
electron-updater: desktop:updates:cloudflare:login,
|
|
160
|
+
desktop:updates:bucket:create, desktop:updates:first-provision,
|
|
161
|
+
desktop:updates:worker:{check,dev,deploy,types},
|
|
162
|
+
desktop:updates:build:{mac,win,linux},
|
|
163
|
+
desktop:updates:publish, verify:desktop-updates
|
|
147
164
|
extension: dev:extension, extension:zip, verify:extension = typecheck + zip
|
|
148
165
|
db: db:generate, db:migrate, db:check, db:studio, verify:db
|
|
149
166
|
storage: r2:login, r2:bucket:create, r2:cors:list, r2:cors:set,
|
|
@@ -189,7 +206,7 @@ Create `turbo.json` using `https://turborepo.dev/schema.json` with:
|
|
|
189
206
|
- `typecheck.dependsOn = ["^build"]`.
|
|
190
207
|
- `dev.cache = false` and `dev.persistent = true`.
|
|
191
208
|
|
|
192
|
-
Ignore `node_modules`, framework/build caches, coverage, release output, every `.env` variant except `.env.example`, and `*.tsbuildinfo`. Put extension output, mobile web export, desktop release output,
|
|
209
|
+
Ignore `node_modules`, framework/build caches, coverage, release output, every `.env` variant except `.env.example`, and `*.tsbuildinfo`. Put extension output, mobile web export, desktop release output, `apps/assets-private-proxy`, and `apps/desktop-updater-worker` in `.vercelignore`.
|
|
193
210
|
|
|
194
211
|
Create the single root `vercel.json` using `https://openapi.vercel.sh/vercel.json`. Add service `api` rooted at `apps/api` and service `web` rooted at `apps/web` as selected. Put the `/api/(.*)` rewrite before the web `/(.*)` catch-all. If billing is selected, add `*/5 * * * *` for `/api/internal/realtime/flush`; if storage is selected, add `0 3 * * *` for `/api/internal/storage/cleanup`. Protect both internal routes with the same high-entropy `CRON_SECRET` bearer token.
|
|
195
212
|
|