@flowscripter/dynamic-cli-framework 10.1.1 → 11.0.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.
@@ -13,7 +13,7 @@ export type KeyValueServiceScopeType = "command" | "service";
13
13
  * {@link KeyValueServiceProvider} (which holds a direct reference to this provider - see
14
14
  * {@link getKeyValueData} and {@link flushIfDirty} - rather than looking this provider up via
15
15
  * {@link Context}, since only {@link configLocation}/{@link setConfigLocation} are safe to expose
16
- * generally; {@link getConfigString} is wired directly to {@link DumpConfigCommand} for the same
16
+ * generally; {@link getConfigString} is wired directly to {@link ConfigDumpSubCommand} for the same
17
17
  * reason - a full config dump would leak every other command's/service's key-value data if it
18
18
  * were reachable through a general lookup).
19
19
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigurationServiceProvider.d.ts","sourceRoot":"","sources":["../../../../src/service/configuration/ConfigurationServiceProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE5F,OAAO,KAAK,EACV,eAAe,EACf,MAAM,EACN,SAAS,EACT,eAAe,EACf,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAS5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAOvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQzE,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,CAAC;AAkB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGG;AACH,MAAM,CAAC,OAAO,OAAO,4BAA6B,YAAW,eAAe;;IAC1E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAA4B;IACtD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC,SAAgB,cAAc,EAAE,OAAO,CAAC;IACxC,SAAgB,aAAa,EAAE,OAAO,CAAC;IACvC,SAAgB,oBAAoB,EAAE,OAAO,CAAC;IAGvC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAKnC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAAa;IAqBvE;;;;;;;;OAQG;IACH,YACE,eAAe,EAAE,MAAM,EACvB,cAAc,UAAQ,EACtB,aAAa,UAAQ,EACrB,oBAAoB,UAAQ,EAW7B;IAEM,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAehE;IAEM,iBAAiB,CAAC,cAAc,EAAE,MAAM,QAE9C;IAED;;;;;;;;;OASG;IACU,wBAAwB,CACnC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC,CAsD3D;IAED;;;;;;OAMG;IACI,eAAe,CACpB,SAAS,EAAE,wBAAwB,EACnC,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAOxB;IAED;;;;;;OAMG;IACU,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQzD;IAEY,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CxD;IA4DM,eAAe,IAAI,MAAM,CAgC/B;CACF"}
1
+ {"version":3,"file":"ConfigurationServiceProvider.d.ts","sourceRoot":"","sources":["../../../../src/service/configuration/ConfigurationServiceProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yCA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YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC,CAsD3D;IAED;;;;;;OAMG;IACI,eAAe,CACpB,SAAS,EAAE,wBAAwB,EACnC,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAOxB;IAED;;;;;;OAMG;IACU,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQzD;IAEY,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CxD;IA4DM,eAAe,IAAI,MAAM,CAgC/B;CACF"}
@@ -4,7 +4,8 @@ import fs from "node:fs/promises";
4
4
  import { Stats } from "node:fs";
5
5
  import ConfigCommand from "./command/ConfigCommand.js";
6
6
  import getLogger from "../../util/logger.js";
7
- import DumpConfigCommand from "./command/DumpConfigCommand.js";
7
+ import ConfigDumpSubCommand from "./command/ConfigDumpSubCommand.js";
8
+ import ConfigGroupCommand from "./command/ConfigGroupCommand.js";
8
9
  import { CONFIGURATION_SERVICE_ID, SECRET_SENTINEL_PREFIX, } from "@flowscripter/dynamic-cli-framework-api";
9
10
  import DefaultSecretService from "./DefaultSecretService.js";
10
11
  import resolveSecrets from "./resolveSecrets.js";
@@ -32,7 +33,7 @@ class ConfigurationServiceImpl {
32
33
  * {@link KeyValueServiceProvider} (which holds a direct reference to this provider - see
33
34
  * {@link getKeyValueData} and {@link flushIfDirty} - rather than looking this provider up via
34
35
  * {@link Context}, since only {@link configLocation}/{@link setConfigLocation} are safe to expose
35
- * generally; {@link getConfigString} is wired directly to {@link DumpConfigCommand} for the same
36
+ * generally; {@link getConfigString} is wired directly to {@link ConfigDumpSubCommand} for the same
36
37
  * reason - a full config dump would leak every other command's/service's key-value data if it
37
38
  * were reachable through a general lookup).
38
39
  *
@@ -176,7 +177,7 @@ export default class ConfigurationServiceProvider {
176
177
  const commands = [];
177
178
  if (this.configEnabled) {
178
179
  commands.push(new ConfigCommand(this.servicePriority));
179
- commands.push(new DumpConfigCommand(() => this.getConfigString()));
180
+ commands.push(new ConfigGroupCommand([new ConfigDumpSubCommand(() => this.getConfigString())]));
180
181
  }
181
182
  if (this.secretServiceEnabled) {
182
183
  this.#defaultsSecretService = new DefaultSecretService(cliConfig.name, "defaults");
@@ -1,18 +1,23 @@
1
1
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
2
- import type { GlobalCommand } from "@flowscripter/dynamic-cli-framework-api";
2
+ import type { Option } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Positional } from "@flowscripter/dynamic-cli-framework-api";
4
+ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
3
5
  /**
4
- * Command which dumps the configuration loaded by {@link ConfigurationServiceProvider}.
6
+ * Member of the `config` group which dumps the configuration loaded by
7
+ * {@link ConfigurationServiceProvider}.
5
8
  *
6
9
  * Takes a direct reference to {@link ConfigurationServiceProvider.getConfigString}, wired by the
7
10
  * provider that constructs this command, rather than looking it up via {@link Context} -
8
11
  * deliberately, since a full config dump is not something every command/task should be able to
9
12
  * reach through a general lookup (see {@link ConfigurationService}'s doc comment).
10
13
  */
11
- export default class DumpConfigCommand implements GlobalCommand {
14
+ export default class ConfigDumpSubCommand implements SubCommand {
12
15
  #private;
13
- readonly name = "dump-config";
16
+ readonly name = "dump";
14
17
  readonly description = "Dump configuration values";
18
+ readonly options: ReadonlyArray<Option>;
19
+ readonly positionals: ReadonlyArray<Positional>;
15
20
  constructor(getConfigString: () => string);
16
21
  execute(context: Context): Promise<void>;
17
22
  }
18
- //# sourceMappingURL=DumpConfigCommand.d.ts.map
23
+ //# sourceMappingURL=ConfigDumpSubCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigDumpSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/configuration/command/ConfigDumpSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAM1E;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,UAAU;;IAC7D,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,WAAW,+BAA+B;IACnD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAM;IAC7C,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAAM;IAIrD,YAAmB,eAAe,EAAE,MAAM,MAAM,EAE/C;IAEY,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CASpD;CACF"}
@@ -1,16 +1,19 @@
1
1
  import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import { SYNTAX_HIGHLIGHTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
3
3
  /**
4
- * Command which dumps the configuration loaded by {@link ConfigurationServiceProvider}.
4
+ * Member of the `config` group which dumps the configuration loaded by
5
+ * {@link ConfigurationServiceProvider}.
5
6
  *
6
7
  * Takes a direct reference to {@link ConfigurationServiceProvider.getConfigString}, wired by the
7
8
  * provider that constructs this command, rather than looking it up via {@link Context} -
8
9
  * deliberately, since a full config dump is not something every command/task should be able to
9
10
  * reach through a general lookup (see {@link ConfigurationService}'s doc comment).
10
11
  */
11
- export default class DumpConfigCommand {
12
- name = "dump-config";
12
+ export default class ConfigDumpSubCommand {
13
+ name = "dump";
13
14
  description = "Dump configuration values";
15
+ options = [];
16
+ positionals = [];
14
17
  #getConfigString;
15
18
  constructor(getConfigString) {
16
19
  this.#getConfigString = getConfigString;
@@ -0,0 +1,16 @@
1
+ import type { Context } from "@flowscripter/dynamic-cli-framework-api";
2
+ import type { GroupCommand } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
4
+ /**
5
+ * Group command named `config` whose members manage the configuration handled by
6
+ * {@link ConfigurationServiceProvider}.
7
+ */
8
+ export default class ConfigGroupCommand implements GroupCommand {
9
+ readonly name = "config";
10
+ readonly description = "Manage configuration";
11
+ readonly enableConfiguration = false;
12
+ readonly memberSubCommands: ReadonlyArray<SubCommand>;
13
+ constructor(memberSubCommands: ReadonlyArray<SubCommand>);
14
+ execute(_context: Context): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=ConfigGroupCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigGroupCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/configuration/command/ConfigGroupCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,YAAY;IAC7D,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,WAAW,0BAA0B;IAC9C,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,iBAAiB,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAEtD,YAAmB,iBAAiB,EAAE,aAAa,CAAC,UAAU,CAAC,EAE9D;IAEY,OAAO,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAG;CAC1D"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Group command named `config` whose members manage the configuration handled by
3
+ * {@link ConfigurationServiceProvider}.
4
+ */
5
+ export default class ConfigGroupCommand {
6
+ name = "config";
7
+ description = "Manage configuration";
8
+ enableConfiguration = false;
9
+ memberSubCommands;
10
+ constructor(memberSubCommands) {
11
+ this.memberSubCommands = memberSubCommands;
12
+ }
13
+ async execute(_context) { }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/dynamic-cli-framework",
3
- "version": "10.1.1",
3
+ "version": "11.0.0",
4
4
  "description": "A framework for developing CLI applications which supports dynamic discovery and installation of new commands",
5
5
  "keywords": [
6
6
  "bun",
@@ -14,7 +14,8 @@ import type {
14
14
  import getLogger from "../../util/logger.ts";
15
15
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
16
16
  import type { GroupCommand } from "@flowscripter/dynamic-cli-framework-api";
17
- import DumpConfigCommand from "./command/DumpConfigCommand.ts";
17
+ import ConfigDumpSubCommand from "./command/ConfigDumpSubCommand.ts";
18
+ import ConfigGroupCommand from "./command/ConfigGroupCommand.ts";
18
19
  import {
19
20
  CONFIGURATION_SERVICE_ID,
20
21
  SECRET_SENTINEL_PREFIX,
@@ -63,7 +64,7 @@ class ConfigurationServiceImpl implements ConfigurationService {
63
64
  * {@link KeyValueServiceProvider} (which holds a direct reference to this provider - see
64
65
  * {@link getKeyValueData} and {@link flushIfDirty} - rather than looking this provider up via
65
66
  * {@link Context}, since only {@link configLocation}/{@link setConfigLocation} are safe to expose
66
- * generally; {@link getConfigString} is wired directly to {@link DumpConfigCommand} for the same
67
+ * generally; {@link getConfigString} is wired directly to {@link ConfigDumpSubCommand} for the same
67
68
  * reason - a full config dump would leak every other command's/service's key-value data if it
68
69
  * were reachable through a general lookup).
69
70
  *
@@ -222,7 +223,9 @@ export default class ConfigurationServiceProvider implements ServiceProvider {
222
223
 
223
224
  if (this.configEnabled) {
224
225
  commands.push(new ConfigCommand(this.servicePriority));
225
- commands.push(new DumpConfigCommand(() => this.getConfigString()));
226
+ commands.push(
227
+ new ConfigGroupCommand([new ConfigDumpSubCommand(() => this.getConfigString())]),
228
+ );
226
229
  }
227
230
  if (this.secretServiceEnabled) {
228
231
  this.#defaultsSecretService = new DefaultSecretService(cliConfig.name, "defaults");
@@ -1,21 +1,26 @@
1
1
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
2
- import type { GlobalCommand } from "@flowscripter/dynamic-cli-framework-api";
2
+ import type { Option } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Positional } from "@flowscripter/dynamic-cli-framework-api";
4
+ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
3
5
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
4
6
  import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
5
7
  import type { SyntaxHighlighterService } from "@flowscripter/dynamic-cli-framework-api";
6
8
  import { SYNTAX_HIGHLIGHTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
7
9
 
8
10
  /**
9
- * Command which dumps the configuration loaded by {@link ConfigurationServiceProvider}.
11
+ * Member of the `config` group which dumps the configuration loaded by
12
+ * {@link ConfigurationServiceProvider}.
10
13
  *
11
14
  * Takes a direct reference to {@link ConfigurationServiceProvider.getConfigString}, wired by the
12
15
  * provider that constructs this command, rather than looking it up via {@link Context} -
13
16
  * deliberately, since a full config dump is not something every command/task should be able to
14
17
  * reach through a general lookup (see {@link ConfigurationService}'s doc comment).
15
18
  */
16
- export default class DumpConfigCommand implements GlobalCommand {
17
- readonly name = "dump-config";
19
+ export default class ConfigDumpSubCommand implements SubCommand {
20
+ readonly name = "dump";
18
21
  readonly description = "Dump configuration values";
22
+ readonly options: ReadonlyArray<Option> = [];
23
+ readonly positionals: ReadonlyArray<Positional> = [];
19
24
 
20
25
  readonly #getConfigString: () => string;
21
26
 
@@ -0,0 +1,20 @@
1
+ import type { Context } from "@flowscripter/dynamic-cli-framework-api";
2
+ import type { GroupCommand } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
4
+
5
+ /**
6
+ * Group command named `config` whose members manage the configuration handled by
7
+ * {@link ConfigurationServiceProvider}.
8
+ */
9
+ export default class ConfigGroupCommand implements GroupCommand {
10
+ readonly name = "config";
11
+ readonly description = "Manage configuration";
12
+ readonly enableConfiguration = false;
13
+ readonly memberSubCommands: ReadonlyArray<SubCommand>;
14
+
15
+ public constructor(memberSubCommands: ReadonlyArray<SubCommand>) {
16
+ this.memberSubCommands = memberSubCommands;
17
+ }
18
+
19
+ public async execute(_context: Context): Promise<void> {}
20
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"DumpConfigCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/configuration/command/DumpConfigCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAM7E;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,aAAa;;IAC7D,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,+BAA+B;IAInD,YAAmB,eAAe,EAAE,MAAM,MAAM,EAE/C;IAEY,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CASpD;CACF"}