create-modern-react 2.1.2 → 2.3.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 +50 -0
- package/lib/prompts.js +8 -0
- package/lib/setup.js +18 -1
- package/package.json +1 -1
- package/templates/base/.claude/skills/agent-browser/SKILL.md +356 -0
- package/templates/base/.claude/skills/agent-browser/references/authentication.md +188 -0
- package/templates/base/.claude/skills/agent-browser/references/proxy-support.md +175 -0
- package/templates/base/.claude/skills/agent-browser/references/session-management.md +181 -0
- package/templates/base/.claude/skills/agent-browser/references/snapshot-refs.md +186 -0
- package/templates/base/.claude/skills/agent-browser/references/video-recording.md +162 -0
- package/templates/base/.claude/skills/agent-browser/templates/authenticated-session.sh +91 -0
- package/templates/base/.claude/skills/agent-browser/templates/capture-workflow.sh +68 -0
- package/templates/base/.claude/skills/agent-browser/templates/form-automation.sh +64 -0
- package/templates/base/.claude/skills/autoskill/skill.md +134 -0
- package/templates/base/.claude/skills/design-principles/skill.md +237 -0
- package/templates/base/.claude/skills/frontend-design/skill.md +42 -0
- package/templates/base/.claude/skills/learn-together/skill.md +448 -0
- package/templates/base/.claude/skills/question-me/skill.md +175 -0
- package/templates/base/.claude/skills/react-best-practices/AGENTS.md +2410 -0
- package/templates/base/.claude/skills/react-best-practices/README.md +123 -0
- package/templates/base/.claude/skills/react-best-practices/SKILL.md +135 -0
- package/templates/base/.claude/skills/react-best-practices/metadata.json +15 -0
- package/templates/base/.claude/skills/react-best-practices/rules/_sections.md +46 -0
- package/templates/base/.claude/skills/react-best-practices/rules/_template.md +28 -0
- package/templates/base/.claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/templates/base/.claude/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
- package/templates/base/.claude/skills/react-best-practices/rules/async-api-routes.md +38 -0
- package/templates/base/.claude/skills/react-best-practices/rules/async-defer-await.md +80 -0
- package/templates/base/.claude/skills/react-best-practices/rules/async-dependencies.md +36 -0
- package/templates/base/.claude/skills/react-best-practices/rules/async-parallel.md +28 -0
- package/templates/base/.claude/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-conditional.md +31 -0
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/templates/base/.claude/skills/react-best-practices/rules/bundle-preload.md +50 -0
- package/templates/base/.claude/skills/react-best-practices/rules/client-event-listeners.md +74 -0
- package/templates/base/.claude/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/templates/base/.claude/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/templates/base/.claude/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-batch-dom-css.md +57 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-cache-storage.md +70 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-early-exit.md +50 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-index-maps.md +37 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-length-check-first.md +49 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/templates/base/.claude/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-activity.md +26 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-memo.md +44 -0
- package/templates/base/.claude/skills/react-best-practices/rules/rerender-transitions.md +40 -0
- package/templates/base/.claude/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/templates/base/.claude/skills/react-best-practices/rules/server-cache-lru.md +41 -0
- package/templates/base/.claude/skills/react-best-practices/rules/server-cache-react.md +76 -0
- package/templates/base/.claude/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/templates/base/.claude/skills/react-best-practices/rules/server-serialization.md +38 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/react-native.csv +53 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/templates/base/.claude/skills/ui-ux-pro-max/scripts/search.py +106 -0
- package/templates/base/public/robots.txt +2 -0
- package/templates/base/public/screenshots/healthmug.png +0 -0
- package/templates/base/public/screenshots/resumefreepro.png +0 -0
- package/templates/base/public/vite.svg +1 -0
- package/templates/base/src/screens/home/index.tsx +113 -14
- package/templates/optional/forms/index.ts +2 -0
- package/templates/optional/forms/types.ts +39 -0
- package/templates/optional/forms/use-zod-form.ts +59 -0
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
│ ✗ No toast notifications ✓ react-hot-toast │
|
|
46
46
|
│ ✗ No error boundary ✓ Built-in │
|
|
47
47
|
│ ✗ Basic ESLint ✓ 25+ rules configured │
|
|
48
|
+
│ ✗ No form validation ✓ RHF + Zod (optional) │
|
|
48
49
|
│ ✗ No state management ✓ Redux (optional) │
|
|
49
50
|
│ ✗ ~2 hours setup ✓ 15 seconds │
|
|
50
51
|
│ │
|
|
@@ -106,6 +107,7 @@ Select during project creation:
|
|
|
106
107
|
|
|
107
108
|
```
|
|
108
109
|
[ ] Redux Toolkit + Redux Persist ── State management with persistence
|
|
110
|
+
[ ] React Hook Form + Zod ────────── Type-safe form validation
|
|
109
111
|
[ ] Ant Design v5 ───────────────── Enterprise UI (replaces Shadcn/ui)
|
|
110
112
|
[ ] Husky + lint-staged ─────────── Git hooks for code quality
|
|
111
113
|
```
|
|
@@ -134,6 +136,8 @@ Select during project creation:
|
|
|
134
136
|
|
|
135
137
|
```
|
|
136
138
|
my-app/
|
|
139
|
+
├── .claude/
|
|
140
|
+
│ └── skills/ # 8 AI skills included (extensible)
|
|
137
141
|
├── src/
|
|
138
142
|
│ ├── components/
|
|
139
143
|
│ │ ├── ui/ # Shadcn/ui components
|
|
@@ -145,6 +149,10 @@ my-app/
|
|
|
145
149
|
│ │ └── layout/
|
|
146
150
|
│ │ ├── root-layout.tsx
|
|
147
151
|
│ │ └── error-boundary.tsx
|
|
152
|
+
│ ├── forms/ # (optional) React Hook Form + Zod
|
|
153
|
+
│ │ ├── index.ts # Barrel export
|
|
154
|
+
│ │ ├── use-zod-form.ts # Custom hook with onBlur validation
|
|
155
|
+
│ │ └── types.ts # Form TypeScript types
|
|
148
156
|
│ ├── hooks/
|
|
149
157
|
│ │ ├── use-loader.ts # Loading state management
|
|
150
158
|
│ │ ├── use-debounce.ts # Value debouncing
|
|
@@ -170,6 +178,23 @@ my-app/
|
|
|
170
178
|
└── .eslintrc.cjs # 25+ rules configured
|
|
171
179
|
```
|
|
172
180
|
|
|
181
|
+
### 🤖 AI-First Development
|
|
182
|
+
|
|
183
|
+
8 pre-configured [Claude Code](https://claude.ai/code) skills ship with every project:
|
|
184
|
+
|
|
185
|
+
| Skill | Purpose |
|
|
186
|
+
|-------|---------|
|
|
187
|
+
| `react-best-practices` | Performance patterns from Vercel Engineering |
|
|
188
|
+
| `frontend-design` | Production-grade UI avoiding generic aesthetics |
|
|
189
|
+
| `design-principles` | Minimal design system (Linear/Notion/Stripe style) |
|
|
190
|
+
| `ui-ux-pro-max` | 67 styles, 96 palettes, 56 font pairings |
|
|
191
|
+
| `question-me` | Socratic spec refinement |
|
|
192
|
+
| `learn-together` | Collaborative tech exploration |
|
|
193
|
+
| `agent-browser` | Browser automation & testing |
|
|
194
|
+
| `autoskill` | Session learning for AI patterns |
|
|
195
|
+
|
|
196
|
+
Skills activate automatically with Claude Code. Add your own to `.claude/skills/`.
|
|
197
|
+
|
|
173
198
|
---
|
|
174
199
|
|
|
175
200
|
## Features
|
|
@@ -223,6 +248,31 @@ const debouncedQuery = useDebounce(searchQuery, 300);
|
|
|
223
248
|
const { cancelToken, cancel } = useCancelToken();
|
|
224
249
|
```
|
|
225
250
|
|
|
251
|
+
### Type-Safe Form Validation (Optional)
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import { z } from 'zod';
|
|
255
|
+
import { useZodForm } from '~/forms';
|
|
256
|
+
|
|
257
|
+
const loginSchema = z.object({
|
|
258
|
+
email: z.string().email(),
|
|
259
|
+
password: z.string().min(8, 'Password must be 8+ characters'),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
function LoginForm() {
|
|
263
|
+
const form = useZodForm({ schema: loginSchema });
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
267
|
+
<input {...form.register('email')} />
|
|
268
|
+
{form.formState.errors.email?.message}
|
|
269
|
+
</form>
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
*UI-agnostic • Works with Shadcn, Antd, or plain HTML • Validates onBlur*
|
|
275
|
+
|
|
226
276
|
### Path Aliases
|
|
227
277
|
|
|
228
278
|
```tsx
|
package/lib/prompts.js
CHANGED
|
@@ -94,6 +94,11 @@ async function createProject(projectName, options) {
|
|
|
94
94
|
value: 'redux',
|
|
95
95
|
checked: false
|
|
96
96
|
},
|
|
97
|
+
{
|
|
98
|
+
name: 'React Hook Form + Zod (form validation)',
|
|
99
|
+
value: 'forms',
|
|
100
|
+
checked: false
|
|
101
|
+
},
|
|
97
102
|
{
|
|
98
103
|
name: 'Ant Design v5 (replaces Shadcn/ui)',
|
|
99
104
|
value: 'antd',
|
|
@@ -153,6 +158,7 @@ async function createProject(projectName, options) {
|
|
|
153
158
|
packageManager,
|
|
154
159
|
// Optional features
|
|
155
160
|
useRedux: optionalFeatures.includes('redux'),
|
|
161
|
+
useForms: optionalFeatures.includes('forms'),
|
|
156
162
|
useAntd: optionalFeatures.includes('antd'),
|
|
157
163
|
useHusky: optionalFeatures.includes('husky'),
|
|
158
164
|
// Flags
|
|
@@ -172,9 +178,11 @@ async function createProject(projectName, options) {
|
|
|
172
178
|
console.log(chalk.cyan('│') + chalk.gray(` ${config.useAntd ? 'Ant Design v5' : 'Shadcn/ui components'} `) + chalk.cyan('│'));
|
|
173
179
|
console.log(chalk.cyan('│') + chalk.gray(' Wouter routing + Axios ') + chalk.cyan('│'));
|
|
174
180
|
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('│'));
|
|
175
182
|
console.log(chalk.cyan('├─────────────────────────────────────────────┤'));
|
|
176
183
|
console.log(chalk.cyan('│') + chalk.white(' Optional Features: ') + chalk.cyan('│'));
|
|
177
184
|
console.log(chalk.cyan('│') + ` Redux Toolkit: ${config.useRedux ? chalk.green('✓') : chalk.gray('✗')} ` + chalk.cyan('│'));
|
|
185
|
+
console.log(chalk.cyan('│') + ` RHF + Zod: ${config.useForms ? chalk.green('✓') : chalk.gray('✗')} ` + chalk.cyan('│'));
|
|
178
186
|
console.log(chalk.cyan('│') + ` Ant Design v5: ${config.useAntd ? chalk.green('✓') : chalk.gray('✗')} ` + chalk.cyan('│'));
|
|
179
187
|
console.log(chalk.cyan('│') + ` Husky hooks: ${config.useHusky ? chalk.green('✓') : chalk.gray('✗')} ` + chalk.cyan('│'));
|
|
180
188
|
console.log(chalk.cyan('└─────────────────────────────────────────────┘\n'));
|
package/lib/setup.js
CHANGED
|
@@ -19,6 +19,9 @@ async function setupProject(config) {
|
|
|
19
19
|
const templatePath = path.join(__dirname, '../templates/base');
|
|
20
20
|
await fs.copy(templatePath, projectPath);
|
|
21
21
|
|
|
22
|
+
// Step 2.5: Log Claude Code AI skills inclusion
|
|
23
|
+
console.log(chalk.gray(' Including Claude Code AI skills (.claude/skills)...'));
|
|
24
|
+
|
|
22
25
|
// Step 3: Handle Antd vs Shadcn/ui
|
|
23
26
|
if (config.useAntd) {
|
|
24
27
|
console.log(chalk.gray(' Configuring Ant Design (removing Shadcn/ui)...'));
|
|
@@ -35,6 +38,11 @@ async function setupProject(config) {
|
|
|
35
38
|
await updateProvidersForRedux(projectPath, config.useAntd);
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
if (config.useForms) {
|
|
42
|
+
console.log(chalk.gray(' Adding React Hook Form + Zod...'));
|
|
43
|
+
await copyOptionalTemplate('forms', projectPath);
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
if (config.useHusky) {
|
|
39
47
|
console.log(chalk.gray(' Adding Husky + lint-staged...'));
|
|
40
48
|
await copyOptionalTemplate('husky', projectPath);
|
|
@@ -78,6 +86,13 @@ async function updatePackageJson(config) {
|
|
|
78
86
|
dependencies['redux-persist'] = '^6.0.0';
|
|
79
87
|
}
|
|
80
88
|
|
|
89
|
+
// React Hook Form + Zod dependencies
|
|
90
|
+
if (config.useForms) {
|
|
91
|
+
dependencies['react-hook-form'] = '^7.54.0';
|
|
92
|
+
dependencies['zod'] = '^3.24.0';
|
|
93
|
+
dependencies['@hookform/resolvers'] = '^3.9.0';
|
|
94
|
+
}
|
|
95
|
+
|
|
81
96
|
// Ant Design dependencies (replaces Shadcn)
|
|
82
97
|
if (config.useAntd) {
|
|
83
98
|
dependencies['antd'] = '^5.20.0';
|
|
@@ -113,9 +128,11 @@ async function copyOptionalTemplate(templateName, projectPath) {
|
|
|
113
128
|
);
|
|
114
129
|
|
|
115
130
|
if (await fs.pathExists(optionalTemplatePath)) {
|
|
116
|
-
// For redux and
|
|
131
|
+
// For redux, antd, and forms, copy to src directory
|
|
117
132
|
if (templateName === 'redux') {
|
|
118
133
|
await fs.copy(optionalTemplatePath, path.join(projectPath, 'src/redux'));
|
|
134
|
+
} else if (templateName === 'forms') {
|
|
135
|
+
await fs.copy(optionalTemplatePath, path.join(projectPath, 'src/forms'));
|
|
119
136
|
} else if (templateName === 'antd') {
|
|
120
137
|
await fs.copy(optionalTemplatePath, path.join(projectPath, 'src/antd'));
|
|
121
138
|
// Also copy the styles file to src/styles
|
package/package.json
CHANGED
|
@@ -0,0 +1,356 @@
|
|
|
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
|
+
```
|