create-modern-react 2.3.4 → 2.3.6

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 (74) hide show
  1. package/bin/index.js +2 -1
  2. package/lib/install.js +12 -6
  3. package/lib/prompts.js +16 -2
  4. package/lib/setup.js +32 -2
  5. package/package.json +4 -2
  6. package/scripts/postinstall.js +18 -0
  7. package/templates/base/.claude/skills.tar.gz +0 -0
  8. package/templates/base/.claude/skills/agent-browser/SKILL.md +0 -356
  9. package/templates/base/.claude/skills/agent-browser/references/authentication.md +0 -188
  10. package/templates/base/.claude/skills/agent-browser/references/proxy-support.md +0 -175
  11. package/templates/base/.claude/skills/agent-browser/references/session-management.md +0 -181
  12. package/templates/base/.claude/skills/agent-browser/references/snapshot-refs.md +0 -186
  13. package/templates/base/.claude/skills/agent-browser/references/video-recording.md +0 -162
  14. package/templates/base/.claude/skills/agent-browser/templates/authenticated-session.sh +0 -91
  15. package/templates/base/.claude/skills/agent-browser/templates/capture-workflow.sh +0 -68
  16. package/templates/base/.claude/skills/agent-browser/templates/form-automation.sh +0 -64
  17. package/templates/base/.claude/skills/autoskill/skill.md +0 -134
  18. package/templates/base/.claude/skills/design-principles/skill.md +0 -237
  19. package/templates/base/.claude/skills/frontend-design/skill.md +0 -42
  20. package/templates/base/.claude/skills/learn-together/skill.md +0 -448
  21. package/templates/base/.claude/skills/question-me/skill.md +0 -175
  22. package/templates/base/.claude/skills/react-best-practices/AGENTS.md +0 -2410
  23. package/templates/base/.claude/skills/react-best-practices/README.md +0 -123
  24. package/templates/base/.claude/skills/react-best-practices/SKILL.md +0 -135
  25. package/templates/base/.claude/skills/react-best-practices/metadata.json +0 -15
  26. package/templates/base/.claude/skills/react-best-practices/rules/_sections.md +0 -46
  27. package/templates/base/.claude/skills/react-best-practices/rules/_template.md +0 -28
  28. package/templates/base/.claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  29. package/templates/base/.claude/skills/react-best-practices/rules/advanced-use-latest.md +0 -49
  30. package/templates/base/.claude/skills/react-best-practices/rules/async-api-routes.md +0 -38
  31. package/templates/base/.claude/skills/react-best-practices/rules/async-defer-await.md +0 -80
  32. package/templates/base/.claude/skills/react-best-practices/rules/async-dependencies.md +0 -36
  33. package/templates/base/.claude/skills/react-best-practices/rules/async-parallel.md +0 -28
  34. package/templates/base/.claude/skills/react-best-practices/rules/async-suspense-boundaries.md +0 -99
  35. package/templates/base/.claude/skills/react-best-practices/rules/bundle-barrel-imports.md +0 -59
  36. package/templates/base/.claude/skills/react-best-practices/rules/bundle-conditional.md +0 -31
  37. package/templates/base/.claude/skills/react-best-practices/rules/bundle-defer-third-party.md +0 -49
  38. package/templates/base/.claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  39. package/templates/base/.claude/skills/react-best-practices/rules/bundle-preload.md +0 -50
  40. package/templates/base/.claude/skills/react-best-practices/rules/client-event-listeners.md +0 -74
  41. package/templates/base/.claude/skills/react-best-practices/rules/client-localstorage-schema.md +0 -71
  42. package/templates/base/.claude/skills/react-best-practices/rules/client-passive-event-listeners.md +0 -48
  43. package/templates/base/.claude/skills/react-best-practices/rules/client-swr-dedup.md +0 -56
  44. package/templates/base/.claude/skills/react-best-practices/rules/js-batch-dom-css.md +0 -57
  45. package/templates/base/.claude/skills/react-best-practices/rules/js-cache-function-results.md +0 -80
  46. package/templates/base/.claude/skills/react-best-practices/rules/js-cache-property-access.md +0 -28
  47. package/templates/base/.claude/skills/react-best-practices/rules/js-cache-storage.md +0 -70
  48. package/templates/base/.claude/skills/react-best-practices/rules/js-combine-iterations.md +0 -32
  49. package/templates/base/.claude/skills/react-best-practices/rules/js-early-exit.md +0 -50
  50. package/templates/base/.claude/skills/react-best-practices/rules/js-hoist-regexp.md +0 -45
  51. package/templates/base/.claude/skills/react-best-practices/rules/js-index-maps.md +0 -37
  52. package/templates/base/.claude/skills/react-best-practices/rules/js-length-check-first.md +0 -49
  53. package/templates/base/.claude/skills/react-best-practices/rules/js-min-max-loop.md +0 -82
  54. package/templates/base/.claude/skills/react-best-practices/rules/js-set-map-lookups.md +0 -24
  55. package/templates/base/.claude/skills/react-best-practices/rules/js-tosorted-immutable.md +0 -57
  56. package/templates/base/.claude/skills/react-best-practices/rules/rendering-activity.md +0 -26
  57. package/templates/base/.claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  58. package/templates/base/.claude/skills/react-best-practices/rules/rendering-conditional-render.md +0 -40
  59. package/templates/base/.claude/skills/react-best-practices/rules/rendering-content-visibility.md +0 -38
  60. package/templates/base/.claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  61. package/templates/base/.claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  62. package/templates/base/.claude/skills/react-best-practices/rules/rendering-svg-precision.md +0 -28
  63. package/templates/base/.claude/skills/react-best-practices/rules/rerender-defer-reads.md +0 -39
  64. package/templates/base/.claude/skills/react-best-practices/rules/rerender-dependencies.md +0 -45
  65. package/templates/base/.claude/skills/react-best-practices/rules/rerender-derived-state.md +0 -29
  66. package/templates/base/.claude/skills/react-best-practices/rules/rerender-functional-setstate.md +0 -74
  67. package/templates/base/.claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  68. package/templates/base/.claude/skills/react-best-practices/rules/rerender-memo.md +0 -44
  69. package/templates/base/.claude/skills/react-best-practices/rules/rerender-transitions.md +0 -40
  70. package/templates/base/.claude/skills/react-best-practices/rules/server-after-nonblocking.md +0 -73
  71. package/templates/base/.claude/skills/react-best-practices/rules/server-cache-lru.md +0 -41
  72. package/templates/base/.claude/skills/react-best-practices/rules/server-cache-react.md +0 -76
  73. package/templates/base/.claude/skills/react-best-practices/rules/server-parallel-fetching.md +0 -83
  74. package/templates/base/.claude/skills/react-best-practices/rules/server-serialization.md +0 -38
