camofox-browser 1.9.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +236 -25
  3. package/bin/camofox-browser.js +14 -28
  4. package/bin/camofox.js +10 -0
  5. package/dist/src/cli/commands/advanced.d.ts +4 -0
  6. package/dist/src/cli/commands/advanced.d.ts.map +1 -0
  7. package/dist/src/cli/commands/advanced.js +342 -0
  8. package/dist/src/cli/commands/advanced.js.map +1 -0
  9. package/dist/src/cli/commands/auth.d.ts +4 -0
  10. package/dist/src/cli/commands/auth.d.ts.map +1 -0
  11. package/dist/src/cli/commands/auth.js +314 -0
  12. package/dist/src/cli/commands/auth.js.map +1 -0
  13. package/dist/src/cli/commands/content.d.ts +4 -0
  14. package/dist/src/cli/commands/content.d.ts.map +1 -0
  15. package/dist/src/cli/commands/content.js +311 -0
  16. package/dist/src/cli/commands/content.js.map +1 -0
  17. package/dist/src/cli/commands/core.d.ts +4 -0
  18. package/dist/src/cli/commands/core.d.ts.map +1 -0
  19. package/dist/src/cli/commands/core.js +194 -0
  20. package/dist/src/cli/commands/core.js.map +1 -0
  21. package/dist/src/cli/commands/download.d.ts +4 -0
  22. package/dist/src/cli/commands/download.d.ts.map +1 -0
  23. package/dist/src/cli/commands/download.js +162 -0
  24. package/dist/src/cli/commands/download.js.map +1 -0
  25. package/dist/src/cli/commands/interaction.d.ts +4 -0
  26. package/dist/src/cli/commands/interaction.d.ts.map +1 -0
  27. package/dist/src/cli/commands/interaction.js +259 -0
  28. package/dist/src/cli/commands/interaction.js.map +1 -0
  29. package/dist/src/cli/commands/navigation.d.ts +4 -0
  30. package/dist/src/cli/commands/navigation.d.ts.map +1 -0
  31. package/dist/src/cli/commands/navigation.js +153 -0
  32. package/dist/src/cli/commands/navigation.js.map +1 -0
  33. package/dist/src/cli/commands/pipe.d.ts +4 -0
  34. package/dist/src/cli/commands/pipe.d.ts.map +1 -0
  35. package/dist/src/cli/commands/pipe.js +144 -0
  36. package/dist/src/cli/commands/pipe.js.map +1 -0
  37. package/dist/src/cli/commands/server.d.ts +10 -0
  38. package/dist/src/cli/commands/server.d.ts.map +1 -0
  39. package/dist/src/cli/commands/server.js +97 -0
  40. package/dist/src/cli/commands/server.js.map +1 -0
  41. package/dist/src/cli/commands/session.d.ts +4 -0
  42. package/dist/src/cli/commands/session.d.ts.map +1 -0
  43. package/dist/src/cli/commands/session.js +226 -0
  44. package/dist/src/cli/commands/session.js.map +1 -0
  45. package/dist/src/cli/index.d.ts +2 -0
  46. package/dist/src/cli/index.d.ts.map +1 -0
  47. package/dist/src/cli/index.js +176 -0
  48. package/dist/src/cli/index.js.map +1 -0
  49. package/dist/src/cli/output/formatter.d.ts +5 -0
  50. package/dist/src/cli/output/formatter.d.ts.map +1 -0
  51. package/dist/src/cli/output/formatter.js +50 -0
  52. package/dist/src/cli/output/formatter.js.map +1 -0
  53. package/dist/src/cli/server/manager.d.ts +33 -0
  54. package/dist/src/cli/server/manager.d.ts.map +1 -0
  55. package/dist/src/cli/server/manager.js +187 -0
  56. package/dist/src/cli/server/manager.js.map +1 -0
  57. package/dist/src/cli/transport/http.d.ts +32 -0
  58. package/dist/src/cli/transport/http.d.ts.map +1 -0
  59. package/dist/src/cli/transport/http.js +131 -0
  60. package/dist/src/cli/transport/http.js.map +1 -0
  61. package/dist/src/cli/types.d.ts +10 -0
  62. package/dist/src/cli/types.d.ts.map +1 -0
  63. package/dist/src/cli/types.js +3 -0
  64. package/dist/src/cli/types.js.map +1 -0
  65. package/dist/src/cli/utils/api-fallback.d.ts +4 -0
  66. package/dist/src/cli/utils/api-fallback.d.ts.map +1 -0
  67. package/dist/src/cli/utils/api-fallback.js +20 -0
  68. package/dist/src/cli/utils/api-fallback.js.map +1 -0
  69. package/dist/src/cli/utils/command-helpers.d.ts +9 -0
  70. package/dist/src/cli/utils/command-helpers.d.ts.map +1 -0
  71. package/dist/src/cli/utils/command-helpers.js +50 -0
  72. package/dist/src/cli/utils/command-helpers.js.map +1 -0
  73. package/dist/src/cli/utils/error-handler.d.ts +18 -0
  74. package/dist/src/cli/utils/error-handler.d.ts.map +1 -0
  75. package/dist/src/cli/utils/error-handler.js +59 -0
  76. package/dist/src/cli/utils/error-handler.js.map +1 -0
  77. package/dist/src/cli/utils/fs-helpers.d.ts +6 -0
  78. package/dist/src/cli/utils/fs-helpers.d.ts.map +1 -0
  79. package/dist/src/cli/utils/fs-helpers.js +54 -0
  80. package/dist/src/cli/utils/fs-helpers.js.map +1 -0
  81. package/dist/src/cli/utils/session-resolver.d.ts +11 -0
  82. package/dist/src/cli/utils/session-resolver.d.ts.map +1 -0
  83. package/dist/src/cli/utils/session-resolver.js +58 -0
  84. package/dist/src/cli/utils/session-resolver.js.map +1 -0
  85. package/dist/src/cli/vault/crypto.d.ts +11 -0
  86. package/dist/src/cli/vault/crypto.d.ts.map +1 -0
  87. package/dist/src/cli/vault/crypto.js +158 -0
  88. package/dist/src/cli/vault/crypto.js.map +1 -0
  89. package/dist/src/cli/vault/store.d.ts +16 -0
  90. package/dist/src/cli/vault/store.d.ts.map +1 -0
  91. package/dist/src/cli/vault/store.js +90 -0
  92. package/dist/src/cli/vault/store.js.map +1 -0
  93. package/dist/src/services/context-pool.d.ts.map +1 -1
  94. package/dist/src/services/context-pool.js +30 -0
  95. package/dist/src/services/context-pool.js.map +1 -1
  96. package/dist/tsconfig.tsbuildinfo +1 -1
  97. package/package.json +8 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0] — 2026-03-03
