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
@@ -5,6 +5,13 @@ from skill-led planning through deterministic generation, source layout,
5
5
  connected capabilities, cloud provisioning, command-driven operations, agent
6
6
  experience, and production verification.
7
7
 
8
+ ![Anhedral master stack diagram](../assets/anhedral-cli-init.svg)
9
+
10
+ The diagram is generated from `scripts/render-master-stack-map.mjs`. Change the
11
+ content or geometry there, then run `pnpm docs:stack-map`; do not hand-edit the
12
+ SVG. The fixed-width map below remains the detailed text and accessibility
13
+ reference.
14
+
8
15
  Read top to bottom. Arrows represent lifecycle order, not runtime network calls.
9
16
  Runtime and provider connections are stated explicitly inside each stage.
10
17
 
@@ -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, 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` |
24
+ | `expo-extension` | web, mobile, api, desktop, extension | database, auth, billing, storage, nativeSubscriptions, electronUpdater | deterministic golden | 150 | `4fcbb6a1bc51387abe3a5f629a6a6f83b4580da668aa00514d24471e50ef652b` |
25
+ | `web-api-minimal` | web, api | database, auth | deterministic golden | 67 | `512f2af0a3ef250d43c24400df730488dee50bc81616dd9f58c4f4e3125aed3a` |
26
+ | `api-only` | api | | deterministic golden | 33 | `3d4c80296467bb735456fc2e2485889b6583e9daac8934e6c3205a0dc47ad04e` |
27
+ | `add-desktop-flow` | api, desktop | database, auth | deterministic golden | 69 | `79e0686d8a0b50f34334b73ffc3c766cbe1a13283a0bc7dfe814c9e7d63cc75c` |
28
28
 
29
29
  ## expo-extension
30
30
 
@@ -88,6 +88,7 @@ expo-extension-sample/
88
88
  │ │ │ │ └── preload.cts
89
89
  │ │ │ └── renderer/
90
90
  │ │ │ ├── components/
91
+ │ │ │ │ ├── item-list.tsx
91
92
  │ │ │ │ └── ui/
92
93
  │ │ │ │ └── button.tsx
93
94
  │ │ │ ├── hooks/
@@ -116,6 +117,7 @@ expo-extension-sample/
116
117
  │ │ ├── postcss.config.cjs
117
118
  │ │ ├── src/
118
119
  │ │ │ ├── components/
120
+ │ │ │ │ ├── item-list.tsx
119
121
  │ │ │ │ └── ui/
120
122
  │ │ │ │ └── button.tsx
121
123
  │ │ │ ├── contexts/
@@ -145,7 +147,8 @@ expo-extension-sample/
145
147
  │ │ ├── app.json
146
148
  │ │ ├── babel.config.js
147
149
  │ │ ├── components/
148
- │ │ │ └── account-controls.tsx
150
+ │ │ │ ├── account-controls.tsx
151
+ │ │ │ └── item-list.tsx
149
152
  │ │ ├── components.json
150
153
  │ │ ├── eas.json
151
154
  │ │ ├── expo-env.d.ts
@@ -170,6 +173,7 @@ expo-extension-sample/
170
173
  │ │ └── page.tsx
171
174
  │ ├── components/
172
175
  │ │ ├── account-actions.tsx
176
+ │ │ ├── item-list.tsx
173
177
  │ │ ├── subscription-status.tsx
174
178
  │ │ └── ui/
175
179
  │ │ ├── button.tsx
@@ -229,6 +233,7 @@ expo-extension-sample/
229
233
  │ └── tsconfig.json
230
234
  ├── pnpm-workspace.yaml
231
235
  ├── scripts/
236
+ │ ├── first-run.mjs
232
237
  │ └── verify-db-migrations.mjs
233
238
  ├── turbo.json
234
239
  └── vercel.json
@@ -277,6 +282,7 @@ web-api-minimal/
277
282
  │ │ └── page.tsx
278
283
  │ ├── components/
279
284
  │ │ ├── account-actions.tsx
285
+ │ │ ├── item-list.tsx
280
286
  │ │ └── ui/
281
287
  │ │ ├── button.tsx
282
288
  │ │ └── card.tsx
@@ -325,6 +331,7 @@ web-api-minimal/
325
331
  │ └── tsconfig.json
326
332
  ├── pnpm-workspace.yaml
327
333
  ├── scripts/
334
+ │ ├── first-run.mjs
328
335
  │ └── verify-db-migrations.mjs
329
336
  ├── turbo.json
330
337
  └── vercel.json
@@ -377,6 +384,8 @@ api-only/
377
384
  │ │ └── index.ts
378
385
  │ └── tsconfig.json
379
386
  ├── pnpm-workspace.yaml
387
+ ├── scripts/
388
+ │ └── first-run.mjs
380
389
  ├── turbo.json
381
390
  └── vercel.json
382
391
  ```
