anhedral 0.11.2 → 0.12.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 +107 -14
- package/dist/bin.js +48 -493
- package/dist/capabilities.d.ts +3 -3
- package/dist/capability-contract.js +4 -0
- package/dist/cli-arguments.d.ts +8 -0
- package/dist/cli-arguments.js +32 -0
- package/dist/cli-commands.d.ts +3 -0
- package/dist/cli-commands.js +114 -0
- package/dist/cli-delivery.d.ts +3 -0
- package/dist/cli-delivery.js +172 -0
- package/dist/cli-output.js +231 -205
- package/dist/delivery-evidence.d.ts +62 -0
- package/dist/delivery-evidence.js +186 -0
- package/dist/delivery.d.ts +3 -40
- package/dist/delivery.js +4 -181
- package/dist/dependencies.d.ts +1 -0
- package/dist/dependencies.js +2 -0
- package/dist/mobile-delivery.d.ts +21 -44
- package/dist/mobile-delivery.js +127 -80
- package/dist/provider-auth.js +3 -3
- package/dist/scaffold/documentation.js +1 -0
- package/dist/scaffold/stream.d.ts +2 -0
- package/dist/scaffold/stream.js +114 -0
- package/dist/service-readers.js +1 -1
- package/dist/services-command.js +8 -6
- package/dist/ship.d.ts +15 -15
- package/dist/stack-registry.d.ts +4 -2
- package/dist/stack-registry.js +16 -0
- package/dist/transaction-lock.d.ts +15 -0
- package/dist/transaction-lock.js +227 -0
- package/dist/transaction.js +2 -208
- package/dist/vercel-project.d.ts +101 -0
- package/dist/vercel-project.js +305 -0
- package/dist/vercel.d.ts +3 -36
- package/dist/vercel.js +3 -300
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/software-factory.md +339 -3
- package/docs/stack-standard.md +138 -30
- package/docs/verification.md +444 -0
- package/package.json +2 -5
- package/docs/cli-design.md +0 -67
- package/docs/plugin-ui.md +0 -102
- package/docs/provider-configuration.md +0 -116
- package/docs/void-verification.md +0 -185
package/dist/bin.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { runServiceCommand } from './services-command.js';
|
|
3
|
-
import { shipCloudflareApplication, shipSelectedVercelApplication, shipSelectedStack, } from './ship.js';
|
|
4
|
-
import { integrationStatus, recoverIntegrationResource } from './providers/recovery.js';
|
|
5
|
-
import { INTEGRATION_PROVIDERS } from './providers/config.js';
|
|
6
|
-
import { recoverDeliveryLock } from './project-state.js';
|
|
7
|
-
import { readLifecycleOperation } from './lifecycle.js';
|
|
8
|
-
import { buildMobileApplication } from './mobile-delivery.js';
|
|
9
|
-
import { authenticateProviders } from './provider-auth.js';
|
|
10
|
-
import { runAdd, runRegistry } from './registry/commands.js';
|
|
11
|
-
import { setupRepository } from './repository.js';
|
|
12
|
-
import path from 'node:path';
|
|
13
|
-
import { hasProjectSection, readProjectSection } from './project-config.js';
|
|
14
|
-
import { registerVercelApplication, connectVercelApplication, vercelApplicationStatus, verifyVercelApplication, rollbackVercelApplication, adoptVercelApplication, recoverVercelApplication, writeVercelOverview, } from './vercel.js';
|
|
15
|
-
import { registerApplication, connectApplication, applicationStatus, verifyApplication, rollbackApplication, recoverApplication, } from './delivery.js';
|
|
16
|
-
import { planProvisioning, provisionApplication } from './provision.js';
|
|
17
|
-
import { writeManagementOverview } from './management.js';
|
|
18
|
-
import { inspectProviderReadiness } from './provider-readiness.js';
|
|
19
|
-
import { inspectProject } from './readiness.js';
|
|
20
|
-
import { inspectApplication } from './project-inspector.js';
|
|
21
2
|
import { argv } from 'node:process';
|
|
22
|
-
import {
|
|
3
|
+
import { runCommand } from './cli-commands.js';
|
|
4
|
+
import { DELIVERY_COMMANDS } from './cli-delivery.js';
|
|
5
|
+
import { STANDARD_USAGE, commandHelp } from './registry/usage.js';
|
|
23
6
|
import { GENERATOR_VERSION } from './version.js';
|
|
24
7
|
import { PostCommitError } from './transaction.js';
|
|
25
8
|
import { CliArgumentError, globalArguments, inlineArguments, validateCommand, } from './cli-arguments.js';
|
|
26
|
-
import { printResult } from './cli-output.js';
|
|
27
|
-
import { commandHelp } from './registry/usage.js';
|
|
28
9
|
let [command, ...args] = argv.slice(2);
|
|
29
10
|
let json = argv.includes('--json');
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
function helpRequested() {
|
|
12
|
+
return ([undefined, '--help', '-h', 'help'].includes(command) ||
|
|
13
|
+
args.includes('--help') ||
|
|
14
|
+
args.includes('-h'));
|
|
15
|
+
}
|
|
16
|
+
function printHelp() {
|
|
17
|
+
const target = command === 'help'
|
|
18
|
+
? args.filter((arg) => arg !== '--json')[0]
|
|
19
|
+
: ['--help', '-h'].includes(command)
|
|
20
|
+
? undefined
|
|
21
|
+
: command;
|
|
22
|
+
const help = target ? commandHelp(target) : STANDARD_USAGE;
|
|
23
|
+
if (!help)
|
|
24
|
+
throw new CliArgumentError('Unknown help topic.', 'Run anhedral --help.');
|
|
25
|
+
console.log(json ? JSON.stringify({ usage: help }) : help);
|
|
26
|
+
}
|
|
27
|
+
function selectDirectory(directory) {
|
|
28
|
+
try {
|
|
29
|
+
process.chdir(directory);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
throw new CliArgumentError('Working directory is unavailable.', 'Choose an existing directory with --cwd <directory>.');
|
|
33
|
+
}
|
|
33
34
|
}
|
|
34
35
|
async function main() {
|
|
35
36
|
const global = globalArguments(argv.slice(2));
|
|
@@ -38,490 +39,44 @@ async function main() {
|
|
|
38
39
|
if (json)
|
|
39
40
|
args.push('--json');
|
|
40
41
|
args = inlineArguments(command, args);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
args.includes('--help') ||
|
|
44
|
-
args.includes('-h')) {
|
|
45
|
-
const target = command === 'help'
|
|
46
|
-
? args.filter((arg) => arg !== '--json')[0]
|
|
47
|
-
: ['--help', '-h'].includes(command)
|
|
48
|
-
? undefined
|
|
49
|
-
: command;
|
|
50
|
-
const help = target ? commandHelp(target) : STANDARD_USAGE;
|
|
51
|
-
if (!help)
|
|
52
|
-
throw new CliArgumentError('Unknown help topic.', 'Run anhedral --help.');
|
|
53
|
-
console.log(json ? JSON.stringify({ usage: help }) : help);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
42
|
+
if (helpRequested())
|
|
43
|
+
return printHelp();
|
|
56
44
|
validateCommand(command, args);
|
|
57
45
|
if (['--version', '-v'].includes(command)) {
|
|
58
46
|
console.log(json ? JSON.stringify({ version: GENERATOR_VERSION }) : GENERATOR_VERSION);
|
|
59
47
|
return;
|
|
60
48
|
}
|
|
61
|
-
if (global.cwd)
|
|
62
|
-
|
|
63
|
-
process.chdir(global.cwd);
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
throw new CliArgumentError('Working directory is unavailable.', 'Choose an existing directory with --cwd <directory>.');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
49
|
+
if (global.cwd)
|
|
50
|
+
selectDirectory(global.cwd);
|
|
69
51
|
if (global.quiet || json)
|
|
70
52
|
process.env.ANHEDRAL_QUIET = '1';
|
|
71
53
|
if (global.verbose && !json && !global.quiet)
|
|
72
54
|
process.env.ANHEDRAL_VERBOSE = '1';
|
|
73
|
-
|
|
74
|
-
printResult(command, await runServiceCommand(process.cwd(), args), output);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (command === 'inspect') {
|
|
78
|
-
const directories = args.filter((arg) => arg !== '--json');
|
|
79
|
-
if (directories.length > 1 || directories.some((arg) => arg.startsWith('-')))
|
|
80
|
-
throw argumentError('Specify at most one project directory.');
|
|
81
|
-
printResult(command, inspectApplication(path.resolve(directories[0] ?? process.cwd())), output);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (command === 'integrations') {
|
|
85
|
-
const [action, ...input] = args.filter((arg) => arg !== '--json');
|
|
86
|
-
const directories = [];
|
|
87
|
-
const options = {};
|
|
88
|
-
for (let index = 0; index < input.length; index++) {
|
|
89
|
-
const flag = input[index];
|
|
90
|
-
if (['--provider', '--operation', '--resource'].includes(flag))
|
|
91
|
-
options[flag] = input[++index];
|
|
92
|
-
else if (flag.startsWith('-'))
|
|
93
|
-
throw argumentError('Unknown integration option.');
|
|
94
|
-
else
|
|
95
|
-
directories.push(flag);
|
|
96
|
-
}
|
|
97
|
-
if (directories.length > 1)
|
|
98
|
-
throw argumentError('Specify one application directory.');
|
|
99
|
-
const root = path.resolve(directories[0] ?? process.cwd());
|
|
100
|
-
if (action === 'status') {
|
|
101
|
-
if (Object.keys(options).length)
|
|
102
|
-
throw argumentError('Integration status accepts no recovery options.');
|
|
103
|
-
printResult(command, integrationStatus(root), output);
|
|
104
|
-
}
|
|
105
|
-
else if (action === 'recover') {
|
|
106
|
-
if (!INTEGRATION_PROVIDERS.includes(options['--provider']) ||
|
|
107
|
-
!options['--operation'] ||
|
|
108
|
-
!options['--resource'])
|
|
109
|
-
throw argumentError('Recovery requires --provider, --operation and --resource.');
|
|
110
|
-
printResult(command, await recoverIntegrationResource(root, {
|
|
111
|
-
provider: options['--provider'],
|
|
112
|
-
operation: options['--operation'],
|
|
113
|
-
resourceId: options['--resource'],
|
|
114
|
-
}), output);
|
|
115
|
-
}
|
|
116
|
-
else
|
|
117
|
-
throw argumentError('Use integrations status or integrations recover.');
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (command === 'auth') {
|
|
121
|
-
let provider;
|
|
122
|
-
const directories = [];
|
|
123
|
-
for (let index = 0; index < args.length; index++) {
|
|
124
|
-
const flag = args[index];
|
|
125
|
-
if (['--json', '--status', '--non-interactive'].includes(flag))
|
|
126
|
-
continue;
|
|
127
|
-
if (flag === '--provider') {
|
|
128
|
-
const value = args[++index];
|
|
129
|
-
if (provider || !value || value.startsWith('-'))
|
|
130
|
-
throw argumentError('Specify one auth provider.');
|
|
131
|
-
provider = value;
|
|
132
|
-
}
|
|
133
|
-
else if (flag.startsWith('-'))
|
|
134
|
-
throw argumentError('Unknown auth option.');
|
|
135
|
-
else
|
|
136
|
-
directories.push(flag);
|
|
137
|
-
}
|
|
138
|
-
if (directories.length > 1)
|
|
139
|
-
throw argumentError('Specify one application directory.');
|
|
140
|
-
const result = await authenticateProviders(path.resolve(directories[0] ?? process.cwd()), {
|
|
141
|
-
provider,
|
|
142
|
-
status: args.includes('--status'),
|
|
143
|
-
interactive: !json &&
|
|
144
|
-
!output.quiet &&
|
|
145
|
-
!args.includes('--non-interactive') &&
|
|
146
|
-
Boolean(process.stdin.isTTY),
|
|
147
|
-
});
|
|
148
|
-
printResult('auth', result, output);
|
|
149
|
-
if (!result.authenticated)
|
|
150
|
-
process.exitCode = 1;
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (command === 'add') {
|
|
154
|
-
await runAdd(args, output);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (command === 'registry') {
|
|
158
|
-
await runRegistry(args, json, output);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (command === 'repository') {
|
|
162
|
-
let owner;
|
|
163
|
-
let name;
|
|
164
|
-
let visibility = 'private';
|
|
165
|
-
let create = false;
|
|
166
|
-
const directories = [];
|
|
167
|
-
for (let index = 0; index < args.length; index++) {
|
|
168
|
-
const flag = args[index];
|
|
169
|
-
if (flag === '--json')
|
|
170
|
-
continue;
|
|
171
|
-
if (flag === '--create') {
|
|
172
|
-
create = true;
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
if (flag === '--owner' || flag === '--name' || flag === '--visibility') {
|
|
176
|
-
const value = args[++index];
|
|
177
|
-
if (!value || value.startsWith('-'))
|
|
178
|
-
throw argumentError('Missing repository option value.');
|
|
179
|
-
if (flag === '--owner') {
|
|
180
|
-
if (owner)
|
|
181
|
-
throw argumentError('Specify one GitHub owner.');
|
|
182
|
-
owner = value;
|
|
183
|
-
}
|
|
184
|
-
else if (flag === '--name') {
|
|
185
|
-
if (name)
|
|
186
|
-
throw argumentError('Specify one repository name.');
|
|
187
|
-
name = value;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
if (!['private', 'public'].includes(value))
|
|
191
|
-
throw argumentError('Visibility must be private or public.');
|
|
192
|
-
visibility = value;
|
|
193
|
-
}
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
if (flag.startsWith('-'))
|
|
197
|
-
throw argumentError('Unknown repository option.');
|
|
198
|
-
directories.push(flag);
|
|
199
|
-
}
|
|
200
|
-
if (directories.length > 1)
|
|
201
|
-
throw argumentError('Specify one application directory.');
|
|
202
|
-
printResult('repository', await setupRepository(path.resolve(directories[0] ?? process.cwd()), {
|
|
203
|
-
owner,
|
|
204
|
-
name,
|
|
205
|
-
visibility,
|
|
206
|
-
create,
|
|
207
|
-
}), output);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
if ([
|
|
211
|
-
'register',
|
|
212
|
-
'connect',
|
|
213
|
-
'provision',
|
|
214
|
-
'ship',
|
|
215
|
-
'status',
|
|
216
|
-
'manage',
|
|
217
|
-
'verify',
|
|
218
|
-
'rollback',
|
|
219
|
-
'adopt',
|
|
220
|
-
'recover',
|
|
221
|
-
].includes(command ?? '')) {
|
|
222
|
-
await runDelivery(command, args);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (command === 'doctor') {
|
|
226
|
-
await runDoctor(args);
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
if (command !== 'init') {
|
|
230
|
-
throw argumentError(`Unknown command: ${command}. Use init, auth, ship, add, registry, inspect, doctor, repository, register, connect, provision, status, manage, verify, rollback, adopt, recover, --help, or --version.`);
|
|
231
|
-
}
|
|
232
|
-
const options = readOptions(args);
|
|
233
|
-
if (options)
|
|
234
|
-
await scaffoldStandardProject(options, undefined, output);
|
|
55
|
+
await runCommand(command, args, { json, quiet: global.quiet });
|
|
235
56
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const value = args[++index];
|
|
253
|
-
if (!value || value.startsWith('-'))
|
|
254
|
-
throw argumentError('Missing mobile build option.');
|
|
255
|
-
if (arg === '--platform') {
|
|
256
|
-
if (platform || !['ios', 'android'].includes(value))
|
|
257
|
-
throw argumentError('Select one mobile platform.');
|
|
258
|
-
platform = value;
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
if (profile)
|
|
262
|
-
throw argumentError('Select one build profile.');
|
|
263
|
-
profile = value;
|
|
264
|
-
}
|
|
265
|
-
continue;
|
|
266
|
-
}
|
|
267
|
-
if (command === 'recover' && arg === '--lock')
|
|
268
|
-
continue;
|
|
269
|
-
if (arg === '--provider') {
|
|
270
|
-
const value = args[++index];
|
|
271
|
-
if (!['vercel', 'cloudflare'].includes(value) || provider)
|
|
272
|
-
throw argumentError('Specify one provider: vercel or cloudflare.');
|
|
273
|
-
provider = value;
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
if (command === 'connect' && arg === '--scope') {
|
|
277
|
-
if (scope)
|
|
278
|
-
throw argumentError('Specify one Vercel scope.');
|
|
279
|
-
scope = args[++index];
|
|
280
|
-
if (!scope || scope.startsWith('-'))
|
|
281
|
-
throw argumentError('Missing Vercel scope.');
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
if (command === 'connect' && arg === '--use') {
|
|
285
|
-
const value = args[++index];
|
|
286
|
-
if (!['personal', 'commercial'].includes(value) || use)
|
|
287
|
-
throw argumentError('Specify --use personal or commercial.');
|
|
288
|
-
use = value;
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
if (command === 'connect' && arg === '--git') {
|
|
292
|
-
git = true;
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
if (command === 'connect' && arg === '--create') {
|
|
296
|
-
create = true;
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
if (command === 'rollback' && arg === '--release') {
|
|
300
|
-
releaseId = args[++index];
|
|
301
|
-
if (!releaseId || releaseId.startsWith('-'))
|
|
302
|
-
throw argumentError('Missing release ID.');
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
if (command === 'rollback' && arg === '--data-compatible')
|
|
306
|
-
continue;
|
|
307
|
-
if (arg === '--json' ||
|
|
308
|
-
(['ship', 'provision'].includes(command) && arg === '--dry-run') ||
|
|
309
|
-
(['status', 'manage', 'verify', 'rollback', 'adopt', 'recover'].includes(command) &&
|
|
310
|
-
arg === '--refresh') ||
|
|
311
|
-
(command === 'manage' && arg === '--local'))
|
|
312
|
-
continue;
|
|
313
|
-
if (command === 'connect' && arg === '--account') {
|
|
314
|
-
if (account)
|
|
315
|
-
throw argumentError('Specify one account.');
|
|
316
|
-
account = args[++index];
|
|
317
|
-
if (!account || account.startsWith('-'))
|
|
318
|
-
throw argumentError('Missing account ID.');
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
if (command === 'connect' &&
|
|
322
|
-
arg === '--audience' &&
|
|
323
|
-
['public', 'private'].includes(args[index + 1])) {
|
|
324
|
-
audience = args[index + 1];
|
|
325
|
-
index++;
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
if (command === 'connect' && arg === '--allow-email') {
|
|
329
|
-
const email = args[++index];
|
|
330
|
-
if (!email || email.startsWith('-'))
|
|
331
|
-
throw argumentError('Missing allowed email address.');
|
|
332
|
-
emails.push(email);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
if (arg.startsWith('-'))
|
|
336
|
-
throw argumentError(`Unknown ${command} option: ${arg}`);
|
|
337
|
-
positional.push(arg);
|
|
338
|
-
}
|
|
339
|
-
if (positional.length > 1)
|
|
340
|
-
throw argumentError('Specify at most one application directory.');
|
|
341
|
-
const root = path.resolve(positional[0] ?? process.cwd());
|
|
342
|
-
let result;
|
|
343
|
-
if (command === 'recover' && args.includes('--lock')) {
|
|
344
|
-
if (provider || args.includes('--refresh'))
|
|
345
|
-
throw argumentError('Local lock recovery cannot be combined with provider recovery or --refresh.');
|
|
346
|
-
printResult(command, recoverDeliveryLock(root), output);
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if (platform || profile) {
|
|
350
|
-
if (!platform || !profile || provider)
|
|
351
|
-
throw argumentError('Mobile shipping requires --platform and --profile, without --provider.');
|
|
352
|
-
result = await buildMobileApplication(root, {
|
|
353
|
-
platform,
|
|
354
|
-
profile,
|
|
355
|
-
dryRun: args.includes('--dry-run'),
|
|
356
|
-
});
|
|
357
|
-
printResult(command, result, output);
|
|
358
|
-
if (result &&
|
|
359
|
-
typeof result === 'object' &&
|
|
360
|
-
'state' in result &&
|
|
361
|
-
['configuration-required', 'provider-configuration-required'].includes(String(result.state)))
|
|
362
|
-
process.exitCode = 1;
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
const web = provider === 'vercel' ||
|
|
366
|
-
(provider !== 'cloudflare' &&
|
|
367
|
-
(hasProjectSection(root, 'vercel') ||
|
|
368
|
-
(command === 'register' &&
|
|
369
|
-
hasProjectSection(root, 'setup') &&
|
|
370
|
-
readProjectSection(root, 'setup').hosting === 'vercel')));
|
|
371
|
-
if (command === 'ship' && !provider) {
|
|
372
|
-
result = await shipSelectedStack(root, args.includes('--dry-run'));
|
|
373
|
-
printResult(command, result, output);
|
|
374
|
-
if (result &&
|
|
375
|
-
typeof result === 'object' &&
|
|
376
|
-
'state' in result &&
|
|
377
|
-
['configuration-required', 'provider-configuration-required', 'partial'].includes(String(result.state)))
|
|
378
|
-
process.exitCode = 1;
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
if (web) {
|
|
382
|
-
if (account || emails.length)
|
|
383
|
-
throw argumentError('Cloudflare account/member flags require --provider cloudflare.');
|
|
384
|
-
if (command === 'register')
|
|
385
|
-
result = registerVercelApplication(root);
|
|
386
|
-
else if (command === 'connect') {
|
|
387
|
-
if (!audience || !use)
|
|
388
|
-
throw argumentError('Vercel connect requires --audience public|private and --use personal|commercial.');
|
|
389
|
-
result = await connectVercelApplication(root, { scope, audience, use, create, git });
|
|
390
|
-
}
|
|
391
|
-
else if (command === 'ship')
|
|
392
|
-
result = await shipSelectedVercelApplication(root, args.includes('--dry-run'));
|
|
393
|
-
else if (command === 'adopt')
|
|
394
|
-
result = await adoptVercelApplication(root);
|
|
395
|
-
else if (command === 'recover')
|
|
396
|
-
result = await recoverVercelApplication(root);
|
|
397
|
-
else if (command === 'verify')
|
|
398
|
-
result = await verifyVercelApplication(root);
|
|
399
|
-
else if (command === 'rollback') {
|
|
400
|
-
if (!releaseId)
|
|
401
|
-
throw argumentError('Rollback requires --release <recorded-id>.');
|
|
402
|
-
result = await rollbackVercelApplication(root, releaseId, args.includes('--data-compatible'));
|
|
403
|
-
}
|
|
404
|
-
else if (command === 'status')
|
|
405
|
-
result = await vercelApplicationStatus(root, args.includes('--refresh'));
|
|
406
|
-
else if (command === 'manage') {
|
|
407
|
-
const snapshot = await vercelApplicationStatus(root, !args.includes('--local'));
|
|
408
|
-
result = { file: writeVercelOverview(root, snapshot), evidence: snapshot.evidence };
|
|
409
|
-
}
|
|
410
|
-
else
|
|
411
|
-
throw argumentError('Vercel project creation is handled by connect --create; Cloudflare resource provisioning requires --provider cloudflare.');
|
|
412
|
-
if (command === 'status')
|
|
413
|
-
result = { ...result, operation: readLifecycleOperation(root) };
|
|
414
|
-
printResult(command, result, output);
|
|
415
|
-
if (result &&
|
|
416
|
-
typeof result === 'object' &&
|
|
417
|
-
'state' in result &&
|
|
418
|
-
result.state === 'provider-configuration-required')
|
|
419
|
-
process.exitCode = 1;
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
if (scope || use || create || git)
|
|
423
|
-
throw argumentError('Vercel connect options require a Vercel web manifest or --provider vercel.');
|
|
424
|
-
if (command === 'register')
|
|
425
|
-
result = registerApplication(root);
|
|
426
|
-
else if (command === 'connect') {
|
|
427
|
-
result = await connectApplication(root, account, audience, undefined, emails);
|
|
428
|
-
}
|
|
429
|
-
else if (command === 'provision')
|
|
430
|
-
result = args.includes('--dry-run') ? planProvisioning(root) : await provisionApplication(root);
|
|
431
|
-
else if (command === 'ship')
|
|
432
|
-
result = await shipCloudflareApplication(root, args.includes('--dry-run'));
|
|
433
|
-
else if (command === 'adopt')
|
|
434
|
-
throw argumentError('Git deployment adoption requires --provider vercel.');
|
|
435
|
-
else if (command === 'recover')
|
|
436
|
-
result = await recoverApplication(root);
|
|
437
|
-
else if (command === 'verify')
|
|
438
|
-
result = await verifyApplication(root);
|
|
439
|
-
else if (command === 'rollback') {
|
|
440
|
-
if (!releaseId)
|
|
441
|
-
throw argumentError('Rollback requires --release <recorded-id>.');
|
|
442
|
-
result = await rollbackApplication(root, releaseId, args.includes('--data-compatible'));
|
|
443
|
-
}
|
|
444
|
-
else if (command === 'manage') {
|
|
445
|
-
const snapshot = await applicationStatus(root, !args.includes('--local'));
|
|
446
|
-
result = { file: writeManagementOverview(root, snapshot), evidence: snapshot.evidence };
|
|
447
|
-
}
|
|
448
|
-
else
|
|
449
|
-
result = await applicationStatus(root, args.includes('--refresh'));
|
|
450
|
-
if (command === 'status')
|
|
451
|
-
result = { ...result, operation: readLifecycleOperation(root) };
|
|
452
|
-
printResult(command, result, output);
|
|
453
|
-
if (result &&
|
|
454
|
-
typeof result === 'object' &&
|
|
455
|
-
'state' in result &&
|
|
456
|
-
['configuration-required', 'provider-configuration-required'].includes(String(result.state)))
|
|
457
|
-
process.exitCode = 1;
|
|
458
|
-
}
|
|
459
|
-
async function runDoctor(args) {
|
|
460
|
-
const positional = args.filter((arg) => arg !== '--json' && arg !== '--providers');
|
|
461
|
-
if (positional.length > 1 || positional.some((arg) => arg.startsWith('-')))
|
|
462
|
-
throw argumentError('Usage: anhedral doctor [directory] [--providers] [--json]');
|
|
463
|
-
const root = path.resolve(positional[0] ?? process.cwd());
|
|
464
|
-
const report = args.includes('--providers')
|
|
465
|
-
? await inspectProviderReadiness(root)
|
|
466
|
-
: inspectProject(root);
|
|
467
|
-
printResult('doctor', report, output);
|
|
468
|
-
if (!report.localReady ||
|
|
469
|
-
('prerequisitesReady' in report &&
|
|
470
|
-
(!report.prerequisitesReady || report.providerVerification !== 'verified-existing-context')))
|
|
471
|
-
process.exitCode = 1;
|
|
472
|
-
}
|
|
473
|
-
function readOptions(args) {
|
|
474
|
-
try {
|
|
475
|
-
return parseStandardOptions(args);
|
|
476
|
-
}
|
|
477
|
-
catch (error) {
|
|
478
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
479
|
-
console.error(json
|
|
480
|
-
? JSON.stringify({
|
|
481
|
-
error: message,
|
|
482
|
-
code: 'INVALID_ARGUMENT',
|
|
483
|
-
nextAction: `Run anhedral ${command} --help.`,
|
|
484
|
-
})
|
|
485
|
-
: `Error: ${message}\nNext: Run anhedral ${command} --help.`);
|
|
486
|
-
process.exitCode = 1;
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
57
|
+
const errorCodes = {
|
|
58
|
+
...Object.fromEntries([...DELIVERY_COMMANDS, 'repository', 'integrations'].map((name) => [name, 'DELIVERY_FAILED'])),
|
|
59
|
+
inspect: 'INSPECTION_FAILED',
|
|
60
|
+
services: 'SERVICE_FAILED',
|
|
61
|
+
auth: 'AUTH_FAILED',
|
|
62
|
+
doctor: 'INVALID_ARGUMENT',
|
|
63
|
+
init: 'GENERATION_FAILED',
|
|
64
|
+
add: 'ADDITION_FAILED',
|
|
65
|
+
registry: 'REGISTRY_FAILED',
|
|
66
|
+
};
|
|
67
|
+
function failureCode(error) {
|
|
68
|
+
if (error instanceof CliArgumentError)
|
|
69
|
+
return error.code;
|
|
70
|
+
if (error instanceof PostCommitError)
|
|
71
|
+
return 'POST_COMMIT_FAILED';
|
|
72
|
+
return Object.hasOwn(errorCodes, command ?? '') ? errorCodes[command] : 'UNKNOWN_COMMAND';
|
|
489
73
|
}
|
|
490
74
|
try {
|
|
491
75
|
await main();
|
|
492
76
|
}
|
|
493
77
|
catch (error) {
|
|
494
78
|
const message = error instanceof Error ? error.message : String(error);
|
|
495
|
-
const code = error
|
|
496
|
-
? error.code
|
|
497
|
-
: error instanceof PostCommitError
|
|
498
|
-
? 'POST_COMMIT_FAILED'
|
|
499
|
-
: [
|
|
500
|
-
'repository',
|
|
501
|
-
'register',
|
|
502
|
-
'connect',
|
|
503
|
-
'provision',
|
|
504
|
-
'ship',
|
|
505
|
-
'status',
|
|
506
|
-
'manage',
|
|
507
|
-
'verify',
|
|
508
|
-
'rollback',
|
|
509
|
-
'adopt',
|
|
510
|
-
'recover',
|
|
511
|
-
'integrations',
|
|
512
|
-
].includes(command ?? '')
|
|
513
|
-
? 'DELIVERY_FAILED'
|
|
514
|
-
: command === 'auth'
|
|
515
|
-
? 'AUTH_FAILED'
|
|
516
|
-
: command === 'doctor'
|
|
517
|
-
? 'INVALID_ARGUMENT'
|
|
518
|
-
: command === 'init'
|
|
519
|
-
? 'GENERATION_FAILED'
|
|
520
|
-
: command === 'add'
|
|
521
|
-
? 'ADDITION_FAILED'
|
|
522
|
-
: command === 'registry'
|
|
523
|
-
? 'REGISTRY_FAILED'
|
|
524
|
-
: 'UNKNOWN_COMMAND';
|
|
79
|
+
const code = failureCode(error);
|
|
525
80
|
const nextAction = error instanceof CliArgumentError
|
|
526
81
|
? error.nextAction
|
|
527
82
|
: `Run anhedral ${command && commandHelp(command) ? command + ' ' : ''}--help.`;
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const CAPABILITIES: Record<StandardProduct, Capability>;
|
|
|
6
6
|
export declare const CAPABILITY_REGISTRY: {
|
|
7
7
|
schemaVersion: number;
|
|
8
8
|
cliVersion: string;
|
|
9
|
-
capabilities: Record<"next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog", Capability>;
|
|
9
|
+
capabilities: Record<"next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "stream" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog", Capability>;
|
|
10
10
|
};
|
|
11
11
|
export declare function createSetupPlan(options: StandardOptions, registry?: import("./registry/resolve.js").ResolvedStackRegistry): {
|
|
12
12
|
schemaVersion: number;
|
|
@@ -15,7 +15,7 @@ export declare function createSetupPlan(options: StandardOptions, registry?: imp
|
|
|
15
15
|
standard: string;
|
|
16
16
|
root: string;
|
|
17
17
|
name: string;
|
|
18
|
-
products: ("next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog")[];
|
|
18
|
+
products: ("next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "stream" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog")[];
|
|
19
19
|
hosting: import("./registry/types.js").Hosting;
|
|
20
20
|
registry: import("./registry/resolve.js").ResolvedStackRegistry;
|
|
21
21
|
bootstrap: ("next" | "pnpm" | "shadcn@4.21.4" | "dlx" | "init" | "--monorepo" | "--template")[];
|
|
@@ -32,7 +32,7 @@ export declare function createSetupPlan(options: StandardOptions, registry?: imp
|
|
|
32
32
|
credentials: readonly string[];
|
|
33
33
|
resources: readonly string[];
|
|
34
34
|
verify: readonly string[];
|
|
35
|
-
id: "next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog";
|
|
35
|
+
id: "next" | "queues" | "basin" | "vinext" | "hono" | "realtime" | "cron" | "workflows" | "electron" | "wxt" | "expo" | "styling" | "neon" | "d1" | "neon-realtime" | "local-data" | "clerk" | "better-auth" | "r2" | "kv" | "stream" | "openai" | "ai-sdk" | "workers-ai" | "resend" | "stripe" | "revenuecat" | "sentry" | "posthog";
|
|
36
36
|
}[];
|
|
37
37
|
completion: string[];
|
|
38
38
|
resourcesProvisioned: boolean;
|
|
@@ -49,6 +49,10 @@ function productCapability(id) {
|
|
|
49
49
|
? 'Signing, notarization, installers, updates, and distribution require a separate delivery workflow.'
|
|
50
50
|
: 'Extension signing, store submission, review, and distribution require a separate delivery workflow.');
|
|
51
51
|
}
|
|
52
|
+
if (id === 'stream') {
|
|
53
|
+
provisioning = stage('scaffold-only', 'Manual Stream activation and live input setup; no automatic Stream provisioning or runtime credential installation.', 'unverified');
|
|
54
|
+
limits.push('Server management factory only; creator/player UI, WHIP/WHEP signaling and playback token issuance require application implementation.', 'Keep management tokens server-only and disclose secret WHIP URLs only to authorized creators; verify private media access independently of hosting protection.', 'One-to-many broadcasts; conferencing, recording, HLS/DASH bridging, restreaming and live viewer counts are outside this integration.', 'Usage-based viewer-minute billing, account eligibility and live broadcast/playback acceptance require separate verification.');
|
|
55
|
+
}
|
|
52
56
|
if (id === 'neon-realtime') {
|
|
53
57
|
provisioning = stage('scaffold-only', 'Manually enable Realtime on the intended Neon branch, configure allowed origins and supply its private secret and public URL; no automatic Realtime provisioning.', 'unverified');
|
|
54
58
|
limits.push('Neon Realtime is beta and does not support RLS; authenticate requests and seal only explicitly scoped, read-only application queries.', 'Keep DATABASE_URL and NEON_REALTIME_SECRET server-only; clients use the public NEON_REALTIME_URL and short-lived sealed queries.', 'The package exposes separate server/client factories and a Drizzle adapter; no arbitrary SQL endpoint or application subscription flow is generated.', 'Live subscriptions, renewal, revocation, allowed origins and cross-tenant isolation require authorized acceptance; live behavior remains unverified.');
|
package/dist/cli-arguments.d.ts
CHANGED
|
@@ -14,3 +14,11 @@ export declare function globalArguments(input: readonly string[]): {
|
|
|
14
14
|
};
|
|
15
15
|
export declare function validateCommand(command: string | undefined, args: readonly string[]): void;
|
|
16
16
|
export declare function inlineArguments(command: string | undefined, args: readonly string[]): string[];
|
|
17
|
+
/** Collect validated options using the same arity and alias metadata as help. */
|
|
18
|
+
export declare function commandArguments(command: string, input: readonly string[]): {
|
|
19
|
+
positional: string[];
|
|
20
|
+
has: (flag: string) => boolean;
|
|
21
|
+
value: (flag: string) => string | undefined;
|
|
22
|
+
values: (flag: string) => string[];
|
|
23
|
+
};
|
|
24
|
+
export declare function commandArgumentError(command: string, message: string): CliArgumentError;
|
package/dist/cli-arguments.js
CHANGED
|
@@ -113,3 +113,35 @@ export function inlineArguments(command, args) {
|
|
|
113
113
|
return [flag, value];
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
+
/** Collect validated options using the same arity and alias metadata as help. */
|
|
117
|
+
export function commandArguments(command, input) {
|
|
118
|
+
validateCommand(command, input);
|
|
119
|
+
const args = inlineArguments(command, input);
|
|
120
|
+
const definitions = [...(commandDefinition(command)?.options ?? []), ...GLOBAL_OPTIONS];
|
|
121
|
+
const positional = [];
|
|
122
|
+
const options = new Map();
|
|
123
|
+
for (let index = 0; index < args.length; index++) {
|
|
124
|
+
const argument = args[index];
|
|
125
|
+
const option = definitions.find((entry) => entry.flag === argument || entry.aliases?.includes(argument));
|
|
126
|
+
if (!option) {
|
|
127
|
+
positional.push(argument);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const values = options.get(option.flag) ?? [];
|
|
131
|
+
const next = args[index + 1];
|
|
132
|
+
if (option.arity && next && !next.startsWith('-')) {
|
|
133
|
+
values.push(next);
|
|
134
|
+
index++;
|
|
135
|
+
}
|
|
136
|
+
options.set(option.flag, values);
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
positional,
|
|
140
|
+
has: (flag) => options.has(flag),
|
|
141
|
+
value: (flag) => options.get(flag)?.[0],
|
|
142
|
+
values: (flag) => [...(options.get(flag) ?? [])],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export function commandArgumentError(command, message) {
|
|
146
|
+
return new CliArgumentError(message, `Run anhedral ${command} --help.`);
|
|
147
|
+
}
|