4
+
5
+ ### ✨ Added
6
+ - **CLI Mode**: 47+ commands for terminal-based browser automation (`camofox` command)
7
+ - **Auth Vault**: AES-256-GCM encrypted credential storage with Argon2id KDF
8
+ - `auth save/load/list/delete/change-password` commands
9
+ - Credentials never output to stdout (LLM-safe)
10
+ - Optional `argon2` dependency with PBKDF2 fallback
11
+ - **Session Management**: Save/load/list/delete browser sessions via CLI
12
+ - **Cookie Management**: Export/import cookies via CLI
13
+ - **Pipeline Scripting**: Execute command scripts from files (`camofox run script.txt`)
14
+ - **Output Formatting**: JSON, text, and plain output formats (`--format`)
15
+ - **Server Management**: Start/stop/status commands for daemon lifecycle
16
+ - **Advanced Commands**: `annotate`, `health`, `version`, `info`
17
+ - **Auto Server Start**: CLI automatically starts server when needed
18
+ - **Search Macros via CLI**: 14 search engines supported (`camofox search "query" --engine google`)
19
+
20
+ ### 🔧 Changed
21
+ - Node.js minimum version updated to >=20 (from >=18)
22
+ - Added `camofox` bin entry alongside existing `camofox-browser`
23
+ - Added `commander` as direct dependency (v14.0.3)
24
+ - Added `argon2` as optional dependency
25
+
26
+ ### 🏗️ Architecture
27
+ - HTTP-only transport with lazy server start (daemon pattern)
28
+ - PID file management at `~/.camofox/`
29
+ - Atomic file writes for session and vault data
30
+ - API fallback pattern for backward compatibility with older server versions
31
+
3
32
  ## [1.9.0] - 2026-03-01
4
33
 
5
34
  ### Added
@@ -14,6 +43,7 @@
14
43
 
15
44
  ### Changed
16
45
  - Refactored `evaluateTab()` to share internal logic via `_evaluateInternal()` — no behavior changes to existing `/evaluate` endpoint
