@flowscripter/example-cli 1.7.0 → 1.8.1

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
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "lockfileVersion": 1,
3
- "configVersion": 0,
3
+ "configVersion": 1,
4
4
  "workspaces": {
5
5
  "": {
6
6
  "name": "@flowscripter/example-cli",
7
7
  "dependencies": {
8
- "@flowscripter/dynamic-cli-framework": "2.3.3",
9
- "@flowscripter/dynamic-cli-framework-api": "^1.2.0",
10
- "@flowscripter/dynamic-plugin-framework": "1.11.1",
8
+ "@flowscripter/dynamic-cli-framework": "5.0.0",
9
+ "@flowscripter/dynamic-cli-framework-api": "^1.5.0",
10
+ "@flowscripter/dynamic-plugin-framework": "2.0.0",
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/bun": "^1.3.14",
@@ -21,11 +21,11 @@
21
21
  },
22
22
  },
23
23
  "packages": {
24
- "@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@2.3.3", "", { "dependencies": { "@flowscripter/dynamic-cli-framework-api": "^1.2.0", "@flowscripter/dynamic-plugin-framework": "1.11.1", "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.11.0", "highlight.js": "^11.11.1", "prettier": "^3.9.4", "semver": "^7.7.3", "supports-color": "^10.2.2", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "typescript": "^6.0.3" } }, "sha512-neY8YtiBHMU8IkBU1k5i1wECbDrDG4J1eyLbTi4RZwEIqzDl285/QLbXbEuNAnHiLZTphN/2YEDaEJxQ94mqnA=="],
24
+ "@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@5.0.0", "", { "dependencies": { "@flowscripter/dynamic-cli-framework-api": "^2.0.0", "@flowscripter/dynamic-plugin-framework": "2.0.0", "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.11.0", "highlight.js": "^11.11.1", "prettier": "^3.9.4", "semver": "^7.7.3", "supports-color": "^10.2.2", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "typescript": "^6.0.3" } }, "sha512-jkM3SXllQIHLVlyDhYMIADTCg+BQfORLWd7GF+ZDjmym+gt8b7xD4PxOmBieODrehgZAACzxzS/hJvMaFFrfLA=="],
25
25
 
26
- "@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@1.2.0", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-ajR6PwQQwsQN96OH3OwO0SH5h3TGY3lLPM5lIYNUCpUXrOZ9MYJtsXvDcDKz8U/heWe0FBJeRY0nsNDJV4p9Vw=="],
26
+ "@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@1.5.0", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-Tjs5rtaL7kEVZAdO2bM1vdbzCp5R5qGJxRFif6T1uilV5qQaVF92t1R90ndjSSb9G9KnyTDdhHe+NbpDOllvtA=="],
27
27
 
