trm-client 9.4.1 → 10.0.1

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.
Files changed (67) hide show
  1. package/changelog.txt +19 -0
  2. package/dist/command/AbstractCommand.d.ts +9 -4
  3. package/dist/command/AbstractCommand.js +82 -34
  4. package/dist/command/implementations/Alias.d.ts +2 -1
  5. package/dist/command/implementations/Alias.js +45 -13
  6. package/dist/command/implementations/Cg3y.d.ts +2 -1
  7. package/dist/command/implementations/Cg3y.js +19 -7
  8. package/dist/command/implementations/Cg3z.d.ts +2 -1
  9. package/dist/command/implementations/Cg3z.js +19 -7
  10. package/dist/command/implementations/ClearCache.d.ts +2 -1
  11. package/dist/command/implementations/ClearCache.js +11 -3
  12. package/dist/command/implementations/Compare.d.ts +2 -1
  13. package/dist/command/implementations/Compare.js +20 -7
  14. package/dist/command/implementations/Content.d.ts +2 -1
  15. package/dist/command/implementations/Content.js +22 -9
  16. package/dist/command/implementations/Deprecate.d.ts +2 -1
  17. package/dist/command/implementations/Deprecate.js +19 -7
  18. package/dist/command/implementations/Dirty.d.ts +2 -1
  19. package/dist/command/implementations/Dirty.js +21 -8
  20. package/dist/command/implementations/DistTag.d.ts +2 -1
  21. package/dist/command/implementations/DistTag.js +40 -14
  22. package/dist/command/implementations/FindDependencies.d.ts +2 -1
  23. package/dist/command/implementations/FindDependencies.js +21 -8
  24. package/dist/command/implementations/Info.d.ts +2 -1
  25. package/dist/command/implementations/Info.js +16 -6
  26. package/dist/command/implementations/Install.d.ts +4 -1
  27. package/dist/command/implementations/Install.js +118 -43
  28. package/dist/command/implementations/List.d.ts +2 -1
  29. package/dist/command/implementations/List.js +19 -6
  30. package/dist/command/implementations/Lock.d.ts +2 -1
  31. package/dist/command/implementations/Lock.js +21 -8
  32. package/dist/command/implementations/Login.d.ts +2 -1
  33. package/dist/command/implementations/Login.js +26 -8
  34. package/dist/command/implementations/Logout.d.ts +2 -1
  35. package/dist/command/implementations/Logout.js +17 -7
  36. package/dist/command/implementations/Ping.d.ts +2 -1
  37. package/dist/command/implementations/Ping.js +15 -5
  38. package/dist/command/implementations/Publish.d.ts +3 -1
  39. package/dist/command/implementations/Publish.js +70 -40
  40. package/dist/command/implementations/Registry.d.ts +2 -1
  41. package/dist/command/implementations/Registry.js +41 -12
  42. package/dist/command/implementations/Settings.d.ts +2 -1
  43. package/dist/command/implementations/Settings.js +18 -6
  44. package/dist/command/implementations/Unpublish.d.ts +2 -1
  45. package/dist/command/implementations/Unpublish.js +18 -6
  46. package/dist/command/implementations/View.d.ts +2 -1
  47. package/dist/command/implementations/View.js +22 -11
  48. package/dist/command/implementations/WhoAmI.d.ts +2 -1
  49. package/dist/command/implementations/WhoAmI.js +17 -7
  50. package/dist/command/implementations/index.d.ts +27 -0
  51. package/dist/command/implementations/index.js +65 -0
  52. package/dist/command/index.d.ts +2 -0
  53. package/dist/command/index.js +2 -0
  54. package/dist/command/metadata/CommandMetadata.d.ts +57 -0
  55. package/dist/command/metadata/CommandMetadata.js +2 -0
  56. package/dist/command/metadata/applyCommandMetadata.d.ts +3 -0
  57. package/dist/command/metadata/applyCommandMetadata.js +26 -0
  58. package/dist/command/metadata/helpers.d.ts +6 -0
  59. package/dist/command/metadata/helpers.js +45 -0
  60. package/dist/command/metadata/index.d.ts +3 -0
  61. package/dist/command/metadata/index.js +19 -0
  62. package/dist/command/runCommandHandler.d.ts +2 -0
  63. package/dist/command/runCommandHandler.js +24 -0
  64. package/dist/utils/GlobalContext.d.ts +3 -1
  65. package/dist/utils/GlobalContext.js +28 -20
  66. package/dist/utils/SettingsData.d.ts +4 -0
  67. package/package.json +4 -5