@@ -431,6 +440,7 @@ add-desktop-flow/
431
440
  │ │ │ └── preload.cts
432
441
  │ │ └── renderer/
433
442
  │ │ ├── components/
443
+ │ │ │ ├── item-list.tsx
434
444
  │ │ │ └── ui/
435
445
  │ │ │ └── button.tsx
436
446
  │ │ ├── lib/
@@ -476,6 +486,7 @@ add-desktop-flow/
476
486
  │ └── tsconfig.json
477
487
  ├── pnpm-workspace.yaml
478
488
  ├── scripts/
489
+ │ ├── first-run.mjs
479
490
  │ └── verify-db-migrations.mjs
480
491
  ├── turbo.json
481
492
  └── vercel.json
@@ -106,11 +106,13 @@ Create only selected branches of this tree. A bracketed condition makes the file
106
106
  apps/web/components/ui/{button.tsx,card.tsx} [web]
107
107
  apps/web/lib/utils.ts [web]
108
108
  apps/web/{lib/api.ts,hooks/use-api-client.ts} [web + api]
109
+ apps/web/components/item-list.tsx [web + api + db]
109
110
  apps/web/components/account-actions.tsx [web + auth]
110
111
  apps/web/{hooks/use-entitlement.ts,components/subscription-status.tsx} [web + billing]
111
112
  apps/mobile/{package.json,app.json,tsconfig.json,expo-env.d.ts,eas.json,.env.example,.gitignore} [mobile]
112
113
  apps/mobile/app/{_layout.tsx,index.tsx} [mobile]
113
114
  apps/mobile/{lib/api.ts,hooks/use-api-client.ts} [mobile + api]
115
+ apps/mobile/components/item-list.tsx [mobile + api + db]
114
116
  apps/mobile/components/account-controls.tsx [mobile + auth]
115
117
  apps/mobile/hooks/use-entitlement.ts [mobile + billing]
116
118
  apps/mobile/lib/subscriptions.ts [native-subscriptions]
@@ -120,6 +122,7 @@ Create only selected branches of this tree. A bracketed condition makes the file
120
122
  apps/desktop/src/renderer/{main.tsx,styles.css,lib/utils.ts} [desktop]
121
123
  apps/desktop/src/renderer/components/ui/button.tsx [desktop]
122
124
  apps/desktop/src/renderer/lib/api.ts [desktop + api]
125
+ apps/desktop/src/renderer/components/item-list.tsx [desktop + api + db]
123
126
  apps/desktop/src/renderer/lib/auth.ts [desktop + auth]
124
127
  apps/desktop/src/renderer/hooks/use-entitlement.ts [desktop + billing]
125
128
  apps/desktop/electron-builder.env.example [electron-updater]
@@ -133,6 +136,7 @@ Create only selected branches of this tree. A bracketed condition makes the file
133
136
  apps/extension/src/entrypoints/{background.ts,sidepanel/index.html,sidepanel/main.tsx,sidepanel/app.tsx} [extension]
134
137
  apps/extension/src/contexts/auth-context.tsx [extension + auth]
135
138
  apps/extension/src/lib/api.ts [extension + api]
