anhedral 0.12.0 → 0.15.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 (184) hide show
  1. package/README.md +35 -172
  2. package/assets/patches/audit-deps.mjs +12 -2
  3. package/assets/ui/LICENSE.shadcn +21 -0
  4. package/assets/ui/UPSTREAM.json +33 -0
  5. package/assets/ui/native/button.tsx +85 -0
  6. package/assets/ui/native/card.tsx +33 -0
  7. package/assets/ui/native/dialog.tsx +75 -0
  8. package/assets/ui/native/input.tsx +27 -0
  9. package/assets/ui/native/label.tsx +4 -0
  10. package/assets/ui/native/layout.tsx +26 -0
  11. package/assets/ui/native/text.tsx +20 -0
  12. package/assets/ui/native/theme-switcher.tsx +22 -0
  13. package/assets/ui/theme-storage.ts +25 -0
  14. package/assets/ui/theme.tsx +66 -0
  15. package/assets/ui/web/button.tsx +59 -0
  16. package/assets/ui/web/input.tsx +21 -0
  17. package/assets/ui/web/label.tsx +19 -0
  18. package/dist/capabilities.d.ts +5 -5
  19. package/dist/capabilities.js +3 -21
  20. package/dist/capability-contract.d.ts +3 -3
  21. package/dist/capability-contract.js +11 -39
  22. package/dist/cli-delivery.d.ts +1 -1
  23. package/dist/cli-delivery.js +5 -65
  24. package/dist/cli-output.js +3 -3
  25. package/dist/command-schema.js +35 -80
  26. package/dist/command.js +9 -11
  27. package/dist/delivery-evidence.d.ts +1 -1
  28. package/dist/delivery-evidence.js +7 -36
  29. package/dist/delivery.d.ts +2 -8
  30. package/dist/delivery.js +23 -102
  31. package/dist/dependencies.d.ts +12 -58
  32. package/dist/dependencies.js +67 -189
  33. package/dist/index.d.ts +1 -3
  34. package/dist/index.js +1 -3
  35. package/dist/inspector-model.d.ts +2 -2
  36. package/dist/integration-service-readers.d.ts +1 -2
  37. package/dist/integration-service-readers.js +3 -84
  38. package/dist/lifecycle-model.d.ts +1 -1
  39. package/dist/lifecycle-model.js +1 -1
  40. package/dist/mobile-delivery.d.ts +1 -1
  41. package/dist/mobile-delivery.js +4 -0
  42. package/dist/platforms/mobile.d.ts +1 -1
  43. package/dist/platforms/mobile.js +64 -114
  44. package/dist/platforms/web.d.ts +3 -0
  45. package/dist/platforms/web.js +299 -0
  46. package/dist/project-config.d.ts +1 -1
  47. package/dist/project-config.js +0 -1
  48. package/dist/project-inspector.js +5 -36
  49. package/dist/project-state.d.ts +1 -3
  50. package/dist/project-state.js +6 -86
  51. package/dist/provider-auth.js +3 -32
  52. package/dist/provider-readiness.d.ts +1 -1
  53. package/dist/provider-readiness.js +5 -24
  54. package/dist/providers/adapters.js +9 -178
  55. package/dist/providers/api.d.ts +1 -1
  56. package/dist/providers/api.js +3 -3
  57. package/dist/providers/config.js +2 -48
  58. package/dist/providers/definitions.d.ts +1 -204
  59. package/dist/providers/definitions.js +0 -85
  60. package/dist/providers/provision.d.ts +1 -1
  61. package/dist/providers/receipts.js +1 -11
  62. package/dist/providers/recovery-verification.js +1 -61
  63. package/dist/providers/runtime.js +15 -35
  64. package/dist/providers/state.js +1 -7
  65. package/dist/provision.d.ts +5 -13
  66. package/dist/provision.js +4 -80
  67. package/dist/readiness.d.ts +1 -1
  68. package/dist/readiness.js +3 -6
  69. package/dist/registry/add.js +11 -38
  70. package/dist/registry/bootstrap.d.ts +3 -2
  71. package/dist/registry/bootstrap.js +4 -13
  72. package/dist/registry/commands.js +8 -10
  73. package/dist/registry/context.js +0 -1
  74. package/dist/registry/options.js +8 -26
  75. package/dist/registry/resolve.d.ts +3 -2
  76. package/dist/registry/resolve.js +26 -82
  77. package/dist/registry/types.d.ts +2 -7
  78. package/dist/registry/usage.js +2 -2
  79. package/dist/runtime-policy.d.ts +0 -2
  80. package/dist/runtime-policy.js +0 -13
  81. package/dist/scaffold/api.js +10 -2
  82. package/dist/scaffold/auth.d.ts +1 -2
  83. package/dist/scaffold/auth.js +57 -116
  84. package/dist/scaffold/backend.d.ts +2 -0
  85. package/dist/scaffold/backend.js +39 -0
  86. package/dist/scaffold/billing-config.d.ts +1 -0
  87. package/dist/scaffold/billing-config.js +73 -0
  88. package/dist/scaffold/billing-contracts.d.ts +2 -0
  89. package/dist/scaffold/billing-contracts.js +48 -0
  90. package/dist/scaffold/billing-providers.d.ts +1 -0
  91. package/dist/scaffold/billing-providers.js +249 -0
  92. package/dist/scaffold/billing-schema.d.ts +1 -0
  93. package/dist/scaffold/billing-schema.js +34 -0
  94. package/dist/scaffold/billing-security.d.ts +1 -0
  95. package/dist/scaffold/billing-security.js +46 -0
  96. package/dist/scaffold/billing-server.d.ts +1 -0
  97. package/dist/scaffold/billing-server.js +139 -0
  98. package/dist/scaffold/billing-store.d.ts +1 -0
  99. package/dist/scaffold/billing-store.js +72 -0
  100. package/dist/scaffold/billing.d.ts +2 -0
  101. package/dist/scaffold/billing.js +208 -0
  102. package/dist/scaffold/bootstrap.d.ts +2 -3
  103. package/dist/scaffold/bootstrap.js +37 -43
  104. package/dist/scaffold/compose.js +2 -12
  105. package/dist/scaffold/database.d.ts +1 -1
  106. package/dist/scaffold/database.js +20 -111
  107. package/dist/scaffold/documentation.d.ts +0 -1
  108. package/dist/scaffold/documentation.js +22 -82
  109. package/dist/scaffold/expo-auth.d.ts +3 -0
  110. package/dist/scaffold/expo-auth.js +203 -0
  111. package/dist/scaffold/expo-billing.d.ts +3 -0
  112. package/dist/scaffold/expo-billing.js +257 -0
  113. package/dist/scaffold/expo-runtime.d.ts +3 -0
  114. package/dist/scaffold/expo-runtime.js +43 -0
  115. package/dist/scaffold/integrations.d.ts +1 -2
  116. package/dist/scaffold/integrations.js +9 -5
  117. package/dist/scaffold/managed-email.d.ts +3 -0
  118. package/dist/scaffold/managed-email.js +47 -0
  119. package/dist/scaffold/native-ui.d.ts +2 -0
  120. package/dist/scaffold/native-ui.js +69 -0
  121. package/dist/scaffold/password-reset.d.ts +1 -0
  122. package/dist/scaffold/password-reset.js +99 -0
  123. package/dist/scaffold/private-files.d.ts +2 -0
  124. package/dist/scaffold/private-files.js +78 -0
  125. package/dist/scaffold/stack-documentation.d.ts +0 -1
  126. package/dist/scaffold/stack-documentation.js +3 -49
  127. package/dist/scaffold/styling.d.ts +1 -1
  128. package/dist/scaffold/styling.js +20 -28
  129. package/dist/scaffold/web-billing.d.ts +2 -0
  130. package/dist/scaffold/web-billing.js +48 -0
  131. package/dist/scaffold/workspace.js +53 -189
  132. package/dist/service-deletion.js +1 -1
  133. package/dist/service-descriptor.js +5 -12
  134. package/dist/service-model.d.ts +1 -1
  135. package/dist/service-operations.js +2 -32
  136. package/dist/service-readers.js +1 -32
  137. package/dist/services-command.d.ts +1 -1
  138. package/dist/services-command.js +3 -9
  139. package/dist/ship.d.ts +3 -316
  140. package/dist/ship.js +13 -143
  141. package/dist/stack-registry.d.ts +2 -43
  142. package/dist/stack-registry.js +80 -308
  143. package/dist/standard.js +7 -14
  144. package/dist/version.d.ts +1 -1
  145. package/dist/version.js +1 -1
  146. package/docs/anhedral-stack.md +23 -0
  147. package/docs/assets/anhedral-stack-light.png +0 -0
  148. package/docs/assets/anhedral-stack.png +0 -0
  149. package/docs/software-factory.md +25 -499
  150. package/docs/stack-standard.md +48 -226
  151. package/docs/verification.md +433 -0
  152. package/package.json +22 -21
  153. package/dist/neon-service-data.d.ts +0 -8
  154. package/dist/neon-service-data.js +0 -117
  155. package/dist/platforms/desktop.d.ts +0 -2
  156. package/dist/platforms/desktop.js +0 -415
  157. package/dist/platforms/extension.d.ts +0 -2
  158. package/dist/platforms/extension.js +0 -328
  159. package/dist/scaffold/lint.d.ts +0 -4
  160. package/dist/scaffold/lint.js +0 -56
  161. package/dist/scaffold/neon-realtime.d.ts +0 -2
  162. package/dist/scaffold/neon-realtime.js +0 -97
  163. package/dist/scaffold/services.d.ts +0 -5
  164. package/dist/scaffold/services.js +0 -108
  165. package/dist/scaffold/stream.d.ts +0 -2
  166. package/dist/scaffold/stream.js +0 -114
  167. package/dist/scaffold/void.d.ts +0 -4
  168. package/dist/scaffold/void.js +0 -256
  169. package/dist/scaffold/web.d.ts +0 -2
  170. package/dist/scaffold/web.js +0 -128
  171. package/dist/vercel-project.d.ts +0 -101
  172. package/dist/vercel-project.js +0 -305
  173. package/dist/vercel.d.ts +0 -67
  174. package/dist/vercel.js +0 -581
  175. package/dist/vinext.d.ts +0 -2
  176. package/dist/vinext.js +0 -86
  177. package/dist/void-execution.d.ts +0 -10
  178. package/dist/void-execution.js +0 -94
  179. package/dist/void-migrations.d.ts +0 -6
  180. package/dist/void-migrations.js +0 -110
  181. package/dist/void-state.d.ts +0 -16
  182. package/dist/void-state.js +0 -65
  183. package/dist/void.d.ts +0 -3
  184. package/dist/void.js +0 -5
