gm-copilot-cli 2.0.377 → 2.0.379

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gm
3
- version: 2.0.377
3
+ version: 2.0.379
4
4
  description: State machine agent with hooks, skills, and automated git enforcement
5
5
  author: AnEntrypoint
6
6
  repository: https://github.com/AnEntrypoint/gm-copilot-cli
package/index.html CHANGED
@@ -18,7 +18,7 @@
18
18
  <script type="module">
19
19
  import { createElement as h, applyDiff, Fragment } from "webjsx";
20
20
  const PLATFORM_NAME="Copilot CLI",PLATFORM_TYPE="CLI Tool",PLATFORM_TYPE_COLOR="#3b82f6";
21
- const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.377";
21
+ const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.379";
22
22
  const GITHUB_URL="https://github.com/AnEntrypoint/gm-copilot-cli",BADGE_LABEL="copilot-cli";
23
23
  const FEATURES=[{"title":"State Machine","desc":"Immutable PLAN→EXECUTE→EMIT→VERIFY→COMPLETE phases with full mutable tracking"},{"title":"Semantic Search","desc":"Natural language codebase exploration via codesearch skill — no grep needed"},{"title":"Hooks","desc":"Pre-tool, session-start, prompt-submit, and stop hooks for full lifecycle control"},{"title":"Agents","desc":"gm, codesearch, and websearch agents pre-configured and ready to use"},{"title":"MCP Integration","desc":"Model Context Protocol server support built in"},{"title":"Auto-Recovery","desc":"Supervisor hierarchy ensures the system never crashes"}],INSTALL_STEPS=[{"desc":"Install via GitHub CLI","cmd":"gh extension install AnEntrypoint/gm-copilot-cli"},{"desc":"Restart your terminal — activates automatically"}];
24
24
  const CURRENT_PLATFORM="gm-copilot-cli";
package/manifest.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: gm
2
- version: 2.0.377
2
+ version: 2.0.379
3
3
  description: State machine agent with hooks, skills, and automated git enforcement
4
4
  author: AnEntrypoint
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-copilot-cli",
3
- "version": "2.0.377",
3
+ "version": "2.0.379",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -1,66 +1,112 @@
1
1
  ---
2
2
  name: browser
3
- description: Browser automation. Use when user needs to interact with websites, navigate pages, fill forms, click buttons, take screenshots, extract data, test web apps, or automate any browser task.
4
- allowed-tools: Bash(exec:browser*)
3
+ description: Browser automation via playwriter. Use when user needs to interact with websites, navigate pages, fill forms, click buttons, take screenshots, extract data, test web apps, or automate any browser task.
4
+ allowed-tools: Bash(browser:*), Bash(exec:browser*)
5
5
  ---
6
6
 
7
- # Browser Automation
7
+ # Browser Automation with playwriter
8
8
 
9
- Use `exec:browser` via Bash for all browser automation. The runtime provides `page`, `snapshot`, `screenshotWithAccessibilityLabels`, and `state` as globals. Sessions persist across calls automatically.
9
+ ## Two Pathways
10
+
11
+ **Session commands** (`browser:` prefix) — manage multi-step sessions via playwriter CLI. Each `browser:` block runs its commands sequentially.
12
+
13
+ **JS execution** (`exec:browser`) — run JavaScript directly against `page`. State persists across calls.
14
+
15
+ **CRITICAL**: Never mix these two pathways. Each `browser:` block is a separate Bash call. Each `exec:browser` block is a separate Bash call.
16
+
17
+ ## Session Pathway (`browser:`)
18
+
19
+ Create a session first, use `--direct` for CDP mode (requires Chrome with remote debugging):
10
20
 
11
21
  ```
12
- exec:browser
13
- await page.goto('https://example.com')
14
- await snapshot({ page })
22
+ browser:
23
+ playwriter session new --direct
15
24
  ```
16
25
 
17
- ## Core Workflow
26
+ Returns a numeric session ID (e.g. `1`). Use that ID for all subsequent calls. **Each command must be a separate Bash call:**
18
27
 
19
- Navigate, snapshot to understand the page, then interact:
28
+ ```
29
+ browser:
30
+ playwriter -s 1 -e 'await page.goto("http://example.com")'
31
+ ```
20
32
 
21
33
  ```
22
- exec:browser
23
- await page.goto('https://example.com/form')
24
- await snapshot({ page })
25
- await page.fill('[name=email]', 'user@example.com')
26
- await page.click('[type=submit]')
27
- await page.waitForLoadState('networkidle')
28
- await snapshot({ page })
34
+ browser:
35
+ playwriter -s 1 -e 'await snapshot({ page })'
29
36
  ```
30
37
 
31
- ## Common Patterns
38
+ ```
39
+ browser:
40
+ playwriter -s 1 -e 'await screenshotWithAccessibilityLabels({ page })'
41
+ ```
32
42
 
33
- ### Screenshot with Accessibility Labels
43
+ State persists across session calls:
34
44
 
35
45
  ```
36
- exec:browser
37
- await screenshotWithAccessibilityLabels({ page })
46
+ browser:
47
+ playwriter -s 1 -e 'state.x = 1'
48
+ ```
49
+
50
+ ```
51
+ browser:
52
+ playwriter -s 1 -e 'console.log(state.x)'
38
53
  ```
39
54
 
40
- ### Data Extraction
55
+ List active sessions:
41
56
 
42
57
  ```
43
- exec:browser
44
- await page.goto('https://example.com/products')
45
- const items = await page.$$eval('.product-title', els => els.map(e => e.textContent))
46
- console.log(JSON.stringify(items))
58
+ browser:
59
+ playwriter session list
47
60
  ```
