@fnndsc/brasa 0.53.0 → 0.54.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/buildinfo.json +1 -1
- package/dist/builtins/res/plugin.d.ts +1 -9
- package/dist/builtins/res/plugin.js +18 -70
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/plugin.sync.d.ts +129 -0
- package/dist/builtins/res/plugin.sync.js +456 -0
- package/dist/builtins/res/plugin.sync.js.map +1 -0
- package/dist/chris/help.js +23 -0
- package/dist/chris/help.js.map +1 -1
- package/dist/config/indexConfig.d.ts +104 -0
- package/dist/config/indexConfig.js +125 -0
- package/dist/config/indexConfig.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/notes.json +1 -1
- package/package.json +5 -5
package/dist/buildinfo.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"hash":"
|
|
1
|
+
{"hash":"382106"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ParsedArgs } from '../utils.js';
|
|
2
1
|
import { type CommandEnvelope } from '@fnndsc/menu';
|
|
2
|
+
export { plugin_addInteractive } from './plugin.sync.js';
|
|
3
3
|
/**
|
|
4
4
|
* Handles plugin commands.
|
|
5
5
|
*
|
|
@@ -7,11 +7,3 @@ import { type CommandEnvelope } from '@fnndsc/menu';
|
|
|
7
7
|
* @returns An envelope carrying the rendered plugin output.
|
|
8
8
|
*/
|
|
9
9
|
export declare function builtin_plugin(args: string[]): Promise<CommandEnvelope>;
|
|
10
|
-
/**
|
|
11
|
-
* Interactive plugin add command with spinner and colored output.
|
|
12
|
-
*
|
|
13
|
-
* @param parsed - Parsed command arguments.
|
|
14
|
-
* @returns An envelope carrying the add outcome. The spinner streams live via
|
|
15
|
-
* the status channel; the result summary is carried in the envelope.
|
|
16
|
-
*/
|
|
17
|
-
export declare function plugin_addInteractive(parsed: ParsedArgs): Promise<CommandEnvelope>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles plugin management in chell. Subcommands:
|
|
5
5
|
* - `list` — fetch and render the plugin collection via chili
|
|
6
6
|
* - `run` — execute a plugin instance by searchable name/id
|
|
7
|
-
* - `add`
|
|
7
|
+
* - `add`, `sync`, `validate`, `index` — registering plugins, in `./plugin.sync.ts`
|
|
8
8
|
*
|
|
9
9
|
* Unknown subcommands fall through to a spawned chili process.
|
|
10
10
|
* `plugin` and `plugins` are both registered as aliases in COMMAND_HANDLERS.
|
|
@@ -15,16 +15,16 @@ import chalk from 'chalk';
|
|
|
15
15
|
import { commandArgs_process, cliOptions_extract } from '../utils.js';
|
|
16
16
|
import { plugins_fetchList } from '@fnndsc/chili/commands/plugins/list.js';
|
|
17
17
|
import { pluginFields_fetch } from '@fnndsc/chili/commands/plugins/fields.js';
|
|
18
|
-
import { plugin_add } from '@fnndsc/chili/commands/plugins/add.js';
|
|
19
18
|
import { pluginList_render } from '@fnndsc/chili/views/plugin.js';
|
|
20
19
|
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
21
|
-
import { spinner } from '../../lib/spinner.js';
|
|
22
|
-
import { chili_capture } from '@fnndsc/chili/screen/output.js';
|
|
23
20
|
import { PLUGIN_INFO_MODEL_KIND, envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
24
21
|
import { pluginInfo_build, pluginInfoText_render, pluginSpecifier_parse, } from './plugin.info.js';
|
|
25
|
-
import { authorizationFailure_is, sudoHint_build } from '../../core/elevation.js';
|
|
26
22
|
import { errorStack } from '@fnndsc/fond';
|
|
27
23
|
import { exitCode_set } from '../../core/handlerRun.js';
|
|
24
|
+
import { PLUGIN_BOOLEAN_FLAGS, pluginAdd_run, pluginIndexVerb_run, pluginSync_run, pluginValidate_run, } from './plugin.sync.js';
|
|
25
|
+
export { plugin_addInteractive } from './plugin.sync.js';
|
|
26
|
+
/** The plugin verb's subcommands, as its usage line names them. */
|
|
27
|
+
const PLUGIN_USAGE = 'plugin <list|add|sync|validate|index|info|inspect|search> ...';
|
|
28
28
|
/**
|
|
29
29
|
* Handles plugin commands.
|
|
30
30
|
*
|
|
@@ -32,10 +32,10 @@ import { exitCode_set } from '../../core/handlerRun.js';
|
|
|
32
32
|
* @returns An envelope carrying the rendered plugin output.
|
|
33
33
|
*/
|
|
34
34
|
export async function builtin_plugin(args) {
|
|
35
|
-
const parsed = commandArgs_process(args);
|
|
35
|
+
const parsed = commandArgs_process(args, { booleanLongOptions: PLUGIN_BOOLEAN_FLAGS });
|
|
36
36
|
const subcommand = parsed._[0];
|
|
37
37
|
if (!subcommand) {
|
|
38
|
-
return envelope_ok(`${chalk.red(
|
|
38
|
+
return envelope_ok(`${chalk.red(`Usage: ${PLUGIN_USAGE}`)}\n`);
|
|
39
39
|
}
|
|
40
40
|
try {
|
|
41
41
|
if (subcommand === 'list') {
|
|
@@ -55,7 +55,16 @@ export async function builtin_plugin(args) {
|
|
|
55
55
|
return envelope_error('', undefined, `${chalk.red('plugin run is retired: run a plugin by its name, where you stand — pl-dcm2niix-v1.0.2 …, or A=$(pl-dcm2niix-v1.0.2 …) to name the run.')}\n`);
|
|
56
56
|
}
|
|
57
57
|
else if (subcommand === 'add') {
|
|
58
|
-
return await
|
|
58
|
+
return await pluginAdd_run(parsed, args);
|
|
59
|
+
}
|
|
60
|
+
else if (subcommand === 'sync') {
|
|
61
|
+
return await pluginSync_run(parsed, args);
|
|
62
|
+
}
|
|
63
|
+
else if (subcommand === 'validate') {
|
|
64
|
+
return await pluginValidate_run(parsed);
|
|
65
|
+
}
|
|
66
|
+
else if (subcommand === 'index') {
|
|
67
|
+
return await pluginIndexVerb_run(parsed);
|
|
59
68
|
}
|
|
60
69
|
else if (subcommand === 'inspect') {
|
|
61
70
|
const fields = await pluginFields_fetch();
|
|
@@ -72,7 +81,7 @@ export async function builtin_plugin(args) {
|
|
|
72
81
|
return await builtin_plugin(['list', `--search`, query]);
|
|
73
82
|
}
|
|
74
83
|
exitCode_set(1);
|
|
75
|
-
return envelope_error('', undefined, `${chalk.yellow(`Unknown subcommand: ${subcommand}. Usage:
|
|
84
|
+
return envelope_error('', undefined, `${chalk.yellow(`Unknown subcommand: ${subcommand}. Usage: ${PLUGIN_USAGE}`)}\n`);
|
|
76
85
|
}
|
|
77
86
|
catch (e) {
|
|
78
87
|
const msg = e instanceof Error ? e.message : String(e);
|
|
@@ -115,65 +124,4 @@ async function pluginInfo_show(words) {
|
|
|
115
124
|
data: built.value,
|
|
116
125
|
});
|
|
117
126
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Interactive plugin add command with spinner and colored output.
|
|
120
|
-
*
|
|
121
|
-
* @param parsed - Parsed command arguments.
|
|
122
|
-
* @returns An envelope carrying the add outcome. The spinner streams live via
|
|
123
|
-
* the status channel; the result summary is carried in the envelope.
|
|
124
|
-
*/
|
|
125
|
-
export async function plugin_addInteractive(parsed) {
|
|
126
|
-
const pluginInput = parsed._[1];
|
|
127
|
-
if (!pluginInput) {
|
|
128
|
-
return envelope_ok(`${chalk.red('Usage: plugin add <name|image|url> [--compute <resources>] [--store <url>]')}\n`);
|
|
129
|
-
}
|
|
130
|
-
const options = {
|
|
131
|
-
compute: parsed.compute,
|
|
132
|
-
store: parsed.store,
|
|
133
|
-
adminUser: parsed.adminUser,
|
|
134
|
-
adminPassword: parsed.adminPassword,
|
|
135
|
-
public_repo: parsed.publicRepo,
|
|
136
|
-
};
|
|
137
|
-
errorStack.stack_clear();
|
|
138
|
-
let rendered = `${chalk.cyan(`\nAdding plugin: ${pluginInput}\n`)}\n`;
|
|
139
|
-
const result = { outcome: 'failed' };
|
|
140
|
-
const captured = await chili_capture(async () => {
|
|
141
|
-
result.outcome = await plugin_add(pluginInput, options);
|
|
142
|
-
});
|
|
143
|
-
rendered += captured.out;
|
|
144
|
-
rendered += captured.err;
|
|
145
|
-
spinner.stop();
|
|
146
|
-
if (result.outcome === 'installed') {
|
|
147
|
-
rendered += `${chalk.green('\n[SUCCESS] Plugin added successfully!\n')}\n`;
|
|
148
|
-
return envelope_ok(rendered);
|
|
149
|
-
}
|
|
150
|
-
else if (result.outcome === 'already_exists') {
|
|
151
|
-
rendered += `${chalk.yellow(`\n[INFO] '${pluginInput}' is already registered in this CUBE.\n`)}\n`;
|
|
152
|
-
return envelope_ok(rendered);
|
|
153
|
-
}
|
|
154
|
-
exitCode_set(1);
|
|
155
|
-
rendered += `${chalk.red('\n[FAILED] Failed to add plugin.\n')}\n`;
|
|
156
|
-
const errors = errorStack.allOfType_get('error');
|
|
157
|
-
if (errors.length > 0) {
|
|
158
|
-
rendered += `${chalk.red('Errors:')}\n`;
|
|
159
|
-
errors.forEach((error) => {
|
|
160
|
-
const cleanError = error.replace(/^\[.*?\]\s+\|\s+/, '');
|
|
161
|
-
rendered += `${chalk.red(` - ${cleanError}`)}\n`;
|
|
162
|
-
});
|
|
163
|
-
rendered += '\n';
|
|
164
|
-
}
|
|
165
|
-
if (errors.some(authorizationFailure_is)) {
|
|
166
|
-
rendered += `\n${sudoHint_build('plugin add', [pluginInput])}`;
|
|
167
|
-
}
|
|
168
|
-
const warnings = errorStack.allOfType_get('warning');
|
|
169
|
-
if (warnings.length > 0) {
|
|
170
|
-
rendered += `${chalk.yellow('Warnings:')}\n`;
|
|
171
|
-
warnings.forEach((warning) => {
|
|
172
|
-
const cleanWarning = warning.replace(/^\[.*?\]\s+\|\s+/, '');
|
|
173
|
-
rendered += `${chalk.yellow(` [WARNING] ${cleanWarning}`)}\n`;
|
|
174
|
-
});
|
|
175
|
-
rendered += '\n';
|
|
176
|
-
}
|
|
177
|
-
return envelope_ok(rendered);
|
|
178
|
-
}
|
|
179
127
|
//# 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,m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K,CAAC,GAAG,CAAC,iCAAiC,KAAK,iCAAiC,CAAC,IAAI,CAAC,CAAC;IAClI,CAAC;IAED,MAAM,KAAK,GAA4B,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACzE,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;QACd,MAAM,OAAO,GAAoC,UAAU,CAAC,SAAS,EAAE,CAAC;QACxE,YAAY,CAAC,CAAC,CAAC,CAAC;QAChB,OAAO,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,WAAW,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QACrD,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,KAAK,CAAC,KAAK;KAClB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The plugin verbs that register: `plugin add`, `sync`, `validate`, `index`.
|
|
3
|
+
*
|
|
4
|
+
* The logic is salsa's (`plugin_add`, the index reads, the plan, the checks);
|
|
5
|
+
* this module is the verb: it reads the words, asks where a change needs a
|
|
6
|
+
* yes, streams what lands, and answers with text and a typed model.
|
|
7
|
+
*
|
|
8
|
+
* `plugin sync` is a plan first. Anyone may see it (the plugin list is
|
|
9
|
+
* public); applying it needs an administrator, so a session that is not one
|
|
10
|
+
* sees the plan and the `sudo` line to run instead. After the plan comes one
|
|
11
|
+
* question, `[y/N]`, unless `--yes`; `--plan` stops at the plan. Uploads
|
|
12
|
+
* stream one line each as they land, and what landed stays when the job is
|
|
13
|
+
* stopped (`kill %N`): a rerun plans only what is still missing.
|
|
14
|
+
*
|
|
15
|
+
* Paths: a sync source with no prefix is a CUBE path (an index uploaded
|
|
16
|
+
* there, how a surface with no host access syncs); `plugin validate` and
|
|
17
|
+
* `plugin add --json` need no CUBE, so theirs is a host path. `host:` and
|
|
18
|
+
* `cube:` say which outright; `owner/repo[@ref]` is a GitHub repository.
|
|
19
|
+
*
|
|
20
|
+
* Key components:
|
|
21
|
+
* - pluginAdd_run: `plugin add <name|image|url>` and `plugin add --json <file>`.
|
|
22
|
+
* - pluginSync_run: `plugin sync [source] [--ref] [--plan] [--yes] [--compute]`.
|
|
23
|
+
* - pluginValidate_run: `plugin validate <file|dir|source> [--offline]`.
|
|
24
|
+
* - pluginIndexVerb_run: `plugin index [<source>] [--reset]`.
|
|
25
|
+
* - syncPlan_render / validateReport_render: the text a plan and a report read as.
|
|
26
|
+
*
|
|
27
|
+
* Typical usage:
|
|
28
|
+
* ```ts
|
|
29
|
+
* const envelope: CommandEnvelope = await pluginSync_run(commandArgs_process(args, { booleanLongOptions: PLUGIN_BOOLEAN_FLAGS }), args);
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Dependencies: salsa's plugin modules, the engine's question and sink, the
|
|
33
|
+
* index configuration.
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
import type { SyncPlan, SyncSeams, ValidateReport } from '@fnndsc/salsa';
|
|
38
|
+
import { type CommandEnvelope } from '@fnndsc/menu';
|
|
39
|
+
import { type ParsedArgs } from '../utils.js';
|
|
40
|
+
/** Long flags of the plugin verbs that take no value. */
|
|
41
|
+
export declare const PLUGIN_BOOLEAN_FLAGS: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* `plugin add <name|image|url>` and `plugin add --json <file>`.
|
|
44
|
+
*
|
|
45
|
+
* @param parsed - The parsed words (`_[0]` is `add`).
|
|
46
|
+
* @param words - The words as typed after `plugin`, for the sudo line.
|
|
47
|
+
* @returns The add's outcome as text.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* await pluginAdd_run(commandArgs_process(['add', 'pl-dircopy']), ['add', 'pl-dircopy']);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function pluginAdd_run(parsed: ParsedArgs, words: readonly string[]): Promise<CommandEnvelope>;
|
|
55
|
+
/**
|
|
56
|
+
* `plugin add` for a caller holding parsed words only (`store install`).
|
|
57
|
+
*
|
|
58
|
+
* @param parsed - The parsed words (`_[0]` is the subcommand, `_[1]` the plugin).
|
|
59
|
+
* @returns The add's outcome as text.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* await plugin_addInteractive({ _: ['install', 'pl-dircopy'] });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function plugin_addInteractive(parsed: ParsedArgs): Promise<CommandEnvelope>;
|
|
67
|
+
/**
|
|
68
|
+
* `plugin sync [source] [--ref <ref>] [--plan] [--yes] [--compute a,b]`.
|
|
69
|
+
*
|
|
70
|
+
* @param parsed - The parsed words (`_[0]` is `sync`).
|
|
71
|
+
* @param words - The words as typed after `plugin`, for the sudo line.
|
|
72
|
+
* @param seams - The CUBE reads and the upload; the connected CUBE's by default.
|
|
73
|
+
* @returns The plan, or the plan with what applying it did, as text and a `plugin.sync` model.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* await pluginSync_run(commandArgs_process(['sync', '--plan'], { booleanLongOptions: PLUGIN_BOOLEAN_FLAGS }), ['sync', '--plan']);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function pluginSync_run(parsed: ParsedArgs, words: readonly string[], seamsGiven?: SyncSeams): Promise<CommandEnvelope>;
|
|
81
|
+
/**
|
|
82
|
+
* `plugin validate <file|dir|source> [--offline]`.
|
|
83
|
+
*
|
|
84
|
+
* @param parsed - The parsed words (`_[0]` is `validate`).
|
|
85
|
+
* @param fetcher - The fetch rule 5 and a GitHub source use.
|
|
86
|
+
* @returns The report, as text and a `plugin.validate` model; exit 1 when a rule that ran failed.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* await pluginValidate_run(commandArgs_process(['validate', './plugins', '--offline'], { booleanLongOptions: PLUGIN_BOOLEAN_FLAGS }));
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function pluginValidate_run(parsed: ParsedArgs, fetcher?: typeof fetch): Promise<CommandEnvelope>;
|
|
94
|
+
/**
|
|
95
|
+
* `plugin index [<owner/repo[@ref]>|cube:<path>|host:<path>] [--reset]`.
|
|
96
|
+
*
|
|
97
|
+
* @param parsed - The parsed words (`_[0]` is `index`).
|
|
98
|
+
* @returns The index in effect, or what it was set to.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* await pluginIndexVerb_run({ _: ['index', 'FNNDSC/chris-plugins@v1'] });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function pluginIndexVerb_run(parsed: ParsedArgs): Promise<CommandEnvelope>;
|
|
106
|
+
/**
|
|
107
|
+
* Renders a plan as the operator reads it.
|
|
108
|
+
*
|
|
109
|
+
* @param plan - The plan.
|
|
110
|
+
* @returns Its header, then each group with its plugins (skip as a count).
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* syncPlan_render(plan); // 'plugin sync: chris-plugins @ 8c9a1f6, 175 plugins → this CUBE, on host\n…'
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare function syncPlan_render(plan: SyncPlan): string;
|
|
118
|
+
/**
|
|
119
|
+
* Renders a validation report as the operator reads it.
|
|
120
|
+
*
|
|
121
|
+
* @param report - The report.
|
|
122
|
+
* @returns Each rule's state, then every finding, then the verdict.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* validateReport_render(report); // 'plugin validate: chris-plugins @ 8c9a1f6, 175 descriptors\n…'
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare function validateReport_render(report: ValidateReport): string;
|