@flowscripter/flowscripter-io-cli 0.1.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/.github/workflows/check-bun-dependencies.yml +12 -0
- package/.github/workflows/lint-pr-message.yml +13 -0
- package/.github/workflows/release-bun-executable.yml +17 -0
- package/.github/workflows/validate-bun-executable-pr.yml +10 -0
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/bun.lock +171 -0
- package/functional_tests/README.md +27 -0
- package/functional_tests/features/commands.feature +48 -0
- package/functional_tests/features/environment.py +44 -0
- package/functional_tests/features/plugin.feature +10 -0
- package/functional_tests/features/steps/executable.py +44 -0
- package/functional_tests/features/steps/io_commands.py +27 -0
- package/functional_tests/features/support/subprocess_wrapper.py +26 -0
- package/functional_tests/pip-requirements.txt +1 -0
- package/index.ts +3 -0
- package/package.json +40 -0
- package/src/cli.ts +35 -0
- package/src/commands/copy.ts +59 -0
- package/src/commands/delete.ts +36 -0
- package/src/commands/get-properties.ts +36 -0
- package/src/commands/hash.ts +60 -0
- package/src/commands/list.ts +58 -0
- package/src/commands/move.ts +55 -0
- package/src/commands/set-properties.ts +45 -0
- package/src/filesystemProvider.ts +40 -0
- package/src/pluginsDir.ts +21 -0
- package/tests/commands_test.ts +135 -0
- package/tests/testContext.ts +35 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
name: check-bun-dependencies
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 0 * * 1,4"
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
pull-requests: write
|
|
9
|
+
jobs:
|
|
10
|
+
call-check-bun-dependencies:
|
|
11
|
+
uses: flowscripter/.github/.github/workflows/check-bun-dependencies.yml@v1
|
|
12
|
+
secrets: inherit
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: release-bun-executable
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
issues: write
|
|
8
|
+
pull-requests: write
|
|
9
|
+
id-token: write
|
|
10
|
+
pages: write
|
|
11
|
+
packages: write
|
|
12
|
+
jobs:
|
|
13
|
+
call-release-bun-executable:
|
|
14
|
+
uses: flowscripter/.github/.github/workflows/release-bun-executable.yml@v1
|
|
15
|
+
secrets: inherit
|
|
16
|
+
with:
|
|
17
|
+
executable-name: "flowscripter-io-cli"
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Flowscripter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# flowscripter-io-cli
|
|
2
|
+
|
|
3
|
+
[](https://github.com/flowscripter/flowscripter-io-cli/releases)
|
|
4
|
+
[](https://github.com/flowscripter/flowscripter-io-cli/actions/workflows/release-bun-executable.yml)
|
|
5
|
+
[](https://github.com/flowscripter/flowscripter-io-cli/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
> Example CLI for
|
|
8
|
+
> [pluggable-io-framework](https://github.com/flowscripter/pluggable-io-framework),
|
|
9
|
+
> built on
|
|
10
|
+
> [dynamic-cli-framework](https://github.com/flowscripter/dynamic-cli-framework)
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
|
|
14
|
+
- `list <path> [--recursive] [--regex]` - list files/folders, one JSON line per item
|
|
15
|
+
- `get-properties <path>` - print size/lastModified/isFolder/mode as JSON
|
|
16
|
+
- `set-properties <path> [--mode]` - set file properties
|
|
17
|
+
- `delete <path>` - delete a file/folder
|
|
18
|
+
- `copy <source> <destination>` - copy a file, using a direct provider copy
|
|
19
|
+
when possible (with a progress bar via
|
|
20
|
+
[dynamic-cli-framework](https://github.com/flowscripter/dynamic-cli-framework)'s
|
|
21
|
+
`PrinterService`)
|
|
22
|
+
- `move <source> <destination>` - move a file, same direct-transfer/progress
|
|
23
|
+
behaviour as `copy`
|
|
24
|
+
- `hash <path> [--algorithm]` - hash a file by piping its readable stream
|
|
25
|
+
through a `Bun.CryptoHasher` (default `sha256`) - demonstrates consuming a
|
|
26
|
+
`pluggable-io-framework` stream directly, outside the framework itself
|
|
27
|
+
|
|
28
|
+
All commands operate against a filesystem source/sink provider - rooted at
|
|
29
|
+
`/`, so any absolute or cwd-relative path works, the same as any normal file
|
|
30
|
+
tool. **This package has no dependency on any provider plugin** - one must
|
|
31
|
+
be installed first via the CLI's own plugin management (provided by
|
|
32
|
+
[dynamic-cli-framework](https://github.com/flowscripter/dynamic-cli-framework)'s
|
|
33
|
+
`plugin` commands), then discovered purely through
|
|
34
|
+
[dynamic-plugin-framework](https://github.com/flowscripter/dynamic-plugin-framework)'s
|
|
35
|
+
`NpmPluginRepository` at runtime:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
bun run index.ts plugin:add @flowscripter/io-plugin-filesystem
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
bun run index.ts plugin:add @flowscripter/io-plugin-filesystem
|
|
45
|
+
bun run index.ts list .
|
|
46
|
+
bun run index.ts copy a.txt b.txt
|
|
47
|
+
bun run index.ts hash a.txt --algorithm sha256
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Development
|
|
51
|
+
|
|
52
|
+
Install dependencies:
|
|
53
|
+
|
|
54
|
+
`bun install`
|
|
55
|
+
|
|
56
|
+
Test:
|
|
57
|
+
|
|
58
|
+
`bun test`
|
|
59
|
+
|
|
60
|
+
Format:
|
|
61
|
+
|
|
62
|
+
`bunx oxfmt`
|
|
63
|
+
|
|
64
|
+
Lint:
|
|
65
|
+
|
|
66
|
+
`bunx oxlint index.ts src/ tests/`
|
|
67
|
+
|
|
68
|
+
## Functional Tests
|
|
69
|
+
|
|
70
|
+
Refer to [functional_tests/README.md](functional_tests/README.md)
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Refer to
|
|
75
|
+
[pluggable-io-framework](https://github.com/flowscripter/pluggable-io-framework),
|
|
76
|
+
[pluggable-io-framework-api](https://github.com/flowscripter/pluggable-io-framework-api)
|
|
77
|
+
and
|
|
78
|
+
[io-plugin-filesystem](https://github.com/flowscripter/io-plugin-filesystem)
|
|
79
|
+
for the contracts and orchestration this CLI is built on.
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT © Flowscripter
|
package/bun.lock
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 1,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "@flowscripter/flowscripter-io-cli",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@flowscripter/dynamic-cli-framework": "^5.1.1",
|
|
9
|
+
"@flowscripter/dynamic-cli-framework-api": "^1.5.0",
|
|
10
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.0",
|
|
11
|
+
"@flowscripter/pluggable-io-framework": "^1.0.0",
|
|
12
|
+
"@flowscripter/pluggable-io-framework-api": "^1.0.1",
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@flowscripter/io-plugin-filesystem": "^1.0.0",
|
|
16
|
+
"@types/bun": "^1.3.14",
|
|
17
|
+
"@types/node": "^24.0.0",
|
|
18
|
+
"oxfmt": "0.57.0",
|
|
19
|
+
"oxlint": "1.72.0",
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"typescript": "^6.0.3",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
"packages": {
|
|
27
|
+
"@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@5.3.3", "", { "dependencies": { "@flowscripter/dynamic-cli-framework-api": "^2.3.0", "@flowscripter/dynamic-plugin-framework": "^2.2.3", "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-f7tcXpg4I6V7Y65+nyQ3MriwgMDCsVs/UQuIcsgmqK2rvBp5BQ/aDyDX3sid197ubB7HERjvtUSyEOYFR28Zgw=="],
|
|
28
|
+
|
|
29
|
+
"@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@1.5.0", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-Tjs5rtaL7kEVZAdO2bM1vdbzCp5R5qGJxRFif6T1uilV5qQaVF92t1R90ndjSSb9G9KnyTDdhHe+NbpDOllvtA=="],
|
|
30
|
+
|
|
31
|
+
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.2.3", "", { "dependencies": { "semver": "^7.8.5" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-vLoGC2LktUVPWqA66CwSzZtjh09zSR2HTuLa8OMGDumePkgZD0UTE9D2jWsd3bFdqcy14eQf3IYRdDM47+wRKg=="],
|
|
32
|
+
|
|
33
|
+
"@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@1.0.2", "", { "dependencies": { "@flowscripter/pluggable-io-framework-api": "^1.0.1", "zod": "^4.4.3" }, "peerDependencies": { "@flowscripter/dynamic-plugin-framework": "*", "typescript": "^6.0.3" } }, "sha512-xM0ON9vap/GXCjyaf+uYemi+Ly0nwnZv0mocUtwwk0PFZAYPc5o0aHFQT4PWhoB6DhW3wykb4ey8vGoTo3hz2w=="],
|
|
34
|
+
|
|
35
|
+
"@flowscripter/pluggable-io-framework": ["@flowscripter/pluggable-io-framework@1.0.1", "", { "dependencies": { "@flowscripter/dynamic-plugin-framework": "^2.2.0", "@flowscripter/pluggable-io-framework-api": "^1.0.1" }, "peerDependencies": { "typescript": "^6.0.3" } }, "sha512-OT7ShiH+9b5KPy+B+7JcBvkFdOUJQwbSwokjLLPYphZE29iBydWJbcuwXNmiC6+BVhx5y5xfUEDDpjn3ql1MyQ=="],
|
|
36
|
+
|
|
37
|
+
"@flowscripter/pluggable-io-framework-api": ["@flowscripter/pluggable-io-framework-api@1.0.3", "", { "dependencies": { "zod": "^4.4.3", "zod-to-json-schema": "^3.25.2" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-2PrHigsOLAUCdLmrcPrncr5yPz1MIdUtfAnRg/gvkRm3yOLepVjTxwUrN93oUfTM4q/KKYvWCGIuzGoWGquQeQ=="],
|
|
38
|
+
|
|
39
|
+
"@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.57.0", "", { "os": "android", "cpu": "arm" }, "sha512-qVBsEO+KugOsCmUHcO8iqNnqc65p7PCKpCs8M66mPZ+Ri+CWbcpoQOEJBg2OTu03+0qu++NK1jj6IzvQVs0Sig=="],
|
|
40
|
+
|
|
41
|
+
"@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.57.0", "", { "os": "android", "cpu": "arm64" }, "sha512-mp6PibWbao3aizijcheOeHQaYEhcUAt8pwLniYbtLfHxL/psFF0BykAwCj+s3c6qIpa8yN8keZICWrqtZ70w8g=="],
|
|
42
|
+
|
|
43
|
+
"@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.57.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-T+0stuCBqmUVY+aMIvrgXhzGhHO3sD5tNiiEcYqgSdPsnukskQqn2u5qOVD0sv1l7RLdFS5Z/f5Wi9Ktyjr3Eg=="],
|
|
44
|
+
|
|
45
|
+
"@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.57.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-O+3JbqWs/mCI2oi4xfhRO2IVPFJNDDEBV8Odo+ZpmsUOeKJfjXoNH7nDmBEQcDgK7NfjDIyE7kRgYSZcTLDO0A=="],
|
|
46
|
+
|
|
47
|
+
"@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.57.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-pxwhxVC+JkLX9twOQ/8C/vbuOQcMZyKIDmiRDZfO7yITuVcIdZCiLRqqf4QOxb2+8FWrRXzQpm+1DBKcMpHSSQ=="],
|
|
48
|
+
|
|
49
|
+
"@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.57.0", "", { "os": "linux", "cpu": "arm" }, "sha512-pxBU4zH2imB/MDBfth2rOMeVxXUMjRQLCazagwLARIFH3hVlxZJBlM4nSnHXaIHJK4/qezoFCIORN6AY8Mra4A=="],
|
|
50
|
+
|
|
51
|
+
"@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.57.0", "", { "os": "linux", "cpu": "arm" }, "sha512-JAprOzt8tycYou36ZgEw14DlRHTiN8qdtKANdV3VZIRIvTI/lh/cX13c9pJ/EnDk2GT3FASH7KvCgQ2AufAifQ=="],
|
|
52
|
+
|
|
53
|
+
"@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.57.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-ajtjaxSaj9xl4BW7REt+Cef/ttzbAq00Bq4z7JUDZEfgFXdwSjH8K9bF+IcIJzZB9lKqMfQ4eHuSFOvvlvtqOg=="],
|
|
54
|
+
|
|
55
|
+
"@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.57.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-p4Y/+RYk9Bk5WO+zHSUXAClRmZ2fbJCejMuCAsU2HhyME4jqf6Ftt/mJYEwIah1wGCBDYOB7wEGV1x5bCEZ6hA=="],
|
|
56
|
+
|
|
57
|
+
"@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.57.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-By6tRALAZsno0F4zedmtG+wdMvJiJmJoXM4d3+A9zHE4HRXLqXITwRH8mgrlcXc5yJM2g2W3riRPwTYdgemZLQ=="],
|
|
58
|
+
|
|
59
|
+
"@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.57.0", "", { "os": "linux", "cpu": "none" }, "sha512-skYeG+RgvyzspqVEBsEprL90OYYZfoVNqB3HcCNR6QDJyXKOzfDRT3zncnHmUaFluIlBHuY23mU1b5WGgR98hA=="],
|
|
60
|
+
|
|
61
|
+
"@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.57.0", "", { "os": "linux", "cpu": "none" }, "sha512-FFgACrZOXAXUh5KQh2mt1CDOVOZmn+QzHP71wM9QobNwyQvoFfyAeefVUltW83g3sm7LTiH3yfFqLLVUpA5ZFQ=="],
|
|
62
|
+
|
|
63
|
+
"@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.57.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-Nm/BAOfQeFiiKd502mZn/GAVKJwtd0RdCg17G3Wz/WSOIQmDi3+7/SZH4BHn1Ye5KvTVH3ua8WvfwLLycNIuvA=="],
|
|
64
|
+
|
|
65
|
+
"@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.57.0", "", { "os": "linux", "cpu": "x64" }, "sha512-BiSy5Ku3mQqyxS6YIqAJgd403wEUWvI7kerfzPxc2l/txZVmZM0pSj7oDM+4bGBExowxOi7o73jEam1W0EDTZg=="],
|
|
66
|
+
|
|
67
|
+
"@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.57.0", "", { "os": "linux", "cpu": "x64" }, "sha512-BCRkJiotz5s9afLYD2LuMvzAoDYx9H17E/YbDyu4xK7l4zHDPeny9ErSXL//i/nJyaOwRk08x4b8cgJC00+JDg=="],
|
|
68
|
+
|
|
69
|
+
"@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.57.0", "", { "os": "none", "cpu": "arm64" }, "sha512-4Oaxe1qrGgXfpCJ1C/ERJ2iCtV2rN1R79ga9fsfyVHfSQRu/hVW780u2KDqZWFZ/iGTHODJji0JemxqFZ63eIQ=="],
|
|
70
|
+
|
|
71
|
+
"@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.57.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-MYLAsDnhdNsSGheLYhWgbk0vfIrlS84iQYun/y21fX6u0jj8iBtYtbpZMdiqYeuf8U12eVPUjVY2xE2NrCfJ0g=="],
|
|
72
|
+
|
|
73
|
+
"@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.57.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-PBwdzZALJY/jcCx2E6is0yu+cuVXeySTDmwuseD+9j0mHqlRNxwlKgsyRTBed/woPeqfVfuXfWjoq4Cx2Zt3Eg=="],
|
|
74
|
+
|
|
75
|
+
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.57.0", "", { "os": "win32", "cpu": "x64" }, "sha512-bQJdH9i4RRfw55jm7+8/xS7GzHLLTbHx4huhrrDxQJaJtbSDbsyOnODvP1ftT7EG0KFKAYO2S+q6AcioXODx8w=="],
|
|
76
|
+
|
|
77
|
+
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.72.0", "", { "os": "android", "cpu": "arm" }, "sha512-zhCmvn+1Mj3UchAc/90i99S0t7jJUsHmFVSPg4UWrjO8b8eaSGwscgO6QAUtvHBstkjQwBttQNswEnAF1mIQdA=="],
|
|
78
|
+
|
|
79
|
+
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.72.0", "", { "os": "android", "cpu": "arm64" }, "sha512-mtH+aY/ozv1eZoCUC2owjFAtyNBKHpJHygKeEu9zXXnQGW1Q2/qOpvx+I+Lf23+TvTz66F4iiXUbl2cGvoLPCQ=="],
|
|
80
|
+
|
|
81
|
+
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.72.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-EvnajNPDtfknB3ZieeOOyDTwJn9QXDiwfnF4ZDQqART6RG6hjY4WigQcZdGoK2dkB3e1vrmEzN9aYbQCUkh/gQ=="],
|
|
82
|
+
|
|
83
|
+
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.72.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-ZkCdEa/G80A7vEHfeCDz/+L3m33DE73v32mDKhgOIgz8Uwf0DFcK7+uu6qC+7LEhmz5fpOe1osWKyjSNMydFIQ=="],
|
|
84
|
+
|
|
85
|
+
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.72.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-NroXv2vh+sxVY1uya/rM5pjhx1hm8BzlYpx9q67QP0Xhw5MH2bf5GJylpvLEC+781p1Xli/317EoV9AlGwViag=="],
|
|
86
|
+
|
|
87
|
+
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.72.0", "", { "os": "linux", "cpu": "arm" }, "sha512-0NDywYgfj279Ou/BcQuCYSj7NJwBfmWn5qc5uGO/Ny7fUWmXyIpvawqX/8acQlWG6IXelJsJhj+JAy6sjsKj0A=="],
|
|
88
|
+
|
|
89
|
+
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.72.0", "", { "os": "linux", "cpu": "arm" }, "sha512-4vpXB06h65Ezsy4hRyrGjGrfa1SkVPii09yaajiYhmVpgsFiLD+KNxIx/BNAY+XiO+i1yqp9HHdwqM8VTqa5XQ=="],
|
|
90
|
+
|
|
91
|
+
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.72.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-immaN4g2ZGFiOkKrvRX9LvzZdd2GkQM5wR+UyzYyUuyhUTXGQ4HKUJH18xp4G8OfhCVaVAJfKZxwE1r8+4hhaQ=="],
|
|
92
|
+
|
|
93
|
+
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.72.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-JGHS9Mnr7iWyyLDxgCv1MhzVpAckgptg00F2gnxt/GD7lQ2SW1BRcxHqhSTaSdDpjWRrBkBxMMh4+Hn3aVtExg=="],
|
|
94
|
+
|
|
95
|
+
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.72.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-AOYgBZqxNshrg83P9v0RYv+m8s10Cqkj4/PxXFDhcS3k7FqsIG5+CxErshZCIN7G8iy4Y+VGfAsuEdar8AcbBg=="],
|
|
96
|
+
|
|
97
|
+
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.72.0", "", { "os": "linux", "cpu": "none" }, "sha512-QMybPS5ij3/vrKG67mqzHwW++91sYxK/PPUVi6SBtNCEzW4niS52fVBdXbQ6nou0wWbUPEpx8Sl/ZjtgE3clXA=="],
|
|
98
|
+
|
|
99
|
+
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.72.0", "", { "os": "linux", "cpu": "none" }, "sha512-gOc3W7JV0PXRpIL7stUlLe3Wa9Gp0Kdlup87IT3gHDvPKck2xNgMIl/Gs2lldYY2lyXZDC4rWi3hmoLUobkgbQ=="],
|
|
100
|
+
|
|
101
|
+
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.72.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-rpGxph+FjjHcYI5q6uxB3Az+tnfmEnDbSA8+PK9ZE/VzyUAkvBOMeuY7ZQMhu5mpZH7YQDsTdW6Cx4kV/msc6w=="],
|
|
102
|
+
|
|
103
|
+
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.72.0", "", { "os": "linux", "cpu": "x64" }, "sha512-WND+uhf/Ko13SLqQMWQUgsZuLvYYEvL0ZKgg0tgGYfLqxG7l8Ju123fHDMJyYSDl5E3bUbpFUuii/OvMreFQzw=="],
|
|
104
|
+
|
|
105
|
+
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.72.0", "", { "os": "linux", "cpu": "x64" }, "sha512-SrpbrUL70nG9vh6zP4/oKHWgLuHquwsr7MW9XOn0olBVgh10Uqr8qscKhQoBGEn6olK/IUpn5GSKcdQ5AjUhGA=="],
|
|
106
|
+
|
|
107
|
+
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.72.0", "", { "os": "none", "cpu": "arm64" }, "sha512-qkrsEn6NmgFKr7U/QnezQMb+q/vzAy0Dd9Y95gQGQTyjzDLN+HRZMuM5u70iyH4nBLCfKBzhjMsYCehKay2jyg=="],
|
|
108
|
+
|
|
109
|
+
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.72.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-LWR6ZlFZph+KPjXv8opgZsXRDCdrdQe8VL8Cg9zxCoBS73h6znzZpydVgmdnwj8mB9AuSM5jxEgDJDpQkjboeg=="],
|
|
110
|
+
|
|
111
|
+
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.72.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-yt6HEh7IsHvtjRWtmeZRX134eaXKHq5Gnqlf1xBJdJl1JtdoRUEJw3nAxpZoUDS860cX/foKbztO441anVBtVQ=="],
|
|
112
|
+
|
|
113
|
+
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.72.0", "", { "os": "win32", "cpu": "x64" }, "sha512-b2eKFD2hX7tIwmo/cyH6TDq8vzWRZ2qNHrzoGntUTmq0h3zQh/uX3eTSHCwI8OB/ADQfJCRelLItK8BsxuucDA=="],
|
|
114
|
+
|
|
115
|
+
"@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
|
|
116
|
+
|
|
117
|
+
"@types/hast": ["@types/hast@3.0.5", "", { "dependencies": { "@types/unist": "*" } }, "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g=="],
|
|
118
|
+
|
|
119
|
+
"@types/node": ["@types/node@24.13.3", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q=="],
|
|
120
|
+
|
|
121
|
+
"@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
|
|
122
|
+
|
|
123
|
+
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
|
|
124
|
+
|
|
125
|
+
"chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
|
|
126
|
+
|
|
127
|
+
"commander": ["commander@14.0.3", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],
|
|
128
|
+
|
|
129
|
+
"dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="],
|
|
130
|
+
|
|
131
|
+
"devlop": ["devlop@1.1.0", "", { "dependencies": { "dequal": "^2.0.0" } }, "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA=="],
|
|
132
|
+
|
|
133
|
+
"emphasize": ["emphasize@7.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "chalk": "^5.0.0", "highlight.js": "~11.9.0", "lowlight": "~3.1.0" } }, "sha512-jdFCDyt+YetBXO12VwK4AiLsMCvkZ3IBxMVIJddB+25EwIL0VETBgpvPkJl63+JyAgaQ5Wja10qWMoXXC95JNg=="],
|
|
134
|
+
|
|
135
|
+
"fastest-levenshtein": ["fastest-levenshtein@1.0.16", "", {}, "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg=="],
|
|
136
|
+
|
|
137
|
+
"figlet": ["figlet@1.11.4", "", { "dependencies": { "commander": "^14.0.0" }, "bin": { "figlet": "bin/index.js" } }, "sha512-ZU41480OncL+NVLQrT0GVnbO0COL24sLSrzksioDgunmdJNYEUxhJJZ4Y3x1csN8XXqN5OcCZTLG8lKdquNyfQ=="],
|
|
138
|
+
|
|
139
|
+
"highlight.js": ["highlight.js@11.12.0", "", {}, "sha512-nbfWpyRMcMrPMmDwJB+dhX/eiaPKtc2RB+0QZskqJ3WjRA/FDS0e9hZrx8EC/lbEv8gXy98FcDbNa/dspAaJMg=="],
|
|
140
|
+
|
|
141
|
+
"lowlight": ["lowlight@3.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.0.0", "highlight.js": "~11.9.0" } }, "sha512-CEbNVoSikAxwDMDPjXlqlFYiZLkDJHwyGu/MfOsJnF3d7f3tds5J3z8s/l9TMXhzfsJCCJEAsD78842mwmg0PQ=="],
|
|
142
|
+
|
|
143
|
+
"oxfmt": ["oxfmt@0.57.0", "", { "dependencies": { "tinypool": "2.1.0" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.57.0", "@oxfmt/binding-android-arm64": "0.57.0", "@oxfmt/binding-darwin-arm64": "0.57.0", "@oxfmt/binding-darwin-x64": "0.57.0", "@oxfmt/binding-freebsd-x64": "0.57.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.57.0", "@oxfmt/binding-linux-arm-musleabihf": "0.57.0", "@oxfmt/binding-linux-arm64-gnu": "0.57.0", "@oxfmt/binding-linux-arm64-musl": "0.57.0", "@oxfmt/binding-linux-ppc64-gnu": "0.57.0", "@oxfmt/binding-linux-riscv64-gnu": "0.57.0", "@oxfmt/binding-linux-riscv64-musl": "0.57.0", "@oxfmt/binding-linux-s390x-gnu": "0.57.0", "@oxfmt/binding-linux-x64-gnu": "0.57.0", "@oxfmt/binding-linux-x64-musl": "0.57.0", "@oxfmt/binding-openharmony-arm64": "0.57.0", "@oxfmt/binding-win32-arm64-msvc": "0.57.0", "@oxfmt/binding-win32-ia32-msvc": "0.57.0", "@oxfmt/binding-win32-x64-msvc": "0.57.0" }, "peerDependencies": { "svelte": "^5.0.0", "vite-plus": "*" }, "optionalPeers": ["svelte", "vite-plus"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-ZB7Bi+rGDSqmVIo9jwcLyFgjxXvQhDdU+jx+ZrVy6VRiVXK2+CHc4hO3J4dUQjHe7V0ymHB+MDuv5z+NhK07HA=="],
|
|
144
|
+
|
|
145
|
+
"oxlint": ["oxlint@1.72.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.72.0", "@oxlint/binding-android-arm64": "1.72.0", "@oxlint/binding-darwin-arm64": "1.72.0", "@oxlint/binding-darwin-x64": "1.72.0", "@oxlint/binding-freebsd-x64": "1.72.0", "@oxlint/binding-linux-arm-gnueabihf": "1.72.0", "@oxlint/binding-linux-arm-musleabihf": "1.72.0", "@oxlint/binding-linux-arm64-gnu": "1.72.0", "@oxlint/binding-linux-arm64-musl": "1.72.0", "@oxlint/binding-linux-ppc64-gnu": "1.72.0", "@oxlint/binding-linux-riscv64-gnu": "1.72.0", "@oxlint/binding-linux-riscv64-musl": "1.72.0", "@oxlint/binding-linux-s390x-gnu": "1.72.0", "@oxlint/binding-linux-x64-gnu": "1.72.0", "@oxlint/binding-linux-x64-musl": "1.72.0", "@oxlint/binding-openharmony-arm64": "1.72.0", "@oxlint/binding-win32-arm64-msvc": "1.72.0", "@oxlint/binding-win32-ia32-msvc": "1.72.0", "@oxlint/binding-win32-x64-msvc": "1.72.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.22.1", "vite-plus": "*" }, "optionalPeers": ["oxlint-tsgolint", "vite-plus"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-1rhdZIP/EvoI91ABIwNU5Q8+bWf8mjrS5UzIOZld4d4bXxJvtlUhlQvaoTogIGin/qdErMOrwaIJvCSIAKTLhA=="],
|
|
146
|
+
|
|
147
|
+
"prettier": ["prettier@3.9.6", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g=="],
|
|
148
|
+
|
|
149
|
+
"semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
|
|
150
|
+
|
|
151
|
+
"supports-color": ["supports-color@10.2.2", "", {}, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="],
|
|
152
|
+
|
|
153
|
+
"supports-terminal-graphics": ["supports-terminal-graphics@0.1.0", "", {}, "sha512-+KdfozhS0Fw8y5Sghw8kkZNGT8nWYzJ1EzcoIvVjxhl+26TJTs26y02yfBgvc1jh5AS/c8jcI3xtahhR95KRyQ=="],
|
|
154
|
+
|
|
155
|
+
"tinypool": ["tinypool@2.1.0", "", {}, "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw=="],
|
|
156
|
+
|
|
157
|
+
"typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
|
|
158
|
+
|
|
159
|
+
"undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],
|
|
160
|
+
|
|
161
|
+
"zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
|
|
162
|
+
|
|
163
|
+
"zod-to-json-schema": ["zod-to-json-schema@3.25.2", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
|
|
164
|
+
|
|
165
|
+
"@flowscripter/dynamic-cli-framework/@flowscripter/dynamic-cli-framework-api": ["@flowscripter/dynamic-cli-framework-api@2.3.2", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-N6icoIP5WBRt2EUF+PLWZr5iXAbAxa6QGkfBZNbxjJ5Z13+vUyTaTF6jEKGNv/9ekwTTmo0eBvOCqTNtFBi7zw=="],
|
|
166
|
+
|
|
167
|
+
"emphasize/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
|
|
168
|
+
|
|
169
|
+
"lowlight/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## Executable Functional Tests
|
|
2
|
+
|
|
3
|
+
#### Setup
|
|
4
|
+
|
|
5
|
+
Ensure the executable is built:
|
|
6
|
+
|
|
7
|
+
bun build ../index.ts --compile --outfile executable
|
|
8
|
+
|
|
9
|
+
Install requirements (virtual environment required):
|
|
10
|
+
|
|
11
|
+
pip3 install -r pip-requirements.txt
|
|
12
|
+
|
|
13
|
+
#### Testing
|
|
14
|
+
|
|
15
|
+
Run the functional tests:
|
|
16
|
+
|
|
17
|
+
export EXECUTABLE=./executable
|
|
18
|
+
behave
|
|
19
|
+
|
|
20
|
+
`before_all` installs `@flowscripter/io-plugin-filesystem` via
|
|
21
|
+
`plugin:add` into a fresh `~/.flowscripter-io-cli` plugin store before any
|
|
22
|
+
scenario runs - these tests require network access to the real npm
|
|
23
|
+
registry.
|
|
24
|
+
|
|
25
|
+
To run with logging output from the test steps:
|
|
26
|
+
|
|
27
|
+
behave --no-logcapture --no-color --logging-level=DEBUG
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Feature: IO commands
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given a temporary working directory
|
|
5
|
+
|
|
6
|
+
Scenario: list shows a file that was written
|
|
7
|
+
Given a file "a.txt" containing "hello" in the working directory
|
|
8
|
+
When the executable stdout is captured for "list {workdir}"
|
|
9
|
+
Then the captured process should complete with exit code 0
|
|
10
|
+
And the stdout should contain "a.txt"
|
|
11
|
+
|
|
12
|
+
Scenario: get-properties reports size
|
|
13
|
+
Given a file "a.txt" containing "hello" in the working directory
|
|
14
|
+
When the executable stdout is captured for "get-properties {workdir}/a.txt"
|
|
15
|
+
Then the captured process should complete with exit code 0
|
|
16
|
+
And the stdout should contain '"size": 5'
|
|
17
|
+
|
|
18
|
+
Scenario: set-properties reports success
|
|
19
|
+
Given a file "a.txt" containing "hello" in the working directory
|
|
20
|
+
When the executable stdout is captured for "set-properties {workdir}/a.txt --mode 420"
|
|
21
|
+
Then the captured process should complete with exit code 0
|
|
22
|
+
And the stdout should contain "Updated properties"
|
|
23
|
+
|
|
24
|
+
Scenario: copy duplicates a file, leaving the original in place
|
|
25
|
+
Given a file "a.txt" containing "hello" in the working directory
|
|
26
|
+
When the executable stdout is captured for "copy {workdir}/a.txt {workdir}/b.txt"
|
|
27
|
+
Then the captured process should complete with exit code 0
|
|
28
|
+
And a file "b.txt" should exist in the working directory
|
|
29
|
+
And a file "a.txt" should exist in the working directory
|
|
30
|
+
|
|
31
|
+
Scenario: move relocates a file
|
|
32
|
+
Given a file "a.txt" containing "hello" in the working directory
|
|
33
|
+
When the executable stdout is captured for "move {workdir}/a.txt {workdir}/c.txt"
|
|
34
|
+
Then the captured process should complete with exit code 0
|
|
35
|
+
And a file "c.txt" should exist in the working directory
|
|
36
|
+
And a file "a.txt" should not exist in the working directory
|
|
37
|
+
|
|
38
|
+
Scenario: delete removes a file
|
|
39
|
+
Given a file "a.txt" containing "hello" in the working directory
|
|
40
|
+
When the executable stdout is captured for "delete {workdir}/a.txt"
|
|
41
|
+
Then the captured process should complete with exit code 0
|
|
42
|
+
And a file "a.txt" should not exist in the working directory
|
|
43
|
+
|
|
44
|
+
Scenario: hash outputs the expected sha256 digest
|
|
45
|
+
Given a file "a.txt" containing "hello" in the working directory
|
|
46
|
+
When the executable stdout is captured for "hash {workdir}/a.txt"
|
|
47
|
+
Then the captured process should complete with exit code 0
|
|
48
|
+
And the stdout should contain "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
IS_WINDOWS = sys.platform.startswith('win')
|
|
7
|
+
|
|
8
|
+
if IS_WINDOWS:
|
|
9
|
+
# Windows' legacy console codepage cannot encode every Unicode icon used in
|
|
10
|
+
# flowscripter-io-cli's colored output, crashing behave's pretty formatter with
|
|
11
|
+
# UnicodeEncodeError whenever a failure message contains one.
|
|
12
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
13
|
+
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def before_all(context):
|
|
17
|
+
context.config.setup_logging()
|
|
18
|
+
|
|
19
|
+
executable = os.environ.get('EXECUTABLE')
|
|
20
|
+
assert executable, 'EXECUTABLE environment variable must be set'
|
|
21
|
+
context.executable = executable
|
|
22
|
+
|
|
23
|
+
# Fresh plugin store for every run, so a previous local run's state can't
|
|
24
|
+
# mask a real failure here.
|
|
25
|
+
plugins_dir = os.path.expanduser(os.path.join('~', '.flowscripter-io-cli'))
|
|
26
|
+
if os.path.isdir(plugins_dir):
|
|
27
|
+
shutil.rmtree(plugins_dir)
|
|
28
|
+
|
|
29
|
+
result = subprocess.run(
|
|
30
|
+
[executable, 'plugin:add', '@flowscripter/io-plugin-filesystem'],
|
|
31
|
+
capture_output=True, text=True, timeout=120,
|
|
32
|
+
)
|
|
33
|
+
assert result.returncode == 0, \
|
|
34
|
+
'failed to install io-plugin-filesystem: stdout={!r} stderr={!r}'.format(
|
|
35
|
+
result.stdout, result.stderr)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def before_scenario(context, scenario):
|
|
39
|
+
context.workdir = None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def after_scenario(context, scenario):
|
|
43
|
+
if context.workdir and os.path.isdir(context.workdir):
|
|
44
|
+
shutil.rmtree(context.workdir, ignore_errors=True)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Feature: Plugin management
|
|
2
|
+
|
|
3
|
+
Note: before_all installs @flowscripter/io-plugin-filesystem via
|
|
4
|
+
plugin:add before any scenario runs (requires network access to the
|
|
5
|
+
real npm registry). These scenarios just verify that succeeded.
|
|
6
|
+
|
|
7
|
+
Scenario: Installed plugin is listed
|
|
8
|
+
When the executable stdout is captured for "plugin:list"
|
|
9
|
+
Then the captured process should complete with exit code 0
|
|
10
|
+
And the stdout should contain "io-plugin-filesystem"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
4
|
+
|
|
5
|
+
from behave import when, then
|
|
6
|
+
from support.subprocess_wrapper import SubprocessWrapper
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@when('the executable stdout is captured for "{args}"')
|
|
10
|
+
def step_impl(context, args):
|
|
11
|
+
args = args.replace('{workdir}', context.workdir or '')
|
|
12
|
+
wrapper = SubprocessWrapper(context.executable)
|
|
13
|
+
wrapper.run(args)
|
|
14
|
+
context.subprocess_wrapper = wrapper
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@then('the captured process should complete with exit code {code:d}')
|
|
18
|
+
def step_impl(context, code):
|
|
19
|
+
status = context.subprocess_wrapper.returncode
|
|
20
|
+
assert status == code, 'unexpected exit status: {} (expected {}); stderr: {!r}'.format(
|
|
21
|
+
status, code, context.subprocess_wrapper.stderr)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@then('the stdout should contain "{text}"')
|
|
25
|
+
def step_impl(context, text):
|
|
26
|
+
text = text.replace('\\n', '\n')
|
|
27
|
+
assert text in context.subprocess_wrapper.stdout, \
|
|
28
|
+
'expected {!r} in stdout {!r}'.format(text, context.subprocess_wrapper.stdout)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@then("the stdout should contain '{text}'")
|
|
32
|
+
def step_impl(context, text):
|
|
33
|
+
# Single-quoted variant so text containing literal double quotes (e.g. a
|
|
34
|
+
# JSON snippet like "size": 5) can be matched without any escaping -
|
|
35
|
+
# Gherkin's "{text}" argument doesn't interpret \" as an escaped quote.
|
|
36
|
+
assert text in context.subprocess_wrapper.stdout, \
|
|
37
|
+
'expected {!r} in stdout {!r}'.format(text, context.subprocess_wrapper.stdout)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@then('the stderr should contain "{text}"')
|
|
41
|
+
def step_impl(context, text):
|
|
42
|
+
text = text.replace('\\n', '\n')
|
|
43
|
+
assert text in context.subprocess_wrapper.stderr, \
|
|
44
|
+
'expected {!r} in stderr {!r}'.format(text, context.subprocess_wrapper.stderr)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import tempfile
|
|
3
|
+
|
|
4
|
+
from behave import given, then
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@given('a temporary working directory')
|
|
8
|
+
def step_impl(context):
|
|
9
|
+
context.workdir = tempfile.mkdtemp(prefix='flowscripter-io-cli-functest-')
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@given('a file "{name}" containing "{content}" in the working directory')
|
|
13
|
+
def step_impl(context, name, content):
|
|
14
|
+
with open(os.path.join(context.workdir, name), 'w') as f:
|
|
15
|
+
f.write(content)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@then('a file "{name}" should exist in the working directory')
|
|
19
|
+
def step_impl(context, name):
|
|
20
|
+
path = os.path.join(context.workdir, name)
|
|
21
|
+
assert os.path.exists(path), 'expected {!r} to exist'.format(path)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@then('a file "{name}" should not exist in the working directory')
|
|
25
|
+
def step_impl(context, name):
|
|
26
|
+
path = os.path.join(context.workdir, name)
|
|
27
|
+
assert not os.path.exists(path), 'expected {!r} not to exist'.format(path)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shlex
|
|
3
|
+
import subprocess
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SubprocessWrapper:
|
|
7
|
+
|
|
8
|
+
def __init__(self, executable):
|
|
9
|
+
self.executable = executable
|
|
10
|
+
self.stdout = None
|
|
11
|
+
self.stderr = None
|
|
12
|
+
self.returncode = None
|
|
13
|
+
|
|
14
|
+
def run(self, args='', timeout=30):
|
|
15
|
+
# shlex's default posix=True mode treats "\" as an escape character,
|
|
16
|
+
# which mangles Windows paths (e.g. "C:\Users\...\Temp\...") by
|
|
17
|
+
# stripping their separators. posix=False preserves them.
|
|
18
|
+
tokens = shlex.split(args, posix=(os.name != 'nt')) if args else []
|
|
19
|
+
cmd = [self.executable] + tokens
|
|
20
|
+
result = subprocess.run(
|
|
21
|
+
cmd, capture_output=True, text=True, timeout=timeout, encoding='utf-8',
|
|
22
|
+
errors='replace',
|
|
23
|
+
)
|
|
24
|
+
self.stdout = result.stdout
|
|
25
|
+
self.stderr = result.stderr
|
|
26
|
+
self.returncode = result.returncode
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
behave
|
package/index.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flowscripter/flowscripter-io-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Example CLI using https://github.com/flowscripter/pluggable-io-framework",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"bun",
|
|
7
|
+
"cli",
|
|
8
|
+
"example",
|
|
9
|
+
"framework",
|
|
10
|
+
"io"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/flowscripter/flowscripter-io-cli#readme",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/flowscripter/flowscripter-io-cli.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"module": "index.ts",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@flowscripter/dynamic-cli-framework": "^5.1.1",
|
|
25
|
+
"@flowscripter/dynamic-cli-framework-api": "^1.5.0",
|
|
26
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.0",
|
|
27
|
+
"@flowscripter/pluggable-io-framework": "^1.0.0",
|
|
28
|
+
"@flowscripter/pluggable-io-framework-api": "^1.0.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@flowscripter/io-plugin-filesystem": "^1.0.0",
|
|
32
|
+
"@types/bun": "^1.3.14",
|
|
33
|
+
"@types/node": "^24.0.0",
|
|
34
|
+
"oxfmt": "0.57.0",
|
|
35
|
+
"oxlint": "1.72.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"typescript": "^6.0.3"
|
|
39
|
+
}
|
|
40
|
+
}
|