@curl-runner/cli 1.25.0 → 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
@@ -1,10 +1,10 @@
1
1
  # @curl-runner/cli
2
2
 
3
3
  [![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
4
- [![Bun](https://img.shields.io/badge/Bun-%23000000.svg?style=flat-square&logo=bun&logoColor=white)](https://bun.sh)
4
+ [![Rust](https://img.shields.io/badge/Rust-%23000000.svg?style=flat-square&logo=rust&logoColor=white)](https://www.rust-lang.org/)
5
5
  [![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
6
6
 
7
- A powerful CLI tool for HTTP request management using YAML configuration files. Built with [Bun](https://bun.sh) for blazing-fast performance and featuring variable interpolation, parallel execution, and response validation.
7
+ A powerful CLI tool for HTTP request management using YAML configuration files. A single native Rust binary (libcurl statically linked; no Bun, Node or curl needed at runtime) featuring variable interpolation, parallel execution, and response validation.
8
8
 
9
9
  ## 🚀 Features
10
10
 
@@ -21,27 +21,85 @@ A powerful CLI tool for HTTP request management using YAML configuration files.
21
21
 
22
22
  ## 📦 Installation
23
23
 
24
+ ### npm / Bun / pnpm
25
+
26
+ ```bash
27
+ bun i -g @curl-runner/cli # no Node needed, no postinstall to trust
28
+ npm i -g @curl-runner/cli # no Bun needed; the runtime needs neither Node nor Bun
29
+ pnpm add -g @curl-runner/cli
30
+ ```
31
+
32
+ ### How the npm package works
33
+
34
+ `@curl-runner/cli` contains no JavaScript. It ships a native binary through
35
+ one optional dependency per platform, versioned in lockstep with it:
36
+
37
+ | Package | `os` / `cpu` | Binary |
38
+ | --- | --- | --- |
39
+ | `@curl-runner/cli-linux-x64` | linux / x64 | static musl |
40
+ | `@curl-runner/cli-linux-arm64` | linux / arm64 | static musl |
41
+ | `@curl-runner/cli-darwin-x64` | darwin / x64 | Mach-O |
42
+ | `@curl-runner/cli-darwin-arm64` | darwin / arm64 | Mach-O |
43
+ | `@curl-runner/cli-win32-x64` | win32 / x64 | `curl-runner.exe` |
44
+
45
+ npm, Bun, pnpm and yarn download only the package whose `os`/`cpu` match.
46
+ The `curl-runner` bin is `bin/curl-runner`, a POSIX `sh` launcher
47
+ (`#!/usr/bin/env sh`): it maps `uname` to the platform, finds
48
+ `node_modules/@curl-runner/cli-<platform>/bin/curl-runner` by walking up
49
+ `node_modules` directories like Node's resolver (npm nested/hoisted, Bun
50
+ global, pnpm `.pnpm` siblings, yarn), and `exec`s it. If the platform is
51
+ unsupported or its package is missing (for example after `--omit=optional`),
52
+ it exits 1 with a message saying so.
53
+
54
+ Why this design:
55
+
56
+ - **No postinstall.** Bun does not run lifecycle scripts of untrusted
57
+ dependencies, so the esbuild-style "postinstall copies the binary over the
58
+ bin" approach breaks `bun i -g`. Optional dependencies plus a launcher need
59
+ no scripts at all.
60
+ - **No Node at runtime.** A JS launcher (`#!/usr/bin/env node`) fails on a
61
+ machine with only Bun. `sh` is always present on Linux and macOS.
62
+ - **Lockstep versions.** The platform packages live in `npm/cli-*` with
63
+ version `0.0.0`. At release, `scripts/npm-stage.sh` stamps them with the
64
+ `@curl-runner/cli` version, copies in the CI-built binaries and adds the
65
+ exact-version `optionalDependencies` to this package (kept out of git so
66
+ `bun.lock` never points at unpublished versions). `scripts/npm-publish.sh`
67
+ then publishes the five platform packages before `changeset publish`
68
+ publishes `@curl-runner/cli`.
69
+
70
+ Windows: package managers wrap bins in shims (npm's cmd-shim writes
71
+ `curl-runner.cmd`/`.ps1`; Bun writes a `.exe` shim). Both read the shebang and
72
+ run `sh <launcher>`, so `curl-runner` works from cmd and PowerShell only when
73
+ a `sh` is on `PATH` (Git for Windows with its Unix tools on `PATH`, MSYS2,
74
+ Cygwin), and always from Git Bash. Without `sh`, install the native binary
75
+ with `install.ps1` from the docs, or run
76
+ `node_modules/@curl-runner/cli-win32-x64/bin/curl-runner.exe` directly.
77
+ Mapping a single `bin` entry to a native `.exe` on Windows would require a
78
+ postinstall, which is what this design avoids.
79
+
80
+ Testing: `scripts/npm-smoke.sh <bin-dir> [linux/arm64 linux/amd64]` packs
81
+ everything, publishes to a throwaway local verdaccio and installs it with
82
+ `bun i -g` (no node), `npm i -g` (no bun) and `pnpm add -g` in Docker.
83
+
24
84
  ### From Source
25
85
 
86
+ Needs [Rust](https://rustup.rs) (toolchain pinned in `rust-toolchain.toml`); Bun is not required.
87
+
26
88
  ```bash
27
- # Clone the monorepo
28
89
  git clone https://github.com/alexvcasillas/curl-runner.git
29
90
  cd curl-runner
30
91
 
31
- # Install dependencies
32
- bun install
33
-
34
92
  # Build the CLI
35
- bun run build:cli
93
+ cargo build --release -p curl-runner
36
94
 
37
- # The binary will be available at ./curl-runner
95
+ # The binary is at ./target/release/curl-runner
38
96
  ```
39
97
 
40
98
  ### Development Mode
41
99
 
42
100
  ```bash
43
101
  # Run from source
44
- bun run packages/cli/src/cli.ts [files...] [options]
102
+ cargo run -p curl-runner -- [files...] [options]
45
103
 
46
104
  # Or use the workspace script
47
105
  bun run cli [files...] [options]
@@ -379,27 +437,25 @@ curl-runner -v examples/
379
437
  ### Running Tests
380
438
 
381
439
  ```bash
382
- # Run unit tests
383
- bun test
440
+ # Run unit and integration tests
441
+ cargo test --workspace
384
442
 
385
- # Run integration tests with example files
443
+ # Run the example files
386
444
  curl-runner examples/
387
445
 
388
446
  # Test CLI functionality
389
- bun run packages/cli/src/cli.ts --help
447
+ cargo run -p curl-runner -- --help
390
448
  ```
391
449
 
392
450
  ### Development Commands
393
451
 
394
452
  ```bash
395
- # Run in development mode with file watching
396
- bun run dev:cli
397
-
398
453
  # Build the CLI binary
399
- bun run build:cli
454
+ cargo build --release -p curl-runner
400
455
 
401
456
  # Check code quality
402
- bun run check
457
+ cargo fmt --all --check
458
+ cargo clippy --workspace --all-targets -- -D warnings
403
459
  ```
404
460
 
405
461
  ## 🎨 Output Formats
@@ -515,4 +571,4 @@ MIT License - see [LICENSE.md](../../LICENSE.md) for details.
515
571
 
516
572
  ---
517
573
 
518
- Built with ❤️ using [Bun](https://bun.sh) and TypeScript
574
+ Built with ❤️ using Rust and libcurl
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env sh
2
+ # curl-runner npm launcher (POSIX sh, no Node or Bun needed at runtime).
3
+ # Finds the native binary shipped in the optional dependency
4
+ # @curl-runner/cli-<os>-<cpu> and execs it. See README.md, "How the npm
5
+ # package works".
6
+ set -e
7
+
8
+ case "$(uname -s)" in
9
+ Linux) os=linux ;;
10
+ Darwin) os=darwin ;;
11
+ MINGW* | MSYS* | CYGWIN*) os=win32 ;;
12
+ *) os="$(uname -s)" ;;
13
+ esac
14
+ case "$(uname -m)" in
15
+ x86_64 | amd64) cpu=x64 ;;
16
+ aarch64 | arm64) cpu=arm64 ;;
17
+ *) cpu="$(uname -m)" ;;
18
+ esac
19
+
20
+ exe=curl-runner
21
+ case "$os-$cpu" in
22
+ linux-x64 | linux-arm64 | darwin-x64 | darwin-arm64) candidates="$os-$cpu" ;;
23
+ win32-x64) candidates="$os-$cpu" exe=curl-runner.exe ;;
24
+ *)
25
+ echo "curl-runner: unsupported platform $os-$cpu (supported: linux-x64, linux-arm64, darwin-x64, darwin-arm64, win32-x64)." >&2
26
+ echo "curl-runner: download a binary from https://github.com/alexvcasillas/curl-runner/releases instead." >&2
27
+ exit 1
28
+ ;;
29
+ esac
30
+ # A Rosetta shell reports x86_64 on Apple silicon while an arm64 package
31
+ # manager installed the arm64 package (and vice versa): accept either.
32
+ case "$os" in darwin) candidates="$candidates darwin-arm64 darwin-x64" ;; esac
33
+
34
+ # Resolve this script through bin symlinks (npm, bun and yarn link it) to
35
+ # the real package directory. No readlink -f: older macOS lacks it.
36
+ self="$0"
37
+ while [ -L "$self" ]; do
38
+ link="$(readlink "$self")"
39
+ case "$link" in
40
+ /*) self="$link" ;;
41
+ *) self="$(dirname -- "$self")/$link" ;;
42
+ esac
43
+ done
44
+ pkg_dir="$(CDPATH='' cd -- "$(dirname -- "$self")/.." && pwd -P)"
45
+
46
+ # Node module resolution from pkg_dir: <ancestor>/node_modules/<name>.
47
+ # Covers npm (nested or hoisted), bun, pnpm (.pnpm siblings) and yarn.
48
+ for platform in $candidates; do
49
+ dir="$pkg_dir"
50
+ while :; do
51
+ bin="$dir/node_modules/@curl-runner/cli-$platform/bin/$exe"
52
+ if [ -f "$bin" ]; then
53
+ exec "$bin" "$@"
54
+ fi
55
+ [ "$dir" = "/" ] && break
56
+ dir="$(dirname "$dir")"
57
+ done
58
+ done
59
+
60
+ echo "curl-runner: platform package @curl-runner/cli-$os-$cpu is missing." >&2
61
+ echo "curl-runner: reinstall @curl-runner/cli with optional dependencies enabled (no --omit=optional / --no-optional / --ignore-optional)." >&2
62
+ exit 1
package/package.json CHANGED
@@ -1,24 +1,13 @@
1
1
  {
2
2
  "name": "@curl-runner/cli",
3
- "version": "1.25.0",
4
- "description": "A powerful CLI tool for HTTP request management using YAML configuration",
3
+ "version": "2.0.0",
4
+ "description": "A powerful CLI tool for HTTP request management using YAML configuration (native binary)",
5
5
  "type": "module",
6
- "main": "./dist/cli.js",
7
6
  "repository": {
8
7
  "url": "git+https://github.com/alexvcasillas/curl-runner.git"
9
8
  },
10
9
  "bin": {
11
- "curl-runner": "dist/cli.js"
12
- },
13
- "scripts": {
14
- "start": "bun run dist/cli.js",
15
- "dev": "bun run src/cli.ts",
16
- "build": "bun run scripts/build-with-version.ts",
17
- "format": "bunx @biomejs/biome format --write .",
18
- "lint": "bunx @biomejs/biome lint .",
19
- "check": "bunx @biomejs/biome check --write .",
20
- "typecheck": "tsc --noEmit",
21
- "test": "bun test"
10
+ "curl-runner": "bin/curl-runner"
22
11
  },
23
12
  "keywords": [
24
13
  "curl",
@@ -26,8 +15,7 @@
26
15
  "api",
27
16
  "testing",
28
17
  "yaml",
29
- "cli",
30
- "bun"
18
+ "cli"
31
19
  ],
32
20
  "author": "",
33
21
  "license": "MIT",
@@ -35,16 +23,14 @@
35
23
  "access": "public"
36
24
  },
37
25
  "files": [
38
- "dist",
26
+ "bin",
39
27
  "README.md"
40
28
  ],
41
- "devDependencies": {
42
- "@types/bun": "latest"
43
- },
44
- "peerDependencies": {
45
- "typescript": "^5.0.0"
46
- },
47
- "dependencies": {
48
- "@clack/prompts": "^1.0.0"
29
+ "optionalDependencies": {
30
+ "@curl-runner/cli-linux-x64": "2.0.0",
31
+ "@curl-runner/cli-linux-arm64": "2.0.0",
32
+ "@curl-runner/cli-darwin-x64": "2.0.0",
33
+ "@curl-runner/cli-darwin-arm64": "2.0.0",
34
+ "@curl-runner/cli-win32-x64": "2.0.0"
49
35
  }
50
36
  }