anhedral 0.13.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 (170) hide show
  1. package/README.md +35 -232
  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 -50
  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 -86
  26. package/dist/delivery-evidence.d.ts +1 -1
  27. package/dist/delivery-evidence.js +7 -36
  28. package/dist/delivery.d.ts +2 -8
  29. package/dist/delivery.js +20 -101
  30. package/dist/dependencies.d.ts +6 -57
  31. package/dist/dependencies.js +54 -188
  32. package/dist/index.d.ts +1 -4
  33. package/dist/index.js +1 -4
  34. package/dist/inspector-model.d.ts +2 -2
  35. package/dist/integration-service-readers.d.ts +1 -2
  36. package/dist/integration-service-readers.js +3 -84
  37. package/dist/lifecycle-model.d.ts +1 -1
  38. package/dist/lifecycle-model.js +1 -1
  39. package/dist/mobile-delivery.d.ts +1 -1
  40. package/dist/mobile-delivery.js +4 -0
  41. package/dist/platforms/mobile.js +30 -121
  42. package/dist/platforms/web.d.ts +3 -0
  43. package/dist/platforms/web.js +299 -0
  44. package/dist/project-config.d.ts +1 -1
  45. package/dist/project-config.js +0 -1
  46. package/dist/project-inspector.js +5 -36
  47. package/dist/project-state.d.ts +1 -3
  48. package/dist/project-state.js +2 -85
  49. package/dist/provider-auth.js +3 -38
  50. package/dist/provider-readiness.d.ts +1 -1
  51. package/dist/provider-readiness.js +5 -24
  52. package/dist/providers/adapters.js +0 -175
  53. package/dist/providers/api.d.ts +1 -1
  54. package/dist/providers/api.js +3 -3
  55. package/dist/providers/config.js +2 -48
  56. package/dist/providers/definitions.d.ts +1 -204
  57. package/dist/providers/definitions.js +0 -85
  58. package/dist/providers/provision.d.ts +1 -1
  59. package/dist/providers/receipts.js +1 -11
  60. package/dist/providers/recovery-verification.js +1 -61
  61. package/dist/providers/runtime.js +4 -35
  62. package/dist/providers/state.js +1 -7
  63. package/dist/provision.d.ts +5 -13
  64. package/dist/provision.js +4 -80
  65. package/dist/readiness.d.ts +1 -1
  66. package/dist/readiness.js +3 -8
  67. package/dist/registry/add.js +10 -70
  68. package/dist/registry/bootstrap.d.ts +3 -2
  69. package/dist/registry/bootstrap.js +4 -13
  70. package/dist/registry/commands.js +8 -10
  71. package/dist/registry/context.js +0 -1
  72. package/dist/registry/options.js +8 -38
  73. package/dist/registry/resolve.d.ts +3 -4
  74. package/dist/registry/resolve.js +26 -108
  75. package/dist/registry/types.d.ts +1 -7
  76. package/dist/registry/usage.js +2 -2
  77. package/dist/runtime-policy.d.ts +0 -2
  78. package/dist/runtime-policy.js +0 -16
  79. package/dist/scaffold/auth.d.ts +1 -2
  80. package/dist/scaffold/auth.js +55 -130
  81. package/dist/scaffold/backend.d.ts +0 -4
  82. package/dist/scaffold/backend.js +1 -186
  83. package/dist/scaffold/billing-schema.d.ts +1 -1
  84. package/dist/scaffold/billing-schema.js +4 -4
  85. package/dist/scaffold/billing.js +11 -19
  86. package/dist/scaffold/bootstrap.d.ts +2 -3
  87. package/dist/scaffold/bootstrap.js +37 -43
  88. package/dist/scaffold/compose.js +2 -14
  89. package/dist/scaffold/database.d.ts +1 -1
  90. package/dist/scaffold/database.js +18 -126
  91. package/dist/scaffold/documentation.d.ts +0 -1
  92. package/dist/scaffold/documentation.js +22 -86
  93. package/dist/scaffold/expo-auth.js +33 -22
  94. package/dist/scaffold/expo-billing.js +17 -52
  95. package/dist/scaffold/expo-runtime.d.ts +2 -2
  96. package/dist/scaffold/expo-runtime.js +6 -97
  97. package/dist/scaffold/integrations.d.ts +1 -3
  98. package/dist/scaffold/integrations.js +9 -10
  99. package/dist/scaffold/managed-email.d.ts +3 -0
  100. package/dist/scaffold/managed-email.js +47 -0
  101. package/dist/scaffold/native-ui.d.ts +2 -0
  102. package/dist/scaffold/native-ui.js +69 -0
  103. package/dist/scaffold/password-reset.d.ts +1 -0
  104. package/dist/scaffold/password-reset.js +99 -0
  105. package/dist/scaffold/private-files.d.ts +2 -0
  106. package/dist/scaffold/private-files.js +78 -0
  107. package/dist/scaffold/stack-documentation.d.ts +0 -1
  108. package/dist/scaffold/stack-documentation.js +3 -49
  109. package/dist/scaffold/styling.d.ts +1 -1
  110. package/dist/scaffold/styling.js +20 -28
  111. package/dist/scaffold/web-billing.d.ts +2 -0
  112. package/dist/scaffold/web-billing.js +48 -0
  113. package/dist/scaffold/workspace.js +53 -194
  114. package/dist/service-deletion.js +1 -1
  115. package/dist/service-descriptor.js +5 -12
  116. package/dist/service-model.d.ts +1 -1
  117. package/dist/service-operations.js +2 -32
  118. package/dist/service-readers.js +1 -32
  119. package/dist/services-command.d.ts +1 -1
  120. package/dist/services-command.js +3 -9
  121. package/dist/ship.d.ts +3 -316
  122. package/dist/ship.js +10 -142
  123. package/dist/stack-registry.d.ts +2 -52
  124. package/dist/stack-registry.js +55 -403
  125. package/dist/standard.js +7 -14
  126. package/dist/version.d.ts +1 -1
  127. package/dist/version.js +1 -1
  128. package/docs/anhedral-stack.md +23 -122
  129. package/docs/assets/anhedral-stack-light.png +0 -0
  130. package/docs/assets/anhedral-stack.png +0 -0
  131. package/docs/software-factory.md +24 -557
  132. package/docs/stack-standard.md +47 -294
  133. package/docs/verification.md +320 -0
  134. package/package.json +20 -22
  135. package/dist/neon-service-data.d.ts +0 -8
  136. package/dist/neon-service-data.js +0 -117
  137. package/dist/platforms/desktop.d.ts +0 -2
  138. package/dist/platforms/desktop.js +0 -415
  139. package/dist/platforms/extension.d.ts +0 -2
  140. package/dist/platforms/extension.js +0 -328
  141. package/dist/registry/presets.d.ts +0 -4
  142. package/dist/registry/presets.js +0 -41
  143. package/dist/scaffold/cloudflare-services.d.ts +0 -8
  144. package/dist/scaffold/cloudflare-services.js +0 -198
  145. package/dist/scaffold/lint.d.ts +0 -4
  146. package/dist/scaffold/lint.js +0 -56
  147. package/dist/scaffold/neon-realtime.d.ts +0 -2
  148. package/dist/scaffold/neon-realtime.js +0 -97
  149. package/dist/scaffold/services.d.ts +0 -5
  150. package/dist/scaffold/services.js +0 -108
  151. package/dist/scaffold/stream.d.ts +0 -2
  152. package/dist/scaffold/stream.js +0 -114
  153. package/dist/scaffold/void.d.ts +0 -4
  154. package/dist/scaffold/void.js +0 -264
  155. package/dist/scaffold/web.d.ts +0 -2
  156. package/dist/scaffold/web.js +0 -130
  157. package/dist/vercel-project.d.ts +0 -101
  158. package/dist/vercel-project.js +0 -305
  159. package/dist/vercel.d.ts +0 -67
  160. package/dist/vercel.js +0 -581
  161. package/dist/vinext.d.ts +0 -2
  162. package/dist/vinext.js +0 -86
  163. package/dist/void-execution.d.ts +0 -10
  164. package/dist/void-execution.js +0 -94
  165. package/dist/void-migrations.d.ts +0 -6
  166. package/dist/void-migrations.js +0 -110
  167. package/dist/void-state.d.ts +0 -16
  168. package/dist/void-state.js +0 -65
  169. package/dist/void.d.ts +0 -3
  170. package/dist/void.js +0 -5
