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.
- package/README.md +35 -172
- package/assets/patches/audit-deps.mjs +12 -2
- package/assets/ui/LICENSE.shadcn +21 -0
- package/assets/ui/UPSTREAM.json +33 -0
- package/assets/ui/native/button.tsx +85 -0
- package/assets/ui/native/card.tsx +33 -0
- package/assets/ui/native/dialog.tsx +75 -0
- package/assets/ui/native/input.tsx +27 -0
- package/assets/ui/native/label.tsx +4 -0
- package/assets/ui/native/layout.tsx +26 -0
- package/assets/ui/native/text.tsx +20 -0
- package/assets/ui/native/theme-switcher.tsx +22 -0
- package/assets/ui/theme-storage.ts +25 -0
- package/assets/ui/theme.tsx +66 -0
- package/assets/ui/web/button.tsx +59 -0
- package/assets/ui/web/input.tsx +21 -0
- package/assets/ui/web/label.tsx +19 -0
- package/dist/capabilities.d.ts +5 -5
- package/dist/capabilities.js +3 -21
- package/dist/capability-contract.d.ts +3 -3
- package/dist/capability-contract.js +11 -39
- package/dist/cli-delivery.d.ts +1 -1
- package/dist/cli-delivery.js +5 -65
- package/dist/cli-output.js +3 -3
- package/dist/command-schema.js +35 -80
- package/dist/command.js +9 -11
- package/dist/delivery-evidence.d.ts +1 -1
- package/dist/delivery-evidence.js +7 -36
- package/dist/delivery.d.ts +2 -8
- package/dist/delivery.js +23 -102
- package/dist/dependencies.d.ts +12 -58
- package/dist/dependencies.js +67 -189
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/inspector-model.d.ts +2 -2
- package/dist/integration-service-readers.d.ts +1 -2
- package/dist/integration-service-readers.js +3 -84
- package/dist/lifecycle-model.d.ts +1 -1
- package/dist/lifecycle-model.js +1 -1
- package/dist/mobile-delivery.d.ts +1 -1
- package/dist/mobile-delivery.js +4 -0
- package/dist/platforms/mobile.d.ts +1 -1
- package/dist/platforms/mobile.js +64 -114
- package/dist/platforms/web.d.ts +3 -0
- package/dist/platforms/web.js +299 -0
- package/dist/project-config.d.ts +1 -1
- package/dist/project-config.js +0 -1
- package/dist/project-inspector.js +5 -36
- package/dist/project-state.d.ts +1 -3
- package/dist/project-state.js +6 -86
- package/dist/provider-auth.js +3 -32
- package/dist/provider-readiness.d.ts +1 -1
- package/dist/provider-readiness.js +5 -24
- package/dist/providers/adapters.js +9 -178
- package/dist/providers/api.d.ts +1 -1
- package/dist/providers/api.js +3 -3
- package/dist/providers/config.js +2 -48
- package/dist/providers/definitions.d.ts +1 -204
- package/dist/providers/definitions.js +0 -85
- package/dist/providers/provision.d.ts +1 -1
- package/dist/providers/receipts.js +1 -11
- package/dist/providers/recovery-verification.js +1 -61
- package/dist/providers/runtime.js +15 -35
- package/dist/providers/state.js +1 -7
- package/dist/provision.d.ts +5 -13
- package/dist/provision.js +4 -80
- package/dist/readiness.d.ts +1 -1
- package/dist/readiness.js +3 -6
- package/dist/registry/add.js +11 -38
- package/dist/registry/bootstrap.d.ts +3 -2
- package/dist/registry/bootstrap.js +4 -13
- package/dist/registry/commands.js +8 -10
- package/dist/registry/context.js +0 -1
- package/dist/registry/options.js +8 -26
- package/dist/registry/resolve.d.ts +3 -2
- package/dist/registry/resolve.js +26 -82
- package/dist/registry/types.d.ts +2 -7
- package/dist/registry/usage.js +2 -2
- package/dist/runtime-policy.d.ts +0 -2
- package/dist/runtime-policy.js +0 -13
- package/dist/scaffold/api.js +10 -2
- package/dist/scaffold/auth.d.ts +1 -2
- package/dist/scaffold/auth.js +57 -116
- package/dist/scaffold/backend.d.ts +2 -0
- package/dist/scaffold/backend.js +39 -0
- package/dist/scaffold/billing-config.d.ts +1 -0
- package/dist/scaffold/billing-config.js +73 -0
- package/dist/scaffold/billing-contracts.d.ts +2 -0
- package/dist/scaffold/billing-contracts.js +48 -0
- package/dist/scaffold/billing-providers.d.ts +1 -0
- package/dist/scaffold/billing-providers.js +249 -0
- package/dist/scaffold/billing-schema.d.ts +1 -0
- package/dist/scaffold/billing-schema.js +34 -0
- package/dist/scaffold/billing-security.d.ts +1 -0
- package/dist/scaffold/billing-security.js +46 -0
- package/dist/scaffold/billing-server.d.ts +1 -0
- package/dist/scaffold/billing-server.js +139 -0
- package/dist/scaffold/billing-store.d.ts +1 -0
- package/dist/scaffold/billing-store.js +72 -0
- package/dist/scaffold/billing.d.ts +2 -0
- package/dist/scaffold/billing.js +208 -0
- package/dist/scaffold/bootstrap.d.ts +2 -3
- package/dist/scaffold/bootstrap.js +37 -43
- package/dist/scaffold/compose.js +2 -12
- package/dist/scaffold/database.d.ts +1 -1
- package/dist/scaffold/database.js +20 -111
- package/dist/scaffold/documentation.d.ts +0 -1
- package/dist/scaffold/documentation.js +22 -82
- package/dist/scaffold/expo-auth.d.ts +3 -0
- package/dist/scaffold/expo-auth.js +203 -0
- package/dist/scaffold/expo-billing.d.ts +3 -0
- package/dist/scaffold/expo-billing.js +257 -0
- package/dist/scaffold/expo-runtime.d.ts +3 -0
- package/dist/scaffold/expo-runtime.js +43 -0
- package/dist/scaffold/integrations.d.ts +1 -2
- package/dist/scaffold/integrations.js +9 -5
- package/dist/scaffold/managed-email.d.ts +3 -0
- package/dist/scaffold/managed-email.js +47 -0
- package/dist/scaffold/native-ui.d.ts +2 -0
- package/dist/scaffold/native-ui.js +69 -0
- package/dist/scaffold/password-reset.d.ts +1 -0
- package/dist/scaffold/password-reset.js +99 -0
- package/dist/scaffold/private-files.d.ts +2 -0
- package/dist/scaffold/private-files.js +78 -0
- package/dist/scaffold/stack-documentation.d.ts +0 -1
- package/dist/scaffold/stack-documentation.js +3 -49
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/styling.js +20 -28
- package/dist/scaffold/web-billing.d.ts +2 -0
- package/dist/scaffold/web-billing.js +48 -0
- package/dist/scaffold/workspace.js +53 -189
- package/dist/service-deletion.js +1 -1
- package/dist/service-descriptor.js +5 -12
- package/dist/service-model.d.ts +1 -1
- package/dist/service-operations.js +2 -32
- package/dist/service-readers.js +1 -32
- package/dist/services-command.d.ts +1 -1
- package/dist/services-command.js +3 -9
- package/dist/ship.d.ts +3 -316
- package/dist/ship.js +13 -143
- package/dist/stack-registry.d.ts +2 -43
- package/dist/stack-registry.js +80 -308
- package/dist/standard.js +7 -14
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +23 -0
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/software-factory.md +25 -499
- package/docs/stack-standard.md +48 -226
- package/docs/verification.md +433 -0
- package/package.json +22 -21
- package/dist/neon-service-data.d.ts +0 -8
- package/dist/neon-service-data.js +0 -117
- package/dist/platforms/desktop.d.ts +0 -2
- package/dist/platforms/desktop.js +0 -415
- package/dist/platforms/extension.d.ts +0 -2
- package/dist/platforms/extension.js +0 -328
- package/dist/scaffold/lint.d.ts +0 -4
- package/dist/scaffold/lint.js +0 -56
- package/dist/scaffold/neon-realtime.d.ts +0 -2
- package/dist/scaffold/neon-realtime.js +0 -97
- package/dist/scaffold/services.d.ts +0 -5
- package/dist/scaffold/services.js +0 -108
- package/dist/scaffold/stream.d.ts +0 -2
- package/dist/scaffold/stream.js +0 -114
- package/dist/scaffold/void.d.ts +0 -4
- package/dist/scaffold/void.js +0 -256
- package/dist/scaffold/web.d.ts +0 -2
- package/dist/scaffold/web.js +0 -128
- package/dist/vercel-project.d.ts +0 -101
- package/dist/vercel-project.js +0 -305
- package/dist/vercel.d.ts +0 -67
- package/dist/vercel.js +0 -581
- package/dist/vinext.d.ts +0 -2
- package/dist/vinext.js +0 -86
- package/dist/void-execution.d.ts +0 -10
- package/dist/void-execution.js +0 -94
- package/dist/void-migrations.d.ts +0 -6
- package/dist/void-migrations.js +0 -110
- package/dist/void-state.d.ts +0 -16
- package/dist/void-state.js +0 -65
- package/dist/void.d.ts +0 -3
- package/dist/void.js +0 -5
package/dist/command-schema.js
CHANGED
|
@@ -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
|
|
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
|
|
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,39 +104,23 @@ export const COMMANDS = {
|
|
|
105
104
|
],
|
|
106
105
|
examples: [
|
|
107
106
|
'integrations status --json',
|
|
108
|
-
'integrations recover --provider
|
|
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: '
|
|
114
|
-
usage: 'init [directory] [
|
|
112
|
+
description: 'Create Next.js web + native Expo + Hono + Drizzle/D1 + private R2.',
|
|
113
|
+
usage: 'init [directory] [options]',
|
|
115
114
|
options: [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
{
|
|
122
|
-
flag: '--hosting',
|
|
123
|
-
description: 'Select web hosting.',
|
|
124
|
-
value: 'cloudflare|vercel',
|
|
125
|
-
arity: 'required',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
flag: '--skip-install',
|
|
129
|
-
description: 'Skip the final install (bootstrap still needs network).',
|
|
130
|
-
},
|
|
131
|
-
{ flag: '--git', description: 'Initialize a project repository or skip it.' },
|
|
132
|
-
{ flag: '--no-git', description: 'Initialize a project repository or skip it.' },
|
|
133
|
-
{ flag: '--dry-run', description: 'Preview the selected stack without writes or network.' },
|
|
134
|
-
],
|
|
135
|
-
examples: [
|
|
136
|
-
'init client-app',
|
|
137
|
-
'init mobile-app --expo',
|
|
138
|
-
'init product --next --hono --neon --clerk --dry-run',
|
|
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.' },
|
|
139
121
|
],
|
|
140
|
-
|
|
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.',
|
|
141
124
|
},
|
|
142
125
|
auth: {
|
|
143
126
|
description: 'Check or guide authentication for the selected providers.',
|
|
@@ -152,7 +135,7 @@ export const COMMANDS = {
|
|
|
152
135
|
{ flag: '--status', description: 'Check existing access without opening login.' },
|
|
153
136
|
{ flag: '--non-interactive', description: 'Never open an interactive login.' },
|
|
154
137
|
],
|
|
155
|
-
examples: ['auth', 'auth --status --json', 'auth --provider
|
|
138
|
+
examples: ['auth', 'auth --status --json', 'auth --provider revenuecat'],
|
|
156
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.',
|
|
157
140
|
},
|
|
158
141
|
ship: {
|
|
@@ -162,8 +145,8 @@ export const COMMANDS = {
|
|
|
162
145
|
{ flag: '--dry-run', description: 'Preview provisioning and deployment without mutations.' },
|
|
163
146
|
{
|
|
164
147
|
flag: '--provider',
|
|
165
|
-
description: 'Select hosting
|
|
166
|
-
value: 'cloudflare
|
|
148
|
+
description: 'Select Cloudflare hosting.',
|
|
149
|
+
value: 'cloudflare',
|
|
167
150
|
arity: 'required',
|
|
168
151
|
},
|
|
169
152
|
{
|
|
@@ -183,8 +166,8 @@ export const COMMANDS = {
|
|
|
183
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.',
|
|
184
167
|
},
|
|
185
168
|
add: {
|
|
186
|
-
description: 'Add
|
|
187
|
-
usage: 'add <
|
|
169
|
+
description: 'Add Stripe or RevenueCat while preserving edited source.',
|
|
170
|
+
usage: 'add <stripe|revenuecat> [...] [options]',
|
|
188
171
|
options: [
|
|
189
172
|
{ flag: '--dry-run', description: 'Preview changed paths without installing them.' },
|
|
190
173
|
{
|
|
@@ -202,22 +185,17 @@ export const COMMANDS = {
|
|
|
202
185
|
{ flag: '--skip-install', description: 'Skip the final dependency install.' },
|
|
203
186
|
],
|
|
204
187
|
examples: [
|
|
205
|
-
'add
|
|
206
|
-
'--cwd client-app add
|
|
207
|
-
'add
|
|
188
|
+
'add stripe',
|
|
189
|
+
'--cwd client-app add stripe --dry-run',
|
|
190
|
+
'add stripe --diff --cwd client-app',
|
|
208
191
|
],
|
|
209
|
-
note: 'Source previews are local and bounded.
|
|
192
|
+
note: 'Source previews are local and bounded. Edited-source conflicts require review; there is no force overwrite.',
|
|
210
193
|
},
|
|
211
194
|
registry: {
|
|
212
|
-
description: 'Inspect the
|
|
213
|
-
usage: 'registry list | view <item> | capabilities
|
|
195
|
+
description: 'Inspect the core stack and payment additions.',
|
|
196
|
+
usage: 'registry list | view <item> | capabilities',
|
|
214
197
|
options: [],
|
|
215
|
-
examples: [
|
|
216
|
-
'registry list',
|
|
217
|
-
'registry view neon',
|
|
218
|
-
'registry capabilities',
|
|
219
|
-
'registry capabilities --json',
|
|
220
|
-
],
|
|
198
|
+
examples: ['registry list', 'registry view stripe', 'registry capabilities --json'],
|
|
221
199
|
},
|
|
222
200
|
doctor: {
|
|
223
201
|
description: 'Check project provenance and local readiness without writes.',
|
|
@@ -234,7 +212,7 @@ export const COMMANDS = {
|
|
|
234
212
|
{
|
|
235
213
|
flag: '--provider',
|
|
236
214
|
description: 'Select the hosting provider.',
|
|
237
|
-
value: 'cloudflare
|
|
215
|
+
value: 'cloudflare',
|
|
238
216
|
arity: 'required',
|
|
239
217
|
},
|
|
240
218
|
{
|
|
@@ -256,21 +234,8 @@ export const COMMANDS = {
|
|
|
256
234
|
arity: 'required',
|
|
257
235
|
repeatable: true,
|
|
258
236
|
},
|
|
259
|
-
{ flag: '--scope', description: 'Select the Vercel team.', value: 'team', arity: 'required' },
|
|
260
|
-
{
|
|
261
|
-
flag: '--use',
|
|
262
|
-
description: 'Declare Vercel usage.',
|
|
263
|
-
value: 'personal|commercial',
|
|
264
|
-
arity: 'required',
|
|
265
|
-
},
|
|
266
|
-
{ flag: '--create', description: 'Create the selected Vercel project.' },
|
|
267
|
-
{ flag: '--git', description: 'Connect the verified GitHub repository.' },
|
|
268
|
-
],
|
|
269
|
-
examples: [
|
|
270
|
-
'connect --provider cloudflare --audience public',
|
|
271
|
-
'connect --scope customer --audience private --use commercial --create',
|
|
272
237
|
],
|
|
273
|
-
|
|
238
|
+
examples: ['connect --provider cloudflare --audience public'],
|
|
274
239
|
},
|
|
275
240
|
repository: {
|
|
276
241
|
description: 'Connect or create the application owner’s GitHub repository.',
|
|
@@ -295,12 +260,12 @@ export const COMMANDS = {
|
|
|
295
260
|
},
|
|
296
261
|
register: {
|
|
297
262
|
description: 'Record application identity and delivery targets.',
|
|
298
|
-
usage: 'register [directory] [--provider cloudflare
|
|
263
|
+
usage: 'register [directory] [--provider cloudflare]',
|
|
299
264
|
options: [
|
|
300
265
|
{
|
|
301
266
|
flag: '--provider',
|
|
302
267
|
description: 'Select the provider.',
|
|
303
|
-
value: 'cloudflare
|
|
268
|
+
value: 'cloudflare',
|
|
304
269
|
arity: 'required',
|
|
305
270
|
},
|
|
306
271
|
],
|
|
@@ -312,7 +277,7 @@ export const COMMANDS = {
|
|
|
312
277
|
options: [
|
|
313
278
|
{
|
|
314
279
|
flag: '--provider',
|
|
315
|
-
description: 'Select Cloudflare
|
|
280
|
+
description: 'Select Cloudflare hosting.',
|
|
316
281
|
value: 'cloudflare',
|
|
317
282
|
arity: 'required',
|
|
318
283
|
},
|
|
@@ -328,7 +293,7 @@ export const COMMANDS = {
|
|
|
328
293
|
{
|
|
329
294
|
flag: '--provider',
|
|
330
295
|
description: 'Select hosting.',
|
|
331
|
-
value: 'cloudflare
|
|
296
|
+
value: 'cloudflare',
|
|
332
297
|
arity: 'required',
|
|
333
298
|
},
|
|
334
299
|
{ flag: '--refresh', description: 'Refresh provider evidence.' },
|
|
@@ -342,7 +307,7 @@ export const COMMANDS = {
|
|
|
342
307
|
{
|
|
343
308
|
flag: '--provider',
|
|
344
309
|
description: 'Select hosting.',
|
|
345
|
-
value: 'cloudflare
|
|
310
|
+
value: 'cloudflare',
|
|
346
311
|
arity: 'required',
|
|
347
312
|
},
|
|
348
313
|
{ flag: '--local', description: 'Use local evidence without provider refresh.' },
|
|
@@ -357,23 +322,13 @@ export const COMMANDS = {
|
|
|
357
322
|
{
|
|
358
323
|
flag: '--provider',
|
|
359
324
|
description: 'Select hosting.',
|
|
360
|
-
value: 'cloudflare
|
|
325
|
+
value: 'cloudflare',
|
|
361
326
|
arity: 'required',
|
|
362
327
|
},
|
|
363
328
|
{ flag: '--refresh', description: 'Refresh provider evidence.' },
|
|
364
329
|
],
|
|
365
330
|
examples: ['verify'],
|
|
366
331
|
},
|
|
367
|
-
adopt: {
|
|
368
|
-
description: 'Record a verified existing Vercel Git deployment.',
|
|
369
|
-
usage: 'adopt [directory] [--provider vercel]',
|
|
370
|
-
options: [
|
|
371
|
-
{ flag: '--provider', description: 'Select Vercel.', value: 'vercel', arity: 'required' },
|
|
372
|
-
{ flag: '--refresh', description: 'Refresh provider evidence.' },
|
|
373
|
-
],
|
|
374
|
-
examples: ['adopt --provider vercel'],
|
|
375
|
-
note: 'Does not push or deploy.',
|
|
376
|
-
},
|
|
377
332
|
recover: {
|
|
378
333
|
description: 'Recover verified hosting state or a proven interrupted local lock.',
|
|
379
334
|
usage: 'recover [directory] [options]',
|
|
@@ -385,7 +340,7 @@ export const COMMANDS = {
|
|
|
385
340
|
{
|
|
386
341
|
flag: '--provider',
|
|
387
342
|
description: 'Select hosting.',
|
|
388
|
-
value: 'cloudflare
|
|
343
|
+
value: 'cloudflare',
|
|
389
344
|
arity: 'required',
|
|
390
345
|
},
|
|
391
346
|
{ flag: '--refresh', description: 'Refresh provider evidence.' },
|
|
@@ -400,7 +355,7 @@ export const COMMANDS = {
|
|
|
400
355
|
{
|
|
401
356
|
flag: '--provider',
|
|
402
357
|
description: 'Select hosting.',
|
|
403
|
-
value: 'cloudflare
|
|
358
|
+
value: 'cloudflare',
|
|
404
359
|
arity: 'required',
|
|
405
360
|
},
|
|
406
361
|
{
|
package/dist/command.js
CHANGED
|
@@ -5,21 +5,19 @@ export function resolveCommand(command, args, platform = process.platform, searc
|
|
|
5
5
|
if (platform !== 'win32' || !['pnpm', 'pnpm.cmd'].includes(command))
|
|
6
6
|
return { command, args: [...args] };
|
|
7
7
|
const directories = searchPath.split(';').filter(Boolean);
|
|
8
|
-
const executable = directories
|
|
9
|
-
.map((directory) => path.join(directory, 'pnpm.exe'))
|
|
10
|
-
.find(existsSync);
|
|
11
|
-
if (executable)
|
|
12
|
-
return { command: executable, args: [...args] };
|
|
13
8
|
const entries = [
|
|
14
9
|
'node_modules/pnpm/bin/pnpm.cjs',
|
|
15
10
|
'node_modules/corepack/dist/pnpm.js',
|
|
16
11
|
'pnpm.cjs',
|
|
17
12
|
'../pnpm/bin/pnpm.cjs',
|
|
18
13
|
];
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
for (const directory of directories) {
|
|
15
|
+
const executable = path.join(directory, 'pnpm.exe');
|
|
16
|
+
if (existsSync(executable))
|
|
17
|
+
return { command: executable, args: [...args] };
|
|
18
|
+
const entry = entries.map((file) => path.join(directory, file)).find(existsSync);
|
|
19
|
+
if (entry)
|
|
20
|
+
return { command: process.execPath, args: [entry, ...args] };
|
|
21
|
+
}
|
|
22
|
+
throw new Error('Cannot locate a direct pnpm entry point. Install pnpm or enable Corepack.');
|
|
25
23
|
}
|
|
@@ -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,
|
|
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 {
|
|
6
|
-
import { configurationFile,
|
|
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
|
|
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:
|
|
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,
|
|
144
|
-
|
|
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);
|
package/dist/delivery.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
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
|
|
66
|
+
export async function shipApplication(root, run = defaultRunner, suppliedRequest) {
|
|
69
67
|
root = realpathSync(root);
|
|
70
|
-
const
|
|
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
|
|
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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -287,7 +211,9 @@ export async function verifyApplication(root, run = defaultRunner) {
|
|
|
287
211
|
throw new Error('Live verification requires a fully active recorded release.');
|
|
288
212
|
const project = snapshot.project;
|
|
289
213
|
const env = environment(project);
|
|
290
|
-
const primary = release.targets.find((target) => target.target === 'web') ??
|
|
214
|
+
const primary = release.targets.find((target) => target.target === 'web') ??
|
|
215
|
+
release.targets.find((target) => target.target === 'mobile') ??
|
|
216
|
+
release.targets.at(-1);
|
|
291
217
|
if (!primary?.urls.length)
|
|
292
218
|
throw new Error('No recorded application URL for live verification.');
|
|
293
219
|
const pkg = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
@@ -360,9 +286,7 @@ export async function rollbackApplication(root, releaseId, dataCompatible, run =
|
|
|
360
286
|
// Resolve every version before changing the first target; unavailable resources still make provider rollback fail closed.
|
|
361
287
|
for (const target of project.targets) {
|
|
362
288
|
const version = desired.targets.find((item) => item.target === target.id);
|
|
363
|
-
const data =
|
|
364
|
-
? (await (request ?? (await cloudflareRequest(project, targetDirectory(root, target), run, env)))('GET', `/workers/scripts/${encodeURIComponent(target.workerName)}/versions/${encodeURIComponent(version.versionId)}`)).result
|
|
365
|
-
: 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));
|
|
366
290
|
if (data.id !== version.versionId)
|
|
367
291
|
throw new Error('Recorded Worker version is unavailable.');
|
|
368
292
|
}
|
|
@@ -381,17 +305,14 @@ export async function rollbackApplication(root, releaseId, dataCompatible, run =
|
|
|
381
305
|
try {
|
|
382
306
|
for (const target of [...project.targets].reverse()) {
|
|
383
307
|
const receipt = desired.targets.find((item) => item.target === target.id);
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
'--message',
|
|
393
|
-
`Anhedral restore ${desired.id}`,
|
|
394
|
-
], 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);
|
|
395
316
|
const restored = { ...receipt, providerConfirmed: false };
|
|
396
317
|
release.targets.push(restored);
|
|
397
318
|
save();
|