gm-copilot-cli 2.0.5
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/.github/workflows/publish-npm.yml +50 -0
- package/.mcp.json +19 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/agents/gm.md +371 -0
- package/cli.js +47 -0
- package/copilot-profile.md +70 -0
- package/hooks/hooks.json +58 -0
- package/hooks/pre-tool-use-hook.js +94 -0
- package/hooks/prompt-submit-hook.js +87 -0
- package/hooks/session-end-git-hook.js +184 -0
- package/hooks/session-end-hook.js +58 -0
- package/hooks/session-start-hook.js +171 -0
- package/manifest.yml +51 -0
- package/package.json +39 -0
- package/skills/agent-browser/SKILL.md +257 -0
- package/tools.json +130 -0
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gm-copilot-cli",
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "Advanced Claude Code plugin with WFGY integration, MCP tools, and automated hooks",
|
|
5
|
+
"author": "AnEntrypoint",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "cli.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"gm-copilot-cli": "./cli.js",
|
|
10
|
+
"gm-install": "./install.js"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/AnEntrypoint/gm-copilot-cli.git"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/AnEntrypoint/gm-copilot-cli#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/AnEntrypoint/gm-copilot-cli/issues"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16.0.0"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"cli.js",
|
|
28
|
+
"agents/",
|
|
29
|
+
"hooks/",
|
|
30
|
+
"skills/",
|
|
31
|
+
".github/",
|
|
32
|
+
"copilot-profile.md",
|
|
33
|
+
"tools.json",
|
|
34
|
+
"manifest.yml",
|
|
35
|
+
".mcp.json",
|
|
36
|
+
"README.md",
|
|
37
|
+
"COPILOT.md"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-browser
|
|
3
|
+
description: Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
|
|
4
|
+
allowed-tools: Bash(agent-browser:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Browser Automation with agent-browser
|
|
8
|
+
|
|
9
|
+
## Core Workflow
|
|
10
|
+
|
|
11
|
+
Every browser automation follows this pattern:
|
|
12
|
+
|
|
13
|
+
1. **Navigate**: `agent-browser open <url>`
|
|
14
|
+
2. **Snapshot**: `agent-browser snapshot -i` (get element refs like `@e1`, `@e2`)
|
|
15
|
+
3. **Interact**: Use refs to click, fill, select
|
|
16
|
+
4. **Re-snapshot**: After navigation or DOM changes, get fresh refs
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
agent-browser open https://example.com/form
|
|
20
|
+
agent-browser snapshot -i
|
|
21
|
+
# Output: @e1 [input type="email"], @e2 [input type="password"], @e3 [button] "Submit"
|
|
22
|
+
|
|
23
|
+
agent-browser fill @e1 "user@example.com"
|
|
24
|
+
agent-browser fill @e2 "password123"
|
|
25
|
+
agent-browser click @e3
|
|
26
|
+
agent-browser wait --load networkidle
|
|
27
|
+
agent-browser snapshot -i # Check result
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Essential Commands
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Navigation
|
|
34
|
+
agent-browser open <url> # Navigate (aliases: goto, navigate)
|
|
35
|
+
agent-browser close # Close browser
|
|
36
|
+
|
|
37
|
+
# Snapshot
|
|
38
|
+
agent-browser snapshot -i # Interactive elements with refs (recommended)
|
|
39
|
+
agent-browser snapshot -i -C # Include cursor-interactive elements (divs with onclick, cursor:pointer)
|
|
40
|
+
agent-browser snapshot -s "#selector" # Scope to CSS selector
|
|
41
|
+
|
|
42
|
+
# Interaction (use @refs from snapshot)
|
|
43
|
+
agent-browser click @e1 # Click element
|
|
44
|
+
agent-browser fill @e2 "text" # Clear and type text
|
|
45
|
+
agent-browser type @e2 "text" # Type without clearing
|
|
46
|
+
agent-browser select @e1 "option" # Select dropdown option
|
|
47
|
+
agent-browser check @e1 # Check checkbox
|
|
48
|
+
agent-browser press Enter # Press key
|
|
49
|
+
agent-browser scroll down 500 # Scroll page
|
|
50
|
+
|
|
51
|
+
# Get information
|
|
52
|
+
agent-browser get text @e1 # Get element text
|
|
53
|
+
agent-browser get url # Get current URL
|
|
54
|
+
agent-browser get title # Get page title
|
|
55
|
+
|
|
56
|
+
# Wait
|
|
57
|
+
agent-browser wait @e1 # Wait for element
|
|
58
|
+
agent-browser wait --load networkidle # Wait for network idle
|
|
59
|
+
agent-browser wait --url "**/page" # Wait for URL pattern
|
|
60
|
+
agent-browser wait 2000 # Wait milliseconds
|
|
61
|
+
|
|
62
|
+
# Capture
|
|
63
|
+
agent-browser screenshot # Screenshot to temp dir
|
|
64
|
+
agent-browser screenshot --full # Full page screenshot
|
|
65
|
+
agent-browser pdf output.pdf # Save as PDF
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Common Patterns
|
|
69
|
+
|
|
70
|
+
### Form Submission
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
agent-browser open https://example.com/signup
|
|
74
|
+
agent-browser snapshot -i
|
|
75
|
+
agent-browser fill @e1 "Jane Doe"
|
|
76
|
+
agent-browser fill @e2 "jane@example.com"
|
|
77
|
+
agent-browser select @e3 "California"
|
|
78
|
+
agent-browser check @e4
|
|
79
|
+
agent-browser click @e5
|
|
80
|
+
agent-browser wait --load networkidle
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Authentication with State Persistence
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Login once and save state
|
|
87
|
+
agent-browser open https://app.example.com/login
|
|
88
|
+
agent-browser snapshot -i
|
|
89
|
+
agent-browser fill @e1 "$USERNAME"
|
|
90
|
+
agent-browser fill @e2 "$PASSWORD"
|
|
91
|
+
agent-browser click @e3
|
|
92
|
+
agent-browser wait --url "**/dashboard"
|
|
93
|
+
agent-browser state save auth.json
|
|
94
|
+
|
|
95
|
+
# Reuse in future sessions
|
|
96
|
+
agent-browser state load auth.json
|
|
97
|
+
agent-browser open https://app.example.com/dashboard
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Data Extraction
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
agent-browser open https://example.com/products
|
|
104
|
+
agent-browser snapshot -i
|
|
105
|
+
agent-browser get text @e5 # Get specific element text
|
|
106
|
+
agent-browser get text body > page.txt # Get all page text
|
|
107
|
+
|
|
108
|
+
# JSON output for parsing
|
|
109
|
+
agent-browser snapshot -i --json
|
|
110
|
+
agent-browser get text @e1 --json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Parallel Sessions
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
agent-browser --session site1 open https://site-a.com
|
|
117
|
+
agent-browser --session site2 open https://site-b.com
|
|
118
|
+
|
|
119
|
+
agent-browser --session site1 snapshot -i
|
|
120
|
+
agent-browser --session site2 snapshot -i
|
|
121
|
+
|
|
122
|
+
agent-browser session list
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Connect to Existing Chrome
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Auto-discover running Chrome with remote debugging enabled
|
|
129
|
+
agent-browser --auto-connect open https://example.com
|
|
130
|
+
agent-browser --auto-connect snapshot
|
|
131
|
+
|
|
132
|
+
# Or with explicit CDP port
|
|
133
|
+
agent-browser --cdp 9222 snapshot
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Visual Browser (Debugging)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
agent-browser --headed open https://example.com
|
|
140
|
+
agent-browser highlight @e1 # Highlight element
|
|
141
|
+
agent-browser record start demo.webm # Record session
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Local Files (PDFs, HTML)
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Open local files with file:// URLs
|
|
148
|
+
agent-browser --allow-file-access open file:///path/to/document.pdf
|
|
149
|
+
agent-browser --allow-file-access open file:///path/to/page.html
|
|
150
|
+
agent-browser screenshot output.png
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### iOS Simulator (Mobile Safari)
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# List available iOS simulators
|
|
157
|
+
agent-browser device list
|
|
158
|
+
|
|
159
|
+
# Launch Safari on a specific device
|
|
160
|
+
agent-browser -p ios --device "iPhone 16 Pro" open https://example.com
|
|
161
|
+
|
|
162
|
+
# Same workflow as desktop - snapshot, interact, re-snapshot
|
|
163
|
+
agent-browser -p ios snapshot -i
|
|
164
|
+
agent-browser -p ios tap @e1 # Tap (alias for click)
|
|
165
|
+
agent-browser -p ios fill @e2 "text"
|
|
166
|
+
agent-browser -p ios swipe up # Mobile-specific gesture
|
|
167
|
+
|
|
168
|
+
# Take screenshot
|
|
169
|
+
agent-browser -p ios screenshot mobile.png
|
|
170
|
+
|
|
171
|
+
# Close session (shuts down simulator)
|
|
172
|
+
agent-browser -p ios close
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Requirements:** macOS with Xcode, Appium (`npm install -g appium && appium driver install xcuitest`)
|
|
176
|
+
|
|
177
|
+
**Real devices:** Works with physical iOS devices if pre-configured. Use `--device "<UDID>"` where UDID is from `xcrun xctrace list devices`.
|
|
178
|
+
|
|
179
|
+
## Ref Lifecycle (Important)
|
|
180
|
+
|
|
181
|
+
Refs (`@e1`, `@e2`, etc.) are invalidated when the page changes. Always re-snapshot after:
|
|
182
|
+
|
|
183
|
+
- Clicking links or buttons that navigate
|
|
184
|
+
- Form submissions
|
|
185
|
+
- Dynamic content loading (dropdowns, modals)
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
agent-browser click @e5 # Navigates to new page
|
|
189
|
+
agent-browser snapshot -i # MUST re-snapshot
|
|
190
|
+
agent-browser click @e1 # Use new refs
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Semantic Locators (Alternative to Refs)
|
|
194
|
+
|
|
195
|
+
When refs are unavailable or unreliable, use semantic locators:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
agent-browser find text "Sign In" click
|
|
199
|
+
agent-browser find label "Email" fill "user@test.com"
|
|
200
|
+
agent-browser find role button click --name "Submit"
|
|
201
|
+
agent-browser find placeholder "Search" type "query"
|
|
202
|
+
agent-browser find testid "submit-btn" click
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## JavaScript Evaluation (eval)
|
|
206
|
+
|
|
207
|
+
Use `eval` to run JavaScript in the browser context. **Shell quoting can corrupt complex expressions** -- use `--stdin` or `-b` to avoid issues.
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Simple expressions work with regular quoting
|
|
211
|
+
agent-browser eval 'document.title'
|
|
212
|
+
agent-browser eval 'document.querySelectorAll("img").length'
|
|
213
|
+
|
|
214
|
+
# Complex JS: use --stdin with heredoc (RECOMMENDED)
|
|
215
|
+
agent-browser eval --stdin <<'EVALEOF'
|
|
216
|
+
JSON.stringify(
|
|
217
|
+
Array.from(document.querySelectorAll("img"))
|
|
218
|
+
.filter(i => !i.alt)
|
|
219
|
+
.map(i => ({ src: i.src.split("/").pop(), width: i.width }))
|
|
220
|
+
)
|
|
221
|
+
EVALEOF
|
|
222
|
+
|
|
223
|
+
# Alternative: base64 encoding (avoids all shell escaping issues)
|
|
224
|
+
agent-browser eval -b "$(echo -n 'Array.from(document.querySelectorAll("a")).map(a => a.href)' | base64)"
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Why this matters:** When the shell processes your command, inner double quotes, `!` characters (history expansion), backticks, and `$()` can all corrupt the JavaScript before it reaches agent-browser. The `--stdin` and `-b` flags bypass shell interpretation entirely.
|
|
228
|
+
|
|
229
|
+
**Rules of thumb:**
|
|
230
|
+
- Single-line, no nested quotes -> regular `eval 'expression'` with single quotes is fine
|
|
231
|
+
- Nested quotes, arrow functions, template literals, or multiline -> use `eval --stdin <<'EVALEOF'`
|
|
232
|
+
- Programmatic/generated scripts -> use `eval -b` with base64
|
|
233
|
+
|
|
234
|
+
## Deep-Dive Documentation
|
|
235
|
+
|
|
236
|
+
| Reference | When to Use |
|
|
237
|
+
|-----------|-------------|
|
|
238
|
+
| [references/commands.md](references/commands.md) | Full command reference with all options |
|
|
239
|
+
| [references/snapshot-refs.md](references/snapshot-refs.md) | Ref lifecycle, invalidation rules, troubleshooting |
|
|
240
|
+
| [references/session-management.md](references/session-management.md) | Parallel sessions, state persistence, concurrent scraping |
|
|
241
|
+
| [references/authentication.md](references/authentication.md) | Login flows, OAuth, 2FA handling, state reuse |
|
|
242
|
+
| [references/video-recording.md](references/video-recording.md) | Recording workflows for debugging and documentation |
|
|
243
|
+
| [references/proxy-support.md](references/proxy-support.md) | Proxy configuration, geo-testing, rotating proxies |
|
|
244
|
+
|
|
245
|
+
## Ready-to-Use Templates
|
|
246
|
+
|
|
247
|
+
| Template | Description |
|
|
248
|
+
|----------|-------------|
|
|
249
|
+
| [templates/form-automation.sh](templates/form-automation.sh) | Form filling with validation |
|
|
250
|
+
| [templates/authenticated-session.sh](templates/authenticated-session.sh) | Login once, reuse state |
|
|
251
|
+
| [templates/capture-workflow.sh](templates/capture-workflow.sh) | Content extraction with screenshots |
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
./templates/form-automation.sh https://example.com/form
|
|
255
|
+
./templates/authenticated-session.sh https://app.example.com/login
|
|
256
|
+
./templates/capture-workflow.sh https://example.com ./output
|
|
257
|
+
```
|
package/tools.json
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gm",
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "Advanced Claude Code plugin with WFGY integration, MCP tools, and automated hooks",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "shell",
|
|
8
|
+
"description": "Execute shell commands",
|
|
9
|
+
"parameters": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"command": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Command to execute"
|
|
15
|
+
},
|
|
16
|
+
"timeout": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"description": "Timeout in ms",
|
|
19
|
+
"default": 30000
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": [
|
|
23
|
+
"command"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "file_write",
|
|
29
|
+
"description": "Write or modify files",
|
|
30
|
+
"parameters": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"properties": {
|
|
33
|
+
"path": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"content": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"mode": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"enum": [
|
|
42
|
+
"create",
|
|
43
|
+
"append",
|
|
44
|
+
"overwrite"
|
|
45
|
+
],
|
|
46
|
+
"default": "overwrite"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": [
|
|
50
|
+
"path",
|
|
51
|
+
"content"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "file_glob",
|
|
57
|
+
"description": "Find files matching pattern",
|
|
58
|
+
"parameters": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"pattern": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"exclude": {
|
|
65
|
+
"type": "array"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"required": [
|
|
69
|
+
"pattern"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "file_search",
|
|
75
|
+
"description": "Search file content",
|
|
76
|
+
"parameters": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"properties": {
|
|
79
|
+
"pattern": {
|
|
80
|
+
"type": "string"
|
|
81
|
+
},
|
|
82
|
+
"files": {
|
|
83
|
+
"type": "string"
|
|
84
|
+
},
|
|
85
|
+
"context_lines": {
|
|
86
|
+
"type": "number",
|
|
87
|
+
"default": 2
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": [
|
|
91
|
+
"pattern"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "semantic_search",
|
|
97
|
+
"description": "AI-powered semantic search",
|
|
98
|
+
"parameters": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"properties": {
|
|
101
|
+
"query": {
|
|
102
|
+
"type": "string"
|
|
103
|
+
},
|
|
104
|
+
"scope": {
|
|
105
|
+
"type": "string"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"required": [
|
|
109
|
+
"query"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"mcp_servers": {
|
|
115
|
+
"dev": {
|
|
116
|
+
"command": "bunx",
|
|
117
|
+
"args": [
|
|
118
|
+
"mcp-gm@latest"
|
|
119
|
+
],
|
|
120
|
+
"timeout": 360000
|
|
121
|
+
},
|
|
122
|
+
"code-search": {
|
|
123
|
+
"command": "bunx",
|
|
124
|
+
"args": [
|
|
125
|
+
"codebasesearch@latest"
|
|
126
|
+
],
|
|
127
|
+
"timeout": 360000
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|