anhedral 0.13.0 → 0.16.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.
Files changed (360) hide show
  1. package/README.md +23 -229
  2. package/assets/patches/audit-deps.mjs +12 -2
  3. package/assets/stack/ai-schema.ts.txt +5 -0
  4. package/assets/stack/ai.ts.txt +30 -0
  5. package/assets/stack/api-index.ts.txt +15 -0
  6. package/assets/stack/auth-features.ts.txt +4 -0
  7. package/assets/stack/auth-journal.json.txt +13 -0
  8. package/assets/stack/auth-migration.sql.txt +53 -0
  9. package/assets/stack/auth-routes.ts.txt +11 -0
  10. package/assets/stack/auth-schema.ts.txt +64 -0
  11. package/assets/stack/auth-snapshot.json.txt +346 -0
  12. package/assets/stack/auth.ts.txt +32 -0
  13. package/assets/stack/billing-mode.ts.txt +8 -0
  14. package/assets/stack/billing-schema.ts.txt +11 -0
  15. package/assets/stack/desktop.rs.txt +21 -0
  16. package/assets/stack/entitlement-guard.ts.txt +32 -0
  17. package/assets/stack/entitlements.ts.txt +8 -0
  18. package/assets/stack/events-schema.ts.txt +12 -0
  19. package/assets/stack/events.ts.txt +59 -0
  20. package/assets/stack/mobile-auth.ts.txt +25 -0
  21. package/assets/stack/mobile-billing.tsx.txt +63 -0
  22. package/assets/stack/mobile-session.tsx.txt +83 -0
  23. package/assets/stack/native-button.tsx.txt +108 -0
  24. package/assets/stack/native-global.css.txt +4 -0
  25. package/assets/stack/native-lib-utils.ts.txt +5 -0
  26. package/assets/stack/native-metro.config.js.txt +6 -0
  27. package/assets/stack/native-nativewind-env.d.ts.txt +1 -0
  28. package/assets/stack/native-tailwind.config.js.txt +73 -0
  29. package/assets/stack/native-text.tsx.txt +89 -0
  30. package/assets/stack/purchases.ts.txt +65 -0
  31. package/assets/stack/revenuecat.ts.txt +88 -0
  32. package/assets/stack/rtc-schema.ts.txt +10 -0
  33. package/assets/stack/rtc.ts.txt +122 -0
  34. package/assets/stack/security.ts.txt +31 -0
  35. package/assets/stack/storage.ts.txt +36 -0
  36. package/assets/stack/stripe.ts.txt +126 -0
  37. package/assets/stack/web-sign-in.tsx.txt +51 -0
  38. package/assets/ui/LICENSE.react-native-reusables +21 -0
  39. package/assets/ui/LICENSE.shadcn +21 -0
  40. package/assets/ui/UPSTREAM.json +39 -0
  41. package/assets/ui/catalog.json +891 -0
  42. package/assets/ui/extensions/registry.json +6 -0
  43. package/assets/ui/native/_controls.tsx +521 -0
  44. package/assets/ui/native/_core.tsx +118 -0
  45. package/assets/ui/native/_data.tsx +200 -0
  46. package/assets/ui/native/_display.tsx +453 -0
  47. package/assets/ui/native/_feedback.tsx +242 -0
  48. package/assets/ui/native/_legacy-dialog.tsx +38 -0
  49. package/assets/ui/native/_motion.tsx +520 -0
  50. package/assets/ui/native/_overlay.tsx +402 -0
  51. package/assets/ui/native/_selection.tsx +366 -0
  52. package/assets/ui/native/accordion.tsx +1 -0
  53. package/assets/ui/native/alert-dialog.tsx +11 -0
  54. package/assets/ui/native/alert.tsx +1 -0
  55. package/assets/ui/native/aspect-ratio.tsx +1 -0
  56. package/assets/ui/native/attachment.tsx +8 -0
  57. package/assets/ui/native/avatar.tsx +8 -0
  58. package/assets/ui/native/badge.tsx +1 -0
  59. package/assets/ui/native/breadcrumb.tsx +9 -0
  60. package/assets/ui/native/bubble.tsx +1 -0
  61. package/assets/ui/native/button-group.tsx +1 -0
  62. package/assets/ui/native/button.tsx +86 -0
  63. package/assets/ui/native/calendar.tsx +170 -0
  64. package/assets/ui/native/card.tsx +44 -0
  65. package/assets/ui/native/carousel.tsx +1 -0
  66. package/assets/ui/native/chart.tsx +193 -0
  67. package/assets/ui/native/checkbox.tsx +1 -0
  68. package/assets/ui/native/code-block.tsx +137 -0
  69. package/assets/ui/native/collapsible.tsx +1 -0
  70. package/assets/ui/native/combobox.tsx +1 -0
  71. package/assets/ui/native/command.tsx +11 -0
  72. package/assets/ui/native/context-menu.tsx +16 -0
  73. package/assets/ui/native/data-table.tsx +1 -0
  74. package/assets/ui/native/date-picker.tsx +43 -0
  75. package/assets/ui/native/dialog.tsx +15 -0
  76. package/assets/ui/native/direction.tsx +1 -0
  77. package/assets/ui/native/drawer.tsx +10 -0
  78. package/assets/ui/native/dropdown-menu.tsx +16 -0
  79. package/assets/ui/native/empty.tsx +8 -0
  80. package/assets/ui/native/field.tsx +13 -0
  81. package/assets/ui/native/hover-card.tsx +1 -0
  82. package/assets/ui/native/input-group.tsx +8 -0
  83. package/assets/ui/native/input-otp.tsx +1 -0
  84. package/assets/ui/native/input.tsx +28 -0
  85. package/assets/ui/native/item.tsx +12 -0
  86. package/assets/ui/native/kbd.tsx +1 -0
  87. package/assets/ui/native/label.tsx +4 -0
  88. package/assets/ui/native/layout.tsx +26 -0
  89. package/assets/ui/native/marker.tsx +1 -0
  90. package/assets/ui/native/menubar.tsx +17 -0
  91. package/assets/ui/native/message-scroller.tsx +6 -0
  92. package/assets/ui/native/message.tsx +10 -0
  93. package/assets/ui/native/native-select.tsx +1 -0
  94. package/assets/ui/native/navigation-menu.tsx +10 -0
  95. package/assets/ui/native/pagination.tsx +9 -0
  96. package/assets/ui/native/popover.tsx +1 -0
  97. package/assets/ui/native/progress.tsx +1 -0
  98. package/assets/ui/native/questionnaire.tsx +130 -0
  99. package/assets/ui/native/radio-group.tsx +1 -0
  100. package/assets/ui/native/registry.json +1103 -0
  101. package/assets/ui/native/resizable.tsx +1 -0
  102. package/assets/ui/native/scroll-area.tsx +1 -0
  103. package/assets/ui/native/select.tsx +11 -0
  104. package/assets/ui/native/separator.tsx +1 -0
  105. package/assets/ui/native/sheet.tsx +10 -0
  106. package/assets/ui/native/sidebar.tsx +22 -0
  107. package/assets/ui/native/skeleton.tsx +1 -0
  108. package/assets/ui/native/slider.tsx +1 -0
  109. package/assets/ui/native/spinner.tsx +1 -0
  110. package/assets/ui/native/switch.tsx +1 -0
  111. package/assets/ui/native/table.tsx +10 -0
  112. package/assets/ui/native/tabs.tsx +1 -0
  113. package/assets/ui/native/text.tsx +20 -0
  114. package/assets/ui/native/textarea.tsx +1 -0
  115. package/assets/ui/native/theme-switcher.tsx +22 -0
  116. package/assets/ui/native/toast.tsx +11 -0
  117. package/assets/ui/native/toggle-group.tsx +1 -0
  118. package/assets/ui/native/toggle.tsx +1 -0
  119. package/assets/ui/native/tooltip.tsx +1 -0
  120. package/assets/ui/native/trace.tsx +20 -0
  121. package/assets/ui/native/typography.tsx +15 -0
  122. package/assets/ui/theme-storage.ts +25 -0
  123. package/assets/ui/theme.tsx +66 -0
  124. package/assets/ui/web/button.tsx +59 -0
  125. package/assets/ui/web/input.tsx +21 -0
  126. package/assets/ui/web/label.tsx +19 -0
  127. package/dist/bin.js +7 -12
  128. package/dist/capabilities.d.ts +4 -33
  129. package/dist/capabilities.js +2 -84
  130. package/dist/capability-catalog.d.ts +83 -0
  131. package/dist/capability-catalog.js +121 -0
  132. package/dist/capability-command.d.ts +3 -0
  133. package/dist/capability-command.js +188 -0
  134. package/dist/capability-editor.d.ts +17 -0
  135. package/dist/capability-editor.js +97 -0
  136. package/dist/capability-recipes.d.ts +4 -0
  137. package/dist/capability-recipes.js +520 -0
  138. package/dist/capability-references.d.ts +4 -0
  139. package/dist/capability-references.js +7 -0
  140. package/dist/cli-commands.d.ts +1 -2
  141. package/dist/cli-commands.js +10 -104
  142. package/dist/cli-output.d.ts +1 -2
  143. package/dist/cli-output.js +6 -251
  144. package/dist/command-schema.js +40 -374
  145. package/dist/dependencies.d.ts +34 -62
  146. package/dist/dependencies.js +112 -199
  147. package/dist/index.d.ts +1 -45
  148. package/dist/index.js +1 -30
  149. package/dist/platforms/mobile.js +29 -139
  150. package/dist/platforms/web.d.ts +3 -0
  151. package/dist/platforms/web.js +251 -0
  152. package/dist/project-config.d.ts +2 -13
  153. package/dist/project-config.js +10 -83
  154. package/dist/registry/context.js +0 -1
  155. package/dist/registry/options.js +6 -40
  156. package/dist/registry/resolve.d.ts +3 -4
  157. package/dist/registry/resolve.js +18 -108
  158. package/dist/registry/types.d.ts +1 -7
  159. package/dist/registry/usage.js +3 -9
  160. package/dist/runtime-policy.d.ts +0 -2
  161. package/dist/runtime-policy.js +0 -16
  162. package/dist/scaffold/backend.d.ts +0 -4
  163. package/dist/scaffold/backend.js +1 -189
  164. package/dist/scaffold/bootstrap.d.ts +2 -3
  165. package/dist/scaffold/bootstrap.js +37 -43
  166. package/dist/scaffold/compose.js +2 -14
  167. package/dist/scaffold/database.d.ts +1 -1
  168. package/dist/scaffold/database.js +19 -126
  169. package/dist/scaffold/documentation.d.ts +0 -1
  170. package/dist/scaffold/documentation.js +82 -84
  171. package/dist/scaffold/expo-runtime.d.ts +2 -2
  172. package/dist/scaffold/expo-runtime.js +9 -101
  173. package/dist/scaffold/native-ui.d.ts +2 -0
  174. package/dist/scaffold/native-ui.js +74 -0
  175. package/dist/scaffold/stack-documentation.d.ts +0 -1
  176. package/dist/scaffold/stack-documentation.js +3 -49
  177. package/dist/scaffold/storage.d.ts +2 -0
  178. package/dist/scaffold/storage.js +21 -0
  179. package/dist/scaffold/styling.d.ts +1 -1
  180. package/dist/scaffold/styling.js +20 -28
  181. package/dist/scaffold/workspace.js +63 -199
  182. package/dist/stack-registry.d.ts +2 -58
  183. package/dist/stack-registry.js +22 -446
  184. package/dist/standard.js +7 -24
  185. package/dist/ui-catalog.d.ts +26 -0
  186. package/dist/ui-catalog.js +31 -0
  187. package/dist/ui-command.d.ts +3 -0
  188. package/dist/ui-command.js +219 -0
  189. package/dist/ui-project.d.ts +22 -0
  190. package/dist/ui-project.js +110 -0
  191. package/dist/version.d.ts +1 -1
  192. package/dist/version.js +1 -1
  193. package/docs/anhedral-stack.md +4 -119
  194. package/docs/capabilities.md +110 -0
  195. package/docs/native-ui.md +102 -0
  196. package/docs/software-factory.md +16 -577
  197. package/docs/stack-standard.md +11 -307
  198. package/docs/ui.md +33 -0
  199. package/docs/verification.md +511 -0
  200. package/package.json +26 -27
  201. package/dist/access.d.ts +0 -10
  202. package/dist/access.js +0 -93
  203. package/dist/auth-schema-snapshot.d.ts +0 -346
  204. package/dist/auth-schema-snapshot.js +0 -347
  205. package/dist/auth-schema.d.ts +0 -1
  206. package/dist/auth-schema.js +0 -57
  207. package/dist/capability-contract.d.ts +0 -47
  208. package/dist/capability-contract.js +0 -168
  209. package/dist/catalog-model.d.ts +0 -24
  210. package/dist/catalog-model.js +0 -1
  211. package/dist/catalog-registration.d.ts +0 -16
  212. package/dist/catalog-registration.js +0 -22
  213. package/dist/catalog-snapshot.d.ts +0 -5
  214. package/dist/catalog-snapshot.js +0 -97
  215. package/dist/cli-delivery.d.ts +0 -3
  216. package/dist/cli-delivery.js +0 -172
  217. package/dist/cloudflare.d.ts +0 -25
  218. package/dist/cloudflare.js +0 -226
  219. package/dist/delivery-evidence.d.ts +0 -62
  220. package/dist/delivery-evidence.js +0 -186
  221. package/dist/delivery.d.ts +0 -88
  222. package/dist/delivery.js +0 -570
  223. package/dist/inspector-model.d.ts +0 -123
  224. package/dist/inspector-model.js +0 -1
  225. package/dist/integration-service-readers.d.ts +0 -13
  226. package/dist/integration-service-readers.js +0 -173
  227. package/dist/lifecycle-model.d.ts +0 -15
  228. package/dist/lifecycle-model.js +0 -20
  229. package/dist/lifecycle.d.ts +0 -11
  230. package/dist/lifecycle.js +0 -91
  231. package/dist/management.d.ts +0 -3
  232. package/dist/management.js +0 -47
  233. package/dist/mobile-delivery.d.ts +0 -77
  234. package/dist/mobile-delivery.js +0 -366
  235. package/dist/neon-service-data.d.ts +0 -8
  236. package/dist/neon-service-data.js +0 -117
  237. package/dist/platforms/desktop.d.ts +0 -2
  238. package/dist/platforms/desktop.js +0 -415
  239. package/dist/platforms/extension.d.ts +0 -2
  240. package/dist/platforms/extension.js +0 -328
  241. package/dist/project-catalog.d.ts +0 -41
  242. package/dist/project-catalog.js +0 -288
  243. package/dist/project-inspector.d.ts +0 -4
  244. package/dist/project-inspector.js +0 -702
  245. package/dist/project-lifecycle.d.ts +0 -25
  246. package/dist/project-lifecycle.js +0 -57
  247. package/dist/project-state.d.ts +0 -49
  248. package/dist/project-state.js +0 -563
  249. package/dist/provider-auth.d.ts +0 -41
  250. package/dist/provider-auth.js +0 -215
  251. package/dist/provider-readiness.d.ts +0 -30
  252. package/dist/provider-readiness.js +0 -104
  253. package/dist/providers/adapters.d.ts +0 -17
  254. package/dist/providers/adapters.js +0 -278
  255. package/dist/providers/api.d.ts +0 -29
  256. package/dist/providers/api.js +0 -253
  257. package/dist/providers/config.d.ts +0 -15
  258. package/dist/providers/config.js +0 -182
  259. package/dist/providers/definitions.d.ts +0 -318
  260. package/dist/providers/definitions.js +0 -127
  261. package/dist/providers/provision.d.ts +0 -24
  262. package/dist/providers/provision.js +0 -76
  263. package/dist/providers/receipts.d.ts +0 -20
  264. package/dist/providers/receipts.js +0 -66
  265. package/dist/providers/recovery-verification.d.ts +0 -7
  266. package/dist/providers/recovery-verification.js +0 -112
  267. package/dist/providers/recovery.d.ts +0 -30
  268. package/dist/providers/recovery.js +0 -34
  269. package/dist/providers/runtime.d.ts +0 -10
  270. package/dist/providers/runtime.js +0 -265
  271. package/dist/providers/schema.d.ts +0 -28
  272. package/dist/providers/schema.js +0 -49
  273. package/dist/providers/state.d.ts +0 -55
  274. package/dist/providers/state.js +0 -289
  275. package/dist/provision.d.ts +0 -55
  276. package/dist/provision.js +0 -284
  277. package/dist/r2-service-data.d.ts +0 -2
  278. package/dist/r2-service-data.js +0 -136
  279. package/dist/readiness.d.ts +0 -23
  280. package/dist/readiness.js +0 -122
  281. package/dist/registry/add.d.ts +0 -24
  282. package/dist/registry/add.js +0 -270
  283. package/dist/registry/bootstrap.d.ts +0 -2
  284. package/dist/registry/bootstrap.js +0 -14
  285. package/dist/registry/commands.d.ts +0 -3
  286. package/dist/registry/commands.js +0 -85
  287. package/dist/registry/presets.d.ts +0 -4
  288. package/dist/registry/presets.js +0 -41
  289. package/dist/registry/preview.d.ts +0 -11
  290. package/dist/registry/preview.js +0 -91
  291. package/dist/registry/receipt.d.ts +0 -3
  292. package/dist/registry/receipt.js +0 -68
  293. package/dist/repository.d.ts +0 -24
  294. package/dist/repository.js +0 -96
  295. package/dist/scaffold/auth.d.ts +0 -3
  296. package/dist/scaffold/auth.js +0 -151
  297. package/dist/scaffold/billing-config.d.ts +0 -1
  298. package/dist/scaffold/billing-config.js +0 -73
  299. package/dist/scaffold/billing-contracts.d.ts +0 -2
  300. package/dist/scaffold/billing-contracts.js +0 -48
  301. package/dist/scaffold/billing-providers.d.ts +0 -1
  302. package/dist/scaffold/billing-providers.js +0 -249
  303. package/dist/scaffold/billing-schema.d.ts +0 -1
  304. package/dist/scaffold/billing-schema.js +0 -34
  305. package/dist/scaffold/billing-security.d.ts +0 -1
  306. package/dist/scaffold/billing-security.js +0 -46
  307. package/dist/scaffold/billing-server.d.ts +0 -1
  308. package/dist/scaffold/billing-server.js +0 -139
  309. package/dist/scaffold/billing-store.d.ts +0 -1
  310. package/dist/scaffold/billing-store.js +0 -72
  311. package/dist/scaffold/billing.d.ts +0 -2
  312. package/dist/scaffold/billing.js +0 -216
  313. package/dist/scaffold/cloudflare-services.d.ts +0 -8
  314. package/dist/scaffold/cloudflare-services.js +0 -198
  315. package/dist/scaffold/expo-auth.d.ts +0 -3
  316. package/dist/scaffold/expo-auth.js +0 -192
  317. package/dist/scaffold/expo-billing.d.ts +0 -3
  318. package/dist/scaffold/expo-billing.js +0 -292
  319. package/dist/scaffold/integrations.d.ts +0 -4
  320. package/dist/scaffold/integrations.js +0 -12
  321. package/dist/scaffold/lint.d.ts +0 -4
  322. package/dist/scaffold/lint.js +0 -56
  323. package/dist/scaffold/neon-realtime.d.ts +0 -2
  324. package/dist/scaffold/neon-realtime.js +0 -97
  325. package/dist/scaffold/services.d.ts +0 -5
  326. package/dist/scaffold/services.js +0 -108
  327. package/dist/scaffold/stream.d.ts +0 -2
  328. package/dist/scaffold/stream.js +0 -114
  329. package/dist/scaffold/void.d.ts +0 -4
  330. package/dist/scaffold/void.js +0 -264
  331. package/dist/scaffold/web.d.ts +0 -2
  332. package/dist/scaffold/web.js +0 -130
  333. package/dist/service-deletion.d.ts +0 -29
  334. package/dist/service-deletion.js +0 -195
  335. package/dist/service-descriptor.d.ts +0 -10
  336. package/dist/service-descriptor.js +0 -78
  337. package/dist/service-model.d.ts +0 -49
  338. package/dist/service-model.js +0 -8
  339. package/dist/service-operations.d.ts +0 -29
  340. package/dist/service-operations.js +0 -78
  341. package/dist/service-readers.d.ts +0 -8
  342. package/dist/service-readers.js +0 -247
  343. package/dist/services-command.d.ts +0 -39
  344. package/dist/services-command.js +0 -102
  345. package/dist/ship.d.ts +0 -348
  346. package/dist/ship.js +0 -239
  347. package/dist/vercel-project.d.ts +0 -101
  348. package/dist/vercel-project.js +0 -305
  349. package/dist/vercel.d.ts +0 -67
  350. package/dist/vercel.js +0 -581
  351. package/dist/vinext.d.ts +0 -2
  352. package/dist/vinext.js +0 -86
  353. package/dist/void-execution.d.ts +0 -10
  354. package/dist/void-execution.js +0 -94
  355. package/dist/void-migrations.d.ts +0 -6
  356. package/dist/void-migrations.js +0 -110
  357. package/dist/void-state.d.ts +0 -16
  358. package/dist/void-state.js +0 -65
  359. package/dist/void.d.ts +0 -3
  360. package/dist/void.js +0 -5