48
61
 
49
- ### Persistent State Across Steps
62
+ **RULE**: The `-e` argument must use single quotes. The JS inside must use double quotes for strings.
63
+
64
+ **RULE**: Never chain multiple `playwriter` commands in one `browser:` block — run one command per block.
65
+
66
+ ## JS Execution Pathway (`exec:browser`)
67
+
68
+ For direct page access, DOM queries, and data extraction. The runtime provides `page`, `snapshot`, `screenshotWithAccessibilityLabels`, and `state` as globals.
50
69
 
51
70
  ```
52
71
  exec:browser
53
- state.count = 0
54
72
  await page.goto('https://example.com')
55
- state.title = await page.title()
73
+ await snapshot({ page })
74
+ ```
75
+
76
+ ```
77
+ exec:browser
78
+ const title = await page.title()
79
+ console.log(title)
80
+ ```
81
+
82
+ Never add shell quoting — write plain JavaScript directly.
83
+
84
+ ## Core Workflow
85
+
86
+ 1. **Create session**: `browser:\nplaywriter session new --direct`
87
+ 2. **Navigate** (one call per command): `browser:\nplaywriter -s 1 -e 'await page.goto("url")'`
88
+ 3. **Snapshot**: `browser:\nplaywriter -s 1 -e 'await snapshot({ page })'`
89
+ 4. **Interact**: click, fill, type — each as a separate browser: call
90
+ 5. **Extract data**: use `exec:browser` for JS queries
91
+
92
+ ## Common Patterns
93
+
94
+ ### Screenshot
95
+
96
+ ```
97
+ browser:
98
+ playwriter -s 1 -e 'await screenshotWithAccessibilityLabels({ page })'
56
99
  ```
57
100
 
101
+ ### Data Extraction (use exec:browser)
102
+
58
103
  ```
59
104
  exec:browser
60
- console.log(state.title, state.count)
105
+ const items = await page.$$eval('.product-title', els => els.map(e => e.textContent))
106
+ console.log(JSON.stringify(items))
61
107
  ```
62
108
 
63
- ### Console Monitoring
109
+ ### Console Monitoring (exec:browser)
64
110
 
65
111
  ```
66
112
  exec:browser
@@ -76,60 +122,49 @@ console.log(JSON.stringify(state.consoleMsgs))
76
122
 
77
123
  ### Web Worker Console Monitoring
78
124
 
79
- Capture console output from Dedicated Web Workers (e.g. game server workers):
80
-
81
125
  ```
82
126
  exec:browser
83
127
  state.workerMsgs = []
84
- // Capture from already-spawned workers
85
128
  for (const w of page.workers()) {
86
129
  w.evaluate(() => {
87
- const orig = console.log.bind(console)
88
- console.log = (...a) => { orig(...a); self.postMessage({ __log: a.map(String).join(' ') }) }
130
+ const o = console.log.bind(console)
131
+ console.log = (...a) => { o(...a) }
89
132
  }).catch(() => {})
90
133
  }
91
- // Capture from workers spawned after this point
92
134
  page.on('worker', w => {
93
- state.workerMsgs.push('[worker attached] ' + w.url())
94
- w.evaluate(() => {
95
- const orig = console.log.bind(console)
96
- console.log = (...a) => { orig(...a); self.postMessage({ __log: a.map(String).join(' ') }) }
97
- }).catch(() => {})
135
+ state.workerMsgs.push('[worker] ' + w.url())
98
136
  })
99
137
  ```
100
138
 
101
139
  ```
102
140
  exec:browser
103
- // List all active workers and their URLs
104
141
  const workers = page.workers()
105
142
  console.log('Workers:', workers.length, workers.map(w => w.url()).join(', '))
106
143
  ```
107
144
 
108
145
  ```
109
146
  exec:browser
110
- // Evaluate JS inside the first worker
111
- const result = await page.workers()[0].evaluate(() => typeof self.someGlobal)
112
- console.log(result)
147
+ if (page.workers().length > 0) {
148
+ const r = await page.workers()[0].evaluate(() => JSON.stringify({ type: 'worker alive' }))
149
+ console.log(r)
150
+ }
113
151
  ```
114
152
 
115
- ### Inject Global Debug State into Page
153
+ ### Access window.debug globals
116
154
 
117
155
  ```
118
156
  exec:browser
119
- const result = await page.evaluate(() => {
120
- // Access app globals exposed on window
121
- return JSON.stringify({
122
- entityCount: window.debug?.scene?.children?.length,
123
- playerId: window.debug?.client?.playerId
124
- })
125
- })
157
+ const result = await page.evaluate(() => JSON.stringify({
158
+ entityCount: window.debug?.scene?.children?.length,
159
+ playerId: window.debug?.client?.playerId
160
+ }))
126
161
  console.log(result)
127
162
  ```
128
163
 
129
164
  ## Key Rules
130
165
 
131
- **Only `exec:browser`** never run any browser CLI tool directly via Bash.
132
-
133
- **Snapshot before interacting** always call `await snapshot({ page })` to understand current page state before clicking or filling.
134
-
135
- **State persists** `state` object and page session carry across multiple `exec:browser` calls.
166
+ - `browser:` prefix playwriter session management (one command per block)
167
+ - `exec:browser` → JS in page context (multi-line JS allowed)
168
+ - Never mix pathways in the same Bash call
169
+ - `-e` argument: single quotes on outside, double quotes inside for JS strings
170
+ - One `playwriter` command per `browser:` block
package/tools.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.377",
3
+ "version": "2.0.379",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "tools": [
6
6
  {