browser4-cli 4.12.0-rc.3 → 4.12.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/README.md +21 -15
- package/bin/browser4-cli-darwin-arm64 +0 -0
- package/bin/browser4-cli-darwin-x64 +0 -0
- package/bin/browser4-cli-linux-arm64 +0 -0
- package/bin/browser4-cli-linux-musl-arm64 +0 -0
- package/bin/browser4-cli-linux-musl-x64 +0 -0
- package/bin/browser4-cli-linux-x64 +0 -0
- package/bin/browser4-cli-win32-x64.exe +0 -0
- package/package.json +1 -1
- package/scripts/build-all-platforms.ps1 +104 -104
- package/scripts/enumerate-help.ps1 +382 -382
- package/scripts/install-browser4-cli.ps1 +812 -750
- package/scripts/install-browser4-cli.sh +31 -8
- package/scripts/tests/install-browser4-cli.tests.ps1 +476 -311
- package/scripts/tests/install-browser4-cli.tests.sh +135 -0
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ browser4-cli agent run "Search amazon for mechanical keyboards, compare the top
|
|
|
88
88
|
|
|
89
89
|
# Parallel scraping with swarm
|
|
90
90
|
browser4-cli swarm create --max-open-tabs 12 --display-mode HEADLESS
|
|
91
|
-
browser4-cli swarm submit --seed-file ./urls.txt --refresh
|
|
91
|
+
browser4-cli swarm submit --seed-file ./urls.txt --refresh
|
|
92
92
|
browser4-cli swarm result scrape-task-1
|
|
93
93
|
|
|
94
94
|
# Batch multiple commands
|
|
@@ -247,16 +247,19 @@ browser4-cli pdf --filename page.pdf
|
|
|
247
247
|
|
|
248
248
|
| Command | Description |
|
|
249
249
|
|---|---|
|
|
250
|
-
| `tab-list` | List all tabs with their zero-based index. |
|
|
250
|
+
| `tab-list` | List all tabs with their zero-based index and stable GUID. Use `--json` for full GUIDs. |
|
|
251
251
|
| `tab-new [url]` | Open a new tab. |
|
|
252
|
-
| `tab-close [index]` | Close a tab (current tab if no index). |
|
|
253
|
-
| `tab-select <index>` | Switch to a tab by index. |
|
|
252
|
+
| `tab-close [index]` | Close a tab (current tab if no index). Use `--guid <guid>` for GUID-based close. |
|
|
253
|
+
| `tab-select <index>` | Switch to a tab by index. Use `--guid <guid>` for GUID-based select. |
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
256
|
browser4-cli tab-list
|
|
257
|
+
browser4-cli tab-list --json # JSON output with full GUIDs
|
|
257
258
|
browser4-cli tab-select 1
|
|
259
|
+
browser4-cli tab-select --guid 1B46D74FB # select by stable GUID
|
|
258
260
|
browser4-cli tab-new https://example.com
|
|
259
261
|
browser4-cli tab-close 1
|
|
262
|
+
browser4-cli tab-close --guid 1B46D74FB # close by stable GUID
|
|
260
263
|
```
|
|
261
264
|
|
|
262
265
|
### Element inspection
|
|
@@ -382,17 +385,21 @@ instructions that always match the installed CLI version.
|
|
|
382
385
|
| `skills list` | List available bundled skills with file counts. |
|
|
383
386
|
| `skills get <name>` | Output a skill's SKILL.md content. `--full` includes references and templates. `--all` outputs every skill. |
|
|
384
387
|
| `skills path [name]` | Print the skills directory path. With a name, prints the path to that skill's subdirectory. |
|
|
388
|
+
| `skills unpack [dest]` | Unpack bundled skill files to a directory (defaults to the skills directory). |
|
|
385
389
|
|
|
386
390
|
Skill files are unpacked to the versioned installation directory during `browser4-cli install`.
|
|
391
|
+
Use `skills unpack` to refresh or relocate skill files without reinstalling.
|
|
387
392
|
Set `BROWSER4_SKILLS_DIR` to override the skills directory path.
|
|
388
393
|
|
|
389
394
|
```bash
|
|
390
|
-
browser4-cli skills
|
|
391
|
-
browser4-cli skills get browser4-cli
|
|
395
|
+
browser4-cli skills # List bundled skills
|
|
396
|
+
browser4-cli skills get browser4-cli # Get the CLI skill's main content
|
|
392
397
|
browser4-cli skills get browser4-cli --full # Include references and templates
|
|
393
|
-
browser4-cli skills get --all
|
|
394
|
-
browser4-cli skills path
|
|
395
|
-
browser4-cli skills path browser4-cli
|
|
398
|
+
browser4-cli skills get --all # Output every skill
|
|
399
|
+
browser4-cli skills path # Print skills root directory
|
|
400
|
+
browser4-cli skills path browser4-cli # Print path to a specific skill
|
|
401
|
+
browser4-cli skills unpack # Unpack to default skills directory
|
|
402
|
+
browser4-cli skills unpack /custom/path # Unpack to a custom directory
|
|
396
403
|
```
|
|
397
404
|
|
|
398
405
|
### Other
|
|
@@ -489,7 +496,7 @@ browser4-cli htmlsnapshot
|
|
|
489
496
|
browser4-cli htmlsnapshot get <field> [selector] [name]
|
|
490
497
|
browser4-cli htmlsnapshot get all <field> [selector] [name]
|
|
491
498
|
browser4-cli htmlsnapshot query [url] --sql <query>
|
|
492
|
-
browser4-cli htmlsnapshot export [--file <path>]
|
|
499
|
+
browser4-cli htmlsnapshot export [--file <path>] [--clean]
|
|
493
500
|
browser4-cli htmlsnapshot summary
|
|
494
501
|
browser4-cli htmlsnapshot grep [OPTIONS] <pattern>
|
|
495
502
|
browser4-cli htmlsnapshot inspect [selector] [--max N] [--depth D]
|
|
@@ -581,10 +588,11 @@ browser4-cli htmlsnapshot query --sql "
|
|
|
581
588
|
|
|
582
589
|
#### htmlsnapshot export
|
|
583
590
|
|
|
584
|
-
Save the full snapshot HTML to a local file.
|
|
591
|
+
Save the full snapshot HTML to a local file. Use `--clean` to strip `<script>`, `<style>`, comments, and non-standard attributes — producing minimal HTML ideal for LLM consumption.
|
|
585
592
|
|
|
586
593
|
```bash
|
|
587
594
|
browser4-cli htmlsnapshot export --file snapshot.html
|
|
595
|
+
browser4-cli htmlsnapshot export --file page.html --clean
|
|
588
596
|
```
|
|
589
597
|
|
|
590
598
|
#### htmlsnapshot summary
|
|
@@ -735,13 +743,12 @@ line; `#` comments and blank lines ignored), or both.
|
|
|
735
743
|
| `--expires <duration>` | Cache expiration (e.g. `1d`, `1h`) |
|
|
736
744
|
| `--refresh` | Force fresh fetch, ignore cache |
|
|
737
745
|
| `--parse` | Parse page immediately after fetching |
|
|
738
|
-
| `--store-content` | Persist page content to storage |
|
|
739
746
|
|
|
740
747
|
```bash
|
|
741
748
|
# Submit URLs from a file
|
|
742
749
|
browser4-cli swarm submit --seed-file ./urls.txt \
|
|
743
750
|
--deadline 2026-03-30T00:00:00Z \
|
|
744
|
-
--expires 1d --refresh
|
|
751
|
+
--expires 1d --refresh
|
|
745
752
|
|
|
746
753
|
# Submit with inline X-SQL
|
|
747
754
|
browser4-cli swarm submit "https://www.amazon.com/dp/B08PP5MSVB" --sql "
|
|
@@ -800,7 +807,6 @@ browser4-cli crawl <url> [options]
|
|
|
800
807
|
| `-a`, `--args` | — | Additional LoadOptions passthrough (e.g. `-a "-nMaxRetry 5"`) |
|
|
801
808
|
| `--refresh` | — | Force fresh fetch |
|
|
802
809
|
| `--parse` | — | Parse pages immediately after fetching |
|
|
803
|
-
| `--store-content` | — | Persist page content |
|
|
804
810
|
| `--expires` | — | Cache expiration (e.g. `1d`, `1h`, `30m`) |
|
|
805
811
|
| `-p`, `--priority` | — | Queue priority (lower = higher) |
|
|
806
812
|
| `--ignore-url-query` | — | Strip query params during URL normalization |
|
|
@@ -821,7 +827,7 @@ browser4-cli crawl "https://shop.example.com" \
|
|
|
821
827
|
--top-links 10
|
|
822
828
|
|
|
823
829
|
# Deep crawl with refresh and content storage
|
|
824
|
-
browser4-cli crawl "https://example.com" --depth 3 --refresh
|
|
830
|
+
browser4-cli crawl "https://example.com" --depth 3 --refresh
|
|
825
831
|
|
|
826
832
|
# Background crawl — submit and return immediately
|
|
827
833
|
browser4-cli crawl "https://example.com" -ol "a[href]" --background
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|