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,123 +0,0 @@
1
- import type { LifecycleOperation } from './lifecycle-model.js';
2
- export interface InspectionSection<T> {
3
- state: 'available' | 'unavailable';
4
- data: T;
5
- error?: string;
6
- }
7
- export type DependencyField = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
8
- export interface WorkspaceEvidence {
9
- name: string;
10
- directory: string;
11
- dependencies: {
12
- name: string;
13
- kind: DependencyField;
14
- }[];
15
- }
16
- export interface BindingEvidence {
17
- application: string;
18
- name: string;
19
- kind: string;
20
- configured: boolean;
21
- identifierRequired: boolean;
22
- resourceId: string | null;
23
- }
24
- export interface ReleaseEvidence {
25
- id: string;
26
- state: string;
27
- commit: string;
28
- recordedAt: string | null;
29
- url: string | null;
30
- kind: 'deployment' | 'build';
31
- operationState?: string;
32
- platform?: string;
33
- profile?: string;
34
- artifact?: string;
35
- }
36
- export interface TargetEvidence {
37
- id: string;
38
- provider: 'cloudflare' | 'vercel' | 'expo' | 'desktop' | 'extension';
39
- application: string;
40
- audience: 'public' | 'private' | 'unconfigured' | 'not-applicable';
41
- accountReference: string | null;
42
- latestAttempt: ReleaseEvidence | null;
43
- lastSuccessful: ReleaseEvidence | null;
44
- delivery: 'implemented' | 'artifact-only' | 'scaffold-only';
45
- liveStatus: 'unknown';
46
- error?: string;
47
- }
48
- export interface IntegrationEvidence {
49
- provider: string;
50
- operations: {
51
- operation: string;
52
- status: 'pending' | 'complete';
53
- resources: Record<string, string>;
54
- recovery: string;
55
- kind: string | null;
56
- }[];
57
- }
58
- export interface ResourceEvidence {
59
- kind: string;
60
- name: string;
61
- id: string;
62
- reused: boolean | null;
63
- createdByProject?: boolean | null;
64
- recordedAt: string | null;
65
- }
66
- /** Browser-safe projection. Read time never substitutes for provider evidence time. */
67
- export interface ProjectInspection {
68
- schemaVersion: 1;
69
- lifecycle?: import('./project-lifecycle.js').ProjectLifecycle;
70
- name: string;
71
- inspectedAt: string;
72
- authentication: {
73
- state: 'not-checked';
74
- };
75
- liveStatus: {
76
- state: 'unknown';
77
- };
78
- limits: string[];
79
- selection: InspectionSection<{
80
- cliVersion: string | null;
81
- products: string[];
82
- hosting: 'cloudflare' | 'vercel' | null;
83
- }>;
84
- setupProviders: InspectionSection<{
85
- id: string;
86
- managementCredential: string | null;
87
- ownerSteps: string[];
88
- authentication: 'not-checked';
89
- permissions: 'unknown';
90
- billing: 'unknown';
91
- }[]>;
92
- workspaces: InspectionSection<WorkspaceEvidence[]>;
93
- configuration: InspectionSection<{
94
- bindings: BindingEvidence[];
95
- schedules: {
96
- application: string;
97
- expression: string;
98
- }[];
99
- environment: {
100
- application: string;
101
- name: string;
102
- }[];
103
- }>;
104
- targets: InspectionSection<TargetEvidence[]>;
105
- integrations: InspectionSection<IntegrationEvidence[]>;
106
- cloudflareResources: InspectionSection<ResourceEvidence[]>;
107
- serviceDeletions?: InspectionSection<{
108
- resourceId: string;
109
- kind: string;
110
- name: string;
111
- state: 'pending' | 'deleted' | 'uncertain';
112
- recordedAt: string | null;
113
- }[]>;
114
- readiness: InspectionSection<{
115
- localReady: boolean;
116
- checks: {
117
- id: string;
118
- ok: boolean;
119
- detail: string;
120
- }[];
121
- }>;
122
- operation: InspectionSection<LifecycleOperation | null>;
123
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import { type IntegrationProvider, type ProviderSettings } from './providers/config.js';
2
- import { type ApiRequest } from './providers/api.js';
3
- import type { ServiceMetrics, ServiceObservation } from './service-model.js';
4
- export interface IntegrationService {
5
- provider: IntegrationProvider;
6
- settings: ProviderSettings;
7
- resources: Record<string, string>;
8
- }
9
- export declare function resolveIntegrationService(root: string, key: string): IntegrationService;
10
- export declare function integrationRequest(service: IntegrationService, env?: NodeJS.ProcessEnv, send?: typeof fetch): ApiRequest;
11
- export declare function inspectIntegrationResource(service: IntegrationService, api: ApiRequest): Promise<Record<string, unknown>>;
12
- export declare function observeIntegrationService(service: IntegrationService, api: ApiRequest): Promise<ServiceObservation>;
13
- export declare function posthogServiceMetrics(service: IntegrationService, api: ApiRequest, hours?: number): Promise<ServiceMetrics>;
@@ -1,173 +0,0 @@
1
- import { inspectApplication } from './project-inspector.js';
2
- import { providerConfiguration, setting, } from './providers/config.js';
3
- import { INTEGRATION_PROVIDERS } from './providers/definitions.js';
4
- import { providerApi, ProviderRequestError, resourceId } from './providers/api.js';
5
- import { record } from './service-readers.js';
6
- export function resolveIntegrationService(root, key) {
7
- const inspection = inspectApplication(root);
8
- const match = key.match(/^(provider|integration):([a-z]+)(?::(.+))?$/);
9
- if (!match ||
10
- !INTEGRATION_PROVIDERS.includes(match[2]) ||
11
- !inspection.setupProviders.data.some((provider) => provider.id === match[2]))
12
- throw new Error('Choose a selected integration service.');
13
- const provider = match[2];
14
- let resources = {};
15
- if (match[1] === 'integration') {
16
- const operation = inspection.integrations.data
17
- .find((entry) => entry.provider === provider)
18
- ?.operations.find((entry) => entry.operation === match[3]);
19
- if (!operation || operation.status !== 'complete')
20
- throw new Error('The integration operation is not complete.');
21
- resources = operation.resources;
22
- }
23
- const settings = providerConfiguration(root).providers[provider];
24
- if (!settings)
25
- throw new Error('Complete the selected provider configuration.');
26
- return { provider, settings, resources };
27
- }
28
- export function integrationRequest(service, env = process.env, send = fetch) {
29
- return providerApi(service.provider, service.settings, env, send, {
30
- maxAttempts: 1,
31
- totalTimeoutMs: 10000,
32
- attemptTimeoutMs: 10000,
33
- });
34
- }
35
- function selected(service, field, receipt) {
36
- const configured = setting(service.settings, field);
37
- const recorded = service.resources[receipt];
38
- if (configured && recorded && configured !== recorded)
39
- throw new Error('Configured and recorded integration identities differ.');
40
- return resourceId(configured || recorded);
41
- }
42
- export async function inspectIntegrationResource(service, api) {
43
- const { provider, settings } = service;
44
- let value;
45
- let expected;
46
- let returned;
47
- if (provider === 'neon') {
48
- expected = selected(service, 'projectId', 'project');
49
- value = record(record(await api(`/api/v2/projects/${expected}`)).project);
50
- returned = value.id;
51
- if (value.org_id !== setting(settings, 'organizationId'))
52
- throw new Error('Neon organization differs.');
53
- }
54
- else if (provider === 'clerk') {
55
- if (record(await api('/v1/platform/me')).subject !== setting(settings, 'workspaceId'))
56
- throw new Error('Clerk workspace differs.');
57
- expected = selected(service, 'applicationId', 'application');
58
- value = record(await api(`/v1/platform/applications/${expected}?include_secret_keys=false`));
59
- returned = value.application_id;
60
- }
61
- else if (provider === 'resend') {
62
- expected = selected(service, 'domainId', 'domain');
63
- value = record(await api(`/domains/${expected}`));
64
- returned = value.id;
65
- if (value.name !== setting(settings, 'domain'))
66
- throw new Error('Resend domain differs.');
67
- }
68
- else if (provider === 'stripe') {
69
- if (record(await api('/v1/account')).id !== setting(settings, 'accountId'))
70
- throw new Error('Stripe account differs.');
71
- expected = resourceId(service.resources.webhook);
72
- value = record(await api(`/v1/webhook_endpoints/${expected}`));
73
- returned = value.id;
74
- if (value.livemode !== (setting(settings, 'mode') === 'live') ||
75
- value.url !== setting(settings, 'webhookUrl'))
76
- throw new Error('Stripe environment or webhook differs.');
77
- }
78
- else if (provider === 'revenuecat') {
79
- expected = selected(service, 'projectId', 'project');
80
- value = record(await api(`/v2/projects/${expected}`));
81
- returned = value.id;
82
- }
83
- else if (provider === 'sentry') {
84
- const organization = resourceId(setting(settings, 'organization'));
85
- const slug = resourceId(setting(settings, 'project'));
86
- value = record(await api(`/api/0/projects/${organization}/${slug}/`));
87
- expected = resourceId(service.resources.project ?? value.id);
88
- returned = value.id;
89
- if (record(value.organization).slug !== organization || value.slug !== slug)
90
- throw new Error('Sentry organization or project differs.');
91
- }
92
- else if (provider === 'posthog') {
93
- expected = selected(service, 'projectId', 'project');
94
- const organization = resourceId(setting(settings, 'organizationId'));
95
- value = record(await api(`/api/organizations/${organization}/projects/${expected}/`));
96
- returned = String(value.id);
97
- if (value.organization !== organization)
98
- throw new Error('PostHog organization differs.');
99
- }
100
- else {
101
- expected = selected(service, 'projectId', 'project');
102
- value = record(await api(`/v1/organization/projects/${expected}`));
103
- returned = value.id;
104
- }
105
- if (String(returned) !== expected)
106
- throw new Error('Provider resource identity differs.');
107
- return value;
108
- }
109
- export async function observeIntegrationService(service, api) {
110
- const fetchedAt = new Date().toISOString();
111
- try {
112
- const value = await inspectIntegrationResource(service, api);
113
- const name = typeof value.name === 'string' && value.name.length <= 256 ? value.name : undefined;
114
- return {
115
- state: 'available',
116
- fetchedAt,
117
- ...(name ? { name } : {}),
118
- message: 'Provider confirmed the selected resource and account context. Application health is separate.',
119
- };
120
- }
121
- catch (error) {
122
- const status = error instanceof ProviderRequestError ? error.status : undefined;
123
- return {
124
- state: status === 404
125
- ? 'not-found'
126
- : status === 401 || status === 403
127
- ? 'permission-required'
128
- : 'unavailable',
129
- fetchedAt,
130
- message: 'Selected integration could not be verified. Check account configuration, identity and scoped permissions.',
131
- };
132
- }
133
- }
134
- export async function posthogServiceMetrics(service, api, hours = 24) {
135
- if (service.provider !== 'posthog' || ![1, 24, 168].includes(hours))
136
- throw new Error('Unsupported analytics selection.');
137
- await inspectIntegrationResource(service, api);
138
- const end = new Date().toISOString();
139
- const start = new Date(Date.parse(end) - hours * 3600000).toISOString();
140
- const id = selected(service, 'projectId', 'project');
141
- const date = (value) => value.slice(0, 19).replace('T', ' ');
142
- const value = record(await api(`/api/projects/${id}/query/`, 'POST', {
143
- query: {
144
- kind: 'HogQLQuery',
145
- query: `SELECT formatDateTime(timestamp, '%Y-%m-%dT%H:00:00Z', 'UTC') AS time, count() AS events, uniqExact(distinct_id) AS visitors FROM events WHERE timestamp >= toDateTime('${date(start)}', 'UTC') AND timestamp < toDateTime('${date(end)}', 'UTC') GROUP BY time ORDER BY time LIMIT 1000`,
146
- },
147
- name: 'Anhedral selected-project hourly analytics',
148
- async: false,
149
- }));
150
- if (!Array.isArray(value.results) || value.results.length >= 1000)
151
- throw new Error('Analytics is pending, truncated or unavailable.');
152
- const points = value.results.map((row) => {
153
- if (!Array.isArray(row) ||
154
- row.length !== 3 ||
155
- typeof row[0] !== 'string' ||
156
- !Number.isFinite(Date.parse(row[0])) ||
157
- row
158
- .slice(1)
159
- .some((count) => typeof count !== 'number' || !Number.isFinite(count) || count < 0))
160
- throw new Error('Unsupported analytics output.');
161
- return { time: row[0], values: { events: row[1], visitors: row[2] } };
162
- });
163
- return {
164
- start,
165
- end,
166
- fetchedAt: new Date().toISOString(),
167
- source: 'PostHog hourly product analytics',
168
- timezone: 'UTC',
169
- sampled: false,
170
- points,
171
- units: { events: 'count', visitors: 'hourly bucket count' },
172
- };
173
- }
@@ -1,15 +0,0 @@
1
- export type OperationState = 'running' | 'blocked' | 'completed' | 'failed';
2
- export type PhaseState = 'running' | 'completed' | 'failed';
3
- export interface LifecycleOperation {
4
- schemaVersion: 1;
5
- id: string;
6
- target: 'cloudflare' | 'vercel' | 'mixed' | 'mobile';
7
- state: OperationState;
8
- startedAt: string;
9
- updatedAt: string;
10
- phases: {
11
- name: string;
12
- state: PhaseState;
13
- }[];
14
- }
15
- export declare function isLifecycleOperation(value: unknown): value is LifecycleOperation;
@@ -1,20 +0,0 @@
1
- export function isLifecycleOperation(value) {
2
- if (!value || typeof value !== 'object' || Array.isArray(value))
3
- return false;
4
- const operation = value;
5
- return (operation.schemaVersion === 1 &&
6
- typeof operation.id === 'string' &&
7
- /^[a-f0-9-]{36}$/.test(operation.id) &&
8
- ['cloudflare', 'vercel', 'mixed', 'mobile'].includes(operation.target) &&
9
- ['running', 'blocked', 'completed', 'failed'].includes(operation.state) &&
10
- [operation.startedAt, operation.updatedAt].every((date) => typeof date === 'string' && Number.isFinite(Date.parse(date))) &&
11
- Array.isArray(operation.phases) &&
12
- operation.phases.length <= 100 &&
13
- operation.phases.every((phase) => phase &&
14
- typeof phase.name === 'string' &&
15
- /^[a-z][a-z-]{0,63}$/.test(phase.name) &&
16
- ['running', 'completed', 'failed'].includes(phase.state)) &&
17
- new Set(operation.phases.map((phase) => phase.name)).size === operation.phases.length &&
18
- Object.keys(operation).every((key) => ['schemaVersion', 'id', 'target', 'state', 'startedAt', 'updatedAt', 'phases'].includes(key)) &&
19
- operation.phases.every((phase) => Object.keys(phase).every((key) => ['name', 'state'].includes(key))));
20
- }
@@ -1,11 +0,0 @@
1
- import { type DeliveryRunner } from './project-state.js';
2
- import { type LifecycleOperation } from './lifecycle-model.js';
3
- export type { LifecycleOperation, OperationState, PhaseState } from './lifecycle-model.js';
4
- export interface LifecycleSession {
5
- phase<T>(name: string, action: () => Promise<T>): Promise<T>;
6
- }
7
- /** A nonsecret record of execution; a completed phase is not product acceptance. */
8
- export declare function readLifecycleOperation(root: string): LifecycleOperation | null;
9
- export declare function withLifecycleOperation<T>(root: string, target: LifecycleOperation['target'], run: DeliveryRunner, action: (session: LifecycleSession) => Promise<T>): Promise<T & {
10
- operation: LifecycleOperation;
11
- }>;
package/dist/lifecycle.js DELETED
@@ -1,91 +0,0 @@
1
- import path from 'node:path';
2
- import { existsSync, lstatSync, realpathSync } from 'node:fs';
3
- import { randomUUID } from 'node:crypto';
4
- import { readBoundedFile, MAX_PROJECT_JSON_BYTES } from './bounded-file.js';
5
- import { atomicJson, withApplicationLock } from './project-state.js';
6
- import { isLifecycleOperation } from './lifecycle-model.js';
7
- /** A nonsecret record of execution; a completed phase is not product acceptance. */
8
- export function readLifecycleOperation(root) {
9
- root = realpathSync(root);
10
- const file = path.join(root, '.anhedral/operation.json');
11
- if (!existsSync(file))
12
- return null;
13
- if (realpathSync(path.dirname(file)) !== path.join(root, '.anhedral') ||
14
- lstatSync(file).isSymbolicLink())
15
- throw new Error('Invalid lifecycle state location.');
16
- let value;
17
- try {
18
- value = JSON.parse(readBoundedFile(file, MAX_PROJECT_JSON_BYTES).toString('utf8'));
19
- }
20
- catch {
21
- throw new Error('Invalid lifecycle state.');
22
- }
23
- if (!isLifecycleOperation(value))
24
- throw new Error('Invalid lifecycle state.');
25
- return value;
26
- }
27
- export async function withLifecycleOperation(root, target, run, action) {
28
- root = realpathSync(root);
29
- const env = { ...process.env, CI: '1', NO_COLOR: '1' };
30
- const relative = '.anhedral/operation.json';
31
- if ((await run('git', ['ls-files', '--', relative], root, env)).trim() ||
32
- (await run('git', ['check-ignore', '--no-index', '--', relative], root, env)).trim() !==
33
- relative)
34
- throw new Error('Ignore .anhedral/ before recording a shipping operation.');
35
- return withApplicationLock(root, async () => {
36
- readLifecycleOperation(root);
37
- const now = new Date().toISOString();
38
- const operation = {
39
- schemaVersion: 1,
40
- id: randomUUID(),
41
- target,
42
- state: 'running',
43
- startedAt: now,
44
- updatedAt: now,
45
- phases: [],
46
- };
47
- const save = () => {
48
- operation.updatedAt = new Date().toISOString();
49
- atomicJson(path.join(root, relative), operation);
50
- };
51
- save();
52
- const session = {
53
- async phase(name, task) {
54
- if (!/^[a-z][a-z-]{0,63}$/.test(name) ||
55
- operation.phases.some((phase) => phase.name === name) ||
56
- operation.phases.length >= 100)
57
- throw new Error('Invalid or duplicate lifecycle phase.');
58
- const phase = { name, state: 'running' };
59
- operation.phases.push(phase);
60
- save();
61
- try {
62
- const result = await task();
63
- phase.state = 'completed';
64
- save();
65
- return result;
66
- }
67
- catch (error) {
68
- phase.state = 'failed';
69
- save();
70
- throw error;
71
- }
72
- },
73
- };
74
- try {
75
- const result = await action(session);
76
- const state = result && typeof result === 'object' && 'state' in result ? result.state : undefined;
77
- operation.state = ['partial', 'failed'].includes(String(state))
78
- ? 'failed'
79
- : ['configuration-required', 'provider-configuration-required', 'building'].includes(String(state))
80
- ? 'blocked'
81
- : 'completed';
82
- save();
83
- return Object.assign({}, result, { operation });
84
- }
85
- catch (error) {
86
- operation.state = 'failed';
87
- save();
88
- throw error;
89
- }
90
- });
91
- }
@@ -1,3 +0,0 @@
1
- import type { applicationStatus } from './delivery.js';
2
- /** A disposable projection of project/provider evidence; no manually maintained UI state. */
3
- export declare function writeManagementOverview(root: string, snapshot: Awaited<ReturnType<typeof applicationStatus>>): string;
@@ -1,47 +0,0 @@
1
- import { mkdirSync, realpathSync, writeFileSync, renameSync, rmSync } from 'node:fs';
2
- import { randomUUID } from 'node:crypto';
3
- import path from 'node:path';
4
- const escape = (value) => String(value ?? '').replace(/[&<>"']/g, (character) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[character]);
5
- const link = (url, label) => {
6
- try {
7
- const value = new URL(url);
8
- if (value.protocol === 'https:' && !value.username && !value.password)
9
- return `<a href="${escape(value.href)}" target="_blank" rel="noreferrer">${escape(label)}</a>`;
10
- }
11
- catch {
12
- /* Omit invalid links. */
13
- }
14
- return escape(label);
15
- };
16
- /** A disposable projection of project/provider evidence; no manually maintained UI state. */
17
- export function writeManagementOverview(root, snapshot) {
18
- root = realpathSync(root);
19
- const directory = path.join(root, '.anhedral');
20
- mkdirSync(directory, { recursive: true });
21
- if (realpathSync(directory) !== directory)
22
- throw new Error('Management directory must not be a symbolic link.');
23
- const latest = snapshot.releases.at(-1);
24
- const targets = snapshot.architecture
25
- .map((target) => {
26
- const receipt = latest?.targets.find((item) => item.target === target.target);
27
- const provider = snapshot.provider.find((item) => item.target === target.target);
28
- return `<article><h3>${escape(target.workerName)}</h3><p>${escape(target.directory)}</p><p>${provider ? escape(provider.versions.map((version) => `${version.versionId}: ${version.percentage}%`).join(', ')) : 'Provider not refreshed'}</p><p>${(receipt?.urls ?? []).map((url) => link(url, url)).join('<br>') || 'No recorded URL'}</p><ul>${target.bindings.map((binding) => `<li>${escape(binding.binding)} — ${escape(binding.kind)}</li>`).join('')}</ul><p>Schedules: ${target.scheduled.map(escape).join(', ') || 'None configured'}</p></article>`;
29
- })
30
- .join('');
31
- const history = [...snapshot.releases]
32
- .reverse()
33
- .map((release) => `<tr><td>${escape(release.startedAt)}</td><td>${escape(release.state)}</td><td>${escape(release.commit)}</td><td>${escape(release.id)}</td></tr>`)
34
- .join('');
35
- const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'"><title>${escape(snapshot.project.name)} · Anhedral</title><style>body{font:16px system-ui;background:#111318;color:#e7e9ef;max-width:1100px;margin:3rem auto;padding:0 1.5rem}a{color:#a9c7ff}h1{font-size:2rem}h2{margin-top:2rem}article{border:1px solid #363c49;border-radius:12px;padding:1rem;margin:1rem 0}p,li{line-height:1.6}table{width:100%;border-collapse:collapse;font-size:.85rem}td,th{text-align:left;padding:.6rem;border-bottom:1px solid #363c49;overflow-wrap:anywhere}code{overflow-wrap:anywhere}.muted{color:#a5adbd}</style></head><body><h1>${escape(snapshot.project.name)}</h1><p>Customer-owned · ${escape(snapshot.project.provider)} · ${escape(snapshot.project.audience)}</p><p class="muted">Snapshot ${escape(new Date().toISOString())} · ${escape(snapshot.evidence)}. Run <code>anhedral manage</code> to refresh. This file is local, not an access control or a hosted registry.</p><p>Account: <code>${escape(snapshot.project.accountId ?? 'Not connected')}</code></p><p>${snapshot.management ? link(snapshot.management, 'Open provider dashboard') : 'Connect an account to manage hosting.'}</p><p>Product acceptance: ${escape(snapshot.productVerification)}. Deployment evidence does not establish working user flows.</p><h2>Applications and resources</h2>${targets || '<p>No Cloudflare targets.</p>'}<h2>Release history</h2><table><thead><tr><th>Started</th><th>State</th><th>Source commit</th><th>Release</th></tr></thead><tbody>${history}</tbody></table></body></html>`;
36
- const file = path.join(directory, 'overview.html');
37
- // Refuse a pre-existing symlink through realpath; use a fresh temporary file and atomic rename in the caller's state directory.
38
- const temporary = path.join(directory, `overview-${randomUUID()}.tmp`);
39
- writeFileSync(temporary, html, { mode: 0o600, flag: 'wx' });
40
- try {
41
- renameSync(temporary, file);
42
- return file;
43
- }
44
- finally {
45
- rmSync(temporary, { force: true });
46
- }
47
- }
@@ -1,77 +0,0 @@
1
- import { type DeliveryRunner } from './project-state.js';
2
- export interface MobileBuildOptions {
3
- platform: 'ios' | 'android';
4
- profile: string;
5
- dryRun?: boolean;
6
- }
7
- /** EAS builds produce artifacts; store submission is a separate user action. */
8
- export declare function buildMobileApplication(root: string, options: MobileBuildOptions, run?: DeliveryRunner): Promise<{
9
- state: string;
10
- deployed: boolean;
11
- storeSubmission: boolean;
12
- nextAction: string;
13
- } | {
14
- schemaVersion: number;
15
- projectId: string;
16
- owner: string;
17
- slug: string;
18
- recordedAt: string;
19
- buildPageUrl: string;
20
- commit: string;
21
- platform: "android" | "ios";
22
- profile: string;
23
- buildId: string;
24
- downloadUrl: string;
25
- state: string;
26
- storeSubmission: boolean;
27
- artifact: string;
28
- } | {
29
- schemaVersion: number;
30
- state: string;
31
- buildId: string;
32
- buildPageUrl: string;
33
- commit: string;
34
- platform: "android" | "ios";
35
- profile: string;
36
- storeSubmission: boolean;
37
- nextAction: string;
38
- } | {
39
- platform: "android" | "ios";
40
- profile: string;
41
- command: string[];
42
- mutation: boolean;
43
- storeSubmission: boolean;
44
- integrations: {
45
- schemaVersion: number;
46
- providers: {
47
- provider: keyof import("./index.js").ProviderSettingsById;
48
- settings: import("./providers/definitions.js").NeonSettings | import("./providers/definitions.js").ClerkSettings | import("./providers/definitions.js").ResendSettings | import("./providers/definitions.js").StripeSettings | import("./providers/definitions.js").RevenueCatSettings | import("./providers/definitions.js").SentrySettings | import("./providers/definitions.js").PostHogSettings | import("./providers/definitions.js").OpenAISettings;
49
- credential: string;
50
- missing: string[];
51
- }[];
52
- configured: boolean;
53
- mutation: boolean;
54
- };
55
- state?: undefined;
56
- deployed?: undefined;
57
- } | {
58
- state: string;
59
- deployed: boolean;
60
- integrations: {
61
- schemaVersion: number;
62
- results: {
63
- provider: string;
64
- resources: Record<string, string>;
65
- ready: boolean;
66
- nextActions: string[];
67
- }[];
68
- ready: boolean;
69
- configuredFiles: string[];
70
- mutation: boolean;
71
- };
72
- storeSubmission: boolean;
73
- platform?: undefined;
74
- profile?: undefined;
75
- command?: undefined;
76
- mutation?: undefined;
77
- }>;