139
+ apps/extension/src/components/item-list.tsx [extension + api + db]
136
140
  apps/extension/src/hooks/use-entitlement.ts [extension + billing]
137
141
  ```
138
142
 
@@ -148,7 +152,7 @@ Always add `build: turbo build` and `typecheck: turbo typecheck`. Set `dev` to
148
152
  the primary product loop: run the first selected client in canonical module
149
153
  order plus API when present, or API alone for a backend-only project. When the
150
154
  project has additional app surfaces, add `dev:all` to run every selected app in
151
- parallel. Each command uses `turbo dev --parallel` with explicit
155
+ parallel. Each command uses `turbo run dev` with explicit
152
156
  `--filter=./apps/<surface>` arguments. Add only selected scripts:
153
157
 
154
158
  ```text
@@ -203,7 +207,7 @@ Pin current security overrides for `@vitejs/plugin-react`, `postcss`, vulnerable
203
207
  Create `turbo.json` using `https://turborepo.dev/schema.json` with:
204
208
 
205
209
  - `build.dependsOn = ["^build"]` and outputs `.next/**`, `!.next/cache/**`, `.output/**`, `dist/**`.
206
- - `typecheck.dependsOn = ["^build"]`.
210
+ - `typecheck.dependsOn = ["^typecheck"]`.
207
211
  - `dev.cache = false` and `dev.persistent = true`.
208
212
 
209
213
  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`.
@@ -212,6 +216,12 @@ Create the single root `vercel.json` using `https://openapi.vercel.sh/vercel.jso
212
216
 
213
217
  Create `.github/workflows/anhedral-ci.yml` with read-only contents permission, concurrency cancellation, pinned action commit SHAs, pnpm setup, Node `22.13.0` for mobile or `20.19.0` otherwise, and frozen installation. Run `pnpm typecheck`, API coverage tests when API exists, and `pnpm build`. For database workspaces also run `pnpm verify:db`, run `pnpm db:generate`, fail on any migration diff, and fail on untracked migration artifacts.
214
218
 
219
+ Create `scripts/first-run.mjs` and root `first-run`/`ready` scripts. `first-run`
220
+ must copy only missing package-local environment files and never overwrite
221
+ existing values. `ready` must identify missing files and required blank or
222
+ placeholder variables without printing values, return nonzero when blocked,
223
+ and treat explicitly documented optional variables as optional.
224
+
215
225
  Create `README.md` containing selected modules and first-run commands. Create `PRODUCTION.md` containing provider and deployment requirements from sections 8 and 9. These two files become user-owned; do not rewrite them during later manual module additions.
216
226
 
217
227
  ## 4. Create shared packages
@@ -235,6 +245,11 @@ Create `@shared/api-client` when API and at least one client surface are selecte
235
245
  - JSON parsing and Zod response validation;
236
246
  - typed methods for health/readiness and only selected auth, billing, and storage routes.
237
247
 
248
+ When database is selected, also create user-owned item request/response
249
+ contracts and `listItems`/`createItem` methods. Render that same feature with
250
+ idiomatic, accessible UI in every selected client so the first end-to-end proof
251
+ is cross-platform rather than web-only.
252
+
238
253
  Do not make server-only provider SDKs dependencies of clients.
239
254
 
240
255
  ### Realtime client
@@ -341,10 +356,12 @@ Run from the root:
341
356
 
342
357
  ```sh
343
358
  pnpm install
344
- pnpm typecheck
359
+ pnpm first-run
360
+ pnpm ready
345
361
  ```
346
362
 
347
- For a database workspace, copy its environment, generate and review the initial migration, and add it to Git before the gate:
363
+ For a database workspace, generate and review the initial migration, and add it
364
+ to Git before the gate:
348
365
 
349
366
  ```sh
350
367
  pnpm db:generate
@@ -356,6 +373,7 @@ pnpm db:migrate
356
373
  Then run every selected package verification, root verification, and build:
357
374
 
358
375
  ```sh
376
+ pnpm typecheck
359
377
  pnpm verify
360
378
  pnpm build
361
379
  ```