package/bin/index.js CHANGED
@@ -9,10 +9,11 @@ program
9
9
  .description(
10
10
  'Create production-ready React + TypeScript + Tailwind applications in seconds'
11
11
  )
12
- .version('2.0.0')
12
+ .version('2.3.5')
13
13
  .argument('[project-name]', 'name of the project')
14
14
  .option('--skip-install', 'skip dependency installation')
15
15
  .option('--skip-git', 'skip git initialization')
16
+ .option('--no-scripts', 'skip all lifecycle scripts (skills extraction + npm scripts)')
16
17
  .action(async (projectName, options) => {
17
18
  try {
18
19
  await createProject(projectName, options);
package/lib/install.js CHANGED
@@ -69,27 +69,33 @@ async function getAvailablePackageManager(preferredManager) {
69
69
  }
70
70
 
71
71
  // Get install command and args for package manager
72
- function getInstallCommand(packageManager) {
72
+ function getInstallCommand(packageManager, noScripts = false) {
73
+ const ignoreScriptsFlag = noScripts ? ['--ignore-scripts'] : [];
74
+
73
75
  switch (packageManager) {
74
76
  case 'yarn':
75
- return { command: 'yarn', args: ['install'] };
77
+ return { command: 'yarn', args: ['install', ...ignoreScriptsFlag] };
76
78
  case 'pnpm':
77
- return { command: 'pnpm', args: ['install'] };
79
+ return { command: 'pnpm', args: ['install', ...ignoreScriptsFlag] };
78
80
  case 'npm':
79
81
  default:
80
- return { command: 'npm', args: ['install'] };
82
+ return { command: 'npm', args: ['install', ...ignoreScriptsFlag] };
81
83
  }
82
84
  }
83
85
 
84
86
  async function installDependencies(config) {
85
- const { projectPath, packageManager: preferredManager, projectName } = config;
87
+ const { projectPath, packageManager: preferredManager, projectName, noScripts } = config;
86
88
 
87
89
  console.log(chalk.blue('\n📦 Installing dependencies...'));
88
90
 
89
91
  try {
90
92
  // Get the best available package manager
91
93
  const availableManager = await getAvailablePackageManager(preferredManager);
92
- const { command, args } = getInstallCommand(availableManager);
94
+ const { command, args } = getInstallCommand(availableManager, noScripts);
95
+
96
+ if (noScripts) {
97
+ console.log(chalk.yellow('⚠️ Running with --ignore-scripts (lifecycle scripts disabled)'));
98
+ }
93
99
 
94
100
  // Update config with actual package manager used
95
101
  config.actualPackageManager = availableManager;
package/lib/prompts.js CHANGED
@@ -163,7 +163,9 @@ async function createProject(projectName, options) {
163
163
  useHusky: optionalFeatures.includes('husky'),
164
164
  // Flags
165
165
  initGit,
166
- installDeps
166
+ installDeps,
167
+ // Security: skip lifecycle scripts when --no-scripts is passed
168
+ noScripts: options.scripts === false
167
169
  };
168
170
 
169
171
  // ─────────────────────────────────────────────────────────────
@@ -178,7 +180,11 @@ async function createProject(projectName, options) {
178
180
  console.log(chalk.cyan('│') + chalk.gray(` ${config.useAntd ? 'Ant Design v5' : 'Shadcn/ui components'} `) + chalk.cyan('│'));
179
181
  console.log(chalk.cyan('│') + chalk.gray(' Wouter routing + Axios ') + chalk.cyan('│'));
180
182
  console.log(chalk.cyan('│') + chalk.gray(' Lucide icons + ESLint + Prettier ') + chalk.cyan('│'));
181
- console.log(chalk.cyan('│') + chalk.magenta(' 🤖 Claude Code AI Skills ') + chalk.cyan('│'));
183
+ if (config.noScripts) {
184
+ console.log(chalk.cyan('│') + chalk.yellow(' 🔒 Claude Code AI Skills (skipped) ') + chalk.cyan('│'));
185
+ } else {
186
+ console.log(chalk.cyan('│') + chalk.magenta(' 🤖 Claude Code AI Skills ') + chalk.cyan('│'));
187
+ }
182
188
  console.log(chalk.cyan('├─────────────────────────────────────────────┤'));
183
189
  console.log(chalk.cyan('│') + chalk.white(' Optional Features: ') + chalk.cyan('│'));
184
190
  console.log(chalk.cyan('│') + ` Redux Toolkit: ${config.useRedux ? chalk.green('✓') : chalk.gray('✗')} ` + chalk.cyan('│'));
@@ -204,6 +210,14 @@ async function createProject(projectName, options) {
204
210
  const runCmd = pm === 'npm' ? 'npm run' : pm;
205
211
 
206
212
  console.log(chalk.green.bold(`\n✅ Project "${projectName}" created successfully!\n`));
213
+
214
+ // Show note if --no-scripts was used
215
+ if (config.noScripts) {
216
+ console.log(chalk.yellow('ℹ️ Note: --no-scripts was used\n'));
217
+ console.log(chalk.gray(' • Claude Code AI skills were not included'));
218
+ console.log(chalk.gray(' • Dependency lifecycle scripts were skipped\n'));
219
+ }
220
+
207
221
  console.log(chalk.white('Next steps:\n'));
208
222
  console.log(chalk.gray(` cd ${projectName}`));
209
223
  if (!installDeps) {
package/lib/setup.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
+ const { execSync } = require('child_process');
4
5
  const { runCommand } = require('./install');
5
6
 
6
7
  /**
@@ -19,8 +20,16 @@ async function setupProject(config) {
19
20
  const templatePath = path.join(__dirname, '../templates/base');
20
21
  await fs.copy(templatePath, projectPath);
21
22
 
22
- // Step 2.5: Log Claude Code AI skills inclusion
23
- console.log(chalk.gray(' Including Claude Code AI skills (.claude/skills)...'));
23
+ // Step 2.5: Extract Claude Code AI skills from archive (unless --no-scripts)
24
+ if (config.noScripts) {
25
+ console.log(chalk.gray(' Skipping Claude Code AI skills (--no-scripts)...'));
26
+ // Remove the archive since we're not extracting it
27
+ const archivePath = path.join(projectPath, '.claude/skills.tar.gz');
28
+ await fs.remove(archivePath);
29
+ } else {
30
+ console.log(chalk.gray(' Including Claude Code AI skills (.claude/skills)...'));
31
+ await extractSkillsArchive(projectPath);
32
+ }
24
33
 
25
34
  // Step 3: Handle Antd vs Shadcn/ui
26
35
  if (config.useAntd) {
@@ -338,6 +347,27 @@ async function setupHusky(projectPath) {
338
347
  }
339
348
  }
340
349
 
350
+ /**
351
+ * Extract skills.tar.gz archive in the new project
352
+ */
353
+ async function extractSkillsArchive(projectPath) {
354
+ const claudeDir = path.join(projectPath, '.claude');
355
+ const archivePath = path.join(claudeDir, 'skills.tar.gz');
356
+
357
+ if (await fs.pathExists(archivePath)) {
358
+ try {
359
+ execSync('tar -xzf skills.tar.gz', { cwd: claudeDir, stdio: 'ignore' });
360
+ // Remove the archive after extraction
361
+ await fs.remove(archivePath);
362
+ } catch (error) {
363
+ console.warn(
364
+ chalk.yellow(' ⚠️ Could not extract skills archive:'),
365
+ error.message
366
+ );
367
+ }
368
+ }
369
+ }
370
+
341
371
  /**
342
372
  * Sort object keys alphabetically
343
373
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-modern-react",
3
- "version": "2.3.4",
3
+ "version": "2.3.6",
4
4
  "description": "Create production-ready React + TypeScript + Tailwind applications in seconds",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
@@ -41,7 +41,8 @@
41
41
  "files": [
42
42
  "bin",
43
43
  "lib",
44
- "templates"
44
+ "templates",
45
+ "scripts"
45
46
  ],
46
47
  "dependencies": {
47
48
  "chalk": "^4.1.2",
@@ -56,6 +57,7 @@
56
57
  "prettier": "^3.0.0"
57
58
  },
58
59
  "scripts": {
60
+ "postinstall": "node scripts/postinstall.js",
59
61
  "test": "echo \"Error: no test specified\" && exit 1",
60
62
  "lint": "eslint .",
61
63
  "format": "prettier --write ."
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+
7
+ const skillsArchive = path.join(__dirname, '../templates/base/.claude/skills.tar.gz');
8
+ const skillsDir = path.join(__dirname, '../templates/base/.claude/skills');
9
+
10
+ // Only extract if archive exists and skills folder doesn't
11
+ if (fs.existsSync(skillsArchive) && !fs.existsSync(skillsDir)) {
12
+ try {
13
+ const claudeDir = path.join(__dirname, '../templates/base/.claude');
14
+ execSync(`tar -xzf skills.tar.gz`, { cwd: claudeDir, stdio: 'ignore' });
15
+ } catch (err) {
16
+ // Silently fail - skills are optional enhancement
17
+ }
18
+ }
@@ -1,356 +0,0 @@
1
- ---
2
- name: agent-browser
3
- description: Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
4
- allowed-tools: Bash(agent-browser:*)
5
- ---
6
-
7
- # Browser Automation with agent-browser
8
-
9
- ## Quick start
10
-
11
- ```bash
12
- agent-browser open <url> # Navigate to page
13
- agent-browser snapshot -i # Get interactive elements with refs
14
- agent-browser click @e1 # Click element by ref
15
- agent-browser fill @e2 "text" # Fill input by ref
16
- agent-browser close # Close browser
17
- ```
18
-
19
- ## Core workflow
20
-
21
- 1. Navigate: `agent-browser open <url>`
22
- 2. Snapshot: `agent-browser snapshot -i` (returns elements with refs like `@e1`, `@e2`)
23
- 3. Interact using refs from the snapshot
24
- 4. Re-snapshot after navigation or significant DOM changes
25
-
26
- ## Commands
27
-
28
- ### Navigation
29
-
30
- ```bash
31
- agent-browser open <url> # Navigate to URL (aliases: goto, navigate)
32
- # Supports: https://, http://, file://, about:, data://
33
- # Auto-prepends https:// if no protocol given
34
- agent-browser back # Go back
35
- agent-browser forward # Go forward
36
- agent-browser reload # Reload page
37
- agent-browser close # Close browser (aliases: quit, exit)
38
- agent-browser connect 9222 # Connect to browser via CDP port
39
- ```
40
-
41
- ### Snapshot (page analysis)
42
-
43
- ```bash
44
- agent-browser snapshot # Full accessibility tree
45
- agent-browser snapshot -i # Interactive elements only (recommended)
46
- agent-browser snapshot -c # Compact output
47
- agent-browser snapshot -d 3 # Limit depth to 3
48
- agent-browser snapshot -s "#main" # Scope to CSS selector
49
- ```
50
-
51
- ### Interactions (use @refs from snapshot)
52
-
53
- ```bash
54
- agent-browser click @e1 # Click
55
- agent-browser dblclick @e1 # Double-click
56
- agent-browser focus @e1 # Focus element
57
- agent-browser fill @e2 "text" # Clear and type
58
- agent-browser type @e2 "text" # Type without clearing
59
- agent-browser press Enter # Press key (alias: key)
60
- agent-browser press Control+a # Key combination
61
- agent-browser keydown Shift # Hold key down
62
- agent-browser keyup Shift # Release key
63
- agent-browser hover @e1 # Hover
64
- agent-browser check @e1 # Check checkbox
65
- agent-browser uncheck @e1 # Uncheck checkbox
66
- agent-browser select @e1 "value" # Select dropdown option
67
- agent-browser select @e1 "a" "b" # Select multiple options
68
- agent-browser scroll down 500 # Scroll page (default: down 300px)
69
- agent-browser scrollintoview @e1 # Scroll element into view (alias: scrollinto)
70
- agent-browser drag @e1 @e2 # Drag and drop
71
- agent-browser upload @e1 file.pdf # Upload files
72
- ```
73
-
74
- ### Get information
75
-
76
- ```bash
77
- agent-browser get text @e1 # Get element text
78
- agent-browser get html @e1 # Get innerHTML
79
- agent-browser get value @e1 # Get input value
80
- agent-browser get attr @e1 href # Get attribute
81
- agent-browser get title # Get page title
82
- agent-browser get url # Get current URL
83
- agent-browser get count ".item" # Count matching elements
84
- agent-browser get box @e1 # Get bounding box
85
- agent-browser get styles @e1 # Get computed styles (font, color, bg, etc.)
86
- ```
87
-
88
- ### Check state
89
-
90
- ```bash
91
- agent-browser is visible @e1 # Check if visible
92
- agent-browser is enabled @e1 # Check if enabled
93
- agent-browser is checked @e1 # Check if checked
94
- ```
95
-
96
- ### Screenshots & PDF
97
-
98
- ```bash
99
- agent-browser screenshot # Screenshot to stdout
100
- agent-browser screenshot path.png # Save to file
101
- agent-browser screenshot --full # Full page
102
- agent-browser pdf output.pdf # Save as PDF
103
- ```
104
-
105
- ### Video recording
106
-
107
- ```bash
108
- agent-browser record start ./demo.webm # Start recording (uses current URL + state)
109
- agent-browser click @e1 # Perform actions
110
- agent-browser record stop # Stop and save video
111
- agent-browser record restart ./take2.webm # Stop current + start new recording
112
- ```
113
-
114
- Recording creates a fresh context but preserves cookies/storage from your session. If no URL is provided, it
115
- automatically returns to your current page. For smooth demos, explore first, then start recording.
116
-
117
- ### Wait
118
-
119
- ```bash
120
- agent-browser wait @e1 # Wait for element
121
- agent-browser wait 2000 # Wait milliseconds
122
- agent-browser wait --text "Success" # Wait for text (or -t)
123
- agent-browser wait --url "**/dashboard" # Wait for URL pattern (or -u)
124
- agent-browser wait --load networkidle # Wait for network idle (or -l)
125
- agent-browser wait --fn "window.ready" # Wait for JS condition (or -f)
126
- ```
127
-
128
- ### Mouse control
129
-
130
- ```bash
131
- agent-browser mouse move 100 200 # Move mouse
132
- agent-browser mouse down left # Press button
133
- agent-browser mouse up left # Release button
134
- agent-browser mouse wheel 100 # Scroll wheel
135
- ```
136
-
137
- ### Semantic locators (alternative to refs)
138
-
139
- ```bash
140
- agent-browser find role button click --name "Submit"
141
- agent-browser find text "Sign In" click
142
- agent-browser find text "Sign In" click --exact # Exact match only
143
- agent-browser find label "Email" fill "user@test.com"
144
- agent-browser find placeholder "Search" type "query"
145
- agent-browser find alt "Logo" click
146
- agent-browser find title "Close" click
147
- agent-browser find testid "submit-btn" click
148
- agent-browser find first ".item" click
149
- agent-browser find last ".item" click
150
- agent-browser find nth 2 "a" hover
151
- ```
152
-
153
- ### Browser settings
154
-
155
- ```bash
156
- agent-browser set viewport 1920 1080 # Set viewport size
157
- agent-browser set device "iPhone 14" # Emulate device
158
- agent-browser set geo 37.7749 -122.4194 # Set geolocation (alias: geolocation)
159
- agent-browser set offline on # Toggle offline mode
160
- agent-browser set headers '{"X-Key":"v"}' # Extra HTTP headers
161
- agent-browser set credentials user pass # HTTP basic auth (alias: auth)
162
- agent-browser set media dark # Emulate color scheme
163
- agent-browser set media light reduced-motion # Light mode + reduced motion
164
- ```
165
-
166
- ### Cookies & Storage
167
-
168
- ```bash
169
- agent-browser cookies # Get all cookies
170
- agent-browser cookies set name value # Set cookie
171
- agent-browser cookies clear # Clear cookies
172
- agent-browser storage local # Get all localStorage
173
- agent-browser storage local key # Get specific key
174
- agent-browser storage local set k v # Set value
175
- agent-browser storage local clear # Clear all
176
- ```
177
-
178
- ### Network
179
-
180
- ```bash
181
- agent-browser network route <url> # Intercept requests
182
- agent-browser network route <url> --abort # Block requests
183
- agent-browser network route <url> --body '{}' # Mock response
184
- agent-browser network unroute [url] # Remove routes
185
- agent-browser network requests # View tracked requests
186
- agent-browser network requests --filter api # Filter requests
187
- ```
188
-
189
- ### Tabs & Windows
190
-
191
- ```bash
192
- agent-browser tab # List tabs
193
- agent-browser tab new [url] # New tab
194
- agent-browser tab 2 # Switch to tab by index
195
- agent-browser tab close # Close current tab
196
- agent-browser tab close 2 # Close tab by index
197
- agent-browser window new # New window
198
- ```
199
-
200
- ### Frames
201
-
202
- ```bash
203
- agent-browser frame "#iframe" # Switch to iframe
204
- agent-browser frame main # Back to main frame
205
- ```
206
-
207
- ### Dialogs
208
-
209
- ```bash
210
- agent-browser dialog accept [text] # Accept dialog
211
- agent-browser dialog dismiss # Dismiss dialog
212
- ```
213
-
214
- ### JavaScript
215
-
216
- ```bash
217
- agent-browser eval "document.title" # Run JavaScript
218
- ```
219
-
220
- ## Global options
221
-
222
- ```bash
223
- agent-browser --session <name> ... # Isolated browser session
224
- agent-browser --json ... # JSON output for parsing
225
- agent-browser --headed ... # Show browser window (not headless)
226
- agent-browser --full ... # Full page screenshot (-f)
227
- agent-browser --cdp <port> ... # Connect via Chrome DevTools Protocol
228
- agent-browser -p <provider> ... # Cloud browser provider (--provider)
229
- agent-browser --proxy <url> ... # Use proxy server
230
- agent-browser --headers <json> ... # HTTP headers scoped to URL's origin
231
- agent-browser --executable-path <p> # Custom browser executable
232
- agent-browser --extension <path> ... # Load browser extension (repeatable)
233
- agent-browser --help # Show help (-h)
234
- agent-browser --version # Show version (-V)
235
- agent-browser <command> --help # Show detailed help for a command
236
- ```
237
-
238
- ### Proxy support
239
-
240
- ```bash
241
- agent-browser --proxy http://proxy.com:8080 open example.com
242
- agent-browser --proxy http://user:pass@proxy.com:8080 open example.com
243
- agent-browser --proxy socks5://proxy.com:1080 open example.com
244
- ```
245
-
246
- ## Environment variables
247
-
248
- ```bash
249
- AGENT_BROWSER_SESSION="mysession" # Default session name
250
- AGENT_BROWSER_EXECUTABLE_PATH="/path/chrome" # Custom browser path
251
- AGENT_BROWSER_EXTENSIONS="/ext1,/ext2" # Comma-separated extension paths
252
- AGENT_BROWSER_PROVIDER="browserbase" # Cloud browser provider
253
- AGENT_BROWSER_STREAM_PORT="9223" # WebSocket streaming port
254
- AGENT_BROWSER_HOME="/path/to/agent-browser" # Custom install location (for daemon.js)
255
- ```
256
-
257
- ## Example: Form submission
258
-
259
- ```bash
260
- agent-browser open https://example.com/form
261
- agent-browser snapshot -i
262
- # Output shows: textbox "Email" [ref=e1], textbox "Password" [ref=e2], button "Submit" [ref=e3]
263
-
264
- agent-browser fill @e1 "user@example.com"
265
- agent-browser fill @e2 "password123"
266
- agent-browser click @e3
267
- agent-browser wait --load networkidle
268
- agent-browser snapshot -i # Check result
269
- ```
270
-
271
- ## Example: Authentication with saved state
272
-
273
- ```bash
274
- # Login once
275
- agent-browser open https://app.example.com/login
276
- agent-browser snapshot -i
277
- agent-browser fill @e1 "username"
278
- agent-browser fill @e2 "password"
279
- agent-browser click @e3
280
- agent-browser wait --url "**/dashboard"
281
- agent-browser state save auth.json
282
-
283
- # Later sessions: load saved state
284
- agent-browser state load auth.json
285
- agent-browser open https://app.example.com/dashboard
286
- ```
287
-
288
- ## Sessions (parallel browsers)
289
-
290
- ```bash
291
- agent-browser --session test1 open site-a.com
292
- agent-browser --session test2 open site-b.com
293
- agent-browser session list
294
- ```
295
-
296
- ## JSON output (for parsing)
297
-
298
- Add `--json` for machine-readable output:
299
-
300
- ```bash
301
- agent-browser snapshot -i --json
302
- agent-browser get text @e1 --json
303
- ```
304
-
305
- ## Debugging
306
-
307
- ```bash
308
- agent-browser --headed open example.com # Show browser window
309
- agent-browser --cdp 9222 snapshot # Connect via CDP port
310
- agent-browser connect 9222 # Alternative: connect command
311
- agent-browser console # View console messages
312
- agent-browser console --clear # Clear console
313
- agent-browser errors # View page errors
314
- agent-browser errors --clear # Clear errors
315
- agent-browser highlight @e1 # Highlight element
316
- agent-browser trace start # Start recording trace
317
- agent-browser trace stop trace.zip # Stop and save trace
318
- agent-browser record start ./debug.webm # Record video from current page
319
- agent-browser record stop # Save recording
320
- ```
321
-
322
- ## Deep-dive documentation
323
-
324
- For detailed patterns and best practices, see:
325
-
326
- | Reference | Description |
327
- |-----------|-------------|
328
- | [references/snapshot-refs.md](references/snapshot-refs.md) | Ref lifecycle, invalidation rules, troubleshooting |
329
- | [references/session-management.md](references/session-management.md) | Parallel sessions, state persistence, concurrent scraping |
330
- | [references/authentication.md](references/authentication.md) | Login flows, OAuth, 2FA handling, state reuse |
331
- | [references/video-recording.md](references/video-recording.md) | Recording workflows for debugging and documentation |
332
- | [references/proxy-support.md](references/proxy-support.md) | Proxy configuration, geo-testing, rotating proxies |
333
-
334
- ## Ready-to-use templates
335
-
336
- Executable workflow scripts for common patterns:
337
-
338
- | Template | Description |
339
- |----------|-------------|
340
- | [templates/form-automation.sh](templates/form-automation.sh) | Form filling with validation |
341
- | [templates/authenticated-session.sh](templates/authenticated-session.sh) | Login once, reuse state |
342
- | [templates/capture-workflow.sh](templates/capture-workflow.sh) | Content extraction with screenshots |
343
-
344
- Usage:
345
- ```bash
346
- ./templates/form-automation.sh https://example.com/form
347
- ./templates/authenticated-session.sh https://app.example.com/login
348
- ./templates/capture-workflow.sh https://example.com ./output
349
- ```
350
-
351
- ## HTTPS Certificate Errors
352
-
353
- For sites with self-signed or invalid certificates:
354
- ```bash
355
- agent-browser open https://localhost:8443 --ignore-https-errors
356
- ```