@@ -1,4 +1,3 @@
1
- import { resolveVoidCloudflareConfig } from './project-state.js';
2
1
  import { projectLifecycle } from './project-lifecycle.js';
3
2
  import path from 'node:path';
4
3
  import { existsSync, lstatSync, readdirSync, realpathSync } from 'node:fs';
@@ -225,18 +224,12 @@ export function inspectApplication(root) {
225
224
  permissions: 'unknown',
226
225
  billing: 'unknown',
227
226
  });
228
- if (products.includes('hono') ||
229
- products.includes('vinext') ||
230
- (products.includes('next') && selection.data.hosting === 'cloudflare'))
227
+ if (products.includes('hono'))
231
228
  add('cloudflare', null, [
232
229
  'Authenticate and connect the intended account and audience; verify service eligibility and required scopes.',
233
230
  ]);
234
- if (products.includes('next') && selection.data.hosting === 'vercel')
235
- add('vercel', null, [
236
- 'Authenticate and connect the intended team, project, plan, and audience.',
237
- ]);
238
231
  for (const [id, definition] of Object.entries(PROVIDER_DEFINITIONS))
239
- if (products.includes(id) || (id === 'openai' && products.includes('ai-sdk')))
232
+ if (products.includes(id))
240
233
  add(id, definition.credential, definition.ownerSteps);
