@fnndsc/brasa 0.1.0 → 0.2.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/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/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/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/help.d.ts +16 -1
- package/dist/builtins/help.js +39 -18
- package/dist/builtins/help.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/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/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/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/dispatch.d.ts +6 -0
- package/dist/core/dispatch.js +77 -85
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/sink.d.ts +0 -18
- package/dist/core/sink.js +0 -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
|
@@ -18,83 +18,79 @@ import { pluginFields_fetch } from '@fnndsc/chili/commands/plugins/fields.js';
|
|
|
18
18
|
import { plugin_execute } from '@fnndsc/chili/commands/plugin/run.js';
|
|
19
19
|
import { plugin_add } from '@fnndsc/chili/commands/plugins/add.js';
|
|
20
20
|
import { pluginList_render, pluginRun_render } from '@fnndsc/chili/views/plugin.js';
|
|
21
|
-
import {
|
|
22
|
-
import { chiliCommand_run } from '../../core/chiliDelegate.js';
|
|
21
|
+
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
23
22
|
import { spinner } from '../../lib/spinner.js';
|
|
24
|
-
import { errorStack } from '@fnndsc/cumin';
|
|
23
|
+
import { errorStack, envelope_ok, envelope_error } from '@fnndsc/cumin';
|
|
25
24
|
import { adminPrompt_register } from '@fnndsc/chili/utils/admin_prompt.js';
|
|
26
25
|
import { repl_question, repl_questionHidden } from '../../core/question.js';
|
|
27
26
|
/**
|
|
28
27
|
* Handles plugin commands.
|
|
29
28
|
*
|
|
30
29
|
* @param args - command arguments.
|
|
30
|
+
* @returns An envelope carrying the rendered plugin output.
|
|
31
31
|
*/
|
|
32
32
|
export async function builtin_plugin(args) {
|
|
33
33
|
const parsed = commandArgs_process(args);
|
|
34
34
|
const subcommand = parsed._[0];
|
|
35
35
|
if (!subcommand) {
|
|
36
|
-
|
|
37
|
-
return;
|
|
36
|
+
return envelope_ok(`${chalk.red("Usage: plugin <list|run|add> ...")}\n`);
|
|
38
37
|
}
|
|
39
38
|
try {
|
|
40
39
|
if (subcommand === 'list') {
|
|
41
40
|
const { plugins, selectedFields, totalCount } = await plugins_fetchList(parsed);
|
|
42
|
-
|
|
41
|
+
let rendered = `${pluginList_render(plugins, selectedFields, { table: !!parsed.table, csv: !!parsed.csv })}\n`;
|
|
43
42
|
if (totalCount !== undefined && plugins.length < totalCount) {
|
|
44
|
-
|
|
43
|
+
rendered += `${chalk.dim(` ↓ showing ${plugins.length} of ${totalCount} · --all to fetch all · --limit <n> for page size`)}\n`;
|
|
45
44
|
}
|
|
45
|
+
return envelope_ok(rendered);
|
|
46
46
|
}
|
|
47
47
|
else if (subcommand === 'run') {
|
|
48
48
|
const searchable = parsed._[1];
|
|
49
49
|
if (!searchable) {
|
|
50
|
-
|
|
51
|
-
return;
|
|
50
|
+
return envelope_ok(`${chalk.red("Usage: plugin run <plugin> [args...]")}\n`);
|
|
52
51
|
}
|
|
53
52
|
const params = args.slice(2).join(' ');
|
|
54
53
|
const instance = await plugin_execute(searchable, params);
|
|
55
54
|
if (instance) {
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
console.error(chalk.red("Plugin execution failed."));
|
|
55
|
+
return envelope_ok(`${pluginRun_render(instance)}\n`);
|
|
60
56
|
}
|
|
57
|
+
process.exitCode = 1;
|
|
58
|
+
return envelope_error('', undefined, `${chalk.red("Plugin execution failed.")}\n`);
|
|
61
59
|
}
|
|
62
60
|
else if (subcommand === 'add') {
|
|
63
|
-
await plugin_addInteractive(parsed);
|
|
61
|
+
return await plugin_addInteractive(parsed);
|
|
64
62
|
}
|
|
65
63
|
else if (subcommand === 'inspect') {
|
|
66
64
|
const fields = await pluginFields_fetch();
|
|
67
65
|
if (fields && fields.length > 0) {
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
console.log(chalk.gray('No fields found.'));
|
|
66
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Plugin fields', justification: 'center' } }));
|
|
72
67
|
}
|
|
68
|
+
return envelope_ok(`${chalk.gray('No fields found.')}\n`);
|
|
73
69
|
}
|
|
74
70
|
else if (subcommand === 'search') {
|
|
75
71
|
const query = parsed._[1] ?? '';
|
|
76
|
-
await builtin_plugin(['list', `--search`, query]);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
console.log(chalk.yellow('Directive not handled by chell... spawning chili directly'));
|
|
80
|
-
await chiliCommand_run('plugins', ['-s', ...args]);
|
|
72
|
+
return await builtin_plugin(['list', `--search`, query]);
|
|
81
73
|
}
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
return envelope_error('', undefined, `${chalk.yellow(`Unknown subcommand: ${subcommand}. Usage: plugin <list|run|add|inspect|search>`)}\n`);
|
|
82
76
|
}
|
|
83
77
|
catch (e) {
|
|
84
78
|
const msg = e instanceof Error ? e.message : String(e);
|
|
85
|
-
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
return envelope_error('', undefined, `${chalk.red(`Plugin error: ${msg}`)}\n`);
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
/**
|
|
89
84
|
* Interactive plugin add command with spinner and colored output.
|
|
90
85
|
*
|
|
91
86
|
* @param parsed - Parsed command arguments.
|
|
87
|
+
* @returns An envelope carrying the add outcome. The spinner streams live via
|
|
88
|
+
* the status channel; the result summary is carried in the envelope.
|
|
92
89
|
*/
|
|
93
90
|
export async function plugin_addInteractive(parsed) {
|
|
94
91
|
const pluginInput = parsed._[1];
|
|
95
92
|
if (!pluginInput) {
|
|
96
|
-
|
|
97
|
-
return;
|
|
93
|
+
return envelope_ok(`${chalk.red('Usage: plugin add <name|image|url> [--compute <resources>] [--store <url>]')}\n`);
|
|
98
94
|
}
|
|
99
95
|
const options = {
|
|
100
96
|
compute: parsed.compute,
|
|
@@ -105,36 +101,37 @@ export async function plugin_addInteractive(parsed) {
|
|
|
105
101
|
};
|
|
106
102
|
errorStack.stack_clear();
|
|
107
103
|
adminPrompt_register(repl_question, repl_questionHidden);
|
|
108
|
-
|
|
104
|
+
let rendered = `${chalk.cyan(`\nAdding plugin: ${pluginInput}\n`)}\n`;
|
|
109
105
|
const outcome = await plugin_add(pluginInput, options);
|
|
110
106
|
spinner.stop();
|
|
111
107
|
if (outcome === 'installed') {
|
|
112
|
-
|
|
108
|
+
rendered += `${chalk.green('\n[SUCCESS] Plugin added successfully!\n')}\n`;
|
|
109
|
+
return envelope_ok(rendered);
|
|
113
110
|
}
|
|
114
111
|
else if (outcome === 'already_exists') {
|
|
115
|
-
|
|
112
|
+
rendered += `${chalk.yellow(`\n[INFO] '${pluginInput}' is already registered in this CUBE.\n`)}\n`;
|
|
113
|
+
return envelope_ok(rendered);
|
|
116
114
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
console.log('');
|
|
137
|
-
}
|
|
115
|
+
process.exitCode = 1;
|
|
116
|
+
rendered += `${chalk.red('\n[FAILED] Failed to add plugin.\n')}\n`;
|
|
117
|
+
const errors = errorStack.allOfType_get('error');
|
|
118
|
+
if (errors.length > 0) {
|
|
119
|
+
rendered += `${chalk.red('Errors:')}\n`;
|
|
120
|
+
errors.forEach((error) => {
|
|
121
|
+
const cleanError = error.replace(/^\[.*?\]\s+\|\s+/, '');
|
|
122
|
+
rendered += `${chalk.red(` - ${cleanError}`)}\n`;
|
|
123
|
+
});
|
|
124
|
+
rendered += '\n';
|
|
125
|
+
}
|
|
126
|
+
const warnings = errorStack.allOfType_get('warning');
|
|
127
|
+
if (warnings.length > 0) {
|
|
128
|
+
rendered += `${chalk.yellow('Warnings:')}\n`;
|
|
129
|
+
warnings.forEach((warning) => {
|
|
130
|
+
const cleanWarning = warning.replace(/^\[.*?\]\s+\|\s+/, '');
|
|
131
|
+
rendered += `${chalk.yellow(` [WARNING] ${cleanWarning}`)}\n`;
|
|
132
|
+
});
|
|
133
|
+
rendered += '\n';
|
|
138
134
|
}
|
|
135
|
+
return envelope_ok(rendered);
|
|
139
136
|
}
|
|
140
137
|
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/builtins/res/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAc,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAoB,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"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2
3
|
* Builtin handler for the `plugininstance` command.
|
|
3
4
|
*
|
|
4
5
|
* @param args - Parsed command arguments for the plugin-instance command.
|
|
5
6
|
*/
|
|
6
|
-
export declare function builtin_plugininstance(args: string[]): Promise<
|
|
7
|
+
export declare function builtin_plugininstance(args: string[]): Promise<CommandEnvelope>;
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* Aliases: plugininstance / plugininstances / instance / instances / job / jobs
|
|
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 { pluginInstances_fetchList } from '@fnndsc/chili/commands/plugininstances/list.js';
|
|
10
11
|
import { pluginInstanceFields_fetch } from '@fnndsc/chili/commands/plugininstances/fields.js';
|
|
11
|
-
import {
|
|
12
|
+
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
12
13
|
/**
|
|
13
14
|
* Builtin handler for the `plugininstance` command.
|
|
14
15
|
*
|
|
@@ -21,33 +22,27 @@ export async function builtin_plugininstance(args) {
|
|
|
21
22
|
try {
|
|
22
23
|
const { pluginInstances, selectedFields, totalCount } = await pluginInstances_fetchList(parsed);
|
|
23
24
|
if (pluginInstances.length === 0) {
|
|
24
|
-
|
|
25
|
-
return;
|
|
25
|
+
return envelope_ok(`${chalk.gray('No plugin instances found.')}\n`);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
return envelope_ok(table_render(pluginInstances, selectedFields, { title: { title: 'Plugin Instances', justification: 'center' }, pagination: totalCount !== undefined ? { shown: pluginInstances.length, total: totalCount } : undefined }));
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
30
|
process.exitCode = 1;
|
|
31
|
-
|
|
31
|
+
return envelope_error('', undefined, `${chalk.red(`plugininstance 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_plugininstance([...args.filter((a) => a !== subcommand), `--search`, query]);
|
|
39
37
|
}
|
|
40
38
|
if (subcommand === 'inspect') {
|
|
41
39
|
const fields = await pluginInstanceFields_fetch();
|
|
42
40
|
if (fields && fields.length > 0) {
|
|
43
|
-
|
|
41
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Plugin Instance fields', justification: 'center' } }));
|
|
44
42
|
}
|
|
45
|
-
|
|
46
|
-
console.log(chalk.gray('No fields found for plugin instances.'));
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
43
|
+
return envelope_ok(`${chalk.gray('No fields found for plugin instances.')}\n`);
|
|
49
44
|
}
|
|
50
45
|
process.exitCode = 1;
|
|
51
|
-
|
|
46
|
+
return envelope_error(`${chalk.red(`Unknown subcommand: ${subcommand}. Usage: plugininstances <list|search|inspect>`)}\n`);
|
|
52
47
|
}
|
|
53
48
|
//# sourceMappingURL=plugininstance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugininstance.js","sourceRoot":"","sources":["../../../src/builtins/res/plugininstance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAc,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAA4B,MAAM,gDAAgD,CAAC;AACrH,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"plugininstance.js","sourceRoot":"","sources":["../../../src/builtins/res/plugininstance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7E,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
|
|
3
4
|
*
|
|
4
5
|
* @param args - Parsed command arguments for the plugin-meta command.
|
|
5
6
|
*/
|
|
6
|
-
export declare function builtin_pluginmeta(args: string[]): Promise<
|
|
7
|
+
export declare function builtin_pluginmeta(args: string[]): Promise<CommandEnvelope>;
|
|
@@ -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
|
+
{"version":3,"file":"pluginmeta.js","sourceRoot":"","sources":["../../../src/builtins/res/pluginmeta.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,mBAAmB,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* @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,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,
|
|
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,EAAmB,WAAW,EAAE,cAAc,EAAE,MAAM,e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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,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAc,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,0CAA0C,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,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KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAW,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,OAAO,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAoB,MAAM,oBAAoB,EAAE,CAAC;QAC7D,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QAC3J,CAAC;QACD,OAAO,WAAW,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,IAAI,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACrB,OAAO,cAAc,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,uBAAuB,UAAU,0CAA0C,CAAC,IAAI,CAAC,CAAC;AACvH,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,C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E,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE;KAC3D,CAAC,CACH,CAAC;AACJ,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';
|