browser4-cli 4.12.0 → 4.12.2

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser4-cli",
3
- "version": "4.12.0",
3
+ "version": "4.12.2",
4
4
  "description": "Browser automation CLI for AI agents",
5
5
  "type": "module",
6
6
  "files": [
package/scripts/README.md CHANGED
@@ -36,7 +36,7 @@ Both scripts auto-detect OS, CPU architecture, and libc variant (glibc vs musl o
36
36
 
37
37
  | Option | Description |
38
38
  |--------|-------------|
39
- | `--version, -v TAG` | Release tag (e.g. `v4.11.0`). Default: latest. |
39
+ | `--version, -v TAG` | Release tag (e.g. `v4.12.0`). Default: latest. |
40
40
  | `--install-dir, -d DIR` | Install directory (default: `~/.local/bin` on Unix, `%LOCALAPPDATA%\Programs\browser4-cli` on Windows). |
41
41
  | `--source SRC` | Force download source: `github` or `oss`. Default: auto (locale-aware). |
42
42
  | `--no-path` / `-AddToPath:$false` | Skip adding the install directory to PATH. |
@@ -44,7 +44,8 @@ Both scripts auto-detect OS, CPU architecture, and libc variant (glibc vs musl o
44
44
  | `--dry-run` / `-DryRun` | Print what would be done without doing it. |
45
45
  | `--skip-if-installed` / `-SkipIfInstalled` | Skip download if binary already exists. |
46
46
  | `--skip-local` / `-SkipLocal` | Skip local bundled binary check; always download. |
47
- | `--locate` (sh only) | Print detection results and exit (no install). |
47
+ | `--force` / `-Force` (pwsh) | Force reinstallation even if the binary already exists at the target path. |
48
+ | `--locate` / `-Locate` | Print detection results (OS, arch, locale) and exit (no install). |
48
49
 
49
50
  ### One-liner install
50
51
 
@@ -87,7 +88,7 @@ Runs a full CLI smoke test suitable for CI and local development:
87
88
  |--------|---------|
88
89
  | `npm-publish-check.js` | Shared library: reads package metadata and compares local vs npm registry version |
89
90
  | `check-npm-publish-needed.js` | CLI wrapper: checks whether a publish is needed and prints the decision |
90
- | `publish-if-needed.js` | Publishes to npm only when the local version differs from the registry |
91
+ | `publish-if-needed.js` | Publishes to npm only when the local version differs from the registry. Uses `--tag next` for prerelease versions (containing `-`). |
91
92
  | `postinstall.js` | npm `postinstall` hook: downloads the platform native binary after `npm install` |
92
93
 
93
94
  ### Version check
@@ -1,104 +1,104 @@
1
- [CmdletBinding()]
2
- param(
3
- [string]$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path,
4
- [string]$ImageName = "browser4-builder",
5
- [switch]$SkipDockerBuild,
6
- [switch]$DryRun
7
- )
8
-
9
- Set-StrictMode -Version Latest
10
- $ErrorActionPreference = "Stop"
11
-
12
- $OutputDir = Join-Path $ProjectRoot "bin"
13
- $CliDir = Join-Path $ProjectRoot "browser4-cli"
14
- $DockerfilePath = Join-Path $ProjectRoot "docker/Dockerfile.build"
15
-
16
- $Targets = @(
17
- @{ Target = "x86_64-unknown-linux-gnu"; Output = "browser4-cli-linux-x64" },
18
- @{ Target = "aarch64-unknown-linux-gnu"; Output = "browser4-cli-linux-arm64" },
19
- @{ Target = "x86_64-pc-windows-gnu"; Output = "browser4-cli-win32-x64.exe" },
20
- @{ Target = "x86_64-apple-darwin"; Output = "browser4-cli-darwin-x64" },
21
- @{ Target = "aarch64-apple-darwin"; Output = "browser4-cli-darwin-arm64" },
22
- @{ Target = "x86_64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-x64" },
23
- @{ Target = "aarch64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-arm64" }
24
- )
25
-
26
- function Invoke-DockerCommand {
27
- param([string[]]$Args)
28
-
29
- if ($DryRun) {
30
- Write-Host ("[DRY-RUN] docker " + ($Args -join " ")) -ForegroundColor DarkYellow
31
- return
32
- }
33
-
34
- & docker @Args
35
- if ($LASTEXITCODE -ne 0) {
36
- throw "Docker command failed with exit code $LASTEXITCODE"
37
- }
38
- }
39
-
40
- function Build-Target {
41
- param(
42
- [string]$Target,
43
- [string]$OutputName
44
- )
45
-
46
- Write-Host "Building for $Target..." -ForegroundColor Yellow
47
-
48
- $containerCmd = "cargo zigbuild --release --target $Target && cp /build/target/$Target/release/browser4-cli* /output/$OutputName && chmod +x /output/$OutputName 2>/dev/null || true"
49
-
50
- Invoke-DockerCommand -Args @(
51
- "run", "--rm",
52
- "-v", "${CliDir}:/build",
53
- "-v", "${OutputDir}:/output",
54
- $ImageName,
55
- "-c", $containerCmd
56
- )
57
-
58
- $artifactPath = Join-Path $OutputDir $OutputName
59
- if (-not (Test-Path -Path $artifactPath -PathType Leaf)) {
60
- throw "Failed to build $OutputName"
61
- }
62
-
63
- $artifactSize = (Get-Item -Path $artifactPath).Length
64
- if ($artifactSize -le 0) {
65
- throw "Built artifact is empty: $OutputName"
66
- }
67
-
68
- Write-Host "Built $OutputName" -ForegroundColor Green
69
- }
70
-
71
- if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
72
- throw "Docker CLI not found in PATH. Install Docker Desktop and retry."
73
- }
74
-
75
- Write-Host "Building browser4-cli for all platforms..." -ForegroundColor Yellow
76
- Write-Host ""
77
-
78
- New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
79
-
80
- if (-not $SkipDockerBuild) {
81
- Write-Host "Building Docker cross-compilation image..." -ForegroundColor Yellow
82
- Invoke-DockerCommand -Args @(
83
- "build",
84
- "-t", $ImageName,
85
- "-f", $DockerfilePath,
86
- $ProjectRoot
87
- )
88
- Write-Host ""
89
- }
90
-
91
- foreach ($entry in $Targets) {
92
- Build-Target -Target $entry.Target -OutputName $entry.Output
93
- }
94
-
95
- Write-Host ""
96
- Write-Host "Build complete" -ForegroundColor Green
97
- Write-Host "Binaries are in: $OutputDir"
98
-
99
- if ($DryRun) {
100
- Write-Host "[DRY-RUN] Skipping artifact listing." -ForegroundColor DarkYellow
101
- }
102
- else {
103
- Get-ChildItem -Path $OutputDir -Filter "browser4-cli-*" | Select-Object Name, Length, LastWriteTime
104
- }
1
+ [CmdletBinding()]
2
+ param(
3
+ [string]$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path,
4
+ [string]$ImageName = "browser4-builder",
5
+ [switch]$SkipDockerBuild,
6
+ [switch]$DryRun
7
+ )
8
+
9
+ Set-StrictMode -Version Latest
10
+ $ErrorActionPreference = "Stop"
11
+
12
+ $OutputDir = Join-Path $ProjectRoot "bin"
13
+ $CliDir = Join-Path $ProjectRoot "browser4-cli"
14
+ $DockerfilePath = Join-Path $ProjectRoot "docker/Dockerfile.build"
15
+
16
+ $Targets = @(
17
+ @{ Target = "x86_64-unknown-linux-gnu"; Output = "browser4-cli-linux-x64" },
18
+ @{ Target = "aarch64-unknown-linux-gnu"; Output = "browser4-cli-linux-arm64" },
19
+ @{ Target = "x86_64-pc-windows-gnu"; Output = "browser4-cli-win32-x64.exe" },
20
+ @{ Target = "x86_64-apple-darwin"; Output = "browser4-cli-darwin-x64" },
21
+ @{ Target = "aarch64-apple-darwin"; Output = "browser4-cli-darwin-arm64" },
22
+ @{ Target = "x86_64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-x64" },
23
+ @{ Target = "aarch64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-arm64" }
24
+ )
25
+
26
+ function Invoke-DockerCommand {
27
+ param([string[]]$Args)
28
+
29
+ if ($DryRun) {
30
+ Write-Host ("[DRY-RUN] docker " + ($Args -join " ")) -ForegroundColor DarkYellow
31
+ return
32
+ }
33
+
34
+ & docker @Args
35
+ if ($LASTEXITCODE -ne 0) {
36
+ throw "Docker command failed with exit code $LASTEXITCODE"
37
+ }
38
+ }
39
+
40
+ function Build-Target {
41
+ param(
42
+ [string]$Target,
43
+ [string]$OutputName
44
+ )
45
+
46
+ Write-Host "Building for $Target..." -ForegroundColor Yellow
47
+
48
+ $containerCmd = "cargo zigbuild --release --target $Target && cp /build/target/$Target/release/browser4-cli* /output/$OutputName && chmod +x /output/$OutputName 2>/dev/null || true"
49
+
50
+ Invoke-DockerCommand -Args @(
51
+ "run", "--rm",
52
+ "-v", "${CliDir}:/build",
53
+ "-v", "${OutputDir}:/output",
54
+ $ImageName,
55
+ "-c", $containerCmd
56
+ )
57
+
58
+ $artifactPath = Join-Path $OutputDir $OutputName
59
+ if (-not (Test-Path -Path $artifactPath -PathType Leaf)) {
60
+ throw "Failed to build $OutputName"
61
+ }
62
+
63
+ $artifactSize = (Get-Item -Path $artifactPath).Length
64
+ if ($artifactSize -le 0) {
65
+ throw "Built artifact is empty: $OutputName"
66
+ }
67
+
68
+ Write-Host "Built $OutputName" -ForegroundColor Green
69
+ }
70
+
71
+ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
72
+ throw "Docker CLI not found in PATH. Install Docker Desktop and retry."
73
+ }
74
+
75
+ Write-Host "Building browser4-cli for all platforms..." -ForegroundColor Yellow
76
+ Write-Host ""
77
+
78
+ New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
79
+
80
+ if (-not $SkipDockerBuild) {
81
+ Write-Host "Building Docker cross-compilation image..." -ForegroundColor Yellow
82
+ Invoke-DockerCommand -Args @(
83
+ "build",
84
+ "-t", $ImageName,
85
+ "-f", $DockerfilePath,
86
+ $ProjectRoot
87
+ )
88
+ Write-Host ""
89
+ }
90
+
91
+ foreach ($entry in $Targets) {
92
+ Build-Target -Target $entry.Target -OutputName $entry.Output
93
+ }
94
+
95
+ Write-Host ""
96
+ Write-Host "Build complete" -ForegroundColor Green
97
+ Write-Host "Binaries are in: $OutputDir"
98
+
99
+ if ($DryRun) {
100
+ Write-Host "[DRY-RUN] Skipping artifact listing." -ForegroundColor DarkYellow
101
+ }
102
+ else {
103
+ Get-ChildItem -Path $OutputDir -Filter "browser4-cli-*" | Select-Object Name, Length, LastWriteTime
104
+ }