@solidactions/cli 3.2.0 → 3.4.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 +30 -6
- package/dist/command-manifest.json +4546 -0
- package/dist/commands/deploy.js +13 -0
- package/dist/commands/login.js +4 -57
- package/dist/commands/project-list.js +27 -6
- package/dist/commands/project-view.js +3 -0
- package/dist/commands/schedule-delete.js +12 -2
- package/dist/commands/schedule-list.js +29 -5
- package/dist/commands/schedule-set.js +18 -2
- package/dist/commands/schedule-state.js +71 -0
- package/dist/commands/state.js +139 -0
- package/dist/index.js +106 -28
- package/dist/utils/api.js +6 -15
- package/dist/utils/command-manifest.js +221 -0
- package/dist/utils/source-provenance.js +3 -0
- package/dist/utils/webhook-formatters.js +36 -4
- package/dist/utils/workspace-lookup.js +56 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.program = void 0;
|
|
40
41
|
const chalk_1 = __importDefault(require("chalk"));
|
|
41
42
|
const commander_1 = require("commander");
|
|
42
43
|
const deploy_1 = require("./commands/deploy");
|
|
@@ -60,6 +61,7 @@ const env_set_1 = require("./commands/env-set");
|
|
|
60
61
|
const schedule_set_1 = require("./commands/schedule-set");
|
|
61
62
|
const schedule_list_1 = require("./commands/schedule-list");
|
|
62
63
|
const schedule_delete_1 = require("./commands/schedule-delete");
|
|
64
|
+
const schedule_state_1 = require("./commands/schedule-state");
|
|
63
65
|
const webhook_list_1 = require("./commands/webhook-list");
|
|
64
66
|
const webhook_secret_1 = require("./commands/webhook-secret");
|
|
65
67
|
const dev_1 = require("./commands/dev");
|
|
@@ -87,10 +89,11 @@ const crew_env_set_1 = require("./commands/crew-env-set");
|
|
|
87
89
|
const crew_env_list_1 = require("./commands/crew-env-list");
|
|
88
90
|
const crew_env_delete_1 = require("./commands/crew-env-delete");
|
|
89
91
|
const crew_env_push_1 = require("./commands/crew-env-push");
|
|
92
|
+
const state_1 = require("./commands/state");
|
|
90
93
|
const config_1 = require("./utils/config");
|
|
91
94
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
92
95
|
const pkg = require('../package.json');
|
|
93
|
-
|
|
96
|
+
exports.program = new commander_1.Command();
|
|
94
97
|
if (process.env.SOLIDACTIONS_DEBUG === '1') {
|
|
95
98
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
96
99
|
const { resolveConfig } = require('./utils/config');
|
|
@@ -113,7 +116,7 @@ if (process.env.SOLIDACTIONS_DEBUG === '1') {
|
|
|
113
116
|
process.stderr.write('[SOLIDACTIONS_DEBUG] no config resolvable\n');
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
|
-
program
|
|
119
|
+
exports.program
|
|
117
120
|
.name('solidactions')
|
|
118
121
|
.description('SolidActions CLI - Deploy and manage workflow automation')
|
|
119
122
|
.version(pkg.version);
|
|
@@ -123,8 +126,8 @@ program
|
|
|
123
126
|
// a parent option of the same name, so `login --workspace <x>` was being
|
|
124
127
|
// swallowed by this global flag instead of reaching login()'s own option.
|
|
125
128
|
// The short form `-w` is unaffected and remains the primary way to use this.
|
|
126
|
-
program.option('-w, --workspace-override <id-or-slug-or-name>', 'Override active workspace for this command (short form: -w)');
|
|
127
|
-
program.hook('preAction', (thisCommand, actionCommand) => {
|
|
129
|
+
exports.program.option('-w, --workspace-override <id-or-slug-or-name>', 'Override active workspace for this command (short form: -w)');
|
|
130
|
+
exports.program.hook('preAction', (thisCommand, actionCommand) => {
|
|
128
131
|
const opts = thisCommand.opts();
|
|
129
132
|
const wsOverride = opts.workspaceOverride;
|
|
130
133
|
if (wsOverride) {
|
|
@@ -142,7 +145,7 @@ program.hook('preAction', (thisCommand, actionCommand) => {
|
|
|
142
145
|
// =============================================================================
|
|
143
146
|
// Top-level commands
|
|
144
147
|
// =============================================================================
|
|
145
|
-
program
|
|
148
|
+
exports.program
|
|
146
149
|
.command('login')
|
|
147
150
|
.description('Authenticate the CLI (prompts securely for your API key, or via --device for browser-based login)')
|
|
148
151
|
.argument('[api-key]', 'Legacy positional API key (prefer the masked prompt, --stdin, or --device)')
|
|
@@ -168,7 +171,7 @@ Environment:
|
|
|
168
171
|
const resolvedApiKey = await (0, login_1.resolveLoginApiKey)(apiKey, { stdin: options.stdin });
|
|
169
172
|
await (0, login_1.login)(resolvedApiKey, options);
|
|
170
173
|
});
|
|
171
|
-
program
|
|
174
|
+
exports.program
|
|
172
175
|
.command('init')
|
|
173
176
|
.description('Scaffold a new SolidActions project (files + AI skills)')
|
|
174
177
|
.argument('[directory]', 'Directory to create (omit to scaffold in the current empty directory)')
|
|
@@ -178,7 +181,7 @@ program
|
|
|
178
181
|
.action(async (directory, options) => {
|
|
179
182
|
await (0, init_1.init)(directory, options);
|
|
180
183
|
});
|
|
181
|
-
program
|
|
184
|
+
exports.program
|
|
182
185
|
.command('logout')
|
|
183
186
|
.description('Remove saved credentials')
|
|
184
187
|
.option('--local', 'Remove only the nearest local ./.solidactions/config.json')
|
|
@@ -186,13 +189,13 @@ program
|
|
|
186
189
|
.action((options) => {
|
|
187
190
|
(0, login_1.logout)(options);
|
|
188
191
|
});
|
|
189
|
-
program
|
|
192
|
+
exports.program
|
|
190
193
|
.command('whoami')
|
|
191
194
|
.description('Show current configuration')
|
|
192
195
|
.action(() => {
|
|
193
196
|
(0, login_1.whoami)();
|
|
194
197
|
});
|
|
195
|
-
program
|
|
198
|
+
exports.program
|
|
196
199
|
.command('dev')
|
|
197
200
|
.description('Run a workflow locally using an in-memory mock server (no deploy needed)')
|
|
198
201
|
.argument('<file>', 'Workflow file to run (e.g., src/simple-steps.ts)')
|
|
@@ -207,7 +210,7 @@ program
|
|
|
207
210
|
// =============================================================================
|
|
208
211
|
// project <subcommand>
|
|
209
212
|
// =============================================================================
|
|
210
|
-
const project = program.command('project').description('Manage projects');
|
|
213
|
+
const project = exports.program.command('project').description('Manage projects');
|
|
211
214
|
project
|
|
212
215
|
.command('view')
|
|
213
216
|
.description('View project status and the client-reported deployed revision')
|
|
@@ -237,6 +240,7 @@ project
|
|
|
237
240
|
.option('-e, --env <environment>', 'Target environment (production/staging/dev). Required on first deploy of a new project.')
|
|
238
241
|
.option('--create', 'Create environment project if it doesn\'t exist')
|
|
239
242
|
.option('--config-only', 'Sync YAML env declarations without building/deploying')
|
|
243
|
+
.option('--paused', 'Deploy with all YAML-declared schedules initially paused')
|
|
240
244
|
.option('--no-cache', 'Force a fresh build, bypassing all build caches')
|
|
241
245
|
.option('--force-rebuild', 'Force a fresh build, bypassing all build caches (alias for --no-cache)')
|
|
242
246
|
.option('--no-git-metadata', 'Do not transmit Git provenance (branch, commit subject, and sanitized remote repository URL; credentials are stripped); also available as SOLIDACTIONS_NO_GIT_METADATA=1')
|
|
@@ -272,10 +276,48 @@ project
|
|
|
272
276
|
.action((options) => {
|
|
273
277
|
(0, project_list_1.projectList)(options);
|
|
274
278
|
});
|
|
279
|
+
project
|
|
280
|
+
.command('enable')
|
|
281
|
+
.description('Allow new workflow starts for a project environment')
|
|
282
|
+
.argument('<project>', 'Project name')
|
|
283
|
+
.option('-e, --env <environment>', 'Environment (production/staging/dev). Defaults to dev.', 'dev')
|
|
284
|
+
.action(async (projectName, options) => {
|
|
285
|
+
await (0, state_1.projectEnable)(projectName, options);
|
|
286
|
+
});
|
|
287
|
+
project
|
|
288
|
+
.command('disable')
|
|
289
|
+
.description('Block new workflow starts for a project environment')
|
|
290
|
+
.argument('<project>', 'Project name')
|
|
291
|
+
.option('-e, --env <environment>', 'Environment (production/staging/dev). Defaults to dev.', 'dev')
|
|
292
|
+
.action(async (projectName, options) => {
|
|
293
|
+
await (0, state_1.projectDisable)(projectName, options);
|
|
294
|
+
});
|
|
295
|
+
// =============================================================================
|
|
296
|
+
// workflow <subcommand>
|
|
297
|
+
// =============================================================================
|
|
298
|
+
const workflow = exports.program.command('workflow').description('Manage deployed workflows');
|
|
299
|
+
workflow
|
|
300
|
+
.command('enable')
|
|
301
|
+
.description('Allow new starts for a deployed workflow')
|
|
302
|
+
.argument('<project>', 'Project name')
|
|
303
|
+
.argument('<workflow>', 'Workflow name or slug')
|
|
304
|
+
.option('-e, --env <environment>', 'Environment (production/staging/dev). Defaults to dev.', 'dev')
|
|
305
|
+
.action(async (projectName, workflowName, options) => {
|
|
306
|
+
await (0, state_1.workflowEnable)(projectName, workflowName, options);
|
|
307
|
+
});
|
|
308
|
+
workflow
|
|
309
|
+
.command('disable')
|
|
310
|
+
.description('Block new starts for a deployed workflow')
|
|
311
|
+
.argument('<project>', 'Project name')
|
|
312
|
+
.argument('<workflow>', 'Workflow name or slug')
|
|
313
|
+
.option('-e, --env <environment>', 'Environment (production/staging/dev). Defaults to dev.', 'dev')
|
|
314
|
+
.action(async (projectName, workflowName, options) => {
|
|
315
|
+
await (0, state_1.workflowDisable)(projectName, workflowName, options);
|
|
316
|
+
});
|
|
275
317
|
// =============================================================================
|
|
276
318
|
// run <subcommand>
|
|
277
319
|
// =============================================================================
|
|
278
|
-
const runCmd = program.command('run').description('Manage workflow runs');
|
|
320
|
+
const runCmd = exports.program.command('run').description('Manage workflow runs');
|
|
279
321
|
runCmd
|
|
280
322
|
.command('start')
|
|
281
323
|
.description('Trigger a workflow run')
|
|
@@ -319,7 +361,7 @@ runCmd
|
|
|
319
361
|
// =============================================================================
|
|
320
362
|
// env <subcommand>
|
|
321
363
|
// =============================================================================
|
|
322
|
-
const env = program.command('env').description('Manage variables');
|
|
364
|
+
const env = exports.program.command('env').description('Manage variables');
|
|
323
365
|
env
|
|
324
366
|
.command('set')
|
|
325
367
|
.description('Set a variable (create or update, global or project)')
|
|
@@ -404,7 +446,7 @@ env
|
|
|
404
446
|
// =============================================================================
|
|
405
447
|
// crew env <subcommand>
|
|
406
448
|
// =============================================================================
|
|
407
|
-
const crew = program.command('crew').description('Manage crews');
|
|
449
|
+
const crew = exports.program.command('crew').description('Manage crews');
|
|
408
450
|
const crewEnv = crew.command('env').description('Manage crew variables');
|
|
409
451
|
crewEnv
|
|
410
452
|
.command('set')
|
|
@@ -448,7 +490,7 @@ crewEnv
|
|
|
448
490
|
// =============================================================================
|
|
449
491
|
// schedule <subcommand>
|
|
450
492
|
// =============================================================================
|
|
451
|
-
const schedule = program.command('schedule').description('Manage cron schedules');
|
|
493
|
+
const schedule = exports.program.command('schedule').description('Manage cron schedules');
|
|
452
494
|
schedule
|
|
453
495
|
.command('set')
|
|
454
496
|
.description('Set a cron schedule for a workflow')
|
|
@@ -457,6 +499,8 @@ schedule
|
|
|
457
499
|
.option('--workflow <name>', 'Workflow name (if project has multiple)')
|
|
458
500
|
.option('-i, --input <json>', 'JSON input to pass to scheduled runs')
|
|
459
501
|
.option('-z, --timezone <iana>', 'IANA timezone the cron is evaluated in (e.g. America/Chicago); defaults to UTC')
|
|
502
|
+
.option('-e, --env <environment>', 'Resolve an explicit environment (production/staging/dev)')
|
|
503
|
+
.option('--paused', 'Create or replace the schedule disabled')
|
|
460
504
|
.option('-y, --yes', 'Skip confirmation if schedule already exists')
|
|
461
505
|
.action((projectName, cron, options) => {
|
|
462
506
|
(0, schedule_set_1.scheduleSet)(projectName, cron, options);
|
|
@@ -465,14 +509,43 @@ schedule
|
|
|
465
509
|
.command('list')
|
|
466
510
|
.description('List schedules for a project')
|
|
467
511
|
.argument('<project>', 'Project name')
|
|
468
|
-
.
|
|
469
|
-
(
|
|
512
|
+
.option('-e, --env <environment>', 'Resolve an explicit environment (production/staging/dev)')
|
|
513
|
+
.action((projectName, options) => {
|
|
514
|
+
(0, schedule_list_1.scheduleList)(projectName, options);
|
|
515
|
+
});
|
|
516
|
+
schedule
|
|
517
|
+
.command('enable')
|
|
518
|
+
.description('Enable a schedule with a sticky operator override')
|
|
519
|
+
.argument('<project>', 'Project name')
|
|
520
|
+
.argument('<schedule-id>', 'Schedule ID')
|
|
521
|
+
.option('-e, --env <environment>', 'Resolve an explicit environment (production/staging/dev)')
|
|
522
|
+
.action((projectName, scheduleId, options) => {
|
|
523
|
+
(0, schedule_state_1.scheduleEnable)(projectName, scheduleId, options);
|
|
524
|
+
});
|
|
525
|
+
schedule
|
|
526
|
+
.command('disable')
|
|
527
|
+
.description('Disable a schedule with a sticky operator override')
|
|
528
|
+
.argument('<project>', 'Project name')
|
|
529
|
+
.argument('<schedule-id>', 'Schedule ID')
|
|
530
|
+
.option('-e, --env <environment>', 'Resolve an explicit environment (production/staging/dev)')
|
|
531
|
+
.action((projectName, scheduleId, options) => {
|
|
532
|
+
(0, schedule_state_1.scheduleDisable)(projectName, scheduleId, options);
|
|
533
|
+
});
|
|
534
|
+
schedule
|
|
535
|
+
.command('reset')
|
|
536
|
+
.description('Return a schedule to its last declared YAML configuration')
|
|
537
|
+
.argument('<project>', 'Project name')
|
|
538
|
+
.argument('<schedule-id>', 'Schedule ID')
|
|
539
|
+
.option('-e, --env <environment>', 'Resolve an explicit environment (production/staging/dev)')
|
|
540
|
+
.action((projectName, scheduleId, options) => {
|
|
541
|
+
(0, schedule_state_1.scheduleReset)(projectName, scheduleId, options);
|
|
470
542
|
});
|
|
471
543
|
schedule
|
|
472
544
|
.command('delete')
|
|
473
545
|
.description('Delete a schedule')
|
|
474
546
|
.argument('<project>', 'Project name')
|
|
475
547
|
.argument('<schedule-id>', 'Schedule ID')
|
|
548
|
+
.option('-e, --env <environment>', 'Resolve an explicit environment (production/staging/dev)')
|
|
476
549
|
.option('-y, --yes', 'Skip confirmation prompt')
|
|
477
550
|
.action((projectName, scheduleId, options) => {
|
|
478
551
|
(0, schedule_delete_1.scheduleDelete)(projectName, scheduleId, options);
|
|
@@ -480,7 +553,7 @@ schedule
|
|
|
480
553
|
// =============================================================================
|
|
481
554
|
// webhook <subcommand>
|
|
482
555
|
// =============================================================================
|
|
483
|
-
const webhook = program.command('webhook').description('Manage webhooks');
|
|
556
|
+
const webhook = exports.program.command('webhook').description('Manage webhooks');
|
|
484
557
|
webhook
|
|
485
558
|
.command('list')
|
|
486
559
|
.description('List webhook URLs for a project')
|
|
@@ -504,7 +577,7 @@ webhook
|
|
|
504
577
|
// =============================================================================
|
|
505
578
|
// workspace <subcommand>
|
|
506
579
|
// =============================================================================
|
|
507
|
-
const workspace = program.command('workspace').description('Manage workspaces');
|
|
580
|
+
const workspace = exports.program.command('workspace').description('Manage workspaces');
|
|
508
581
|
workspace
|
|
509
582
|
.command('list')
|
|
510
583
|
.description('List your workspaces across all organizations')
|
|
@@ -529,7 +602,7 @@ Where the pin is saved (--local / --global):
|
|
|
529
602
|
// =============================================================================
|
|
530
603
|
// oauth-action <subcommand>
|
|
531
604
|
// =============================================================================
|
|
532
|
-
const oauthActionCmd = program.command('oauth-action').description('Discover OAuth-backed API operations callable via the SA proxy');
|
|
605
|
+
const oauthActionCmd = exports.program.command('oauth-action').description('Discover OAuth-backed API operations callable via the SA proxy');
|
|
533
606
|
oauthActionCmd
|
|
534
607
|
.command('search <platform> [query]')
|
|
535
608
|
.description('Search available actions for a connected platform')
|
|
@@ -566,7 +639,7 @@ oauthActionCmd
|
|
|
566
639
|
// =============================================================================
|
|
567
640
|
// connection <subcommand>
|
|
568
641
|
// =============================================================================
|
|
569
|
-
const connection = program.command('connection').description('Manage OAuth connections');
|
|
642
|
+
const connection = exports.program.command('connection').description('Manage OAuth connections');
|
|
570
643
|
connection
|
|
571
644
|
.command('list')
|
|
572
645
|
.description('List OAuth connections in the active workspace')
|
|
@@ -576,7 +649,7 @@ connection
|
|
|
576
649
|
// =============================================================================
|
|
577
650
|
// ai <subcommand>
|
|
578
651
|
// =============================================================================
|
|
579
|
-
const ai = program.command('ai').description('AI helper tools');
|
|
652
|
+
const ai = exports.program.command('ai').description('AI helper tools');
|
|
580
653
|
ai
|
|
581
654
|
.command('init')
|
|
582
655
|
.description('Install SolidActions AI skills and SDK reference for AI-assisted development')
|
|
@@ -593,7 +666,7 @@ ai
|
|
|
593
666
|
// =============================================================================
|
|
594
667
|
// skill <subcommand> (SOP surface — flat top-level noun per cli#34)
|
|
595
668
|
// =============================================================================
|
|
596
|
-
const skill = program.command('skill').description('Manage agent skills (crews SOP surface)');
|
|
669
|
+
const skill = exports.program.command('skill').description('Manage agent skills (crews SOP surface)');
|
|
597
670
|
skill
|
|
598
671
|
.command('push')
|
|
599
672
|
.description('Push a local skill folder into the library (create, or update if it already exists)')
|
|
@@ -685,7 +758,7 @@ skill
|
|
|
685
758
|
// =============================================================================
|
|
686
759
|
// role <subcommand> (SOP surface — flat peer of skill, per cli#34)
|
|
687
760
|
// =============================================================================
|
|
688
|
-
const role = program.command('role').description('Manage roles (crews SOP surface)');
|
|
761
|
+
const role = exports.program.command('role').description('Manage roles (crews SOP surface)');
|
|
689
762
|
role
|
|
690
763
|
.command('push <dir>')
|
|
691
764
|
.description('Push a role definition (create or update)')
|
|
@@ -697,7 +770,7 @@ role
|
|
|
697
770
|
// =============================================================================
|
|
698
771
|
// doc <subcommand> (SA-Docs surface)
|
|
699
772
|
// =============================================================================
|
|
700
|
-
const doc = program.command('doc').description('Manage docs in SA-Docs');
|
|
773
|
+
const doc = exports.program.command('doc').description('Manage docs in SA-Docs');
|
|
701
774
|
doc
|
|
702
775
|
.command('push')
|
|
703
776
|
.description('Recursively upload a local markdown tree into SA-Docs')
|
|
@@ -731,7 +804,12 @@ doc
|
|
|
731
804
|
.action(async (files, options) => {
|
|
732
805
|
await (0, doc_upload_1.docUpload)(files, { folder: options.folder, title: options.title, replace: options.replace });
|
|
733
806
|
});
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
807
|
+
// Only parse argv when this file IS the process entry point (the `solidactions`
|
|
808
|
+
// bin). The #1004 command-manifest generator requires this module to walk the
|
|
809
|
+
// assembled command tree; that must not consume the caller's argv or exit.
|
|
810
|
+
if (require.main === module) {
|
|
811
|
+
exports.program.parseAsync().catch((err) => {
|
|
812
|
+
console.error(chalk_1.default.red(err.message ?? String(err)));
|
|
813
|
+
process.exit(1);
|
|
814
|
+
});
|
|
815
|
+
}
|
package/dist/utils/api.js
CHANGED
|
@@ -17,7 +17,6 @@ exports.ensureWorkspaceSelected = ensureWorkspaceSelected;
|
|
|
17
17
|
exports.requireConfigWithWorkspace = requireConfigWithWorkspace;
|
|
18
18
|
const axios_1 = __importDefault(require("axios"));
|
|
19
19
|
const chalk_1 = __importDefault(require("chalk"));
|
|
20
|
-
const readline_1 = __importDefault(require("readline"));
|
|
21
20
|
const config_1 = require("./config");
|
|
22
21
|
const workspace_lookup_1 = require("./workspace-lookup");
|
|
23
22
|
// Backend (solidactions-app PR #128) returns: "Project '<slug>' not found in your active workspace '<workspace-slug>'."
|
|
@@ -223,7 +222,7 @@ function authFailureMessage(config, sources) {
|
|
|
223
222
|
const keySource = sources?.apiKey ?? 'config';
|
|
224
223
|
return `Authentication failed against ${config.host} (key from ${keySource}). Run \`solidactions login --global\` to re-configure.`;
|
|
225
224
|
}
|
|
226
|
-
async function ensureWorkspaceSelected(config) {
|
|
225
|
+
async function ensureWorkspaceSelected(config, dependencies = {}) {
|
|
227
226
|
if (config.workspaceId) {
|
|
228
227
|
return config;
|
|
229
228
|
}
|
|
@@ -286,22 +285,14 @@ async function ensureWorkspaceSelected(config) {
|
|
|
286
285
|
+ 'Run `solidactions workspace set <name-or-id> --local` (or --global).'));
|
|
287
286
|
process.exit(1);
|
|
288
287
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
const chosen = await (0, workspace_lookup_1.selectWorkspaceInteractively)(workspaces, {
|
|
289
|
+
...dependencies,
|
|
290
|
+
label: (ws) => `${ws.name} ${chalk_1.default.gray(`(${ws.org_name}, ${ws.role})`)}`,
|
|
292
291
|
});
|
|
293
|
-
|
|
294
|
-
const rl = readline_1.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
295
|
-
const answer = await new Promise((resolve) => {
|
|
296
|
-
rl.question(chalk_1.default.blue('Enter number: '), resolve);
|
|
297
|
-
});
|
|
298
|
-
rl.close();
|
|
299
|
-
const index = parseInt(answer, 10) - 1;
|
|
300
|
-
if (isNaN(index) || index < 0 || index >= workspaces.length) {
|
|
301
|
-
console.error(chalk_1.default.red('Invalid selection.'));
|
|
292
|
+
if (!chosen) {
|
|
302
293
|
process.exit(1);
|
|
303
294
|
}
|
|
304
|
-
selected =
|
|
295
|
+
selected = chosen;
|
|
305
296
|
}
|
|
306
297
|
config.workspace = selected.slug ?? selected.name;
|
|
307
298
|
config.workspaceId = selected.id;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMAND_MANIFEST_FILE = exports.COMMAND_MANIFEST_SCHEMA_VERSION = void 0;
|
|
4
|
+
exports.buildCommandManifest = buildCommandManifest;
|
|
5
|
+
/**
|
|
6
|
+
* Machine-readable description of the CLI's command surface, generated from the
|
|
7
|
+
* commander definitions at build time (#1004 PR 0). Consumers — chiefly the
|
|
8
|
+
* content repo's prose validator — pin a released manifest and fail CI when
|
|
9
|
+
* documentation names a command or flag that does not exist here.
|
|
10
|
+
*
|
|
11
|
+
* Follows the `schema_version` precedent set by src/utils/skill-cache.ts.
|
|
12
|
+
*/
|
|
13
|
+
exports.COMMAND_MANIFEST_SCHEMA_VERSION = 1;
|
|
14
|
+
exports.COMMAND_MANIFEST_FILE = 'command-manifest.json';
|
|
15
|
+
/**
|
|
16
|
+
* True when `value` survives JSON.stringify without becoming undefined —
|
|
17
|
+
* functions, symbols and undefined do not, and must never reach the manifest.
|
|
18
|
+
*/
|
|
19
|
+
function isJsonSafe(value) {
|
|
20
|
+
try {
|
|
21
|
+
return JSON.stringify(value) !== undefined;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function applyDefault(target, defaultValue, defaultValueDescription) {
|
|
28
|
+
if (defaultValue === undefined) {
|
|
29
|
+
if (defaultValueDescription !== undefined) {
|
|
30
|
+
target.default_description = defaultValueDescription;
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (isJsonSafe(defaultValue)) {
|
|
35
|
+
target.default = defaultValue;
|
|
36
|
+
if (defaultValueDescription !== undefined) {
|
|
37
|
+
target.default_description = defaultValueDescription;
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
target.default_description = defaultValueDescription ?? String(defaultValue);
|
|
42
|
+
}
|
|
43
|
+
function describeOption(option) {
|
|
44
|
+
const entry = {
|
|
45
|
+
flags: option.flags,
|
|
46
|
+
long: option.long ?? null,
|
|
47
|
+
short: option.short ?? null,
|
|
48
|
+
description: option.description,
|
|
49
|
+
required: option.mandatory === true,
|
|
50
|
+
value_required: option.required === true,
|
|
51
|
+
value_optional: option.optional === true,
|
|
52
|
+
variadic: option.variadic === true,
|
|
53
|
+
negated: option.negate === true,
|
|
54
|
+
hidden: option.hidden === true,
|
|
55
|
+
};
|
|
56
|
+
// commander's Command.addOption() (lib/command.js ~:548) defaults a negated
|
|
57
|
+
// option's positive attribute to `true` when no explicit defaultValue was
|
|
58
|
+
// given (and no positive counterpart option is registered) — e.g.
|
|
59
|
+
// `--no-cache` implicitly defaults `cache` to `true`. That implicit default
|
|
60
|
+
// lives in the Command's option-processing, not on Option.defaultValue, so
|
|
61
|
+
// it's otherwise invisible here.
|
|
62
|
+
const defaultValue = option.negate === true && option.defaultValue === undefined ? true : option.defaultValue;
|
|
63
|
+
applyDefault(entry, defaultValue, option.defaultValueDescription);
|
|
64
|
+
if (option.argChoices) {
|
|
65
|
+
entry.choices = [...option.argChoices];
|
|
66
|
+
}
|
|
67
|
+
return entry;
|
|
68
|
+
}
|
|
69
|
+
function describeArgument(argument) {
|
|
70
|
+
const entry = {
|
|
71
|
+
name: argument.name(),
|
|
72
|
+
required: argument.required === true,
|
|
73
|
+
variadic: argument.variadic === true,
|
|
74
|
+
description: argument.description,
|
|
75
|
+
};
|
|
76
|
+
applyDefault(entry, argument.defaultValue, argument.defaultValueDescription);
|
|
77
|
+
if (argument.argChoices) {
|
|
78
|
+
entry.choices = [...argument.argChoices];
|
|
79
|
+
}
|
|
80
|
+
return entry;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* commander exposes no public getter for a command hidden via
|
|
84
|
+
* `.command(name, { hidden: true })` — the flag lives on the private `_hidden`
|
|
85
|
+
* field, which its own help renderer reads. Read it the same way.
|
|
86
|
+
*/
|
|
87
|
+
function isHiddenCommand(command) {
|
|
88
|
+
return command._hidden === true;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* commander auto-adds a `-h, --help` option to every command, but it is
|
|
92
|
+
* synthesized at help-render time (see lib/help.js `visibleOptions`) rather
|
|
93
|
+
* than being a real `Option` living in `command.options` — so the plain
|
|
94
|
+
* `command.options.map(describeOption)` walk below silently drops it from
|
|
95
|
+
* the manifest. Downstream doc validators need it (real prose documents
|
|
96
|
+
* `--help`), so read the same private fields commander's own help renderer
|
|
97
|
+
* reads (`_hasHelpOption`, `_helpFlags`, `_helpShortFlag`, `_helpLongFlag`,
|
|
98
|
+
* `_helpDescription` — there is no public getter for any of them) and
|
|
99
|
+
* synthesize an equivalent manifest entry by hand.
|
|
100
|
+
*
|
|
101
|
+
* commander also suppresses a help flag form when a real option on the
|
|
102
|
+
* command already owns that exact flag (`Help.visibleOptions` in
|
|
103
|
+
* lib/help.js, via `Command._findOption`/`Option.is`) — e.g.
|
|
104
|
+
* `.option('-h, --human')` steals `-h` from the synthesized help option, so
|
|
105
|
+
* only `--help` is shown. Mirror that per-form check here.
|
|
106
|
+
*/
|
|
107
|
+
function describeHelpOption(command) {
|
|
108
|
+
const cmd = command;
|
|
109
|
+
if (cmd._hasHelpOption !== true) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const ownsFlag = (flag) => flag !== undefined && command.options.some((option) => option.short === flag || option.long === flag);
|
|
113
|
+
const showShort = cmd._helpShortFlag !== undefined && !ownsFlag(cmd._helpShortFlag);
|
|
114
|
+
const showLong = !ownsFlag(cmd._helpLongFlag);
|
|
115
|
+
if (!showShort && !showLong) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const short = showShort ? (cmd._helpShortFlag ?? null) : null;
|
|
119
|
+
const long = showLong ? (cmd._helpLongFlag ?? null) : null;
|
|
120
|
+
const flags = showShort && showLong
|
|
121
|
+
? (cmd._helpFlags ?? [short, long].filter((flag) => flag !== null).join(', '))
|
|
122
|
+
: (long ?? short);
|
|
123
|
+
return {
|
|
124
|
+
flags,
|
|
125
|
+
long,
|
|
126
|
+
short,
|
|
127
|
+
description: cmd._helpDescription ?? '',
|
|
128
|
+
required: false,
|
|
129
|
+
value_required: false,
|
|
130
|
+
value_optional: false,
|
|
131
|
+
variadic: false,
|
|
132
|
+
negated: false,
|
|
133
|
+
hidden: false,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* commander adds an implicit `help [command]` (sub)command to any command
|
|
138
|
+
* that has children, no action handler of its own, and no explicit `help`
|
|
139
|
+
* command already registered (`_hasImplicitHelpCommand()` in command.js) —
|
|
140
|
+
* but, like the `-h, --help` option above, it is synthesized at help-render
|
|
141
|
+
* time (see `Help.visibleCommands` in lib/help.js) rather than living in
|
|
142
|
+
* `command.commands`, so the recursive walk in `describeCommand` never sees
|
|
143
|
+
* it. It is real and typable at every level it applies — both
|
|
144
|
+
* `solidactions help project` and `solidactions project help view` work —
|
|
145
|
+
* so downstream doc validators need an entry for it too. Reconstruct it the
|
|
146
|
+
* same way commander's own help renderer does (there is no public API for
|
|
147
|
+
* any of `_hasImplicitHelpCommand`, `_helpCommandnameAndArgs`,
|
|
148
|
+
* `_helpCommandDescription`): build a throwaway `Command` from those private
|
|
149
|
+
* fields, then run it through the normal `describeCommand` walk so its shape
|
|
150
|
+
* (path, aliases, options via `describeHelpOption`, etc.) matches every
|
|
151
|
+
* other command for free.
|
|
152
|
+
*/
|
|
153
|
+
function describeImplicitHelpCommand(command, path) {
|
|
154
|
+
const cmd = command;
|
|
155
|
+
if (typeof cmd._hasImplicitHelpCommand !== 'function' || !cmd._hasImplicitHelpCommand()) {
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
const nameAndArgs = cmd._helpCommandnameAndArgs ?? 'help [command]';
|
|
159
|
+
const match = nameAndArgs.match(/([^ ]+) *(.*)/);
|
|
160
|
+
const helpName = match?.[1] ?? 'help';
|
|
161
|
+
const helpArgs = match?.[2] ?? '';
|
|
162
|
+
// Same construction as commander's Help.visibleCommands: a fresh command
|
|
163
|
+
// with its own help option turned off (commander never lists "-h, --help"
|
|
164
|
+
// twice for the same invocation) and, when the nameAndArgs spec carries
|
|
165
|
+
// one (e.g. "[command]"), the optional target-command argument.
|
|
166
|
+
const helpCommand = command.createCommand(helpName).helpOption(false);
|
|
167
|
+
helpCommand.description(cmd._helpCommandDescription ?? '');
|
|
168
|
+
if (helpArgs) {
|
|
169
|
+
helpCommand.arguments(helpArgs);
|
|
170
|
+
}
|
|
171
|
+
return describeCommand(helpCommand, path);
|
|
172
|
+
}
|
|
173
|
+
function describeCommand(command, parentPath) {
|
|
174
|
+
const path = [...parentPath, command.name()];
|
|
175
|
+
const options = command.options.map(describeOption);
|
|
176
|
+
const helpOption = describeHelpOption(command);
|
|
177
|
+
if (helpOption) {
|
|
178
|
+
options.push(helpOption);
|
|
179
|
+
}
|
|
180
|
+
const entry = {
|
|
181
|
+
path,
|
|
182
|
+
name: command.name(),
|
|
183
|
+
aliases: [...command.aliases()],
|
|
184
|
+
description: command.description(),
|
|
185
|
+
hidden: isHiddenCommand(command),
|
|
186
|
+
arguments: command.registeredArguments.map(describeArgument),
|
|
187
|
+
options,
|
|
188
|
+
};
|
|
189
|
+
return [
|
|
190
|
+
entry,
|
|
191
|
+
...command.commands.flatMap((child) => describeCommand(child, path)),
|
|
192
|
+
...describeImplicitHelpCommand(command, path),
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Walk an assembled commander program into its manifest. Declaration order is
|
|
197
|
+
* preserved throughout: it is already deterministic and mirrors help ordering.
|
|
198
|
+
*/
|
|
199
|
+
function buildCommandManifest(program, cliVersion) {
|
|
200
|
+
// The root program's `-h, --help` is the same commander-synthesized
|
|
201
|
+
// option as describeHelpOption handles per-command (see that function's
|
|
202
|
+
// comment) — commander keeps it outside `program.options` too, so the
|
|
203
|
+
// plain `program.options.map(describeOption)` walk below would otherwise
|
|
204
|
+
// silently drop it from global_options even though `solidactions --help`
|
|
205
|
+
// works (README.md documents it).
|
|
206
|
+
const globalOptions = program.options.map(describeOption);
|
|
207
|
+
const rootHelpOption = describeHelpOption(program);
|
|
208
|
+
if (rootHelpOption) {
|
|
209
|
+
globalOptions.push(rootHelpOption);
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
schema_version: exports.COMMAND_MANIFEST_SCHEMA_VERSION,
|
|
213
|
+
cli_name: program.name(),
|
|
214
|
+
cli_version: cliVersion,
|
|
215
|
+
global_options: globalOptions,
|
|
216
|
+
commands: [
|
|
217
|
+
...program.commands.flatMap((command) => describeCommand(command, [])),
|
|
218
|
+
...describeImplicitHelpCommand(program, []),
|
|
219
|
+
],
|
|
220
|
+
};
|
|
221
|
+
}
|
|
@@ -237,5 +237,8 @@ function parseDeployAcceptance(data) {
|
|
|
237
237
|
deploymentId: nullableString(body.deployment_id),
|
|
238
238
|
sourceMetadata,
|
|
239
239
|
sourceMetadataRejected: nullableString(body.source_metadata_rejected),
|
|
240
|
+
schedulesPaused: typeof body.schedules_paused === 'boolean'
|
|
241
|
+
? body.schedules_paused
|
|
242
|
+
: null,
|
|
240
243
|
};
|
|
241
244
|
}
|