@flowscripter/dynamic-cli-framework 1.7.3 → 1.7.5

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 (369) hide show
  1. package/cli-plugin.ts +1 -1
  2. package/dist/cli-plugin.d.ts +1 -1
  3. package/dist/cli-plugin.d.ts.map +1 -1
  4. package/dist/cli-plugin.js +25 -247
  5. package/dist/index.js +70 -105754
  6. package/dist/src/api/BaseCLIFeatureOptions.js +0 -0
  7. package/dist/src/api/CLI.js +0 -0
  8. package/dist/src/api/CLIConfig.js +0 -0
  9. package/dist/src/api/Context.js +0 -0
  10. package/dist/src/api/RunResult.js +73 -0
  11. package/dist/src/api/argument/Argument.js +0 -0
  12. package/dist/src/api/argument/ArgumentValueTypes.js +18 -0
  13. package/dist/src/api/argument/ComplexOption.js +1 -0
  14. package/dist/src/api/argument/GlobalCommandArgument.js +0 -0
  15. package/dist/src/api/argument/Option.js +0 -0
  16. package/dist/src/api/argument/Positional.js +0 -0
  17. package/dist/src/api/argument/SubCommandArgument.js +1 -0
  18. package/dist/src/api/command/Command.js +0 -0
  19. package/dist/src/api/command/GlobalCommand.js +0 -0
  20. package/dist/src/api/command/GlobalModifierCommand.js +0 -0
  21. package/dist/src/api/command/GroupCommand.js +0 -0
  22. package/dist/src/api/command/SubCommand.js +0 -0
  23. package/dist/src/api/command/UsageExample.js +0 -0
  24. package/dist/src/api/plugin/CLIPlugin.js +2 -0
  25. package/dist/src/api/plugin/CommandFactory.js +7 -0
  26. package/dist/src/api/plugin/ServiceProviderFactory.js +7 -0
  27. package/dist/src/api/plugin/createCLIPlugin.js +30 -0
  28. package/dist/src/api/service/ServiceProvider.js +0 -0
  29. package/dist/src/api/service/core/ArgumentPrompterService.js +1 -0
  30. package/dist/src/api/service/core/AsciiBannerGeneratorService.js +1 -0
  31. package/dist/src/api/service/core/CompletionService.js +8 -0
  32. package/dist/src/api/service/core/DataDumpGeneratorService.js +7 -0
  33. package/dist/src/api/service/core/ImagePrinterService.js +1 -0
  34. package/dist/src/api/service/core/KeyValueService.js +7 -0
  35. package/dist/src/api/service/core/PluginService.js +6 -0
  36. package/dist/src/api/service/core/PrettyPrinterService.js +1 -0
  37. package/dist/src/api/service/core/PrinterService.js +42 -0
  38. package/dist/src/api/service/core/PrompterService.js +10 -0
  39. package/dist/src/api/service/core/SecretService.js +0 -0
  40. package/dist/src/api/service/core/ShutdownService.js +1 -0
  41. package/dist/src/api/service/core/SyntaxHighlighterService.js +1 -0
  42. package/dist/src/api/service/core/Table.js +49 -0
  43. package/dist/src/api/service/core/TableGeneratorService.d.ts +1 -0
  44. package/dist/src/api/service/core/TableGeneratorService.d.ts.map +1 -1
  45. package/dist/src/api/service/core/TableGeneratorService.js +7 -0
  46. package/dist/src/api/service/core/TreePrinterService.js +1 -0
  47. package/dist/src/cli/BaseCLI.d.ts.map +1 -1
  48. package/dist/src/cli/BaseCLI.js +232 -0
  49. package/dist/src/cli/DefaultRuntimeCLI.js +20 -0
  50. package/dist/src/cli/DynamicPluginRuntimeCLI.js +50 -0
  51. package/dist/src/command/MultiCommandCliHelpCommand.js +238 -0
  52. package/dist/src/command/SingleCommandCliHelpCommand.js +104 -0
  53. package/dist/src/command/UsageCommand.js +16 -0
  54. package/dist/src/command/VersionCommand.js +13 -0
  55. package/dist/src/launcher.js +61 -0
  56. package/dist/src/runtime/DefaultContext.js +25 -0
  57. package/dist/src/runtime/argument/ArgumentTypeGuards.js +3 -0
  58. package/dist/src/runtime/command/CommandTypeGuards.js +12 -0
  59. package/dist/src/runtime/command/CommandValidator.js +371 -0
  60. package/dist/src/runtime/parser.js +105 -0
  61. package/dist/src/runtime/registry/CommandRegistry.js +0 -0
  62. package/dist/src/runtime/registry/DefaultCommandRegistry.js +190 -0
  63. package/dist/src/runtime/registry/DefaultServiceProviderRegistry.js +20 -0
  64. package/dist/src/runtime/registry/ServiceProviderRegistry.js +0 -0
  65. package/dist/src/runtime/runner.js +507 -0
  66. package/dist/src/runtime/scanner.js +244 -0
  67. package/dist/src/runtime/values/ValuePopulationResult.js +0 -0
  68. package/dist/src/runtime/values/argumentValueMerge.js +122 -0
  69. package/dist/src/runtime/values/argumentValueValidation.js +505 -0
  70. package/dist/src/runtime/values/globalCommandValuePopulation.js +67 -0
  71. package/dist/src/runtime/values/subCommandValuePopulation.js +549 -0
  72. package/dist/src/service/argumentPrompter/ArgumentPrompterServiceProvider.js +19 -0
  73. package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.js +197 -0
  74. package/dist/src/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.js +28 -0
  75. package/dist/src/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.js +233 -0
  76. package/dist/src/service/asciiBannerGenerator/standard.flf.json +3 -0
  77. package/dist/src/service/banner/BannerServiceProvider.js +60 -0
  78. package/dist/src/service/banner/command/NoBannerCommand.js +24 -0
  79. package/dist/src/service/chiselAsciiBannerGenerator/ChiselFontAsciiBannerGeneratorService.js +51 -0
  80. package/dist/src/service/chiselAsciiBannerGenerator/chisel.flf.json +3 -0
  81. package/dist/src/service/completion/CompletionServiceProvider.d.ts +2 -1
  82. package/dist/src/service/completion/CompletionServiceProvider.d.ts.map +1 -1
  83. package/dist/src/service/completion/CompletionServiceProvider.js +159 -0
  84. package/dist/src/service/completion/DefaultCompletionService.js +279 -0
  85. package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts +15 -0
  86. package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts.map +1 -0
  87. package/dist/src/service/completion/command/CompletionCompleteSubCommand.js +37 -0
  88. package/dist/src/service/completion/command/CompletionGroupCommand.d.ts +14 -0
  89. package/dist/src/service/completion/command/CompletionGroupCommand.d.ts.map +1 -0
  90. package/dist/src/service/completion/command/CompletionGroupCommand.js +10 -0
  91. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts +14 -0
  92. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts.map +1 -0
  93. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.js +67 -0
  94. package/dist/src/service/completion/shell/ShellHandler.js +0 -0
  95. package/dist/src/service/completion/shell/bash.js +39 -0
  96. package/dist/src/service/completion/shell/fish.js +35 -0
  97. package/dist/src/service/completion/shell/powershell.js +51 -0
  98. package/dist/src/service/completion/shell/zsh.js +42 -0
  99. package/dist/src/service/configuration/ConfigurationServiceProvider.js +482 -0
  100. package/dist/src/service/configuration/DefaultKeyValueService.js +80 -0
  101. package/dist/src/service/configuration/DefaultSecretService.js +60 -0
  102. package/dist/src/service/configuration/command/ConfigCommand.js +24 -0
  103. package/dist/src/service/configuration/command/DumpConfigCommand.js +18 -0
  104. package/dist/src/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.js +24 -0
  105. package/dist/src/service/dataDumpGenerator/DefaultDataDumpGeneratorService.js +59 -0
  106. package/dist/src/service/imagePrinter/DefaultImagePrinterService.js +10 -0
  107. package/dist/src/service/imagePrinter/ImagePrinterServiceProvider.js +20 -0
  108. package/dist/src/service/plugin/DefaultPluginService.js +21 -0
  109. package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts +1 -1
  110. package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts.map +1 -1
  111. package/dist/src/service/plugin/DefaultPluginServiceProvider.js +21 -0
  112. package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts +17 -0
  113. package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts.map +1 -0
  114. package/dist/src/service/plugin/command/PluginAddSubCommand.js +49 -0
  115. package/dist/src/service/plugin/command/PluginGroupCommand.d.ts +12 -0
  116. package/dist/src/service/plugin/command/PluginGroupCommand.d.ts.map +1 -0
  117. package/dist/src/service/plugin/command/PluginGroupCommand.js +21 -0
  118. package/dist/src/service/plugin/command/PluginListSubCommand.d.ts +12 -0
  119. package/dist/src/service/plugin/command/PluginListSubCommand.d.ts.map +1 -0
  120. package/dist/src/service/plugin/command/PluginListSubCommand.js +25 -0
  121. package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts +17 -0
  122. package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts.map +1 -0
  123. package/dist/src/service/plugin/command/PluginRemoveSubCommand.js +24 -0
  124. package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts +18 -0
  125. package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts.map +1 -0
  126. package/dist/src/service/plugin/command/PluginSearchSubCommand.js +34 -0
  127. package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts +12 -0
  128. package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts.map +1 -0
  129. package/dist/src/service/plugin/command/PluginUpgradeSubCommand.js +25 -0
  130. package/dist/src/service/plugin/command/getPluginId.d.ts +3 -0
  131. package/dist/src/service/plugin/command/getPluginId.d.ts.map +1 -0
  132. package/dist/src/service/plugin/command/getPluginId.js +3 -0
  133. package/dist/src/service/prettyPrinter/DefaultPrettyPrinterService.js +45 -0
  134. package/dist/src/service/prettyPrinter/PrettyPrinterServiceProvider.js +28 -0
  135. package/dist/src/service/printer/DefaultPrinterService.js +250 -0
  136. package/dist/src/service/printer/PrinterServiceProvider.js +43 -0
  137. package/dist/src/service/printer/command/DarkModeCommand.js +24 -0
  138. package/dist/src/service/printer/command/LogLevelCommand.js +41 -0
  139. package/dist/src/service/printer/command/NoColorCommand.js +24 -0
  140. package/dist/src/service/printer/command/NoHyperlinksCommand.js +21 -0
  141. package/dist/src/service/printer/terminal/Color.js +15 -0
  142. package/dist/src/service/printer/terminal/Progress.js +271 -0
  143. package/dist/src/service/printer/terminal/Spinner.js +83 -0
  144. package/dist/src/service/printer/terminal/Theme.js +26 -0
  145. package/dist/src/service/prompter/DefaultPrompterService.js +52 -0
  146. package/dist/src/service/prompter/PrompterServiceProvider.js +20 -0
  147. package/dist/src/service/prompter/command/NoPromptCommand.js +21 -0
  148. package/dist/src/service/prompter/prompt/PromptContext.js +22 -0
  149. package/dist/src/service/prompter/prompt/promptAcknowledge.js +19 -0
  150. package/dist/src/service/prompter/prompt/promptMultiSelect.js +74 -0
  151. package/dist/src/service/prompter/prompt/promptOpenUrl.js +70 -0
  152. package/dist/src/service/prompter/prompt/promptSingleSelect.js +73 -0
  153. package/dist/src/service/prompter/prompt/promptText.js +75 -0
  154. package/dist/src/service/prompter/prompt/promptToggle.js +21 -0
  155. package/dist/src/service/shutdown/DefaultShutdownService.js +16 -0
  156. package/dist/src/service/shutdown/ShutdownServiceProvider.js +60 -0
  157. package/dist/src/service/shutdown/ShutdownState.js +5 -0
  158. package/dist/src/service/syntaxHighlighter/DefaultSyntaxHighlighterService.js +54 -0
  159. package/dist/src/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.js +32 -0
  160. package/dist/src/service/tableGenerator/DefaultTableGeneratorService.d.ts +3 -1
  161. package/dist/src/service/tableGenerator/DefaultTableGeneratorService.d.ts.map +1 -1
  162. package/dist/src/service/tableGenerator/DefaultTableGeneratorService.js +344 -0
  163. package/dist/src/service/tableGenerator/TableGeneratorServiceProvider.js +26 -0
  164. package/dist/src/service/treePrinter/DefaultTreePrinterService.js +35 -0
  165. package/dist/src/service/treePrinter/TreePrinterServiceProvider.js +24 -0
  166. package/dist/src/terminal/Ansi.js +23 -0
  167. package/dist/src/terminal/ImageRenderer.d.ts.map +1 -1
  168. package/dist/src/terminal/ImageRenderer.js +166 -0
  169. package/dist/src/terminal/KeyReader.js +13 -0
  170. package/dist/src/terminal/PngDecoder.js +115 -0
  171. package/dist/src/terminal/Styler.js +0 -0
  172. package/dist/src/terminal/Terminal.js +0 -0
  173. package/dist/src/terminal/TtyKeyReader.js +87 -0
  174. package/dist/src/terminal/TtyStyler.js +55 -0
  175. package/dist/src/terminal/TtyTerminal.js +52 -0
  176. package/dist/src/terminal/supportsHyperlinks.js +95 -0
  177. package/dist/src/util/configHelper.js +61 -0
  178. package/dist/src/util/envVarHelper.js +216 -0
  179. package/dist/src/util/helpHelper.d.ts.map +1 -1
  180. package/dist/src/util/helpHelper.js +497 -0
  181. package/dist/src/util/logger.js +81 -0
  182. package/dist/src/util/runnerHelper.js +80 -0
  183. package/package.json +2 -2
  184. package/src/api/service/core/TableGeneratorService.ts +1 -0
  185. package/src/cli/BaseCLI.ts +4 -19
  186. package/src/service/completion/CompletionServiceProvider.ts +16 -3
  187. package/src/service/completion/command/CompletionCompleteSubCommand.ts +59 -0
  188. package/src/service/completion/command/CompletionGroupCommand.ts +21 -0
  189. package/src/{command/CompletionCommand.ts → service/completion/command/CompletionIntegrationSubCommand.ts} +12 -73
  190. package/src/service/completion/shell/bash.ts +1 -1
  191. package/src/service/completion/shell/fish.ts +1 -1
  192. package/src/service/completion/shell/powershell.ts +1 -1
  193. package/src/service/completion/shell/zsh.ts +1 -1
  194. package/src/service/plugin/DefaultPluginServiceProvider.ts +2 -2
  195. package/src/service/plugin/command/PluginAddSubCommand.ts +64 -0
  196. package/src/service/plugin/command/PluginGroupCommand.ts +27 -0
  197. package/src/service/plugin/command/PluginListSubCommand.ts +33 -0
  198. package/src/service/plugin/command/PluginRemoveSubCommand.ts +32 -0
  199. package/src/service/plugin/command/PluginSearchSubCommand.ts +42 -0
  200. package/src/service/plugin/command/PluginUpgradeSubCommand.ts +36 -0
  201. package/src/service/plugin/command/getPluginId.ts +5 -0
  202. package/src/service/tableGenerator/DefaultTableGeneratorService.ts +6 -1
  203. package/src/terminal/ImageRenderer.ts +7 -5
  204. package/src/util/helpHelper.ts +1 -2
  205. package/dist/src/command/CompletionCommand.d.ts +0 -32
  206. package/dist/src/command/CompletionCommand.d.ts.map +0 -1
  207. package/dist/src/command/PluginCommand.d.ts +0 -67
  208. package/dist/src/command/PluginCommand.d.ts.map +0 -1
  209. package/dist/tests/cli/BaseCLI.test.d.ts +0 -2
  210. package/dist/tests/cli/BaseCLI.test.d.ts.map +0 -1
  211. package/dist/tests/cli/DynamicPluginRuntimeCLI.test.d.ts +0 -2
  212. package/dist/tests/cli/DynamicPluginRuntimeCLI.test.d.ts.map +0 -1
  213. package/dist/tests/command/CompletionCommand.test.d.ts +0 -2
  214. package/dist/tests/command/CompletionCommand.test.d.ts.map +0 -1
  215. package/dist/tests/command/MultiCommandCliHelpCommand.test.d.ts +0 -2
  216. package/dist/tests/command/MultiCommandCliHelpCommand.test.d.ts.map +0 -1
  217. package/dist/tests/command/PluginCommand.test.d.ts +0 -2
  218. package/dist/tests/command/PluginCommand.test.d.ts.map +0 -1
  219. package/dist/tests/command/SingleCommandCliHelpCommand.test.d.ts +0 -2
  220. package/dist/tests/command/SingleCommandCliHelpCommand.test.d.ts.map +0 -1
  221. package/dist/tests/command/UsageCommand.test.d.ts +0 -2
  222. package/dist/tests/command/UsageCommand.test.d.ts.map +0 -1
  223. package/dist/tests/command/VersionCommand.test.d.ts +0 -2
  224. package/dist/tests/command/VersionCommand.test.d.ts.map +0 -1
  225. package/dist/tests/fixtures/CLIConfig.d.ts +0 -3
  226. package/dist/tests/fixtures/CLIConfig.d.ts.map +0 -1
  227. package/dist/tests/fixtures/Command.d.ts +0 -20
  228. package/dist/tests/fixtures/Command.d.ts.map +0 -1
  229. package/dist/tests/fixtures/CommandRegistry.d.ts +0 -4
  230. package/dist/tests/fixtures/CommandRegistry.d.ts.map +0 -1
  231. package/dist/tests/fixtures/ConfigurationServiceProvider.d.ts +0 -10
  232. package/dist/tests/fixtures/ConfigurationServiceProvider.d.ts.map +0 -1
  233. package/dist/tests/fixtures/Context.d.ts +0 -4
  234. package/dist/tests/fixtures/Context.d.ts.map +0 -1
  235. package/dist/tests/fixtures/ServiceProviderRegistry.d.ts +0 -4
  236. package/dist/tests/fixtures/ServiceProviderRegistry.d.ts.map +0 -1
  237. package/dist/tests/fixtures/StreamString.d.ts +0 -10
  238. package/dist/tests/fixtures/StreamString.d.ts.map +0 -1
  239. package/dist/tests/fixtures/prettierPluginFoo.d.ts +0 -4
  240. package/dist/tests/fixtures/prettierPluginFoo.d.ts.map +0 -1
  241. package/dist/tests/fixtures/util.d.ts +0 -8
  242. package/dist/tests/fixtures/util.d.ts.map +0 -1
  243. package/dist/tests/runtime/DefaultContext.test.d.ts +0 -2
  244. package/dist/tests/runtime/DefaultContext.test.d.ts.map +0 -1
  245. package/dist/tests/runtime/argument/ArgumentTypeGuards.test.d.ts +0 -2
  246. package/dist/tests/runtime/argument/ArgumentTypeGuards.test.d.ts.map +0 -1
  247. package/dist/tests/runtime/command/CommandTypeGuards.test.d.ts +0 -2
  248. package/dist/tests/runtime/command/CommandTypeGuards.test.d.ts.map +0 -1
  249. package/dist/tests/runtime/command/CommandValidator.test.d.ts +0 -2
  250. package/dist/tests/runtime/command/CommandValidator.test.d.ts.map +0 -1
  251. package/dist/tests/runtime/parser.test.d.ts +0 -2
  252. package/dist/tests/runtime/parser.test.d.ts.map +0 -1
  253. package/dist/tests/runtime/registry/DefaultCommandRegistry.test.d.ts +0 -2
  254. package/dist/tests/runtime/registry/DefaultCommandRegistry.test.d.ts.map +0 -1
  255. package/dist/tests/runtime/registry/DefaultServiceProviderRegistry.test.d.ts +0 -2
  256. package/dist/tests/runtime/registry/DefaultServiceProviderRegistry.test.d.ts.map +0 -1
  257. package/dist/tests/runtime/runner.test.d.ts +0 -2
  258. package/dist/tests/runtime/runner.test.d.ts.map +0 -1
  259. package/dist/tests/runtime/scanner.test.d.ts +0 -2
  260. package/dist/tests/runtime/scanner.test.d.ts.map +0 -1
  261. package/dist/tests/runtime/values/argumentValueMerge.test.d.ts +0 -2
  262. package/dist/tests/runtime/values/argumentValueMerge.test.d.ts.map +0 -1
  263. package/dist/tests/runtime/values/argumentValueValidation.test.d.ts +0 -2
  264. package/dist/tests/runtime/values/argumentValueValidation.test.d.ts.map +0 -1
  265. package/dist/tests/runtime/values/globalCommandValuePopulation.test.d.ts +0 -2
  266. package/dist/tests/runtime/values/globalCommandValuePopulation.test.d.ts.map +0 -1
  267. package/dist/tests/runtime/values/subCommandValuePopulation.test.d.ts +0 -2
  268. package/dist/tests/runtime/values/subCommandValuePopulation.test.d.ts.map +0 -1
  269. package/dist/tests/service/argumentPrompter/ArgumentPrompterServiceProvider.test.d.ts +0 -2
  270. package/dist/tests/service/argumentPrompter/ArgumentPrompterServiceProvider.test.d.ts.map +0 -1
  271. package/dist/tests/service/argumentPrompter/DefaultArgumentPrompterService.test.d.ts +0 -2
  272. package/dist/tests/service/argumentPrompter/DefaultArgumentPrompterService.test.d.ts.map +0 -1
  273. package/dist/tests/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.test.d.ts +0 -2
  274. package/dist/tests/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.test.d.ts.map +0 -1
  275. package/dist/tests/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.test.d.ts +0 -2
  276. package/dist/tests/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.test.d.ts.map +0 -1
  277. package/dist/tests/service/banner/BannerServiceProvider.test.d.ts +0 -2
  278. package/dist/tests/service/banner/BannerServiceProvider.test.d.ts.map +0 -1
  279. package/dist/tests/service/banner/command/NoBannerCommand.test.d.ts +0 -2
  280. package/dist/tests/service/banner/command/NoBannerCommand.test.d.ts.map +0 -1
  281. package/dist/tests/service/chiselAsciiBannerGenerator/ChiselFontAsciiBannerGeneratorService.test.d.ts +0 -2
  282. package/dist/tests/service/chiselAsciiBannerGenerator/ChiselFontAsciiBannerGeneratorService.test.d.ts.map +0 -1
  283. package/dist/tests/service/completion/CompletionServiceProvider.test.d.ts +0 -2
  284. package/dist/tests/service/completion/CompletionServiceProvider.test.d.ts.map +0 -1
  285. package/dist/tests/service/completion/DefaultCompletionService.test.d.ts +0 -2
  286. package/dist/tests/service/completion/DefaultCompletionService.test.d.ts.map +0 -1
  287. package/dist/tests/service/completion/shell/bash.test.d.ts +0 -2
  288. package/dist/tests/service/completion/shell/bash.test.d.ts.map +0 -1
  289. package/dist/tests/service/completion/shell/fish.test.d.ts +0 -2
  290. package/dist/tests/service/completion/shell/fish.test.d.ts.map +0 -1
  291. package/dist/tests/service/completion/shell/powershell.test.d.ts +0 -2
  292. package/dist/tests/service/completion/shell/powershell.test.d.ts.map +0 -1
  293. package/dist/tests/service/completion/shell/zsh.test.d.ts +0 -2
  294. package/dist/tests/service/completion/shell/zsh.test.d.ts.map +0 -1
  295. package/dist/tests/service/configuration/ConfigurationServiceProvider.test.d.ts +0 -2
  296. package/dist/tests/service/configuration/ConfigurationServiceProvider.test.d.ts.map +0 -1
  297. package/dist/tests/service/configuration/DefaultKeyValueService.test.d.ts +0 -2
  298. package/dist/tests/service/configuration/DefaultKeyValueService.test.d.ts.map +0 -1
  299. package/dist/tests/service/configuration/DefaultSecretService.test.d.ts +0 -2
  300. package/dist/tests/service/configuration/DefaultSecretService.test.d.ts.map +0 -1
  301. package/dist/tests/service/configuration/command/ConfigCommand.test.d.ts +0 -2
  302. package/dist/tests/service/configuration/command/ConfigCommand.test.d.ts.map +0 -1
  303. package/dist/tests/service/configuration/command/DumpConfigCommand.test.d.ts +0 -2
  304. package/dist/tests/service/configuration/command/DumpConfigCommand.test.d.ts.map +0 -1
  305. package/dist/tests/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.test.d.ts +0 -2
  306. package/dist/tests/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.test.d.ts.map +0 -1
  307. package/dist/tests/service/dataDumpGenerator/DefaultDataDumpGeneratorService.test.d.ts +0 -2
  308. package/dist/tests/service/dataDumpGenerator/DefaultDataDumpGeneratorService.test.d.ts.map +0 -1
  309. package/dist/tests/service/imagePrinter/DefaultImagePrinterService.test.d.ts +0 -2
  310. package/dist/tests/service/imagePrinter/DefaultImagePrinterService.test.d.ts.map +0 -1
  311. package/dist/tests/service/imagePrinter/ImagePrinterServiceProvider.test.d.ts +0 -2
  312. package/dist/tests/service/imagePrinter/ImagePrinterServiceProvider.test.d.ts.map +0 -1
  313. package/dist/tests/service/plugin/DefaultPluginServiceProvider.test.d.ts +0 -2
  314. package/dist/tests/service/plugin/DefaultPluginServiceProvider.test.d.ts.map +0 -1
  315. package/dist/tests/service/prettyPrinter/DefaultPrettyPrinterService.test.d.ts +0 -2
  316. package/dist/tests/service/prettyPrinter/DefaultPrettyPrinterService.test.d.ts.map +0 -1
  317. package/dist/tests/service/prettyPrinter/PrettyPrinterServiceProvider.test.d.ts +0 -2
  318. package/dist/tests/service/prettyPrinter/PrettyPrinterServiceProvider.test.d.ts.map +0 -1
  319. package/dist/tests/service/printer/DefaultPrinterService.test.d.ts +0 -2
  320. package/dist/tests/service/printer/DefaultPrinterService.test.d.ts.map +0 -1
  321. package/dist/tests/service/printer/PrinterServiceProvider.test.d.ts +0 -2
  322. package/dist/tests/service/printer/PrinterServiceProvider.test.d.ts.map +0 -1
  323. package/dist/tests/service/printer/command/DarkModeCommand.test.d.ts +0 -2
  324. package/dist/tests/service/printer/command/DarkModeCommand.test.d.ts.map +0 -1
  325. package/dist/tests/service/printer/command/LogLevelCommand.test.d.ts +0 -2
  326. package/dist/tests/service/printer/command/LogLevelCommand.test.d.ts.map +0 -1
  327. package/dist/tests/service/printer/command/NoColorCommand.test.d.ts +0 -2
  328. package/dist/tests/service/printer/command/NoColorCommand.test.d.ts.map +0 -1
  329. package/dist/tests/service/printer/command/NoHyperlinksCommand.test.d.ts +0 -2
  330. package/dist/tests/service/printer/command/NoHyperlinksCommand.test.d.ts.map +0 -1
  331. package/dist/tests/service/printer/terminal/Progress.test.d.ts +0 -2
  332. package/dist/tests/service/printer/terminal/Progress.test.d.ts.map +0 -1
  333. package/dist/tests/service/printer/terminal/Spinner.test.d.ts +0 -2
  334. package/dist/tests/service/printer/terminal/Spinner.test.d.ts.map +0 -1
  335. package/dist/tests/service/prompter/DefaultPrompterService.test.d.ts +0 -2
  336. package/dist/tests/service/prompter/DefaultPrompterService.test.d.ts.map +0 -1
  337. package/dist/tests/service/prompter/PrompterServiceProvider.test.d.ts +0 -2
  338. package/dist/tests/service/prompter/PrompterServiceProvider.test.d.ts.map +0 -1
  339. package/dist/tests/service/prompter/command/NoPromptCommand.test.d.ts +0 -2
  340. package/dist/tests/service/prompter/command/NoPromptCommand.test.d.ts.map +0 -1
  341. package/dist/tests/service/prompter/prompt/PromptContext.test.d.ts +0 -2
  342. package/dist/tests/service/prompter/prompt/PromptContext.test.d.ts.map +0 -1
  343. package/dist/tests/service/shutdown/ShutdownServiceProvider.test.d.ts +0 -2
  344. package/dist/tests/service/shutdown/ShutdownServiceProvider.test.d.ts.map +0 -1
  345. package/dist/tests/service/syntaxHighlighter/DefaultSyntaxHighlighterService.test.d.ts +0 -2
  346. package/dist/tests/service/syntaxHighlighter/DefaultSyntaxHighlighterService.test.d.ts.map +0 -1
  347. package/dist/tests/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.test.d.ts +0 -2
  348. package/dist/tests/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.test.d.ts.map +0 -1
  349. package/dist/tests/service/tableGenerator/DefaultTableGeneratorService.test.d.ts +0 -2
  350. package/dist/tests/service/tableGenerator/DefaultTableGeneratorService.test.d.ts.map +0 -1
  351. package/dist/tests/service/tableGenerator/TableGeneratorServiceProvider.test.d.ts +0 -2
  352. package/dist/tests/service/tableGenerator/TableGeneratorServiceProvider.test.d.ts.map +0 -1
  353. package/dist/tests/service/treePrinter/DefaultTreePrinterService.test.d.ts +0 -2
  354. package/dist/tests/service/treePrinter/DefaultTreePrinterService.test.d.ts.map +0 -1
  355. package/dist/tests/service/treePrinter/TreePrinterServiceProvider.test.d.ts +0 -2
  356. package/dist/tests/service/treePrinter/TreePrinterServiceProvider.test.d.ts.map +0 -1
  357. package/dist/tests/terminal/ImageRenderer.test.d.ts +0 -2
  358. package/dist/tests/terminal/ImageRenderer.test.d.ts.map +0 -1
  359. package/dist/tests/terminal/PngDecoder.test.d.ts +0 -2
  360. package/dist/tests/terminal/PngDecoder.test.d.ts.map +0 -1
  361. package/dist/tests/terminal/supportsHyperlinks.test.d.ts +0 -2
  362. package/dist/tests/terminal/supportsHyperlinks.test.d.ts.map +0 -1
  363. package/dist/tests/util/configHelper.test.d.ts +0 -2
  364. package/dist/tests/util/configHelper.test.d.ts.map +0 -1
  365. package/dist/tests/util/envVarHelper.test.d.ts +0 -2
  366. package/dist/tests/util/envVarHelper.test.d.ts.map +0 -1
  367. package/dist/tests/util/logger.test.d.ts +0 -2
  368. package/dist/tests/util/logger.test.d.ts.map +0 -1
  369. package/src/command/PluginCommand.ts +0 -197
