@flowscripter/example-cli 1.3.5 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bun.lock CHANGED
@@ -5,10 +5,12 @@
5
5
  "": {
6
6
  "name": "@flowscripter/example-cli",
7
7
  "dependencies": {
8
- "@flowscripter/dynamic-cli-framework": "^1.4.18",
8
+ "@flowscripter/dynamic-cli-framework": "1.7.0",
9
+ "@flowscripter/dynamic-plugin-framework": "1.10.0",
9
10
  },
10
11
  "devDependencies": {
11
12
  "@types/bun": "^1.3.14",
13
+ "@types/node": "^26.1.0",
12
14
  "oxfmt": "0.56.0",
13
15
  "oxlint": "1.71.0",
14
16
  },
@@ -18,7 +20,9 @@
18
20
  },
19
21
  },
20
22
  "packages": {
21
- "@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@1.4.18", "", { "dependencies": { "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.11.0", "highlight.js": "^11.11.1", "prettier": "^3.8.4", "supports-color": "^10.2.2", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "typescript": "^6.0.3" } }, "sha512-HLGLeO8V0tieNbkx3ShXl4dB9JHmYa27aQvFUvTLtxwyvLv/zTrJWtz/PL2Us6/JEXxAdgC5wAOxXWpUxNz1ow=="],
23
+ "@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@1.7.0", "", { "dependencies": { "@flowscripter/dynamic-plugin-framework": "1.10.0", "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.11.0", "highlight.js": "^11.11.1", "prettier": "^3.9.4", "supports-color": "^10.2.2", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "typescript": "^6.0.3" } }, "sha512-JSwzlsjcZSYo0vczzDXieV8/36J8AJhL4fIyq8ANj8xf01+NL+Abo/6HB0lTi/H/h9jwfN8IfagVo2SEgMNxPg=="],
24
+
25
+ "@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@1.10.0", "", { "dependencies": { "semver": "^7.8.5" }, "peerDependencies": { "typescript": "^6.0.3" } }, "sha512-WC0PKxQsk4KJSP/fstL2+Po5/2OB1hSgwM3HGLGwoHyH5qV7pNF/aZct6mDnLIi0aECVWM1sm7LXg75cb9FWLQ=="],
22
26
 
23
27
  "@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.56.0", "", { "os": "android", "cpu": "arm" }, "sha512-CSCxi7ovYojgfdPOdUb9T508HKeAdDIKeRGg7x8IZwVJrWz9gVgX7MbUnFqtQAE4QvoNo07mj2JlwnOzJw4qqA=="],
24
28
 
@@ -100,7 +104,7 @@
100
104
 
101
105
  "@types/hast": ["@types/hast@3.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ=="],
102
106
 
103
- "@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
107
+ "@types/node": ["@types/node@26.1.0", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-O0A1G3xPGy4w7AgQdAQYUlQ+BKk2Oovw8eRpofyp5KdBZULnbe+WqaOVNrm705SHphCiG4XHsACrSmPu1f+Kgw=="],
104
108
 
105
109
  "@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
106
110
 
@@ -128,7 +132,9 @@
128
132
 
129
133
  "oxlint": ["oxlint@1.71.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.71.0", "@oxlint/binding-android-arm64": "1.71.0", "@oxlint/binding-darwin-arm64": "1.71.0", "@oxlint/binding-darwin-x64": "1.71.0", "@oxlint/binding-freebsd-x64": "1.71.0", "@oxlint/binding-linux-arm-gnueabihf": "1.71.0", "@oxlint/binding-linux-arm-musleabihf": "1.71.0", "@oxlint/binding-linux-arm64-gnu": "1.71.0", "@oxlint/binding-linux-arm64-musl": "1.71.0", "@oxlint/binding-linux-ppc64-gnu": "1.71.0", "@oxlint/binding-linux-riscv64-gnu": "1.71.0", "@oxlint/binding-linux-riscv64-musl": "1.71.0", "@oxlint/binding-linux-s390x-gnu": "1.71.0", "@oxlint/binding-linux-x64-gnu": "1.71.0", "@oxlint/binding-linux-x64-musl": "1.71.0", "@oxlint/binding-openharmony-arm64": "1.71.0", "@oxlint/binding-win32-arm64-msvc": "1.71.0", "@oxlint/binding-win32-ia32-msvc": "1.71.0", "@oxlint/binding-win32-x64-msvc": "1.71.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.22.1", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-U1m1X+C0vDj7DC1e13IoZULzEcPczE7UOMTs8VlZGHUEIUaSTZKo5qkPsQEfzpgnQ29Pea/w3Xntk62UCecxZw=="],
130
134
 
131
- "prettier": ["prettier@3.8.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-N2MylSdi48+5N/6S5j+maeHbUSIzzZ5uOcX5Hm4QpV8Dkb1HFjfAKTKX6yNPJQD9AhcT3ifHNB66tWTTJDi11Q=="],
135
+ "prettier": ["prettier@3.9.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-yWG/o/4oJfo036EKAfK6ACAoDOfHeRHx4tuxkfBZiauURiaSmYwlpOr5LQqKtIkRD2z1PLteme2WoxEnj4tHTg=="],
136
+
137
+ "semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
132
138
 
133
139
  "supports-color": ["supports-color@10.2.2", "", {}, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="],
134
140
 
@@ -138,10 +144,14 @@
138
144
 
139
145
  "typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
140
146
 
141
- "undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
147
+ "undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
148
+
149
+ "bun-types/@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
142
150
 
143
151
  "emphasize/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
144
152
 
145
153
  "lowlight/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
154
+
155
+ "bun-types/@types/node/undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
146
156
  }
147
157
  }
@@ -0,0 +1,37 @@
1
+ Feature: Plugin management
2
+
3
+ Note: These scenarios require @flowscripter/example-cli-plugin to be
4
+ published on npmjs.com and the test machine to have network access.
5
+ The plugin install folder is ~/.example-cli/plugins.
6
+
7
+ Scenario: Search for example-cli-plugin on npmjs
8
+ When the executable is launched with "plugin:search example-cli-plugin"
9
+ Then the executable should complete with exit code 0
10
+ And the executable should have output "example-cli-plugin"
11
+
12
+ Scenario: List plugins when none installed
13
+ When the executable is launched with "plugin:list"
14
+ Then the executable should complete with exit code 0
15
+
16
+ Scenario: Install example-cli-plugin
17
+ When the executable is launched with "plugin:add @flowscripter/example-cli-plugin"
18
+ Then the executable should complete with exit code 0
19
+ And the executable should have output "installed"
20
+
21
+ Scenario: List installed plugins after install
22
+ When the executable is launched with "plugin:list"
23
+ Then the executable should complete with exit code 0
24
+ And the executable should have output "example-cli-plugin"
25
+
26
+ Scenario: Use hello command from installed plugin
27
+ When the executable is launched with "hello"
28
+ Then the executable should complete with exit code 0
29
+ And the executable should have output "Hello"
30
+
31
+ Scenario: Remove example-cli-plugin
32
+ When the executable is launched with "plugin:remove @flowscripter/example-cli-plugin"
33
+ Then the executable should complete with exit code 0
34
+
35
+ Scenario: Plugin no longer listed after removal
36
+ When the executable is launched with "plugin:list"
37
+ Then the executable should complete with exit code 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/example-cli",
3
- "version": "1.3.5",
3
+ "version": "1.4.0",
4
4
  "description": "Simple example CLI using https://github.com/flowscripter/dynamic-cli-framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -24,10 +24,12 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@flowscripter/dynamic-cli-framework": "^1.4.18"
27
+ "@flowscripter/dynamic-cli-framework": "1.7.0",
28
+ "@flowscripter/dynamic-plugin-framework": "1.10.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/bun": "^1.3.14",
32
+ "@types/node": "^26.1.0",
31
33
  "oxfmt": "0.56.0",
32
34
  "oxlint": "1.71.0"
33
35
  },
