@sixb/cli 0.1.21 → 0.1.22
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 +18 -3
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/db-migrate.d.ts.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/desktop.d.ts +15 -0
- package/dist/commands/desktop.d.ts.map +1 -0
- package/dist/commands/dev-runner.d.ts +4 -0
- package/dist/commands/dev-runner.d.ts.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/lake-check.d.ts.map +1 -1
- package/dist/commands/lake-cleanup.d.ts.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/orchestrator.d.ts.map +1 -1
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/rules.d.ts.map +1 -1
- package/dist/commands/scheduler.d.ts.map +1 -1
- package/dist/commands/service-account.d.ts.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/token.d.ts.map +1 -1
- package/dist/commands/typegen.d.ts.map +1 -1
- package/dist/commands/worker-group.d.ts +2 -0
- package/dist/commands/worker-group.d.ts.map +1 -1
- package/dist/commands/worker.d.ts +2 -0
- package/dist/commands/worker.d.ts.map +1 -1
- package/dist/lib/command-line.d.ts +22 -2
- package/dist/lib/command-line.d.ts.map +1 -1
- package/dist/lib/deploy-release.d.ts +3 -1
- package/dist/lib/deploy-release.d.ts.map +1 -1
- package/dist/lib/desktop.d.ts +26 -0
- package/dist/lib/desktop.d.ts.map +1 -0
- package/dist/lib/dev-messages.d.ts +43 -0
- package/dist/lib/dev-messages.d.ts.map +1 -0
- package/dist/lib/dev-supervisor.d.ts +27 -0
- package/dist/lib/dev-supervisor.d.ts.map +1 -1
- package/dist/lib/open-url.d.ts +3 -0
- package/dist/lib/open-url.d.ts.map +1 -0
- package/dist/lib/role-lifecycle.d.ts.map +1 -1
- package/dist/lib/runtime.d.ts +2 -0
- package/dist/lib/runtime.d.ts.map +1 -1
- package/dist/lib/worker-concurrency.d.ts +11 -0
- package/dist/lib/worker-concurrency.d.ts.map +1 -1
- package/dist/lib/worker-registry.d.ts +2 -0
- package/dist/lib/worker-registry.d.ts.map +1 -1
- package/dist/ui/deploy-screens.d.ts +48 -0
- package/dist/ui/deploy-screens.d.ts.map +1 -0
- package/dist/ui/index.d.ts +28 -244
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/layout.d.ts +65 -0
- package/dist/ui/layout.d.ts.map +1 -0
- package/dist/ui/live/ansi.d.ts +8 -0
- package/dist/ui/live/ansi.d.ts.map +1 -0
- package/dist/ui/live/can-run-live.d.ts +6 -0
- package/dist/ui/live/can-run-live.d.ts.map +1 -0
- package/dist/ui/live/components.d.ts +17 -0
- package/dist/ui/live/components.d.ts.map +1 -0
- package/dist/ui/live/deploy.d.ts +22 -0
- package/dist/ui/live/deploy.d.ts.map +1 -0
- package/dist/ui/live/dev.d.ts +47 -0
- package/dist/ui/live/dev.d.ts.map +1 -0
- package/dist/ui/live/prompt.d.ts +30 -0
- package/dist/ui/live/prompt.d.ts.map +1 -0
- package/dist/ui/live/session.d.ts +27 -0
- package/dist/ui/live/session.d.ts.map +1 -0
- package/dist/ui/screens.d.ts +136 -0
- package/dist/ui/screens.d.ts.map +1 -0
- package/dist/ui/theme.d.ts +58 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/package.json +19 -18
- package/src/commands/{api.tsx → api.ts} +18 -27
- package/src/commands/{app.tsx → app.ts} +14 -18
- package/src/commands/build.ts +70 -0
- package/src/commands/{check.tsx → check.ts} +27 -18
- package/src/commands/db-migrate.ts +32 -0
- package/src/commands/{deploy.tsx → deploy.ts} +109 -102
- package/src/commands/desktop.ts +71 -0
- package/src/commands/{dev-runner.tsx → dev-runner.ts} +67 -33
- package/src/commands/{init.tsx → init.ts} +19 -8
- package/src/commands/lake-check.ts +36 -0
- package/src/commands/{lake-cleanup.tsx → lake-cleanup.ts} +17 -12
- package/src/commands/{login.tsx → login.ts} +36 -30
- package/src/commands/{logout.tsx → logout.ts} +5 -5
- package/src/commands/{orchestrator.tsx → orchestrator.ts} +15 -28
- package/src/commands/{profile.tsx → profile.ts} +38 -19
- package/src/commands/{rules.tsx → rules.ts} +15 -24
- package/src/commands/{scheduler.tsx → scheduler.ts} +14 -27
- package/src/commands/{service-account.tsx → service-account.ts} +37 -39
- package/src/commands/{status.tsx → status.ts} +8 -8
- package/src/commands/{token.tsx → token.ts} +19 -20
- package/src/commands/typegen.ts +18 -0
- package/src/commands/{worker-group.tsx → worker-group.ts} +40 -29
- package/src/commands/{worker.tsx → worker.ts} +30 -22
- package/src/index.tsx +22 -1
- package/src/lib/command-line.ts +108 -57
- package/src/lib/deploy-release.ts +17 -1
- package/src/lib/desktop.ts +52 -0
- package/src/lib/dev-messages.ts +44 -0
- package/src/lib/dev-supervisor.ts +132 -12
- package/src/lib/open-url.ts +15 -0
- package/src/lib/role-lifecycle.ts +2 -3
- package/src/lib/runtime.ts +4 -0
- package/src/lib/worker-concurrency.ts +31 -0
- package/src/lib/worker-registry.ts +4 -0
- package/src/ui/README.md +54 -0
- package/src/ui/deploy-screens.ts +360 -0
- package/src/ui/index.ts +158 -0
- package/src/ui/layout.ts +245 -0
- package/src/ui/live/ansi.ts +103 -0
- package/src/ui/live/can-run-live.ts +9 -0
- package/src/ui/live/components.tsx +81 -0
- package/src/ui/live/deploy.tsx +170 -0
- package/src/ui/live/dev.tsx +522 -0
- package/src/ui/live/prompt.tsx +205 -0
- package/src/ui/live/session.ts +103 -0
- package/src/ui/screens.ts +490 -0
- package/src/ui/theme.ts +122 -0
- package/dist/lib/role-view.d.ts +0 -21
- package/dist/lib/role-view.d.ts.map +0 -1
- package/src/commands/build.tsx +0 -65
- package/src/commands/db-migrate.tsx +0 -30
- package/src/commands/lake-check.tsx +0 -33
- package/src/commands/typegen.tsx +0 -18
- package/src/lib/role-view.ts +0 -49
- package/src/ui/index.tsx +0 -1398
- /package/src/commands/{dev.tsx → dev.ts} +0 -0
package/src/lib/command-line.ts
CHANGED
|
@@ -49,11 +49,26 @@ export const CLI_OPTION_DEFINITIONS = {
|
|
|
49
49
|
summary: "Concurrent embedding calls for vector indexing (default: 4)",
|
|
50
50
|
kind: "string",
|
|
51
51
|
},
|
|
52
|
+
"subagent-concurrency": {
|
|
53
|
+
syntax: "--subagent-concurrency <count>",
|
|
54
|
+
summary: "Child agents an agent worker runs at once (default: 4)",
|
|
55
|
+
kind: "string",
|
|
56
|
+
},
|
|
57
|
+
"subagent-concurrency-per-run": {
|
|
58
|
+
syntax: "--subagent-concurrency-per-run <count>",
|
|
59
|
+
summary: "Child agents one Agent turn keeps at work at once (default: 4)",
|
|
60
|
+
kind: "string",
|
|
61
|
+
},
|
|
52
62
|
"app-public-origin": {
|
|
53
63
|
syntax: "--app-public-origin <origin>",
|
|
54
64
|
summary: "Public app origin",
|
|
55
65
|
kind: "string",
|
|
56
66
|
},
|
|
67
|
+
desktop: {
|
|
68
|
+
syntax: "--desktop",
|
|
69
|
+
summary: "Also open the app in a desktop window",
|
|
70
|
+
kind: "boolean",
|
|
71
|
+
},
|
|
57
72
|
"trusted-proxies": {
|
|
58
73
|
syntax: "--trusted-proxies <ranges>",
|
|
59
74
|
summary: "Proxies trusted for client addresses (default: private)",
|
|
@@ -166,6 +181,7 @@ export type LocalCommandId =
|
|
|
166
181
|
| "check"
|
|
167
182
|
| "typegen"
|
|
168
183
|
| "build"
|
|
184
|
+
| "desktop:build"
|
|
169
185
|
| "db:migrate"
|
|
170
186
|
| "db:prepare"
|
|
171
187
|
| "lake:check"
|
|
@@ -232,6 +248,8 @@ const INSTANCE_SUMMARIES = {
|
|
|
232
248
|
files: "Upload and download files",
|
|
233
249
|
workflows: "Discover and start workflows",
|
|
234
250
|
"workflow-runs": "Inspect workflow execution history",
|
|
251
|
+
users: "List and search project members",
|
|
252
|
+
models: "List the project's models and their prices",
|
|
235
253
|
} as const satisfies Record<InstanceCommand, string>
|
|
236
254
|
|
|
237
255
|
const instanceNodes: readonly CommandNode[] = INSTANCE_COMMANDS.map((name) => ({
|
|
@@ -244,7 +262,7 @@ const instanceNodes: readonly CommandNode[] = INSTANCE_COMMANDS.map((name) => ({
|
|
|
244
262
|
}))
|
|
245
263
|
|
|
246
264
|
const commandTree: readonly CommandNode[] = [
|
|
247
|
-
command("dev", "
|
|
265
|
+
command("dev", "Run the project locally, restarting as you edit", {
|
|
248
266
|
options: [
|
|
249
267
|
"entry",
|
|
250
268
|
"port",
|
|
@@ -255,11 +273,14 @@ const commandTree: readonly CommandNode[] = [
|
|
|
255
273
|
"agent-turn-timeout",
|
|
256
274
|
"concurrency",
|
|
257
275
|
"vector-concurrency",
|
|
276
|
+
"subagent-concurrency",
|
|
277
|
+
"subagent-concurrency-per-run",
|
|
258
278
|
"app-public-origin",
|
|
279
|
+
"desktop",
|
|
259
280
|
],
|
|
260
281
|
repeatable: ["concurrency"],
|
|
261
282
|
}),
|
|
262
|
-
command("api", "Start production API
|
|
283
|
+
command("api", "Start the production API, docs, and event stream", {
|
|
263
284
|
options: [
|
|
264
285
|
"entry",
|
|
265
286
|
"no-migrate",
|
|
@@ -272,23 +293,23 @@ const commandTree: readonly CommandNode[] = [
|
|
|
272
293
|
"trusted-proxies",
|
|
273
294
|
],
|
|
274
295
|
}),
|
|
275
|
-
command("app", "Start production app server", {
|
|
296
|
+
command("app", "Start the production app server", {
|
|
276
297
|
options: ["entry", "port", "host", "api-public-origin", "app-public-origin"],
|
|
277
298
|
}),
|
|
278
|
-
command("login", "
|
|
299
|
+
command("login", "Sign in to an instance and save it as a profile", {
|
|
279
300
|
usage: "sixb login <api-url> [--profile <name>] [--token-stdin]",
|
|
280
301
|
options: ["profile", "token-stdin", "json"],
|
|
281
|
-
|
|
302
|
+
// Asked for in a terminal when it is missing.
|
|
282
303
|
maximumPositionals: 1,
|
|
283
304
|
rootHelpLabel: "login <api-url>",
|
|
284
305
|
}),
|
|
285
306
|
command("logout", "Remove a saved profile", { options: ["profile", "json"] }),
|
|
286
|
-
command("status", "Check the
|
|
307
|
+
command("status", "Check the current profile's connection", {
|
|
287
308
|
options: [...CONNECTION_OPTIONS, "json"],
|
|
288
309
|
}),
|
|
289
310
|
{
|
|
290
311
|
name: "profile",
|
|
291
|
-
summary: "
|
|
312
|
+
summary: "List, show, or switch saved profiles",
|
|
292
313
|
usage: "sixb profile <list|show|use> [name]",
|
|
293
314
|
rootHelpLabel: "profile list|show|use",
|
|
294
315
|
children: [
|
|
@@ -306,7 +327,7 @@ const commandTree: readonly CommandNode[] = [
|
|
|
306
327
|
path: ["profile", "use"],
|
|
307
328
|
usage: "sixb profile use <name>",
|
|
308
329
|
options: ["json"],
|
|
309
|
-
|
|
330
|
+
// Picked from the saved profiles in a terminal when it is missing.
|
|
310
331
|
maximumPositionals: 1,
|
|
311
332
|
}),
|
|
312
333
|
],
|
|
@@ -315,12 +336,12 @@ const commandTree: readonly CommandNode[] = [
|
|
|
315
336
|
{
|
|
316
337
|
name: "token",
|
|
317
338
|
summary: "Manage personal access tokens",
|
|
339
|
+
rootHelpLabel: "token list|create|revoke",
|
|
318
340
|
usage: "sixb token <list|create|revoke>",
|
|
319
341
|
children: [
|
|
320
342
|
command("token:list", "List personal access tokens", {
|
|
321
343
|
path: ["token", "list"],
|
|
322
344
|
options: [...CONNECTION_OPTIONS, "json"],
|
|
323
|
-
rootHelpLabel: "token list",
|
|
324
345
|
}),
|
|
325
346
|
command("token:create", "Create a personal access token", {
|
|
326
347
|
path: ["token", "create"],
|
|
@@ -329,7 +350,6 @@ const commandTree: readonly CommandNode[] = [
|
|
|
329
350
|
repeatable: ["group"],
|
|
330
351
|
maximumPositionals: 1,
|
|
331
352
|
requiredInputs: [{ option: "name", positional: 0 }],
|
|
332
|
-
rootHelpLabel: "token create",
|
|
333
353
|
}),
|
|
334
354
|
command("token:revoke", "Revoke a personal access token", {
|
|
335
355
|
path: ["token", "revoke"],
|
|
@@ -337,19 +357,18 @@ const commandTree: readonly CommandNode[] = [
|
|
|
337
357
|
options: [...CONNECTION_OPTIONS, "id", "json"],
|
|
338
358
|
maximumPositionals: 1,
|
|
339
359
|
requiredInputs: [{ option: "id", positional: 0 }],
|
|
340
|
-
rootHelpLabel: "token revoke <id>",
|
|
341
360
|
}),
|
|
342
361
|
],
|
|
343
362
|
},
|
|
344
363
|
{
|
|
345
364
|
name: "service-account",
|
|
346
|
-
summary: "Manage service accounts",
|
|
365
|
+
summary: "Manage service accounts and their tokens",
|
|
366
|
+
rootHelpLabel: "service-account ...",
|
|
347
367
|
usage: "sixb service-account <list|create|disable|token>",
|
|
348
368
|
children: [
|
|
349
369
|
command("service-account:list", "List service accounts", {
|
|
350
370
|
path: ["service-account", "list"],
|
|
351
371
|
options: [...CONNECTION_OPTIONS, "json"],
|
|
352
|
-
rootHelpLabel: "service-account list",
|
|
353
372
|
}),
|
|
354
373
|
command("service-account:create", "Create a service account", {
|
|
355
374
|
path: ["service-account", "create"],
|
|
@@ -358,7 +377,6 @@ const commandTree: readonly CommandNode[] = [
|
|
|
358
377
|
repeatable: ["group"],
|
|
359
378
|
maximumPositionals: 1,
|
|
360
379
|
requiredInputs: [{ option: "name", positional: 0 }],
|
|
361
|
-
rootHelpLabel: "service-account create",
|
|
362
380
|
}),
|
|
363
381
|
command("service-account:disable", "Disable a service account", {
|
|
364
382
|
path: ["service-account", "disable"],
|
|
@@ -366,13 +384,11 @@ const commandTree: readonly CommandNode[] = [
|
|
|
366
384
|
options: [...CONNECTION_OPTIONS, "id", "json"],
|
|
367
385
|
maximumPositionals: 1,
|
|
368
386
|
requiredInputs: [{ option: "id", positional: 0 }],
|
|
369
|
-
rootHelpLabel: "service-account disable",
|
|
370
387
|
}),
|
|
371
388
|
{
|
|
372
389
|
name: "token",
|
|
373
390
|
summary: "Manage service-account tokens",
|
|
374
391
|
usage: "sixb service-account token <list|create|revoke> <service-account-id>",
|
|
375
|
-
rootHelpLabel: "service-account token",
|
|
376
392
|
children: [
|
|
377
393
|
command("service-account:token:list", "List service-account tokens", {
|
|
378
394
|
path: ["service-account", "token", "list"],
|
|
@@ -402,14 +418,14 @@ const commandTree: readonly CommandNode[] = [
|
|
|
402
418
|
},
|
|
403
419
|
],
|
|
404
420
|
},
|
|
405
|
-
command("scheduler", "Start production scheduler
|
|
421
|
+
command("scheduler", "Start the production scheduler", {
|
|
406
422
|
options: ["entry", "no-migrate"],
|
|
407
423
|
}),
|
|
408
|
-
command("orchestrator", "Start production
|
|
424
|
+
command("orchestrator", "Start the production orchestrator, which queues work for events", {
|
|
409
425
|
options: ["entry", "no-migrate"],
|
|
410
426
|
}),
|
|
411
|
-
command("rules", "Start production rules runtime", { options: ["entry", "no-migrate"] }),
|
|
412
|
-
command("worker", "Start
|
|
427
|
+
command("rules", "Start the production rules runtime", { options: ["entry", "no-migrate"] }),
|
|
428
|
+
command("worker", "Start one queue worker: sync, agent, pipeline, projection, workflow", {
|
|
413
429
|
usage: "sixb worker <sync|agent|pipeline|projection|workflow> [options]",
|
|
414
430
|
options: [
|
|
415
431
|
"entry",
|
|
@@ -418,12 +434,14 @@ const commandTree: readonly CommandNode[] = [
|
|
|
418
434
|
"agent-turn-timeout",
|
|
419
435
|
"concurrency",
|
|
420
436
|
"vector-concurrency",
|
|
437
|
+
"subagent-concurrency",
|
|
438
|
+
"subagent-concurrency-per-run",
|
|
421
439
|
],
|
|
422
440
|
minimumPositionals: 1,
|
|
423
441
|
maximumPositionals: 1,
|
|
424
442
|
rootHelpLabel: "worker <type>",
|
|
425
443
|
}),
|
|
426
|
-
command("worker-group", "
|
|
444
|
+
command("worker-group", "Run several queue workers in one process", {
|
|
427
445
|
usage: "sixb worker-group [types...] [options]",
|
|
428
446
|
options: [
|
|
429
447
|
"entry",
|
|
@@ -432,6 +450,8 @@ const commandTree: readonly CommandNode[] = [
|
|
|
432
450
|
"agent-turn-timeout",
|
|
433
451
|
"concurrency",
|
|
434
452
|
"vector-concurrency",
|
|
453
|
+
"subagent-concurrency",
|
|
454
|
+
"subagent-concurrency-per-run",
|
|
435
455
|
],
|
|
436
456
|
repeatable: ["concurrency"],
|
|
437
457
|
maximumPositionals: Number.POSITIVE_INFINITY,
|
|
@@ -439,7 +459,21 @@ const commandTree: readonly CommandNode[] = [
|
|
|
439
459
|
}),
|
|
440
460
|
command("check", "Validate project configuration and health", { options: ["entry"] }),
|
|
441
461
|
command("typegen", "Generate ontology types for typed queries", { options: ["entry"] }),
|
|
442
|
-
command("build", "Build runtime and
|
|
462
|
+
command("build", "Build the runtime and the app for production", {
|
|
463
|
+
options: ["entry", "outdir"],
|
|
464
|
+
}),
|
|
465
|
+
{
|
|
466
|
+
name: "desktop",
|
|
467
|
+
summary: "Ship the app as a desktop app",
|
|
468
|
+
usage: "sixb desktop build",
|
|
469
|
+
children: [
|
|
470
|
+
command("desktop:build", "Package the deployed app as a desktop app for this machine", {
|
|
471
|
+
path: ["desktop", "build"],
|
|
472
|
+
options: ["app-public-origin", "api-public-origin"],
|
|
473
|
+
rootHelpLabel: "desktop build",
|
|
474
|
+
}),
|
|
475
|
+
],
|
|
476
|
+
},
|
|
443
477
|
{
|
|
444
478
|
name: "db",
|
|
445
479
|
summary: "Manage runtime storage",
|
|
@@ -454,7 +488,7 @@ const commandTree: readonly CommandNode[] = [
|
|
|
454
488
|
rootHelpLabel: "db prepare",
|
|
455
489
|
}
|
|
456
490
|
),
|
|
457
|
-
command("db:migrate", "Run
|
|
491
|
+
command("db:migrate", "Run database migrations ahead of a role", {
|
|
458
492
|
path: ["db", "migrate"],
|
|
459
493
|
options: ["entry"],
|
|
460
494
|
rootHelpLabel: "db migrate",
|
|
@@ -471,7 +505,7 @@ const commandTree: readonly CommandNode[] = [
|
|
|
471
505
|
options: ["entry"],
|
|
472
506
|
rootHelpLabel: "lake check",
|
|
473
507
|
}),
|
|
474
|
-
command("lake:cleanup", "
|
|
508
|
+
command("lake:cleanup", "Clean up old lake snapshots and files", {
|
|
475
509
|
path: ["lake", "cleanup"],
|
|
476
510
|
options: ["entry", "dry-run", "expire-older-than", "delete-older-than"],
|
|
477
511
|
rootHelpLabel: "lake cleanup",
|
|
@@ -539,7 +573,7 @@ const commandTree: readonly CommandNode[] = [
|
|
|
539
573
|
},
|
|
540
574
|
],
|
|
541
575
|
},
|
|
542
|
-
command("init", "
|
|
576
|
+
command("init", "Create a Sixb project in a directory", {
|
|
543
577
|
usage: "sixb init [dir]",
|
|
544
578
|
maximumPositionals: 1,
|
|
545
579
|
rootHelpLabel: "init [dir]",
|
|
@@ -591,43 +625,60 @@ export const ROOT_HELP: CliHelp = {
|
|
|
591
625
|
usage: "sixb <command> [options]",
|
|
592
626
|
summary: "Real-time digital twin framework",
|
|
593
627
|
commands: rootHelpItems(commandTree),
|
|
594
|
-
options
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
{ label: "--version", value: "Show version" },
|
|
601
|
-
],
|
|
628
|
+
// Each command lists its own options; the root names the ones most commands share. Its last
|
|
629
|
+
// line points to `--help`.
|
|
630
|
+
options: (["entry", "profile", "json"] as const).map((name) => ({
|
|
631
|
+
label: CLI_OPTION_DEFINITIONS[name].syntax,
|
|
632
|
+
value: CLI_OPTION_DEFINITIONS[name].summary,
|
|
633
|
+
})),
|
|
602
634
|
}
|
|
603
635
|
|
|
636
|
+
/** The root help's commands, grouped by what they are for. Order is the reading order. */
|
|
637
|
+
const ROOT_HELP_GROUP_COMMANDS: readonly {
|
|
638
|
+
readonly title: string
|
|
639
|
+
readonly names: readonly string[]
|
|
640
|
+
/** Listed by name only: each has its own help. */
|
|
641
|
+
readonly compact?: boolean
|
|
642
|
+
}[] = [
|
|
643
|
+
{ title: "Develop", names: ["init", "dev", "check", "typegen", "build"] },
|
|
644
|
+
{ title: "Deploy", names: ["deploy", "desktop"] },
|
|
645
|
+
{
|
|
646
|
+
title: "Run in production",
|
|
647
|
+
names: ["api", "app", "scheduler", "orchestrator", "rules", "worker", "worker-group"],
|
|
648
|
+
},
|
|
649
|
+
{ title: "Storage", names: ["db", "lake"] },
|
|
650
|
+
{
|
|
651
|
+
title: "Connect to an instance",
|
|
652
|
+
names: ["login", "logout", "status", "profile", "token", "service-account"],
|
|
653
|
+
},
|
|
654
|
+
{ title: "Work with an instance", names: INSTANCE_COMMANDS, compact: true },
|
|
655
|
+
]
|
|
656
|
+
|
|
657
|
+
export const ROOT_HELP_GROUPS: readonly {
|
|
658
|
+
readonly title: string
|
|
659
|
+
readonly items: readonly CliHelpItem[]
|
|
660
|
+
readonly compact?: boolean
|
|
661
|
+
}[] = (() => {
|
|
662
|
+
const grouped = new Set(ROOT_HELP_GROUP_COMMANDS.flatMap((group) => group.names))
|
|
663
|
+
const ungrouped = commandTree.filter((node) => !grouped.has(node.name))
|
|
664
|
+
const groups = ROOT_HELP_GROUP_COMMANDS.map((group) => ({
|
|
665
|
+
title: group.title,
|
|
666
|
+
...(group.compact ? { compact: true } : {}),
|
|
667
|
+
items: rootHelpItems(
|
|
668
|
+
group.names.flatMap((name) => commandTree.filter((node) => node.name === name))
|
|
669
|
+
),
|
|
670
|
+
}))
|
|
671
|
+
// A command added without a group still shows up.
|
|
672
|
+
return ungrouped.length > 0
|
|
673
|
+
? [...groups, { title: "More", items: rootHelpItems(ungrouped) }]
|
|
674
|
+
: groups
|
|
675
|
+
})()
|
|
676
|
+
|
|
604
677
|
export const CLI_EXAMPLES = [
|
|
678
|
+
"sixb init my-project",
|
|
605
679
|
"sixb dev",
|
|
606
|
-
"sixb
|
|
607
|
-
"sixb api",
|
|
608
|
-
"sixb login http://localhost:3001 --profile local",
|
|
609
|
-
"sixb ontology list",
|
|
610
|
-
"sixb objects inspect Customer customer-123",
|
|
611
|
-
"sixb token create --name 'Local CLI' --expires-in 90d",
|
|
612
|
-
"sixb service-account create --id svc_sandbox --name 'Sandbox agent' --group agents",
|
|
613
|
-
"sixb service-account token create svc_sandbox --name 'Sandbox token' --expires-in 30d",
|
|
614
|
-
"sixb status",
|
|
615
|
-
"sixb app",
|
|
616
|
-
"sixb scheduler",
|
|
617
|
-
"sixb orchestrator",
|
|
618
|
-
"sixb rules",
|
|
619
|
-
"sixb worker pipeline",
|
|
620
|
-
"sixb worker agent --concurrency 8",
|
|
621
|
-
"sixb worker-group sync agent --concurrency sync=2 --concurrency agent=8",
|
|
622
|
-
"sixb dev --entry examples/mac-os/sixb.config.ts --port 8080",
|
|
623
|
-
"sixb check",
|
|
624
|
-
"sixb typegen",
|
|
625
|
-
"sixb db migrate",
|
|
626
|
-
"sixb lake check",
|
|
627
|
-
"sixb lake cleanup --dry-run",
|
|
628
|
-
"sixb deploy --dry-run",
|
|
680
|
+
"sixb login https://api.example.com",
|
|
629
681
|
"sixb deploy",
|
|
630
|
-
"sixb deploy logs api --follow",
|
|
631
682
|
] as const
|
|
632
683
|
|
|
633
684
|
export function parseCliArgs(args: readonly string[]): ParsedCli {
|
|
@@ -81,7 +81,7 @@ export function buildDeployRelease(
|
|
|
81
81
|
config: DeployConfig,
|
|
82
82
|
options: DeployReleaseOptions
|
|
83
83
|
): DeployRelease {
|
|
84
|
-
const enabled =
|
|
84
|
+
const enabled = enabledServices(config)
|
|
85
85
|
const http = resolveHttpServices(config, enabled)
|
|
86
86
|
|
|
87
87
|
// Every service gets every origin: the API checks browser origins, and agent workers call it.
|
|
@@ -114,6 +114,22 @@ export function buildDeployRelease(
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/** Where browsers reach each HTTP service the deployment runs. */
|
|
118
|
+
export function deployPublicOrigins(
|
|
119
|
+
config: DeployConfig
|
|
120
|
+
): Partial<Record<DeployHttpServiceName, string>> {
|
|
121
|
+
return Object.fromEntries(
|
|
122
|
+
[...resolveHttpServices(config, enabledServices(config))].map(([service, address]) => [
|
|
123
|
+
service,
|
|
124
|
+
address.publicOrigin,
|
|
125
|
+
])
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function enabledServices(config: DeployConfig): DeployServiceName[] {
|
|
130
|
+
return DEPLOY_SERVICES.filter((service) => config.services?.[service] !== false)
|
|
131
|
+
}
|
|
132
|
+
|
|
117
133
|
function sixbService(
|
|
118
134
|
config: DeployConfig,
|
|
119
135
|
service: DeployServiceName,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url"
|
|
2
|
+
import { SixbCliError } from "./errors"
|
|
3
|
+
|
|
4
|
+
export interface DesktopAppOptions {
|
|
5
|
+
readonly projectRoot: string
|
|
6
|
+
/** Where the app is served. The desktop app opens it and takes its name and icon from it. */
|
|
7
|
+
readonly appUrl: string
|
|
8
|
+
readonly apiOrigin: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* What the CLI calls on `@sixb/desktop`. Declared here, not imported: the CLI does not depend on
|
|
13
|
+
* the package, and `desktop.test.ts` holds the two together.
|
|
14
|
+
*/
|
|
15
|
+
export interface SixbDesktop {
|
|
16
|
+
openDesktopApp(options: DesktopAppOptions): Promise<{
|
|
17
|
+
readonly exited: Promise<number>
|
|
18
|
+
close(): void
|
|
19
|
+
}>
|
|
20
|
+
buildDesktopApp(options: DesktopAppOptions): Promise<{
|
|
21
|
+
readonly path: string
|
|
22
|
+
readonly signed: boolean
|
|
23
|
+
}>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Loads the project's `@sixb/desktop`. The CLI does not depend on it because it brings Electron,
|
|
28
|
+
* which only a project that ships a desktop app should download.
|
|
29
|
+
*/
|
|
30
|
+
export async function loadDesktop(projectRoot: string): Promise<SixbDesktop> {
|
|
31
|
+
let path: string
|
|
32
|
+
try {
|
|
33
|
+
path = Bun.resolveSync("@sixb/desktop", projectRoot)
|
|
34
|
+
} catch {
|
|
35
|
+
throw new SixbCliError("[SixbCLI] Desktop apps need @sixb/desktop, which this project lacks.", {
|
|
36
|
+
remediation: "Run `bun add -d @sixb/desktop`, then try again.",
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
const loaded: unknown = await import(pathToFileURL(path).href)
|
|
40
|
+
if (!isSixbDesktop(loaded)) {
|
|
41
|
+
throw new SixbCliError(`[SixbCLI] The @sixb/desktop at ${path} is not one this CLI can use.`, {
|
|
42
|
+
remediation: "Run `bun add -d @sixb/desktop@latest`, then try again.",
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
return loaded
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function isSixbDesktop(value: unknown): value is SixbDesktop {
|
|
49
|
+
if (typeof value !== "object" || value === null) return false
|
|
50
|
+
const { openDesktopApp, buildDesktopApp } = value as Record<string, unknown>
|
|
51
|
+
return typeof openDesktopApp === "function" && typeof buildDesktopApp === "function"
|
|
52
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the dev process tells the supervisor over IPC. The supervisor outlives every restart, so
|
|
3
|
+
* when it draws the terminal's live footer the dev process reports instead of printing.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Set on the dev process when the supervisor draws the screen; the process then only reports. */
|
|
7
|
+
export const DEV_UI_ENV = "SIXB_DEV_UI"
|
|
8
|
+
|
|
9
|
+
/** The steps a dev process goes through before it serves, in order. */
|
|
10
|
+
export const DEV_STARTUP_STEPS = [
|
|
11
|
+
"Generating types",
|
|
12
|
+
"Loading project",
|
|
13
|
+
"Starting server",
|
|
14
|
+
"Starting app",
|
|
15
|
+
] as const
|
|
16
|
+
|
|
17
|
+
export type DevStartupStep = (typeof DEV_STARTUP_STEPS)[number]
|
|
18
|
+
|
|
19
|
+
/** What a dev process serves once it is ready. */
|
|
20
|
+
export interface DevReadyView {
|
|
21
|
+
readonly name: string
|
|
22
|
+
readonly apiUrl: string
|
|
23
|
+
readonly apiDocsUrl: string
|
|
24
|
+
readonly wsUrl: string
|
|
25
|
+
/** `null` when the app could not start; a warning says why. */
|
|
26
|
+
readonly appUrl: string | null
|
|
27
|
+
readonly workers: readonly { readonly type: string; readonly concurrency: number }[]
|
|
28
|
+
readonly warnings: readonly string[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface DevStartupFailure {
|
|
32
|
+
readonly message: string
|
|
33
|
+
readonly remediation?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type DevChildMessage =
|
|
37
|
+
| { readonly type: "status"; readonly step: DevStartupStep }
|
|
38
|
+
| {
|
|
39
|
+
readonly type: "ready"
|
|
40
|
+
readonly watchesApp: boolean
|
|
41
|
+
readonly app: { readonly url: string; readonly apiOrigin: string } | null
|
|
42
|
+
readonly view?: DevReadyView
|
|
43
|
+
}
|
|
44
|
+
| { readonly type: "startup-error"; readonly error?: DevStartupFailure }
|