@flowscripter/dynamic-cli-framework 2.4.0 → 3.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.
Files changed (143) hide show
  1. package/dist/index.d.ts +6 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -1
  4. package/dist/src/cli/BaseCLI.d.ts +1 -0
  5. package/dist/src/cli/BaseCLI.d.ts.map +1 -1
  6. package/dist/src/cli/BaseCLI.js +6 -0
  7. package/dist/src/cli/BaseCLIFeatureOptions.d.ts +1 -0
  8. package/dist/src/cli/BaseCLIFeatureOptions.d.ts.map +1 -1
  9. package/dist/src/command/MultiCommandCliHelpCommand.d.ts +4 -4
  10. package/dist/src/command/MultiCommandCliHelpCommand.d.ts.map +1 -1
  11. package/dist/src/command/MultiCommandCliHelpCommand.js +3 -3
  12. package/dist/src/runtime/command/CommandValidator.d.ts.map +1 -1
  13. package/dist/src/runtime/command/CommandValidator.js +14 -16
  14. package/dist/src/runtime/parser.d.ts +5 -5
  15. package/dist/src/runtime/parser.d.ts.map +1 -1
  16. package/dist/src/runtime/parser.js +2 -2
  17. package/dist/src/runtime/runner.d.ts.map +1 -1
  18. package/dist/src/runtime/values/ValuePopulationResult.d.ts +3 -3
  19. package/dist/src/runtime/values/ValuePopulationResult.d.ts.map +1 -1
  20. package/dist/src/runtime/values/argumentValueMerge.d.ts +2 -2
  21. package/dist/src/runtime/values/argumentValueMerge.d.ts.map +1 -1
  22. package/dist/src/runtime/values/argumentValueValidation.d.ts +4 -4
  23. package/dist/src/runtime/values/argumentValueValidation.d.ts.map +1 -1
  24. package/dist/src/runtime/values/argumentValueValidation.js +6 -6
  25. package/dist/src/runtime/values/globalCommandValuePopulation.d.ts +4 -4
  26. package/dist/src/runtime/values/globalCommandValuePopulation.d.ts.map +1 -1
  27. package/dist/src/runtime/values/globalCommandValuePopulation.js +5 -5
  28. package/dist/src/runtime/values/subCommandValuePopulation.d.ts +5 -5
  29. package/dist/src/runtime/values/subCommandValuePopulation.d.ts.map +1 -1
  30. package/dist/src/runtime/values/subCommandValuePopulation.js +8 -7
  31. package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.d.ts.map +1 -1
  32. package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.js +6 -6
  33. package/dist/src/service/banner/command/NoBannerCommand.d.ts +2 -2
  34. package/dist/src/service/banner/command/NoBannerCommand.d.ts.map +1 -1
  35. package/dist/src/service/banner/command/NoBannerCommand.js +2 -2
  36. package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts +2 -2
  37. package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts.map +1 -1
  38. package/dist/src/service/completion/command/CompletionCompleteSubCommand.js +3 -3
  39. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts +2 -2
  40. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts.map +1 -1
  41. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.js +3 -3
  42. package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts +6 -6
  43. package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts.map +1 -1
  44. package/dist/src/service/configuration/ConfigurationServiceProvider.js +4 -4
  45. package/dist/src/service/configuration/command/ConfigCommand.d.ts +2 -2
  46. package/dist/src/service/configuration/command/ConfigCommand.d.ts.map +1 -1
  47. package/dist/src/service/configuration/command/ConfigCommand.js +2 -2
  48. package/dist/src/service/fetch/DefaultFetchService.d.ts +7 -0
  49. package/dist/src/service/fetch/DefaultFetchService.d.ts.map +1 -0
  50. package/dist/src/service/fetch/DefaultFetchService.js +44 -0
  51. package/dist/src/service/fetch/FetchServiceProvider.d.ts +10 -0
  52. package/dist/src/service/fetch/FetchServiceProvider.d.ts.map +1 -0
  53. package/dist/src/service/fetch/FetchServiceProvider.js +22 -0
  54. package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts +2 -1
  55. package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts.map +1 -1
  56. package/dist/src/service/plugin/DefaultPluginServiceProvider.js +23 -8
  57. package/dist/src/service/plugin/FetchInterfaceAdapter.d.ts +17 -0
  58. package/dist/src/service/plugin/FetchInterfaceAdapter.d.ts.map +1 -0
  59. package/dist/src/service/plugin/FetchInterfaceAdapter.js +16 -0
  60. package/dist/src/service/plugin/SpawnInterfaceAdapter.js +1 -1
  61. package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts +4 -4
  62. package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts.map +1 -1
  63. package/dist/src/service/plugin/command/PluginAddSubCommand.js +2 -2
  64. package/dist/src/service/plugin/command/PluginListSubCommand.d.ts +2 -2
  65. package/dist/src/service/plugin/command/PluginListSubCommand.d.ts.map +1 -1
  66. package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts +4 -4
  67. package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts.map +1 -1
  68. package/dist/src/service/plugin/command/PluginRemoveSubCommand.js +2 -2
  69. package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts +4 -4
  70. package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts.map +1 -1
  71. package/dist/src/service/plugin/command/PluginSearchSubCommand.js +2 -2
  72. package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts +2 -2
  73. package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts.map +1 -1
  74. package/dist/src/service/printer/command/DarkModeCommand.d.ts +2 -2
  75. package/dist/src/service/printer/command/DarkModeCommand.d.ts.map +1 -1
  76. package/dist/src/service/printer/command/DarkModeCommand.js +2 -2
  77. package/dist/src/service/printer/command/LogLevelCommand.d.ts +2 -2
  78. package/dist/src/service/printer/command/LogLevelCommand.d.ts.map +1 -1
  79. package/dist/src/service/printer/command/LogLevelCommand.js +2 -2
  80. package/dist/src/service/printer/command/NoColorCommand.d.ts +2 -2
  81. package/dist/src/service/printer/command/NoColorCommand.d.ts.map +1 -1
  82. package/dist/src/service/printer/command/NoColorCommand.js +2 -2
  83. package/dist/src/service/printer/command/NoHyperlinksCommand.d.ts +2 -2
  84. package/dist/src/service/printer/command/NoHyperlinksCommand.d.ts.map +1 -1
  85. package/dist/src/service/printer/command/NoHyperlinksCommand.js +2 -2
  86. package/dist/src/service/prompter/command/NoPromptCommand.d.ts +2 -2
  87. package/dist/src/service/prompter/command/NoPromptCommand.d.ts.map +1 -1
  88. package/dist/src/service/prompter/command/NoPromptCommand.js +2 -2
  89. package/dist/src/service/spawn/DefaultSpawnService.js +6 -6
  90. package/dist/src/service/upgrade/DefaultUpgradeService.d.ts +2 -2
  91. package/dist/src/service/upgrade/DefaultUpgradeService.d.ts.map +1 -1
  92. package/dist/src/service/upgrade/DefaultUpgradeService.js +33 -51
  93. package/dist/src/service/upgrade/UpgradeServiceProvider.d.ts.map +1 -1
  94. package/dist/src/service/upgrade/UpgradeServiceProvider.js +12 -9
  95. package/dist/src/service/upgrade/command/UpgradeSubCommand.d.ts +2 -2
  96. package/dist/src/service/upgrade/command/UpgradeSubCommand.d.ts.map +1 -1
  97. package/dist/src/service/upgrade/command/UpgradeSubCommand.js +3 -3
  98. package/dist/src/util/envVarHelper.d.ts +3 -3
  99. package/dist/src/util/envVarHelper.d.ts.map +1 -1
  100. package/dist/src/util/envVarHelper.js +9 -12
  101. package/dist/src/util/helpHelper.d.ts.map +1 -1
  102. package/dist/src/util/helpHelper.js +27 -28
  103. package/index.ts +12 -10
  104. package/package.json +3 -3
  105. package/src/cli/BaseCLI.ts +7 -0
  106. package/src/cli/BaseCLIFeatureOptions.ts +1 -0
  107. package/src/command/MultiCommandCliHelpCommand.ts +7 -7
  108. package/src/runtime/command/CommandValidator.ts +17 -26
  109. package/src/runtime/parser.ts +8 -8
  110. package/src/runtime/runner.ts +16 -19
  111. package/src/runtime/values/ValuePopulationResult.ts +4 -4
  112. package/src/runtime/values/argumentValueMerge.ts +33 -50
  113. package/src/runtime/values/argumentValueValidation.ts +38 -52
  114. package/src/runtime/values/globalCommandValuePopulation.ts +7 -7
  115. package/src/runtime/values/subCommandValuePopulation.ts +42 -47
  116. package/src/service/argumentPrompter/DefaultArgumentPrompterService.ts +23 -26
  117. package/src/service/banner/command/NoBannerCommand.ts +3 -6
  118. package/src/service/completion/command/CompletionCompleteSubCommand.ts +4 -7
  119. package/src/service/completion/command/CompletionIntegrationSubCommand.ts +4 -7
  120. package/src/service/configuration/ConfigurationServiceProvider.ts +21 -21
  121. package/src/service/configuration/command/ConfigCommand.ts +3 -6
  122. package/src/service/fetch/DefaultFetchService.ts +55 -0
  123. package/src/service/fetch/FetchServiceProvider.ts +33 -0
  124. package/src/service/plugin/DefaultPluginServiceProvider.ts +29 -12
  125. package/src/service/plugin/FetchInterfaceAdapter.ts +28 -0
  126. package/src/service/plugin/SpawnInterfaceAdapter.ts +1 -1
  127. package/src/service/plugin/command/PluginAddSubCommand.ts +4 -4
  128. package/src/service/plugin/command/PluginListSubCommand.ts +2 -2
  129. package/src/service/plugin/command/PluginRemoveSubCommand.ts +4 -4
  130. package/src/service/plugin/command/PluginSearchSubCommand.ts +4 -4
  131. package/src/service/plugin/command/PluginUpgradeSubCommand.ts +2 -2
  132. package/src/service/printer/command/DarkModeCommand.ts +3 -6
  133. package/src/service/printer/command/LogLevelCommand.ts +3 -6
  134. package/src/service/printer/command/NoColorCommand.ts +3 -6
  135. package/src/service/printer/command/NoHyperlinksCommand.ts +3 -6
  136. package/src/service/prompter/command/NoPromptCommand.ts +3 -6
  137. package/src/service/prompter/prompt/promptText.ts +2 -2
  138. package/src/service/spawn/DefaultSpawnService.ts +6 -6
  139. package/src/service/upgrade/DefaultUpgradeService.ts +66 -65
  140. package/src/service/upgrade/UpgradeServiceProvider.ts +13 -9
  141. package/src/service/upgrade/command/UpgradeSubCommand.ts +4 -7
  142. package/src/util/envVarHelper.ts +23 -26
  143. package/src/util/helpHelper.ts +28 -36
