@vforsh/argus 0.1.18 → 0.1.20
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/dist/.tsbuildinfo +1 -1
- package/dist/argus.js +3008 -572
- package/dist/cli/plugins/pluginHost.d.ts.map +1 -1
- package/dist/cli/plugins/pluginHost.js +1 -0
- package/dist/cli/plugins/pluginHost.js.map +1 -1
- package/dist/cli/register/extensionCommands.d.ts.map +1 -1
- package/dist/cli/register/extensionCommands.js +131 -6
- package/dist/cli/register/extensionCommands.js.map +1 -1
- package/dist/cli/register/index.d.ts.map +1 -1
- package/dist/cli/register/index.js +6 -0
- package/dist/cli/register/index.js.map +1 -1
- package/dist/cli/register/recordCommands.d.ts +3 -0
- package/dist/cli/register/recordCommands.d.ts.map +1 -0
- package/dist/cli/register/recordCommands.js +90 -0
- package/dist/cli/register/recordCommands.js.map +1 -0
- package/dist/cli/register/skillCommands.d.ts +3 -0
- package/dist/cli/register/skillCommands.d.ts.map +1 -0
- package/dist/cli/register/skillCommands.js +13 -0
- package/dist/cli/register/skillCommands.js.map +1 -0
- package/dist/commands/domDrag.d.ts +21 -0
- package/dist/commands/domDrag.d.ts.map +1 -0
- package/dist/commands/domDrag.js +179 -0
- package/dist/commands/domDrag.js.map +1 -0
- package/dist/commands/extension/attach.d.ts +2 -0
- package/dist/commands/extension/attach.d.ts.map +1 -1
- package/dist/commands/extension/attach.js +31 -6
- package/dist/commands/extension/attach.js.map +1 -1
- package/dist/commands/extension/doctor.d.ts +6 -0
- package/dist/commands/extension/doctor.d.ts.map +1 -0
- package/dist/commands/extension/doctor.js +185 -0
- package/dist/commands/extension/doctor.js.map +1 -0
- package/dist/commands/extension/extensionId.d.ts +27 -0
- package/dist/commands/extension/extensionId.d.ts.map +1 -0
- package/dist/commands/extension/extensionId.js +37 -0
- package/dist/commands/extension/extensionId.js.map +1 -0
- package/dist/commands/extension/extensionPath.d.ts +15 -0
- package/dist/commands/extension/extensionPath.d.ts.map +1 -0
- package/dist/commands/extension/extensionPath.js +61 -0
- package/dist/commands/extension/extensionPath.js.map +1 -0
- package/dist/commands/extension/install.d.ts +16 -0
- package/dist/commands/extension/install.d.ts.map +1 -0
- package/dist/commands/extension/install.js +154 -0
- package/dist/commands/extension/install.js.map +1 -0
- package/dist/commands/extension/select.d.ts +7 -0
- package/dist/commands/extension/select.d.ts.map +1 -0
- package/dist/commands/extension/select.js +73 -0
- package/dist/commands/extension/select.js.map +1 -0
- package/dist/commands/extension/setup.d.ts +2 -1
- package/dist/commands/extension/setup.d.ts.map +1 -1
- package/dist/commands/extension/setup.js +5 -2
- package/dist/commands/extension/setup.js.map +1 -1
- package/dist/commands/extension/show.d.ts +4 -0
- package/dist/commands/extension/show.d.ts.map +1 -1
- package/dist/commands/extension/show.js +12 -88
- package/dist/commands/extension/show.js.map +1 -1
- package/dist/commands/extension/tabAttach.d.ts +28 -0
- package/dist/commands/extension/tabAttach.d.ts.map +1 -0
- package/dist/commands/extension/tabAttach.js +106 -0
- package/dist/commands/extension/tabAttach.js.map +1 -0
- package/dist/commands/extension/tabWatcher.d.ts +22 -0
- package/dist/commands/extension/tabWatcher.d.ts.map +1 -0
- package/dist/commands/extension/tabWatcher.js +89 -0
- package/dist/commands/extension/tabWatcher.js.map +1 -0
- package/dist/commands/extension/targetSelection.d.ts +62 -0
- package/dist/commands/extension/targetSelection.d.ts.map +1 -0
- package/dist/commands/extension/targetSelection.js +210 -0
- package/dist/commands/extension/targetSelection.js.map +1 -0
- package/dist/commands/extension/targets.d.ts +7 -0
- package/dist/commands/extension/targets.d.ts.map +1 -0
- package/dist/commands/extension/targets.js +73 -0
- package/dist/commands/extension/targets.js.map +1 -0
- package/dist/commands/extension/use.d.ts +13 -0
- package/dist/commands/extension/use.d.ts.map +1 -0
- package/dist/commands/extension/use.js +66 -0
- package/dist/commands/extension/use.js.map +1 -0
- package/dist/commands/record.d.ts +35 -0
- package/dist/commands/record.d.ts.map +1 -0
- package/dist/commands/record.js +210 -0
- package/dist/commands/record.js.map +1 -0
- package/dist/commands/skill.d.ts +6 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +42 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/watcherNativeHost.js +48 -1
- package/dist/commands/watcherNativeHost.js.map +1 -1
- package/dist/extension/dist/background/auth-header-monitor.js +77 -0
- package/dist/extension/dist/background/bridge-client.js +120 -0
- package/dist/extension/dist/background/cdp-proxy.js +201 -0
- package/dist/extension/dist/background/debugger-manager.js +296 -0
- package/dist/extension/dist/background/service-worker.js +2004 -0
- package/dist/extension/dist/background/service-worker.js.map +7 -0
- package/dist/extension/dist/popup/popup.js +730 -0
- package/dist/extension/dist/popup/popup.js.map +7 -0
- package/dist/extension/dist/popup/tabMarkup.js +104 -0
- package/dist/extension/dist/popup/viewState.js +60 -0
- package/dist/extension/dist/types/messages.js +5 -0
- package/dist/extension/icons/icon-128.png +0 -0
- package/dist/extension/icons/icon-16.png +0 -0
- package/dist/extension/icons/icon-48.png +0 -0
- package/dist/extension/manifest.json +26 -0
- package/dist/extension/src/popup/popup.html +756 -0
- package/dist/skill/argus/SKILL.md +202 -0
- package/dist/skill/argus/reference/CAPTURE.md +77 -0
- package/dist/skill/argus/reference/DIALOG.md +31 -0
- package/dist/skill/argus/reference/EVAL.md +137 -0
- package/dist/skill/argus/reference/EXTENSION.md +43 -0
- package/dist/skill/argus/reference/EXTENSION_IFRAME_EVAL.md +58 -0
- package/dist/skill/argus/reference/IFRAMES.md +46 -0
- package/dist/skill/argus/reference/INJECT.md +145 -0
- package/dist/skill/argus/reference/INSPECT.md +175 -0
- package/dist/skill/argus/reference/NET.md +108 -0
- package/dist/skill/argus/reference/PLUGINS.md +172 -0
- package/dist/skill/argus/reference/RUNTIME_CODE.md +42 -0
- package/dist/skill/argus/reference/START.md +120 -0
- package/dist/skill/argus/start-watcher.ts +108 -0
- package/package.json +2 -2
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: argus
|
|
3
|
+
description: Guides use of the Argus CLI to debug and inspect web apps via Chrome CDP or the Argus Chrome extension, including authenticated browser sessions, iframe targets, logs, eval, DOM, network, and screenshots.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Argus CLI
|
|
7
|
+
|
|
8
|
+
Debug web apps through either:
|
|
9
|
+
|
|
10
|
+
- **Extension-control**: normal user Chrome profile, cookies, login state, existing extensions. Best for authenticated portal apps and ordinary browser sessions.
|
|
11
|
+
- **CDP Chrome**: Argus-launched/debuggable Chrome. Best for local apps, temp profiles, clean repros, headless runs, and raw Chrome target control.
|
|
12
|
+
|
|
13
|
+
Install/run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i -g @vforsh/argus
|
|
17
|
+
argus --help
|
|
18
|
+
npx -y @vforsh/argus --help
|
|
19
|
+
argus skill
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`argus skill` prints the absolute path to the installed `SKILL.md`. Use it when an agent needs to locate the packaged Argus skill files.
|
|
23
|
+
|
|
24
|
+
**Long-running commands:** `argus start`, `argus chrome start`, `argus watcher start`, and log tails do not exit on their own. Start them in the background when using an agent shell.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Pick The Mode
|
|
29
|
+
|
|
30
|
+
Use **extension-control** when the task needs the user's normal Chrome profile, saved login, cookies, local storage, or already-open tabs.
|
|
31
|
+
|
|
32
|
+
Use **CDP Chrome** when the task needs an isolated browser, headless run, custom CDP port, script injection at startup, or raw `chrome://`/target-id control.
|
|
33
|
+
|
|
34
|
+
Use **iframe target selection** when the app is embedded in a portal page and `eval`/DOM/click/screenshot must run inside the embedded app, not the host page.
|
|
35
|
+
|
|
36
|
+
Read:
|
|
37
|
+
|
|
38
|
+
- [START.md](./reference/START.md) for CDP startup, watcher lifecycle, config defaults, and Node API.
|
|
39
|
+
- [EXTENSION.md](./reference/EXTENSION.md) for extension setup and runtime limitations.
|
|
40
|
+
- [INSPECT.md](./reference/INSPECT.md) for command catalogs: logs, eval, capture, DOM, interaction, auth, storage, trace, pages, emulation.
|
|
41
|
+
- [CAPTURE.md](./reference/CAPTURE.md) for screenshots, recordings, crop semantics, iframe capture, and recording troubleshooting.
|
|
42
|
+
- [NET.md](./reference/NET.md) for network capture, filtering, inspection, bodies, WebSockets, SSE, HAR export, and mocks.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Authenticated Browser Profile Flow
|
|
47
|
+
|
|
48
|
+
Use this for any app that needs the user's normal browser profile, cookies, local storage, extensions, or saved login state. Do **not** use `argus start`, `argus chrome start --profile temp`, headless Chrome, or a fresh CDP profile for this flow; those lose the real login/session context.
|
|
49
|
+
|
|
50
|
+
First-time setup is one command: `argus extension install` (installs native hosts, opens chrome://extensions, waits for connect). The extension ID is pinned and the build ships with the CLI — see [EXTENSION.md](./reference/EXTENSION.md).
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
APP_URL="https://portal.example/app"
|
|
54
|
+
WATCHER_ID="app"
|
|
55
|
+
|
|
56
|
+
open -a "Google Chrome" "$APP_URL"
|
|
57
|
+
argus ext doctor --json
|
|
58
|
+
argus ext tabs --url "$APP_URL" --json
|
|
59
|
+
argus ext use --url "$APP_URL" --as "$WATCHER_ID" --json
|
|
60
|
+
argus eval "$WATCHER_ID" "({ title: document.title, href: location.href })" --json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If multiple tabs match, do not guess. Run `argus ext tabs --url "$APP_URL" --json`, choose the intended `tabId`, then use:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
argus ext use --tab <tabId> --as "$WATCHER_ID" --json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If the tab is restored in the background or app boot looks stuck, make it visible and reload:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
argus ext show "$WATCHER_ID"
|
|
73
|
+
argus reload "$WATCHER_ID"
|
|
74
|
+
argus eval-until "$WATCHER_ID" "document.readyState === 'complete'" --total-timeout 30s
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Extension Iframe Flow
|
|
80
|
+
|
|
81
|
+
Use this when the real app lives in an iframe inside a host page.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
APP_URL="https://portal.example/app"
|
|
85
|
+
WATCHER_ID="app"
|
|
86
|
+
|
|
87
|
+
open -a "Google Chrome" "$APP_URL"
|
|
88
|
+
argus ext use --url "$APP_URL" --as "$WATCHER_ID" --iframe-url game-frame-host.example --json
|
|
89
|
+
argus eval "$WATCHER_ID" "({ title: document.title, origin: location.origin })" --json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If iframe selection fails because the iframe is not present yet:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
argus ext use --url "$APP_URL" --as "$WATCHER_ID" --json
|
|
96
|
+
argus ext show "$WATCHER_ID"
|
|
97
|
+
argus reload "$WATCHER_ID"
|
|
98
|
+
argus eval-until "$WATCHER_ID" "document.querySelectorAll('iframe').length > 0" --total-timeout 30s
|
|
99
|
+
argus ext targets "$WATCHER_ID" --tree
|
|
100
|
+
argus ext select "$WATCHER_ID" --iframe-url game-frame-host.example --json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Useful selectors:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
argus ext select "$WATCHER_ID" --iframe-url game-frame-host.example
|
|
107
|
+
argus ext select "$WATCHER_ID" --iframe-title "Game Title"
|
|
108
|
+
argus ext select "$WATCHER_ID" --iframe auto
|
|
109
|
+
argus ext select "$WATCHER_ID" --page
|
|
110
|
+
argus ext doctor --watcher "$WATCHER_ID"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`--iframe auto` is a convenience heuristic and should fail closed when multiple iframes look equally plausible. Prefer `--iframe-url` or `--iframe-title` when correctness matters.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Inspect Loop
|
|
118
|
+
|
|
119
|
+
Once a watcher is attached, use quick bounded commands first:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
argus logs app --since 10m --levels error,warning
|
|
123
|
+
argus eval app "({ href: location.href, title: document.title })" --json
|
|
124
|
+
argus screenshot app --out shot.png
|
|
125
|
+
argus record app --duration 5s --selector "canvas" --out demo.mp4
|
|
126
|
+
argus dom tree app --selector body --depth 2
|
|
127
|
+
argus snapshot app --interactive
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For interaction:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
argus locate role app button --name "Submit"
|
|
134
|
+
argus click app --selector "button.submit"
|
|
135
|
+
argus click app --ref e5
|
|
136
|
+
argus drag app --selector "canvas" --pos 320,240 --by 80,-30
|
|
137
|
+
argus fill app --selector "#email" "user@example.com"
|
|
138
|
+
argus keydown app --key Enter
|
|
139
|
+
argus scroll-to app --selector "#footer"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
For iframe-active extension watchers, commands run against the selected iframe target. Screenshots, recordings, selectors, and eval are resolved relative to that iframe.
|
|
143
|
+
|
|
144
|
+
For deeper command lists, use [INSPECT.md](./reference/INSPECT.md). For screenshots/recording details, use [CAPTURE.md](./reference/CAPTURE.md). For eval flags, polling, file scripts, and args, use [EVAL.md](./reference/EVAL.md).
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## CDP Quick Start
|
|
149
|
+
|
|
150
|
+
Use CDP for local apps and clean repros where a temp/debuggable browser is acceptable.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm run dev
|
|
154
|
+
argus start --id app --url localhost:3000
|
|
155
|
+
argus eval app "location.href"
|
|
156
|
+
argus screenshot app --out shot.png
|
|
157
|
+
argus record app --duration 3s --out demo.mp4
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`argus start` launches Chrome and a watcher together. For more control:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
argus chrome start --url http://localhost:3000
|
|
164
|
+
argus watcher start --id app --url localhost:3000 --chrome-port 9222
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Keep these commands in the background in agent shells. See [START.md](./reference/START.md) for profile modes, auth-state hydration, watcher target flags, config defaults, and programmatic watcher APIs.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Troubleshooting
|
|
172
|
+
|
|
173
|
+
**No extension-control watcher** — First time? Run `argus extension install`. Otherwise open/reload the extension, then run `argus ext doctor --json`.
|
|
174
|
+
|
|
175
|
+
**Multiple tabs matched** — Use `argus ext tabs --url <url> --json`, choose a `tabId`, then pass `--tab <tabId>`.
|
|
176
|
+
|
|
177
|
+
**Iframe not found** — `argus ext show <id>`, `argus reload <id>`, wait for iframes, then `argus ext targets <id> --tree`.
|
|
178
|
+
|
|
179
|
+
**Eval runs on host page** — Select the iframe first: `argus ext select <id> --iframe-url <substring>`.
|
|
180
|
+
|
|
181
|
+
**Watcher cannot attach in CDP mode** — Check the Chrome port: `argus chrome status --cdp 127.0.0.1:9222`.
|
|
182
|
+
|
|
183
|
+
**Wrong CDP target matched** — Use `--type iframe`, `--origin`, `--parent`, or `--target`. See [IFRAMES.md](./reference/IFRAMES.md).
|
|
184
|
+
|
|
185
|
+
**Need to keep a page unthrottled** — Use `argus page show <id>` or `argus ext show <id>`. Hide later with `argus page hide <id>`.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## References
|
|
190
|
+
|
|
191
|
+
- [START.md](./reference/START.md) — CDP startup, watcher lifecycle, config defaults, Node API.
|
|
192
|
+
- [EXTENSION.md](./reference/EXTENSION.md) — Extension setup and extension-control details.
|
|
193
|
+
- [INSPECT.md](./reference/INSPECT.md) — Logs, capture summary, DOM, interaction, auth, storage, trace, emulation.
|
|
194
|
+
- [CAPTURE.md](./reference/CAPTURE.md) — Screenshots, recordings, crop semantics, iframe capture, recording troubleshooting.
|
|
195
|
+
- [NET.md](./reference/NET.md) — Network capture, filtering, inspection, export, and mocks.
|
|
196
|
+
- [EVAL.md](./reference/EVAL.md) — Eval syntax, polling, files, args, iframe eval.
|
|
197
|
+
- [RUNTIME_CODE.md](./reference/RUNTIME_CODE.md) — Runtime JS/CSS discovery and live CSS edits.
|
|
198
|
+
- [IFRAMES.md](./reference/IFRAMES.md) — CDP iframe targeting and iframe concepts.
|
|
199
|
+
- [EXTENSION_IFRAME_EVAL.md](./reference/EXTENSION_IFRAME_EVAL.md) — Cross-origin iframe helper mechanics.
|
|
200
|
+
- [INJECT.md](./reference/INJECT.md) — Script injection on watcher attach/navigation.
|
|
201
|
+
- [DIALOG.md](./reference/DIALOG.md) — Browser dialog status and handling.
|
|
202
|
+
- [PLUGINS.md](./reference/PLUGINS.md) — CLI plugin loading and Google Sheets plugin.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
## Capture Commands
|
|
2
|
+
|
|
3
|
+
Use this when you need page pixels: screenshots for quick state checks, recordings for motion/gameplay/repro clips.
|
|
4
|
+
|
|
5
|
+
## Screenshots
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
argus screenshot app --out shot.png
|
|
9
|
+
argus screenshot app --selector "canvas" --out canvas.png
|
|
10
|
+
argus screenshot app --clip 100,80,640,360 --out crop.png
|
|
11
|
+
argus screenshot app --testid "game-canvas" --out game.png
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`--selector` and `--clip` are mutually exclusive. `--clip` is viewport-relative in CSS pixels. `--testid <id>` is shorthand for `--selector "[data-testid='<id>']"`.
|
|
15
|
+
|
|
16
|
+
## Recording
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
argus record app --duration 5s --out demo.mp4
|
|
20
|
+
argus record app --duration 3s --selector "canvas" --out canvas.mp4
|
|
21
|
+
argus record app --duration 3s --clip 100,80,640,360 --out crop.mp4
|
|
22
|
+
argus record app --duration 3s --testid "game-canvas" --out game.mp4
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Recordings are silent MP4/H.264 files by default. WebM is supported with `--format webm` or a `.webm` output path. Default FPS is 30; use `--fps <1-60>` for large canvases or lighter artifacts.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
argus record app --duration 5s --selector "canvas" --fps 12 --out canvas.mp4
|
|
29
|
+
argus record app --duration 5s --selector "canvas" --format webm --out canvas.webm
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For manual interaction windows:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
argus record start app --selector "canvas" --out canvas.mp4
|
|
36
|
+
argus click app --selector "#play"
|
|
37
|
+
argus record stop app
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Crop Semantics
|
|
41
|
+
|
|
42
|
+
Viewport capture records or screenshots the visible page viewport. Selector capture resolves the element once at capture start, then crops page pixels to that element rectangle. Clip capture uses `x,y,width,height` in viewport CSS pixels.
|
|
43
|
+
|
|
44
|
+
If the selected element moves or resizes during a recording, Argus keeps the original crop rectangle for that recording. Prefer a stable canvas/container selector for games.
|
|
45
|
+
|
|
46
|
+
## Extension / Iframes
|
|
47
|
+
|
|
48
|
+
For iframe-active extension watchers, capture commands resolve selectors inside the selected iframe, then capture top-level page pixels with the translated crop. This is the same target model used by `eval`, DOM commands, and screenshots.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
argus ext use --url portal.example --as app --iframe-url game-frame-host.example
|
|
52
|
+
argus record app --duration 5s --selector "canvas" --out game.mp4
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If capture runs against the host page instead of the app, select the iframe first:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
argus ext targets app --tree
|
|
59
|
+
argus ext select app --iframe-url game-frame-host.example
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Troubleshooting
|
|
63
|
+
|
|
64
|
+
If recording fails with no frames, make the page visible and unthrottled:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
argus page show app
|
|
68
|
+
argus record app --duration 3s --selector "canvas" --out canvas.mp4
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If recording fails because `ffmpeg` is missing, install it or point Argus at it:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
ARGUS_FFMPEG=/opt/homebrew/bin/ffmpeg argus record app --duration 3s --out demo.mp4
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
MP4 output requires an ffmpeg build with `libx264`. If your ffmpeg lacks it, install a full build or record WebM with `--format webm`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# argus dialog
|
|
2
|
+
|
|
3
|
+
Inspect and handle browser JavaScript dialogs on the watcher-attached page.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
argus dialog status [id] [--json]
|
|
9
|
+
argus dialog accept [id] [--json]
|
|
10
|
+
argus dialog dismiss [id] [--json]
|
|
11
|
+
argus dialog prompt [id] --text "<value>" [--json]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
argus dialog status app
|
|
18
|
+
argus dialog accept app
|
|
19
|
+
argus dialog dismiss app
|
|
20
|
+
argus dialog prompt app --text "hello"
|
|
21
|
+
argus dialog status app --json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Behavior
|
|
25
|
+
|
|
26
|
+
- `status` returns the single active dialog, or `null` when nothing is open.
|
|
27
|
+
- `accept` resolves the active dialog with OK / Leave / equivalent browser action.
|
|
28
|
+
- `dismiss` resolves the active dialog with Cancel / Stay / equivalent browser action.
|
|
29
|
+
- `prompt` is just `accept` plus submitted text. It fails if the active dialog is not a prompt.
|
|
30
|
+
|
|
31
|
+
Chrome only exposes one active JavaScript dialog at a time, so Argus models dialog state as a single current snapshot instead of a list.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# argus eval
|
|
2
|
+
|
|
3
|
+
Evaluate JavaScript in page connected to watcher.
|
|
4
|
+
|
|
5
|
+
Alias: `argus js`
|
|
6
|
+
|
|
7
|
+
## Syntax
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
argus eval [id] "<expression>" [flags]
|
|
11
|
+
argus js [id] "<expression>" [flags]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
argus eval app "location.href"
|
|
18
|
+
argus eval app "document.title"
|
|
19
|
+
argus eval app "await fetch('/ping').then(r => r.status)"
|
|
20
|
+
argus eval app "window.store.getState()" --inject ./debug-hooks.js
|
|
21
|
+
argus eval app --file ./script.js --arg level=10 --arg mode=fast
|
|
22
|
+
argus eval app --file ./script.js --args ./args.json
|
|
23
|
+
argus eval app "document.title" --json --out ./result.json
|
|
24
|
+
argus eval app --file ./script.js --bundle
|
|
25
|
+
argus eval app --file ./script.js --no-bundle
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`--file` with leading `import`/`export` auto-enables bundling (one-line stderr note). `--bundle` forces bundling; `--no-bundle` reads the file as-is. Bundling resolves the entry and any import graph esbuild can resolve from the current working directory (including paths outside the entry directory and packages under `node_modules`). Node built-ins (`node:fs`, etc.) are rejected. TypeScript is transpiled without typechecking. Helpers may `export` symbols; the entry file must not emit top-level `export` into the bundle.
|
|
29
|
+
|
|
30
|
+
Poll until condition:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
argus eval app "document.title" --interval 250ms --until 'result === "ready"'
|
|
34
|
+
argus eval app "Date.now()" --interval 500 --count 10 --out ./poll.ndjson
|
|
35
|
+
argus eval app "Date.now()" --interval 500 --count 10 --out ./frames.json --rotate
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Output
|
|
39
|
+
|
|
40
|
+
- Default: compact preview
|
|
41
|
+
- `--json`: JSON object (NDJSON with `--interval`)
|
|
42
|
+
- `--out <path>`: write result to file; single eval overwrites, polling appends NDJSON, `--rotate` writes one numbered file per iteration
|
|
43
|
+
|
|
44
|
+
## Behavior Flags
|
|
45
|
+
|
|
46
|
+
| Flag | Effect |
|
|
47
|
+
| ------------------------ | ----------------------------------- |
|
|
48
|
+
| `--no-await` | Don't await promises |
|
|
49
|
+
| `--timeout <duration>` | Eval timeout (`60000`, `60s`, `2m`) |
|
|
50
|
+
| `--no-return-by-value` | Preview-style results |
|
|
51
|
+
| `--no-fail-on-exception` | Don't exit 1 on throw |
|
|
52
|
+
| `--retry <n>` | Retry failed evals |
|
|
53
|
+
| `--silent` / `-q` | Suppress success output |
|
|
54
|
+
| `--inject <file>` | Run setup code before expression |
|
|
55
|
+
| `--bundle` | Force bundling for `--file` |
|
|
56
|
+
| `--no-bundle` | Skip bundling (disables auto) |
|
|
57
|
+
| `--arg <key=value>` | Expose string arg as `args[key]` |
|
|
58
|
+
| `--args <path>` | Load args map from JSON file |
|
|
59
|
+
| `--out <path>` | Write result to file |
|
|
60
|
+
| `--rotate` | One file per poll iteration |
|
|
61
|
+
|
|
62
|
+
## Script Args
|
|
63
|
+
|
|
64
|
+
`--arg <key=value>` is repeatable on `eval`/`js` and `eval-until`/`wait`. It exposes a frozen `args` object to the evaluated source:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
argus js app --file ./open-level.js --arg level=10 --arg variant=arrows
|
|
68
|
+
argus js app --file ./open-level.js --args ./fixtures/level.json --arg variant=arrows
|
|
69
|
+
argus js app "window.store.getState()" --inject ./debug-hooks.js --arg user=qa
|
|
70
|
+
cat ./click-test-id.js | argus js app --stdin --arg testId=arrows.boosters.button.ruler
|
|
71
|
+
argus wait app --file ./ready.js --arg level=10 --total-timeout 20s
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Values stay strings; cast in the script:
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const level = Number(args.level)
|
|
78
|
+
const variant = String(args.variant ?? 'arrows')
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Duplicate keys use the last value. Values are split at the first `=`, so URLs and query strings work. Invalid values like `--arg level`, `--arg =10`, or `--arg ""` exit with code 2 before contacting the watcher.
|
|
82
|
+
|
|
83
|
+
`--args <path>` loads a JSON object from disk. Primitive values (`string`, `number`, `boolean`, `null`) are coerced to strings; nested objects/arrays are rejected. CLI `--arg` flags override file entries.
|
|
84
|
+
|
|
85
|
+
## Polling Flags
|
|
86
|
+
|
|
87
|
+
| Flag | Effect |
|
|
88
|
+
| ----------------------- | ----------------------------------- |
|
|
89
|
+
| `--interval <duration>` | Re-run periodically (`250ms`, `3s`) |
|
|
90
|
+
| `--count <n>` | Stop after n iterations |
|
|
91
|
+
| `--until <condition>` | Stop when truthy |
|
|
92
|
+
|
|
93
|
+
`--until` context: `{ result, exception, iteration, attempt }`
|
|
94
|
+
|
|
95
|
+
## eval-until
|
|
96
|
+
|
|
97
|
+
Poll until expression returns truthy (`Boolean(result)`). Defaults to 250ms interval; silent intermediate output.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
argus eval-until [id] "<expression>" [flags]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
argus eval-until app "document.querySelector('#loaded')"
|
|
105
|
+
argus eval-until app "window.APP_READY" --interval 500
|
|
106
|
+
argus eval-until app "document.title === 'Ready'" --total-timeout 30s
|
|
107
|
+
argus eval-until app "window.data" --verbose --count 20
|
|
108
|
+
argus eval-until app --file ./check.js --total-timeout 1m
|
|
109
|
+
argus wait app --file ./ready.js --arg level=10 --total-timeout 20s
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
| Flag | Effect |
|
|
113
|
+
| ---------------------------- | --------------------------------------- |
|
|
114
|
+
| `--interval <ms\|duration>` | Polling interval (default: 250ms) |
|
|
115
|
+
| `--count <n>` | Max iterations |
|
|
116
|
+
| `--total-timeout <duration>` | Max wall-clock time (`30s`, `2m`, `1h`) |
|
|
117
|
+
| `--verbose` | Print intermediate (falsy) results |
|
|
118
|
+
|
|
119
|
+
Also supports all behavior flags (`--no-await`, `--timeout 60s`, `--json`, `--retry`, etc.) and iframe flags.
|
|
120
|
+
Also supports `--arg <key=value>`, `--args <path>`, and `--out <path>`.
|
|
121
|
+
|
|
122
|
+
**Exit codes:** 0 = truthy found, 1 = error/exhausted, 2 = invalid args, 130 = SIGINT/SIGTERM.
|
|
123
|
+
|
|
124
|
+
**vs `eval --interval --until`:** `eval-until` defaults interval to 250ms, uses implicit `Boolean(result)` condition, suppresses intermediate output by default, and adds `--total-timeout`.
|
|
125
|
+
|
|
126
|
+
## Iframe Eval (extension mode)
|
|
127
|
+
|
|
128
|
+
Cross-origin iframes need helper script:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
argus eval iframe-helper --out src/argus-helper.js
|
|
132
|
+
argus eval app "window.gameState" --iframe "iframe#game"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Options: `--iframe <selector>`, `--iframe-namespace <name>`, `--iframe-timeout <duration>` (`5000`, `5s`, `1m`)
|
|
136
|
+
|
|
137
|
+
See [EXTENSION_IFRAME_EVAL.md](./EXTENSION_IFRAME_EVAL.md).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
## Extension Workflow
|
|
2
|
+
|
|
3
|
+
Debug normal Chrome session without CDP flags.
|
|
4
|
+
|
|
5
|
+
### One-Time Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Installs native hosts, opens chrome://extensions, waits for the extension to connect:
|
|
9
|
+
argus extension install
|
|
10
|
+
# → click "Load unpacked" and select the printed folder (enable Developer mode if hidden)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The extension ID is **pinned** (via a `key` in the manifest), so there's no ID to copy/paste and the prebuilt extension ships with the CLI — no build step. Useful sub-commands:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
argus extension path # absolute folder to "Load unpacked"
|
|
17
|
+
argus extension status # native host config + extension ID
|
|
18
|
+
argus extension install --no-wait # scripted/non-interactive (skip the connect wait)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Advanced: `argus extension setup [extensionId]` installs only the native hosts (pass an id to override the pinned one for a differently-keyed build).
|
|
22
|
+
|
|
23
|
+
> Migration: if you previously loaded an unkeyed build, reload the extension once at `chrome://extensions` so it picks up the pinned ID.
|
|
24
|
+
|
|
25
|
+
### Usage
|
|
26
|
+
|
|
27
|
+
1. Click Argus extension icon
|
|
28
|
+
2. Click **Attach** on target tab
|
|
29
|
+
3. Chrome shows orange "debugging" bar (expected)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
argus list
|
|
33
|
+
argus logs extension
|
|
34
|
+
argus eval extension "document.title"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Limitations
|
|
38
|
+
|
|
39
|
+
- Debugging bar can't be hidden (Chrome security)
|
|
40
|
+
- One debugger per tab
|
|
41
|
+
- Tab must stay open
|
|
42
|
+
- Manual tab selection (no `--url` matching)
|
|
43
|
+
- Cross-origin iframes: use helper script (see [IFRAMES.md](./IFRAMES.md))
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Cross-Origin Iframe Eval (Extension Mode)
|
|
2
|
+
|
|
3
|
+
Extension mode can't eval directly in cross-origin iframes. Use postMessage bridge.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Generate helper
|
|
9
|
+
argus eval iframe-helper --out src/argus-helper.js
|
|
10
|
+
argus eval iframe-helper --iife --out dist/argus-helper.js # Wrap in IIFE
|
|
11
|
+
argus eval iframe-helper --namespace myapp # Custom namespace
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Include in iframe HTML:
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<script src="argus-helper.js"></script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
argus eval app "document.title" --iframe "iframe"
|
|
24
|
+
argus eval app "window.gameState" --iframe "iframe#game"
|
|
25
|
+
argus eval app "heavyComputation()" --iframe "iframe" --iframe-timeout 10000
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Message Format
|
|
29
|
+
|
|
30
|
+
Request (parent → iframe):
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{ "type": "argus:eval", "id": "<uuid>", "code": "<expression>" }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Response (iframe → parent):
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{ "type": "argus:eval-result", "id": "<uuid>", "ok": true, "result": "<value>" }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## When to Use
|
|
43
|
+
|
|
44
|
+
| Scenario | Approach |
|
|
45
|
+
| ------------------------ | -------------------------------------- |
|
|
46
|
+
| CDP + any iframe | `--type iframe` / `--origin` targeting |
|
|
47
|
+
| Extension + same-origin | Eval reaches iframe directly |
|
|
48
|
+
| Extension + cross-origin | **`--iframe` option** (needs helper) |
|
|
49
|
+
|
|
50
|
+
## Security
|
|
51
|
+
|
|
52
|
+
Helper uses `eval()`. Dev/debug builds only. Consider removing from production.
|
|
53
|
+
|
|
54
|
+
## Limitations
|
|
55
|
+
|
|
56
|
+
- Requires modifying iframe source
|
|
57
|
+
- Results must be serializable
|
|
58
|
+
- Async needs explicit `await` in code string
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Iframes and Target Selection (CDP)
|
|
2
|
+
|
|
3
|
+
For embedded apps/games in iframes. Simple `--url` matching can attach to wrong target when parent page has iframe URL in query string.
|
|
4
|
+
|
|
5
|
+
## Targeting Flags
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Only iframes
|
|
9
|
+
argus watcher start --id game --type iframe --url localhost:3007
|
|
10
|
+
|
|
11
|
+
# Match by origin (ignores query params)
|
|
12
|
+
argus watcher start --id game --origin https://localhost:3007
|
|
13
|
+
|
|
14
|
+
# Explicit target ID
|
|
15
|
+
argus page targets --type iframe
|
|
16
|
+
argus watcher start --id game --target CC1135709D9AC3B9CC0446F8B58CC344
|
|
17
|
+
|
|
18
|
+
# Match parent URL pattern
|
|
19
|
+
argus watcher start --id game --type iframe --parent yandex.ru --url localhost:3007
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Discovering Targets
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
argus page targets # List all
|
|
26
|
+
argus page targets --tree # Parent-child tree
|
|
27
|
+
argus page targets --type iframe
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example (embedded game)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Terminal 1
|
|
34
|
+
argus chrome start --url "https://yandex.ru/games/app/123"
|
|
35
|
+
|
|
36
|
+
# Terminal 2
|
|
37
|
+
argus watcher start --id game --type iframe --url localhost:3007
|
|
38
|
+
|
|
39
|
+
# Terminal 3
|
|
40
|
+
argus logs game --levels error,warning
|
|
41
|
+
argus eval game "window.gameState"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Extension Mode
|
|
45
|
+
|
|
46
|
+
Cross-origin iframes need helper script + `argus eval --iframe`. See [EXTENSION_IFRAME_EVAL.md](./EXTENSION_IFRAME_EVAL.md).
|