241
234
  if (products.includes('expo'))
242
235
  add('expo', null, [
@@ -298,13 +291,7 @@ export function inspectApplication(root) {
298
291
  });
299
292
  };
300
293
  for (const application of apps()) {
301
- const declaration = document(`${application}/anhedral.cloudflare.json`);
302
- const lock = declaration ? document(`${application}/void.lock.json`) : null;
303
- const config = declaration
304
- ? lock
305
- ? resolveVoidCloudflareConfig(declaration, lock)
306
- : declaration
307
- : document(`${application}/wrangler.jsonc`);
294
+ const config = document(`${application}/wrangler.jsonc`);
308
295
  if (config) {
309
296
  for (const [field, kind, idField] of [
310
297
  ['d1_databases', 'D1', 'database_id'],
@@ -394,9 +381,7 @@ export function inspectApplication(root) {
394
381
  for (const value of values) {
395
382
  try {
396
383
  let entry;
397
- if (target.provider === 'vercel')
398
- entry = release(value, value.url);
399
- else {
384
+ {
400
385
  const members = array(value.targets ?? []).map(object);
401
386
  const ids = members.map((member) => name(member.target));
402
387
  if (new Set(ids).size !== ids.length || ids.some((id) => !known.includes(id)))
@@ -431,7 +416,7 @@ export function inspectApplication(root) {
431
416
  }
432
417
  function hostingTargets() {
433
418
  const targets = [];
434
- for (const provider of ['cloudflare', 'vercel']) {
419
+ for (const provider of ['cloudflare']) {
435
420
  try {
436
421
  const project = projectSection(provider);
437
422
  if (!project)
@@ -497,22 +482,6 @@ export function inspectApplication(root) {
497
482
  const targets = section([], 'Delivery targets are unavailable.', () => {
498
483
  const values = hostingTargets();
499
484
  const applications = apps();
500
- for (const [app, provider] of [
501
- ['apps/desktop', 'desktop'],
502
- ['apps/extension', 'extension'],
503
- ])
504
- if (applications.includes(app))
505
- values.push({
506
- id: `${provider}:application`,
507
- provider,
508
- application: app,
509
- audience: 'not-applicable',
510
- accountReference: null,
511
- latestAttempt: null,
512
- lastSuccessful: null,
513
- delivery: 'scaffold-only',
514
- liveStatus: 'unknown',
515
- });
516
485
  if (applications.includes('apps/mobile')) {
517
486
  for (const platform of ['ios', 'android']) {
518
487
  const target = {
@@ -9,7 +9,7 @@ export interface ApplicationProject {
9
9
  name: string;
10
10
  ownership: 'customer';
11
11
  provider: 'cloudflare';
12
- deliveryEngine: 'void' | 'wrangler';
12
+ deliveryEngine: 'wrangler';
13
13
  accountId: string | null;
14
14
  audience: 'unconfigured' | 'public' | 'private';
15
15
  access?: {
@@ -20,8 +20,6 @@ export interface ApplicationProject {
20
20
  export type DeliveryRunner = (command: string, args: string[], cwd: string, env: NodeJS.ProcessEnv, input?: string) => Promise<string>;
21
21
  export declare function atomicJson(file: string, value: unknown): void;
22
22
  export declare function configurationFile(directory: string): string;
23
- export declare function usesVoid(project: ApplicationProject): boolean;
24
- export declare function resolveVoidCloudflareConfig(authored: Record<string, unknown>, lock: Record<string, unknown>): Record<string, unknown>;
25
23
  export declare function readConfig(directory: string): Record<string, unknown>;
26
24
  export declare function targetDirectory(root: string, target: DeploymentTarget): string;
27
25
  export declare function registerApplication(root: string, extendTargets?: boolean): ApplicationProject;
@@ -1,5 +1,4 @@
1
1
  import { hasProjectSection, readProjectSection, writeProjectSection } from './project-config.js';
2
- import { isDeepStrictEqual } from 'node:util';
3
2
  import { randomUUID } from 'node:crypto';
4
3
  import { AsyncLocalStorage } from 'node:async_hooks';
5
4
  import { existsSync, lstatSync, fstatSync, openSync, closeSync, unlinkSync, rmdirSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
@@ -27,90 +26,11 @@ export function configurationFile(directory) {
27
26
  const canonical = path.join(directory, 'anhedral.cloudflare.json');
28
27
  return existsSync(canonical) ? canonical : path.join(directory, 'wrangler.jsonc');
29
28
  }
30
- export function usesVoid(project) {
31
- return project.deliveryEngine === 'void';
32
- }
33
- function mergeVoidConfig(previous, resolved, authored) {
34
- if (isDeepStrictEqual(previous, authored))
35
- return resolved;
36
- if (Array.isArray(previous) && Array.isArray(resolved) && Array.isArray(authored)) {
37
- const identity = (value) => {
38
- if (value && typeof value === 'object')
39
- for (const key of ['binding', 'name', 'tag', 'class_name', 'pattern', 'route']) {
40
- const item = value[key];
41
- if (typeof item === 'string')
42
- return `${key}:${item}`;
43
- }
44
- return JSON.stringify(value);
45
- };
46
- return [
47
- ...authored.map((item) => {
48
- const before = previous.find((entry) => identity(entry) === identity(item));
49
- const after = resolved.find((entry) => identity(entry) === identity(item));
50
- return before !== undefined && after !== undefined
51
- ? mergeVoidConfig(before, after, item)
52
- : item;
53
- }),
54
- ...resolved.filter((item) => !previous.some((entry) => identity(entry) === identity(item)) &&
55
- !authored.some((entry) => identity(entry) === identity(item))),
56
- ];
57
- }
58
- const object = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
59
- if (object(previous) && object(resolved) && object(authored)) {
60
- const result = {};
61
- for (const key of new Set([
62
- ...Object.keys(previous),
63
- ...Object.keys(resolved),
64
- ...Object.keys(authored),
65
- ])) {
66
- if (key in authored)
67
- Object.defineProperty(result, key, {
68
- value: mergeVoidConfig(previous[key], resolved[key], authored[key]),
69
- enumerable: true,
70
- });
71
- else if (!(key in previous) && key in resolved)
72
- Object.defineProperty(result, key, { value: resolved[key], enumerable: true });
73
- }
74
- return result;
75
- }
76
- return authored;
77
- }
78
- export function resolveVoidCloudflareConfig(authored, lock) {
79
- const value = structuredClone(authored);
80
- if (lock.version !== 1 ||
81
- !lock.source ||
82
- typeof lock.source !== 'object' ||
83
- Array.isArray(lock.source) ||
84
- !lock.resolved ||
85
- typeof lock.resolved !== 'object' ||
86
- Array.isArray(lock.resolved) ||
87
- typeof lock.text !== 'string')
88
- throw new Error('Invalid pinned Void resource lock.');
89
- // The generated Void configuration omits resource-ID scaffolding placeholders.
90
- // Match that authored input when applying Void's resolved resource identities.
91
- for (const [field, key] of [
92
- ['d1_databases', 'database_id'],
93
- ['kv_namespaces', 'id'],
94
- ['pipelines', 'stream'],
95
- ]) {
96
- if (Array.isArray(value[field]))
97
- for (const entry of value[field]) {
98
- if (entry && typeof entry[key] === 'string' && entry[key].startsWith('REPLACE_WITH_'))
99
- delete entry[key];
100
- }
101
- }
102
- return mergeVoidConfig(lock.source, lock.resolved, value);
103
- }
104
29
  export function readConfig(directory) {
105
30
  const errors = [];
106
31
  const value = parse(readFileSync(configurationFile(directory), 'utf8'), errors);
107
32
  if (errors.length || !value || typeof value !== 'object' || Array.isArray(value))
108
33
  throw new Error('Invalid Wrangler JSONC configuration.');
109
- const lockFile = path.join(directory, 'void.lock.json');
110
- if (existsSync(path.join(directory, 'anhedral.cloudflare.json')) && existsSync(lockFile)) {
111
- const lock = JSON.parse(readFileSync(lockFile, 'utf8'));
112
- return resolveVoidCloudflareConfig(value, lock);
113
- }
114
34
  return value;
115
35
  }
116
36
  export function targetDirectory(root, target) {
@@ -137,11 +57,11 @@ export function registerApplication(root, extendTargets = false) {
137
57
  throw new Error('Invalid Worker name.');
138
58
  return { id: entry.name, directory: `apps/${entry.name}`, workerName };
139
59
  })
140
- .sort((a, b) => (a.id === 'web' ? 1 : b.id === 'web' ? -1 : a.id.localeCompare(b.id)));
141
- const selectedEngine = targets.length &&
142
- targets.every((target) => existsSync(path.join(root, target.directory, 'void.config.ts')))
143
- ? 'void'
144
- : 'wrangler';
60
+ .sort((a, b) => {
61
+ const rank = (id) => (id === 'web' ? 2 : id === 'mobile' ? 1 : 0);
62
+ return rank(a.id) - rank(b.id) || a.id.localeCompare(b.id);
63
+ });
64
+ const selectedEngine = 'wrangler';
145
65
  if (existing) {
146
66
  if (existing.targets.some((target) => !targets.some((candidate) => candidate.id === target.id &&
147
67
  candidate.directory === target.directory &&
@@ -182,7 +102,7 @@ export function readApplication(root) {
182
102
  !/^[a-f0-9-]{36}$/i.test(project.id) ||
183
103
  project.ownership !== 'customer' ||
184
104
  project.provider !== 'cloudflare' ||
185
- !['void', 'wrangler'].includes(project.deliveryEngine) ||
105
+ project.deliveryEngine !== 'wrangler' ||
186
106
  !(project.accountId === null || accountPattern.test(project.accountId)) ||
187
107
  !['unconfigured', 'public', 'private'].includes(project.audience) ||
188
108
  !Array.isArray(project.targets))
@@ -1,40 +1,20 @@
1
- import { EAS_CLI_VERSION, STACK_DEPENDENCIES, VERCEL_CLI_VERSION } from './dependencies.js';
1
+ import { EAS_CLI_VERSION, STACK_DEPENDENCIES } from './dependencies.js';
2
2
  import { realpathSync } from 'node:fs';
3
3
  import { spawn } from 'node:child_process';
4
4
  import { readProjectSection } from './project-config.js';
5
5
  import { validateSetupPlan } from './readiness.js';
6
6
  import { resolveCommand } from './command.js';
7
7
  import { defaultRunner } from './project-state.js';
8
- import { providerConfiguration } from './providers/config.js';
9
8
  import { INTEGRATION_PROVIDERS, PROVIDER_DEFINITIONS, } from './providers/definitions.js';
10
9
  /** Deployment access is separate from application-user authentication. */
11
10
  export const PROVIDER_AUTH = [
12
11
  {
13
12
  id: 'cloudflare',
14
- products: [
15
- 'vinext',
16
- 'hono',
17
- 'd1',
18
- 'r2',
19
- 'kv',
20
- 'realtime',
21
- 'queues',
22
- 'cron',
23
- 'workflows',
24
- 'workers-ai',
25
- 'basin',
26
- ],
13
+ products: ['expo', 'hono', 'd1', 'r2'],
27
14
  login: ['pnpm', 'dlx', `wrangler@${STACK_DEPENDENCIES.wrangler}`, 'login'],
28
15
  identity: ['pnpm', 'dlx', `wrangler@${STACK_DEPENDENCIES.wrangler}`, 'whoami', '--json'],
29
16
  setup: 'Select and connect the intended Cloudflare account before shipping.',
30
17
  },
31
- {
32
- id: 'vercel',
33
- products: [],
34
- login: ['pnpm', 'dlx', `vercel@${VERCEL_CLI_VERSION}`, 'login'],
35
- identity: ['pnpm', 'dlx', `vercel@${VERCEL_CLI_VERSION}`, 'whoami'],
36
- setup: 'Connect the intended Vercel team and project before shipping.',
37
- },
38
18
  ...INTEGRATION_PROVIDERS.map((id) => {
39
19
  const definition = PROVIDER_DEFINITIONS[id];
40
20
  const { auth } = definition;
@@ -81,11 +61,7 @@ export function requiredProviders(root) {
81
61
  throw new Error('A valid Anhedral setup plan is required before authentication.');
82
62
  }
83
63
  validateSetupPlan(plan);
84
- const providers = PROVIDER_AUTH.filter((provider) => provider.products.some((product) => plan.products.includes(product)) ||
85
- (provider.id === 'cloudflare' &&
86
- plan.products.includes('next') &&
87
- plan.hosting === 'cloudflare') ||
88
- (provider.id === 'vercel' && plan.products.includes('next') && plan.hosting === 'vercel'));
64
+ const providers = PROVIDER_AUTH.filter((provider) => provider.products.some((product) => plan.products.includes(product)));
89
65
  return providers;
90
66
  }
91
67
  async function login(command, root) {
@@ -107,7 +83,6 @@ export async function authenticateProviders(root, options = {}, run = defaultRun
107
83
  if (options.provider && !required.some((item) => item.id === options.provider))
108
84
  throw new Error('Requested provider is not required by this project.');
109
85
  const selected = required.filter((item) => !options.provider || item.id === options.provider);
110
- const configuration = providerConfiguration(root);
111
86
  const checks = [];
112
87
  for (const provider of selected) {
113
88
  let state = 'unverified';
@@ -165,10 +140,6 @@ export async function authenticateProviders(root, options = {}, run = defaultRun
165
140
  endpoint = provider.runtime.endpoint;
166
141
  credentialAccess = 'runtime';
167
142
  }
168
- if (provider.regionalEndpoints) {
169
- const region = configuration.providers.posthog?.region;
170
- endpoint = region ? provider.regionalEndpoints[region] : undefined;
171
- }
172
143
  if (!credential)
173
144
  state = 'missing';
174
145
  else if (endpoint) {
@@ -9,7 +9,7 @@ export declare function inspectProviderReadiness(root: string, run?: DeliveryRun
9
9
  }[];
10
10
  prerequisitesReady: boolean;
11
11
  providers: {
12
- provider: "vercel" | "cloudflare";
12
+ provider: "cloudflare";
13
13
  connection: "verified" | "blocked";
14
14
  deployment: "active-recorded" | "unverified";
15
15
  nextAction?: string;
@@ -2,9 +2,7 @@ import { hasProjectSection, readProjectSection } from './project-config.js';
2
2
  import path from 'node:path';
3
3
  import { inspectProject } from './readiness.js';
4
4
  import { defaultRunner } from './project-state.js';
5
- import { vercelApplicationStatus } from './vercel.js';
6
5
  import { applicationStatus } from './delivery.js';
7
- import { supportsVoidRuntime, VOID_VERSION } from './void.js';
8
6
  import { supportsWorkspaceRuntime } from './runtime-policy.js';
9
7
  import { PACKAGE_MANAGER } from './dependencies.js';
10
8
  /** Explicit opt-in: checks local tools and existing provider context without setup or deployment. */
@@ -27,26 +25,11 @@ export async function inspectProviderReadiness(root, run = defaultRunner) {
27
25
  checks.push({ id, ok: false, detail, nextAction });
28
26
  }
29
27
  };
30
- let voidTargets = [];
31
- try {
32
- const manifest = readProjectSection(root, 'cloudflare');
33
- if (manifest.deliveryEngine === 'void' && Array.isArray(manifest.targets))
34
- voidTargets = manifest.targets.filter((target) => typeof target.directory === 'string' && /^apps\/[a-z0-9-]+$/.test(target.directory));
35
- }
36
- catch {
37
- // Provider readiness below reports invalid or unconfigured manifests.
38
- }
39
28
  checks.push({
40
29
  id: 'node',
41
- ok: voidTargets.length
42
- ? supportsVoidRuntime(process.versions.node)
43
- : supportsWorkspaceRuntime(process.versions.node),
44
- detail: voidTargets.length
45
- ? 'Void applications require Node.js 24.21.0 or newer.'
46
- : 'Generated workspaces require Node 22.13+ on 22.x, or Node 24+.',
30
+ ok: supportsWorkspaceRuntime(process.versions.node),
31
+ detail: 'Generated workspaces require Node 22.13+ on 22.x, or Node 24+.',
47
32
  });
48
- for (const target of voidTargets)
49
- await check(`void:${target.directory}`, async () => (await run('pnpm', ['exec', 'void', '--version'], path.join(root, target.directory), environment)).trim() === VOID_VERSION, `Pinned Void ${VOID_VERSION} is available in ${target.directory}`, 'Install the committed workspace lockfile and the pinned Void version.');
50
33
  await check('pnpm', async () => (await run('pnpm', ['--version'], root, environment)).trim() ===
51
34
  PACKAGE_MANAGER.slice('pnpm@'.length), `${PACKAGE_MANAGER} is available`, `Install ${PACKAGE_MANAGER} before operating this workspace.`);
52
35
  await check('git', async () => (await run('git', ['--version'], root, environment)).startsWith('git version '), 'Git is available', 'Install Git.');
@@ -58,17 +41,15 @@ export async function inspectProviderReadiness(root, run = defaultRunner) {
58
41
  return typeof user.login === 'string' && /^[a-zA-Z0-9-]+$/.test(user.login);
59
42
  }, 'GitHub CLI can identify its authenticated account', 'Complete gh auth login locally for the intended GitHub account.');
60
43
  const providers = [];
61
- for (const provider of ['vercel', 'cloudflare']) {
44
+ for (const provider of ['cloudflare']) {
62
45
  try {
63
46
  if (!hasProjectSection(root, provider))
64
47
  continue;
65
48
  const manifest = readProjectSection(root, provider);
66
- const connected = provider === 'vercel' ? manifest.projectId && manifest.teamId : manifest.accountId;
49
+ const connected = manifest.accountId;
67
50
  if (!connected || manifest.audience === 'unconfigured')
68
51
  throw new Error('unconfigured');
69
- const status = provider === 'vercel'
70
- ? await vercelApplicationStatus(root, true, run)
71
- : await applicationStatus(root, true, run);
52
+ const status = await applicationStatus(root, true, run);
72
53
  const active = 'activeRecordedVersion' in status
73
54
  ? status.activeRecordedVersion === true
74
55
  : status.provider.length > 0 &&
@@ -8,106 +8,6 @@ function same(value, expected, description) {
8
8
  if (value !== expected)
9
9
  throw new Error(`Provider ${description} differs from the selected configuration.`);
10
10
  }
11
- async function neon(context) {
12
- const { settings: config, api } = context;
13
- let id = setting(config, 'projectId');
14
- if (!id) {
15
- const response = await create(context, 'project', '/api/v2/projects', {
16
- project: {
17
- name: setting(config, 'name'),
18
- org_id: setting(config, 'organizationId'),
19
- region_id: setting(config, 'region'),
20
- default_branch: {
21
- name: 'main',
22
- database_name: setting(config, 'database'),
23
- role_name: setting(config, 'role'),
24
- },
25
- },
26
- });
27
- id = resourceId(object(response.project).id);
28
- }
29
- id = resourceId(id);
30
- const project = object(object(await api(`/api/v2/projects/${id}`)).project);
31
- same(project.org_id, setting(config, 'organizationId'), 'Neon organization');
32
- if (project.suspended === true)
33
- throw new Error('Neon project is suspended.');
34
- const operations = list(object(await api(`/api/v2/projects/${id}/operations`)).operations);
35
- if (operations.some((operation) => !['finished', 'skipped'].includes(String(operation.status))))
36
- return result({ project: id }, {}, ['Neon operations are pending or failed. Inspect the project, then run ship again.'], false);
37
- const query = new URLSearchParams({
38
- database_name: setting(config, 'database'),
39
- role_name: setting(config, 'role'),
40
- pooled: 'true',
41
- });
42
- const uri = text(object(await api(`/api/v2/projects/${id}/connection_uri?${query}`)).uri);
43
- const parsed = new URL(uri);
44
- if (!['postgres:', 'postgresql:'].includes(parsed.protocol) ||
45
- !parsed.hostname.endsWith('.neon.tech'))
46
- throw new Error('Neon returned an unexpected database connection.');
47
- return result({ project: id }, { DATABASE_URL: uri }, [
48
- 'Configure DATABASE_URL_UNPOOLED with the intended direct migration connection in ignored packages/db/.env; runtime provisioning does not configure migration credentials.',
49
- 'Run pnpm db:generate, review the SQL, then run pnpm db:migrate against the intended database before testing authentication or application data.',
50
- ]);
51
- }
52
- async function clerk(context) {
53
- const { settings: config, api } = context;
54
- const principal = object(await api('/v1/platform/me'));
55
- same(principal.subject, setting(config, 'workspaceId'), 'Clerk workspace');
56
- let id = setting(config, 'applicationId');
57
- if (!id)
58
- id = resourceId((await create(context, 'application', '/v1/platform/applications', {
59
- name: setting(config, 'name'),
60
- environment_types: [setting(config, 'environment')],
61
- })).application_id);
62
- id = resourceId(id);
63
- const application = object(await api(`/v1/platform/applications/${id}?include_secret_keys=true`));
64
- same(application.application_id, id, 'Clerk application');
65
- const instances = list(application.instances).filter((instance) => instance.environment_type === config.environment);
66
- if (instances.length !== 1)
67
- throw new Error('Clerk did not return exactly one selected environment.');
68
- const instance = instances[0];
69
- const publishable = text(instance.publishable_key);
70
- const secret = text(instance.secret_key);
71
- const mode = config.environment === 'production' ? 'live' : 'test';
72
- if (!publishable.startsWith(`pk_${mode}_`) || !secret.startsWith(`sk_${mode}_`))
73
- throw new Error('Clerk keys do not match the selected environment.');
74
- return result({ application: id, instance: resourceId(instance.instance_id) }, {
75
- CLERK_SECRET_KEY: secret,
76
- CLERK_PUBLISHABLE_KEY: publishable,
77
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: publishable,
78
- }, config.environment === 'production'
79
- ? ['Verify the production Clerk domain, DNS and enabled OAuth providers before delivery.']
80
- : []);
81
- }
82
- async function resend(context) {
83
- const { settings: config, api } = context;
84
- let id = setting(config, 'domainId');
85
- if (!id)
86
- id = resourceId((await create(context, 'domain', '/domains', {
87
- name: setting(config, 'domain'),
88
- ...(setting(config, 'region') ? { region: config.region } : {}),
89
- })).id);
90
- id = resourceId(id);
91
- let domain = object(await api(`/domains/${id}`));
92
- same(domain.name, setting(config, 'domain'), 'Resend domain');
93
- if (domain.status !== 'verified') {
94
- await api(`/domains/${id}/verify`, 'POST');
95
- domain = object(await api(`/domains/${id}`));
96
- }
97
- if (domain.status !== 'verified') {
98
- const records = list(domain.records).map((record) => `${text(record.type)} ${text(record.name)} ${text(record.value)}${record.priority === undefined ? '' : ` (priority ${Number(record.priority)})`}`);
99
- return result({ domain: id }, {}, ['Publish the Resend DNS records, wait for verification, then run ship again.', ...records], false);
100
- }
101
- const key = await create(context, 'sending-key', '/api-keys', {
102
- name: `anhedral-${id}`.slice(0, 50),
103
- permission: 'sending_access',
104
- domain_id: id,
105
- });
106
- const keys = object(await api('/api-keys'));
107
- if (keys.has_more === true || !list(keys.data).some((entry) => entry.id === key.id))
108
- throw new Error('Resend did not confirm the recorded sending key; inspect key access before configuring runtime.');
109
- return result({ domain: id, sendingKey: resourceId(key.id) }, { RESEND_API_KEY: text(key.token) });
110
- }
111
11
  async function stripe(context) {
112
12
  const { settings: config, api, environment } = context;
113
13
  const account = object(await api('/v1/account'));
@@ -117,7 +17,10 @@ async function stripe(context) {
117
17
  if (!prefix.test(key))
118
18
  throw new Error('Stripe key does not match the selected test/live mode.');
119
19
  const resources = { account: resourceId(account.id) };
120
- const runtime = { STRIPE_SECRET_KEY: key };
20
+ const runtime = {
21
+ STRIPE_SECRET_KEY: key,
22
+ BILLING_ENVIRONMENT: config.mode === 'live' ? 'production' : 'sandbox',
23
+ };
121
24
  if (setting(config, 'webhookUrl')) {
122
25
  const webhook = await create(context, 'webhook', '/v1/webhook_endpoints', {
123
26
  url: config.webhookUrl,
@@ -139,75 +42,6 @@ async function stripe(context) {
139
42
  ? ['Complete Stripe account activation before accepting live payments.']
140
43
  : []);
141
44
  }
142
- async function sentry(context) {
143
- const { settings: config, api } = context;
144
- const organization = resourceId(config.organization);
145
- const team = resourceId(config.team);
146
- const slug = resourceId(config.project);
147
- const projects = list(await api(`/api/0/teams/${organization}/${team}/projects/`));
148
- const matching = projects.filter((project) => project.slug === slug);
149
- if (matching.length > 1)
150
- throw new Error('Sentry project selection is ambiguous.');
151
- if (!matching.length)
152
- await create(context, 'project', `/api/0/teams/${organization}/${team}/projects/`, {
153
- name: setting(config, 'name') || slug,
154
- slug,
155
- platform: config.platform,
156
- default_rules: false,
157
- });
158
- const project = object(await api(`/api/0/projects/${organization}/${slug}/`));
159
- same(object(project.organization).slug, organization, 'Sentry organization');
160
- same(project.platform, setting(config, 'platform'), 'Sentry platform');
161
- if (!list(project.teams).some((entry) => entry.slug === team))
162
- throw new Error('Sentry project belongs to a different team.');
163
- let keys = list(await api(`/api/0/projects/${organization}/${slug}/keys/`)).filter((key) => key.isActive === true);
164
- if (!keys.length) {
165
- await create(context, 'client-key', `/api/0/projects/${organization}/${slug}/keys/`, {
166
- name: 'Anhedral',
167
- });
168
- keys = list(await api(`/api/0/projects/${organization}/${slug}/keys/`)).filter((key) => key.isActive === true);
169
- }
170
- if (keys.length !== 1)
171
- throw new Error('Select exactly one active Sentry client key before configuring.');
172
- const dsn = text(object(keys[0].dsn).public);
173
- if (new URL(dsn).protocol !== 'https:')
174
- throw new Error('Sentry DSN must use HTTPS.');
175
- return result({ project: resourceId(project.id) }, { SENTRY_DSN: dsn });
176
- }
177
- async function posthog(context) {
178
- const { settings: config, api } = context;
179
- const organization = resourceId(config.organizationId);
180
- let id = setting(config, 'projectId');
181
- if (!id)
182
- id = resourceId((await create(context, 'project', `/api/organizations/${organization}/projects/`, {
183
- name: config.name,
184
- })).id);
185
- id = resourceId(id);
186
- const project = object(await api(`/api/organizations/${organization}/projects/${id}/`));
187
- same(resourceId(project.id), id, 'PostHog project');
188
- same(project.organization, organization, 'PostHog organization');
189
- return result({ project: id }, {
190
- POSTHOG_API_KEY: text(project.api_token),
191
- POSTHOG_HOST: config.region === 'eu' ? 'https://eu.i.posthog.com' : 'https://us.i.posthog.com',
192
- });
193
- }
194
- async function openai(context) {
195
- const { settings: config, api } = context;
196
- let id = setting(config, 'projectId');
197
- if (!id)
198
- id = resourceId((await create(context, 'project', '/v1/organization/projects', { name: config.name })).id);
199
- id = resourceId(id);
200
- const project = object(await api(`/v1/organization/projects/${id}`));
201
- same(project.id, id, 'OpenAI project');
202
- if (project.status !== 'active')
203
- throw new Error('OpenAI project is not active.');
204
- const account = await create(context, 'service-account', `/v1/organization/projects/${id}/service_accounts`, { name: config.serviceAccountName });
205
- const accountId = resourceId(account.id);
206
- const current = object(await api(`/v1/organization/projects/${id}/service_accounts/${accountId}`));
207
- same(current.id, accountId, 'OpenAI service account');
208
- same(current.name, setting(config, 'serviceAccountName'), 'OpenAI service account name');
209
- return result({ project: id, serviceAccount: accountId }, { OPENAI_API_KEY: text(object(account.api_key).value) });
210
- }
211
45
  async function revenuecat(context) {
212
46
  const { settings: config, api } = context;
213
47
  let id = setting(config, 'projectId');
@@ -217,7 +51,7 @@ async function revenuecat(context) {
217
51
  const project = object(await api(`/v2/projects/${id}`));
218
52
  same(project.id, id, 'RevenueCat project');
219
53
  const resources = { project: id };
220
- const runtime = {};
54
+ const runtime = { REVENUECAT_PROJECT_ID: id };
221
55
  if (setting(config, 'webAppId') || setting(config, 'stripeAccountId')) {
222
56
  let appId = setting(config, 'webAppId');
223
57
  if (!appId)
@@ -256,17 +90,14 @@ async function revenuecat(context) {
256
90
  resources[`${platform}App`] = appId;
257
91
  runtime[`EXPO_PUBLIC_REVENUECAT_${platform.toUpperCase()}_API_KEY`] = text(keys[0].key);
258
92
  }
93
+ const appIds = ['iosApp', 'androidApp', 'webApp'].flatMap((name) => resources[name] ? [resources[name]] : []);
94
+ if (appIds.length)
95
+ runtime.REVENUECAT_APP_IDS_JSON = JSON.stringify(appIds);
259
96
  return result(resources, runtime, [
260
- 'Configure store credentials or the Stripe connection, products and offerings and verify purchases before enabling billing. SDK keys alone do not activate subscriptions.',
97
+ 'Configure the dedicated server RevenueCat v1 API key and authenticated webhook integration separately from the v2 management credential. Configure store credentials or the Stripe connection, products and offerings and verify purchases before enabling billing. SDK keys alone do not activate subscriptions.',
261
98
  ]);
262
99
  }
263
100
  export const PROVIDER_ADAPTERS = {
264
- neon,
265
- clerk,
266
- resend,
267
101
  stripe,
268
102
  revenuecat,
269
- sentry,
270
- posthog,
271
- openai,
272
103
  };
@@ -26,4 +26,4 @@ export interface ProviderRetryOptions {
26
26
  }
27
27
  /** Fixed origins, bounded reads and sanitized errors keep management keys out of output.
28
28
  * Only GET requests retry transient failures; unknown mutation outcomes never replay. */
29
- export declare function providerApi(id: IntegrationProvider, settings: ProviderSettings, environment: NodeJS.ProcessEnv, send: typeof fetch, options?: ProviderRetryOptions): ApiRequest;
29
+ export declare function providerApi(id: IntegrationProvider, _settings: ProviderSettings, environment: NodeJS.ProcessEnv, send: typeof fetch, options?: ProviderRetryOptions): ApiRequest;
@@ -153,13 +153,13 @@ function requestedDelay(value, maximum) {
153
153
  }
154
154
  /** Fixed origins, bounded reads and sanitized errors keep management keys out of output.
155
155
  * Only GET requests retry transient failures; unknown mutation outcomes never replay. */
156
- export function providerApi(id, settings, environment, send, options = {}) {
156
+ export function providerApi(id, _settings, environment, send, options = {}) {
157
157
  const token = environment[CREDENTIALS[id]];
158
158
  if (!token || /[^\x21-\x7e]/.test(token))
159
159
  throw new Error(`${id}: supply ${CREDENTIALS[id]}.`);
160
160
  const policy = retryPolicy(options);
161
161
  const definition = PROVIDER_DEFINITIONS[id];
162
- const origin = definition.regionalOrigins?.[settings.region ?? ''] ?? definition.origin;
162
+ const origin = definition.origin;
163
163
  return async (route, method = 'GET', body, operation) => {
164
164
  if (!route.startsWith('/') ||
165
165
  route.startsWith('//') ||
@@ -192,7 +192,7 @@ export function providerApi(id, settings, environment, send, options = {}) {
192
192
  headers['Content-Type'] = 'application/json';
193
193
  }
194
194
  }
195
- if (operation && (id === 'stripe' || id === 'resend'))
195
+ if (operation && id === 'stripe')
196
196
  headers['Idempotency-Key'] = operation;
197
197
  const started = performance.now();
198
198
  const attempts = method === 'GET' ? policy.maxAttempts : 1;