@@ -0,0 +1,33 @@
1
+ import type {
2
+ CLIConfig,
3
+ Context,
4
+ ServiceInfo,
5
+ ServiceProvider,
6
+ ShutdownService,
7
+ } from "@flowscripter/dynamic-cli-framework-api";
8
+ import { FETCH_SERVICE_ID, SHUTDOWN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
9
+ import DefaultFetchService from "./DefaultFetchService.ts";
10
+
11
+ export default class FetchServiceProvider implements ServiceProvider {
12
+ readonly serviceId: string = FETCH_SERVICE_ID;
13
+ readonly servicePriority: number;
14
+ #fetchService: DefaultFetchService | undefined;
15
+
16
+ public constructor(servicePriority: number) {
17
+ this.servicePriority = servicePriority;
18
+ }
19
+
20
+ public getServiceInfo(_cliConfig: CLIConfig): Promise<ServiceInfo> {
21
+ this.#fetchService = new DefaultFetchService();
22
+ return Promise.resolve({
23
+ service: this.#fetchService,
24
+ commands: [],
25
+ });
26
+ }
27
+
28
+ public initService(context: Context): Promise<void> {
29
+ const shutdownService = context.getServiceById(SHUTDOWN_SERVICE_ID) as ShutdownService;
30
+ this.#fetchService!.setDependencies(shutdownService);
31
+ return Promise.resolve();
32
+ }
33
+ }
@@ -3,7 +3,10 @@ import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
3
  import type { CLIConfig } from "@flowscripter/dynamic-cli-framework-api";
4
4
  import type { PrinterService, SpawnService } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import { PRINTER_SERVICE_ID, SPAWN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
6
+ import type { FetchService } from "@flowscripter/dynamic-cli-framework-api";
7
+ import { FETCH_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
6
8
  import type {
9
+ FetchCapable,
7
10
  MarketplacePluginManager,
8
11
  SpawnCapable,
9
12
  } from "@flowscripter/dynamic-plugin-framework";
@@ -13,6 +16,9 @@ import { PluginGroupCommand } from "./command/PluginGroupCommand.ts";
13
16
  import SpawnInterfaceAdapter, {
14
17
  type SpawnInterfaceAdapterOptions,
15
18
  } from "./SpawnInterfaceAdapter.ts";
19
+ import FetchInterfaceAdapter, {
20
+ type FetchInterfaceAdapterOptions,
21
+ } from "./FetchInterfaceAdapter.ts";
16
22
  import getLogger from "../../util/logger.ts";
17
23
 
18
24
  const logger = getLogger("DefaultPluginServiceProvider");
@@ -22,16 +28,19 @@ export default class DefaultPluginServiceProvider implements ServiceProvider {
22
28
  readonly servicePriority: number;
23
29
  readonly #pluginManager: MarketplacePluginManager;
24
30
  readonly #spawnInterfaceAdapterOptions: SpawnInterfaceAdapterOptions;
31
+ readonly #fetchInterfaceAdapterOptions: FetchInterfaceAdapterOptions;
25
32
  #pluginService: DefaultPluginService | undefined;
26
33
 
27
34
  constructor(
28
35
  pluginManager: MarketplacePluginManager,
29
36
  servicePriority = 50,
30
37
  spawnInterfaceAdapterOptions: SpawnInterfaceAdapterOptions = {},
38
+ fetchInterfaceAdapterOptions: FetchInterfaceAdapterOptions = {},
31
39
  ) {
32
40
  this.#pluginManager = pluginManager;
33
41
  this.servicePriority = servicePriority;
34
42
  this.#spawnInterfaceAdapterOptions = spawnInterfaceAdapterOptions;
43
+ this.#fetchInterfaceAdapterOptions = fetchInterfaceAdapterOptions;
35
44
  }
36
45
 
37
46
  async getServiceInfo(_cliConfig: CLIConfig): Promise<ServiceInfo> {
@@ -45,21 +54,29 @@ export default class DefaultPluginServiceProvider implements ServiceProvider {
45
54
  initService(context: Context): Promise<void> {
46
55
  if (!context.doesServiceExist(SPAWN_SERVICE_ID)) {
47
56
  logger.debug("SpawnService not available, plugin manager will spawn processes directly");
48
- return Promise.resolve();
49
- }
50
- if (!("setSpawn" in this.#pluginManager)) {
57
+ } else if (!("setSpawn" in this.#pluginManager)) {
51
58
  logger.debug("Plugin manager does not support SpawnCapable, skipping spawn injection");
52
- return Promise.resolve();
59
+ } else {
60
+ const spawnService = context.getServiceById(SPAWN_SERVICE_ID) as SpawnService;
61
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
62
+ const adapter = new SpawnInterfaceAdapter(
63
+ spawnService,
64
+ printerService,
65
+ this.#spawnInterfaceAdapterOptions,
66
+ );
67
+ (this.#pluginManager as unknown as SpawnCapable).setSpawn(adapter);
68
+ }
69
+
70
+ if (!context.doesServiceExist(FETCH_SERVICE_ID)) {
71
+ logger.debug("FetchService not available, plugin manager will fetch directly");
72
+ } else if (!("setFetch" in this.#pluginManager)) {
73
+ logger.debug("Plugin manager does not support FetchCapable, skipping fetch injection");
74
+ } else {
75
+ const fetchService = context.getServiceById(FETCH_SERVICE_ID) as FetchService;
76
+ const adapter = new FetchInterfaceAdapter(fetchService, this.#fetchInterfaceAdapterOptions);
77
+ (this.#pluginManager as unknown as FetchCapable).setFetch(adapter);
53
78
  }
54
79
 
55
- const spawnService = context.getServiceById(SPAWN_SERVICE_ID) as SpawnService;
56
- const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
57
- const adapter = new SpawnInterfaceAdapter(
58
- spawnService,
59
- printerService,
60
- this.#spawnInterfaceAdapterOptions,
61
- );
62
- (this.#pluginManager as unknown as SpawnCapable).setSpawn(adapter);
63
80
  return Promise.resolve();
64
81
  }
65
82
  }
@@ -0,0 +1,28 @@
1
+ import type { FetchService } from "@flowscripter/dynamic-cli-framework-api";
2
+ import type { FetchInterface } from "@flowscripter/dynamic-plugin-framework";
3
+
4
+ export interface FetchInterfaceAdapterOptions {
5
+ timeoutMs?: number;
6
+ }
7
+
8
+ /**
9
+ * Adapts a {@link FetchService} to dynamic-plugin-framework's {@link FetchInterface}, so plugin
10
+ * manager/repository fetches respect the host CLI's shutdown handling and default timeout.
11
+ */
12
+ export default class FetchInterfaceAdapter implements FetchInterface {
13
+ readonly #fetchService: FetchService;
14
+ readonly #timeoutMs: number | undefined;
15
+
16
+ public constructor(fetchService: FetchService, options: FetchInterfaceAdapterOptions = {}) {
17
+ this.#fetchService = fetchService;
18
+ this.#timeoutMs = options.timeoutMs;
19
+ }
20
+
21
+ public async fetch(
22
+ input: string,
23
+ init?: RequestInit & { timeoutMs?: number },
24
+ ): Promise<Response> {
25
+ const { timeoutMs = this.#timeoutMs, ...requestInit } = init ?? {};
26
+ return this.#fetchService.fetch(input, { ...requestInit, timeoutMs });
27
+ }
28
+ }
@@ -45,7 +45,7 @@ export default class SpawnInterfaceAdapter implements SpawnInterface {
45
45
 
46
46
  const result = await this.#spawnService.spawn(command, {
47
47
  cwd: options.cwd,
48
- stdio: "wrapped",
48
+ mode: "wrapped",
49
49
  onOutput,
50
50
  });
51
51
 
@@ -1,7 +1,7 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
4
- import { ArgumentValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
+ import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { Icon, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
7
7
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -18,11 +18,11 @@ export class PluginAddSubCommand implements SubCommand {
18
18
  {
19
19
  name: "pluginId",
20
20
  description: "Plugin ID to install (e.g. @scope/name)",
21
- type: ArgumentValueTypeName.STRING,
21
+ type: ValueTypeName.STRING,
22
22
  },
23
23
  ];
24
24
 
25
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
25
+ async execute(context: Context, argumentValues: Values): Promise<void> {
26
26
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
27
27
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
28
28
 
@@ -1,6 +1,6 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
4
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -14,7 +14,7 @@ export class PluginListSubCommand implements SubCommand {
14
14
  readonly options = [];
15
15
  readonly positionals = [];
16
16
 
17
- async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
17
+ async execute(context: Context, _argumentValues: Values): Promise<void> {
18
18
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
19
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
20
20
 
@@ -1,7 +1,7 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
4
- import { ArgumentValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
+ import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { Icon, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
7
7
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -16,11 +16,11 @@ export class PluginRemoveSubCommand implements SubCommand {
16
16
  {
17
17
  name: "pluginId",
18
18
  description: "Plugin ID to remove (e.g. @scope/name)",
19
- type: ArgumentValueTypeName.STRING,
19
+ type: ValueTypeName.STRING,
20
20
  },
21
21
  ];
22
22
 
23
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
23
+ async execute(context: Context, argumentValues: Values): Promise<void> {
24
24
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
25
25
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
26
26
 
@@ -1,7 +1,7 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
4
- import { ArgumentValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
+ import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
7
7
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -17,12 +17,12 @@ export class PluginSearchSubCommand implements SubCommand {
17
17
  {
18
18
  name: "query",
19
19
  description: "Search query",
20
- type: ArgumentValueTypeName.STRING,
20
+ type: ValueTypeName.STRING,
21
21
  isVarargOptional: true,
22
22
  },
23
23
  ];
24
24
 
25
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
25
+ async execute(context: Context, argumentValues: Values): Promise<void> {
26
26
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
27
27
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
28
28
 
@@ -1,6 +1,6 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
4
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import { Icon, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -14,7 +14,7 @@ export class PluginUpgradeSubCommand implements SubCommand {
14
14
  readonly options = [];
15
15
  readonly positionals = [];
16
16
 
17
- async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
17
+ async execute(context: Context, _argumentValues: Values): Promise<void> {
18
18
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
19
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
20
20
 
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
9
6
 
@@ -15,7 +12,7 @@ export default class DarkModeCommand implements GlobalModifierCommand {
15
12
  readonly description = "Enable dark mode for output";
16
13
  readonly enableConfiguration = true;
17
14
  readonly argument: GlobalCommandArgument = {
18
- type: ArgumentValueTypeName.BOOLEAN,
15
+ type: ValueTypeName.BOOLEAN,
19
16
  defaultValue: false,
20
17
  configurationKey: "DARK_MODE",
21
18
  };
@@ -28,7 +25,7 @@ export default class DarkModeCommand implements GlobalModifierCommand {
28
25
  this.executePriority = executePriority;
29
26
  }
30
27
 
31
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
28
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
32
29
  this.#printerServiceProvider.printerService!.darkMode = argumentValue as boolean;
33
30
 
34
31
  return Promise.resolve();
@@ -1,8 +1,5 @@
1
1
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
2
- import {
3
- type ArgumentSingleValueType,
4
- ArgumentValueTypeName,
5
- } from "@flowscripter/dynamic-cli-framework-api";
2
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
6
3
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
@@ -16,7 +13,7 @@ export default class LogLevelCommand implements GlobalModifierCommand {
16
13
  readonly description = "Set the logging threshold";
17
14
  readonly enableConfiguration = true;
18
15
  readonly argument: GlobalCommandArgument = {
19
- type: ArgumentValueTypeName.STRING,
16
+ type: ValueTypeName.STRING,
20
17
  allowableValues: ["DEBUG", "INFO", "WARN", "ERROR"],
21
18
  isCaseInsensitive: true,
22
19
  defaultValue: "INFO",
@@ -31,7 +28,7 @@ export default class LogLevelCommand implements GlobalModifierCommand {
31
28
  this.executePriority = executePriority;
32
29
  }
33
30
 
34
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
31
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
35
32
  const logLevel = argumentValue as string;
36
33
 
37
34
  switch (logLevel.toUpperCase()) {
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
9
6
 
@@ -15,7 +12,7 @@ export default class NoColorCommand implements GlobalModifierCommand {
15
12
  readonly description = "Disable color for output";
16
13
  readonly enableConfiguration = true;
17
14
  readonly argument: GlobalCommandArgument = {
18
- type: ArgumentValueTypeName.BOOLEAN,
15
+ type: ValueTypeName.BOOLEAN,
19
16
  defaultValue: false,
20
17
  configurationKey: "NO_COLOR",
21
18
  };
@@ -28,7 +25,7 @@ export default class NoColorCommand implements GlobalModifierCommand {
28
25
  this.executePriority = executePriority;
29
26
  }
30
27
 
31
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
28
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
32
29
  this.#printerServiceProvider.printerService!.colorEnabled = !argumentValue as boolean;
33
30
 
34
31
  return Promise.resolve();
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
9
6
 
@@ -12,7 +9,7 @@ export default class NoHyperlinksCommand implements GlobalModifierCommand {
12
9
  readonly description = "Disable hyperlinks for output";
13
10
  readonly enableConfiguration = true;
14
11
  readonly argument: GlobalCommandArgument = {
15
- type: ArgumentValueTypeName.BOOLEAN,
12
+ type: ValueTypeName.BOOLEAN,
16
13
  defaultValue: false,
17
14
  configurationKey: "NO_HYPERLINKS",
18
15
  };
@@ -25,7 +22,7 @@ export default class NoHyperlinksCommand implements GlobalModifierCommand {
25
22
  this.executePriority = executePriority;
26
23
  }
27
24
 
28
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
25
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
29
26
  this.#printerServiceProvider.printerService!.hyperlinksEnabled = !argumentValue as boolean;
30
27
 
31
28
  return Promise.resolve();
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrompterServiceProvider from "../PrompterServiceProvider.ts";
9
6
 
@@ -12,7 +9,7 @@ export default class NoPromptCommand implements GlobalModifierCommand {
12
9
  readonly description = "Disable interactive prompting";
13
10
  readonly enableConfiguration = true;
14
11
  readonly argument: GlobalCommandArgument = {
15
- type: ArgumentValueTypeName.BOOLEAN,
12
+ type: ValueTypeName.BOOLEAN,
16
13
  defaultValue: false,
17
14
  configurationKey: "NO_PROMPT",
18
15
  };
@@ -25,7 +22,7 @@ export default class NoPromptCommand implements GlobalModifierCommand {
25
22
  this.executePriority = executePriority;
26
23
  }
27
24
 
28
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
25
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
29
26
  this.#prompterServiceProvider.prompterService.promptEnabled = !(argumentValue as boolean);
30
27
 
31
28
  return Promise.resolve();
@@ -1,5 +1,5 @@
1
1
  import type { Prompt, PromptResult } from "@flowscripter/dynamic-cli-framework-api";
2
- import type { ArgumentSingleValueType } from "@flowscripter/dynamic-cli-framework-api";
2
+ import type { SingleValueType } from "@flowscripter/dynamic-cli-framework-api";
3
3
  import { SpecialKey } from "../../../terminal/KeyReader.ts";
4
4
  import ShutdownServiceProvider from "../../shutdown/ShutdownServiceProvider.ts";
5
5
  import { renderPromptHeader } from "./PromptContext.ts";
@@ -52,7 +52,7 @@ export default async function promptText(
52
52
  continue;
53
53
  }
54
54
 
55
- const value: ArgumentSingleValueType = buffer;
55
+ const value: SingleValueType = buffer;
56
56
 
57
57
  const validationOption = promptDef.options.length > 0 ? promptDef.options[0] : undefined;
58
58
  if (validationOption?.validate) {
@@ -95,10 +95,10 @@ export default class DefaultSpawnService implements SpawnService {
95
95
  }
96
96
  const printerService = this.#printerService;
97
97
  const shutdownService = this.#shutdownService;
98
- const stdio = options.stdio ?? "inherit";
98
+ const mode = options.mode ?? "inherit";
99
99
  const longRunning = options.longRunning ?? true;
100
100
 
101
- if (stdio === "inherit") {
101
+ if (mode === "inherit") {
102
102
  await printerService.hideSpinner();
103
103
  await printerService.hideAllProgressBars();
104
104
  }
@@ -107,9 +107,9 @@ export default class DefaultSpawnService implements SpawnService {
107
107
  try {
108
108
  proc = Bun.spawn(resolveForPlatform(command), {
109
109
  cwd: options.cwd,
110
- stdin: stdio === "wrapped" ? "ignore" : "inherit",
111
- stdout: stdio === "wrapped" ? "pipe" : "inherit",
112
- stderr: stdio === "wrapped" ? "pipe" : "inherit",
110
+ stdin: mode === "inherit" ? "inherit" : "ignore",
111
+ stdout: mode === "wrapped" ? "pipe" : mode === "ignore" ? "ignore" : "inherit",
112
+ stderr: mode === "wrapped" ? "pipe" : mode === "ignore" ? "ignore" : "inherit",
113
113
  });
114
114
  } catch (error) {
115
115
  logger.debug(() => `Failed to launch command '${command.join(" ")}': ${error}`);
@@ -129,7 +129,7 @@ export default class DefaultSpawnService implements SpawnService {
129
129
  await this.#terminate(proc, command);
130
130
  });
131
131
 
132
- if (stdio === "wrapped" && options.onOutput) {
132
+ if (mode === "wrapped" && options.onOutput) {
133
133
  const onOutput = options.onOutput;
134
134
  void this.#pipeLines(proc.stdout, "stdout", onOutput);
135
135
  void this.#pipeLines(proc.stderr, "stderr", onOutput);