@@ -32,6 +32,7 @@ export interface CellOptions {
32
32
  }
33
33
 
34
34
  export default interface TableGeneratorService {
35
+ createTable(rowCount: number, columnCount: number, options?: TableOptions): Table;
35
36
  render(table: Table): string;
36
37
  }
37
38
 
@@ -51,11 +51,6 @@ import ArgumentPrompterServiceProvider from "../service/argumentPrompter/Argumen
51
51
  import DefaultCompletionService from "../service/completion/DefaultCompletionService.ts";
52
52
  import CompletionServiceProvider from "../service/completion/CompletionServiceProvider.ts";
53
53
  import ImagePrinterServiceProvider from "../service/imagePrinter/ImagePrinterServiceProvider.ts";
54
- import {
55
- CompletionCompleteSubCommand,
56
- CompletionGroupCommand,
57
- CompletionIntegrationSubCommand,
58
- } from "../command/CompletionCommand.ts";
59
54
  const logger = getLogger("BaseCLI");
60
55
 
61
56
  /**
@@ -233,10 +228,11 @@ export default class BaseCLI implements CLI {
233
228
  this.addServiceProvider(new ImagePrinterServiceProvider(55, this.#stdoutTerminal));
234
229
  }
235
230
 
236
- let completionService: DefaultCompletionService | undefined;
237
231
  if (this.#options.completionServiceEnabled) {
238
- completionService = new DefaultCompletionService();
239
- this.addServiceProvider(new CompletionServiceProvider(5, completionService));
232
+ const completionService = new DefaultCompletionService();
233
+ this.addServiceProvider(
234
+ new CompletionServiceProvider(5, completionService, this.#commandRegistry),
235
+ );
240
236
  }
241
237
 
242
238
  const configurationServiceProvider = new ConfigurationServiceProvider(
@@ -303,16 +299,6 @@ export default class BaseCLI implements CLI {
303
299
  // register the version command
304
300
  this.#commandRegistry.addCommand(new VersionCommand());
305
301
 
306
- // register completion commands (need CommandRegistry reference like help commands)
307
- if (completionService) {
308
- completionService.setCommandRegistry(this.#commandRegistry);
309
- const integrationCommand = new CompletionIntegrationSubCommand();
310
- const completeCommand = new CompletionCompleteSubCommand();
311
- this.#commandRegistry.addCommand(
312
- new CompletionGroupCommand(integrationCommand, completeCommand),
313
- );
314
- }
315
-
316
302
  // run...
317
303
  const runResult = await run(
318
304
  args,
@@ -345,7 +331,6 @@ export default class BaseCLI implements CLI {
345
331
  if (shutdownState.shutdownRequested || (error as Error).message === "Interrupted") {
346
332
  return { runState: RunState.INTERRUPTED };
347
333
  }
348
- logger.error("Runtime error: %s", (error as Error).message);
349
334
  await printRuntimeError(this.#context, error as Error);
350
335
  return {
351
336
  runState: RunState.RUNTIME_ERROR,
@@ -13,7 +13,11 @@ import { KEY_VALUE_SERVICE_ID } from "../../api/service/core/KeyValueService.ts"
13
13
  import type KeyValueService from "../../api/service/core/KeyValueService.ts";
14
14
  import { Icon, PRINTER_SERVICE_ID } from "../../api/service/core/PrinterService.ts";
15
15
  import type PrinterService from "../../api/service/core/PrinterService.ts";
16
+ import type CommandRegistry from "../../runtime/registry/CommandRegistry.ts";
16
17
  import getLogger from "../../util/logger.ts";
18
+ import { CompletionIntegrationSubCommand } from "./command/CompletionIntegrationSubCommand.ts";
19
+ import { CompletionCompleteSubCommand } from "./command/CompletionCompleteSubCommand.ts";
20
+ import { CompletionGroupCommand } from "./command/CompletionGroupCommand.ts";
17
21
 
18
22
  const logger = getLogger("CompletionServiceProvider");
19
23
 
@@ -23,16 +27,26 @@ export default class CompletionServiceProvider implements ServiceProvider {
23
27
  readonly #completionService: DefaultCompletionService;
24
28
  #cliName = "";
25
29
 
26
- public constructor(servicePriority: number, completionService: DefaultCompletionService) {
30
+ public constructor(
31
+ servicePriority: number,
32
+ completionService: DefaultCompletionService,
33
+ commandRegistry: CommandRegistry,
34
+ ) {
27
35
  this.servicePriority = servicePriority;
28
36
  this.#completionService = completionService;
37
+ this.#completionService.setCommandRegistry(commandRegistry);
29
38
  }
30
39
 
31
40
  public getServiceInfo(cliConfig: CLIConfig): Promise<ServiceInfo> {
32
41
  this.#cliName = cliConfig.name;
33
42
  return Promise.resolve({
34
43
  service: this.#completionService,
35
- commands: [],
44
+ commands: [
45
+ new CompletionGroupCommand(
46
+ new CompletionIntegrationSubCommand(),
47
+ new CompletionCompleteSubCommand(),
48
+ ),
49
+ ],
36
50
  });
37
51
  }
38
52
 
@@ -119,7 +133,6 @@ export default class CompletionServiceProvider implements ServiceProvider {
119
133
  await this.#installCompletion(context, shellType);
120
134
  await keyValueService.setKey("completion-status", "installed");
121
135
  } catch (error) {
122
- logger.error("Failed to install completion: %s", (error as Error).message);
123
136
  if (context.doesServiceExist(PRINTER_SERVICE_ID)) {
124
137
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
125
138
  await printerService.error(
@@ -0,0 +1,59 @@
1
+ import type SubCommand from "../../../api/command/SubCommand.ts";
2
+ import type Option from "../../../api/argument/Option.ts";
3
+ import type Positional from "../../../api/argument/Positional.ts";
4
+ import type Context from "../../../api/Context.ts";
5
+ import {
6
+ type ArgumentValues,
7
+ ArgumentValueTypeName,
8
+ } from "../../../api/argument/ArgumentValueTypes.ts";
9
+ import { COMPLETION_SERVICE_ID, ShellType } from "../../../api/service/core/CompletionService.ts";
10
+ import type DefaultCompletionService from "../DefaultCompletionService.ts";
11
+ import { PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
12
+ import type PrinterService from "../../../api/service/core/PrinterService.ts";
13
+
14
+ export class CompletionCompleteSubCommand implements SubCommand {
15
+ readonly name = "complete";
16
+ readonly description = "Generate completions for shell integration";
17
+ readonly enableConfiguration = false;
18
+ readonly disableGenericHelpDisplay = true;
19
+
20
+ readonly options: ReadonlyArray<Option> = [];
21
+
22
+ readonly positionals: ReadonlyArray<Positional> = [
23
+ {
24
+ name: "shell",
25
+ type: ArgumentValueTypeName.STRING,
26
+ allowableValues: Object.values(ShellType),
27
+ description: "Shell type",
28
+ },
29
+ {
30
+ name: "args",
31
+ type: ArgumentValueTypeName.STRING,
32
+ isVarargMultiple: true,
33
+ isVarargOptional: true,
34
+ description: "Shell-specific completion context arguments",
35
+ },
36
+ ];
37
+
38
+ async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
39
+ const completionService = context.getServiceById(
40
+ COMPLETION_SERVICE_ID,
41
+ ) as DefaultCompletionService;
42
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
43
+
44
+ const shellType = argumentValues.shell as ShellType;
45
+ const args = (argumentValues.args || []) as string[];
46
+
47
+ const completionContext = completionService.parseCompletionContext(shellType, args);
48
+ const completions = await completionService.generateCompletions(
49
+ shellType,
50
+ completionContext.line,
51
+ completionContext.cursorPosition,
52
+ );
53
+
54
+ const output = completionService.formatCompletions(shellType, completions);
55
+ if (output.length > 0) {
56
+ await printerService.print(output + "\n");
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,21 @@
1
+ import type GroupCommand from "../../../api/command/GroupCommand.ts";
2
+ import type SubCommand from "../../../api/command/SubCommand.ts";
3
+ import type Context from "../../../api/Context.ts";
4
+ import type { CompletionIntegrationSubCommand } from "./CompletionIntegrationSubCommand.ts";
5
+ import type { CompletionCompleteSubCommand } from "./CompletionCompleteSubCommand.ts";
6
+
7
+ export class CompletionGroupCommand implements GroupCommand {
8
+ readonly name = "completion";
9
+ readonly description = "Manage shell auto-completion";
10
+ readonly enableConfiguration = false;
11
+ readonly memberSubCommands: ReadonlyArray<SubCommand>;
12
+
13
+ constructor(
14
+ integrationCommand: CompletionIntegrationSubCommand,
15
+ completeCommand: CompletionCompleteSubCommand,
16
+ ) {
17
+ this.memberSubCommands = [integrationCommand, completeCommand];
18
+ }
19
+
20
+ async execute(_context: Context): Promise<void> {}
21
+ }
@@ -1,14 +1,16 @@
1
1
  import process from "node:process";
2
- import type GroupCommand from "../api/command/GroupCommand.ts";
3
- import type SubCommand from "../api/command/SubCommand.ts";
4
- import type Option from "../api/argument/Option.ts";
5
- import type Positional from "../api/argument/Positional.ts";
6
- import type Context from "../api/Context.ts";
7
- import { type ArgumentValues, ArgumentValueTypeName } from "../api/argument/ArgumentValueTypes.ts";
8
- import { COMPLETION_SERVICE_ID, ShellType } from "../api/service/core/CompletionService.ts";
9
- import type DefaultCompletionService from "../service/completion/DefaultCompletionService.ts";
10
- import { Icon, PRINTER_SERVICE_ID } from "../api/service/core/PrinterService.ts";
11
- import type PrinterService from "../api/service/core/PrinterService.ts";
2
+ import type SubCommand from "../../../api/command/SubCommand.ts";
3
+ import type Option from "../../../api/argument/Option.ts";
4
+ import type Positional from "../../../api/argument/Positional.ts";
5
+ import type Context from "../../../api/Context.ts";
6
+ import {
7
+ type ArgumentValues,
8
+ ArgumentValueTypeName,
9
+ } from "../../../api/argument/ArgumentValueTypes.ts";
10
+ import { COMPLETION_SERVICE_ID, ShellType } from "../../../api/service/core/CompletionService.ts";
11
+ import type DefaultCompletionService from "../DefaultCompletionService.ts";
12
+ import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
13
+ import type PrinterService from "../../../api/service/core/PrinterService.ts";
12
14
 
13
15
  export class CompletionIntegrationSubCommand implements SubCommand {
14
16
  readonly name = "integration";
@@ -94,66 +96,3 @@ export class CompletionIntegrationSubCommand implements SubCommand {
94
96
  );
95
97
  }
96
98
  }
97
-
98
- export class CompletionCompleteSubCommand implements SubCommand {
99
- readonly name = "complete";
100
- readonly description = "Generate completions for shell integration";
101
- readonly enableConfiguration = false;
102
- readonly disableGenericHelpDisplay = true;
103
-
104
- readonly options: ReadonlyArray<Option> = [];
105
-
106
- readonly positionals: ReadonlyArray<Positional> = [
107
- {
108
- name: "shell",
109
- type: ArgumentValueTypeName.STRING,
110
- allowableValues: Object.values(ShellType),
111
- description: "Shell type",
112
- },
113
- {
114
- name: "args",
115
- type: ArgumentValueTypeName.STRING,
116
- isVarargMultiple: true,
117
- isVarargOptional: true,
118
- description: "Shell-specific completion context arguments",
119
- },
120
- ];
121
-
122
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
123
- const completionService = context.getServiceById(
124
- COMPLETION_SERVICE_ID,
125
- ) as DefaultCompletionService;
126
- const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
127
-
128
- const shellType = argumentValues.shell as ShellType;
129
- const args = (argumentValues.args || []) as string[];
130
-
131
- const completionContext = completionService.parseCompletionContext(shellType, args);
132
- const completions = await completionService.generateCompletions(
133
- shellType,
134
- completionContext.line,
135
- completionContext.cursorPosition,
136
- );
137
-
138
- const output = completionService.formatCompletions(shellType, completions);
139
- if (output.length > 0) {
140
- await printerService.print(output + "\n");
141
- }
142
- }
143
- }
144
-
145
- export class CompletionGroupCommand implements GroupCommand {
146
- readonly name = "completions";
147
- readonly description = "Manage shell auto-completion";
148
- readonly enableConfiguration = false;
149
- readonly memberSubCommands: ReadonlyArray<SubCommand>;
150
-
151
- constructor(
152
- integrationCommand: CompletionIntegrationSubCommand,
153
- completeCommand: CompletionCompleteSubCommand,
154
- ) {
155
- this.memberSubCommands = [integrationCommand, completeCommand];
156
- }
157
-
158
- async execute(_context: Context): Promise<void> {}
159
- }
@@ -16,7 +16,7 @@ export default class BashShellHandler implements ShellHandler {
16
16
  return [
17
17
  `_${cliName}_completions() {`,
18
18
  ` local IFS=$'\\n'`,
19
- ` COMPREPLY=( $("${executablePath}" completions:complete bash "\${COMP_LINE}" "\${COMP_POINT}" 2>/dev/null) )`,
19
+ ` COMPREPLY=( $("${executablePath}" completion:complete bash "\${COMP_LINE}" "\${COMP_POINT}" 2>/dev/null) )`,
20
20
  `}`,
21
21
  `complete -F _${cliName}_completions ${cliName}`,
22
22
  ].join("\n");
@@ -13,7 +13,7 @@ export default class FishShellHandler implements ShellHandler {
13
13
  }
14
14
 
15
15
  getBootstrapScript(cliName: string, executablePath: string): string {
16
- return `complete -c ${cliName} -f -a '("${executablePath}" completions:complete fish (commandline -cp) (commandline -C) 2>/dev/null)'`;
16
+ return `complete -c ${cliName} -f -a '("${executablePath}" completion:complete fish (commandline -cp) (commandline -C) 2>/dev/null)'`;
17
17
  }
18
18
 
19
19
  validateEnvironment(): Promise<boolean> {
@@ -19,7 +19,7 @@ export default class PowerShellShellHandler implements ShellHandler {
19
19
  return [
20
20
  `Register-ArgumentCompleter -Native -CommandName ${cliName} -ScriptBlock {`,
21
21
  ` param($wordToComplete, $commandAst, $cursorPosition)`,
22
- ` $completions = & "${executablePath}" completions:complete powershell "$commandAst" "$cursorPosition" 2>$null`,
22
+ ` $completions = & "${executablePath}" completion:complete powershell "$commandAst" "$cursorPosition" 2>$null`,
23
23
  ` $completions -split '\\n' | ForEach-Object {`,
24
24
  ` [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)`,
25
25
  ` }`,
@@ -16,7 +16,7 @@ export default class ZshShellHandler implements ShellHandler {
16
16
  return [
17
17
  `_${cliName}_completions() {`,
18
18
  ` local -a completions`,
19
- ` completions=("\${(@f)$("${executablePath}" completions:complete zsh "\${words}" "\${CURSOR}" 2>/dev/null)}")`,
19
+ ` completions=("\${(@f)$("${executablePath}" completion:complete zsh "\${words}" "\${CURSOR}" 2>/dev/null)}")`,
20
20
  ` _describe '${cliName}' completions`,
21
21
  `}`,
22
22
  `compdef _${cliName}_completions ${cliName}`,
@@ -1,10 +1,10 @@
1
- import type { ServiceProvider, ServiceInfo } from "../../api/service/ServiceProvider.ts";
1
+ import type { ServiceInfo, ServiceProvider } from "../../api/service/ServiceProvider.ts";
2
2
  import type Context from "../../api/Context.ts";
3
3
  import type CLIConfig from "../../api/CLIConfig.ts";
4
4
  import type { MarketplacePluginManager } from "@flowscripter/dynamic-plugin-framework";
5
5
  import { PLUGIN_SERVICE_ID } from "../../api/service/core/PluginService.ts";
6
6
  import DefaultPluginService from "./DefaultPluginService.ts";
7
- import { PluginGroupCommand } from "../../command/PluginCommand.ts";
7
+ import { PluginGroupCommand } from "./command/PluginGroupCommand.ts";
8
8
 
9
9
  export default class DefaultPluginServiceProvider implements ServiceProvider {
10
10
  readonly serviceId = PLUGIN_SERVICE_ID;
@@ -0,0 +1,64 @@
1
+ import type SubCommand from "../../../api/command/SubCommand.ts";
2
+ import type Context from "../../../api/Context.ts";
3
+ import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
4
+ import { ArgumentValueTypeName } from "../../../api/argument/ArgumentValueTypes.ts";
5
+ import type PrinterService from "../../../api/service/core/PrinterService.ts";
6
+ import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
7
+ import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
8
+ import type PluginService from "../../../api/service/core/PluginService.ts";
9
+ import type { VersionedPluginDescriptor } from "@flowscripter/dynamic-plugin-framework";
10
+ import { getPluginId } from "./getPluginId.ts";
11
+
12
+ export class PluginAddSubCommand implements SubCommand {
13
+ readonly name = "add";
14
+ readonly description = "Install a remote plugin";
15
+ readonly enableConfiguration = false;
16
+ readonly options = [];
17
+ readonly positionals = [
18
+ {
19
+ name: "pluginId",
20
+ description: "Plugin ID to install (e.g. @scope/name)",
21
+ type: ArgumentValueTypeName.STRING,
22
+ },
23
+ ];
24
+
25
+ async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
26
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
27
+ const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
28
+
29
+ const pluginId = argumentValues["pluginId"] as string;
30
+ await printerService.info(`Searching for plugin: ${pluginId}\n`, Icon.INFORMATION);
31
+
32
+ let descriptor: VersionedPluginDescriptor | undefined;
33
+ for await (const d of pluginService.search({ text: pluginId })) {
34
+ if (getPluginId(d) === pluginId || d.pluginId === pluginId) {
35
+ descriptor = d;
36
+ break;
37
+ }
38
+ }
39
+
40
+ if (!descriptor) {
41
+ // Search did not find an exact match - attempt direct install by plugin ID.
42
+ // This handles cases where the package exists on the registry but is not
43
+ // returned by search (e.g. recently published or low search ranking).
44
+ await printerService.info(
45
+ `Plugin not found via search, attempting direct install of ${pluginId}...\n`,
46
+ Icon.INFORMATION,
47
+ );
48
+ const parts = pluginId.startsWith("@") ? pluginId.slice(1).split("/") : [undefined, pluginId];
49
+ const scope = pluginId.startsWith("@") ? `@${parts[0]}` : undefined;
50
+ const name = pluginId.startsWith("@") ? parts[1]! : pluginId;
51
+ descriptor = {
52
+ pluginId,
53
+ scope,
54
+ name,
55
+ version: "latest",
56
+ extensionPoints: [],
57
+ };
58
+ }
59
+
60
+ await printerService.info(`Installing ${descriptor.pluginId}...\n`, Icon.INFORMATION);
61
+ await pluginService.install(descriptor);
62
+ await printerService.print(`Plugin ${descriptor.pluginId} installed.\n`, Icon.SUCCESS);
63
+ }
64
+ }
@@ -0,0 +1,27 @@
1
+ import type GroupCommand from "../../../api/command/GroupCommand.ts";
2
+ import type SubCommand from "../../../api/command/SubCommand.ts";
3
+ import type Context from "../../../api/Context.ts";
4
+ import { PluginListSubCommand } from "./PluginListSubCommand.ts";
5
+ import { PluginSearchSubCommand } from "./PluginSearchSubCommand.ts";
6
+ import { PluginAddSubCommand } from "./PluginAddSubCommand.ts";
7
+ import { PluginRemoveSubCommand } from "./PluginRemoveSubCommand.ts";
8
+ import { PluginUpgradeSubCommand } from "./PluginUpgradeSubCommand.ts";
9
+
10
+ export class PluginGroupCommand implements GroupCommand {
11
+ readonly name = "plugin";
12
+ readonly description = "Manage CLI plugins";
13
+ readonly enableConfiguration = false;
14
+ readonly memberSubCommands: ReadonlyArray<SubCommand>;
15
+
16
+ constructor() {
17
+ this.memberSubCommands = [
18
+ new PluginListSubCommand(),
19
+ new PluginSearchSubCommand(),
20
+ new PluginAddSubCommand(),
21
+ new PluginRemoveSubCommand(),
22
+ new PluginUpgradeSubCommand(),
23
+ ];
24
+ }
25
+
26
+ async execute(_context: Context): Promise<void> {}
27
+ }
@@ -0,0 +1,33 @@
1
+ import type SubCommand from "../../../api/command/SubCommand.ts";
2
+ import type Context from "../../../api/Context.ts";
3
+ import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
4
+ import type PrinterService from "../../../api/service/core/PrinterService.ts";
5
+ import { PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
6
+ import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
7
+ import type PluginService from "../../../api/service/core/PluginService.ts";
8
+ import { getPluginId } from "./getPluginId.ts";
9
+
10
+ export class PluginListSubCommand implements SubCommand {
11
+ readonly name = "list";
12
+ readonly description = "List locally installed plugins";
13
+ readonly enableConfiguration = false;
14
+ readonly options = [];
15
+ readonly positionals = [];
16
+
17
+ async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
18
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
+ const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
20
+
21
+ let found = false;
22
+ for await (const descriptor of pluginService.listInstalled()) {
23
+ if (!found) {
24
+ found = true;
25
+ await printerService.print("Installed plugins:\n");
26
+ }
27
+ await printerService.print(` ${getPluginId(descriptor)} ${descriptor.version}\n`);
28
+ }
29
+ if (!found) {
30
+ await printerService.print("No plugins installed.\n");
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,32 @@
1
+ import type SubCommand from "../../../api/command/SubCommand.ts";
2
+ import type Context from "../../../api/Context.ts";
3
+ import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
4
+ import { ArgumentValueTypeName } from "../../../api/argument/ArgumentValueTypes.ts";
5
+ import type PrinterService from "../../../api/service/core/PrinterService.ts";
6
+ import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
7
+ import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
8
+ import type PluginService from "../../../api/service/core/PluginService.ts";
9
+
10
+ export class PluginRemoveSubCommand implements SubCommand {
11
+ readonly name = "remove";
12
+ readonly description = "Remove a locally installed plugin";
13
+ readonly enableConfiguration = false;
14
+ readonly options = [];
15
+ readonly positionals = [
16
+ {
17
+ name: "pluginId",
18
+ description: "Plugin ID to remove (e.g. @scope/name)",
19
+ type: ArgumentValueTypeName.STRING,
20
+ },
21
+ ];
22
+
23
+ async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
24
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
25
+ const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
26
+
27
+ const pluginId = argumentValues["pluginId"] as string;
28
+ await printerService.info(`Removing plugin: ${pluginId}...\n`, Icon.INFORMATION);
29
+ await pluginService.uninstall(pluginId);
30
+ await printerService.print(`Plugin ${pluginId} removed.\n`, Icon.SUCCESS);
31
+ }
32
+ }
@@ -0,0 +1,42 @@
1
+ import type SubCommand from "../../../api/command/SubCommand.ts";
2
+ import type Context from "../../../api/Context.ts";
3
+ import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
4
+ import { ArgumentValueTypeName } from "../../../api/argument/ArgumentValueTypes.ts";
5
+ import type PrinterService from "../../../api/service/core/PrinterService.ts";
6
+ import { PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
7
+ import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
8
+ import type PluginService from "../../../api/service/core/PluginService.ts";
9
+ import { getPluginId } from "./getPluginId.ts";
10
+
11
+ export class PluginSearchSubCommand implements SubCommand {
12
+ readonly name = "search";
13
+ readonly description = "Search remote plugins";
14
+ readonly enableConfiguration = false;
15
+ readonly options = [];
16
+ readonly positionals = [
17
+ {
18
+ name: "query",
19
+ description: "Search query",
20
+ type: ArgumentValueTypeName.STRING,
21
+ isVarargOptional: true,
22
+ },
23
+ ];
24
+
25
+ async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
26
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
27
+ const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
28
+
29
+ const query = (argumentValues["query"] as string | undefined) ?? "";
30
+ let found = false;
31
+ for await (const descriptor of pluginService.search({ text: query })) {
32
+ if (!found) {
33
+ found = true;
34
+ await printerService.print("Available plugins:\n");
35
+ }
36
+ await printerService.print(` ${getPluginId(descriptor)} ${descriptor.version}\n`);
37
+ }
38
+ if (!found) {
39
+ await printerService.print("No plugins found.\n");
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,36 @@
1
+ import type SubCommand from "../../../api/command/SubCommand.ts";
2
+ import type Context from "../../../api/Context.ts";
3
+ import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
4
+ import type PrinterService from "../../../api/service/core/PrinterService.ts";
5
+ import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
6
+ import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
7
+ import type PluginService from "../../../api/service/core/PluginService.ts";
8
+ import { getPluginId } from "./getPluginId.ts";
9
+
10
+ export class PluginUpgradeSubCommand implements SubCommand {
11
+ readonly name = "upgrade";
12
+ readonly description = "Upgrade locally installed plugins";
13
+ readonly enableConfiguration = false;
14
+ readonly options = [];
15
+ readonly positionals = [];
16
+
17
+ async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
18
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
+ const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
20
+
21
+ let upgraded = 0;
22
+ for await (const update of pluginService.checkForUpdates()) {
23
+ const id = getPluginId(update.descriptor);
24
+ await printerService.info(
25
+ `Upgrading ${id} to ${update.availableVersion}...\n`,
26
+ Icon.INFORMATION,
27
+ );
28
+ await pluginService.install(update.descriptor);
29
+ await printerService.print(`Upgraded ${id} to ${update.availableVersion}.\n`, Icon.SUCCESS);
30
+ upgraded++;
31
+ }
32
+ if (upgraded === 0) {
33
+ await printerService.print("All plugins are up to date.\n");
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,5 @@
1
+ import type { VersionedPluginDescriptor } from "@flowscripter/dynamic-plugin-framework";
2
+
3
+ export function getPluginId(descriptor: VersionedPluginDescriptor): string {
4
+ return descriptor.scope ? `@${descriptor.scope}/${descriptor.name}` : descriptor.name;
5
+ }
@@ -1,6 +1,7 @@
1
1
  import type TableGeneratorService from "../../api/service/core/TableGeneratorService.ts";
2
2
  import { Align } from "../../api/service/core/TableGeneratorService.ts";
3
- import type Table from "../../api/service/core/Table.ts";
3
+ import type { TableOptions } from "../../api/service/core/TableGeneratorService.ts";
4
+ import Table from "../../api/service/core/Table.ts";
4
5
 
5
6
  const BORDER_TOP_LEFT = "┌";
6
7
  const BORDER_TOP = "─";
@@ -23,6 +24,10 @@ export default class DefaultTableGeneratorService implements TableGeneratorServi
23
24
  colorFunction: (text: string, hexFormattedColor: string) => string = (text) => text;
24
25
  backgroundColorFunction: (text: string, hexFormattedColor: string) => string = (text) => text;
25
26
 
27
+ createTable(rowCount: number, columnCount: number, options?: TableOptions): Table {
28
+ return new Table(rowCount, columnCount, options);
29
+ }
30
+
26
31
  #resolveAlign(table: Table, rowIndex: number, columnIndex: number): Align {
27
32
  const cellOpts = table.getCell(rowIndex, columnIndex)?.options;
28
33
  if (cellOpts?.align !== undefined) return cellOpts.align;
@@ -23,12 +23,14 @@ export default class ImageRenderer {
23
23
  hexFormattedBackgroundColor?: string,
24
24
  ): Promise<string> {
25
25
  if (!this.#isMultiplexer()) {
26
- if (supportsTerminalGraphics.stdout.kitty) {
27
- return this.#renderKitty(imageBuffer, widthPercentage);
28
- }
26
+ // iTerm2 only supports its own proprietary image protocol, not Kitty's, despite
27
+ // supports-terminal-graphics incorrectly reporting kitty:true for iTerm2 3.6+.
29
28
  if (supportsTerminalGraphics.stdout.iterm2) {
30
29
  return this.#renderITerm2(imageBuffer, widthPercentage);
31
30
  }
31
+ if (supportsTerminalGraphics.stdout.kitty) {
32
+ return this.#renderKitty(imageBuffer, widthPercentage);
33
+ }
32
34
  }
33
35
  return this.#renderAnsiBlocks(imageBuffer, widthPercentage, hexFormattedBackgroundColor);
34
36
  }
@@ -57,9 +59,9 @@ export default class ImageRenderer {
57
59
  for (let i = 0; i < chunks.length; i++) {
58
60
  const isLast = i === chunks.length - 1;
59
61
  if (i === 0) {
60
- result += `\x1b_Gf=100,a=T,c=${columns},m=${isLast ? 0 : 1};${chunks[i]}\x1b\\`;
62
+ result += `\x1b_Gf=100,a=T,c=${columns},q=2,m=${isLast ? 0 : 1};${chunks[i]}\x1b\\`;
61
63
  } else {
62
- result += `\x1b_Gm=${isLast ? 0 : 1};${chunks[i]}\x1b\\`;
64
+ result += `\x1b_Gq=2,m=${isLast ? 0 : 1};${chunks[i]}\x1b\\`;
63
65
  }
64
66
  }
65
67
  return result;