46
+ - Documentation clarification: async expressions for `/evaluate` and `/evaluate-extended` must be wrapped in an async IIFE (`(async () => { ... })()`), since top-level `await` is not supported by `page.evaluate()`
17
47
 
18
48
  ### Fixed
19
49
  - Restored missing `POST /sessions/:userId/toggle-display` route that was causing `Cannot POST` 404 errors from MCP toggle_display tool
package/README.md CHANGED
@@ -4,13 +4,17 @@
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue)](tsconfig.json)
7
- [![Node](https://img.shields.io/badge/Node-18%2B-green)](package.json)
7
+ [![Node](https://img.shields.io/badge/Node-20%2B-green)](package.json)
8
+ [![npm](https://img.shields.io/npm/v/camofox-browser)](https://www.npmjs.com/package/camofox-browser)
8
9
 
9
10
  ## Table of Contents
10
11
 
11
12
  - [Why CamoFox?](#why-camofox)
12
13
  - [Features](#features)
13
14
  - [Quick Start](#quick-start)
15
+ - [CLI](#cli)
16
+ - [Security](#security)
17
+ - [Usage with AI Agents](#usage-with-ai-agents)
14
18
  - [Architecture](#architecture)
15
19
  - [API Reference](#api-reference)
16
20
  - [Search Macros](#search-macros)
@@ -52,6 +56,9 @@
52
56
  - **YouTube Transcript Extraction** — yt-dlp primary pipeline with browser fallback
53
57
  - **Snapshot Pagination** — offset-based windowing for large page snapshots
54
58
  - **Browser Health Monitoring** — health probe with recovery/degraded state tracking
59
+ - 🖥️ **CLI Mode** — 47+ commands for terminal-based browser automation
60
+ - 🔐 **Auth Vault** — AES-256-GCM encrypted credential storage (LLM-safe)
61
+ - 📜 **Pipeline Scripting** — Execute command scripts from files
55
62
 
56
63
  ## Quick Start
57
64
 
@@ -67,36 +74,26 @@ npm start
67
74
 
68
75
  ### Using npm (CLI)
69
76
 
70
- This is a **server**, not a browser automation library. Most users should run it from source or Docker.
71
-
72
- If you want a minimal CLI wrapper that starts the server (via the package `bin`):
73
-
74
77
  ```bash
75
78
  npm install -g camofox-browser
76
- camofox-browser
77
- ```
78
79
 
79
- Or one-off:
80
+ # Start the server
81
+ camofox-browser
80
82
 
81
- ```bash
82
- npx camofox-browser
83
+ # Or use the CLI for browser automation
84
+ camofox open https://example.com
85
+ camofox snapshot
86
+ camofox click e5
83
87
  ```
84
88
 
85
- ### Using Docker
89
+ > See [CLI](#cli) for the complete command reference.
86
90
 
87
- ```bash
88
- docker build -t camofox-browser .
89
- docker run -d \
90
- --name camofox-browser \
91
- -p 9377:9377 \
92
- -p 6080:6080 \
93
- -v ~/.camofox:/home/node/.camofox \
94
- camofox-browser
95
- ```
91
+ ### Using Docker
96
92
 
97
- To persist browser profiles (cookies, localStorage, IndexedDB, etc.) across container restarts:
93
+ > Docker image: `ghcr.io/redf0x1/camofox-browser`
98
94
 
99
95
  ```bash
96
+ docker build -t camofox-browser .
100
97
  docker run -d \
101
98
  --name camofox-browser \
102
99
  -p 9377:9377 \
@@ -105,7 +102,7 @@ docker run -d \
105
102
  camofox-browser
106
103
  ```
107
104
 
108
- The volume mount `-v ~/.camofox:/home/node/.camofox` ensures profiles persist across container restarts.
105
+ To persist browser profiles (cookies, localStorage, IndexedDB, etc.) across container restarts, keep the volume mount shown above.
109
106
 
110
107
  ### Using Docker Compose
111
108
 
@@ -134,9 +131,208 @@ curl http://localhost:9377/health
134
131
  # {"ok":true,"engine":"camoufox","browserConnected":true}
135
132
  ```
136
133
 
137
- ## Architecture
134
+ ## CLI
135
+
136
+ CamoFox Browser includes a powerful CLI for browser automation directly from the terminal. The CLI auto-starts the server when needed.
137
+
138
+ ### Installation
138
139
 
140
+ ```bash
141
+ # Global install (recommended)
142
+ npm install -g camofox-browser
143
+
144
+ # Or use npx (no install needed)
145
+ npx camofox open https://example.com
146
+ ```
147
+
148
+ ### Quick Start
149
+
150
+ ```bash
151
+ camofox open https://example.com # Open a page in anti-detection browser
152
+ camofox snapshot # Get accessibility tree with element refs
153
+ camofox click e5 # Click element [e5]
154
+ camofox type e3 "hello world" # Type into element [e3]
155
+ camofox screenshot --output page.png # Save screenshot
156
+ camofox close # Close the tab
157
+ ```
158
+
159
+ ### Core Commands
160
+
161
+ ```bash
162
+ # Browser lifecycle
163
+ camofox open <url> # Open URL in new tab
164
+ camofox close [tabId] # Close tab
165
+ camofox navigate <url> # Navigate current tab to URL
166
+
167
+ # Inspection
168
+ camofox snapshot # Get accessibility tree with [eN] refs
169
+ camofox screenshot [--output file] # Take screenshot (saves to file)
170
+ camofox annotate # Screenshot + element ref overlay
171
+ camofox get-url # Get current page URL
172
+ camofox get-text # Get page text content
173
+ camofox get-links # Get all links on page
174
+ camofox get-tabs # List open tabs
175
+
176
+ # Interaction
177
+ camofox click <ref> # Click element by ref
178
+ camofox type <ref> <text> # Type text into element
179
+ camofox fill '[e1]="user" [e2]="pw"' # Fill multiple fields at once
180
+ camofox scroll <direction> # Scroll up/down/left/right
181
+ camofox select <ref> <value> # Select dropdown option
182
+ camofox hover <ref> # Hover over element
183
+ camofox press <key> # Press keyboard key
184
+ camofox drag <from> <to> # Drag element to target
185
+
186
+ # Navigation
187
+ camofox go-back # Browser back
188
+ camofox go-forward # Browser forward
189
+ camofox search "query" --engine google # Search (14 engines supported)
190
+ camofox eval "document.title" # Execute JavaScript
191
+ camofox wait <selector> [--timeout ms] # Wait for element
192
+ ```
193
+
194
+ ### Session Management
195
+
196
+ ```bash
197
+ camofox session save <name> # Save current browser state
198
+ camofox session load <name> # Restore browser state
199
+ camofox session list # List saved sessions
200
+ camofox session delete <name> # Delete saved session
201
+ ```
202
+
203
+ ### Cookie Management
204
+
205
+ ```bash
206
+ camofox cookie export <file> # Export cookies to JSON file
207
+ camofox cookie import <file> # Import cookies from JSON file
208
+ ```
209
+
210
+ ### Auth Vault
211
+
212
+ Securely store credentials locally with AES-256-GCM encryption. Credentials are **never** output to stdout — safe for LLM agent automation.
213
+
214
+ ```bash
215
+ camofox auth save <profile> [--url URL] # Save credentials (prompts for master password)
216
+ camofox auth load <profile> # Show profile info (username only)
217
+ camofox auth list # List saved profiles (no secrets shown)
218
+ camofox auth delete <profile> # Delete a profile
219
+ camofox auth change-password <profile> # Change master password
220
+
221
+ # Inject credentials into a browser tab (LLM-safe)
222
+ camofox snapshot # Get element refs first
223
+ camofox auth load gmail --inject --username-ref e5 --password-ref e12
139
224
  ```
225
+
226
+ > **Security:** Master passwords use Argon2id KDF (with PBKDF2 fallback). Vault files are stored with 0600 permissions. The `--inject` flag sends credentials directly to the browser — the LLM agent never sees the password.
227
+
228
+ ### Pipeline Scripting
229
+
230
+ Execute multiple commands from a file for automation workflows:
231
+
232
+ ```bash
233
+ # Create a script
234
+ cat > login-flow.txt << 'EOF'
235
+ # Login automation script
236
+ open https://example.com/login
237
+ snapshot
238
+ type e3 "username"
239
+ type e5 "password"
240
+ click e7
241
+ wait .dashboard --timeout 5000
242
+ screenshot --output result.png
243
+ close
244
+ EOF
245
+
246
+ # Run it
247
+ camofox run login-flow.txt
248
+
249
+ # Continue on errors
250
+ camofox run login-flow.txt --continue-on-error
251
+
252
+ # Read from stdin
253
+ echo "get-url" | camofox run -
254
+ ```
255
+
256
+ ### Server Management
257
+
258
+ ```bash
259
+ camofox server start # Start server daemon
260
+ camofox server start --background # Start in background
261
+ camofox server stop # Stop server daemon
262
+ camofox server status # Check server status
263
+ ```
264
+
265
+ ### Diagnostics
266
+
267
+ ```bash
268
+ camofox health # System health report
269
+ camofox version # CLI + server version
270
+ camofox info # Configuration info
271
+ ```
272
+
273
+ ### Global Options
274
+
275
+ | Flag | Env Var | Description | Default |
276
+ |------|---------|-------------|---------|
277
+ | `--user <id>` | `CAMOFOX_USER` | User/profile ID | `cli-default` |
278
+ | `--port <port>` | `PORT` | Server port | `9377` |
279
+ | `--format <fmt>` | — | Output: `json`, `text`, `plain` | `text` |
280
+ | `-V, --version` | — | Show version | — |
281
+ | `-h, --help` | — | Show help | — |
282
+
283
+ ### Output Formats
284
+
285
+ ```bash
286
+ camofox get-url --format json # {"url":"https://example.com"}
287
+ camofox get-url --format text # URL: https://example.com
288
+ camofox get-url --format plain # https://example.com
289
+ ```
290
+
291
+ > **Tip:** Use `--format json` for programmatic parsing and LLM agent integration.
292
+
293
+ ## Security
294
+
295
+ ### Anti-Detection
296
+ CamoFox uses [Camoufox](https://github.com/daijro/camoufox), a Firefox fork with **C++ level fingerprint spoofing**. Unlike Chromium-based tools, CamoFox passes bot detection on Google, Cloudflare, and other anti-bot services.
297
+
298
+ ### Auth Vault
299
+ - **AES-256-GCM** encryption with **Argon2id** key derivation (PBKDF2 fallback)
300
+ - Credentials **never** appear in stdout (safe for LLM agent pipelines)
301
+ - Vault files stored with `0600` permissions
302
+ - Master password required for all vault operations
303
+
304
+ ### LLM Agent Safety
305
+ - The `--inject` flag sends credentials directly to the browser — the LLM agent orchestrating the CLI never sees raw passwords
306
+ - Output formats are designed for safe parsing without credential exposure
307
+ - Pipeline scripts can reference auth profiles without embedding secrets
308
+
309
+ ## Usage with AI Agents
310
+
311
+ CamoFox works seamlessly with AI coding agents and LLM-powered automation:
312
+
313
+ ### MCP Integration (Recommended)
314
+ Use [CamoFox MCP](https://github.com/redf0x1/camofox-mcp) for direct integration with Claude, Cursor, Windsurf, and other MCP-compatible agents. See [Used With](#used-with).
315
+
316
+ ### CLI Integration
317
+ AI agents can use the CLI with `--format json` for structured output:
318
+
319
+ ```bash
320
+ camofox open https://example.com # Open page
321
+ camofox snapshot --format json # Get structured element tree
322
+ camofox click e5 # Interact with elements
323
+ camofox auth load gmail --inject --username-ref e5 --password-ref e12 # Safe credential injection
324
+ ```
325
+
326
+ ### Pipeline Automation
327
+ Create reusable automation scripts that AI agents can execute:
328
+
329
+ ```bash
330
+ camofox run automation-flow.txt # Execute multi-step workflow
331
+ ```
332
+
333
+ ## Architecture
334
+
335
+ ```text
140
336
  AI Agent (MCP / OpenClaw / REST Client)
141
337
 
142
338
  ▼ HTTP REST API (port 9377)
@@ -232,6 +428,10 @@ The VNC session auto-terminates after 2 minutes (configurable via `CAMOFOX_VNC_T
232
428
  ### Evaluate JavaScript
233
429
  Execute a JavaScript expression in the page context and return the JSON-serializable result.
234
430
 
431
+ Auth: required only when `CAMOFOX_API_KEY` is set on the server; otherwise no auth is required.
432
+
433
+ Note: async expressions must be wrapped in an async IIFE (for example, `(async () => { ... })()`). Top-level `await` is not supported.
434
+
235
435
  ```bash
236
436
  POST /tabs/:tabId/evaluate
237
437
  {"userId": "agent1", "expression": "document.title"}
@@ -241,9 +441,13 @@ Returns: `{"ok": true, "result": "Page Title", "resultType": "string", "truncate
241
441
  ### Evaluate JavaScript (Extended)
242
442
  Execute a long-running JavaScript expression (up to 300s timeout). Conditionally API-key protected. Rate limited.
243
443
 
444
+ Auth: required only when `CAMOFOX_API_KEY` is set on the server; otherwise no auth is required.
445
+
446
+ Note: async expressions must be wrapped in an async IIFE (for example, `(async () => { ... })()`). Top-level `await` is not supported.
447
+
244
448
  ```bash
245
449
  POST /tabs/:tabId/evaluate-extended
246
- {"userId": "agent1", "expression": "await fetch('/api').then(r => r.json())", "timeout": 60000}
450
+ {"userId": "agent1", "expression": "(async () => { const response = await fetch('/api/data'); return await response.json(); })()", "timeout": 60000}
247
451
  ```
248
452
  Returns: `{"ok": true, "result": {...}, "resultType": "object", "truncated": false}`
249
453
 
@@ -375,7 +579,7 @@ fly deploy
375
579
 
376
580
  ### System Requirements
377
581
 
378
- - Node.js 18+ (20+ recommended)
582
+ - Node.js 20+
379
583
  - 2GB+ RAM (browser + contexts require significant memory)
380
584
  - Linux recommended for production; macOS is fine for development
381
585
 
@@ -391,6 +595,13 @@ fly deploy
391
595
 
392
596
  ```text
393
597
  src/
598
+ ├── cli/
599
+ │ ├── commands/ # Command modules (core, navigation, interaction, etc.)
600
+ │ ├── vault/ # Auth vault (encryption, storage)
601
+ │ ├── server/ # Server lifecycle management
602
+ │ ├── transport/ # HTTP transport layer
603
+ │ ├── output/ # Output formatting
604
+ │ └── utils/ # Shared utilities
394
605
  ├── server.ts # Express app entry point
395
606
  ├── types.ts # Shared TypeScript interfaces
396
607
  ├── routes/
@@ -1,39 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Minimal CLI entrypoint for running the server via `npx camofox-browser`.
4
- // The server starts listening as a side effect of importing the built entry.
5
-
6
3
  const args = process.argv.slice(2);
7
4
 
8
- if (args.includes('--help') || args.includes('-h')) {
5
+ if (args.includes('--version') || args.includes('-v')) {
9
6
  const pkg = require('../package.json');
10
- console.log(`
11
- CamoFox Browser Server v${pkg.version}
12
- Anti-detection browser server for AI agents
13
-
14
- Usage:
15
- camofox-browser [options]
16
-
17
- Options:
18
- --help, -h Show this help message
19
- --version, -v Show version number
7
+ console.log(pkg.version);
8
+ process.exit(0);
9
+ }
20
10
 
21
- Environment Variables:
22
- PORT Server port (default: 9377)
23
- CAMOFOX_API_KEY API key for protected endpoints
24
- CAMOFOX_HEADLESS Run browser headless (default: false)
25
- CAMOFOX_PROXY Proxy URL for browser
11
+ const firstArg = args[0];
12
+ const shouldRunServer = args.length === 0 || firstArg === 'serve';
26
13
 
27
- Documentation:
28
- https://github.com/redf0x1/camofox-browser
29
- `);
30
- process.exit(0);
14
+ if (shouldRunServer) {
15
+ require('../dist/src/server.js');
16
+ return;
31
17
  }
32
18
 
33
- if (args.includes('--version') || args.includes('-v')) {
34
- const pkg = require('../package.json');
35
- console.log(pkg.version);
36
- process.exit(0);
19
+ const cli = require('../dist/src/cli/index.js');
20
+ if (!cli || typeof cli.run !== 'function') {
21
+ console.error('CLI entrypoint is missing. Please run "npm run build" first.');
22
+ process.exit(1);
37
23
  }
38
24
 
39
- require('../dist/src/server.js');
25
+ void cli.run(process.argv);
package/bin/camofox.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const cli = require('../dist/src/cli/index.js');
4
+
5
+ if (!cli || typeof cli.run !== 'function') {
6
+ console.error('CLI entrypoint is missing. Please run "npm run build" first.');
7
+ process.exit(1);
8
+ }
9
+
10
+ void cli.run(process.argv);
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ import type { CliContext } from '../types';
3
+ export declare function registerAdvancedCommands(program: Command, context: CliContext): void;
4
+ //# sourceMappingURL=advanced.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/advanced.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAuJ3C,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAkMpF"}