package/src/cli.ts CHANGED
@@ -2,15 +2,35 @@ import {
2
2
  AsciiBannerGeneratorServiceProvider,
3
3
  BannerServiceProvider,
4
4
  DataDumpGeneratorServiceProvider,
5
- launchMultiCommandCLI,
5
+ launchDynamicPluginMultiCommandCLI,
6
6
  SyntaxHighlighterServiceProvider,
7
7
  TreePrinterServiceProvider,
8
8
  } from "@flowscripter/dynamic-cli-framework";
9
+ import {
10
+ NpmPluginManager,
11
+ NpmPluginRepository,
12
+ NpmjsPluginRepository,
13
+ } from "@flowscripter/dynamic-plugin-framework";
9
14
  import demo from "./commands/demo.ts";
10
15
  import packageJson from "../package.json";
16
+ import path from "node:path";
17
+ import os from "node:os";
11
18
 
12
19
  export async function cli(): Promise<void> {
13
- await launchMultiCommandCLI(
20
+ const pluginsDir = path.join(os.homedir(), ".example-cli", "plugins", "node_modules");
21
+ const pluginManager = new NpmPluginManager(
22
+ [
23
+ new NpmjsPluginRepository({
24
+ name: "npmjs",
25
+ registryUrl: "https://registry.npmjs.org",
26
+ packageJsonNamespace: "dynamic-cli-framework",
27
+ }),
28
+ ],
29
+ new NpmPluginRepository(pluginsDir, "dynamic-cli-framework"),
30
+ );
31
+
32
+ await launchDynamicPluginMultiCommandCLI(
33
+ pluginManager,
14
34
  [demo],
15
35
  "Simple example CLI using dynamic-cli-framework.",
16
36
  "example-cli",
@@ -1,3 +1,4 @@
1
+ import process from "node:process";
1
2
  import {
2
3
  type ArgumentValues,
3
4
  COMPLETION_SERVICE_ID,
@@ -18,7 +19,11 @@ const completion: SubCommand = {
18
19
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
20
  const completionService = context.getServiceById(COMPLETION_SERVICE_ID) as CompletionService;
20
21
 
21
- const bootstrapScript = completionService.getBootstrapScript(ShellType.BASH, "example-cli");
22
+ const bootstrapScript = completionService.getBootstrapScript(
23
+ ShellType.BASH,
24
+ "example-cli",
25
+ process.execPath,
26
+ );
22
27
  await printerService.print(`Bash bootstrap script:\n${bootstrapScript}\n`);
23
28
 
24
29
  const configPath = completionService.getDefaultConfigPath(ShellType.BASH);
package/tsconfig.json CHANGED
@@ -26,5 +26,5 @@
26
26
  "noUnusedParameters": false,
27
27
  "noPropertyAccessFromIndexSignature": false
28
28
  },
29
- "exclude": ["tests"]
29
+ "exclude": ["dist"]
30
30
  }