@positronic/cli 0.0.76 → 0.0.78
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 +306 -198
- package/dist/src/commands/server.js +2 -2
- package/dist/src/components/brain-show.js +1 -1
- package/dist/src/components/event-detail.js +139 -139
- package/dist/src/components/events-view.js +60 -63
- package/dist/src/components/watch-keyboard.js +1 -1
- package/dist/src/components/watch-machine.js +344 -286
- package/dist/src/components/watch.js +17 -84
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/components/brain-show.d.ts.map +1 -1
- package/dist/types/components/event-detail.d.ts.map +1 -1
- package/dist/types/components/events-view.d.ts.map +1 -1
- package/dist/types/components/watch-machine.d.ts +90 -146
- package/dist/types/components/watch-machine.d.ts.map +1 -1
- package/dist/types/components/watch.d.ts.map +1 -1
- package/dist/types/hooks/useBrainMachine.d.ts +0 -3
- package/dist/types/hooks/useBrainMachine.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/src/commands/auth.js +0 -91
- package/dist/src/commands/brain.js +0 -139
- package/dist/src/commands/pages.js +0 -47
- package/dist/src/commands/project.js +0 -130
- package/dist/src/commands/resources.js +0 -272
- package/dist/src/commands/schedule.js +0 -91
- package/dist/src/commands/secrets.js +0 -67
- package/dist/src/commands/store.js +0 -36
- package/dist/src/commands/users.js +0 -92
- package/dist/src/components/agent-chat-view.js +0 -125
- package/dist/src/utils/agent-utils.js +0 -107
- package/dist/types/commands/auth.d.ts +0 -32
- package/dist/types/commands/auth.d.ts.map +0 -1
- package/dist/types/commands/brain.d.ts +0 -46
- package/dist/types/commands/brain.d.ts.map +0 -1
- package/dist/types/commands/pages.d.ts +0 -15
- package/dist/types/commands/pages.d.ts.map +0 -1
- package/dist/types/commands/project.d.ts +0 -55
- package/dist/types/commands/project.d.ts.map +0 -1
- package/dist/types/commands/resources.d.ts +0 -13
- package/dist/types/commands/resources.d.ts.map +0 -1
- package/dist/types/commands/schedule.d.ts +0 -33
- package/dist/types/commands/schedule.d.ts.map +0 -1
- package/dist/types/commands/secrets.d.ts +0 -20
- package/dist/types/commands/secrets.d.ts.map +0 -1
- package/dist/types/commands/store.d.ts +0 -5
- package/dist/types/commands/store.d.ts.map +0 -1
- package/dist/types/commands/users.d.ts +0 -34
- package/dist/types/commands/users.d.ts.map +0 -1
- package/dist/types/components/agent-chat-view.d.ts +0 -12
- package/dist/types/components/agent-chat-view.d.ts.map +0 -1
- package/dist/types/utils/agent-utils.d.ts +0 -20
- package/dist/types/utils/agent-utils.d.ts.map +0 -1
package/dist/src/cli.js
CHANGED
|
@@ -35,19 +35,6 @@ function _async_to_generator(fn) {
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function _define_property(obj, key, value) {
|
|
39
|
-
if (key in obj) {
|
|
40
|
-
Object.defineProperty(obj, key, {
|
|
41
|
-
value: value,
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
obj[key] = value;
|
|
48
|
-
}
|
|
49
|
-
return obj;
|
|
50
|
-
}
|
|
51
38
|
function _instanceof(left, right) {
|
|
52
39
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
53
40
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -61,45 +48,6 @@ function _iterable_to_array(iter) {
|
|
|
61
48
|
function _non_iterable_rest() {
|
|
62
49
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
63
50
|
}
|
|
64
|
-
function _object_spread(target) {
|
|
65
|
-
for(var i = 1; i < arguments.length; i++){
|
|
66
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
67
|
-
var ownKeys = Object.keys(source);
|
|
68
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
69
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
70
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
ownKeys.forEach(function(key) {
|
|
74
|
-
_define_property(target, key, source[key]);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return target;
|
|
78
|
-
}
|
|
79
|
-
function ownKeys(object, enumerableOnly) {
|
|
80
|
-
var keys = Object.keys(object);
|
|
81
|
-
if (Object.getOwnPropertySymbols) {
|
|
82
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
83
|
-
if (enumerableOnly) {
|
|
84
|
-
symbols = symbols.filter(function(sym) {
|
|
85
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
keys.push.apply(keys, symbols);
|
|
89
|
-
}
|
|
90
|
-
return keys;
|
|
91
|
-
}
|
|
92
|
-
function _object_spread_props(target, source) {
|
|
93
|
-
source = source != null ? source : {};
|
|
94
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
95
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
96
|
-
} else {
|
|
97
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
98
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return target;
|
|
102
|
-
}
|
|
103
51
|
function _to_array(arr) {
|
|
104
52
|
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
105
53
|
}
|
|
@@ -205,19 +153,66 @@ function _ts_generator(thisArg, body) {
|
|
|
205
153
|
import yargs from 'yargs';
|
|
206
154
|
import { hideBin } from 'yargs/helpers';
|
|
207
155
|
import React from 'react';
|
|
208
|
-
import { ProjectCommand } from './commands/project.js';
|
|
209
156
|
import { ServerCommand } from './commands/server.js';
|
|
210
|
-
import {
|
|
211
|
-
import { ResourcesCommand } from './commands/resources.js';
|
|
212
|
-
import { ScheduleCommand } from './commands/schedule.js';
|
|
213
|
-
import { SecretsCommand } from './commands/secrets.js';
|
|
214
|
-
import { PagesCommand } from './commands/pages.js';
|
|
215
|
-
import { UsersCommand } from './commands/users.js';
|
|
216
|
-
import { AuthCommand } from './commands/auth.js';
|
|
217
|
-
import { StoreCommand } from './commands/store.js';
|
|
218
|
-
import { readFileSync } from 'fs';
|
|
157
|
+
import { readFileSync, existsSync, mkdirSync } from 'fs';
|
|
219
158
|
import { fileURLToPath } from 'url';
|
|
220
159
|
import { dirname, join } from 'path';
|
|
160
|
+
// Brain components
|
|
161
|
+
import { BrainList } from './components/brain-list.js';
|
|
162
|
+
import { BrainHistory } from './components/brain-history.js';
|
|
163
|
+
import { BrainShow } from './components/brain-show.js';
|
|
164
|
+
import { RunShow } from './components/run-show.js';
|
|
165
|
+
import { BrainRerun } from './components/brain-rerun.js';
|
|
166
|
+
import { BrainRun } from './components/brain-run.js';
|
|
167
|
+
import { BrainKill } from './components/brain-kill.js';
|
|
168
|
+
import { BrainResolver } from './components/brain-resolver.js';
|
|
169
|
+
import { WatchResolver } from './components/watch-resolver.js';
|
|
170
|
+
import { TopNavigator } from './components/top-navigator.js';
|
|
171
|
+
// Schedule components
|
|
172
|
+
import { ScheduleCreate } from './components/schedule-create.js';
|
|
173
|
+
import { ScheduleList } from './components/schedule-list.js';
|
|
174
|
+
import { ScheduleDelete } from './components/schedule-delete.js';
|
|
175
|
+
import { ScheduleRuns } from './components/schedule-runs.js';
|
|
176
|
+
import { ScheduleTimezone } from './components/schedule-timezone.js';
|
|
177
|
+
// Secrets components
|
|
178
|
+
import { SecretsList } from './components/secrets-list.js';
|
|
179
|
+
import { SecretsCreate } from './components/secrets-create.js';
|
|
180
|
+
import { SecretsDelete } from './components/secrets-delete.js';
|
|
181
|
+
import { SecretsBulk } from './components/secrets-bulk.js';
|
|
182
|
+
// Pages components
|
|
183
|
+
import { PagesList } from './components/pages-list.js';
|
|
184
|
+
import { PageDelete } from './components/page-delete.js';
|
|
185
|
+
// Users components
|
|
186
|
+
import { UsersList } from './components/users-list.js';
|
|
187
|
+
import { UsersCreate } from './components/users-create.js';
|
|
188
|
+
import { UsersDelete } from './components/users-delete.js';
|
|
189
|
+
import { UsersKeysList } from './components/users-keys-list.js';
|
|
190
|
+
import { UsersKeysAdd } from './components/users-keys-add.js';
|
|
191
|
+
import { UsersKeysRemove } from './components/users-keys-remove.js';
|
|
192
|
+
// Auth components
|
|
193
|
+
import { AuthLogin } from './components/auth-login.js';
|
|
194
|
+
import { AuthLogout } from './components/auth-logout.js';
|
|
195
|
+
import { Whoami } from './components/whoami.js';
|
|
196
|
+
// Project components
|
|
197
|
+
import { ProjectAdd } from './components/project-add.js';
|
|
198
|
+
import { ProjectList } from './components/project-list.js';
|
|
199
|
+
import { ProjectSelect } from './components/project-select.js';
|
|
200
|
+
import { ProjectShow } from './components/project-show.js';
|
|
201
|
+
import { ProjectCreate } from './components/project-create.js';
|
|
202
|
+
import { ProjectRemove } from './components/project-remove.js';
|
|
203
|
+
// Store components
|
|
204
|
+
import { StoreExplorer } from './components/store-explorer.js';
|
|
205
|
+
// Resource components
|
|
206
|
+
import { ResourceList } from './components/resource-list.js';
|
|
207
|
+
import { ResourceSync } from './components/resource-sync.js';
|
|
208
|
+
import { ResourceClear } from './components/resource-clear.js';
|
|
209
|
+
import { ResourceDelete } from './components/resource-delete.js';
|
|
210
|
+
import { ResourceUpload } from './components/resource-upload.js';
|
|
211
|
+
import { ResourceTypes } from './components/resource-types.js';
|
|
212
|
+
// Shared
|
|
213
|
+
import { ErrorComponent } from './components/error.js';
|
|
214
|
+
import { ProjectConfigManager } from './commands/project-config-manager.js';
|
|
215
|
+
import { scanLocalResources } from './commands/helpers.js';
|
|
221
216
|
// Helper function to parse key=value options
|
|
222
217
|
function parseKeyValueOptions(opts) {
|
|
223
218
|
if (!opts || opts.length === 0) return undefined;
|
|
@@ -292,6 +287,15 @@ function parseStateValues(opts) {
|
|
|
292
287
|
export function buildCli(options) {
|
|
293
288
|
var _options_argv = options.argv, argv = _options_argv === void 0 ? hideBin(process.argv) : _options_argv, server = options.server, _options_exitProcess = options.exitProcess, exitProcess = _options_exitProcess === void 0 ? false : _options_exitProcess, render = options.render, projectRootPath = options.projectRootPath;
|
|
294
289
|
var isLocalDevMode = server !== undefined;
|
|
290
|
+
function renderLocalDevOnly() {
|
|
291
|
+
render(React.createElement(ErrorComponent, {
|
|
292
|
+
error: {
|
|
293
|
+
title: 'Command Not Available',
|
|
294
|
+
message: 'This command is only available in local dev mode',
|
|
295
|
+
details: 'Please run this command from within a Positronic project directory.'
|
|
296
|
+
}
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
295
299
|
// Get version from package.json
|
|
296
300
|
var version = 'TEST'; // Default version for test environment where package.json path differs
|
|
297
301
|
try {
|
|
@@ -304,13 +308,7 @@ export function buildCli(options) {
|
|
|
304
308
|
// In test environment, the relative path to package.json is different
|
|
305
309
|
// so we use 'TEST' as the version to avoid breaking tests
|
|
306
310
|
}
|
|
307
|
-
|
|
308
|
-
var projectCommand = new ProjectCommand();
|
|
309
|
-
var brainCommand = new BrainCommand();
|
|
310
|
-
var scheduleCommand = new ScheduleCommand();
|
|
311
|
-
var secretsCommand = new SecretsCommand();
|
|
312
|
-
var pagesCommand = new PagesCommand();
|
|
313
|
-
var usersCommand = new UsersCommand();
|
|
311
|
+
var configManager = new ProjectConfigManager();
|
|
314
312
|
// Main CLI definition
|
|
315
313
|
var cli = yargs(argv).scriptName('positronic').usage('Usage: $0 <command> [options]').version(version).alias('v', 'version').help('h').alias('h', 'help').wrap(null).strictCommands().exitProcess(exitProcess);
|
|
316
314
|
// --- Project Management Commands (Global Mode Only) ---
|
|
@@ -323,8 +321,9 @@ export function buildCli(options) {
|
|
|
323
321
|
demandOption: true
|
|
324
322
|
});
|
|
325
323
|
}, function(argv) {
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
render(React.createElement(ProjectCreate, {
|
|
325
|
+
projectPathArg: argv.name
|
|
326
|
+
}));
|
|
328
327
|
});
|
|
329
328
|
}
|
|
330
329
|
yargsProject.command('add <name>', 'Add a project to your list of projects', function(yargsAdd) {
|
|
@@ -338,22 +337,29 @@ export function buildCli(options) {
|
|
|
338
337
|
demandOption: true
|
|
339
338
|
}).example('$0 project add my-project --url https://api.my-project.positronic.sh', 'Add a project configuration');
|
|
340
339
|
}, function(argv) {
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
render(React.createElement(ProjectAdd, {
|
|
341
|
+
name: argv.name,
|
|
342
|
+
url: argv.url,
|
|
343
|
+
projectConfig: configManager
|
|
344
|
+
}));
|
|
343
345
|
}).command('select [name]', 'Switch the active project', function(yargsSelect) {
|
|
344
346
|
return yargsSelect.positional('name', {
|
|
345
347
|
describe: 'Project name to select',
|
|
346
348
|
type: 'string'
|
|
347
349
|
}).example('$0 project select my-project', 'Switch the active project').example('$0 project select', 'Interactive project selection');
|
|
348
350
|
}, function(argv) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
render(React.createElement(ProjectSelect, {
|
|
352
|
+
name: argv.name,
|
|
353
|
+
projectConfig: configManager
|
|
354
|
+
}));
|
|
351
355
|
}).command('list', 'List all of your Positronic projects', function() {}, function() {
|
|
352
|
-
|
|
353
|
-
|
|
356
|
+
render(React.createElement(ProjectList, {
|
|
357
|
+
projectConfig: configManager
|
|
358
|
+
}));
|
|
354
359
|
}).command('show', 'Display your currently selected project', function() {}, function() {
|
|
355
|
-
|
|
356
|
-
|
|
360
|
+
render(React.createElement(ProjectShow, {
|
|
361
|
+
projectConfig: configManager
|
|
362
|
+
}));
|
|
357
363
|
}).command('rm <name>', 'Remove a project from your list of projects', function(yargsRm) {
|
|
358
364
|
return yargsRm.positional('name', {
|
|
359
365
|
describe: 'Name of the project to remove',
|
|
@@ -361,8 +367,10 @@ export function buildCli(options) {
|
|
|
361
367
|
demandOption: true
|
|
362
368
|
}).example('$0 project rm my-project', 'Remove a project configuration');
|
|
363
369
|
}, function(argv) {
|
|
364
|
-
|
|
365
|
-
|
|
370
|
+
render(React.createElement(ProjectRemove, {
|
|
371
|
+
name: argv.name,
|
|
372
|
+
projectConfig: configManager
|
|
373
|
+
}));
|
|
366
374
|
}).demandCommand(1, 'You need to specify a project command (add, select, list, show, rm) in Local Dev Mode.');
|
|
367
375
|
return yargsProject;
|
|
368
376
|
});
|
|
@@ -375,8 +383,9 @@ export function buildCli(options) {
|
|
|
375
383
|
demandOption: true
|
|
376
384
|
});
|
|
377
385
|
}, function(argv) {
|
|
378
|
-
|
|
379
|
-
|
|
386
|
+
render(React.createElement(ProjectCreate, {
|
|
387
|
+
projectPathArg: argv.name
|
|
388
|
+
}));
|
|
380
389
|
});
|
|
381
390
|
}
|
|
382
391
|
// --- Add the Server Command ---
|
|
@@ -454,9 +463,8 @@ export function buildCli(options) {
|
|
|
454
463
|
});
|
|
455
464
|
}
|
|
456
465
|
// --- List Brains Command ---
|
|
457
|
-
cli = cli.command('list', 'List all brains in the active project\n', function() {}, function(
|
|
458
|
-
|
|
459
|
-
render(element);
|
|
466
|
+
cli = cli.command('list', 'List all brains in the active project\n', function() {}, function() {
|
|
467
|
+
render(React.createElement(BrainList));
|
|
460
468
|
});
|
|
461
469
|
// --- Brain History Command ---
|
|
462
470
|
cli = cli.command('history <brain>', 'List recent runs of a specific brain\n', function(yargsHistory) {
|
|
@@ -470,8 +478,15 @@ export function buildCli(options) {
|
|
|
470
478
|
default: 10
|
|
471
479
|
}).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');
|
|
472
480
|
}, function(argv) {
|
|
473
|
-
|
|
474
|
-
|
|
481
|
+
render(React.createElement(BrainResolver, {
|
|
482
|
+
identifier: argv.brain,
|
|
483
|
+
children: function(resolvedBrainTitle) {
|
|
484
|
+
return React.createElement(BrainHistory, {
|
|
485
|
+
brainName: resolvedBrainTitle,
|
|
486
|
+
limit: argv.limit
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
}));
|
|
475
490
|
});
|
|
476
491
|
// --- Show Brain/Run Command ---
|
|
477
492
|
cli = cli.command('show [brain]', 'Show information about a brain or a specific run\n', function(yargsShow) {
|
|
@@ -493,11 +508,30 @@ export function buildCli(options) {
|
|
|
493
508
|
return true;
|
|
494
509
|
}).example('$0 show my-brain', 'Show info about my-brain').example('$0 show my-brain --steps', 'Show my-brain with step structure').example('$0 show --run-id abc123', 'Show details for a specific run');
|
|
495
510
|
}, function(argv) {
|
|
496
|
-
|
|
497
|
-
|
|
511
|
+
if (argv.runId) {
|
|
512
|
+
render(React.createElement(RunShow, {
|
|
513
|
+
runId: argv.runId
|
|
514
|
+
}));
|
|
515
|
+
} else if (argv.brain) {
|
|
516
|
+
render(React.createElement(BrainShow, {
|
|
517
|
+
identifier: argv.brain,
|
|
518
|
+
showSteps: argv.steps || false
|
|
519
|
+
}));
|
|
520
|
+
} else {
|
|
521
|
+
render(React.createElement(ErrorComponent, {
|
|
522
|
+
error: {
|
|
523
|
+
title: 'Missing Argument',
|
|
524
|
+
message: 'You must provide either a brain identifier or a run ID.',
|
|
525
|
+
details: 'Use: show <brain> to show brain info, or show --run-id <id> to show run info.'
|
|
526
|
+
}
|
|
527
|
+
}));
|
|
528
|
+
}
|
|
498
529
|
});
|
|
499
530
|
// --- Rerun Brain Command ---
|
|
500
|
-
cli = cli.command(
|
|
531
|
+
cli = cli.command([
|
|
532
|
+
'rerun <run-id>',
|
|
533
|
+
'rr <run-id>'
|
|
534
|
+
], 'Rerun an existing brain run from a specific step\n', function(yargsRerun) {
|
|
501
535
|
return yargsRerun.positional('run-id', {
|
|
502
536
|
describe: 'ID of the brain run to rerun',
|
|
503
537
|
type: 'string',
|
|
@@ -508,8 +542,10 @@ export function buildCli(options) {
|
|
|
508
542
|
demandOption: true
|
|
509
543
|
}).alias('starts-at', 's').example('$0 rerun abc123 --starts-at=3', 'Rerun from step 3');
|
|
510
544
|
}, function(argv) {
|
|
511
|
-
|
|
512
|
-
|
|
545
|
+
render(React.createElement(BrainRerun, {
|
|
546
|
+
runId: argv.runId,
|
|
547
|
+
startsAt: argv.startsAt
|
|
548
|
+
}));
|
|
513
549
|
});
|
|
514
550
|
// --- Run Brain Command ---
|
|
515
551
|
cli = cli.command([
|
|
@@ -558,10 +594,12 @@ export function buildCli(options) {
|
|
|
558
594
|
} else if (argv.state) {
|
|
559
595
|
initialState = argv.state;
|
|
560
596
|
}
|
|
561
|
-
|
|
597
|
+
render(React.createElement(BrainRun, {
|
|
598
|
+
identifier: argv.brain,
|
|
599
|
+
watch: argv.watch,
|
|
600
|
+
options: argv.options,
|
|
562
601
|
initialState: initialState
|
|
563
602
|
}));
|
|
564
|
-
render(element);
|
|
565
603
|
});
|
|
566
604
|
// --- Watch Brain Run Command ---
|
|
567
605
|
cli = cli.command('watch <identifier>', 'Watch a brain run by brain name or run ID\n', function(yargsWatch) {
|
|
@@ -576,8 +614,10 @@ export function buildCli(options) {
|
|
|
576
614
|
default: false
|
|
577
615
|
}).example('$0 watch my-brain', "Watch the latest run of the brain named 'my-brain'").example('$0 watch abc123def', 'Watch a specific brain run by its ID').example('$0 watch my-brain --events', 'Watch with events log view');
|
|
578
616
|
}, function(argv) {
|
|
579
|
-
|
|
580
|
-
|
|
617
|
+
render(React.createElement(WatchResolver, {
|
|
618
|
+
identifier: argv.identifier,
|
|
619
|
+
startWithEvents: argv.events
|
|
620
|
+
}));
|
|
581
621
|
});
|
|
582
622
|
// --- Top Command (view running brains) ---
|
|
583
623
|
cli = cli.command('top [brain]', 'View live status of all running brains\n', function(yargsTop) {
|
|
@@ -586,14 +626,14 @@ export function buildCli(options) {
|
|
|
586
626
|
type: 'string'
|
|
587
627
|
}).example('$0 top', 'View all running brains').example('$0 top my-brain', 'View running brains matching "my-brain"');
|
|
588
628
|
}, function(argv) {
|
|
589
|
-
|
|
590
|
-
|
|
629
|
+
render(React.createElement(TopNavigator, {
|
|
630
|
+
brainFilter: argv.brain
|
|
631
|
+
}));
|
|
591
632
|
});
|
|
592
633
|
// --- Brain Commands ---
|
|
593
634
|
cli = cli.command('brain', 'Manage your brains\n', function(yargsBrain) {
|
|
594
|
-
yargsBrain.command('list', 'List all brains in the active project\n', function() {}, function(
|
|
595
|
-
|
|
596
|
-
render(element);
|
|
635
|
+
yargsBrain.command('list', 'List all brains in the active project\n', function() {}, function() {
|
|
636
|
+
render(React.createElement(BrainList));
|
|
597
637
|
}).command('history <brain>', 'List recent runs of a specific brain\n', function(yargsHistory) {
|
|
598
638
|
return yargsHistory.positional('brain', {
|
|
599
639
|
describe: 'Brain identifier (title, filename, or search term)',
|
|
@@ -605,8 +645,15 @@ export function buildCli(options) {
|
|
|
605
645
|
default: 10
|
|
606
646
|
}).example('$0 brain history my-brain', 'List recent runs for my-brain').example('$0 brain history my-brain --limit=20', 'List more recent runs');
|
|
607
647
|
}, function(argv) {
|
|
608
|
-
|
|
609
|
-
|
|
648
|
+
render(React.createElement(BrainResolver, {
|
|
649
|
+
identifier: argv.brain,
|
|
650
|
+
children: function(resolvedBrainTitle) {
|
|
651
|
+
return React.createElement(BrainHistory, {
|
|
652
|
+
brainName: resolvedBrainTitle,
|
|
653
|
+
limit: argv.limit
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
}));
|
|
610
657
|
}).command('show [brain]', 'Show information about a brain or a specific run\n', function(yargsShow) {
|
|
611
658
|
return yargsShow.positional('brain', {
|
|
612
659
|
describe: 'Brain identifier to show info for',
|
|
@@ -626,9 +673,28 @@ export function buildCli(options) {
|
|
|
626
673
|
return true;
|
|
627
674
|
}).example('$0 brain show my-brain', 'Show info about my-brain').example('$0 brain show my-brain --steps', 'Show my-brain with step structure').example('$0 brain show --run-id abc123', 'Show details for a specific run');
|
|
628
675
|
}, function(argv) {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
676
|
+
if (argv.runId) {
|
|
677
|
+
render(React.createElement(RunShow, {
|
|
678
|
+
runId: argv.runId
|
|
679
|
+
}));
|
|
680
|
+
} else if (argv.brain) {
|
|
681
|
+
render(React.createElement(BrainShow, {
|
|
682
|
+
identifier: argv.brain,
|
|
683
|
+
showSteps: argv.steps || false
|
|
684
|
+
}));
|
|
685
|
+
} else {
|
|
686
|
+
render(React.createElement(ErrorComponent, {
|
|
687
|
+
error: {
|
|
688
|
+
title: 'Missing Argument',
|
|
689
|
+
message: 'You must provide either a brain identifier or a run ID.',
|
|
690
|
+
details: 'Use: show <brain> to show brain info, or show --run-id <id> to show run info.'
|
|
691
|
+
}
|
|
692
|
+
}));
|
|
693
|
+
}
|
|
694
|
+
}).command([
|
|
695
|
+
'rerun <run-id>',
|
|
696
|
+
'rr <run-id>'
|
|
697
|
+
], 'Rerun an existing brain run from a specific step\n', function(yargsRerun) {
|
|
632
698
|
return yargsRerun.positional('run-id', {
|
|
633
699
|
describe: 'ID of the brain run to rerun',
|
|
634
700
|
type: 'string',
|
|
@@ -639,8 +705,10 @@ export function buildCli(options) {
|
|
|
639
705
|
demandOption: true
|
|
640
706
|
}).alias('starts-at', 's').example('$0 brain rerun abc123 --starts-at=3', 'Rerun from step 3');
|
|
641
707
|
}, function(argv) {
|
|
642
|
-
|
|
643
|
-
|
|
708
|
+
render(React.createElement(BrainRerun, {
|
|
709
|
+
runId: argv.runId,
|
|
710
|
+
startsAt: argv.startsAt
|
|
711
|
+
}));
|
|
644
712
|
}).command('run <brain>', 'Run a brain and optionally watch its execution\n', function(yargsRun) {
|
|
645
713
|
return yargsRun.positional('brain', {
|
|
646
714
|
describe: 'Brain identifier (title, filename, or search term)',
|
|
@@ -684,10 +752,12 @@ export function buildCli(options) {
|
|
|
684
752
|
} else if (argv.state) {
|
|
685
753
|
initialState = argv.state;
|
|
686
754
|
}
|
|
687
|
-
|
|
755
|
+
render(React.createElement(BrainRun, {
|
|
756
|
+
identifier: argv.brain,
|
|
757
|
+
watch: argv.watch,
|
|
758
|
+
options: argv.options,
|
|
688
759
|
initialState: initialState
|
|
689
760
|
}));
|
|
690
|
-
render(element);
|
|
691
761
|
}).command('watch <identifier>', 'Watch a brain run by brain name or run ID\n', function(yargsWatch) {
|
|
692
762
|
return yargsWatch.positional('identifier', {
|
|
693
763
|
describe: 'Brain name or run ID to watch',
|
|
@@ -700,8 +770,10 @@ export function buildCli(options) {
|
|
|
700
770
|
default: false
|
|
701
771
|
}).example('$0 brain watch my-brain', "Watch the latest run of the brain named 'my-brain'").example('$0 brain watch abc123def', 'Watch a specific brain run by its ID').example('$0 brain watch my-brain --events', 'Watch with events log view');
|
|
702
772
|
}, function(argv) {
|
|
703
|
-
|
|
704
|
-
|
|
773
|
+
render(React.createElement(WatchResolver, {
|
|
774
|
+
identifier: argv.identifier,
|
|
775
|
+
startWithEvents: argv.events
|
|
776
|
+
}));
|
|
705
777
|
}).command('kill <run-id>', 'Kill a running brain\n', function(yargsKill) {
|
|
706
778
|
return yargsKill.positional('run-id', {
|
|
707
779
|
describe: 'ID of the brain run to kill',
|
|
@@ -714,64 +786,64 @@ export function buildCli(options) {
|
|
|
714
786
|
default: false
|
|
715
787
|
}).example('$0 brain kill abc123def', 'Kill a running brain by its run ID').example('$0 brain kill abc123def --force', 'Kill a brain without confirmation');
|
|
716
788
|
}, function(argv) {
|
|
717
|
-
|
|
718
|
-
|
|
789
|
+
render(React.createElement(BrainKill, {
|
|
790
|
+
runId: argv.runId,
|
|
791
|
+
force: argv.force
|
|
792
|
+
}));
|
|
719
793
|
}).command('top [brain]', 'View live status of all running brains\n', function(yargsTop) {
|
|
720
794
|
return yargsTop.positional('brain', {
|
|
721
795
|
describe: 'Filter to brains matching this name',
|
|
722
796
|
type: 'string'
|
|
723
797
|
}).example('$0 brain top', 'View all running brains').example('$0 brain top my-brain', 'View running brains matching "my-brain"');
|
|
724
798
|
}, function(argv) {
|
|
725
|
-
|
|
726
|
-
|
|
799
|
+
render(React.createElement(TopNavigator, {
|
|
800
|
+
brainFilter: argv.brain
|
|
801
|
+
}));
|
|
727
802
|
}).demandCommand(1, 'You need to specify a brain command (list, history, show, rerun, run, watch, kill, top).');
|
|
728
803
|
return yargsBrain;
|
|
729
804
|
});
|
|
730
805
|
// --- Resource Management Commands ---
|
|
731
806
|
cli = cli.command('resources', 'Resources are any data that can be used in your brains, agents, and prompts. They can be text or binaries.\n', function(yargsResource) {
|
|
732
|
-
var resourcesCommand = new ResourcesCommand(server);
|
|
733
807
|
yargsResource.command('list', 'List all resources in the active project\n', function(yargsListCmd) {
|
|
734
808
|
return yargsListCmd.example('$0 resources list', 'List all resources in the active project');
|
|
735
809
|
}, function() {
|
|
736
|
-
|
|
737
|
-
render(element);
|
|
810
|
+
render(React.createElement(ResourceList));
|
|
738
811
|
});
|
|
739
812
|
// Command available ONLY in Local Dev Mode
|
|
740
813
|
yargsResource.command('sync', 'Sync local resources folder with the server so they are available to brains when they run\n', function(yargsSyncCmd) {
|
|
741
814
|
return yargsSyncCmd.example('$0 resources sync', 'Upload new or modified resources to the server');
|
|
742
815
|
}, function() {
|
|
743
|
-
|
|
744
|
-
|
|
816
|
+
if (!server) {
|
|
817
|
+
renderLocalDevOnly();
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
var resourcesDir = join(server.projectRootDir, 'resources');
|
|
821
|
+
if (!existsSync(resourcesDir)) {
|
|
822
|
+
mkdirSync(resourcesDir, {
|
|
823
|
+
recursive: true
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
var localResources = scanLocalResources(resourcesDir);
|
|
827
|
+
render(React.createElement(ResourceSync, {
|
|
828
|
+
localResources: localResources,
|
|
829
|
+
resourcesDir: resourcesDir
|
|
830
|
+
}));
|
|
745
831
|
});
|
|
746
832
|
yargsResource.command('types', 'Generate TypeScript type definitions for resources\n', function(yargsTypesCmd) {
|
|
747
833
|
return yargsTypesCmd.example('$0 resources types', 'Generate a resources.d.ts file with type definitions for all resources');
|
|
748
834
|
}, function() {
|
|
749
|
-
|
|
750
|
-
|
|
835
|
+
if (!server) {
|
|
836
|
+
renderLocalDevOnly();
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
render(React.createElement(ResourceTypes, {
|
|
840
|
+
projectRootDir: server.projectRootDir
|
|
841
|
+
}));
|
|
751
842
|
});
|
|
752
843
|
yargsResource.command('clear', 'Delete ALL resources from the server (development only)\n', function(yargsClearCmd) {
|
|
753
844
|
return yargsClearCmd.example('$0 resources clear', 'Delete all resources from the server');
|
|
754
845
|
}, function() {
|
|
755
|
-
|
|
756
|
-
var element;
|
|
757
|
-
return _ts_generator(this, function(_state) {
|
|
758
|
-
switch(_state.label){
|
|
759
|
-
case 0:
|
|
760
|
-
return [
|
|
761
|
-
4,
|
|
762
|
-
resourcesCommand.clear()
|
|
763
|
-
];
|
|
764
|
-
case 1:
|
|
765
|
-
element = _state.sent();
|
|
766
|
-
if (element) {
|
|
767
|
-
render(element);
|
|
768
|
-
}
|
|
769
|
-
return [
|
|
770
|
-
2
|
|
771
|
-
];
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
})();
|
|
846
|
+
render(React.createElement(ResourceClear));
|
|
775
847
|
});
|
|
776
848
|
// Upload/delete command available in both dev and production modes
|
|
777
849
|
yargsResource.command('upload <file>', 'Upload a file as a resource, or delete with -d flag\n', function(yargsUploadCmd) {
|
|
@@ -796,11 +868,18 @@ export function buildCli(options) {
|
|
|
796
868
|
}).example('$0 resources upload video.mp4', 'Upload a video file').example('$0 resources upload /path/to/large-file.zip --key archive/backup.zip', 'Upload with custom resource key').example('$0 resources upload -d video.mp4', 'Delete the resource with key "video.mp4"').example('$0 resources upload -d archive/backup.zip', 'Delete a resource with a nested key').example('$0 resources upload -d -f video.mp4', 'Delete a resource without confirmation');
|
|
797
869
|
}, function(argv) {
|
|
798
870
|
if (argv.delete) {
|
|
799
|
-
|
|
800
|
-
|
|
871
|
+
render(React.createElement(ResourceDelete, {
|
|
872
|
+
resourceKey: argv.file,
|
|
873
|
+
resourcePath: argv.file,
|
|
874
|
+
projectRootPath: server === null || server === void 0 ? void 0 : server.projectRootDir,
|
|
875
|
+
force: argv.force
|
|
876
|
+
}));
|
|
801
877
|
} else {
|
|
802
|
-
|
|
803
|
-
|
|
878
|
+
render(React.createElement(ResourceUpload, {
|
|
879
|
+
filePath: argv.file,
|
|
880
|
+
customKey: argv.key,
|
|
881
|
+
projectRootPath: server === null || server === void 0 ? void 0 : server.projectRootDir
|
|
882
|
+
}));
|
|
804
883
|
}
|
|
805
884
|
});
|
|
806
885
|
return yargsResource.demandCommand(1, 'You need to specify a resources command');
|
|
@@ -845,7 +924,7 @@ export function buildCli(options) {
|
|
|
845
924
|
// Handle top-level list/delete options
|
|
846
925
|
yargsSchedule.middleware(function(argv) {
|
|
847
926
|
return _async_to_generator(function() {
|
|
848
|
-
var
|
|
927
|
+
var result, result1;
|
|
849
928
|
return _ts_generator(this, function(_state) {
|
|
850
929
|
switch(_state.label){
|
|
851
930
|
case 0:
|
|
@@ -853,10 +932,9 @@ export function buildCli(options) {
|
|
|
853
932
|
3,
|
|
854
933
|
3
|
|
855
934
|
];
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
});
|
|
859
|
-
result = render(element);
|
|
935
|
+
result = render(React.createElement(ScheduleList, {
|
|
936
|
+
brainFilter: argv.brain
|
|
937
|
+
}));
|
|
860
938
|
if (!(result && typeof result.waitUntilExit === 'function')) return [
|
|
861
939
|
3,
|
|
862
940
|
2
|
|
@@ -877,11 +955,10 @@ export function buildCli(options) {
|
|
|
877
955
|
3,
|
|
878
956
|
6
|
|
879
957
|
];
|
|
880
|
-
|
|
958
|
+
result1 = render(React.createElement(ScheduleDelete, {
|
|
881
959
|
scheduleId: argv.delete,
|
|
882
960
|
force: argv.force
|
|
883
|
-
});
|
|
884
|
-
result1 = render(element1);
|
|
961
|
+
}));
|
|
885
962
|
if (!(result1 && typeof result1.waitUntilExit === 'function')) return [
|
|
886
963
|
3,
|
|
887
964
|
5
|
|
@@ -950,18 +1027,26 @@ export function buildCli(options) {
|
|
|
950
1027
|
} else if (argv.state) {
|
|
951
1028
|
initialState = argv.state;
|
|
952
1029
|
}
|
|
953
|
-
|
|
954
|
-
|
|
1030
|
+
render(React.createElement(BrainResolver, {
|
|
1031
|
+
identifier: argv.brain,
|
|
1032
|
+
children: function(resolvedBrainTitle) {
|
|
1033
|
+
return React.createElement(ScheduleCreate, {
|
|
1034
|
+
identifier: resolvedBrainTitle,
|
|
1035
|
+
cronExpression: argv.cronExpression,
|
|
1036
|
+
options: argv.options,
|
|
1037
|
+
initialState: initialState
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
955
1040
|
}));
|
|
956
|
-
render(element);
|
|
957
1041
|
}).command('timezone [timezone]', 'Get or set the project timezone for schedules\n', function(yargsTimezone) {
|
|
958
1042
|
return yargsTimezone.positional('timezone', {
|
|
959
1043
|
describe: 'IANA timezone (e.g., "America/Chicago", "Europe/London")',
|
|
960
1044
|
type: 'string'
|
|
961
1045
|
}).example('$0 schedule timezone', 'Show current project timezone').example('$0 schedule timezone America/Chicago', 'Set timezone to Central');
|
|
962
1046
|
}, function(argv) {
|
|
963
|
-
|
|
964
|
-
|
|
1047
|
+
render(React.createElement(ScheduleTimezone, {
|
|
1048
|
+
timezone: argv.timezone
|
|
1049
|
+
}));
|
|
965
1050
|
}).command('runs', 'List scheduled run history\n', function(yargsRuns) {
|
|
966
1051
|
return yargsRuns.option('schedule-id', {
|
|
967
1052
|
describe: 'Filter runs by schedule ID',
|
|
@@ -982,16 +1067,18 @@ export function buildCli(options) {
|
|
|
982
1067
|
]
|
|
983
1068
|
}).example('$0 schedule runs', 'List recent scheduled runs').example('$0 schedule runs --schedule-id abc123', 'List runs for a specific schedule').example('$0 schedule runs --status failed --limit 50', 'List last 50 failed scheduled runs');
|
|
984
1069
|
}, function(argv) {
|
|
985
|
-
|
|
986
|
-
|
|
1070
|
+
render(React.createElement(ScheduleRuns, {
|
|
1071
|
+
scheduleId: argv.scheduleId,
|
|
1072
|
+
limit: argv.limit,
|
|
1073
|
+
status: argv.status
|
|
1074
|
+
}));
|
|
987
1075
|
});
|
|
988
1076
|
return yargsSchedule;
|
|
989
1077
|
});
|
|
990
1078
|
// --- Pages Management Commands ---
|
|
991
1079
|
cli = cli.command('pages', 'Manage pages created by brains\n', function(yargsPages) {
|
|
992
|
-
yargsPages.command('list', 'List all pages\n', {}, function(
|
|
993
|
-
|
|
994
|
-
render(element);
|
|
1080
|
+
yargsPages.command('list', 'List all pages\n', {}, function() {
|
|
1081
|
+
render(React.createElement(PagesList));
|
|
995
1082
|
}).command('delete <slug>', 'Delete a page by slug\n', function(yargsDelete) {
|
|
996
1083
|
return yargsDelete.positional('slug', {
|
|
997
1084
|
describe: 'Slug of the page to delete',
|
|
@@ -1004,16 +1091,17 @@ export function buildCli(options) {
|
|
|
1004
1091
|
default: false
|
|
1005
1092
|
}).example('$0 pages delete my-page', 'Delete a page by slug').example('$0 pages delete my-page --force', 'Delete without confirmation');
|
|
1006
1093
|
}, function(argv) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1094
|
+
render(React.createElement(PageDelete, {
|
|
1095
|
+
slug: argv.slug,
|
|
1096
|
+
force: argv.force
|
|
1097
|
+
}));
|
|
1009
1098
|
}).demandCommand(1, 'You need to specify a subcommand');
|
|
1010
1099
|
return yargsPages;
|
|
1011
1100
|
});
|
|
1012
1101
|
// --- Secrets Management Commands ---
|
|
1013
1102
|
cli = cli.command('secrets', 'Manage secrets for your brains\n', function(yargsSecret) {
|
|
1014
1103
|
yargsSecret.command('list', 'List all secrets\n', {}, function() {
|
|
1015
|
-
|
|
1016
|
-
render(element);
|
|
1104
|
+
render(React.createElement(SecretsList));
|
|
1017
1105
|
}).command('create <name>', 'Create a new secret\n', function(yargsCreate) {
|
|
1018
1106
|
return yargsCreate.positional('name', {
|
|
1019
1107
|
describe: 'Name of the secret (e.g., ANTHROPIC_API_KEY)',
|
|
@@ -1024,8 +1112,10 @@ export function buildCli(options) {
|
|
|
1024
1112
|
type: 'string'
|
|
1025
1113
|
}).example('$0 secrets create ANTHROPIC_API_KEY', 'Create a secret with secure input').example('$0 secrets create DATABASE_URL --value "postgres://..."', 'Create a secret with direct value (not recommended)');
|
|
1026
1114
|
}, function(argv) {
|
|
1027
|
-
|
|
1028
|
-
|
|
1115
|
+
render(React.createElement(SecretsCreate, {
|
|
1116
|
+
name: argv.name,
|
|
1117
|
+
value: argv.value
|
|
1118
|
+
}));
|
|
1029
1119
|
}).command('delete <name>', 'Delete a secret\n', function(yargsDelete) {
|
|
1030
1120
|
return yargsDelete.positional('name', {
|
|
1031
1121
|
describe: 'Name of the secret to delete',
|
|
@@ -1033,24 +1123,25 @@ export function buildCli(options) {
|
|
|
1033
1123
|
demandOption: true
|
|
1034
1124
|
}).example('$0 secrets delete ANTHROPIC_API_KEY', 'Delete a secret');
|
|
1035
1125
|
}, function(argv) {
|
|
1036
|
-
|
|
1037
|
-
|
|
1126
|
+
render(React.createElement(SecretsDelete, {
|
|
1127
|
+
name: argv.name
|
|
1128
|
+
}));
|
|
1038
1129
|
}).command('bulk [file]', 'Bulk upload secrets from a .env file\n', function(yargsBulk) {
|
|
1039
1130
|
return yargsBulk.positional('file', {
|
|
1040
1131
|
describe: 'Path to the .env file (defaults to .env in project root)',
|
|
1041
1132
|
type: 'string'
|
|
1042
1133
|
}).example('$0 secrets bulk', 'Upload secrets from .env file in project root').example('$0 secrets bulk .env.production', 'Upload secrets from a specific .env file');
|
|
1043
1134
|
}, function(argv) {
|
|
1044
|
-
|
|
1045
|
-
|
|
1135
|
+
render(React.createElement(SecretsBulk, {
|
|
1136
|
+
file: argv.file
|
|
1137
|
+
}));
|
|
1046
1138
|
}).demandCommand(1, 'You need to specify a subcommand');
|
|
1047
1139
|
return yargsSecret;
|
|
1048
1140
|
});
|
|
1049
1141
|
// --- User Management Commands ---
|
|
1050
1142
|
cli = cli.command('users', 'Manage users and SSH keys for authentication\n', function(yargsUsers) {
|
|
1051
1143
|
yargsUsers.command('list', 'List all users\n', {}, function() {
|
|
1052
|
-
|
|
1053
|
-
render(element);
|
|
1144
|
+
render(React.createElement(UsersList));
|
|
1054
1145
|
}).command('create <name>', 'Create a new user\n', function(yargsCreate) {
|
|
1055
1146
|
return yargsCreate.positional('name', {
|
|
1056
1147
|
describe: 'Name of the user',
|
|
@@ -1058,8 +1149,9 @@ export function buildCli(options) {
|
|
|
1058
1149
|
demandOption: true
|
|
1059
1150
|
}).example('$0 users create admin', 'Create a user named admin');
|
|
1060
1151
|
}, function(argv) {
|
|
1061
|
-
|
|
1062
|
-
|
|
1152
|
+
render(React.createElement(UsersCreate, {
|
|
1153
|
+
name: argv.name
|
|
1154
|
+
}));
|
|
1063
1155
|
}).command('delete <name>', 'Delete a user\n', function(yargsDelete) {
|
|
1064
1156
|
return yargsDelete.positional('name', {
|
|
1065
1157
|
describe: 'Name of the user to delete',
|
|
@@ -1072,8 +1164,10 @@ export function buildCli(options) {
|
|
|
1072
1164
|
default: false
|
|
1073
1165
|
}).example('$0 users delete admin', 'Delete a user').example('$0 users delete admin --force', 'Delete without confirmation');
|
|
1074
1166
|
}, function(argv) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1167
|
+
render(React.createElement(UsersDelete, {
|
|
1168
|
+
userName: argv.name,
|
|
1169
|
+
force: argv.force
|
|
1170
|
+
}));
|
|
1077
1171
|
}).command('list-keys <name>', 'List keys for a user\n', function(yargsKeysList) {
|
|
1078
1172
|
return yargsKeysList.positional('name', {
|
|
1079
1173
|
describe: 'Name of the user',
|
|
@@ -1081,8 +1175,9 @@ export function buildCli(options) {
|
|
|
1081
1175
|
demandOption: true
|
|
1082
1176
|
}).example('$0 users list-keys admin', 'List keys for a user');
|
|
1083
1177
|
}, function(argv) {
|
|
1084
|
-
|
|
1085
|
-
|
|
1178
|
+
render(React.createElement(UsersKeysList, {
|
|
1179
|
+
userName: argv.name
|
|
1180
|
+
}));
|
|
1086
1181
|
}).command('add-key <name> [pubkey-path]', 'Add an SSH public key to a user\n', function(yargsAdd) {
|
|
1087
1182
|
return yargsAdd.positional('name', {
|
|
1088
1183
|
describe: 'Name of the user',
|
|
@@ -1106,8 +1201,12 @@ export function buildCli(options) {
|
|
|
1106
1201
|
return true;
|
|
1107
1202
|
}).example('$0 users add-key admin ~/.ssh/id_ed25519.pub', 'Add an SSH public key').example('$0 users add-key admin --paste', 'Paste a public key interactively').example('$0 users add-key admin ~/.ssh/id_ed25519.pub --label laptop', 'Add key with label');
|
|
1108
1203
|
}, function(argv) {
|
|
1109
|
-
|
|
1110
|
-
|
|
1204
|
+
render(React.createElement(UsersKeysAdd, {
|
|
1205
|
+
userName: argv.name,
|
|
1206
|
+
pubkeyPath: argv.pubkeyPath,
|
|
1207
|
+
paste: argv.paste,
|
|
1208
|
+
label: argv.label
|
|
1209
|
+
}));
|
|
1111
1210
|
}).command('remove-key <name> <fingerprint>', 'Remove a key from a user\n', function(yargsRemove) {
|
|
1112
1211
|
return yargsRemove.positional('name', {
|
|
1113
1212
|
describe: 'Name of the user',
|
|
@@ -1124,19 +1223,19 @@ export function buildCli(options) {
|
|
|
1124
1223
|
default: false
|
|
1125
1224
|
}).example('$0 users remove-key admin SHA256:...', 'Remove a key');
|
|
1126
1225
|
}, function(argv) {
|
|
1127
|
-
|
|
1128
|
-
|
|
1226
|
+
render(React.createElement(UsersKeysRemove, {
|
|
1227
|
+
userName: argv.name,
|
|
1228
|
+
fingerprint: argv.fingerprint,
|
|
1229
|
+
force: argv.force
|
|
1230
|
+
}));
|
|
1129
1231
|
}).demandCommand(1, 'You need to specify a users command (list, create, delete, list-keys, add-key, remove-key)');
|
|
1130
1232
|
return yargsUsers;
|
|
1131
1233
|
});
|
|
1132
1234
|
// --- Store Explorer Command ---
|
|
1133
|
-
var storeCommand = new StoreCommand();
|
|
1134
1235
|
cli = cli.command('store', 'Browse and manage brain store data\n', function() {}, function() {
|
|
1135
|
-
|
|
1136
|
-
render(element);
|
|
1236
|
+
render(React.createElement(StoreExplorer));
|
|
1137
1237
|
});
|
|
1138
1238
|
// --- Auth Commands (Top-level) ---
|
|
1139
|
-
var authCommand = new AuthCommand(undefined, projectRootPath);
|
|
1140
1239
|
cli = cli.command('login', 'Configure SSH key for authentication\n', function(yargsLogin) {
|
|
1141
1240
|
return yargsLogin.option('path', {
|
|
1142
1241
|
describe: 'Path to SSH private key',
|
|
@@ -1148,8 +1247,12 @@ export function buildCli(options) {
|
|
|
1148
1247
|
default: false
|
|
1149
1248
|
}).example('$0 login', 'Interactive key selection').example('$0 login --path ~/.ssh/id_ed25519', 'Set key directly').example('$0 login --project', 'Set key for current project');
|
|
1150
1249
|
}, function(argv) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1250
|
+
render(React.createElement(AuthLogin, {
|
|
1251
|
+
configManager: configManager,
|
|
1252
|
+
keyPath: argv.path,
|
|
1253
|
+
forProject: argv.project || false,
|
|
1254
|
+
projectRootPath: projectRootPath
|
|
1255
|
+
}));
|
|
1153
1256
|
});
|
|
1154
1257
|
cli = cli.command('logout', 'Clear SSH key configuration\n', function(yargsLogout) {
|
|
1155
1258
|
return yargsLogout.option('project', {
|
|
@@ -1158,12 +1261,17 @@ export function buildCli(options) {
|
|
|
1158
1261
|
default: false
|
|
1159
1262
|
}).example('$0 logout', 'Clear global key configuration').example('$0 logout --project', 'Clear project-specific key');
|
|
1160
1263
|
}, function(argv) {
|
|
1161
|
-
|
|
1162
|
-
|
|
1264
|
+
render(React.createElement(AuthLogout, {
|
|
1265
|
+
configManager: configManager,
|
|
1266
|
+
forProject: argv.project || false,
|
|
1267
|
+
projectRootPath: projectRootPath
|
|
1268
|
+
}));
|
|
1163
1269
|
});
|
|
1164
1270
|
cli = cli.command('whoami', 'Show your current authenticated identity\n', function() {}, function() {
|
|
1165
|
-
|
|
1166
|
-
|
|
1271
|
+
render(React.createElement(Whoami, {
|
|
1272
|
+
configManager: configManager,
|
|
1273
|
+
projectRootPath: projectRootPath
|
|
1274
|
+
}));
|
|
1167
1275
|
});
|
|
1168
1276
|
cli = cli.epilogue('For more information, visit https://positronic.sh');
|
|
1169
1277
|
return cli;
|