package/changelog.txt CHANGED
@@ -8,6 +8,25 @@ Legend
8
8
  + : added
9
9
  - : removed
10
10
 
11
+ 2026-07-06 v10.0.1
12
+ -------------------
13
+ + picker type in metadata
14
+ + custom pickers in metadata
15
+ + negated in metadata
16
+ ! commands gui relevance, icons and grouping
17
+
18
+ 2026-07-06 v10.0.0
19
+ -------------------
20
+ + expose commands metadata
21
+ ! format commands descriptions and longtexts
22
+ - execa dependency
23
+ - support for dockerized trm
24
+ * cache management
25
+
26
+ 2026-07-02 v9.4.1
27
+ -------------------
28
+ + expose exports
29
+
11
30
  2026-06-15 v9.4.0
12
31
  -------------------
13
32
  ! trm-core ^9.8.0
@@ -4,19 +4,22 @@ import { CliVersionStatus } from "../utils";
4
4
  import * as Core from "trm-core";
5
5
  import { Package } from "trm-registry-types";
6
6
  export declare abstract class AbstractCommand {
7
- protected readonly name: string;
8
- protected readonly aliases?: string[];
9
- protected readonly subcommand?: string;
10
7
  protected command: Command;
11
8
  protected registerOpts: RegisterCommandOpts;
12
9
  protected args: any;
10
+ protected readonly name: string;
11
+ protected readonly aliases?: string[];
12
+ protected readonly subcommand?: string;
13
13
  private cliVersionStatus;
14
14
  private registry;
15
15
  private registryAuthData;
16
16
  private registryAuthFailed;
17
17
  private systemPackages;
18
18
  private trmDependenciesCheck;
19
+ private metadata;
19
20
  constructor(program: Command, name: string, aliases?: string[], subcommand?: string);
21
+ constructor(name: string, aliases?: string[], subcommand?: string);
22
+ private getMetadata;
20
23
  getCliVersionStatus(): Promise<CliVersionStatus>;
21
24
  getRegistry(): Core.AbstractRegistry;
22
25
  hasRegistryAuthData(): boolean;
@@ -25,11 +28,11 @@ export declare abstract class AbstractCommand {
25
28
  viewRegistryPackage(packageName: string, print?: boolean): Promise<Package>;
26
29
  getSystemPackages(): Promise<Core.TrmPackage[]>;
27
30
  getTrmDependenciesCheck(): Promise<Core.CheckTrmDependencies>;
28
- protected abstract init(): void;
29
31
  protected abstract handler(): Promise<void>;
30
32
  register(): void;
31
33
  private getLogger;
32
34
  private getInquirer;
35
+ private normalizeArgs;
33
36
  private parseCommandArgs;
34
37
  validateOutputFileArg(argValue: string): void;
35
38
  validateInputFileArg(argValue: string): void;
@@ -41,5 +44,7 @@ export declare abstract class AbstractCommand {
41
44
  parseJsonArg(name: string): any;
42
45
  parseArrayArg(name: string): string[];
43
46
  parseNumberArg(name: string): number;
47
+ run(args?: any): Promise<void>;
44
48
  private execute;
49
+ private executePrepared;
45
50
  }
@@ -59,33 +59,48 @@ const fs_1 = require("fs");
59
59
  const path_1 = require("path");
60
60
  const constants_1 = __importDefault(require("constants"));
61
61
  const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
62
+ const applyCommandMetadata_1 = require("./metadata/applyCommandMetadata");
62
63
  class AbstractCommand {
63
- constructor(program, name, aliases, subcommand) {
64
- this.name = name;
65
- this.aliases = aliases;
66
- this.subcommand = subcommand;
64
+ constructor(programOrName, nameOrAliases, aliasesOrSubcommand, subcommandArg) {
67
65
  this.registerOpts = {};
68
66
  this.args = {};
69
67
  this.registryAuthData = false;
70
- const index = program.commands.findIndex(c => c.name() === this.name);
71
- if (index >= 0) {
72
- if (subcommand) {
73
- this.command = program.commands[index];
68
+ const program = typeof programOrName === "string" ? undefined : programOrName;
69
+ this.name = typeof programOrName === "string" ? programOrName : nameOrAliases;
70
+ this.aliases = typeof programOrName === "string" ? nameOrAliases : aliasesOrSubcommand;
71
+ this.subcommand = typeof programOrName === "string" ? aliasesOrSubcommand : subcommandArg;
72
+ this.metadata = this.getMetadata();
73
+ if (this.metadata) {
74
+ this.registerOpts = Object.assign({}, this.metadata.requirements);
75
+ }
76
+ if (program) {
77
+ const index = program.commands.findIndex(c => c.name() === this.name);
78
+ if (index >= 0) {
79
+ if (this.subcommand) {
80
+ this.command = program.commands[index];
81
+ }
82
+ else {
83
+ throw new Error(`Command "${this.name}" declared multiple times without subcommand.`);
84
+ }
74
85
  }
75
86
  else {
76
- throw new Error(`Command "${this.name}" declared multiple times without subcommand.`);
87
+ this.command = program.command(this.name);
88
+ }
89
+ if (this.subcommand) {
90
+ this.command = this.command.command(this.subcommand);
91
+ }
92
+ if (this.aliases) {
93
+ this.command.aliases(this.aliases);
94
+ }
95
+ if (this.metadata) {
96
+ (0, applyCommandMetadata_1.applyCommandMetadata)(this.command, this.metadata);
77
97
  }
78
98
  }
79
- else {
80
- this.command = program.command(this.name);
81
- }
82
- if (this.subcommand) {
83
- this.command = this.command.command(this.subcommand);
84
- }
85
- if (aliases) {
86
- this.command.aliases(aliases);
87
- }
88
- this.init();
99
+ }
100
+ getMetadata() {
101
+ const metadata = this.constructor.metadata;
102
+ const entries = Array.isArray(metadata) ? metadata : metadata ? [metadata] : [];
103
+ return entries.find(entry => entry.command === this.name && entry.subcommand === this.subcommand);
89
104
  }
90
105
  getCliVersionStatus() {
91
106
  return __awaiter(this, void 0, void 0, function* () {
@@ -171,6 +186,9 @@ class AbstractCommand {
171
186
  });
172
187
  }
173
188
  register() {
189
+ if (!this.command) {
190
+ throw new Error(`Command "${this.name}" cannot be registered without a Commander program.`);
191
+ }
174
192
  const defaultLogger = utils_1.GlobalContext.getInstance().getSettings().loggerType;
175
193
  const logOutputFolder = utils_1.GlobalContext.getInstance().getSettings().logOutputFolder;
176
194
  this.command
@@ -227,22 +245,38 @@ class AbstractCommand {
227
245
  default: throw new Error(`Unknown inquirer type "${type}". Possible values are ${Object.keys(InquirerType_1.InquirerType).map(k => InquirerType_1.InquirerType[k]).join(', ')}.`);
228
246
  }
229
247
  }
248
+ normalizeArgs(args = {}) {
249
+ const defaultLogger = utils_1.GlobalContext.getInstance().getSettings().loggerType;
250
+ const logOutputFolder = utils_1.GlobalContext.getInstance().getSettings().logOutputFolder;
251
+ const normalized = {
252
+ logger: defaultLogger,
253
+ loggerOutDir: logOutputFolder,
254
+ debug: false
255
+ };
256
+ if (this.metadata) {
257
+ [...this.metadata.arguments, ...this.metadata.options].forEach(field => {
258
+ if (field.defaultValue !== undefined) {
259
+ normalized[field.name] = field.defaultValue;
260
+ }
261
+ });
262
+ }
263
+ const providedArgs = Object.entries(args).reduce((acc, [key, value]) => {
264
+ const newKey = key.replace(/[ -](\w)/g, (_, char) => char.toUpperCase());
265
+ acc[newKey] = value;
266
+ return acc;
267
+ }, {});
268
+ return Object.assign(Object.assign({}, normalized), providedArgs);
269
+ }
230
270
  parseCommandArgs(argsValues) {
231
271
  var args = {};
232
- const commandOpts = this.command['_optionValues'] || {};
233
- const commandArgs = this.command["_args"] || [];
272
+ const commandOpts = this.command ? this.command.opts() : {};
273
+ const commandArgs = this.metadata ? [...this.metadata.arguments].sort((a, b) => a.position - b.position) : [];
234
274
  commandArgs.forEach((a, i) => {
235
275
  if (typeof (argsValues[i]) === 'string') {
236
- args[a.name()] = argsValues[i];
276
+ args[a.name] = argsValues[i];
237
277
  }
238
278
  });
239
- args = Object.assign(Object.assign({}, commandOpts), args);
240
- args = Object.entries(args).reduce((acc, [key, value]) => {
241
- const newKey = key.includes(" ") ? key.replace(/ (\w)/g, (_, char) => char.toUpperCase()) : key;
242
- acc[newKey] = value;
243
- return acc;
244
- }, {});
245
- return args;
279
+ return this.normalizeArgs(Object.assign(Object.assign({}, commandOpts), args));
246
280
  }
247
281
  validateOutputFileArg(argValue) {
248
282
  const resolvedPath = (0, path_1.resolve)(argValue);
@@ -366,11 +400,23 @@ class AbstractCommand {
366
400
  catch (_a) { }
367
401
  }
368
402
  }
403
+ run() {
404
+ return __awaiter(this, arguments, void 0, function* (args = {}) {
405
+ this.args = this.normalizeArgs(args);
406
+ this.onArgs();
407
+ yield this.executePrepared(false);
408
+ });
409
+ }
369
410
  execute(...args) {
370
411
  return __awaiter(this, void 0, void 0, function* () {
371
412
  this.args = this.parseCommandArgs(args);
372
413
  this.onArgs();
373
- var exitCode;
414
+ const exitCode = yield this.executePrepared(true);
415
+ process.exit(exitCode);
416
+ });
417
+ }
418
+ executePrepared(logErrors) {
419
+ return __awaiter(this, void 0, void 0, function* () {
374
420
  try {
375
421
  yield utils_1.GlobalContext.getInstance().load();
376
422
  yield Commons.Plugin.call("client", "loadCore", { core: Core });
@@ -457,11 +503,14 @@ class AbstractCommand {
457
503
  if (Commons.Logger.logger instanceof Commons.CliLogger || Commons.Logger.logger instanceof Commons.CliLogFileLogger) {
458
504
  Commons.Logger.logger.forceStop();
459
505
  }
460
- exitCode = 0;
506
+ return 0;
461
507
  }
462
508
  catch (e) {
463
- yield (0, utils_1.logError)(e);
464
- exitCode = 1;
509
+ if (logErrors) {
510
+ yield (0, utils_1.logError)(e);
511
+ return 1;
512
+ }
513
+ throw e;
465
514
  }
466
515
  finally {
467
516
  if (Core.SystemConnector.systemConnector) {
@@ -478,7 +527,6 @@ class AbstractCommand {
478
527
  const logFilePath = Commons.Logger.logger.getFilePath();
479
528
  Commons.Logger.info(`Saved log output "${logFilePath}" for session ID ${sessionId}.`);
480
529
  }
481
- process.exit(exitCode);
482
530
  }
483
531
  });
484
532
  }
@@ -1,6 +1,7 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class Alias extends AbstractCommand {
3
- protected init(): void;
4
+ static readonly metadata: CommandMetadata[];
4
5
  private view;
5
6
  private check;
6
7
  private edit;
@@ -15,20 +15,8 @@ const AbstractCommand_1 = require("../AbstractCommand");
15
15
  const prompts_1 = require("../prompts");
16
16
  const systemAlias_1 = require("../../systemAlias");
17
17
  const utils_1 = require("../../utils");
18
+ const helpers_1 = require("../metadata/helpers");
18
19
  class Alias extends AbstractCommand_1.AbstractCommand {
19
- init() {
20
- if (this.subcommand === 'create') {
21
- this.command.description(`Create a new system alias.`);
22
- this.command.argument(`<alias>`, `Alias name.`);
23
- }
24
- else if (this.subcommand === 'delete') {
25
- this.command.description(`Delete a system alias.`);
26
- this.command.argument(`<alias>`, `Alias name.`);
27
- }
28
- else {
29
- this.command.description(`Manage system aliases.`);
30
- }
31
- }
32
20
  view(alias) {
33
21
  const connection = utils_1.GlobalContext.getInstance().getConnections().find(o => o.name === alias.type);
34
22
  if (!connection) {
@@ -170,3 +158,47 @@ class Alias extends AbstractCommand_1.AbstractCommand {
170
158
  }
171
159
  }
172
160
  exports.Alias = Alias;
161
+ Alias.metadata = [
162
+ {
163
+ id: "alias",
164
+ command: "alias",
165
+ title: "Manage aliases",
166
+ group: "system",
167
+ guiRelevant: false,
168
+ description: "Create, view, edit, check, or delete system aliases.",
169
+ icon: "Network",
170
+ arguments: [],
171
+ options: [],
172
+ requirements: {}
173
+ },
174
+ {
175
+ id: "alias:create",
176
+ command: "alias",
177
+ subcommand: "create",
178
+ title: "Create alias",
179
+ group: "system",
180
+ guiRelevant: false,
181
+ description: "Create a system alias.",
182
+ icon: "Network",
183
+ arguments: [
184
+ (0, helpers_1.argument)(0, { name: "alias", label: "Alias", description: "Name of the system alias." })
185
+ ],
186
+ options: [],
187
+ requirements: {}
188
+ },
189
+ {
190
+ id: "alias:delete",
191
+ command: "alias",
192
+ subcommand: "delete",
193
+ title: "Delete alias",
194
+ group: "system",
195
+ guiRelevant: false,
196
+ description: "Delete a system alias.",
197
+ icon: "Network",
198
+ arguments: [
199
+ (0, helpers_1.argument)(0, { name: "alias", label: "Alias", description: "Name of the system alias." })
200
+ ],
201
+ options: [],
202
+ requirements: {}
203
+ }
204
+ ];
@@ -1,5 +1,6 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class Cg3y extends AbstractCommand {
3
- protected init(): void;
4
+ static readonly metadata: CommandMetadata;
4
5
  protected handler(): Promise<void>;
5
6
  }
@@ -19,14 +19,8 @@ const trm_core_1 = require("trm-core");
19
19
  const trm_commons_1 = require("trm-commons");
20
20
  const promises_1 = require("fs/promises");
21
21
  const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
22
+ const helpers_1 = require("../metadata/helpers");
22
23
  class Cg3y extends AbstractCommand_1.AbstractCommand {
23
- init() {
24
- this.registerOpts.requiresConnection = true;
25
- this.registerOpts.requiresTrmDependencies = true;
26
- this.command.description(`Download any released transport.`);
27
- this.command.argument(`<transport>`, `Transport number.`);
28
- this.command.argument(`[filename]`, `Name (or path) of the output file.`);
29
- }
30
24
  handler() {
31
25
  return __awaiter(this, void 0, void 0, function* () {
32
26
  if (!this.args.filename) {
@@ -47,3 +41,21 @@ class Cg3y extends AbstractCommand_1.AbstractCommand {
47
41
  }
48
42
  }
49
43
  exports.Cg3y = Cg3y;
44
+ Cg3y.metadata = {
45
+ id: "cg3y",
46
+ command: "cg3y",
47
+ title: "Download transport",
48
+ group: "utility",
49
+ groupPriority: 8,
50
+ description: "Download a released transport from the connected system.",
51
+ icon: "Download",
52
+ arguments: [
53
+ (0, helpers_1.argument)(0, { name: "transport", label: "Transport", description: "Transport request number." }),
54
+ (0, helpers_1.argument)(1, { name: "filename", label: "Output file", description: "Output file name or path.", required: false, control: "file-picker", pickerType: "output" })
55
+ ],
56
+ options: [],
57
+ requirements: {
58
+ requiresConnection: true,
59
+ requiresTrmDependencies: true
60
+ }
61
+ };
@@ -1,5 +1,6 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class Cg3z extends AbstractCommand {
3
- protected init(): void;
4
+ static readonly metadata: CommandMetadata;
4
5
  protected handler(): Promise<void>;
5
6
  }
@@ -16,14 +16,8 @@ const trm_core_1 = require("trm-core");
16
16
  const utils_1 = require("../../utils");
17
17
  const promises_1 = require("fs/promises");
18
18
  const path_1 = require("path");
19
+ const helpers_1 = require("../metadata/helpers");
19
20
  class Cg3z extends AbstractCommand_1.AbstractCommand {
20
- init() {
21
- this.registerOpts.requiresConnection = true;
22
- this.registerOpts.requiresTrmDependencies = true;
23
- this.registerOpts.requiresR3trans = true;
24
- this.command.description(`Upload any released transport.`);
25
- this.command.argument(`<filename>`, `Name (or path) of the file.`);
26
- }
27
21
  handler() {
28
22
  return __awaiter(this, void 0, void 0, function* () {
29
23
  const extension = (0, path_1.extname)(this.args.filename);
@@ -58,3 +52,21 @@ class Cg3z extends AbstractCommand_1.AbstractCommand {
58
52
  }
59
53
  }
60
54
  exports.Cg3z = Cg3z;
55
+ Cg3z.metadata = {
56
+ id: "cg3z",
57
+ command: "cg3z",
58
+ title: "Upload transport",
59
+ group: "utility",
60
+ groupPriority: 7,
61
+ description: "Upload a released transport archive to the connected system.",
62
+ icon: "Upload",
63
+ arguments: [
64
+ (0, helpers_1.argument)(0, { name: "filename", label: "Transport archive", description: "Transport archive file name or path.", control: "file-picker", pickerType: "input" })
65
+ ],
66
+ options: [],
67
+ requirements: {
68
+ requiresConnection: true,
69
+ requiresTrmDependencies: true,
70
+ requiresR3trans: true
71
+ }
72
+ };
@@ -1,5 +1,6 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class ClearCache extends AbstractCommand {
3
- protected init(): void;
4
+ static readonly metadata: CommandMetadata;
4
5
  protected handler(): Promise<void>;
5
6
  }
@@ -14,9 +14,6 @@ const AbstractCommand_1 = require("../AbstractCommand");
14
14
  const trm_commons_1 = require("trm-commons");
15
15
  const utils_1 = require("../../utils");
16
16
  class ClearCache extends AbstractCommand_1.AbstractCommand {
17
- init() {
18
- this.command.description(`Clear client cache.`);
19
- }
20
17
  handler() {
21
18
  return __awaiter(this, void 0, void 0, function* () {
22
19
  utils_1.GlobalContext.getInstance().clearCache();
@@ -25,3 +22,14 @@ class ClearCache extends AbstractCommand_1.AbstractCommand {
25
22
  }
26
23
  }
27
24
  exports.ClearCache = ClearCache;
25
+ ClearCache.metadata = {
26
+ id: "clear-cache",
27
+ command: "clear-cache",
28
+ title: "Clear cache",
29
+ group: "utility",
30
+ description: "Clear the client cache.",
31
+ icon: "Trash2",
32
+ arguments: [],
33
+ options: [],
34
+ requirements: {}
35
+ };
@@ -1,7 +1,8 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class Compare extends AbstractCommand {
4
+ static readonly metadata: CommandMetadata;
3
5
  private connections;
4
- protected init(): void;
5
6
  private promptConnections;
6
7
  protected handler(): Promise<void>;
7
8
  }
@@ -15,18 +15,12 @@ const trm_core_1 = require("trm-core");
15
15
  const AbstractCommand_1 = require("../AbstractCommand");
16
16
  const systemAlias_1 = require("../../systemAlias");
17
17
  const prompts_1 = require("../prompts");
18
+ const helpers_1 = require("../metadata/helpers");
18
19
  class Compare extends AbstractCommand_1.AbstractCommand {
19
20
  constructor() {
20
21
  super(...arguments);
21
22
  this.connections = [];
22
23
  }
23
- init() {
24
- this.registerOpts.requiresRegistry = true;
25
- this.registerOpts.ignoreRegistryUnreachable = true;
26
- this.command.description(`Compare a package between different systems.`);
27
- this.command.argument(`<package>`, `Name of the package.`);
28
- this.command.option(`-c, --connections <json>`, `Array of system connection aliases (JSON or path to JSON file).`);
29
- }
30
24
  promptConnections() {
31
25
  return __awaiter(this, void 0, void 0, function* () {
32
26
  if (this.connections.length > 0) {
@@ -131,3 +125,22 @@ class Compare extends AbstractCommand_1.AbstractCommand {
131
125
  }
132
126
  }
133
127
  exports.Compare = Compare;
128
+ Compare.metadata = {
129
+ id: "compare",
130
+ command: "compare",
131
+ title: "Compare package",
132
+ group: "package",
133
+ guiRelevant: false,
134
+ description: "Compare a package across multiple systems.",
135
+ icon: "GitCompare",
136
+ arguments: [
137
+ (0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package name." })
138
+ ],
139
+ options: [
140
+ (0, helpers_1.option)("-c, --connections <json>", { name: "connections", label: "Connections", description: "System connection aliases as JSON, or a path to a JSON file.", control: "textarea" })
141
+ ],
142
+ requirements: {
143
+ requiresRegistry: true,
144
+ ignoreRegistryUnreachable: true
145
+ }
146
+ };
@@ -1,5 +1,6 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class Content extends AbstractCommand {
3
- protected init(): void;
4
+ static readonly metadata: CommandMetadata;
4
5
  protected handler(): Promise<void>;
5
6
  }
@@ -17,16 +17,8 @@ const trm_commons_1 = require("trm-commons");
17
17
  const AbstractCommand_1 = require("../AbstractCommand");
18
18
  const utils_1 = require("../../utils");
19
19
  const chalk_1 = __importDefault(require("chalk"));
20
+ const helpers_1 = require("../metadata/helpers");
20
21
  class Content extends AbstractCommand_1.AbstractCommand {
21
- init() {
22
- this.registerOpts.requiresRegistry = true;
23
- this.registerOpts.requiresR3trans = true;
24
- this.command.description(`Extract and list content of a package.`);
25
- this.command.addHelpText(`before`, `This command has no effect when trying to login into a registry that doesn't require authentication.`);
26
- this.command.argument(`<package>`, `Name of the package.`);
27
- this.command.argument(`[version]`, `Version or tag of the package`, 'latest');
28
- this.command.option(`--full`, `Show all transport entries of the package`, false);
29
- }
30
22
  handler() {
31
23
  return __awaiter(this, void 0, void 0, function* () {
32
24
  var transports = {};
@@ -193,3 +185,24 @@ class Content extends AbstractCommand_1.AbstractCommand {
193
185
  }
194
186
  }
195
187
  exports.Content = Content;
188
+ Content.metadata = {
189
+ id: "content",
190
+ command: "content",
191
+ aliases: ["contents"],
192
+ title: "Package content",
193
+ group: "registry",
194
+ groupPriority: 7,
195
+ description: "View the contents of a package release in registry.",
196
+ icon: "FolderTree",
197
+ arguments: [
198
+ (0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package name." }),
199
+ (0, helpers_1.argument)(1, { name: "version", label: "Version", description: "Package version or distribution tag.", required: false, defaultValue: "latest" })
200
+ ],
201
+ options: [
202
+ (0, helpers_1.option)("--full", { name: "full", label: "Full content", description: "Show all transport entries in the package.", control: "checkbox", defaultValue: false })
203
+ ],
204
+ requirements: {
205
+ requiresRegistry: true,
206
+ requiresR3trans: true
207
+ }
208
+ };
@@ -1,5 +1,6 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class Deprecate extends AbstractCommand {
3
- protected init(): void;
4
+ static readonly metadata: CommandMetadata;
4
5
  protected handler(): Promise<void>;
5
6
  }
@@ -12,14 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Deprecate = void 0;
13
13
  const trm_commons_1 = require("trm-commons");
14
14
  const AbstractCommand_1 = require("../AbstractCommand");
15
+ const helpers_1 = require("../metadata/helpers");
15
16
  class Deprecate extends AbstractCommand_1.AbstractCommand {
16
- init() {
17
- this.registerOpts.requiresRegistry = true;
18
- this.command.description(`Deprecate a package release from registry.`);
19
- this.command.argument(`<package>`, `Name of the package.`);
20
- this.command.argument(`<version>`, `Version of the release.`);
21
- this.command.option(`--note <note>`, `Deprecation note`);
22
- }
23
17
  handler() {
24
18
  return __awaiter(this, void 0, void 0, function* () {
25
19
  if (!this.args.note) {
@@ -33,3 +27,21 @@ class Deprecate extends AbstractCommand_1.AbstractCommand {
33
27
  }
34
28
  }
35
29
  exports.Deprecate = Deprecate;
30
+ Deprecate.metadata = {
31
+ id: "deprecate",
32
+ command: "deprecate",
33
+ title: "Deprecate release",
34
+ group: "registry",
35
+ description: "Deprecate a package release in the registry.",
36
+ icon: "ArchiveX",
37
+ arguments: [
38
+ (0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package name." }),
39
+ (0, helpers_1.argument)(1, { name: "version", label: "Version", description: "Release version." })
40
+ ],
41
+ options: [
42
+ (0, helpers_1.option)("--note <note>", { name: "note", label: "Deprecation note", description: "Message shown for the deprecated release." })
43
+ ],
44
+ requirements: {
45
+ requiresRegistry: true
46
+ }
47
+ };
@@ -1,6 +1,7 @@
1
1
  import { AbstractCommand } from "../AbstractCommand";
2
+ import { CommandMetadata } from "../metadata/CommandMetadata";
2
3
  export declare class Dirty extends AbstractCommand {
3
- protected init(): void;
4
+ static readonly metadata: CommandMetadata;
4
5
  private keepFirstByKey;
5
6
  protected handler(): Promise<void>;
6
7
  }
@@ -17,15 +17,8 @@ const trm_commons_1 = require("trm-commons");
17
17
  const trm_core_1 = require("trm-core");
18
18
  const AbstractCommand_1 = require("../AbstractCommand");
19
19
  const chalk_1 = __importDefault(require("chalk"));
20
+ const helpers_1 = require("../metadata/helpers");
20
21
  class Dirty extends AbstractCommand_1.AbstractCommand {
21
- init() {
22
- this.registerOpts.requiresConnection = true;
23
- this.registerOpts.requiresRegistry = true;
24
- this.registerOpts.ignoreRegistryUnreachable = true;
25
- this.command.description(`Show local objetcs that flagged a package as dirty.`);
26
- this.command.argument(`<package>`, `Name of the dirty package to check.`);
27
- this.command.option(`--latest-only`, `Show only the latest transports with changes`, false);
28
- }
29
22
  keepFirstByKey(entries) {
30
23
  const seen = new Set();
31
24
  return entries.filter(entry => {
@@ -78,3 +71,23 @@ class Dirty extends AbstractCommand_1.AbstractCommand {
78
71
  }
79
72
  }
80
73
  exports.Dirty = Dirty;
74
+ Dirty.metadata = {
75
+ id: "dirty",
76
+ command: "dirty",
77
+ title: "Show dirty entries",
78
+ group: "package",
79
+ guiRelevant: false,
80
+ description: "Show objects that caused a package to be marked as dirty.",
81
+ icon: "TriangleAlert",
82
+ arguments: [
83
+ (0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package to inspect." })
84
+ ],
85
+ options: [
86
+ (0, helpers_1.option)("--latest-only", { name: "latestOnly", label: "Latest only", description: "Show only the latest transports that contain changes.", control: "checkbox", defaultValue: false })
87
+ ],
88
+ requirements: {
89
+ requiresConnection: true,
90
+ requiresRegistry: true,
91
+ ignoreRegistryUnreachable: true
92
+ }
93
+ };