28
- "@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@1.11.1", "", { "dependencies": { "semver": "^7.8.5" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-m8bioReoQzzm7uj3sxXLH7Haclyj1UWnPCSxy2QXvGQ2yp24H1GnzqohVnXo3JfBpJzmCUAaHT+lAhYu9Gh6Aw=="],
28
+ "@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.0.0", "", { "dependencies": { "semver": "^7.8.5" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-LPq4JXqsWttvNgE7Z5fim3h78xfeF/754gL7yI4PMjxfIvAZeyJhqsUElXOMEzNIrY9bXTqVWQJBpKO0+Vl61A=="],
29
29
 
30
30
  "@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.56.0", "", { "os": "android", "cpu": "arm" }, "sha512-CSCxi7ovYojgfdPOdUb9T508HKeAdDIKeRGg7x8IZwVJrWz9gVgX7MbUnFqtQAE4QvoNo07mj2JlwnOzJw4qqA=="],
31
31
 
@@ -105,15 +105,15 @@
105
105
 
106
106
  "@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
107
107
 
108
- "@types/hast": ["@types/hast@3.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ=="],
108
+ "@types/hast": ["@types/hast@3.0.5", "", { "dependencies": { "@types/unist": "*" } }, "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g=="],
109
109
 
110
- "@types/node": ["@types/node@26.1.0", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-O0A1G3xPGy4w7AgQdAQYUlQ+BKk2Oovw8eRpofyp5KdBZULnbe+WqaOVNrm705SHphCiG4XHsACrSmPu1f+Kgw=="],
110
+ "@types/node": ["@types/node@26.1.1", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw=="],
111
111
 
112
112
  "@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
113
113
 
114
114
  "bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
115
115
 
116
- "chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="],
116
+ "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
117
117
 
118
118
  "commander": ["commander@14.0.3", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],
119
119
 
@@ -125,7 +125,7 @@
125
125
 
126
126
  "fastest-levenshtein": ["fastest-levenshtein@1.0.16", "", {}, "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg=="],
127
127
 
128
- "figlet": ["figlet@1.11.0", "", { "dependencies": { "commander": "^14.0.0" }, "bin": { "figlet": "bin/index.js" } }, "sha512-EEx3OS/l2bFqcUNN2NM9FPJp8vAMrgbCxsbl2hbcJNNxOEwVe3mEzrhan7TbJQViZa8mMqhihlbCaqD+LyYKTQ=="],
128
+ "figlet": ["figlet@1.11.3", "", { "dependencies": { "commander": "^14.0.0" }, "bin": { "figlet": "bin/index.js" } }, "sha512-7+OS4S6VjQXI2XRvfZlOdHhItd25lI0NgrR1j5UHfuyZfmMh44v65tMQUlb2bSriYGPCHAtGhuY5u23vqelvmg=="],
129
129
 
130
130
  "highlight.js": ["highlight.js@11.11.1", "", {}, "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w=="],
131
131
 
@@ -135,7 +135,7 @@
135
135
 
136
136
  "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=="],
137
137
 
138
- "prettier": ["prettier@3.9.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-yWG/o/4oJfo036EKAfK6ACAoDOfHeRHx4tuxkfBZiauURiaSmYwlpOr5LQqKtIkRD2z1PLteme2WoxEnj4tHTg=="],
138
+ "prettier": ["prettier@3.9.6", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g=="],
139
139
 
140
140
  "semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
141
141
 
@@ -149,12 +149,10 @@
149
149
 
150
150
  "undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
151
151
 
152
- "bun-types/@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
152
+ "@flowscripter/dynamic-cli-framework/@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@2.0.0", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-jeSfXanm+RED9zKSxStOJYmDRi3t7bAaDNSQxI+KhraUMb0iTt+TiWPmDZyBN/Bc76hDX9W/lqN7041OALl2pA=="],
153
153
 
154
154
  "emphasize/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
155
155
 
156
156
  "lowlight/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
157
-
158
- "bun-types/@types/node/undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
159
157
  }
160
158
  }
@@ -1,10 +1,19 @@
1
1
  import os
2
2
  import platform
3
+ import sys
3
4
 
4
5
  from support.pexpect_wrapper import PExpectWrapper
5
6
 
6
7
  IS_WINDOWS = platform.system() == 'Windows'
7
8
 
9
+ if IS_WINDOWS:
10
+ # Windows' legacy console codepage (e.g. cp1252) cannot encode several Unicode icons used
11
+ # in example-cli's coloured output (e.g. the U+203C alert icon), crashing behave's pretty
12
+ # formatter with UnicodeEncodeError whenever a failure message contains one. Reconfigure
13
+ # the streams to UTF-8, which covers them, before any output is written.
14
+ sys.stdout.reconfigure(encoding='utf-8', errors='replace')
15
+ sys.stderr.reconfigure(encoding='utf-8', errors='replace')
16
+
8
17
 
9
18
  def before_scenario(context, scenario):
10
19
 
@@ -31,6 +31,7 @@ class PExpectWrapper:
31
31
  def expect(self, message):
32
32
  assert self.child is not None
33
33
 
34
+ remaining = list(self.output)
34
35
  found = ''
35
36
  while len(self.output) > 0:
36
37
  next_line = self.output.pop(0)
@@ -39,7 +40,7 @@ class PExpectWrapper:
39
40
  found = next_line
40
41
  break
41
42
 
42
- assert found != '', 'expected {} in output'.format(message)
43
+ assert found != '', 'expected "{}" in output, got: {!r}'.format(message, remaining)
43
44
 
44
45
  def expect_eof(self):
45
46
  assert self.child is not None
@@ -1,3 +1,4 @@
1
+ import platform
1
2
  import shlex
2
3
  import subprocess
3
4
  import logging
@@ -5,6 +6,24 @@ import logging
5
6
  log = logging.getLogger("subprocess_wrapper")
6
7
 
7
8
 
9
+ def _dump_process_tree():
10
+ # TEMPORARY: diagnosing an intermittent Windows-only hang in `plugin:add`. Dumps the OS
11
+ # process list on timeout so we can see whether a child npm/node process is stuck vs. our
12
+ # own process. Remove once root-caused.
13
+ try:
14
+ if platform.system() == 'Windows':
15
+ out = subprocess.run(
16
+ ['tasklist', '/v'], capture_output=True, text=True, timeout=10
17
+ ).stdout
18
+ else:
19
+ out = subprocess.run(
20
+ ['ps', '-ef'], capture_output=True, text=True, timeout=10
21
+ ).stdout
22
+ print('DEBUG: process list at timeout:\n{}'.format(out), flush=True)
23
+ except Exception as e:
24
+ print('DEBUG: failed to dump process list: {}'.format(e), flush=True)
25
+
26
+
8
27
  class SubprocessWrapper:
9
28
 
10
29
  def __init__(self, executable):
@@ -15,14 +34,24 @@ class SubprocessWrapper:
15
34
 
16
35
  def run(self, args='', stdin_text=None, timeout=30):
17
36
  cmd = [self.executable] + (shlex.split(args) if args else [])
18
- log.debug('running: {}'.format(cmd))
19
- result = subprocess.run(
20
- cmd, capture_output=True, text=True, timeout=timeout, input=stdin_text,
21
- encoding='utf-8', errors='replace'
22
- )
37
+ # TEMPORARY: plain print() (not logging.debug) so this shows up in CI output regardless
38
+ # of behave's default log-capture level, while diagnosing an intermittent Windows-only
39
+ # hang in `plugin:add`. Remove once root-caused.
40
+ print('DEBUG: running: {}'.format(cmd), flush=True)
41
+ try:
42
+ result = subprocess.run(
43
+ cmd, capture_output=True, text=True, timeout=timeout, input=stdin_text,
44
+ encoding='utf-8', errors='replace'
45
+ )
46
+ except subprocess.TimeoutExpired as e:
47
+ print('DEBUG: TIMED OUT after {}s'.format(timeout), flush=True)
48
+ print('DEBUG: partial stdout: {!r}'.format(e.stdout), flush=True)
49
+ print('DEBUG: partial stderr: {!r}'.format(e.stderr), flush=True)
50
+ _dump_process_tree()
51
+ raise
23
52
  self.stdout = result.stdout
24
53
  self.stderr = result.stderr
25
54
  self.returncode = result.returncode
26
- log.debug('stdout: {!r}'.format(self.stdout))
27
- log.debug('stderr: {!r}'.format(self.stderr))
28
- log.debug('returncode: {}'.format(self.returncode))
55
+ print('DEBUG: stdout: {!r}'.format(self.stdout), flush=True)
56
+ print('DEBUG: stderr: {!r}'.format(self.stderr), flush=True)
57
+ print('DEBUG: returncode: {}'.format(self.returncode), flush=True)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/example-cli",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
4
4
  "description": "Simple example CLI using https://github.com/flowscripter/dynamic-cli-framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -24,9 +24,9 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@flowscripter/dynamic-cli-framework": "2.3.3",
28
- "@flowscripter/dynamic-cli-framework-api": "^1.2.0",
29
- "@flowscripter/dynamic-plugin-framework": "1.11.1"
27
+ "@flowscripter/dynamic-cli-framework": "5.0.0",
28
+ "@flowscripter/dynamic-cli-framework-api": "^1.5.0",
29
+ "@flowscripter/dynamic-plugin-framework": "2.0.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/bun": "^1.3.14",
package/src/cli.ts CHANGED
@@ -2,16 +2,11 @@ import {
2
2
  AsciiBannerGeneratorServiceProvider,
3
3
  BannerServiceProvider,
4
4
  DataDumpGeneratorServiceProvider,
5
- launchDynamicPluginMultiCommandCLI,
5
+ launchMultiCommandCLI,
6
6
  SyntaxHighlighterServiceProvider,
7
7
  TreePrinterServiceProvider,
8
8
  } from "@flowscripter/dynamic-cli-framework";
9
9
  import { SupportedArch, SupportedOs } from "@flowscripter/dynamic-cli-framework-api";
10
- import {
11
- NpmPluginManager,
12
- NpmPluginRepository,
13
- NpmjsPluginRepository,
14
- } from "@flowscripter/dynamic-plugin-framework";
15
10
  import demo from "./commands/demo.ts";
16
11
  import packageJson from "../package.json";
17
12
  import path from "node:path";
@@ -19,19 +14,8 @@ import os from "node:os";
19
14
 
20
15
  export async function cli(): Promise<void> {
21
16
  const pluginsDir = path.join(os.homedir(), ".example-cli", "plugins", "node_modules");
22
- const pluginManager = new NpmPluginManager(
23
- [
24
- new NpmjsPluginRepository({
25
- name: "npmjs",
26
- registryUrl: "https://registry.npmjs.org",
27
- packageJsonNamespace: "dynamic-cli-framework",
28
- }),
29
- ],
30
- new NpmPluginRepository(pluginsDir, "dynamic-cli-framework"),
31
- );
32
17
 
33
- await launchDynamicPluginMultiCommandCLI(
34
- pluginManager,
18
+ await launchMultiCommandCLI(
35
19
  [demo],
36
20
  "Simple example CLI using dynamic-cli-framework.",
37
21
  "example-cli",
@@ -51,7 +35,18 @@ export async function cli(): Promise<void> {
51
35
  completionServiceEnabled: true,
52
36
  imagePrinterServiceEnabled: true,
53
37
  spawnServiceEnabled: true,
38
+ fetchServiceEnabled: true,
54
39
  upgradeServiceEnabled: true,
40
+ pluginServiceEnabled: true,
41
+ pluginServiceRemoteConfig: {
42
+ name: "npmjs",
43
+ registryUrl: "https://registry.npmjs.org",
44
+ packageJsonNamespace: "dynamic-cli-framework",
45
+ },
46
+ pluginServiceLocalConfig: {
47
+ nodeModulesPath: pluginsDir,
48
+ packageJsonNamespace: "dynamic-cli-framework",
49
+ },
55
50
  upgradeLocationsConfig: {
56
51
  supportedPlatforms: [
57
52
  { os: SupportedOs.LINUX, arch: SupportedArch.X64 },
@@ -1,6 +1,6 @@
1
1
  import {
2
- type ArgumentValues,
3
- ArgumentValueTypeName,
2
+ type Values,
3
+ ValueTypeName,
4
4
  ComplexValueTypeName,
5
5
  type Context,
6
6
  PRINTER_SERVICE_ID,
@@ -17,21 +17,21 @@ const argParsing: SubCommand = {
17
17
  {
18
18
  name: "booleanOption",
19
19
  description: "A boolean option",
20
- type: ArgumentValueTypeName.BOOLEAN,
20
+ type: ValueTypeName.BOOLEAN,
21
21
  shortAlias: "b",
22
22
  isOptional: true,
23
23
  },
24
24
  {
25
25
  name: "numberOption",
26
26
  description: "A number option",
27
- type: ArgumentValueTypeName.NUMBER,
27
+ type: ValueTypeName.NUMBER,
28
28
  shortAlias: "n",
29
29
  isOptional: true,
30
30
  },
31
31
  {
32
32
  name: "stringOption",
33
33
  description: "A string option",
34
- type: ArgumentValueTypeName.STRING,
34
+ type: ValueTypeName.STRING,
35
35
  shortAlias: "s",
36
36
  isOptional: true,
37
37
  },
@@ -45,7 +45,7 @@ const argParsing: SubCommand = {
45
45
  {
46
46
  name: "numberSubOption",
47
47
  description: "A number sub-option",
48
- type: ArgumentValueTypeName.NUMBER,
48
+ type: ValueTypeName.NUMBER,
49
49
  shortAlias: "n",
50
50
  isArray: true,
51
51
  },
@@ -56,17 +56,17 @@ const argParsing: SubCommand = {
56
56
  {
57
57
  name: "booleanPositional",
58
58
  description: "A boolean positional",
59
- type: ArgumentValueTypeName.BOOLEAN,
59
+ type: ValueTypeName.BOOLEAN,
60
60
  },
61
61
  {
62
62
  name: "numberPositional",
63
63
  description: "A number positional",
64
- type: ArgumentValueTypeName.NUMBER,
64
+ type: ValueTypeName.NUMBER,
65
65
  },
66
66
  {
67
67
  name: "stringPositional",
68
68
  description: "A string positional",
69
- type: ArgumentValueTypeName.STRING,
69
+ type: ValueTypeName.STRING,
70
70
  },
71
71
  ],
72
72
  usageExamples: [
@@ -114,7 +114,7 @@ const argParsing: SubCommand = {
114
114
  ],
115
115
  },
116
116
  ],
117
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
117
+ async execute(context: Context, argumentValues: Values): Promise<void> {
118
118
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
119
119
  const highlighterService = context.getServiceById(
120
120
  SYNTAX_HIGHLIGHTER_SERVICE_ID,
@@ -1,5 +1,5 @@
1
1
  import {
2
- type ArgumentValues,
2
+ type Values,
3
3
  ASCII_BANNER_GENERATOR_SERVICE_ID,
4
4
  type AsciiBannerGeneratorService,
5
5
  ChiselFontAsciiBannerGeneratorService,
@@ -14,7 +14,7 @@ const banners: SubCommand = {
14
14
  description: "Demonstrates chisel font ASCII banner and ASCII banner subtitle",
15
15
  options: [],
16
16
  positionals: [],
17
- execute: async (context: Context, _argumentValues: ArgumentValues): Promise<void> => {
17
+ execute: async (context: Context, _argumentValues: Values): Promise<void> => {
18
18
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
19
  const asciiBannerService = context.getServiceById(
20
20
  ASCII_BANNER_GENERATOR_SERVICE_ID,
@@ -1,6 +1,6 @@
1
1
  import process from "node:process";
2
2
  import {
3
- type ArgumentValues,
3
+ type Values,
4
4
  COMPLETION_SERVICE_ID,
5
5
  type CompletionService,
6
6
  type Context,
@@ -15,7 +15,7 @@ const completion: SubCommand = {
15
15
  description: "Demonstrates shell completion service",
16
16
  options: [],
17
17
  positionals: [],
18
- execute: async (context: Context, _argumentValues: ArgumentValues): Promise<void> => {
18
+ execute: async (context: Context, _argumentValues: Values): Promise<void> => {
19
19
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
20
20
  const completionService = context.getServiceById(COMPLETION_SERVICE_ID) as CompletionService;
21
21
 
@@ -1,5 +1,5 @@
1
1
  import {
2
- type ArgumentValues,
2
+ type Values,
3
3
  type Context,
4
4
  KEY_VALUE_SERVICE_ID,
5
5
  type KeyValueService,
@@ -7,34 +7,35 @@ import {
7
7
  type PrinterService,
8
8
  type SubCommand,
9
9
  } from "@flowscripter/dynamic-cli-framework";
10
+ import { Secret } from "@flowscripter/dynamic-cli-framework-api";
10
11
 
11
12
  const configuration: SubCommand = {
12
13
  name: "configuration",
13
14
  description: "Demonstrates secrets storage and key-value service",
14
15
  options: [],
15
16
  positionals: [],
16
- async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
17
+ async execute(context: Context, _argumentValues: Values): Promise<void> {
17
18
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
18
19
  const keyValueService = context.getServiceById(KEY_VALUE_SERVICE_ID) as KeyValueService;
19
20
 
20
21
  // --- Key-Value Storage ---
21
22
  await printerService.print("--- Key-Value Storage ---\n");
22
23
 
23
- await keyValueService.setKey("demo-string", "hello world");
24
- await keyValueService.setKey("demo-number", "42");
25
- await keyValueService.setKey("demo-json", '{"enabled":true,"retries":3}');
24
+ await keyValueService.set("demo-string", "hello world");
25
+ await keyValueService.set("demo-number", "42");
26
+ await keyValueService.set("demo-json", '{"enabled":true,"retries":3}');
26
27
 
27
28
  const keys = ["demo-string", "demo-number", "demo-json"];
28
29
  for (const key of keys) {
29
- const value = await keyValueService.getKey(key);
30
+ const value = await keyValueService.get(key);
30
31
  await printerService.print(` ${key} = ${value}\n`);
31
32
  }
32
33
 
33
- const missing = await keyValueService.hasKey("demo-nonexistent");
34
+ const missing = await keyValueService.has("demo-nonexistent");
34
35
  await printerService.print(` demo-nonexistent exists: ${missing}\n`);
35
36
 
36
37
  for (const key of keys) {
37
- await keyValueService.deleteKey(key);
38
+ await keyValueService.delete(key);
38
39
  }
39
40
  await printerService.print("Cleaned up keys\n");
40
41
 
@@ -42,17 +43,17 @@ const configuration: SubCommand = {
42
43
  await printerService.print("--- Secret Storage ---\n");
43
44
 
44
45
  try {
45
- await keyValueService.setKey("demo-api-key", "sk-secret-12345", true);
46
+ await keyValueService.set("demo-api-key", new Secret("sk-secret-12345"));
46
47
  await printerService.print("Stored secret: demo-api-key\n");
47
48
 
48
- const exists = await keyValueService.hasKey("demo-api-key");
49
+ const exists = await keyValueService.has("demo-api-key");
49
50
  await printerService.print(`Key exists: ${exists}\n`);
50
51
 
51
- const secret = await keyValueService.getKey("demo-api-key");
52
+ const secret = await keyValueService.get<string>("demo-api-key");
52
53
  const masked = secret.substring(0, 3) + "***";
53
54
  await printerService.print(`Retrieved secret (masked): ${masked}\n`);
54
55
 
55
- await keyValueService.deleteKey("demo-api-key");
56
+ await keyValueService.delete("demo-api-key");
56
57
  await printerService.print("Deleted secret: demo-api-key\n");
57
58
  } catch (error) {
58
59
  await printerService.warn(
@@ -1,5 +1,5 @@
1
1
  import {
2
- type ArgumentValues,
2
+ type Values,
3
3
  type Context,
4
4
  IMAGE_PRINTER_SERVICE_ID,
5
5
  type ImagePrinterService,
@@ -14,7 +14,7 @@ const image: SubCommand = {
14
14
  description: "Demonstrates image rendering in the terminal",
15
15
  options: [],
16
16
  positionals: [],
17
- execute: async (context: Context, _argumentValues: ArgumentValues): Promise<void> => {
17
+ execute: async (context: Context, _argumentValues: Values): Promise<void> => {
18
18
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
19
  const imagePrinterService = context.getServiceById(
20
20
  IMAGE_PRINTER_SERVICE_ID,
@@ -1,5 +1,5 @@
1
1
  import {
2
- type ArgumentValues,
2
+ type Values,
3
3
  type Context,
4
4
  Icon,
5
5
  PRINTER_SERVICE_ID,
@@ -18,7 +18,7 @@ const interruption: SubCommand = {
18
18
  description: "Demonstrates graceful shutdown with signal handling (press Ctrl+C to interrupt)",
19
19
  options: [],
20
20
  positionals: [],
21
- execute: async (context: Context, _argumentValues: ArgumentValues): Promise<void> => {
21
+ execute: async (context: Context, _argumentValues: Values): Promise<void> => {
22
22
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
23
23
  const shutdownService = context.getServiceById(SHUTDOWN_SERVICE_ID) as ShutdownService;
24
24
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Align,
3
- type ArgumentValues,
3
+ type Values,
4
4
  ASCII_BANNER_GENERATOR_SERVICE_ID,
5
5
  type AsciiBannerGeneratorService,
6
6
  type Context,
@@ -31,7 +31,7 @@ const printing: SubCommand = {
31
31
  description: "Demonstrates printer, tree, table, data dump, and banner output features",
32
32
  options: [],
33
33
  positionals: [],
34
- execute: async (context: Context, _argumentValues: ArgumentValues): Promise<void> => {
34
+ execute: async (context: Context, _argumentValues: Values): Promise<void> => {
35
35
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
36
36
  const asciiBannerGenerator = context.getServiceById(
37
37
  ASCII_BANNER_GENERATOR_SERVICE_ID,
@@ -1,6 +1,6 @@
1
1
  import {
2
- type ArgumentValues,
3
- ArgumentValueTypeName,
2
+ type Values,
3
+ ValueTypeName,
4
4
  type Context,
5
5
  PRINTER_SERVICE_ID,
6
6
  type PrinterService,
@@ -19,7 +19,7 @@ const prompting: SubCommand = {
19
19
  {
20
20
  name: "age",
21
21
  description: "Your age",
22
- type: ArgumentValueTypeName.NUMBER,
22
+ type: ValueTypeName.NUMBER,
23
23
  shortAlias: "a",
24
24
  isOptional: true,
25
25
  validate: (value): string | undefined => {
@@ -35,7 +35,7 @@ const prompting: SubCommand = {
35
35
  {
36
36
  name: "name",
37
37
  description: "Your name (must be at least 2 characters)",
38
- type: ArgumentValueTypeName.STRING,
38
+ type: ValueTypeName.STRING,
39
39
  validate: (value): string | undefined => {
40
40
  const str = value as string;
41
41
  if (str.length < 2) {
@@ -45,7 +45,7 @@ const prompting: SubCommand = {
45
45
  },
46
46
  },
47
47
  ],
48
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
48
+ async execute(context: Context, argumentValues: Values): Promise<void> {
49
49
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
50
50
  const prompterService = context.getServiceById(PROMPTER_SERVICE_ID) as PrompterService;
51
51