@flowscripter/flowscripter-io-cli 3.0.19 → 3.1.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/.claude/CLAUDE.md CHANGED
@@ -5,3 +5,5 @@
5
5
  - Since Plan 4 (PR #31): `cli()` runs `ProviderRegistry.discover()` before `launchMultiCommandCLI`; commands are `createXCommand(registry)` factories; locations are `ComplexOption`s (`--source.protocol=file --source.file.path=... --source.file.filename=...`) built by `zodToComplexOption` from each factory's `locationSchema`; Ctrl-C uses `ShutdownService.enterLongRunningMode` plus our own SIGINT listener (1st = stop, 2nd = signal).
6
6
  - Tests mirror `src/` as `tests/<dir>/<Name>.test.ts`; fixtures in `tests/fixtures/` (`installFilesystemPlugin` symlinks the devDependency plugin into a temp store via `FLOWSCRIPTER_IO_CLI_PLUGINS_PATH`).
7
7
  - dynamic-cli-framework before 8.0.1 cached nested option lookups by parent name only, so `--properties.file.*` collided with `--location.file.*` (dcf PR #228).
8
+ - Framework services enabled in `getCLIFeatureOptions()` (`src/cli.ts`): argument prompter, spawn, plugin, config file, key-value, fetch and upgrade. Config file and key-value are on for the upgrade service, which stores the auto-upgrade answer under `key-values.services["@flowscripter/dynamic-cli-framework/upgrade-service"]["upgrade-status"]` in `~/.flowscripteriocli.json` (the framework strips hyphens from the CLI name). Upgrade locations mirror example-cli's: Linux x64/arm64, macOS arm64 (no x64 asset), Windows x64/arm64.
9
+ - `functional_tests/features/upgrade.feature` runs `upgrade` against the real GitHub release, so it can install a newer release in the runner, and fails during a GitHub outage.
package/README.md CHANGED
@@ -38,6 +38,28 @@ Via [Winget](https://github.com/microsoft/winget-cli):
38
38
  You can download and extract the binary zip files from the
39
39
  [releases](https://github.com/flowscripter/flowscripter-io-cli/releases) page.
40
40
 
41
+ ## Upgrading
42
+
43
+ `flowscripter-io-cli --upgrade` checks the latest GitHub release and, when it
44
+ is newer, installs it with the method the CLI was installed with: Homebrew on
45
+ macOS, the install script on Linux, winget on Windows, or the release zip
46
+ otherwise. When the installed version is already the latest it says so.
47
+
48
+ `--install-method=<method>` overrides the detected method. The allowed methods
49
+ are `homebrew` and `github-release` on macOS, `linux-script` and
50
+ `github-release` on Linux, and `winget` and `github-release` on Windows.
51
+
52
+ The first interactive run asks once whether to enable automatic upgrades. With
53
+ "Yes", each later run checks for and installs a newer version before running
54
+ the command. With "No", it never asks again. The answer is stored in the
55
+ configuration file, `~/.flowscripteriocli.json` by default; remove the
56
+ `upgrade-status` entry under `key-values` to be asked again. Non-interactive
57
+ runs (no TTY) never prompt, and a failed version check never stops the
58
+ command.
59
+
60
+ The global `--config <path>` option sets a different configuration file, and
61
+ the `config:*` commands manage stored default option values.
62
+
41
63
  ## Locations
42
64
 
43
65
  Every command addresses data through a location argument: `--source` and
package/bun.lock CHANGED
@@ -5,16 +5,16 @@
5
5
  "": {
6
6
  "name": "@flowscripter/flowscripter-io-cli",
7
7
  "dependencies": {
8
- "@flowscripter/dynamic-cli-framework": "^12.2.8",
9
- "@flowscripter/dynamic-cli-framework-api": "^5.1.11",
10
- "@flowscripter/dynamic-plugin-framework": "^2.3.8",
11
- "@flowscripter/flowscripter-io-cli-hash-native": "^2.0.11",
12
- "@flowscripter/pluggable-io-framework": "^2.1.16",
13
- "@flowscripter/pluggable-io-framework-api": "^3.1.12",
8
+ "@flowscripter/dynamic-cli-framework": "^12.2.13",
9
+ "@flowscripter/dynamic-cli-framework-api": "^5.1.13",
10
+ "@flowscripter/dynamic-plugin-framework": "^2.3.10",
11
+ "@flowscripter/flowscripter-io-cli-hash-native": "^2.0.13",
12
+ "@flowscripter/pluggable-io-framework": "^2.1.18",
13
+ "@flowscripter/pluggable-io-framework-api": "^3.1.14",
14
14
  "zod": "^4.6.7",
15
15
  },
16
16
  "devDependencies": {
17
- "@flowscripter/io-plugin-filesystem": "^2.0.13",
17
+ "@flowscripter/io-plugin-filesystem": "^2.0.15",
18
18
  "@types/bun": "^1.4.5",
19
19
  "@types/node": "^26.6.11",
20
20
  "oxfmt": "0.80.0",
@@ -26,19 +26,19 @@
26
26
  },
27
27
  },
28
28
  "packages": {
29
- "@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@12.2.8", "", { "dependencies": { "@flowscripter/dynamic-cli-framework-api": "^5.1.11", "@flowscripter/dynamic-plugin-framework": "^2.3.7", "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.13.0", "highlight.js": "^11.12.0", "prettier": "^3.10.1", "semver": "^7.8.6", "supports-color": "^11.0.0", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "@decimalturn/toml-patch": "^3.3.1", "typescript": "^7.0.2", "yaml": "^2.9.1" }, "optionalPeers": ["@decimalturn/toml-patch", "yaml"] }, "sha512-m6P3QuCigonug14osxrnvCoULtHYkqBS4xvYScjenB4U/BNCK8AC5TMZLQXoOdmqd0pSY9VQ3F/GDqarVb+Yxg=="],
29
+ "@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@12.2.13", "", { "dependencies": { "@flowscripter/dynamic-cli-framework-api": "^5.1.11", "@flowscripter/dynamic-plugin-framework": "^2.3.8", "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.13.0", "highlight.js": "^11.12.0", "prettier": "^3.10.1", "semver": "^7.8.6", "supports-color": "^11.0.0", "supports-terminal-graphics": "^0.1.0" }, "peerDependencies": { "@decimalturn/toml-patch": "^3.3.1", "typescript": "^7.0.2", "yaml": "^2.9.1" }, "optionalPeers": ["@decimalturn/toml-patch", "yaml"] }, "sha512-xsBnAuVolgRdeuKBTXsw2vU3Ycx4TJrzPlIbUUepO+dYUBbOJZ/S7V/kwX4acz+O9r9nHwMGWYPGPI6UfaDg5g=="],
30
30
 
31
- "@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@5.1.11", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-43w8bmiULjDK4hN436rczwTiaMQ7KdcvBACZydq7mhYiTRkQRNnhtRR1lHQutq7aoVbuYbzdC379VKB+TQw/qw=="],
31
+ "@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@5.1.13", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-RXCuvequ6W4AIfyRA6+Z6zypp+5CvJAaKoy+NV1RBx7OAOn8lu1x0+RdEcjI5OeOKsrsNmexJZG82n0onk4zVA=="],
32
32
 
33
- "@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.3.8", "", { "dependencies": { "semver": "^7.8.6" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-2PHjrg1/rdYuSKDMXHCOMuiSxhcb3BUA4PGzAaYqb8XDnUsf3po2sFh7qzakqr8JZXv1bkBaHzduiAHLcYwVjg=="],
33
+ "@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.3.10", "", { "dependencies": { "semver": "^7.8.6" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-mLHVWuuIAQo7bkJ7zVKQ5348u8YwT89MWJUKrXHyCJ/Ua8O9SYo4GBEH2LmABq+4L9B+Da4IhbvTK/frhlkbgw=="],
34
34
 
35
- "@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@2.0.11", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-ZAwpgcM1g/gL9qcgKsMqF0h9LJe7SX2za0bt0NBppiU8ZJo0F/YqtAzFj0La1LOIbzYKuRGNRdQbnRK/nyB2MA=="],
35
+ "@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@2.0.13", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-APF8cpRjAbncScSxY1C9cvBrEmc+MTiG7+ab303aIyaHpMdsGekzJ44SPs119utPzS0WGEhhdD2MmAuBkTgHJg=="],
36
36
 
37
- "@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@2.0.13", "", { "dependencies": { "@flowscripter/pluggable-io-framework-api": "^3.1.12", "zod": "^4.6.7" }, "peerDependencies": { "@flowscripter/dynamic-plugin-framework": "*", "typescript": "^7.0.2" } }, "sha512-3ZrNbvmv0TlznCAU8pWA7pE8Jb+24giDfwYNPlPUnHvxsbYIl/ai652w114eZVd9eFwXWY2ZRibNF47nhb7HAw=="],
37
+ "@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@2.0.15", "", { "dependencies": { "@flowscripter/pluggable-io-framework-api": "^3.1.12", "zod": "^4.6.7" }, "peerDependencies": { "@flowscripter/dynamic-plugin-framework": "*", "typescript": "^7.0.2" } }, "sha512-jeBS4Lt4FiVFbnP2c09sHoECqP+0OtNdEbOii512Lm3iIq5CAb5oaTaaLe8dKYJHt1wVn33VB9f7ONdkfFyv0w=="],
38
38
 
39
- "@flowscripter/pluggable-io-framework": ["@flowscripter/pluggable-io-framework@2.1.16", "", { "dependencies": { "@flowscripter/dynamic-plugin-framework": "^2.3.7", "@flowscripter/pluggable-io-framework-api": "^3.1.12" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-4f05rCrQEnY8QtCRw7wv9mJe9GHo18Ihtcnc2SfacU7xAscLLj3BmLFJpGusF6+CKxjE7jRRuWE9NdtULKqYqQ=="],
39
+ "@flowscripter/pluggable-io-framework": ["@flowscripter/pluggable-io-framework@2.1.18", "", { "dependencies": { "@flowscripter/dynamic-plugin-framework": "^2.3.8", "@flowscripter/pluggable-io-framework-api": "^3.1.12" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-ElizCWZRbx7ci0Tnw1jh9YG1YPRCF0Det215wwkVJvDM3UDtGAkBxH+K5QTN04yS3AUpG+DRhyt8LujN4lUNZg=="],
40
40
 
41
- "@flowscripter/pluggable-io-framework-api": ["@flowscripter/pluggable-io-framework-api@3.1.12", "", { "dependencies": { "zod": "^4.6.7", "zod-to-json-schema": "^3.25.2" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-kDGiN4goydnlCQQDDYpna9pVsnocw2oszusJ7h4G2VY/NxdnpItfgt9Kn8pWxVTU/7PCcAfoeNaWQlF06Vom3A=="],
41
+ "@flowscripter/pluggable-io-framework-api": ["@flowscripter/pluggable-io-framework-api@3.1.14", "", { "dependencies": { "zod": "^4.6.7", "zod-to-json-schema": "^3.25.2" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-ISBwdiqjsQHet1Ax9z4x9ciDhFS0e5SI4z03Vqpd1J/qvNfySN6JVuy9TFKn91ww+WNhoY/4zxaODHXmvfRLyg=="],
42
42
 
43
43
  "@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.80.0", "", { "os": "android", "cpu": "arm" }, "sha512-IKgbKL684l/0zb1yAIr7YkqmUsZmO6O02ELkb+78SLFsDJAJxCtPtLypHGUGNpeOrsdIHXIZMxYGo/9QYSHuhg=="],
44
44
 
@@ -50,3 +50,10 @@ def step_impl(context, text):
50
50
  def step_impl(context, text):
51
51
  assert text not in context.subprocess_wrapper.stdout, \
52
52
  'expected {!r} not in stdout {!r}'.format(text, context.subprocess_wrapper.stdout)
53
+
54
+
55
+ @then('the stdout should contain either "{first}" or "{second}"')
56
+ def step_impl(context, first, second):
57
+ stdout = context.subprocess_wrapper.stdout
58
+ assert first in stdout or second in stdout, \
59
+ 'expected {!r} or {!r} in stdout {!r}'.format(first, second, stdout)
@@ -0,0 +1,11 @@
1
+ Feature: Upgrade
2
+
3
+ Scenario: Help lists the upgrade command
4
+ When the executable stdout is captured for "--help"
5
+ Then the captured process should complete with exit code 0
6
+ And the stdout should contain "upgrade"
7
+
8
+ Scenario: Running upgrade either upgrades or reports already up to date
9
+ When the executable stdout is captured for "upgrade"
10
+ Then the captured process should complete with exit code 0
11
+ And the stdout should contain either "flowscripter-io-cli upgraded" or "flowscripter-io-cli is already up to date"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/flowscripter-io-cli",
3
- "version": "3.0.19",
3
+ "version": "3.1.1",
4
4
  "description": "CLI for https://github.com/flowscripter/pluggable-io-framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -21,16 +21,16 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
- "@flowscripter/dynamic-cli-framework": "^12.2.8",
25
- "@flowscripter/dynamic-cli-framework-api": "^5.1.11",
26
- "@flowscripter/dynamic-plugin-framework": "^2.3.8",
27
- "@flowscripter/flowscripter-io-cli-hash-native": "^2.0.11",
28
- "@flowscripter/pluggable-io-framework": "^2.1.16",
29
- "@flowscripter/pluggable-io-framework-api": "^3.1.12",
24
+ "@flowscripter/dynamic-cli-framework": "^12.2.13",
25
+ "@flowscripter/dynamic-cli-framework-api": "^5.1.13",
26
+ "@flowscripter/dynamic-plugin-framework": "^2.3.10",
27
+ "@flowscripter/flowscripter-io-cli-hash-native": "^2.0.13",
28
+ "@flowscripter/pluggable-io-framework": "^2.1.18",
29
+ "@flowscripter/pluggable-io-framework-api": "^3.1.14",
30
30
  "zod": "^4.6.7"
31
31
  },
32
32
  "devDependencies": {
33
- "@flowscripter/io-plugin-filesystem": "^2.0.13",
33
+ "@flowscripter/io-plugin-filesystem": "^2.0.15",
34
34
  "@types/bun": "^1.4.5",
35
35
  "@types/node": "^26.6.11",
36
36
  "oxfmt": "0.80.0",
package/src/cli.ts CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  SyntaxHighlighterServiceProvider,
5
5
  launchMultiCommandCLI,
6
6
  } from "@flowscripter/dynamic-cli-framework";
7
+ import { SupportedArch, SupportedOs } from "@flowscripter/dynamic-cli-framework-api";
7
8
  import { createCopyCommand } from "./commands/copy.ts";
8
9
  import { createDeleteCommand } from "./commands/delete.ts";
9
10
  import { createGetPropertiesCommand } from "./commands/get-properties.ts";
@@ -20,10 +21,15 @@ import packageJson from "../package.json";
20
21
 
21
22
  export function getCLIFeatureOptions(): BaseCLIFeatureOptions {
22
23
  return {
24
+ // The key-value service, backed by the config file, stores the auto-upgrade answer.
25
+ configFileSupportEnabled: true,
26
+ keyValueServiceEnabled: true,
23
27
  argumentPrompterServiceEnabled: true,
24
28
  // The spawn service lets plugin:add/plugin:remove quote the package manager output and
25
29
  // clear it on success.
26
30
  spawnServiceEnabled: true,
31
+ fetchServiceEnabled: true,
32
+ upgradeServiceEnabled: true,
27
33
  pluginServiceEnabled: true,
28
34
  pluginServiceRemoteConfig: {
29
35
  name: "npmjs",
@@ -34,6 +40,31 @@ export function getCLIFeatureOptions(): BaseCLIFeatureOptions {
34
40
  nodeModulesPath: getPluginsNodeModulesPath(),
35
41
  packageJsonNamespace: PLUGGABLE_IO_FRAMEWORK_PACKAGE_JSON_NAMESPACE,
36
42
  },
43
+ upgradeLocationsConfig: {
44
+ supportedPlatforms: [
45
+ { os: SupportedOs.LINUX, arch: SupportedArch.X64 },
46
+ { os: SupportedOs.LINUX, arch: SupportedArch.ARM64 },
47
+ { os: SupportedOs.MACOS, arch: SupportedArch.ARM64 },
48
+ { os: SupportedOs.WINDOWS, arch: SupportedArch.X64 },
49
+ { os: SupportedOs.WINDOWS, arch: SupportedArch.ARM64 },
50
+ ],
51
+ githubRelease: {
52
+ owner: "flowscripter",
53
+ repo: "flowscripter-io-cli",
54
+ assetPattern: "flowscripter-io-cli_{os}_{arch}.zip",
55
+ },
56
+ linuxScript: {
57
+ scriptUrl:
58
+ "https://raw.githubusercontent.com/flowscripter/flowscripter-io-cli/main/script/install.sh",
59
+ },
60
+ homebrew: {
61
+ tap: "flowscripter/tap",
62
+ formula: "flowscripter-io-cli",
63
+ },
64
+ winget: {
65
+ packageId: "Flowscripter.flowscripter-io-cli",
66
+ },
67
+ },
37
68
  };
38
69
  }
39
70
 
package/tests/cli.test.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
+ import { SupportedArch, SupportedOs } from "@flowscripter/dynamic-cli-framework-api";
2
3
  import { getCLIFeatureOptions } from "../src/cli.ts";
3
4
 
4
5
  describe("getCLIFeatureOptions", () => {
@@ -7,4 +8,40 @@ describe("getCLIFeatureOptions", () => {
7
8
  expect(options.pluginServiceEnabled).toBeTrue();
8
9
  expect(options.spawnServiceEnabled).toBeTrue();
9
10
  });
11
+
12
+ test("enables the upgrade service and the services it depends on", () => {
13
+ const options = getCLIFeatureOptions();
14
+ expect(options.configFileSupportEnabled).toBeTrue();
15
+ expect(options.keyValueServiceEnabled).toBeTrue();
16
+ expect(options.fetchServiceEnabled).toBeTrue();
17
+ expect(options.upgradeServiceEnabled).toBeTrue();
18
+ expect(options.restartAfterAutoUpgrade).toBeUndefined();
19
+ });
20
+
21
+ test("supports only the platforms that have release assets", () => {
22
+ const platforms = getCLIFeatureOptions().upgradeLocationsConfig?.supportedPlatforms;
23
+ expect(platforms).toEqual([
24
+ { os: SupportedOs.LINUX, arch: SupportedArch.X64 },
25
+ { os: SupportedOs.LINUX, arch: SupportedArch.ARM64 },
26
+ { os: SupportedOs.MACOS, arch: SupportedArch.ARM64 },
27
+ { os: SupportedOs.WINDOWS, arch: SupportedArch.X64 },
28
+ { os: SupportedOs.WINDOWS, arch: SupportedArch.ARM64 },
29
+ ]);
30
+ expect(platforms).not.toContainEqual({ os: SupportedOs.MACOS, arch: SupportedArch.X64 });
31
+ });
32
+
33
+ test("points the upgrade locations at flowscripter-io-cli's own channels", () => {
34
+ const config = getCLIFeatureOptions().upgradeLocationsConfig;
35
+ expect(config?.githubRelease).toEqual({
36
+ owner: "flowscripter",
37
+ repo: "flowscripter-io-cli",
38
+ assetPattern: "flowscripter-io-cli_{os}_{arch}.zip",
39
+ });
40
+ expect(config?.linuxScript).toEqual({
41
+ scriptUrl:
42
+ "https://raw.githubusercontent.com/flowscripter/flowscripter-io-cli/main/script/install.sh",
43
+ });
44
+ expect(config?.homebrew).toEqual({ tap: "flowscripter/tap", formula: "flowscripter-io-cli" });
45
+ expect(config?.winget).toEqual({ packageId: "Flowscripter.flowscripter-io-cli" });
46
+ });
10
47
  });