@@ -1,4 +1,3 @@
1
- import { STANDARD_PRODUCTS } from './stack-registry.js';
2
1
  export const GLOBAL_OPTIONS = [
3
2
  {
4
3
  flag: '--cwd',
@@ -43,7 +42,7 @@ export const COMMANDS = {
43
42
  flag: '--table',
44
43
  value: 'table',
45
44
  arity: 'required',
46
- description: 'Existing database table or keys for KV metadata.',
45
+ description: 'Existing D1 database table.',
47
46
  },
48
47
  {
49
48
  flag: '--offset',
@@ -71,7 +70,7 @@ export const COMMANDS = {
71
70
  },
72
71
  ],
73
72
  examples: ['services list --json', 'services status binding:apps/api:D1:DB --json'],
74
- note: 'Provider calls occur only when requested. Data output can contain private values. Deletion is limited to verified project-created D1/KV resources and requires a fresh plan and typed resource name.',
73
+ note: 'Provider calls occur only when requested. Data output can contain private values. Deletion is limited to verified project-created D1 databases and requires a fresh plan and typed resource name.',
75
74
  },
76
75
  inspect: {
77
76
  description: 'Inspect local stack, setup requirements and recorded delivery evidence.',
@@ -105,45 +104,23 @@ export const COMMANDS = {
105
104
  ],
106
105
  examples: [
107
106
  'integrations status --json',
108
- 'integrations recover --provider neon --operation recorded-hash --resource existing-id',
107
+ 'integrations recover --provider revenuecat --operation recorded-hash --resource existing-id',
109
108
  ],
110
109
  note: 'Status is read-only. Recovery verifies provider identity before updating a local receipt. Unsupported receipt schemas are rejected. Recovery cannot reconstruct missing one-time credentials.',
111
110
  },
112
111
  init: {
113
- description: 'Scaffold a project from the bundled stack registry.',
114
- usage: 'init [directory] [products...] [options]',
112
+ description: 'Create Next.js web + native Expo + Hono + Drizzle/D1 + private R2.',
113
+ usage: 'init [directory] [options]',
115
114
  options: [
116
- ...STANDARD_PRODUCTS.map((name) => ({
117
- flag: `--${name}`,
118
- description: `Include ${name}.`,
119
- hidden: true,
120
- })),
121
- {
122
- flag: '--preset',
123
- description: 'Start minimal or select the complete compatible product stack.',
124
- value: 'minimal|full-product',
125
- arity: 'required',
126
- },
127
- {
128
- flag: '--hosting',
129
- description: 'Select web hosting.',
130
- value: 'cloudflare|vercel',
131
- arity: 'required',
132
- },
133
- {
134
- flag: '--skip-install',
135
- description: 'Skip the final install (bootstrap still needs network).',
136
- },
137
- { flag: '--git', description: 'Initialize a project repository or skip it.' },
138
- { flag: '--no-git', description: 'Initialize a project repository or skip it.' },
139
- { flag: '--dry-run', description: 'Preview the selected stack without writes or network.' },
115
+ { flag: '--stripe', description: 'Add Stripe web billing.' },
116
+ { flag: '--revenuecat', description: 'Add RevenueCat native purchases.' },
117
+ { flag: '--skip-install', description: 'Skip dependency installation.' },
118
+ { flag: '--git', description: 'Initialize a project repository.' },
119
+ { flag: '--no-git', description: 'Skip Git initialization.' },
120
+ { flag: '--dry-run', description: 'Preview without writes or network.' },
140
121
  ],
141
- examples: [
142
- 'init client-app',
143
- 'init product --preset full-product --dry-run',
144
- 'init product --next --hono --neon --clerk --dry-run',
145
- ],
146
- note: `Default: minimal Expo web/iOS/Android app on Cloudflare; no API, auth, database or paid integrations. Add capabilities with resolved dependencies, or use --preset full-product.\nProducts: ${STANDARD_PRODUCTS.join(', ')}\nOnly bundled options are supported. --all is intentionally unsupported.`,
122
+ examples: ['init client-app', 'init client-app --stripe --revenuecat --dry-run'],
123
+ note: 'The complete core foundation is always included. Stripe and RevenueCat are the only optional additions. Generation does not provision cloud resources.',
147
124
  },
148
125
  auth: {
149
126
  description: 'Check or guide authentication for the selected providers.',
@@ -158,7 +135,7 @@ export const COMMANDS = {
158
135
  { flag: '--status', description: 'Check existing access without opening login.' },
159
136
  { flag: '--non-interactive', description: 'Never open an interactive login.' },
160
137
  ],
161
- examples: ['auth', 'auth --status --json', 'auth --provider neon'],
138
+ examples: ['auth', 'auth --status --json', 'auth --provider revenuecat'],
162
139
  note: 'Management keys come from the environment. Login does not establish all write permissions or complete provider setup. Complete provider settings in anhedral.json (providers) before shipping.',
163
140
  },
164
141
  ship: {
@@ -168,8 +145,8 @@ export const COMMANDS = {
168
145
  { flag: '--dry-run', description: 'Preview provisioning and deployment without mutations.' },
169
146
  {
170
147
  flag: '--provider',
171
- description: 'Select hosting in a mixed project.',
172
- value: 'cloudflare|vercel',
148
+ description: 'Select Cloudflare hosting.',
149
+ value: 'cloudflare',
173
150
  arity: 'required',
174
151
  },
175
152
  {
@@ -189,8 +166,8 @@ export const COMMANDS = {
189
166
  note: 'Connect the intended hosting account and audience first. Commit source before shipping; resolved tracked bindings require review and another commit. Mobile builds return links and never submit to stores.',
190
167
  },
191
168
  add: {
192
- description: 'Add bundled stack parts while preserving edited source.',
193
- usage: 'add <items...> [options]',
169
+ description: 'Add Stripe or RevenueCat while preserving edited source.',
170
+ usage: 'add <stripe|revenuecat> [...] [options]',
194
171
  options: [
195
172
  { flag: '--dry-run', description: 'Preview changed paths without installing them.' },
196
173
  {
@@ -208,22 +185,17 @@ export const COMMANDS = {
208
185
  { flag: '--skip-install', description: 'Skip the final dependency install.' },
209
186
  ],
210
187
  examples: [
211
- 'add resend',
212
- '--cwd client-app add resend --dry-run',
213
- 'add resend --diff --cwd client-app',
188
+ 'add stripe',
189
+ '--cwd client-app add stripe --dry-run',
190
+ 'add stripe --diff --cwd client-app',
214
191
  ],
215
- note: 'Source previews are local and bounded. A new web bootstrap cannot be previewed offline; the plan reports that limitation. Edited-source conflicts require review; there is no force overwrite.',
192
+ note: 'Source previews are local and bounded. Edited-source conflicts require review; there is no force overwrite.',
216
193
  },
217
194
  registry: {
218
- description: 'Inspect the bundled stack catalog and setup requirements.',
219
- usage: 'registry list | view <item> | capabilities [options]',
195
+ description: 'Inspect the core stack and payment additions.',
196
+ usage: 'registry list | view <item> | capabilities',
220
197
  options: [],
221
- examples: [
222
- 'registry list',
223
- 'registry view neon',
224
- 'registry capabilities',
225
- 'registry capabilities --json',
226
- ],
198
+ examples: ['registry list', 'registry view stripe', 'registry capabilities --json'],
227
199
  },
228
200
  doctor: {
229
201
  description: 'Check project provenance and local readiness without writes.',
@@ -240,7 +212,7 @@ export const COMMANDS = {
240
212
  {
241
213
  flag: '--provider',
242
214
  description: 'Select the hosting provider.',
243
- value: 'cloudflare|vercel',
215
+ value: 'cloudflare',
244
216
  arity: 'required',
245
217
  },
246
218
  {
@@ -262,21 +234,8 @@ export const COMMANDS = {
262
234
  arity: 'required',
263
235
  repeatable: true,
264
236
  },
265
- { flag: '--scope', description: 'Select the Vercel team.', value: 'team', arity: 'required' },
266
- {
267
- flag: '--use',
268
- description: 'Declare Vercel usage.',
269
- value: 'personal|commercial',
270
- arity: 'required',
271
- },
272
- { flag: '--create', description: 'Create the selected Vercel project.' },
273
- { flag: '--git', description: 'Connect the verified GitHub repository.' },
274
- ],
275
- examples: [
276
- 'connect --provider cloudflare --audience public',
277
- 'connect --scope customer --audience private --use commercial --create',
278
237
  ],
279
- note: 'Vercel Hobby is personal/non-commercial. Commercial applications need an eligible existing plan; no paid plan is activated automatically.',
238
+ examples: ['connect --provider cloudflare --audience public'],
280
239
  },
281
240
  repository: {
282
241
  description: 'Connect or create the application owner’s GitHub repository.',
@@ -301,12 +260,12 @@ export const COMMANDS = {
301
260
  },
302
261
  register: {
303
262
  description: 'Record application identity and delivery targets.',
304
- usage: 'register [directory] [--provider cloudflare|vercel]',
263
+ usage: 'register [directory] [--provider cloudflare]',
305
264
  options: [
306
265
  {
307
266
  flag: '--provider',
308
267
  description: 'Select the provider.',
309
- value: 'cloudflare|vercel',
268
+ value: 'cloudflare',
310
269
  arity: 'required',
311
270
  },
312
271
  ],
@@ -318,7 +277,7 @@ export const COMMANDS = {
318
277
  options: [
319
278
  {
320
279
  flag: '--provider',
321
- description: 'Select Cloudflare in a mixed project.',
280
+ description: 'Select Cloudflare hosting.',
322
281
  value: 'cloudflare',
323
282
  arity: 'required',
324
283
  },
@@ -334,7 +293,7 @@ export const COMMANDS = {
334
293
  {
335
294
  flag: '--provider',
336
295
  description: 'Select hosting.',
337
- value: 'cloudflare|vercel',
296
+ value: 'cloudflare',
338
297
  arity: 'required',
339
298
  },
340
299
  { flag: '--refresh', description: 'Refresh provider evidence.' },
@@ -348,7 +307,7 @@ export const COMMANDS = {
348
307
  {
349
308
  flag: '--provider',
350
309
  description: 'Select hosting.',
351
- value: 'cloudflare|vercel',
310
+ value: 'cloudflare',
352
311
  arity: 'required',
353
312
  },
354
313
  { flag: '--local', description: 'Use local evidence without provider refresh.' },
@@ -363,23 +322,13 @@ export const COMMANDS = {
363
322
  {
364
323
  flag: '--provider',
365
324
  description: 'Select hosting.',
366
- value: 'cloudflare|vercel',
325
+ value: 'cloudflare',
367
326
  arity: 'required',
368
327
  },
369
328
  { flag: '--refresh', description: 'Refresh provider evidence.' },
370
329
  ],
371
330
  examples: ['verify'],
372
331
  },
373
- adopt: {
374
- description: 'Record a verified existing Vercel Git deployment.',
375
- usage: 'adopt [directory] [--provider vercel]',
376
- options: [
377
- { flag: '--provider', description: 'Select Vercel.', value: 'vercel', arity: 'required' },
378
- { flag: '--refresh', description: 'Refresh provider evidence.' },
379
- ],
380
- examples: ['adopt --provider vercel'],
381
- note: 'Does not push or deploy.',
382
- },
383
332
  recover: {
384
333
  description: 'Recover verified hosting state or a proven interrupted local lock.',
385
334
  usage: 'recover [directory] [options]',
@@ -391,7 +340,7 @@ export const COMMANDS = {
391
340
  {
392
341
  flag: '--provider',
393
342
  description: 'Select hosting.',
394
- value: 'cloudflare|vercel',
343
+ value: 'cloudflare',
395
344
  arity: 'required',
396
345
  },
397
346
  { flag: '--refresh', description: 'Refresh provider evidence.' },
@@ -406,7 +355,7 @@ export const COMMANDS = {
406
355
  {
407
356
  flag: '--provider',
408
357
  description: 'Select hosting.',
409
- value: 'cloudflare|vercel',
358
+ value: 'cloudflare',
410
359
  arity: 'required',
411
360
  },
412
361
  {
@@ -48,7 +48,7 @@ export interface ActiveVersion {
48
48
  percentage: number;
49
49
  }
50
50
  export declare function activeVersions(value: unknown): ActiveVersion[];
51
- export declare function providerStatus(root: string, project: ApplicationProject, target: DeploymentTarget, run: typeof defaultRunner, request?: CloudflareRequest): Promise<unknown>;
51
+ export declare function providerStatus(root: string, project: ApplicationProject, target: DeploymentTarget, run: typeof defaultRunner, _request?: CloudflareRequest): Promise<unknown>;
52
52
  export declare function fullyActive(versions: ActiveVersion[], versionId: string): boolean;
53
53
  export declare function describeArchitecture(root: string, project: ApplicationProject): {
54
54
  target: string;
@@ -2,8 +2,8 @@ import { createHash } from 'node:crypto';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { projectConfigPath } from './project-config.js';
5
- import { cloudflareRequest } from './cloudflare.js';
6
- import { configurationFile, usesVoid, defaultRunner, environment, readApplication, readConfig, targetDirectory, } from './project-state.js';
5
+ import {} from './cloudflare.js';
6
+ import { configurationFile, defaultRunner, environment, readApplication, readConfig, targetDirectory, } from './project-state.js';
7
7
  const stateDirectory = '.anhedral';
8
8
  export function history(root, project) {
9
9
  const file = path.join(root, stateDirectory, 'releases.json');
@@ -27,11 +27,7 @@ export function checkTargets(root, project, allowResourcePlaceholders = false) {
27
27
  throw new Error('Wrangler configuration account conflicts with the registered account.');
28
28
  const pending = structuredClone(config);
29
29
  if (allowResourcePlaceholders) {
30
- for (const [field, id] of [
31
- ['d1_databases', 'database_id'],
32
- ['kv_namespaces', 'id'],
33
- ['pipelines', 'stream'],
34
- ]) {
30
+ for (const [field, id] of [['d1_databases', 'database_id']]) {
35
31
  const entries = pending[field];
36
32
  if (Array.isArray(entries))
37
33
  for (const entry of entries) {
@@ -40,7 +36,7 @@ export function checkTargets(root, project, allowResourcePlaceholders = false) {
40
36
  }
41
37
  }
42
38
  }
43
- if (/REPLACE_WITH_|YOUR_[A-Z_]+/.test(allowResourcePlaceholders || usesVoid(project)
39
+ if (/REPLACE_WITH_|YOUR_[A-Z_]+/.test(allowResourcePlaceholders
44
40
  ? JSON.stringify(pending)
45
41
  : readFileSync(configurationFile(directory), 'utf8')))
46
42
  throw new Error('Configure selected resources before shipping; placeholder bindings remain.');
@@ -54,37 +50,19 @@ export function configurationFingerprint(root, project) {
54
50
  for (const target of project.targets) {
55
51
  const directory = targetDirectory(root, target);
56
52
  hash.update(readFileSync(configurationFile(directory)));
57
- if (usesVoid(project))
58
- for (const name of ['void.config.ts', 'env.ts']) {
59
- const file = path.join(directory, name);
60
- hash.update(name).update(existsSync(file) ? readFileSync(file) : '<absent>');
61
- }
62
53
  }
63
54
  return hash.digest('hex');
64
55
  }
65
56
  export function planDelivery(root, allowResourcePlaceholders = false) {
66
57
  const project = readApplication(root);
67
58
  checkTargets(root, project, allowResourcePlaceholders);
68
- if (usesVoid(project)) {
69
- const owners = project.targets.filter((target) => {
70
- // Ownership is authored. Void may add a conventional migrations_dir to
71
- // resolved consumer locks; those consumers must not become migration owners.
72
- const config = JSON.parse(readFileSync(configurationFile(targetDirectory(root, target)), 'utf8'));
73
- return (Array.isArray(config.d1_databases) &&
74
- config.d1_databases.some((database) => database?.migrations_dir));
75
- });
76
- if (owners.length > 1)
77
- throw new Error('Void delivery requires one D1 migration owner; other server targets must consume the shared database without deployment migrations.');
78
- }
79
59
  return {
80
60
  project,
81
61
  checks: [['pnpm', 'run', 'check']],
82
62
  deployments: project.targets.map((target) => ({
83
63
  target: target.id,
84
64
  directory: target.directory,
85
- command: usesVoid(project)
86
- ? ['pnpm', 'exec', 'void', 'deploy', '--platform', 'cloudflare']
87
- : ['pnpm', 'run', 'deploy'],
65
+ command: ['pnpm', 'run', 'deploy'],
88
66
  })),
89
67
  resourcesProvisioned: false,
90
68
  audience: project.audience,
@@ -140,15 +118,8 @@ export function activeVersions(value) {
140
118
  throw new Error('Invalid provider traffic allocation.');
141
119
  return versions;
142
120
  }
143
- export async function providerStatus(root, project, target, run, request) {
144
- if (!usesVoid(project))
145
- return JSON.parse(await run('pnpm', ['exec', 'wrangler', 'deployments', 'status', '--json'], targetDirectory(root, target), environment(project)));
146
- const api = request ??
147
- (await cloudflareRequest(project, targetDirectory(root, target), run, environment(project)));
148
- const result = (await api('GET', `/workers/scripts/${encodeURIComponent(target.workerName)}/deployments`)).result;
149
- if (!Array.isArray(result?.deployments) || !result.deployments.length)
150
- throw new Error('No active Cloudflare deployment evidence.');
151
- return result.deployments[0];
121
+ export async function providerStatus(root, project, target, run, _request) {
122
+ return JSON.parse(await run('pnpm', ['exec', 'wrangler', 'deployments', 'status', '--json'], targetDirectory(root, target), environment(project)));
152
123
  }
153
124
  export function fullyActive(versions, versionId) {
154
125
  return (versions.length === 1 && versions[0].versionId === versionId && versions[0].percentage === 100);
@@ -6,18 +6,12 @@ import { type ApplicationProject } from './project-state.js';
6
6
  export { registerApplication, readApplication, defaultRunner, environment, targetDirectory, } from './project-state.js';
7
7
  export type { ApplicationProject, DeploymentTarget, DeliveryRunner } from './project-state.js';
8
8
  export declare function connectApplication(root: string, accountId: string | undefined, audience: 'public' | 'private' | undefined, run?: import("./project-state.js").DeliveryRunner, emails?: string[]): Promise<ApplicationProject>;
9
- export declare function shipApplication(root: string, run?: import("./project-state.js").DeliveryRunner, suppliedRequest?: CloudflareRequest, options?: {
10
- voidLogsDirectory?: string;
11
- }): Promise<{
12
- management: string;
13
- state?: "configuration-required" | undefined;
14
- deployed?: false | undefined;
15
- activated?: true | undefined;
16
- nextAction?: string | undefined;
9
+ export declare function shipApplication(root: string, run?: import("./project-state.js").DeliveryRunner, suppliedRequest?: CloudflareRequest): Promise<{
17
10
  projectId: string;
18
11
  release: Release;
19
12
  managementFile: string;
20
13
  productVerification: string;
14
+ management: string;
21
15
  }>;
22
16
  export declare function applicationStatus(root: string, refresh?: boolean, run?: import("./project-state.js").DeliveryRunner): Promise<{
23
17
  project: ApplicationProject;
package/dist/delivery.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { history, checkTargets, configurationFingerprint, planDelivery, parseDeploymentOutput, activeVersions, providerStatus, fullyActive, describeArchitecture, } from './delivery-evidence.js';
2
2
  export { planDelivery, parseDeploymentOutput } from './delivery-evidence.js';
3
3
  import { projectConfigPath, writeProjectSection } from './project-config.js';
4
- import { deployVoidTarget, rollbackVoidTarget } from './void-execution.js';
5
- import { voidLogSnapshot, readVoidDeploymentReceipt } from './void-state.js';
6
4
  import { randomUUID } from 'node:crypto';
7
5
  import { mkdirSync, readFileSync, realpathSync, rmSync } from 'node:fs';
8
6
  import { tmpdir } from 'node:os';
@@ -11,7 +9,7 @@ import { writeManagementOverview } from './management.js';
11
9
  import { reconcileAccess, validatePrivateAudience } from './access.js';
12
10
  import { inspectApplicationResources } from './provision.js';
13
11
  import { cloudflareRequest } from './cloudflare.js';
14
- import { atomicJson, configurationFile, usesVoid, authenticate, defaultRunner, environment, readApplication, readConfig, targetDirectory, withApplicationLock, } from './project-state.js';
12
+ import { atomicJson, configurationFile, authenticate, defaultRunner, environment, readApplication, readConfig, targetDirectory, withApplicationLock, } from './project-state.js';
15
13
  export { registerApplication, readApplication, defaultRunner, environment, targetDirectory, } from './project-state.js';
16
14
  const manifestName = 'anhedral.json';
17
15
  const stateDirectory = '.anhedral';
@@ -65,10 +63,9 @@ export async function connectApplication(root, accountId, audience, run = defaul
65
63
  return connected;
66
64
  });
67
65
  }
68
- export async function shipApplication(root, run = defaultRunner, suppliedRequest, options = {}) {
66
+ export async function shipApplication(root, run = defaultRunner, suppliedRequest) {
69
67
  root = realpathSync(root);
70
- const registered = readApplication(root);
71
- const { project } = planDelivery(root, usesVoid(registered));
68
+ const { project } = planDelivery(root);
72
69
  if (project.audience === 'unconfigured')
73
70
  throw new Error('Select an explicit audience before shipping: public or private with allowed members.');
74
71
  const env = environment(project);
@@ -90,22 +87,7 @@ export async function shipApplication(root, run = defaultRunner, suppliedRequest
90
87
  if (!/^[a-f0-9]{40,64}$/.test(commit))
91
88
  throw new Error('Invalid source commit.');
92
89
  const fingerprint = configurationFingerprint(root, project);
93
- const lockChanges = new Set();
94
- const sourceChanged = async () => {
95
- const dirty = (await run('git', ['status', '--porcelain'], root, env)).trimEnd();
96
- if (!dirty)
97
- return false;
98
- if (!usesVoid(project))
99
- return true;
100
- for (const line of dirty.split('\n')) {
101
- const file = line.slice(3);
102
- if (!/^ [M?]|^\?\?/.test(line) ||
103
- !project.targets.some((target) => file === `${target.directory}/void.lock.json`))
104
- return true;
105
- lockChanges.add(file);
106
- }
107
- return false;
108
- };
90
+ const sourceChanged = async () => Boolean((await run('git', ['status', '--porcelain'], root, env)).trim());
109
91
  records = history(root, project);
110
92
  release = {
111
93
  operation: 'ship',
@@ -133,55 +115,12 @@ export async function shipApplication(root, run = defaultRunner, suppliedRequest
133
115
  throw new Error('Source or configuration changed during delivery; preserve the release record and rebuild.');
134
116
  const output = path.join(outputDirectory, `${target.id}.ndjson`);
135
117
  let receipt;
136
- if (usesVoid(project)) {
137
- const before = voidLogSnapshot(options.voidLogsDirectory);
138
- const startedAt = Date.now();
139
- await deployVoidTarget(targetDirectory(root, target), run, env);
140
- receipt = readVoidDeploymentReceipt(before, targetDirectory(root, target), target, startedAt, options.voidLogsDirectory);
141
- release.targets.push(receipt);
142
- save();
143
- const api = suppliedRequest ??
144
- (await cloudflareRequest(project, targetDirectory(root, target), run, env));
145
- const visibility = (await api('GET', `/workers/scripts/${encodeURIComponent(target.workerName)}/subdomain`)).result;
146
- const accountDomain = visibility?.enabled === true
147
- ? (await api('GET', '/workers/subdomain')).result
148
- : undefined;
149
- const workersDevUrl = typeof accountDomain?.subdomain === 'string' &&
150
- /^[a-z0-9-]+$/i.test(accountDomain.subdomain)
151
- ? `https://${target.workerName}.${accountDomain.subdomain}.workers.dev`
152
- : undefined;
153
- const config = readConfig(targetDirectory(root, target));
154
- const hasCustomDomains = Array.isArray(config.routes) &&
155
- config.routes.some((route) => route?.custom_domain === true);
156
- const domains = hasCustomDomains
157
- ? (await api('GET', `/workers/domains?service=${encodeURIComponent(target.workerName)}`)).result
158
- : [];
159
- if (!Array.isArray(domains))
160
- throw new Error('Cloudflare custom-domain evidence is unavailable.');
161
- receipt.urls = Array.isArray(config.routes)
162
- ? config.routes.flatMap((route) => {
163
- if (!route || typeof route !== 'object')
164
- return [];
165
- const value = route;
166
- return value.custom_domain === true &&
167
- typeof value.pattern === 'string' &&
168
- /^[a-z0-9.-]+$/i.test(value.pattern) &&
169
- domains.some((domain) => domain?.hostname === value.pattern && domain?.service === target.workerName)
170
- ? [`https://${value.pattern}`]
171
- : [];
172
- })
173
- : [];
174
- if (workersDevUrl)
175
- receipt.urls.push(workersDevUrl);
176
- }
177
- else {
178
- await run('pnpm', ['run', 'deploy'], targetDirectory(root, target), {
179
- ...env,
180
- WRANGLER_OUTPUT_FILE_PATH: output,
181
- });
182
- receipt = parseDeploymentOutput(readFileSync(output, 'utf8'), target);
183
- release.targets.push(receipt);
184
- }
118
+ await run('pnpm', ['run', 'deploy'], targetDirectory(root, target), {
119
+ ...env,
120
+ WRANGLER_OUTPUT_FILE_PATH: output,
121
+ });
122
+ receipt = parseDeploymentOutput(readFileSync(output, 'utf8'), target);
123
+ release.targets.push(receipt);
185
124
  save();
186
125
  const provider = await providerStatus(root, project, target, run, suppliedRequest);
187
126
  if (!fullyActive(activeVersions(provider), receipt.versionId))
@@ -195,14 +134,7 @@ export async function shipApplication(root, run = defaultRunner, suppliedRequest
195
134
  (await run('git', ['rev-parse', 'HEAD'], root, env)).trim() !== commit ||
196
135
  (await sourceChanged()))
197
136
  throw new Error('Source or configuration changed during deployment.');
198
- if (usesVoid(project)) {
199
- const api = suppliedRequest ??
200
- (await cloudflareRequest(project, targetDirectory(root, project.targets[0]), run, env));
201
- await inspectApplicationResources(root, api);
202
- }
203
- release.state = lockChanges.size ? 'configuration-required' : 'deployed';
204
- if (lockChanges.size)
205
- release.configurationChanges = [...lockChanges].sort();
137
+ release.state = 'deployed';
206
138
  release.finishedAt = new Date().toISOString();
207
139
  save();
208
140
  const managementFile = writeManagementOverview(root, await applicationStatus(root));
@@ -211,14 +143,6 @@ export async function shipApplication(root, run = defaultRunner, suppliedRequest
211
143
  release,
212
144
  managementFile,
213
145
  productVerification: 'required',
214
- ...(lockChanges.size
215
- ? {
216
- state: 'configuration-required',
217
- deployed: false,
218
- activated: true,
219
- nextAction: 'Review and commit the recorded void.lock.json resource identities, then ship the clean committed configuration before running verify. Active target receipts are retained; product verification has not passed.',
220
- }
221
- : {}),
222
146
  management: `https://dash.cloudflare.com/${project.accountId}/workers-and-pages`,
223
147
  };
224
148
  }
@@ -362,9 +286,7 @@ export async function rollbackApplication(root, releaseId, dataCompatible, run =
362
286
  // Resolve every version before changing the first target; unavailable resources still make provider rollback fail closed.
363
287
  for (const target of project.targets) {
364
288
  const version = desired.targets.find((item) => item.target === target.id);
365
- const data = usesVoid(project)
366
- ? (await (request ?? (await cloudflareRequest(project, targetDirectory(root, target), run, env)))('GET', `/workers/scripts/${encodeURIComponent(target.workerName)}/versions/${encodeURIComponent(version.versionId)}`)).result
367
- : JSON.parse(await run('pnpm', ['exec', 'wrangler', 'versions', 'view', version.versionId, '--json'], targetDirectory(root, target), env));
289
+ const data = JSON.parse(await run('pnpm', ['exec', 'wrangler', 'versions', 'view', version.versionId, '--json'], targetDirectory(root, target), env));
368
290
  if (data.id !== version.versionId)
369
291
  throw new Error('Recorded Worker version is unavailable.');
370
292
  }
@@ -383,17 +305,14 @@ export async function rollbackApplication(root, releaseId, dataCompatible, run =
383
305
  try {
384
306
  for (const target of [...project.targets].reverse()) {
385
307
  const receipt = desired.targets.find((item) => item.target === target.id);
386
- if (usesVoid(project))
387
- await rollbackVoidTarget(targetDirectory(root, target), receipt.versionId, run, env);
388
- else
389
- await run('pnpm', [
390
- 'exec',
391
- 'wrangler',
392
- 'rollback',
393
- receipt.versionId,
394
- '--message',
395
- `Anhedral restore ${desired.id}`,
396
- ], targetDirectory(root, target), env);
308
+ await run('pnpm', [
309
+ 'exec',
310
+ 'wrangler',
311
+ 'rollback',
312
+ receipt.versionId,
313
+ '--message',
314
+ `Anhedral restore ${desired.id}`,
315
+ ], targetDirectory(root, target), env);
397
316
  const restored = { ...receipt, providerConfirmed: false };
398
317
  release.targets.push(restored);
399
318
  save();