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,101 +0,0 @@
1
- import type { DeliveryRunner } from './project-state.js';
2
- export declare const cli: string[];
3
- export interface WebProject {
4
- schemaVersion: 1;
5
- id: string;
6
- name: string;
7
- ownership: 'customer';
8
- provider: 'vercel';
9
- directory: 'apps/web';
10
- teamId: string | null;
11
- projectId: string | null;
12
- scope: string | null;
13
- audience: 'unconfigured' | 'public' | 'private';
14
- use: 'unconfigured' | 'personal' | 'commercial';
15
- repository?: {
16
- repoId: number;
17
- nameWithOwner: string;
18
- productionBranch?: string;
19
- };
20
- }
21
- export interface WebRelease {
22
- id: string;
23
- commit: string;
24
- operation: 'ship' | 'rollback' | 'adopt' | 'recover';
25
- provenance?: 'cli' | 'git';
26
- branch?: string;
27
- state: 'running' | 'deployed' | 'failed';
28
- startedAt: string;
29
- deploymentId?: string;
30
- url?: string;
31
- deploymentUrl?: string;
32
- restoredReleaseId?: string;
33
- verification?: {
34
- state: 'passed' | 'failed';
35
- checkedAt: string;
36
- };
37
- }
38
- export interface ProviderProject {
39
- id: string;
40
- name: string;
41
- accountId: string;
42
- framework: string;
43
- rootDirectory: string;
44
- sourceFilesOutsideRootDirectory?: boolean;
45
- link?: {
46
- type: string;
47
- org?: string;
48
- repo?: string;
49
- repoId?: number;
50
- productionBranch?: string;
51
- };
52
- ssoProtection?: {
53
- deploymentType?: string;
54
- };
55
- passwordProtection?: unknown;
56
- targets?: {
57
- production?: {
58
- id?: string;
59
- };
60
- };
61
- }
62
- export interface ProviderDeployment {
63
- id: string;
64
- projectId: string;
65
- ownerId: string;
66
- readyState: string;
67
- target: string;
68
- url: string;
69
- alias?: string[];
70
- meta?: Record<string, string>;
71
- gitSource?: {
72
- type?: string;
73
- repoId?: number | string;
74
- org?: string;
75
- repo?: string;
76
- sha?: string;
77
- ref?: string;
78
- prId?: number | null;
79
- };
80
- }
81
- export declare function registerVercelApplication(root: string): WebProject;
82
- export declare function readWeb(root: string): WebProject;
83
- export declare function env(project?: WebProject): NodeJS.ProcessEnv;
84
- export declare function context(root: string, project: WebProject): void;
85
- export declare function api(root: string, run: DeliveryRunner, endpoint: string, scope?: string, body?: unknown, method?: string): Promise<any>;
86
- export declare function paginated(root: string, run: DeliveryRunner, endpoint: string, key: string, scope?: string): Promise<any[]>;
87
- export declare function validateProvider(project: WebProject, value: ProviderProject): void;
88
- export declare function matchesRepository(link: ProviderProject['link'], repository: NonNullable<WebProject['repository']>): boolean;
89
- export declare function inspect(root: string, project: WebProject, run: DeliveryRunner): Promise<ProviderProject>;
90
- export declare function history(root: string, project: WebProject): {
91
- schemaVersion: 1;
92
- projectId: string;
93
- releases: WebRelease[];
94
- };
95
- export declare function source(root: string, run: DeliveryRunner): Promise<string>;
96
- export declare function https(value: string): string;
97
- export declare function validBranch(branch: string): boolean;
98
- export declare function deployment(project: WebProject, value: ProviderDeployment, commit: string, provenance?: 'cli' | 'git', branch?: string): void;
99
- export declare function validateRelease(project: WebProject, value: ProviderDeployment, release: WebRelease): void;
100
- export declare function committedManifest(root: string, project: WebProject, run: DeliveryRunner): Promise<string>;
101
- export declare function remoteBranch(root: string, branch: string, commit: string, run: DeliveryRunner): Promise<void>;
@@ -1,305 +0,0 @@
1
- import { hasProjectSection, readProjectSection, writeProjectSection } from './project-config.js';
2
- import { githubRepository } from './repository.js';
3
- import { providerProjectName } from './render.js';
4
- import { existsSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
5
- import { randomUUID } from 'node:crypto';
6
- import path from 'node:path';
7
- import { tmpdir } from 'node:os';
8
- import { VERCEL_CLI_VERSION } from './dependencies.js';
9
- // Keep provider commands reproducible independently of globally installed tooling.
10
- export const cli = ['dlx', `vercel@${VERCEL_CLI_VERSION}`];
11
- const manifest = 'anhedral.json';
12
- function webDirectory(root) {
13
- root = realpathSync(root);
14
- const directory = realpathSync(path.join(root, 'apps/web'));
15
- if (!directory.startsWith(root + path.sep))
16
- throw new Error('Web directory escapes the application.');
17
- return directory;
18
- }
19
- export function registerVercelApplication(root) {
20
- root = realpathSync(root);
21
- webDirectory(root);
22
- if (hasProjectSection(root, 'vercel'))
23
- return readWeb(root);
24
- const setup = readProjectSection(root, 'setup');
25
- if (setup.hosting !== 'vercel')
26
- throw new Error('This application did not select Vercel web hosting.');
27
- const packageName = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8')).name;
28
- if (typeof packageName !== 'string' || !packageName)
29
- throw new Error('A package name is required to register the Vercel project.');
30
- const name = providerProjectName(packageName);
31
- const project = {
32
- schemaVersion: 1,
33
- id: randomUUID(),
34
- name,
35
- ownership: 'customer',
36
- provider: 'vercel',
37
- directory: 'apps/web',
38
- teamId: null,
39
- projectId: null,
40
- scope: null,
41
- audience: 'unconfigured',
42
- use: 'unconfigured',
43
- };
44
- const ignore = path.join(root, '.gitignore');
45
- let source = existsSync(ignore) ? readFileSync(ignore, 'utf8') : '';
46
- for (const entry of ['.anhedral/', '.vercel/'])
47
- if (!source.split(/\r?\n/).includes(entry))
48
- source += (source && !source.endsWith('\n') ? '\n' : '') + entry + '\n';
49
- writeFileSync(ignore, source);
50
- writeProjectSection(root, 'vercel', project);
51
- return project;
52
- }
53
- export function readWeb(root) {
54
- webDirectory(root);
55
- const project = readProjectSection(root, 'vercel');
56
- if (project.schemaVersion !== 1 ||
57
- !/^[a-f0-9-]{36}$/.test(project.id) ||
58
- project.provider !== 'vercel' ||
59
- project.ownership !== 'customer' ||
60
- project.directory !== 'apps/web' ||
61
- !/^[a-z0-9][a-z0-9-]{0,62}$/.test(project.name) ||
62
- !['unconfigured', 'public', 'private'].includes(project.audience) ||
63
- !['unconfigured', 'personal', 'commercial'].includes(project.use) ||
64
- !(project.teamId === null || /^team_[a-zA-Z0-9]+$/.test(project.teamId)) ||
65
- !(project.projectId === null || /^prj_[a-zA-Z0-9]+$/.test(project.projectId)) ||
66
- !(project.scope === null || /^[a-zA-Z0-9_-]+$/.test(project.scope)) ||
67
- (project.repository !== undefined &&
68
- (!Number.isSafeInteger(project.repository?.repoId) ||
69
- project.repository.repoId <= 0 ||
70
- !/^[a-zA-Z0-9-]+\/[a-zA-Z0-9_.-]+$/.test(project.repository.nameWithOwner) ||
71
- (project.repository.productionBranch !== undefined &&
72
- !validBranch(project.repository.productionBranch)))))
73
- throw new Error('Invalid Vercel application manifest.');
74
- return project;
75
- }
76
- export function env(project) {
77
- if (project &&
78
- ((process.env.VERCEL_PROJECT_ID && process.env.VERCEL_PROJECT_ID !== project.projectId) ||
79
- (process.env.VERCEL_ORG_ID && process.env.VERCEL_ORG_ID !== project.teamId)))
80
- throw new Error('Vercel environment selects a different project/account.');
81
- return {
82
- ...process.env,
83
- CI: '1',
84
- NO_COLOR: '1',
85
- ...(project?.projectId
86
- ? { VERCEL_PROJECT_ID: project.projectId, VERCEL_ORG_ID: project.teamId }
87
- : {}),
88
- };
89
- }
90
- export function context(root, project) {
91
- const file = path.join(root, '.vercel/project.json');
92
- if (existsSync(path.join(root, '.vercel/repo.json')))
93
- throw new Error('Reconcile existing Vercel repository links explicitly before using automatic delivery.');
94
- if (!existsSync(file))
95
- throw new Error('Run anhedral connect to link the selected Vercel project.');
96
- if (realpathSync(path.dirname(file)) !== path.join(realpathSync(root), '.vercel'))
97
- throw new Error('Vercel link directory must not be a symbolic link.');
98
- const link = JSON.parse(readFileSync(file, 'utf8'));
99
- if (link.orgId !== project.teamId || link.projectId !== project.projectId)
100
- throw new Error('Local Vercel link differs from the recorded customer account/project.');
101
- }
102
- export async function api(root, run, endpoint, scope, body, method = 'POST') {
103
- if (!/^\/v\d+\//.test(endpoint) || endpoint.includes('..') || endpoint.includes('#'))
104
- throw new Error('Invalid Vercel API path.');
105
- const temporary = path.join(tmpdir(), `anhedral-vercel-${randomUUID()}.json`);
106
- const args = [
107
- ...cli,
108
- 'api',
109
- endpoint,
110
- '--raw',
111
- '--non-interactive',
112
- ...(scope ? ['--scope', scope] : []),
113
- ];
114
- try {
115
- if (body) {
116
- writeFileSync(temporary, JSON.stringify(body), { mode: 0o600, flag: 'wx' });
117
- args.push('-X', method, '--input', temporary);
118
- }
119
- const output = await run('pnpm', args, root, env());
120
- let value;
121
- try {
122
- value = JSON.parse(output);
123
- }
124
- catch {
125
- throw new Error('Vercel did not return valid provider JSON.');
126
- }
127
- if (!value || typeof value !== 'object' || value.error || value.status === 'error')
128
- throw new Error('Vercel rejected the request; verify login, scope and project permissions.');
129
- return value;
130
- }
131
- finally {
132
- rmSync(temporary, { force: true });
133
- }
134
- }
135
- export async function paginated(root, run, endpoint, key, scope) {
136
- const result = [];
137
- let cursor;
138
- for (let page = 0; page < 1000; page++) {
139
- const data = await api(root, run, `${endpoint}${endpoint.includes('?') ? '&' : '?'}limit=100${cursor ? `&until=${cursor}` : ''}`, scope);
140
- if (!Array.isArray(data[key]))
141
- throw new Error('Invalid Vercel provider listing.');
142
- result.push(...data[key]);
143
- if (data[key].length === 0)
144
- return result;
145
- const next = data.pagination?.next;
146
- if (next === null || next === undefined)
147
- return result;
148
- if (typeof next !== 'number' || !Number.isFinite(next) || next === cursor)
149
- throw new Error('Invalid Vercel pagination cursor.');
150
- cursor = next;
151
- }
152
- throw new Error('Vercel listing exceeded pagination bounds.');
153
- }
154
- function protection(project, provider) {
155
- const all = provider.ssoProtection?.deploymentType === 'all';
156
- if (project.audience === 'private' && !all)
157
- throw new Error('Private Vercel hosting requires verified protection for all deployments, including production. Configure Vercel Authentication for every deployment in the selected project; protection was not disabled or purchased.');
158
- if (project.audience === 'public' && (all || provider.passwordProtection))
159
- throw new Error('Provider production protection differs from the requested public audience. Reconcile it explicitly.');
160
- }
161
- export function validateProvider(project, value) {
162
- if (value.id !== project.projectId ||
163
- value.accountId !== project.teamId ||
164
- value.name !== project.name ||
165
- value.framework !== 'nextjs' ||
166
- value.rootDirectory !== project.directory ||
167
- value.sourceFilesOutsideRootDirectory !== true)
168
- throw new Error('Vercel provider account, framework or monorepo root differs from the manifest.');
169
- protection(project, value);
170
- if (project.repository &&
171
- (!matchesRepository(value.link, project.repository) ||
172
- (project.repository.productionBranch !== undefined &&
173
- value.link?.productionBranch !== project.repository.productionBranch)))
174
- throw new Error('Vercel Git repository differs from the recorded source repository. Reconcile it explicitly.');
175
- }
176
- export function matchesRepository(link, repository) {
177
- const [owner, name] = repository.nameWithOwner.split('/');
178
- return (link?.type === 'github' &&
179
- link.repoId === repository.repoId &&
180
- link.org?.toLowerCase() === owner.toLowerCase() &&
181
- link.repo?.toLowerCase() === name.toLowerCase());
182
- }
183
- export async function inspect(root, project, run) {
184
- context(root, project);
185
- env(project);
186
- const team = await api(root, run, `/v2/teams/${project.teamId}`, project.teamId);
187
- if (team.id !== project.teamId ||
188
- !['hobby', 'pro', 'enterprise'].includes(team.billing?.plan) ||
189
- (project.use === 'commercial' && team.billing.plan === 'hobby'))
190
- throw new Error('Selected Vercel account plan no longer supports the recorded application use.');
191
- const linked = JSON.parse(await run('pnpm', [...cli, 'project', 'inspect', '--json', '--non-interactive', '--scope', project.teamId], root, env(project)));
192
- if (linked.id !== project.projectId || linked.owner?.slug !== project.scope)
193
- throw new Error('Vercel CLI resolved a different project/account.');
194
- const provider = await api(root, run, `/v9/projects/${project.projectId}?teamId=${project.teamId}`, project.teamId);
195
- validateProvider(project, provider);
196
- if (project.repository) {
197
- const repository = await githubRepository(root, run);
198
- if (repository.repoId !== project.repository.repoId ||
199
- repository.nameWithOwner.toLowerCase() !== project.repository.nameWithOwner.toLowerCase())
200
- throw new Error('GitHub origin differs from the recorded source repository. Reconcile it explicitly.');
201
- }
202
- return provider;
203
- }
204
- export function history(root, project) {
205
- const file = path.join(root, '.anhedral/web-releases.json');
206
- const value = existsSync(file)
207
- ? JSON.parse(readFileSync(file, 'utf8'))
208
- : { schemaVersion: 1, projectId: project.id, releases: [] };
209
- if (value.schemaVersion !== 1 || value.projectId !== project.id || !Array.isArray(value.releases))
210
- throw new Error('Vercel release history differs from project identity.');
211
- return value;
212
- }
213
- export async function source(root, run) {
214
- if (realpathSync((await run('git', ['rev-parse', '--show-toplevel'], root, env())).trim()) !==
215
- root ||
216
- (await run('git', ['status', '--porcelain'], root, env())).trim())
217
- throw new Error('Commit the application and manifest in their own repository before delivery/verification.');
218
- const commit = (await run('git', ['rev-parse', 'HEAD'], root, env())).trim();
219
- if (!/^[a-f0-9]{40,64}$/.test(commit))
220
- throw new Error('Invalid source commit.');
221
- return commit;
222
- }
223
- export function https(value) {
224
- const url = new URL(value.startsWith('https://') ? value : `https://${value}`);
225
- if (url.protocol !== 'https:' ||
226
- url.username ||
227
- url.password ||
228
- url.port ||
229
- url.search ||
230
- url.hash ||
231
- url.pathname !== '/')
232
- throw new Error('Invalid provider deployment URL.');
233
- return url.origin;
234
- }
235
- export function validBranch(branch) {
236
- return (typeof branch === 'string' &&
237
- branch.length > 0 &&
238
- branch.length < 256 &&
239
- !branch.startsWith('-') &&
240
- !branch.startsWith('/') &&
241
- !branch.endsWith('/') &&
242
- !branch.endsWith('.') &&
243
- !branch.includes('..') &&
244
- !branch.includes('@{') &&
245
- !/[\x00-\x20\x7f~^:?*\\[\]]/.test(branch) &&
246
- !branch.split('/').some((part) => !part || part.startsWith('.') || part.endsWith('.lock')));
247
- }
248
- export function deployment(project, value, commit, provenance = 'cli', branch) {
249
- if (!/^[a-f0-9]{40,64}$/.test(commit) ||
250
- !/^dpl_[a-zA-Z0-9]+$/.test(value.id) ||
251
- value.projectId !== project.projectId ||
252
- value.ownerId !== project.teamId ||
253
- value.readyState !== 'READY' ||
254
- value.target !== 'production')
255
- throw new Error('Vercel deployment is not ready or differs from account/project/source provenance.');
256
- if (provenance === 'git') {
257
- const repository = project.repository;
258
- const git = value.gitSource;
259
- const identity = git?.repoId !== undefined && String(git.repoId) === String(repository?.repoId);
260
- if (!repository ||
261
- !branch ||
262
- !validBranch(branch) ||
263
- git?.type !== 'github' ||
264
- !identity ||
265
- git.sha !== commit ||
266
- git.ref !== branch ||
267
- git.prId != null)
268
- throw new Error('Git deployment differs from the recorded repository, production branch or source commit.');
269
- }
270
- else if (value.meta?.anhedralProject !== project.id || value.meta?.anhedralCommit !== commit)
271
- throw new Error('Vercel deployment differs from recorded CLI provenance.');
272
- https(value.url);
273
- }
274
- export function validateRelease(project, value, release) {
275
- deployment(project, value, release.commit, release.provenance ?? 'cli', release.branch);
276
- if (value.id !== release.deploymentId ||
277
- !release.deploymentUrl ||
278
- https(value.url) !== https(release.deploymentUrl))
279
- throw new Error('Recorded deployment identity or URL differs from provider evidence.');
280
- }
281
- export async function committedManifest(root, project, run) {
282
- const commit = await source(root, run);
283
- let recorded;
284
- try {
285
- const configuration = JSON.parse(await run('git', ['show', `HEAD:${manifest}`], root, env(project)));
286
- if (configuration.schemaVersion !== 1)
287
- throw new Error('Invalid committed project configuration.');
288
- recorded = configuration.vercel;
289
- }
290
- catch {
291
- throw new Error('Commit the Vercel identity manifest before adoption or recovery.');
292
- }
293
- if (JSON.stringify(recorded) !== JSON.stringify(project))
294
- throw new Error('Committed Vercel identity differs from the application manifest.');
295
- return commit;
296
- }
297
- export async function remoteBranch(root, branch, commit, run) {
298
- if (!validBranch(branch))
299
- throw new Error('Record an explicit valid production branch before Git adoption.');
300
- const ref = `refs/heads/${branch}`;
301
- const output = (await run('git', ['ls-remote', '--heads', 'origin', ref], root, env())).trim();
302
- const rows = output.split(/\r?\n/).filter(Boolean);
303
- if (rows.length !== 1 || rows[0] !== `${commit}\t${ref}`)
304
- throw new Error('Remote production branch does not match the exact clean source commit.');
305
- }
package/dist/vercel.d.ts DELETED
@@ -1,67 +0,0 @@
1
- import { type WebProject, type WebRelease } from './vercel-project.js';
2
- export { registerVercelApplication } from './vercel-project.js';
3
- export type { WebProject, WebRelease } from './vercel-project.js';
4
- import { type DeliveryRunner } from './project-state.js';
5
- export declare function connectVercelApplication(root: string, options: {
6
- scope?: string;
7
- audience: 'public' | 'private';
8
- use: 'personal' | 'commercial';
9
- create?: boolean;
10
- git?: boolean;
11
- }, run?: DeliveryRunner): Promise<{
12
- project: WebProject;
13
- plan: any;
14
- planActivated: boolean;
15
- }>;
16
- export declare function adoptVercelApplication(root: string, run?: DeliveryRunner): Promise<{
17
- projectId: string;
18
- release: WebRelease;
19
- adopted: boolean;
20
- productVerification: string;
21
- }>;
22
- export declare function recoverVercelApplication(root: string, run?: DeliveryRunner): Promise<{
23
- projectId: string;
24
- release: WebRelease;
25
- adopted: boolean;
26
- productVerification: string;
27
- }>;
28
- export declare function planVercelDelivery(root: string): {
29
- project: WebProject;
30
- checks: string[];
31
- deployment: string[];
32
- cloudflareServices: string;
33
- mutation: boolean;
34
- };
35
- export declare function vercelApplicationStatus(root: string, refresh?: boolean, run?: DeliveryRunner): Promise<{
36
- project: WebProject;
37
- releases: WebRelease[];
38
- activeRecordedVersion: boolean | undefined;
39
- evidence: string;
40
- productVerification: string;
41
- management: string | null;
42
- }>;
43
- export declare function configureVercelEnvironment(root: string, values: Record<string, string>, run?: DeliveryRunner): Promise<void>;
44
- export declare function shipVercelApplication(root: string, run?: DeliveryRunner): Promise<{
45
- projectId: string;
46
- release: WebRelease;
47
- productVerification: string;
48
- }>;
49
- export declare function verifyVercelApplication(root: string, run?: DeliveryRunner): Promise<{
50
- projectId: string;
51
- releaseId: string;
52
- verification: {
53
- state: "passed" | "failed";
54
- checkedAt: string;
55
- };
56
- }>;
57
- export declare function rollbackVercelApplication(root: string, releaseId: string, dataCompatible: boolean, run?: DeliveryRunner): Promise<{
58
- projectId: string;
59
- release: WebRelease;
60
- dataRestored: boolean;
61
- productVerification: string;
62
- automaticProductionUpdates: string;
63
- nextAction: string;
64
- }>;
65
- export declare function writeVercelOverview(root: string, snapshot: Awaited<ReturnType<typeof vercelApplicationStatus>>): string;
66
- /** Read-only Web Analytics query for the exact connected project/team. */
67
- export declare function vercelServiceMetrics(root: string, hours?: number, run?: DeliveryRunner): Promise<import('./service-model.js').ServiceMetrics>;