@flowscripter/example-cli-plugin 1.1.3 → 2.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.
package/README.md CHANGED
@@ -9,6 +9,13 @@
9
9
  > Example CLI plugin for the
10
10
  > [dynamic-cli-framework](https://github.com/flowscripter/dynamic-cli-framework)
11
11
 
12
+ This plugin is authored against
13
+ [`@flowscripter/dynamic-cli-framework-api`](https://github.com/flowscripter/dynamic-cli-framework-api),
14
+ the lightweight plugin-facing API package, rather than the full
15
+ `dynamic-cli-framework` - keeping the framework's concrete service
16
+ implementations and their dependencies out of the plugin's own
17
+ dependency tree.
18
+
12
19
  ## Development
13
20
 
14
21
  Build (produces `dist/` for Node.js and TypeScript consumers; Bun uses raw source directly):
@@ -76,13 +83,26 @@ classDiagram
76
83
  +execute(context, argumentValues) void
77
84
  }
78
85
 
86
+ class helloRustCommand {
87
+ <<SubCommand>>
88
+ +name: "hello_rust"
89
+ +execute(context) void
90
+ }
91
+
92
+ class world {
93
+ <<@flowscripter/template-bun-rust-library>>
94
+ +world() void
95
+ }
96
+
79
97
  Plugin --> DemoCommandFactory : extensionDescriptor
80
98
  Plugin --> DemoServiceProviderFactory : extensionDescriptor
81
99
  DemoCommandFactory --> helloCommand : getCommands()
100
+ DemoCommandFactory --> helloRustCommand : getCommands()
82
101
  DemoServiceProviderFactory --> DemoServiceProvider : getServiceProviders()
83
102
  DemoServiceProvider --> DefaultDemoService : creates
84
103
  DefaultDemoService ..|> DemoService
85
104
  helloCommand --> DemoService : uses via context
105
+ helloRustCommand --> world : calls
86
106
  ```
87
107
 
88
108
  ### Framework API
@@ -1,4 +1,4 @@
1
- import type { SubCommand } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  declare const helloCommand: SubCommand;
3
3
  export default helloCommand;
4
4
  //# sourceMappingURL=HelloCommand.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HelloCommand.d.ts","sourceRoot":"","sources":["../../../src/command/HelloCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIX,MAAM,gDAAgD,CAAC;AAQxD,QAAA,MAAM,YAAY,EAAE,UAqBnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"HelloCommand.d.ts","sourceRoot":"","sources":["../../../src/command/HelloCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAIX,MAAM,yCAAyC,CAAC;AAKjD,QAAA,MAAM,YAAY,EAAE,UAqBnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ArgumentValueTypeName, PRINTER_SERVICE_ID, } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import { ArgumentValueTypeName, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import { DEMO_SERVICE_ID } from "../service/DemoService.js";
3
3
  const helloCommand = {
4
4
  name: "hello",
@@ -0,0 +1,4 @@
1
+ import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
+ declare const helloRustCommand: SubCommand;
3
+ export default helloRustCommand;
4
+ //# sourceMappingURL=HelloRustCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HelloRustCommand.d.ts","sourceRoot":"","sources":["../../../src/command/HelloRustCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,yCAAyC,CAAC;AAInG,QAAA,MAAM,gBAAgB,EAAE,UAYvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
2
+ import { world } from "@flowscripter/template-bun-rust-library";
3
+ const helloRustCommand = {
4
+ name: "hello_rust",
5
+ description: "Greet using a native Rust library via FFI",
6
+ helpTopic: "Hello",
7
+ enableConfiguration: false,
8
+ options: [],
9
+ positionals: [],
10
+ execute: async (context) => {
11
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID);
12
+ await printerService?.print("Hello ");
13
+ world();
14
+ },
15
+ };
16
+ export default helloRustCommand;
@@ -1,5 +1,5 @@
1
- import type { CommandFactory } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import type { CommandFactory } from "@flowscripter/dynamic-cli-framework-api";
2
2
  export default class DemoCommandFactory implements CommandFactory {
3
- getCommands(): import("@flowscripter/dynamic-cli-framework/cli-plugin").SubCommand[];
3
+ getCommands(): import("@flowscripter/dynamic-cli-framework-api").SubCommand[];
4
4
  }
5
5
  //# sourceMappingURL=DemoCommandFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DemoCommandFactory.d.ts","sourceRoot":"","sources":["../../../src/factory/DemoCommandFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAGrF,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,cAAc;IAC/D,WAAW;CAGZ"}
1
+ {"version":3,"file":"DemoCommandFactory.d.ts","sourceRoot":"","sources":["../../../src/factory/DemoCommandFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAI9E,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,cAAc;IAC/D,WAAW;CAGZ"}
@@ -1,6 +1,7 @@
1
1
  import helloCommand from "../command/HelloCommand.js";
2
+ import helloRustCommand from "../command/HelloRustCommand.js";
2
3
  export default class DemoCommandFactory {
3
4
  getCommands() {
4
- return [helloCommand];
5
+ return [helloCommand, helloRustCommand];
5
6
  }
6
7
  }
@@ -1,4 +1,4 @@
1
- import type { ServiceProviderFactory } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import type { ServiceProviderFactory } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import DemoServiceProvider from "../service/DemoServiceProvider.ts";
3
3
  export default class DemoServiceProviderFactory implements ServiceProviderFactory {
4
4
  getServiceProviders(): DemoServiceProvider[];
@@ -1 +1 @@
1
- {"version":3,"file":"DemoServiceProviderFactory.d.ts","sourceRoot":"","sources":["../../../src/factory/DemoServiceProviderFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,mBAAmB,MAAM,mCAAmC,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,0BAA2B,YAAW,sBAAsB;IAC/E,mBAAmB;CAGpB"}
1
+ {"version":3,"file":"DemoServiceProviderFactory.d.ts","sourceRoot":"","sources":["../../../src/factory/DemoServiceProviderFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,mBAAmB,MAAM,mCAAmC,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,0BAA2B,YAAW,sBAAsB;IAC/E,mBAAmB;CAGpB"}
@@ -1,3 +1,3 @@
1
- declare const _default: import("@flowscripter/dynamic-cli-framework/cli-plugin").CLIPlugin;
1
+ declare const _default: import("@flowscripter/dynamic-cli-framework-api").CLIPlugin;
2
2
  export default _default;
3
3
  //# sourceMappingURL=plugin.d.ts.map
@@ -1,4 +1,4 @@
1
- import { createCLIPlugin } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import { createCLIPlugin } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import DemoCommandFactory from "./factory/DemoCommandFactory.js";
3
3
  import DemoServiceProviderFactory from "./factory/DemoServiceProviderFactory.js";
4
4
  export default createCLIPlugin({
@@ -1,4 +1,4 @@
1
- import type { ServiceProvider, ServiceInfo, CLIConfig, Context } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import type { ServiceProvider, ServiceInfo, CLIConfig, Context } from "@flowscripter/dynamic-cli-framework-api";
2
2
  export default class DemoServiceProvider implements ServiceProvider {
3
3
  readonly serviceId = "DEMO_SERVICE";
4
4
  readonly servicePriority = 10;
@@ -1 +1 @@
1
- {"version":3,"file":"DemoServiceProvider.d.ts","sourceRoot":"","sources":["../../../src/service/DemoServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,SAAS,EACT,OAAO,EACR,MAAM,gDAAgD,CAAC;AAIxD,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,eAAe;IACjE,QAAQ,CAAC,SAAS,kBAAmB;IACrC,QAAQ,CAAC,eAAe,MAAM;IAExB,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAI3D,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CACpD"}
1
+ {"version":3,"file":"DemoServiceProvider.d.ts","sourceRoot":"","sources":["../../../src/service/DemoServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,SAAS,EACT,OAAO,EACR,MAAM,yCAAyC,CAAC;AAIjD,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,eAAe;IACjE,QAAQ,CAAC,SAAS,kBAAmB;IACrC,QAAQ,CAAC,eAAe,MAAM;IAExB,cAAc,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAI3D,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CACpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/example-cli-plugin",
3
- "version": "1.1.3",
3
+ "version": "2.0.0",
4
4
  "description": "Example CLI plugin for the https://github.com/flowscripter/dynamic-cli-framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -42,16 +42,18 @@
42
42
  "build": "tsc -p tsconfig.build.json"
43
43
  },
44
44
  "dependencies": {
45
+ "@flowscripter/template-bun-rust-library": "^1.2.5",
45
46
  "cowsay": "^1.6.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@flowscripter/dynamic-cli-framework": "1.7.3",
49
+ "@flowscripter/dynamic-cli-framework": "^2.0.0",
50
+ "@flowscripter/dynamic-cli-framework-api": "^1.0.1",
49
51
  "@types/bun": "^1.3.14",
50
52
  "oxfmt": "0.56.0",
51
53
  "oxlint": "1.71.0"
52
54
  },
53
55
  "peerDependencies": {
54
- "@flowscripter/dynamic-cli-framework": "*",
56
+ "@flowscripter/dynamic-cli-framework-api": "*",
55
57
  "typescript": "^6.0.3"
56
58
  },
57
59
  "dynamic-cli-framework": {
@@ -3,11 +3,8 @@ import type {
3
3
  Context,
4
4
  ArgumentValues,
5
5
  PrinterService,
6
- } from "@flowscripter/dynamic-cli-framework/cli-plugin";
7
- import {
8
- ArgumentValueTypeName,
9
- PRINTER_SERVICE_ID,
10
- } from "@flowscripter/dynamic-cli-framework/cli-plugin";
6
+ } from "@flowscripter/dynamic-cli-framework-api";
7
+ import { ArgumentValueTypeName, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
11
8
  import { DEMO_SERVICE_ID } from "../service/DemoService.ts";
12
9
  import type DemoService from "../service/DemoService.ts";
13
10
 
@@ -0,0 +1,19 @@
1
+ import type { SubCommand, Context, PrinterService } from "@flowscripter/dynamic-cli-framework-api";
2
+ import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { world } from "@flowscripter/template-bun-rust-library";
4
+
5
+ const helloRustCommand: SubCommand = {
6
+ name: "hello_rust",
7
+ description: "Greet using a native Rust library via FFI",
8
+ helpTopic: "Hello",
9
+ enableConfiguration: false,
10
+ options: [],
11
+ positionals: [],
12
+ execute: async (context: Context) => {
13
+ const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
14
+ await printerService?.print("Hello ");
15
+ world();
16
+ },
17
+ };
18
+
19
+ export default helloRustCommand;
@@ -1,8 +1,9 @@
1
- import type { CommandFactory } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import type { CommandFactory } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import helloCommand from "../command/HelloCommand.ts";
3
+ import helloRustCommand from "../command/HelloRustCommand.ts";
3
4
 
4
5
  export default class DemoCommandFactory implements CommandFactory {
5
6
  getCommands() {
6
- return [helloCommand];
7
+ return [helloCommand, helloRustCommand];
7
8
  }
8
9
  }
@@ -1,4 +1,4 @@
1
- import type { ServiceProviderFactory } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import type { ServiceProviderFactory } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import DemoServiceProvider from "../service/DemoServiceProvider.ts";
3
3
 
4
4
  export default class DemoServiceProviderFactory implements ServiceProviderFactory {
package/src/plugin.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { createCLIPlugin } from "@flowscripter/dynamic-cli-framework/cli-plugin";
1
+ import { createCLIPlugin } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import DemoCommandFactory from "./factory/DemoCommandFactory.ts";
3
3
  import DemoServiceProviderFactory from "./factory/DemoServiceProviderFactory.ts";
4
4
 
@@ -3,7 +3,7 @@ import type {
3
3
  ServiceInfo,
4
4
  CLIConfig,
5
5
  Context,
6
- } from "@flowscripter/dynamic-cli-framework/cli-plugin";
6
+ } from "@flowscripter/dynamic-cli-framework-api";
7
7
  import { DEMO_SERVICE_ID } from "./DemoService.ts";
8
8
  import DefaultDemoService from "./DefaultDemoService.ts";
9
9