@@ -1,60 +1,26 @@
1
- import { applyPreset } from './presets.js';
2
1
  import { resolveStandardProducts } from './resolve.js';
3
2
  import path from 'node:path';
4
3
  import { packageNameFromText } from '../render.js';
5
- import { STANDARD_PRODUCTS } from '../stack-registry.js';
6
4
  function readGitFlag(token, previous) {
7
5
  const value = token === '--git';
8
6
  if (previous !== undefined && value !== previous)
9
7
  throw new Error('Conflicting Git options.');
10
8
  return value;
11
9
  }
12
- function readHostingFlag(value, previous, specified) {
13
- if (value !== 'cloudflare' && value !== 'vercel')
14
- throw new Error('hosting must be cloudflare or vercel.');
15
- if (specified && previous !== value)
16
- throw new Error('Conflicting hosting options.');
17
- return value;
18
- }
19
10
  function parseStandardFlags(remaining) {
20
11
  const products = new Set();
21
- let hosting = 'cloudflare';
22
- let hostingSpecified = false;
12
+ const hosting = 'cloudflare';
23
13
  let gitSpecified;
24
- let preset;
25
- for (let index = 0; index < remaining.length; index++) {
26
- const token = remaining[index];
14
+ for (const token of remaining) {
27
15
  if (['--skip-install', '--dry-run', '--json', '--verbose'].includes(token))
28
16
  continue;
29
17
  if (token === '--git' || token === '--no-git') {
30
18
  gitSpecified = readGitFlag(token, gitSpecified);
31
19
  continue;
32
20
  }
33
- if (token === '--preset' || token.startsWith('--preset=')) {
34
- if (preset !== undefined)
35
- throw new Error('Specify --preset once.');
36
- preset = token === '--preset' ? remaining[++index] : token.slice('--preset='.length);
37
- if (!preset || preset.startsWith('-'))
38
- throw new Error('Supply a value for --preset.');
39
- continue;
40
- }
41
- if (token === '--hosting' || token.startsWith('--hosting=')) {
42
- const value = token === '--hosting' ? remaining[++index] : token.slice('--hosting='.length);
43
- hosting = readHostingFlag(value, hosting, hostingSpecified);
44
- hostingSpecified = true;
45
- continue;
46
- }
47
- const value = token.replace(/^--/, '');
48
- if (!STANDARD_PRODUCTS.includes(value)) {
49
- throw new Error(`Unknown standard product: ${token}. Select only required products.`);
50
- }
51
- products.add(value);
21
+ throw new Error(`Unknown init option: ${token}. Run anhedral init --help.`);
52
22
  }
53
- if (preset)
54
- applyPreset(preset, products);
55
- if (!hostingSpecified && products.has('next'))
56
- hosting = 'vercel';
57
- return { products, hosting, hostingSpecified, gitSpecified };
23
+ return { products, hosting, gitSpecified };
58
24
  }
59
25
  export function parseStandardOptions(args) {
60
26
  const remaining = [...args];
@@ -63,8 +29,8 @@ export function parseStandardOptions(args) {
63
29
  if (!directory || directory.startsWith('-'))
64
30
  throw new Error('Specify a valid initialization directory.');
65
31
  const root = path.resolve(directory);
66
- const { products, hosting, hostingSpecified, gitSpecified } = parseStandardFlags(remaining);
67
- resolveStandardProducts(products, hosting, hostingSpecified);
32
+ const { products, hosting, gitSpecified } = parseStandardFlags(remaining);
33
+ resolveStandardProducts(products, hosting);
68
34
  return {
69
35
  root,
70
36
  name: packageNameFromText(path.basename(root)),
@@ -1,8 +1,7 @@
1
1
  import type { Hosting, StandardOptions, StandardProduct, StackRegistryItem } from './types.js';
2
- /** Explicit billing selection needs an authenticated server and durable state. */
3
- export declare function resolveBillingProducts(selected: Set<StandardProduct>): void;
4
- /** Apply default selections once. All callers then use the same strict graph resolver. */
5
- export declare function resolveStandardProducts(selected: Set<StandardProduct>, hosting: Hosting, hostingSpecified: boolean, initializing?: boolean): void;
2
+ export declare const CORE_PRODUCTS: readonly StandardProduct[];
3
+ /** Every initialization uses the same foundation. */
4
+ export declare function resolveStandardProducts(selected: Set<StandardProduct>, hosting: Hosting): void;
6
5
  export interface ResolvedStackRegistry {
7
6
  schemaVersion: number;
8
7
  name: string;
@@ -1,128 +1,38 @@
1
1
  import { dependencyOrder } from '../dependency-order.js';
2
2
  import { STANDARD_PRODUCTS, STACK_REGISTRY, getStackDefinition, getStackItem, } from '../stack-registry.js';
3
3
  import { createResolutionContext } from './context.js';
4
- function hasServer(context) {
5
- return context.has('hono') || context.has('vinext') || context.has('next');
6
- }
7
- function needsWorker(name, context) {
8
- const definition = getStackDefinition(name);
9
- return (definition.runtime === 'worker' ||
10
- (definition.runtime === 'optional-worker' && hasServer(context)));
11
- }
12
- /** Explicit billing selection needs an authenticated server and durable state. */
13
- export function resolveBillingProducts(selected) {
14
- selected.add('hono');
15
- if (!selected.has('clerk'))
16
- selected.add('better-auth');
17
- if (!selected.has('neon') && !selected.has('d1'))
18
- selected.add(selected.has('neon-realtime') ? 'neon' : 'd1');
19
- }
20
- function validateProducts(selected, hosting) {
21
- if (!['cloudflare', 'vercel'].includes(hosting))
22
- throw new Error('hosting must be cloudflare or vercel.');
23
- for (const id of selected) {
24
- if (!STANDARD_PRODUCTS.includes(id))
25
- throw new Error(`Unknown stack product: ${id}.`);
26
- const { conflicts = [], requiresAny = [], requiresAll = [] } = getStackDefinition(id).selection;
27
- const conflict = conflicts.find((other) => selected.has(other));
28
- if (conflict)
29
- throw new Error(`Choose one of ${id} / ${conflict}.`);
30
- if (requiresAny.length && !requiresAny.some((other) => selected.has(other)))
31
- throw new Error(`${id} requires an explicitly selected ${requiresAny.join(' or ')} capability.`);
32
- const missing = requiresAll.filter((other) => !selected.has(other));
33
- if (missing.length)
34
- throw new Error(`${id} requires ${missing.join(', ')}; select it explicitly.`);
35
- }
36
- if (selected.has('vinext') && hosting !== 'cloudflare')
37
- throw new Error('Vinext requires Cloudflare hosting; select --next for Vercel.');
38
- }
39
- /** Apply default selections once. All callers then use the same strict graph resolver. */
40
- export function resolveStandardProducts(selected, hosting, hostingSpecified, initializing = true) {
4
+ export const CORE_PRODUCTS = ['next', 'styling'];
5
+ /** Every initialization uses the same foundation. */
6
+ export function resolveStandardProducts(selected, hosting) {
7
+ if (hosting !== 'cloudflare')
8
+ throw new Error('Anhedral applications use Cloudflare Workers.');
41
9
  for (const id of selected)
42
10
  getStackDefinition(id);
43
- const applications = [...selected].filter((id) => getStackDefinition(id).type === 'application');
44
- if (!applications.length)
45
- selected.add(hosting === 'vercel' ? 'next' : 'expo');
46
- // Resolve to a fixed point: an addition may introduce another dependency.
47
- // Readiness/add callers preserve an existing web-owned backend; new profiles
48
- // use Hono whenever privileged server behavior is selected.
49
- let changed = true;
50
- while (changed) {
51
- const before = selected.size;
52
- if (selected.has('stripe') || selected.has('revenuecat'))
53
- resolveBillingProducts(selected);
54
- const defaults = [...selected].sort((left, right) => (getStackDefinition(left).selection.requiresAny?.length ?? 0) -
55
- (getStackDefinition(right).selection.requiresAny?.length ?? 0) ||
56
- left.localeCompare(right));
57
- for (const id of defaults) {
58
- const definition = getStackDefinition(id);
59
- const alternatives = definition.selection.requiresAny ?? [];
60
- if (definition.fallbackDependency &&
61
- !alternatives.some((other) => selected.has(other)))
62
- selected.add(definition.fallbackDependency);
63
- for (const dependency of definition.selection.requiresAll ?? [])
64
- selected.add(dependency);
65
- const serverCapability = Boolean(definition.runtime);
66
- if (serverCapability &&
67
- (initializing || !hasServer(createResolutionContext({ products: [...selected], hosting }))))
68
- selected.add('hono');
69
- }
70
- changed = selected.size !== before;
71
- }
72
- const context = createResolutionContext({ products: [...selected], hosting });
73
- if (context.has('next') &&
74
- hosting === 'vercel' &&
75
- [...selected].some((id) => needsWorker(id, context)))
76
- selected.add('hono');
77
- if (selected.has('expo') && hosting === 'vercel' && !selected.has('next'))
78
- throw new Error('Expo web uses Cloudflare hosting; select --next for a Vercel web application.');
79
- if (hostingSpecified && !selected.has('next') && !selected.has('vinext') && !selected.has('expo'))
80
- throw new Error('--hosting applies to the web application.');
11
+ for (const product of CORE_PRODUCTS)
12
+ selected.add(product);
81
13
  resolveStackRegistry({ products: [...selected], hosting });
82
14
  }
83
- function itemDependencies(name, context) {
84
- const definition = getStackDefinition(name);
85
- const dependencies = new Set(definition.registryDependencies);
86
- if (definition.runtime) {
87
- if (!hasServer(context) && definition.runtime !== 'optional-worker')
88
- throw new Error(`${name} requires a server runtime.`);
89
- if (needsWorker(name, context) &&
90
- !context.has('hono') &&
91
- !(context.options.hosting === 'cloudflare' && (context.has('vinext') || context.has('next'))))
92
- throw new Error(`${name} requires a Cloudflare runtime.`);
93
- if (hasServer(context))
94
- dependencies.add(context.has('hono') ? 'hono' : context.has('vinext') ? 'vinext' : 'next');
95
- }
96
- for (const dependency of definition.resolveDependencies?.(context) ?? [])
97
- dependencies.add(dependency);
98
- return dependencies;
99
- }
100
15
  export function resolveStackRegistry(options) {
101
- const selected = new Set(options.products);
102
- validateProducts(selected, options.hosting);
103
- if (![...selected].some((id) => getStackDefinition(id).type === 'application'))
104
- throw new Error('Stack registry requires an application.');
105
- const context = createResolutionContext(options);
16
+ if (options.hosting !== 'cloudflare')
17
+ throw new Error('Anhedral applications use Cloudflare Workers.');
18
+ for (const id of options.products)
19
+ if (!STANDARD_PRODUCTS.includes(id))
20
+ throw new Error(`Unknown stack product: ${id}.`);
21
+ const products = [...new Set([...CORE_PRODUCTS, ...options.products])];
22
+ const context = createResolutionContext({ ...options, products });
106
23
  const resolved = new Map();
107
- const collect = (name) => {
24
+ function collect(name) {
108
25
  if (resolved.has(name))
109
26
  return;
110
27
  const definition = getStackDefinition(name);
111
28
  const metadata = getStackItem(name);
112
- const dependencies = itemDependencies(name, context);
113
- metadata.registryDependencies = [...dependencies];
114
- metadata.environment = definition.resolveEnvironment?.(context) ?? metadata.environment;
115
- metadata.targets = definition.resolveTargets?.(context) ?? metadata.targets;
116
29
  if (definition.configure)
117
30
  metadata.bindings = definition.configure(context);
118
- if (definition.package)
119
- metadata.package =
120
- definition.resolvePackage?.(context, definition.package) ?? definition.package;
121
31
  resolved.set(name, metadata);
122
- for (const dependency of dependencies)
32
+ for (const dependency of metadata.registryDependencies)
123
33
  collect(dependency);
124
- };
125
- for (const name of ['workspace', 'typescript', 'eslint', ...[...selected].sort()])
34
+ }
35
+ for (const name of ['workspace', 'typescript', 'eslint', ...products.sort()])
126
36
  collect(name);
127
37
  const graph = new Map([...resolved].map(([name, item]) => [name, item.registryDependencies]));
128
38
  return {
@@ -1,7 +1,7 @@
1
1
  import type { StandardProduct } from '../stack-registry.js';
2
2
  import type { Json } from '../scaffold/files.js';
3
3
  export type { StandardProduct } from '../stack-registry.js';
4
- export type Hosting = 'cloudflare' | 'vercel';
4
+ export type Hosting = 'cloudflare';
5
5
  export interface StandardOptions {
6
6
  root: string;
7
7
  name: string;
@@ -30,7 +30,6 @@ export interface RecipeContext {
30
30
  updating?: boolean;
31
31
  root: string;
32
32
  options: StandardOptions;
33
- runtimeApp: 'api' | 'web';
34
33
  bindings: Json;
35
34
  has: (product: string) => boolean;
36
35
  }
@@ -58,9 +57,4 @@ export interface StackRegistryItem {
58
57
  export interface ItemDefinition extends Omit<StackRegistryItem, 'bindings'> {
59
58
  install?: Recipe;
60
59
  configure?: (context: RecipeContext) => Json;
61
- resolveEnvironment?: (context: RecipeContext) => string[];
62
- resolveTargets?: (context: RecipeContext) => string[];
63
- resolvePackage?: (context: RecipeContext, recipe: PackageRecipe) => PackageRecipe;
64
- resolveDependencies?: (context: RecipeContext) => string[];
65
- fallbackDependency?: string;
66
60
  }
@@ -1,18 +1,12 @@
1
1
  import { COMMANDS, GLOBAL_OPTIONS, optionHelp } from '../command-schema.js';
2
- // Preserve the presentation API for consumers; all option text comes from typed definitions.
3
2
  export const COMMAND_HELP = Object.fromEntries(Object.entries(COMMANDS).map(([name, entry]) => [
4
3
  name,
5
- { ...entry, options: entry.options.filter((option) => !option.hidden).map(optionHelp) },
4
+ { ...entry, options: entry.options.map(optionHelp) },
6
5
  ]));
7
- const primary = ['init', 'auth', 'ship', 'add', 'registry', 'inspect', 'doctor', 'connect'];
8
- const common = GLOBAL_OPTIONS.map(optionHelp);
9
6
  export function commandHelp(command) {
10
7
  const entry = COMMAND_HELP[command];
11
8
  if (!entry)
12
9
  return undefined;
13
- return `${entry.description}\n\nUsage: anhedral ${entry.usage}\n\nOptions:\n${[...entry.options, ...common].map((option) => ` ${option}`).join('\n')}\n\nExamples:\n${entry.examples.map((example) => ` anhedral ${example}`).join('\n')}${entry.note ? `\n\n${entry.note}` : ''}\n`;
10
+ return `${entry.description}\n\nUsage: anhedral ${entry.usage}\n\nOptions:\n${[...entry.options, ...GLOBAL_OPTIONS.map(optionHelp)].map((option) => ` ${option}`).join('\n')}\n\n${entry.note}\n`;
14
11
  }
15
- export const STANDARD_USAGE = `Anhedral\nScaffold source, authenticate your providers, and ship your selected stack.\n\nUsage: anhedral <command> [options]\n\nStart here:\n${primary.map((name) => ` ${name.padEnd(12)}${COMMAND_HELP[name].description}`).join('\n')}\n\nDelivery tools:\n${Object.entries(COMMAND_HELP)
16
- .filter(([name]) => !primary.includes(name))
17
- .map(([name, entry]) => ` ${name.padEnd(12)}${entry.description}`)
18
- .join('\n')}\n\nDefault: minimal Expo web, iOS and Android app in a pnpm/Turborepo workspace. Add API, identity, data and services when needed; --preset full-product selects the complete compatible stack.\nExamples:\n anhedral init client-app\n anhedral auth client-app\n anhedral ship client-app --dry-run\n\nUse anhedral <command> --help for options and examples.\nUse anhedral help <command> for the same focused help.\nGlobal options:\n${common.map((option) => ` ${option}`).join('\n')}\n -v, --version Show the CLI version.\n`;
12
+ export const STANDARD_USAGE = `Anhedral — an open-source stack foundation\n\n${commandHelp('init')}\n${commandHelp('ui')}\n${commandHelp('add')}\n${commandHelp('stack')}\n -v, --version Show the CLI version.\n`;
@@ -1,4 +1,2 @@
1
1
  /** Runtime policy shared by generation, setup guidance, and diagnostics. */
2
2
  export declare function supportsWorkspaceRuntime(version: string): boolean;
3
- export declare function supportsVoidRuntime(version: string): boolean;
4
- export declare function usesVoidSelection(products: readonly string[], hosting: string): boolean;
@@ -6,19 +6,3 @@ export function supportsWorkspaceRuntime(version) {
6
6
  const [major, minor] = match.slice(1).map(Number);
7
7
  return (major === 22 && minor >= 13) || major >= 24;
8
8
  }
9
- export function supportsVoidRuntime(version) {
10
- const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
11
- if (!match)
12
- return false;
13
- const [major, minor] = match.slice(1).map(Number);
14
- return major > 24 || (major === 24 && minor >= 21);
15
- }
16
- export function usesVoidSelection(products, hosting) {
17
- return (!products.includes('expo') &&
18
- !(products.includes('next') && hosting === 'cloudflare') &&
19
- !products.includes('queues') &&
20
- !products.includes('basin') &&
21
- !products.includes('images') &&
22
- !products.includes('analytics-engine') &&
23
- products.some((product) => ['vinext', 'hono', 'realtime', 'cron', 'workflows'].includes(product)));
24
- }
@@ -1,6 +1,2 @@
1
- import type { RecipeContext } from '../registry/types.js';
2
1
  /** Public contracts never import a framework, database or auth server. */
3
2
  export declare function scaffoldContracts(root: string): void;
4
- /** A single trusted upstream; never forward provider/edge identity headers from browsers. */
5
- export declare function scaffoldWebBackend({ root, options, has }: RecipeContext): void;
6
- export declare function scaffoldWebAuth(root: string): void;
@@ -1,23 +1,16 @@
1
- import { existsSync } from 'node:fs';
2
- import path from 'node:path';
3
- import { resourceName } from '../render.js';
4
1
  import { STACK_DEPENDENCIES } from '../dependencies.js';
5
- import { json, patchPackage, put, readJson, sharedPackage } from './files.js';
6
- import { writeEnvironmentFile } from './environment.js';
2
+ import { put, sharedPackage } from './files.js';
7
3
  /** Public contracts never import a framework, database or auth server. */
8
4
  export function scaffoldContracts(root) {
9
5
  sharedPackage(root, 'contracts', `import { z } from 'zod';
10
6
  import { createHttpClient, type HttpOptions } from './http';
11
7
 
12
8
  export const healthSchema = z.object({ ok: z.literal(true) });
13
- export const sessionSchema = z.object({ user: z.object({ id: z.string(), name: z.string(), email: z.email() }) });
14
- export type Session = z.infer<typeof sessionSchema>;
15
9
 
16
10
  export function createApiClient(baseURL = '/api', options: HttpOptions = {}) {
17
11
  const request = createHttpClient(baseURL, options);
18
12
  return {
19
13
  health: (init?: RequestInit) => request('/health', healthSchema, init),
20
- session: (init?: RequestInit) => request('/session', sessionSchema, init),
21
14
  };
22
15
  }
23
16
  `, { zod: STACK_DEPENDENCIES.zod });
@@ -41,184 +34,3 @@ export function createHttpClient(baseURL: string, options: HttpOptions = {}) {
41
34
  }
42
35
  `);
43
36
  }
44
- /** A single trusted upstream; never forward provider/edge identity headers from browsers. */
45
- export function scaffoldWebBackend({ root, options, has }) {
46
- if (!has('hono'))
47
- return;
48
- if (has('better-auth')) {
49
- patchPackage(root, 'apps/web/package.json', {
50
- dependencies: { '@workspace/contracts': 'workspace:*' },
51
- });
52
- put(root, 'apps/web/lib/api-client.ts', `import { createApiClient } from '@workspace/contracts';
53
- export const api = createApiClient();
54
- `);
55
- }
56
- put(root, 'apps/web/lib/api-proxy.ts', `type Transport = (request: Request) => Promise<Response>;
57
- const forwardedHeaders = ['accept', 'content-type', 'cookie', 'origin', 'authorization', 'expo-origin', 'sec-fetch-site', 'idempotency-key'];
58
- const removedHeaders = ['connection', 'transfer-encoding', 'access-control-allow-origin', 'access-control-allow-credentials'];
59
- function isLocal(url: URL) {
60
- return url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
61
- }
62
- function trustedOrigin(origin: string) {
63
- const url = new URL(origin);
64
- if (url.protocol !== 'https:' && !isLocal(url)) throw new Error('Configure a trusted HTTPS API origin (HTTP is local-only).');
65
- if ([url.username, url.password, url.pathname.replace('/', ''), url.search, url.hash].some(Boolean)) {
66
- throw new Error('Configure a trusted HTTPS API origin without credentials or a path.');
67
- }
68
- return url;
69
- }
70
- function requestHeaders(request: Request) {
71
- const headers = new Headers();
72
- for (const name of forwardedHeaders) {
73
- const value = request.headers.get(name);
74
- if (value) headers.set(name, value);
75
- }
76
- return headers;
77
- }
78
- function privateResponse(response: Response) {
79
- const headers = new Headers(response.headers);
80
- for (const name of removedHeaders) headers.delete(name);
81
- headers.set('cache-control', 'private, no-store');
82
- return new Response(response.body, { status: response.status, headers });
83
- }
84
- export function createApiProxy(send: Transport, origin: string) {
85
- const upstream = trustedOrigin(origin);
86
- return async function proxy(request: Request): Promise<Response> {
87
- const path = new URL(request.url);
88
- if (!path.pathname.startsWith('/api/')) return new Response(null, { status: 404 });
89
- const target = new URL(upstream);
90
- target.pathname = path.pathname;
91
- target.search = path.search;
92
- try {
93
- const forwarded = new Request(new Request(target, request), {
94
- headers: requestHeaders(request), redirect: 'manual',
95
- signal: AbortSignal.any([request.signal, AbortSignal.timeout(15000)]),
96
- });
97
- return privateResponse(await send(forwarded));
98
- } catch {
99
- return Response.json({ error: 'API unavailable' }, { status: 503, headers: { 'cache-control': 'private, no-store' } });
100
- }
101
- };
102
- }
103
- `);
104
- const cloudflare = options.hosting === 'cloudflare';
105
- const binding = has('vinext')
106
- ? "import { env } from 'cloudflare:workers';"
107
- : "import { getCloudflareContext } from '@opennextjs/cloudflare';";
108
- const transport = cloudflare
109
- ? `${binding}
110
- import { createApiProxy } from '@/lib/api-proxy';
111
- async function handler(request: Request) {
112
- const bindings = ${has('vinext') ? 'env' : '(await getCloudflareContext({ async: true })).env'} as unknown as { API: { fetch(request: Request): Promise<Response> } };
113
- return createApiProxy((upstream) => bindings.API.fetch(upstream), 'https://localhost')(request);
114
- }`
115
- : `import { apiTransport } from '@/lib/api-transport';
116
- import { createApiProxy } from '@/lib/api-proxy';
117
- async function handler(request: Request) {
118
- const origin = process.env.API_URL;
119
- if (!origin) return Response.json({ error: 'Configure API_URL' }, { status: 503 });
120
- return createApiProxy(apiTransport, origin)(request);
121
- }`;
122
- put(root, 'apps/web/app/api/[...path]/route.ts', `${transport}
123
- export { handler as GET, handler as POST, handler as PUT, handler as PATCH, handler as DELETE, handler as OPTIONS, handler as HEAD };
124
- `);
125
- if (cloudflare) {
126
- const configFile = existsSync(path.join(root, 'apps/web/wrangler.jsonc'))
127
- ? 'apps/web/wrangler.jsonc'
128
- : 'apps/web/anhedral.cloudflare.json';
129
- const config = readJson(root, configFile);
130
- const services = (config.services ?? []);
131
- json(root, configFile, {
132
- ...config,
133
- services: [
134
- ...services.filter((service) => service.binding !== 'API'),
135
- { binding: 'API', service: resourceName(options.name, 'api') },
136
- ],
137
- });
138
- }
139
- else {
140
- put(root, 'apps/web/lib/api-transport.ts', `// Service credentials are server-only; never forward browser-supplied Access identity.
141
- export function apiTransport(request: Request) {
142
- const id = process.env.API_ACCESS_CLIENT_ID;
143
- const secret = process.env.API_ACCESS_CLIENT_SECRET;
144
- if (Boolean(id) !== Boolean(secret)) throw new Error('Configure both API Access credentials.');
145
- const headers = new Headers(request.headers);
146
- if (id && secret) {
147
- headers.set('CF-Access-Client-Id', id);
148
- headers.set('CF-Access-Client-Secret', secret);
149
- }
150
- return fetch(request, { headers, redirect: 'manual' });
151
- }
152
- `);
153
- writeEnvironmentFile(root, 'apps/web/.env.example', {
154
- API_URL: 'http://127.0.0.1:8787',
155
- API_ACCESS_CLIENT_ID: '',
156
- API_ACCESS_CLIENT_SECRET: '',
157
- });
158
- }
159
- }
160
- export function scaffoldWebAuth(root) {
161
- patchPackage(root, 'apps/web/package.json', {
162
- dependencies: { 'better-auth': STACK_DEPENDENCIES['better-auth'] },
163
- });
164
- put(root, 'apps/web/lib/auth-client.ts', `import { createAuthClient } from 'better-auth/react';
165
- export const authClient = createAuthClient();
166
- `);
167
- put(root, 'apps/web/app/sign-in/page.tsx', `'use client';
168
-
169
- import { useState } from 'react';
170
- import { Button } from '@workspace/ui/components/button';
171
- import { api } from '@/lib/api-client';
172
- import { authClient } from '@/lib/auth-client';
173
-
174
- const modes = {
175
- signIn: { title: 'Sign in', password: 'current-password', name: false, next: 'signUp', toggle: 'Create an account' },
176
- signUp: { title: 'Create account', password: 'new-password', name: true, next: 'signIn', toggle: 'Use an existing account' },
177
- } as const;
178
- type Mode = keyof typeof modes;
179
- function authenticate(mode: Mode, form: FormData) {
180
- const credentials = { email: String(form.get('email')), password: String(form.get('password')) };
181
- if (mode === 'signUp') return authClient.signUp.email({ ...credentials, name: String(form.get('name')) });
182
- return authClient.signIn.email(credentials);
183
- }
184
- function AuthForm({ refresh }: { refresh: () => Promise<unknown> }) {
185
- const [mode, setMode] = useState<Mode>('signIn');
186
- const [pending, setPending] = useState(false);
187
- const [message, setMessage] = useState('');
188
- const fields = modes[mode];
189
- async function submit(event: React.SyntheticEvent<HTMLFormElement>) {
190
- event.preventDefault();
191
- const form = new FormData(event.currentTarget);
192
- setPending(true);
193
- setMessage('');
194
- try {
195
- const result = await authenticate(mode, form);
196
- if (result.error) { setMessage(result.error.message ?? 'Sign in failed.'); return; }
197
- await api.session();
198
- await refresh();
199
- } catch { setMessage('Unable to reach the API.'); }
200
- finally { setPending(false); }
201
- }
202
- return <main className="mx-auto grid max-w-sm gap-4 p-6">
203
- <h1 className="text-xl font-medium">{fields.title}</h1>
204
- <form onSubmit={submit} className="grid gap-3">
205
- {fields.name && <label>Name<input className="block w-full rounded border p-2" name="name" autoComplete="name" required /></label>}
206
- <label>Email<input className="block w-full rounded border p-2" type="email" name="email" autoComplete="email" required /></label>
207
- <label>Password<input className="block w-full rounded border p-2" type="password" name="password" autoComplete={fields.password} minLength={8} required /></label>
208
- <Button type="submit" disabled={pending}>{pending ? 'Working…' : fields.title}</Button>
209
- </form>
210
- <p role="status">{message}</p>
211
- <Button variant="ghost" disabled={pending} onClick={() => { setMode(fields.next); setMessage(''); }}>{fields.toggle}</Button>
212
- </main>;
213
- }
214
- export default function SignInPage() {
215
- const { data: session, refetch } = authClient.useSession();
216
- if (!session) return <AuthForm refresh={refetch} />;
217
- return <main className="mx-auto grid max-w-sm gap-4 p-6">
218
- <h1 className="text-xl font-medium">Account</h1>
219
- <p>{session.user.email}</p>
220
- <Button onClick={async () => { await authClient.signOut(); await refetch(); }}>Sign out</Button>
221
- </main>;
222
- }
223
- `);
224
- }
@@ -1,5 +1,4 @@
1
1
  import type { StandardRunner } from '../registry/types.js';
2
- export declare function assertBootstrapPlatform(run: StandardRunner, platform?: NodeJS.Platform): void;
3
- /** Planning and diagnostics support older Node releases; generated dependencies do not. */
4
2
  export declare function assertWorkspaceRuntime(run: StandardRunner, version?: string): void;
5
- export declare function bootstrapWorkspace(root: string, name: string, run: StandardRunner, webOnly?: boolean): void;
3
+ /** No downloaded template, disposable Next app or initialization-time cloud operation. */
4
+ export declare function bootstrapWorkspace(root: string, name: string, run: StandardRunner): void;
@@ -1,48 +1,42 @@
1
- import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync } from 'node:fs';
2
- import path from 'node:path';
3
- import { execFile, appendGitignore } from '../util.js';
4
- import { bootstrapArguments } from '../registry/bootstrap.js';
5
1
  import { supportsWorkspaceRuntime } from '../runtime-policy.js';
6
- export function assertBootstrapPlatform(run, platform = process.platform) {
7
- if (platform === 'win32' && run === execFile)
8
- throw new Error('Native Windows initialization is blocked because the upstream shadcn monorepo bootstrap writes component files outside the project. Run Anhedral inside WSL. Planning and doctor remain available on Windows.');
9
- }
10
- /** Planning and diagnostics support older Node releases; generated dependencies do not. */
2
+ import { execFile } from '../util.js';
3
+ import { STACK_DEPENDENCIES } from '../dependencies.js';
4
+ import { json, put } from './files.js';
11
5
  export function assertWorkspaceRuntime(run, version = process.versions.node) {
12
- if (run !== execFile)
13
- return;
14
- if (!supportsWorkspaceRuntime(version))
15
- throw new Error('Generated workspaces require Node.js 22.13+ on the 22.x line or Node.js 24+. Planning and doctor remain available on older CLI-supported versions.');
6
+ if (run === execFile && !supportsWorkspaceRuntime(version))
7
+ throw new Error('Generated workspaces require Node.js 22.13+ on the 22.x line or Node.js 24+.');
16
8
  }
17
- export function bootstrapWorkspace(root, name, run, webOnly = false) {
18
- assertBootstrapPlatform(run);
9
+ /** No downloaded template, disposable Next app or initialization-time cloud operation. */
10
+ export function bootstrapWorkspace(root, name, run) {
19
11
  assertWorkspaceRuntime(run);
20
- const temporary = path.join(root, '.bootstrap');
21
- mkdirSync(temporary);
22
- try {
23
- run('pnpm', bootstrapArguments(name, temporary), root);
24
- const generated = path.join(temporary, name);
25
- if (!existsSync(path.join(generated, 'pnpm-workspace.yaml')) ||
26
- !existsSync(path.join(generated, 'apps/web/package.json')))
27
- throw new Error('Official shadcn bootstrap did not produce the expected monorepo.');
28
- const ignored = ['.git', 'node_modules', '.next', '.turbo'];
29
- const seed = !webOnly && existsSync(path.join(root, '.gitignore'))
30
- ? readFileSync(path.join(root, '.gitignore'), 'utf8')
31
- : '';
32
- for (const entry of webOnly ? ['apps/web', 'packages/ui'] : readdirSync(generated)) {
33
- if (ignored.includes(entry))
34
- continue;
35
- if (webOnly && existsSync(path.join(root, entry)))
36
- throw new Error(`Web foundation target already exists: ${entry}.`);
37
- cpSync(path.join(generated, entry), path.join(root, entry), {
38
- recursive: true,
39
- filter: (source) => !ignored.includes(path.basename(source)),
40
- });
41
- }
42
- if (seed)
43
- appendGitignore(root, seed.split(/\r?\n/));
44
- }
45
- finally {
46
- rmSync(temporary, { recursive: true, force: true });
47
- }
12
+ json(root, 'package.json', { name, private: true });
13
+ put(root, 'pnpm-workspace.yaml', 'packages:\n - apps/*\n - packages/*\n');
14
+ json(root, 'packages/typescript-config/package.json', {
15
+ name: '@workspace/typescript-config',
16
+ private: true,
17
+ exports: { './base.json': './base.json' },
18
+ });
19
+ json(root, 'packages/typescript-config/base.json', {
20
+ compilerOptions: {
21
+ strict: true,
22
+ skipLibCheck: true,
23
+ target: 'ES2022',
24
+ module: 'ESNext',
25
+ moduleResolution: 'Bundler',
26
+ },
27
+ });
28
+ json(root, 'packages/eslint-config/package.json', {
29
+ name: '@workspace/eslint-config',
30
+ private: true,
31
+ type: 'module',
32
+ exports: { './base': './base.js', './react-internal': './react-internal.js' },
33
+ dependencies: {
34
+ typescript: STACK_DEPENDENCIES.typescript,
35
+ eslint: STACK_DEPENDENCIES.eslint,
36
+ '@typescript-eslint/parser': STACK_DEPENDENCIES['@typescript-eslint/parser'],
37
+ '@typescript-eslint/eslint-plugin': STACK_DEPENDENCIES['@typescript-eslint/eslint-plugin'],
38
+ },
39
+ });
40
+ put(root, 'packages/eslint-config/base.js', "import parser from '@typescript-eslint/parser';\nimport plugin from '@typescript-eslint/eslint-plugin';\nexport const config = [{ ignores: ['dist/**', '.output/**', '.wrangler/**', 'worker-configuration.d.ts'] }, { files: ['**/*.{ts,tsx,cts,mts}'], languageOptions: { parser, parserOptions: { ecmaFeatures: { jsx: true } } }, plugins: { '@typescript-eslint': plugin }, rules: { ...plugin.configs.recommended.rules, 'no-undef': 'off', 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }] } }];\n");
41
+ put(root, 'packages/eslint-config/react-internal.js', "export { config } from './base.js';\n");
48
42
  }