@fnndsc/brasa 0.1.0 → 0.3.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/dist/builtins/fs/cat.js +3 -63
- package/dist/builtins/fs/cat.js.map +1 -1
- package/dist/builtins/fs/download.d.ts +3 -1
- package/dist/builtins/fs/download.js +10 -7
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/du.d.ts +2 -1
- package/dist/builtins/fs/du.js +15 -7
- package/dist/builtins/fs/du.js.map +1 -1
- package/dist/builtins/fs/edit.d.ts +3 -1
- package/dist/builtins/fs/edit.js +17 -23
- package/dist/builtins/fs/edit.js.map +1 -1
- package/dist/builtins/fs/ls.d.ts +2 -1
- package/dist/builtins/fs/ls.js +22 -11
- package/dist/builtins/fs/ls.js.map +1 -1
- package/dist/builtins/fs/pull.d.ts +2 -1
- package/dist/builtins/fs/pull.js +31 -27
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/fs/tree.d.ts +2 -1
- package/dist/builtins/fs/tree.js +10 -13
- package/dist/builtins/fs/tree.js.map +1 -1
- package/dist/builtins/fs/upload.d.ts +3 -1
- package/dist/builtins/fs/upload.js +10 -8
- package/dist/builtins/fs/upload.js.map +1 -1
- package/dist/builtins/help.d.ts +16 -1
- package/dist/builtins/help.js +39 -18
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/net/connect.d.ts +3 -2
- package/dist/builtins/net/connect.js +6 -8
- package/dist/builtins/net/connect.js.map +1 -1
- package/dist/builtins/net/cubepath.d.ts +2 -1
- package/dist/builtins/net/cubepath.js +19 -15
- package/dist/builtins/net/cubepath.js.map +1 -1
- package/dist/builtins/net/logout.d.ts +4 -2
- package/dist/builtins/net/logout.js +7 -4
- package/dist/builtins/net/logout.js.map +1 -1
- package/dist/builtins/net/pacs.d.ts +4 -1
- package/dist/builtins/net/pacs.js +38 -39
- package/dist/builtins/net/pacs.js.map +1 -1
- package/dist/builtins/net/query.d.ts +2 -2
- package/dist/builtins/net/query.js +20 -23
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/parametersofplugin.d.ts +3 -2
- package/dist/builtins/parametersofplugin.js +8 -9
- package/dist/builtins/parametersofplugin.js.map +1 -1
- package/dist/builtins/proc.d.ts +3 -1
- package/dist/builtins/proc.js +74 -64
- package/dist/builtins/proc.js.map +1 -1
- package/dist/builtins/res/compute.d.ts +3 -1
- package/dist/builtins/res/compute.js +9 -12
- package/dist/builtins/res/compute.js.map +1 -1
- package/dist/builtins/res/feed.d.ts +3 -1
- package/dist/builtins/res/feed.js +58 -83
- package/dist/builtins/res/feed.js.map +1 -1
- package/dist/builtins/res/files.d.ts +7 -3
- package/dist/builtins/res/files.js +26 -25
- package/dist/builtins/res/files.js.map +1 -1
- package/dist/builtins/res/group.d.ts +3 -1
- package/dist/builtins/res/group.js +10 -14
- package/dist/builtins/res/group.js.map +1 -1
- package/dist/builtins/res/pipeline.d.ts +2 -1
- package/dist/builtins/res/pipeline.js +53 -53
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/plugin.d.ts +6 -2
- package/dist/builtins/res/plugin.js +47 -50
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/plugininstance.d.ts +2 -1
- package/dist/builtins/res/plugininstance.js +9 -14
- package/dist/builtins/res/plugininstance.js.map +1 -1
- package/dist/builtins/res/pluginmeta.d.ts +2 -1
- package/dist/builtins/res/pluginmeta.js +9 -14
- package/dist/builtins/res/pluginmeta.js.map +1 -1
- package/dist/builtins/res/tag.d.ts +3 -1
- package/dist/builtins/res/tag.js +10 -14
- package/dist/builtins/res/tag.js.map +1 -1
- package/dist/builtins/res/workflow.d.ts +2 -1
- package/dist/builtins/res/workflow.js +9 -14
- package/dist/builtins/res/workflow.js.map +1 -1
- package/dist/builtins/store.d.ts +3 -1
- package/dist/builtins/store.js +19 -35
- package/dist/builtins/store.js.map +1 -1
- package/dist/builtins/sys/context.d.ts +2 -1
- package/dist/builtins/sys/context.js +5 -4
- package/dist/builtins/sys/context.js.map +1 -1
- package/dist/core/chiliDelegate.d.ts +10 -7
- package/dist/core/chiliDelegate.js +20 -11
- package/dist/core/chiliDelegate.js.map +1 -1
- package/dist/core/dispatch.d.ts +6 -0
- package/dist/core/dispatch.js +121 -169
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/sink.d.ts +57 -18
- package/dist/core/sink.js +77 -77
- package/dist/core/sink.js.map +1 -1
- package/dist/lib/vfs/vfs.d.ts +2 -2
- package/dist/lib/vfs/vfs.js +10 -14
- package/dist/lib/vfs/vfs.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* Aliases: pluginmeta / pluginmetas / meta / metas
|
|
6
6
|
*/
|
|
7
7
|
import chalk from 'chalk';
|
|
8
|
+
import { envelope_ok, envelope_error } from '@fnndsc/cumin';
|
|
8
9
|
import { commandArgs_process } from '../utils.js';
|
|
9
10
|
import { pluginMetas_fetchList } from '@fnndsc/chili/commands/pluginmetas/list.js';
|
|
10
11
|
import { pluginMetaFields_fetch } from '@fnndsc/chili/commands/pluginmetas/fields.js';
|
|
11
|
-
import {
|
|
12
|
+
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
12
13
|
/**
|
|
13
14
|
* Builtin handler for the `pluginmeta` command.
|
|
14
15
|
*
|
|
@@ -21,33 +22,27 @@ export async function builtin_pluginmeta(args) {
|
|
|
21
22
|
try {
|
|
22
23
|
const { pluginMetas, selectedFields, totalCount } = await pluginMetas_fetchList(parsed);
|
|
23
24
|
if (pluginMetas.length === 0) {
|
|
24
|
-
|
|
25
|
-
return;
|
|
25
|
+
return envelope_ok(`${chalk.gray('No plugin metas found.')}\n`);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
return envelope_ok(table_render(pluginMetas, selectedFields, { title: { title: 'Plugin Metas', justification: 'center' }, pagination: totalCount !== undefined ? { shown: pluginMetas.length, total: totalCount } : undefined }));
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
30
|
process.exitCode = 1;
|
|
31
|
-
|
|
31
|
+
return envelope_error('', undefined, `${chalk.red(`pluginmeta error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
32
32
|
}
|
|
33
|
-
return;
|
|
34
33
|
}
|
|
35
34
|
if (subcommand === 'search') {
|
|
36
35
|
const query = parsed._[1] ?? '';
|
|
37
|
-
|
|
38
|
-
return;
|
|
36
|
+
return builtin_pluginmeta([...args.filter((a) => a !== subcommand), `--search`, query]);
|
|
39
37
|
}
|
|
40
38
|
if (subcommand === 'inspect') {
|
|
41
39
|
const fields = await pluginMetaFields_fetch();
|
|
42
40
|
if (fields && fields.length > 0) {
|
|
43
|
-
|
|
41
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Plugin Meta fields', justification: 'center' } }));
|
|
44
42
|
}
|
|
45
|
-
|
|
46
|
-
console.log(chalk.gray('No fields found for plugin metas.'));
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
43
|
+
return envelope_ok(`${chalk.gray('No fields found for plugin metas.')}\n`);
|
|
49
44
|
}
|
|
50
45
|
process.exitCode = 1;
|
|
51
|
-
|
|
46
|
+
return envelope_error(`${chalk.red(`Unknown subcommand: ${subcommand}. Usage: pluginmetas <list|search|inspect>`)}\n`);
|
|
52
47
|
}
|
|
53
48
|
//# sourceMappingURL=pluginmeta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginmeta.js","sourceRoot":"","sources":["../../../src/builtins/res/pluginmeta.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAc,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAwB,MAAM,4CAA4C,CAAC;AACzG,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,
|
|
1
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AK,CAAC,GAAG,CAAC,uBAAuB,UAAU,4CAA4C,CAAC,IAAI,CAAC,CAAC;AACzH,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { CommandEnvelope } from '@fnndsc/cumin';
|
|
1
2
|
/**
|
|
2
3
|
* Builtin handler for the `tag` command.
|
|
3
4
|
*
|
|
4
5
|
* @param args - Parsed command arguments for the tag command.
|
|
6
|
+
* @returns An envelope carrying the tag listing or fields.
|
|
5
7
|
*/
|
|
6
|
-
export declare function builtin_tag(args: string[]): Promise<
|
|
8
|
+
export declare function builtin_tag(args: string[]): Promise<CommandEnvelope>;
|
package/dist/builtins/res/tag.js
CHANGED
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* Singular/plural aliases: tag / tags
|
|
6
6
|
*/
|
|
7
7
|
import chalk from 'chalk';
|
|
8
|
+
import { envelope_ok, envelope_error } from '@fnndsc/cumin';
|
|
8
9
|
import { commandArgs_process } from '../utils.js';
|
|
9
10
|
import { tags_fetchList } from '@fnndsc/chili/commands/tags/list.js';
|
|
10
11
|
import { tagFields_fetch } from '@fnndsc/chili/commands/tags/fields.js';
|
|
11
|
-
import {
|
|
12
|
+
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
12
13
|
/**
|
|
13
14
|
* Builtin handler for the `tag` command.
|
|
14
15
|
*
|
|
15
16
|
* @param args - Parsed command arguments for the tag command.
|
|
17
|
+
* @returns An envelope carrying the tag listing or fields.
|
|
16
18
|
*/
|
|
17
19
|
export async function builtin_tag(args) {
|
|
18
20
|
const parsed = commandArgs_process(args);
|
|
@@ -21,33 +23,27 @@ export async function builtin_tag(args) {
|
|
|
21
23
|
try {
|
|
22
24
|
const { tags, selectedFields, totalCount } = await tags_fetchList(parsed);
|
|
23
25
|
if (tags.length === 0) {
|
|
24
|
-
|
|
25
|
-
return;
|
|
26
|
+
return envelope_ok(`${chalk.gray('No tags found.')}\n`);
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
return envelope_ok(table_render(tags, selectedFields, { title: { title: 'Tags', justification: 'center' }, pagination: totalCount !== undefined ? { shown: tags.length, total: totalCount } : undefined }));
|
|
28
29
|
}
|
|
29
30
|
catch (e) {
|
|
30
31
|
process.exitCode = 1;
|
|
31
|
-
|
|
32
|
+
return envelope_error('', undefined, `${chalk.red(`tag error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
32
33
|
}
|
|
33
|
-
return;
|
|
34
34
|
}
|
|
35
35
|
if (subcommand === 'search') {
|
|
36
36
|
const query = parsed._[1] ?? '';
|
|
37
|
-
|
|
38
|
-
return;
|
|
37
|
+
return builtin_tag([...args.filter((a) => a !== subcommand), `--search`, query]);
|
|
39
38
|
}
|
|
40
39
|
if (subcommand === 'inspect') {
|
|
41
40
|
const fields = await tagFields_fetch();
|
|
42
41
|
if (fields && fields.length > 0) {
|
|
43
|
-
|
|
42
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Tag fields', justification: 'center' } }));
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
console.log(chalk.gray('No fields found for tags.'));
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
44
|
+
return envelope_ok(`${chalk.gray('No fields found for tags.')}\n`);
|
|
49
45
|
}
|
|
50
46
|
process.exitCode = 1;
|
|
51
|
-
|
|
47
|
+
return envelope_error(`${chalk.red(`Unknown subcommand: ${subcommand}. Usage: tags <list|search|inspect>`)}\n`);
|
|
52
48
|
}
|
|
53
49
|
//# sourceMappingURL=tag.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../../../src/builtins/res/tag.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAc,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAiB,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE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cAAc,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,uBAAuB,UAAU,qCAAqC,CAAC,IAAI,CAAC,CAAC;AAClH,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { CommandEnvelope } from '@fnndsc/cumin';
|
|
1
2
|
/**
|
|
2
3
|
* Builtin handler for the `workflow` command.
|
|
3
4
|
*
|
|
4
5
|
* @param args - Parsed command arguments for the workflow command.
|
|
5
6
|
*/
|
|
6
|
-
export declare function builtin_workflow(args: string[]): Promise<
|
|
7
|
+
export declare function builtin_workflow(args: string[]): Promise<CommandEnvelope>;
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* Aliases: workflow / workflows
|
|
6
6
|
*/
|
|
7
7
|
import chalk from 'chalk';
|
|
8
|
+
import { envelope_ok, envelope_error } from '@fnndsc/cumin';
|
|
8
9
|
import { commandArgs_process } from '../utils.js';
|
|
9
10
|
import { workflows_fetchList } from '@fnndsc/chili/commands/workflows/list.js';
|
|
10
11
|
import { workflowFields_fetch } from '@fnndsc/chili/commands/workflows/fields.js';
|
|
11
|
-
import {
|
|
12
|
+
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
12
13
|
/**
|
|
13
14
|
* Builtin handler for the `workflow` command.
|
|
14
15
|
*
|
|
@@ -21,33 +22,27 @@ export async function builtin_workflow(args) {
|
|
|
21
22
|
try {
|
|
22
23
|
const { workflows, selectedFields, totalCount } = await workflows_fetchList(parsed);
|
|
23
24
|
if (workflows.length === 0) {
|
|
24
|
-
|
|
25
|
-
return;
|
|
25
|
+
return envelope_ok(`${chalk.gray('No workflows found.')}\n`);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
return envelope_ok(table_render(workflows, selectedFields, { title: { title: 'Workflows', justification: 'center' }, pagination: totalCount !== undefined ? { shown: workflows.length, total: totalCount } : undefined }));
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
30
|
process.exitCode = 1;
|
|
31
|
-
|
|
31
|
+
return envelope_error('', undefined, `${chalk.red(`workflow error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
32
32
|
}
|
|
33
|
-
return;
|
|
34
33
|
}
|
|
35
34
|
if (subcommand === 'search') {
|
|
36
35
|
const query = parsed._[1] ?? '';
|
|
37
|
-
|
|
38
|
-
return;
|
|
36
|
+
return builtin_workflow([...args.filter((a) => a !== subcommand), `--search`, query]);
|
|
39
37
|
}
|
|
40
38
|
if (subcommand === 'inspect') {
|
|
41
39
|
const fields = await workflowFields_fetch();
|
|
42
40
|
if (fields && fields.length > 0) {
|
|
43
|
-
|
|
41
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Workflow fields', justification: 'center' } }));
|
|
44
42
|
}
|
|
45
|
-
|
|
46
|
-
console.log(chalk.gray('No fields found for workflows.'));
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
43
|
+
return envelope_ok(`${chalk.gray('No fields found for workflows.')}\n`);
|
|
49
44
|
}
|
|
50
45
|
process.exitCode = 1;
|
|
51
|
-
|
|
46
|
+
return envelope_error(`${chalk.red(`Unknown subcommand: ${subcommand}. Usage: workflows <list|search|inspect>`)}\n`);
|
|
52
47
|
}
|
|
53
48
|
//# sourceMappingURL=workflow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../src/builtins/res/workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAc,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,0CAA0C,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../src/builtins/res/workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,M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@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type CommandEnvelope } from '@fnndsc/cumin';
|
|
1
2
|
/**
|
|
2
3
|
* Handles store commands.
|
|
3
4
|
*
|
|
4
5
|
* @param args - command arguments.
|
|
6
|
+
* @returns An envelope carrying the rendered store output.
|
|
5
7
|
*/
|
|
6
|
-
export declare function builtin_store(args: string[]): Promise<
|
|
8
|
+
export declare function builtin_store(args: string[]): Promise<CommandEnvelope>;
|
package/dist/builtins/store.js
CHANGED
|
@@ -8,18 +8,19 @@ import { store_listPlugins, store_searchPlugins } from '@fnndsc/chili/commands/s
|
|
|
8
8
|
import { grid_render, long_render } from '@fnndsc/chili/views/ls.js';
|
|
9
9
|
import { spinner } from '../lib/spinner.js';
|
|
10
10
|
import { plugin_addInteractive } from './res/plugin.js';
|
|
11
|
+
import { envelope_ok, envelope_error } from '@fnndsc/cumin';
|
|
11
12
|
import { DEFAULT_STORE_URL, storeUrl_get, storeUrl_isDefault, storeUrl_set, storeUrl_clear, storeConfig_persist, } from '../config/storeConfig.js';
|
|
12
13
|
/**
|
|
13
14
|
* Handles store commands.
|
|
14
15
|
*
|
|
15
16
|
* @param args - command arguments.
|
|
17
|
+
* @returns An envelope carrying the rendered store output.
|
|
16
18
|
*/
|
|
17
19
|
export async function builtin_store(args) {
|
|
18
20
|
const parsed = commandArgs_process(args);
|
|
19
21
|
const subcommand = parsed._[0];
|
|
20
22
|
if (!subcommand) {
|
|
21
|
-
|
|
22
|
-
return;
|
|
23
|
+
return envelope_ok(`${chalk.red("Usage: store <list|search|install> ...")}\n`);
|
|
23
24
|
}
|
|
24
25
|
const storeOptions = {
|
|
25
26
|
store: parsed.store
|
|
@@ -30,78 +31,61 @@ export async function builtin_store(args) {
|
|
|
30
31
|
const items = await store_listPlugins(storeOptions);
|
|
31
32
|
spinner.stop();
|
|
32
33
|
if (items.length === 0) {
|
|
33
|
-
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
// Use grid render by default, or long render if -l flag (handled by view options in future,
|
|
37
|
-
// but currently ls view helpers accept options).
|
|
38
|
-
// chell's ls uses args to parse flags. Here we have parsed args.
|
|
39
|
-
// parsed.l is boolean.
|
|
40
|
-
if (parsed.l) {
|
|
41
|
-
console.log(long_render(items, { human: !!parsed.h }));
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
console.log(grid_render(items));
|
|
34
|
+
return envelope_ok('No plugins found in store.\n');
|
|
45
35
|
}
|
|
36
|
+
// Use grid render by default, or long render if -l flag.
|
|
37
|
+
return envelope_ok(parsed.l ? `${long_render(items, { human: !!parsed.h })}\n` : `${grid_render(items)}\n`);
|
|
46
38
|
}
|
|
47
39
|
else if (subcommand === 'search') {
|
|
48
40
|
const query = parsed._[1];
|
|
49
41
|
if (!query) {
|
|
50
42
|
spinner.stop();
|
|
51
|
-
|
|
52
|
-
return;
|
|
43
|
+
return envelope_ok(`${chalk.red("Usage: store search <query>")}\n`);
|
|
53
44
|
}
|
|
54
45
|
const items = await store_searchPlugins(query, storeOptions);
|
|
55
46
|
spinner.stop();
|
|
56
47
|
if (items.length === 0) {
|
|
57
|
-
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (parsed.l) {
|
|
61
|
-
console.log(long_render(items, { human: !!parsed.h }));
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
console.log(grid_render(items));
|
|
48
|
+
return envelope_ok(`No plugins found matching '${query}'.\n`);
|
|
65
49
|
}
|
|
50
|
+
return envelope_ok(parsed.l ? `${long_render(items, { human: !!parsed.h })}\n` : `${grid_render(items)}\n`);
|
|
66
51
|
}
|
|
67
52
|
else if (subcommand === 'install') {
|
|
68
53
|
spinner.stop();
|
|
69
54
|
const installParsed = { ...parsed, _: [parsed._[0], parsed._[1]] };
|
|
70
|
-
await plugin_addInteractive(installParsed);
|
|
55
|
+
return await plugin_addInteractive(installParsed);
|
|
71
56
|
}
|
|
72
57
|
else if (subcommand === 'inspect') {
|
|
73
58
|
spinner.stop();
|
|
74
59
|
const current = storeUrl_get();
|
|
75
60
|
const isDefault = storeUrl_isDefault();
|
|
76
|
-
|
|
61
|
+
return envelope_ok(`${chalk.bold('Peer store URL:')} ${chalk.blue(current)}${isDefault ? chalk.gray(' (default)') : chalk.yellow(' (custom)')}\n`);
|
|
77
62
|
}
|
|
78
63
|
else if (subcommand === 'set') {
|
|
79
64
|
spinner.stop();
|
|
80
65
|
const url = parsed._[1];
|
|
81
66
|
if (!url) {
|
|
82
|
-
console.log(chalk.red('Usage: store set <url>'));
|
|
83
67
|
process.exitCode = 1;
|
|
84
|
-
return;
|
|
68
|
+
return envelope_error('', undefined, `${chalk.red('Usage: store set <url>')}\n`);
|
|
85
69
|
}
|
|
86
70
|
storeUrl_set(url);
|
|
87
71
|
await storeConfig_persist();
|
|
88
|
-
|
|
72
|
+
return envelope_ok(`${chalk.green(`Store URL set to: ${chalk.blue(url)}`)}\n`);
|
|
89
73
|
}
|
|
90
74
|
else if (subcommand === 'reset') {
|
|
91
75
|
spinner.stop();
|
|
92
76
|
storeUrl_clear();
|
|
93
77
|
await storeConfig_persist();
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
spinner.stop();
|
|
98
|
-
console.log(chalk.red(`Unknown subcommand: ${subcommand}. Usage: store <list|search|install|inspect|set|reset>`));
|
|
78
|
+
return envelope_ok(`${chalk.green(`Store URL reset to default: ${chalk.blue(DEFAULT_STORE_URL)}`)}\n`);
|
|
99
79
|
}
|
|
80
|
+
spinner.stop();
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
return envelope_error('', undefined, `${chalk.red(`Unknown subcommand: ${subcommand}. Usage: store <list|search|install|inspect|set|reset>`)}\n`);
|
|
100
83
|
}
|
|
101
84
|
catch (e) {
|
|
102
85
|
spinner.stop();
|
|
103
86
|
const msg = e instanceof Error ? e.message : String(e);
|
|
104
|
-
|
|
87
|
+
process.exitCode = 1;
|
|
88
|
+
return envelope_error('', undefined, `${chalk.red(`Store error: ${msg}`)}\n`);
|
|
105
89
|
}
|
|
106
90
|
}
|
|
107
91
|
//# sourceMappingURL=store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/builtins/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAc,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/builtins/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAc,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAwB,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;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,GAAG,CAAC,CAAC;QACrB,OAAO,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAChF,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { CommandEnvelope } from '@fnndsc/cumin';
|
|
1
2
|
/**
|
|
2
3
|
* Displays the current ChRIS context.
|
|
3
4
|
*
|
|
4
5
|
* @param args - Command line arguments (optional flags).
|
|
5
6
|
*/
|
|
6
|
-
export declare function builtin_context(
|
|
7
|
+
export declare function builtin_context(_args: string[]): Promise<CommandEnvelope>;
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import { context_getSingle } from '@fnndsc/salsa';
|
|
7
7
|
import { session } from '../../session/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import { envelope_ok } from '@fnndsc/cumin';
|
|
9
|
+
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
9
10
|
/**
|
|
10
11
|
* Displays the current ChRIS context.
|
|
11
12
|
*
|
|
12
13
|
* @param args - Command line arguments (optional flags).
|
|
13
14
|
*/
|
|
14
|
-
export async function builtin_context(
|
|
15
|
+
export async function builtin_context(_args) {
|
|
15
16
|
const context = await context_getSingle();
|
|
16
17
|
const tableData = [
|
|
17
18
|
{
|
|
@@ -43,8 +44,8 @@ export async function builtin_context(args) {
|
|
|
43
44
|
Value: session.physicalMode_get() ? chalk.magenta('Enabled') : chalk.gray('Disabled'),
|
|
44
45
|
},
|
|
45
46
|
];
|
|
46
|
-
|
|
47
|
+
return envelope_ok(table_render(tableData, ['Context', 'Value'], {
|
|
47
48
|
title: { title: 'ChRIS Context', justification: 'center' },
|
|
48
|
-
});
|
|
49
|
+
}));
|
|
49
50
|
}
|
|
50
51
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/builtins/sys/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/builtins/sys/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAkC,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAU9D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,KAAe;IACnD,MAAM,OAAO,GAAkB,MAAM,iBAAiB,EAAE,CAAC;IAEzD,MAAM,SAAS,GAAiB;QAC9B;YACE,OAAO,EAAE,YAAY;YACrB,KAAK,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;SAC7C;QACD;YACE,OAAO,EAAE,WAAW;YACpB,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;SAC5C;QACD;YACE,OAAO,EAAE,cAAc;YACvB,KAAK,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;SAC/C;QACD;YACE,OAAO,EAAE,YAAY;YACrB,KAAK,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;SAC7C;QACD;YACE,OAAO,EAAE,cAAc;YACvB,KAAK,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;SAC/C;QACD;YACE,OAAO,EAAE,aAAa;YACtB,KAAK,EAAE,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;SACnD;QACD;YACE,OAAO,EAAE,eAAe;YACxB,KAAK,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;SACtF;KACF,CAAC;IAEF,OAAO,WAAW,CAChB,YAAY,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;QAC5C,KAAK,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE;KAC3D,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Delegation to the chili command layer.
|
|
3
3
|
*
|
|
4
|
-
* Unknown commands and
|
|
5
|
-
*
|
|
4
|
+
* Unknown commands and the pacs passthroughs hand off to chili. This lives in
|
|
5
|
+
* its own leaf module so both the dispatcher and any builtins can call it
|
|
6
6
|
* without importing each other — dispatch imports the builtins, so routing the
|
|
7
7
|
* delegation through dispatch would close a cycle.
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
+
import { type CommandEnvelope } from '@fnndsc/cumin';
|
|
11
12
|
/**
|
|
12
|
-
* Runs a chili command in-process.
|
|
13
|
+
* Runs a chili command in-process and returns its output as an envelope.
|
|
13
14
|
*
|
|
14
15
|
* chili shares this process's cumin connection and context, so there is no node
|
|
15
|
-
* subprocess to spawn and no per-command startup cost.
|
|
16
|
+
* subprocess to spawn and no per-command startup cost. Its output is captured
|
|
17
|
+
* through chili's own output seam ({@link run_capture}) rather than a console
|
|
18
|
+
* monkeypatch, so the rendered text and error stream travel in the envelope.
|
|
16
19
|
*
|
|
17
|
-
* @param command - The command to run (e.g., "
|
|
20
|
+
* @param command - The command to run (e.g., "pacsservers").
|
|
18
21
|
* @param args - The arguments to pass to the command.
|
|
19
|
-
* @returns
|
|
22
|
+
* @returns An envelope carrying chili's captured output.
|
|
20
23
|
*/
|
|
21
|
-
export declare function chiliCommand_run(command: string, args: string[]): Promise<
|
|
24
|
+
export declare function chiliCommand_run(command: string, args: string[]): Promise<CommandEnvelope>;
|
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Delegation to the chili command layer.
|
|
3
3
|
*
|
|
4
|
-
* Unknown commands and
|
|
5
|
-
*
|
|
4
|
+
* Unknown commands and the pacs passthroughs hand off to chili. This lives in
|
|
5
|
+
* its own leaf module so both the dispatcher and any builtins can call it
|
|
6
6
|
* without importing each other — dispatch imports the builtins, so routing the
|
|
7
7
|
* delegation through dispatch would close a cycle.
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
11
|
import chalk from 'chalk';
|
|
12
|
-
import {
|
|
12
|
+
import { run_capture } from '@fnndsc/chili/run.js';
|
|
13
|
+
import { envelope_ok, envelope_error } from '@fnndsc/cumin';
|
|
13
14
|
/**
|
|
14
|
-
* Runs a chili command in-process.
|
|
15
|
+
* Runs a chili command in-process and returns its output as an envelope.
|
|
15
16
|
*
|
|
16
17
|
* chili shares this process's cumin connection and context, so there is no node
|
|
17
|
-
* subprocess to spawn and no per-command startup cost.
|
|
18
|
+
* subprocess to spawn and no per-command startup cost. Its output is captured
|
|
19
|
+
* through chili's own output seam ({@link run_capture}) rather than a console
|
|
20
|
+
* monkeypatch, so the rendered text and error stream travel in the envelope.
|
|
18
21
|
*
|
|
19
|
-
* @param command - The command to run (e.g., "
|
|
22
|
+
* @param command - The command to run (e.g., "pacsservers").
|
|
20
23
|
* @param args - The arguments to pass to the command.
|
|
21
|
-
* @returns
|
|
24
|
+
* @returns An envelope carrying chili's captured output.
|
|
22
25
|
*/
|
|
23
26
|
export async function chiliCommand_run(command, args) {
|
|
24
27
|
try {
|
|
25
|
-
await
|
|
28
|
+
const { out, err } = await run_capture([command, ...args]);
|
|
29
|
+
const envelope = envelope_ok(out);
|
|
30
|
+
if (err.length > 0) {
|
|
31
|
+
envelope.renderedErr = err;
|
|
32
|
+
}
|
|
33
|
+
return envelope;
|
|
26
34
|
}
|
|
27
|
-
catch (
|
|
28
|
-
const message =
|
|
29
|
-
|
|
35
|
+
catch (e) {
|
|
36
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
return envelope_error('', undefined, `${chalk.red(`chili command '${command}' failed: ${message}`)}\n`);
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
41
|
//# sourceMappingURL=chiliDelegate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chiliDelegate.js","sourceRoot":"","sources":["../../src/core/chiliDelegate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"chiliDelegate.js","sourceRoot":"","sources":["../../src/core/chiliDelegate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAwB,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAElF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAe,EAAE,IAAc;IACpE,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,WAAW,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAoB,WAAW,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnB,QAAQ,CAAC,WAAW,GAAG,GAAG,CAAC;QAC7B,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,OAAO,GAAW,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,kBAAkB,OAAO,aAAa,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1G,CAAC;AACH,CAAC"}
|
package/dist/core/dispatch.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ type CommandHandler = (args: string[]) => Promise<void>;
|
|
|
16
16
|
* table below consumes them through {@link envelopeHandler_wrap}.
|
|
17
17
|
*/
|
|
18
18
|
type EnvelopeHandler = (args: string[]) => Promise<CommandEnvelope>;
|
|
19
|
+
/**
|
|
20
|
+
* Builtins that have been converted to return envelopes, keyed by command
|
|
21
|
+
* name. Entries here are also present in COMMAND_HANDLERS in wrapped form;
|
|
22
|
+
* this registry exists so envelope-aware hosts can bypass the wrapper and
|
|
23
|
+
* receive the structured result.
|
|
24
|
+
*/
|
|
19
25
|
export declare const ENVELOPE_HANDLERS: Record<string, EnvelopeHandler>;
|
|
20
26
|
export declare const COMMAND_HANDLERS: Record<string, CommandHandler>;
|
|
21
27
|
export { COMMAND_HANDLERS_KEYS } from '../command-keys.js';
|