@positronic/cli 0.0.38 → 0.0.39
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/dist/src/cli.js +41 -77
- package/dist/src/commands/brain.js +52 -410
- package/dist/src/commands/schedule.js +10 -4
- package/dist/src/components/brain-list.js +57 -21
- package/dist/src/components/brain-resolver.js +405 -0
- package/dist/src/components/brain-run.js +529 -0
- package/dist/src/components/brain-watch.js +356 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/commands/brain.d.ts +8 -8
- package/dist/types/commands/brain.d.ts.map +1 -1
- package/dist/types/commands/schedule.d.ts +2 -2
- package/dist/types/commands/schedule.d.ts.map +1 -1
- package/dist/types/components/brain-list.d.ts.map +1 -1
- package/dist/types/components/brain-resolver.d.ts +16 -0
- package/dist/types/components/brain-resolver.d.ts.map +1 -0
- package/dist/types/components/brain-run.d.ts +8 -0
- package/dist/types/components/brain-run.d.ts.map +1 -0
- package/dist/types/components/brain-watch.d.ts +12 -0
- package/dist/types/components/brain-watch.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/src/cli.js
CHANGED
|
@@ -363,16 +363,16 @@ export function buildCli(options) {
|
|
|
363
363
|
render(element);
|
|
364
364
|
});
|
|
365
365
|
// --- Brain History Command ---
|
|
366
|
-
cli = cli.command('history <
|
|
367
|
-
return yargsHistory.positional('
|
|
368
|
-
describe: '
|
|
366
|
+
cli = cli.command('history <brain>', 'List recent runs of a specific brain\n', function(yargsHistory) {
|
|
367
|
+
return yargsHistory.positional('brain', {
|
|
368
|
+
describe: 'Brain identifier (title, filename, or search term)',
|
|
369
369
|
type: 'string',
|
|
370
370
|
demandOption: true
|
|
371
371
|
}).option('limit', {
|
|
372
372
|
describe: 'Maximum number of runs to show',
|
|
373
373
|
type: 'number',
|
|
374
374
|
default: 10
|
|
375
|
-
}).example('$0 history my-brain', 'List recent runs for my-brain').example('$0 history my-brain --limit=20', 'List more recent runs');
|
|
375
|
+
}).example('$0 history my-brain', 'List recent runs for my-brain').example('$0 history "My Brain Title"', 'Search by title').example('$0 history my-brain --limit=20', 'List more recent runs');
|
|
376
376
|
}, function(argv) {
|
|
377
377
|
var element = brainCommand.history(argv);
|
|
378
378
|
render(element);
|
|
@@ -389,9 +389,9 @@ export function buildCli(options) {
|
|
|
389
389
|
render(element);
|
|
390
390
|
});
|
|
391
391
|
// --- Rerun Brain Command ---
|
|
392
|
-
cli = cli.command('rerun <
|
|
393
|
-
return yargsRerun.positional('
|
|
394
|
-
describe: '
|
|
392
|
+
cli = cli.command('rerun <brain> [run-id]', 'Rerun an existing brain run\n', function(yargsRerun) {
|
|
393
|
+
return yargsRerun.positional('brain', {
|
|
394
|
+
describe: 'Brain identifier (title, filename, or search term)',
|
|
395
395
|
type: 'string',
|
|
396
396
|
demandOption: true
|
|
397
397
|
}).positional('run-id', {
|
|
@@ -409,9 +409,9 @@ export function buildCli(options) {
|
|
|
409
409
|
render(element);
|
|
410
410
|
});
|
|
411
411
|
// --- Run Brain Command ---
|
|
412
|
-
cli = cli.command('run <
|
|
413
|
-
return yargsRun.positional('
|
|
414
|
-
describe: '
|
|
412
|
+
cli = cli.command('run <brain>', 'Run a brain and optionally watch its execution\n', function(yargsRun) {
|
|
413
|
+
return yargsRun.positional('brain', {
|
|
414
|
+
describe: 'Brain identifier (title, filename, or search term)',
|
|
415
415
|
type: 'string',
|
|
416
416
|
demandOption: true
|
|
417
417
|
}).option('watch', {
|
|
@@ -425,41 +425,23 @@ export function buildCli(options) {
|
|
|
425
425
|
alias: 'o',
|
|
426
426
|
string: true,
|
|
427
427
|
coerce: parseKeyValueOptions
|
|
428
|
-
}).example('$0 run my-brain', 'Run a brain by
|
|
428
|
+
}).example('$0 run my-brain', 'Run a brain by filename').example('$0 run "Email Digest"', 'Run a brain by title').example('$0 run email', 'Fuzzy search for brains matching "email"').example('$0 run my-brain --watch', 'Run a brain and watch its execution').example('$0 run my-brain -o channel=#general -o debug=true', 'Run a brain with options');
|
|
429
429
|
}, function(argv) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
return _ts_generator(this, function(_state) {
|
|
433
|
-
switch(_state.label){
|
|
434
|
-
case 0:
|
|
435
|
-
return [
|
|
436
|
-
4,
|
|
437
|
-
brainCommand.run(argv)
|
|
438
|
-
];
|
|
439
|
-
case 1:
|
|
440
|
-
element = _state.sent();
|
|
441
|
-
if (element) {
|
|
442
|
-
render(element);
|
|
443
|
-
}
|
|
444
|
-
return [
|
|
445
|
-
2
|
|
446
|
-
];
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
})();
|
|
430
|
+
var element = brainCommand.run(argv);
|
|
431
|
+
render(element);
|
|
450
432
|
});
|
|
451
433
|
// --- Watch Brain Run Command ---
|
|
452
|
-
cli = cli.command('watch [
|
|
453
|
-
return yargsWatch.positional('
|
|
454
|
-
describe: '
|
|
434
|
+
cli = cli.command('watch [brain]', 'Watch a brain run: latest by brain name (default) or specific by ID\n', function(yargsWatch) {
|
|
435
|
+
return yargsWatch.positional('brain', {
|
|
436
|
+
describe: 'Brain identifier to watch (watches the most recent active run)',
|
|
455
437
|
type: 'string'
|
|
456
438
|
}).option('run-id', {
|
|
457
439
|
describe: 'ID of the specific brain run to watch',
|
|
458
440
|
type: 'string',
|
|
459
441
|
alias: 'id'
|
|
460
|
-
}).conflicts('
|
|
461
|
-
if (!argv.
|
|
462
|
-
throw new Error('You must provide either a brain
|
|
442
|
+
}).conflicts('brain', 'run-id').check(function(argv) {
|
|
443
|
+
if (!argv.brain && !argv.runId) {
|
|
444
|
+
throw new Error('You must provide either a brain identifier or a --run-id.');
|
|
463
445
|
}
|
|
464
446
|
return true;
|
|
465
447
|
}).example('$0 watch my-brain', "Watch the latest run of the brain named 'my-brain'").example('$0 watch --run-id abc123def', 'Watch a specific brain run by its ID');
|
|
@@ -490,9 +472,9 @@ export function buildCli(options) {
|
|
|
490
472
|
yargsBrain.command('list', 'List all brains in the active project\n', function() {}, function(argv) {
|
|
491
473
|
var element = brainCommand.list(argv);
|
|
492
474
|
render(element);
|
|
493
|
-
}).command('history <
|
|
494
|
-
return yargsHistory.positional('
|
|
495
|
-
describe: '
|
|
475
|
+
}).command('history <brain>', 'List recent runs of a specific brain\n', function(yargsHistory) {
|
|
476
|
+
return yargsHistory.positional('brain', {
|
|
477
|
+
describe: 'Brain identifier (title, filename, or search term)',
|
|
496
478
|
type: 'string',
|
|
497
479
|
demandOption: true
|
|
498
480
|
}).option('limit', {
|
|
@@ -512,9 +494,9 @@ export function buildCli(options) {
|
|
|
512
494
|
}, function(argv) {
|
|
513
495
|
var element = brainCommand.show(argv);
|
|
514
496
|
render(element);
|
|
515
|
-
}).command('rerun <
|
|
516
|
-
return yargsRerun.positional('
|
|
517
|
-
describe: '
|
|
497
|
+
}).command('rerun <brain> [run-id]', 'Rerun an existing brain run\n', function(yargsRerun) {
|
|
498
|
+
return yargsRerun.positional('brain', {
|
|
499
|
+
describe: 'Brain identifier (title, filename, or search term)',
|
|
518
500
|
type: 'string',
|
|
519
501
|
demandOption: true
|
|
520
502
|
}).positional('run-id', {
|
|
@@ -530,9 +512,9 @@ export function buildCli(options) {
|
|
|
530
512
|
}, function(argv) {
|
|
531
513
|
var element = brainCommand.rerun(argv);
|
|
532
514
|
render(element);
|
|
533
|
-
}).command('run <
|
|
534
|
-
return yargsRun.positional('
|
|
535
|
-
describe: '
|
|
515
|
+
}).command('run <brain>', 'Run a brain and optionally watch its execution\n', function(yargsRun) {
|
|
516
|
+
return yargsRun.positional('brain', {
|
|
517
|
+
describe: 'Brain identifier (title, filename, or search term)',
|
|
536
518
|
type: 'string',
|
|
537
519
|
demandOption: true
|
|
538
520
|
}).option('watch', {
|
|
@@ -546,39 +528,21 @@ export function buildCli(options) {
|
|
|
546
528
|
alias: 'o',
|
|
547
529
|
string: true,
|
|
548
530
|
coerce: parseKeyValueOptions
|
|
549
|
-
}).example('$0 brain run my-brain', 'Run a brain by
|
|
531
|
+
}).example('$0 brain run my-brain', 'Run a brain by filename').example('$0 brain run "Email Digest"', 'Run a brain by title').example('$0 brain run email', 'Fuzzy search for brains matching "email"').example('$0 brain run my-brain --watch', 'Run a brain and watch its execution').example('$0 brain run my-brain -o channel=#general -o debug=true', 'Run a brain with options');
|
|
550
532
|
}, function(argv) {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return [
|
|
557
|
-
4,
|
|
558
|
-
brainCommand.run(argv)
|
|
559
|
-
];
|
|
560
|
-
case 1:
|
|
561
|
-
element = _state.sent();
|
|
562
|
-
if (element) {
|
|
563
|
-
render(element);
|
|
564
|
-
}
|
|
565
|
-
return [
|
|
566
|
-
2
|
|
567
|
-
];
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
})();
|
|
571
|
-
}).command('watch [filename]', 'Watch a brain run: latest by filename (default) or specific by ID\n', function(yargsWatch) {
|
|
572
|
-
return yargsWatch.positional('filename', {
|
|
573
|
-
describe: 'Filename of the brain to watch (watches the most recent run)',
|
|
533
|
+
var element = brainCommand.run(argv);
|
|
534
|
+
render(element);
|
|
535
|
+
}).command('watch [brain]', 'Watch a brain run: latest by brain name (default) or specific by ID\n', function(yargsWatch) {
|
|
536
|
+
return yargsWatch.positional('brain', {
|
|
537
|
+
describe: 'Brain identifier to watch (watches the most recent active run)',
|
|
574
538
|
type: 'string'
|
|
575
539
|
}).option('run-id', {
|
|
576
540
|
describe: 'ID of the specific brain run to watch',
|
|
577
541
|
type: 'string',
|
|
578
542
|
alias: 'id'
|
|
579
|
-
}).conflicts('
|
|
580
|
-
if (!argv.
|
|
581
|
-
throw new Error('You must provide either a brain
|
|
543
|
+
}).conflicts('brain', 'run-id').check(function(argv) {
|
|
544
|
+
if (!argv.brain && !argv.runId) {
|
|
545
|
+
throw new Error('You must provide either a brain identifier or a --run-id.');
|
|
582
546
|
}
|
|
583
547
|
return true;
|
|
584
548
|
}).example('$0 brain watch my-brain', "Watch the latest run of the brain named 'my-brain'").example('$0 brain watch --run-id abc123def', 'Watch a specific brain run by its ID');
|
|
@@ -757,11 +721,11 @@ export function buildCli(options) {
|
|
|
757
721
|
}
|
|
758
722
|
}, true);
|
|
759
723
|
yargsSchedule.command([
|
|
760
|
-
'create <brain
|
|
761
|
-
'c <brain
|
|
724
|
+
'create <brain> <cron-expression>',
|
|
725
|
+
'c <brain> <cron-expression>'
|
|
762
726
|
], 'Create a new schedule for a brain\n', function(yargsCreate) {
|
|
763
|
-
return yargsCreate.positional('brain
|
|
764
|
-
describe: '
|
|
727
|
+
return yargsCreate.positional('brain', {
|
|
728
|
+
describe: 'Brain identifier (title, filename, or search term)',
|
|
765
729
|
type: 'string',
|
|
766
730
|
demandOption: true
|
|
767
731
|
}).positional('cron-expression', {
|