chromeflow 0.1.6 → 0.1.8
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/CLAUDE.md +5 -1
- package/dist/index.js +1 -1
- package/dist/tools/flow.js +0 -25
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -43,10 +43,12 @@ Do NOT ask "should I open the browser?" — just do it. The user expects seamles
|
|
|
43
43
|
```
|
|
44
44
|
1. show_guide_panel(title, steps[]) — show the full plan upfront
|
|
45
45
|
2. open_page(url) — navigate to the right page
|
|
46
|
+
mark_step_done(0) — ALWAYS mark step 0 done right after open_page succeeds
|
|
46
47
|
3. For each step:
|
|
47
48
|
a. Claude acts directly:
|
|
48
49
|
click_element("Save") — press buttons/links Claude can press
|
|
49
50
|
fill_input("Product name", "Pro") — fill fields Claude knows the answer to
|
|
51
|
+
clear_overlays() — call this immediately after fill_input succeeds
|
|
50
52
|
scroll_page("down") — reveal off-screen content then retry
|
|
51
53
|
b. Check results with text, not vision:
|
|
52
54
|
get_page_text() — read errors/status after actions
|
|
@@ -60,6 +62,7 @@ Do NOT ask "should I open the browser?" — just do it. The user expects seamles
|
|
|
60
62
|
d. Pause for the user when needed:
|
|
61
63
|
find_and_highlight(text, msg) — show the user what to do
|
|
62
64
|
wait_for_click() — wait for user interaction
|
|
65
|
+
[after wait_for_click + fill_input] clear_overlays() — always clear after filling
|
|
63
66
|
e. mark_step_done(i) — check off the step
|
|
64
67
|
4. clear_overlays() — clean up when done
|
|
65
68
|
```
|
|
@@ -95,8 +98,9 @@ Use the absolute path for `envPath` — it's the Claude Code working directory +
|
|
|
95
98
|
|
|
96
99
|
## Error handling
|
|
97
100
|
- After any action → `get_page_text()` to check for errors (not `take_screenshot`)
|
|
101
|
+
- After `click_element("Save")` / form submission → use `get_page_text()` or `wait_for_selector` to confirm. Never use `wait_for_navigation` — most form saves don't navigate.
|
|
98
102
|
- `click_element` not found → `scroll_page("down")` then retry
|
|
99
103
|
- Still not found → `take_screenshot()` then `highlight_region(x,y,w,h,msg)`
|
|
100
|
-
- `fill_input` not found → `click_element(hint)` to focus the field, then retry `fill_input`. If still failing,
|
|
104
|
+
- `fill_input` not found → `click_element(hint)` to focus the field, then retry `fill_input`. If still failing, use `find_and_highlight(hint, "Click here — I'll fill it in")` (NO `valueToType`) then `wait_for_click()` then retry `fill_input` — after the user focuses the field by clicking, the active-element fallback fills it automatically. `find_and_highlight` uses DOM positioning (pixel-perfect) — only fall back to `take_screenshot` + `highlight_region` if `find_and_highlight` returns false. After `fill_input` succeeds, immediately call `clear_overlays()` to remove the highlight. Only use `valueToType` when the user genuinely must type the value themselves (e.g. password, personal data).
|
|
101
105
|
- Waiting for async result (build, save, deploy) → `wait_for_selector(selector, timeout)`
|
|
102
106
|
- Never use Bash to work around a stuck browser interaction
|
package/dist/index.js
CHANGED
package/dist/tools/flow.js
CHANGED
|
@@ -70,31 +70,6 @@ If the click causes page navigation, this resolves when the new page finishes lo
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
);
|
|
73
|
-
server.tool(
|
|
74
|
-
"wait_for_navigation",
|
|
75
|
-
"Wait for the browser to navigate to a new page (without requiring a prior click watch). Useful after calling open_page or after a form submission.",
|
|
76
|
-
{
|
|
77
|
-
urlPattern: z.string().optional().describe("Substring to match in the new URL \u2014 waits for any navigation if omitted"),
|
|
78
|
-
timeout: z.number().optional().describe("Max seconds to wait (default 30)")
|
|
79
|
-
},
|
|
80
|
-
async ({ urlPattern, timeout = 30 }) => {
|
|
81
|
-
const response = await bridge.request({
|
|
82
|
-
type: "start_click_watch",
|
|
83
|
-
timeout: timeout * 1e3
|
|
84
|
-
});
|
|
85
|
-
const url = response.url ?? "";
|
|
86
|
-
if (urlPattern && !url.includes(urlPattern)) {
|
|
87
|
-
return {
|
|
88
|
-
content: [
|
|
89
|
-
{ type: "text", text: `Navigation detected to ${url} (pattern "${urlPattern}" not matched \u2014 proceeding anyway).` }
|
|
90
|
-
]
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
content: [{ type: "text", text: `Page navigated to: ${url}` }]
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
73
|
server.tool(
|
|
99
74
|
"wait_for_selector",
|
|
100
75
|
`Wait for a CSS selector to appear on the page. Use this instead of polling with take_screenshot.
|
package/package.json
CHANGED