chrome-devtools-axi 0.1.1 → 0.1.2
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 +104 -25
- package/dist/bin/chrome-devtools-axi.js +0 -0
- package/dist/src/cli.d.ts +58 -0
- package/dist/src/cli.js +992 -41
- package/dist/src/cli.js.map +1 -1
- package/dist/src/client.d.ts +6 -1
- package/dist/src/client.js +27 -6
- package/dist/src/client.js.map +1 -1
- package/dist/src/hooks.d.ts +44 -0
- package/dist/src/hooks.js +88 -0
- package/dist/src/hooks.js.map +1 -0
- package/dist/src/snapshot.d.ts +6 -0
- package/dist/src/snapshot.js +9 -0
- package/dist/src/snapshot.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">chrome-devtools-axi</h1>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/chrome-devtools-axi"><img alt="npm" src="https://img.shields.io/npm/v/chrome-devtools-axi?style=flat-square" /></a>
|
|
5
|
+
<a href="https://github.com/kunchenguid/chrome-devtools-axi/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/kunchenguid/chrome-devtools-axi/ci.yml?style=flat-square&label=CI" /></a>
|
|
6
|
+
<a href="https://github.com/kunchenguid/chrome-devtools-axi/actions/workflows/release-please.yml"><img alt="Release" src="https://img.shields.io/github/actions/workflow/status/kunchenguid/chrome-devtools-axi/release-please.yml?style=flat-square&label=Release" /></a>
|
|
7
|
+
<a href="#"><img alt="Platform" src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-blue?style=flat-square" /></a>
|
|
8
|
+
<a href="https://x.com/kunchenguid"><img alt="X" src="https://img.shields.io/badge/X-@kunchenguid-black?style=flat-square" /></a>
|
|
9
|
+
<a href="https://discord.gg/BW4aJuQhTf"><img alt="Discord" src="https://img.shields.io/discord/1439901831038763092?style=flat-square&label=discord" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
<h3 align="center">Highly agent-ergonomic browser automation</h3>
|
|
9
13
|
|
|
@@ -34,10 +38,10 @@ snapshot:
|
|
|
34
38
|
|
|
35
39
|
## Install
|
|
36
40
|
|
|
37
|
-
**
|
|
41
|
+
**Tell your agent:**
|
|
38
42
|
|
|
39
|
-
```
|
|
40
|
-
npm install -g chrome-devtools-axi
|
|
43
|
+
```
|
|
44
|
+
Execute `npm install -g chrome-devtools-axi` and run the command for browser automation.
|
|
41
45
|
```
|
|
42
46
|
|
|
43
47
|
**From source**
|
|
@@ -74,28 +78,103 @@ npm link
|
|
|
74
78
|
|
|
75
79
|
## CLI Reference
|
|
76
80
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
### Navigation
|
|
82
|
+
|
|
83
|
+
| Command | Description |
|
|
84
|
+
| ----------------- | ----------------------------------- |
|
|
85
|
+
| `open <url>` | Navigate to URL and snapshot |
|
|
86
|
+
| `snapshot` | Capture current page state |
|
|
87
|
+
| `screenshot <p>` | Save a screenshot to a file |
|
|
88
|
+
| `scroll <dir>` | Scroll: up, down, top, bottom |
|
|
89
|
+
| `back` | Navigate back |
|
|
90
|
+
| `wait <ms\|text>` | Wait for time or text to appear |
|
|
91
|
+
| `eval <js>` | Evaluate JavaScript in page context |
|
|
92
|
+
|
|
93
|
+
### Interaction
|
|
94
|
+
|
|
95
|
+
| Command | Description |
|
|
96
|
+
| -------------------------- | ------------------------------ |
|
|
97
|
+
| `click @<uid>` | Click an element by ref |
|
|
98
|
+
| `fill @<uid> <text>` | Fill a form field |
|
|
99
|
+
| `type <text>` | Type text at current focus |
|
|
100
|
+
| `press <key>` | Press a keyboard key |
|
|
101
|
+
| `hover @<uid>` | Hover over an element |
|
|
102
|
+
| `drag @<from> @<to>` | Drag an element onto another |
|
|
103
|
+
| `fillform @<uid>=<val>...` | Fill multiple form fields |
|
|
104
|
+
| `dialog <accept\|dismiss>` | Handle a browser dialog |
|
|
105
|
+
| `upload @<uid> <path>` | Upload a file through an input |
|
|
106
|
+
|
|
107
|
+
### Page Management
|
|
108
|
+
|
|
109
|
+
| Command | Description |
|
|
110
|
+
| ----------------- | --------------------------- |
|
|
111
|
+
| `pages` | List all open tabs |
|
|
112
|
+
| `newpage <url>` | Open a new tab |
|
|
113
|
+
| `selectpage <id>` | Switch to a tab by ID |
|
|
114
|
+
| `closepage <id>` | Close a tab by ID |
|
|
115
|
+
| `resize <w> <h>` | Resize the browser viewport |
|
|
116
|
+
|
|
117
|
+
### Emulation
|
|
118
|
+
|
|
119
|
+
| Command | Description |
|
|
120
|
+
| --------- | ------------------------------- |
|
|
121
|
+
| `emulate` | Emulate device/network/viewport |
|
|
122
|
+
|
|
123
|
+
### DevTools Debugging
|
|
124
|
+
|
|
125
|
+
| Command | Description |
|
|
126
|
+
| ------------------ | ------------------------------ |
|
|
127
|
+
| `console` | List console messages |
|
|
128
|
+
| `console-get <id>` | Get a specific console message |
|
|
129
|
+
| `network` | List network requests |
|
|
130
|
+
| `network-get [id]` | Get a specific network request |
|
|
131
|
+
|
|
132
|
+
### Performance
|
|
133
|
+
|
|
134
|
+
| Command | Description |
|
|
135
|
+
| --------------------------- | ----------------------------- |
|
|
136
|
+
| `lighthouse` | Run a Lighthouse audit |
|
|
137
|
+
| `perf-start` | Start a performance trace |
|
|
138
|
+
| `perf-stop` | Stop the performance trace |
|
|
139
|
+
| `perf-insight <set> <name>` | Analyze a performance insight |
|
|
140
|
+
| `heap <path>` | Capture a heap snapshot |
|
|
141
|
+
|
|
142
|
+
### Bridge
|
|
143
|
+
|
|
144
|
+
| Command | Description |
|
|
145
|
+
| ------- | ----------------------- |
|
|
146
|
+
| `start` | Start the bridge server |
|
|
147
|
+
| `stop` | Stop the bridge server |
|
|
91
148
|
|
|
92
149
|
Running with no command is equivalent to `snapshot`.
|
|
93
150
|
|
|
94
151
|
### Flags
|
|
95
152
|
|
|
96
|
-
| Flag
|
|
97
|
-
|
|
|
98
|
-
| `--help`
|
|
153
|
+
| Flag | Description |
|
|
154
|
+
| --------------------------- | ------------------------------------------- |
|
|
155
|
+
| `--help` | Show usage information |
|
|
156
|
+
| `--full` | Show complete snapshot without truncation |
|
|
157
|
+
| `--background` | Open new page in background (newpage) |
|
|
158
|
+
| `--uid @<uid>` | Target a specific element (screenshot) |
|
|
159
|
+
| `--full-page` | Capture entire scrollable page (screenshot) |
|
|
160
|
+
| `--format <fmt>` | Image format: png, jpeg, webp (screenshot) |
|
|
161
|
+
| `--viewport <spec>` | Viewport like "390x844x3,mobile" (emulate) |
|
|
162
|
+
| `--color-scheme <value>` | dark, light, or auto (emulate) |
|
|
163
|
+
| `--network <condition>` | Network throttle: Slow 3G, etc. (emulate) |
|
|
164
|
+
| `--cpu <rate>` | CPU throttling rate 1-20 (emulate) |
|
|
165
|
+
| `--geolocation <lat>x<lon>` | Set geolocation (emulate) |
|
|
166
|
+
| `--user-agent <string>` | Custom user agent (emulate) |
|
|
167
|
+
| `--type <type>` | Filter by type (console, network) |
|
|
168
|
+
| `--limit <n>` | Max items to return (console, network) |
|
|
169
|
+
| `--page <n>` | Pagination (console, network) |
|
|
170
|
+
| `--device <device>` | desktop or mobile (lighthouse) |
|
|
171
|
+
| `--mode <mode>` | navigation or snapshot (lighthouse) |
|
|
172
|
+
| `--output-dir <path>` | Directory for reports (lighthouse) |
|
|
173
|
+
| `--no-reload` | Skip page reload (perf-start) |
|
|
174
|
+
| `--no-auto-stop` | Disable auto-stop (perf-start) |
|
|
175
|
+
| `--file <path>` | Save trace data to file (perf-start/stop) |
|
|
176
|
+
| `--response-file <path>` | Save response body (network-get) |
|
|
177
|
+
| `--request-file <path>` | Save request body (network-get) |
|
|
99
178
|
|
|
100
179
|
## Configuration
|
|
101
180
|
|
|
File without changes
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -1 +1,59 @@
|
|
|
1
|
+
export declare function getCommandHelp(command: string): string | null;
|
|
2
|
+
export interface ScreenshotArgs {
|
|
3
|
+
filePath: string | null;
|
|
4
|
+
uid: string | undefined;
|
|
5
|
+
fullPage: boolean;
|
|
6
|
+
format: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseScreenshotArgs(args: string[]): ScreenshotArgs;
|
|
9
|
+
export declare function formatScreenshotOutput(filePath: string): string;
|
|
10
|
+
/** Parse MCP list_pages markdown into structured data. */
|
|
11
|
+
export declare function parsePagesList(text: string): {
|
|
12
|
+
id: number;
|
|
13
|
+
url: string;
|
|
14
|
+
selected: boolean;
|
|
15
|
+
}[];
|
|
16
|
+
/** Format raw MCP text result as AXI output: labeled block + truncation + suggestions. */
|
|
17
|
+
export declare function formatMcpResult(label: string, text: string, suggestions: string[]): string;
|
|
18
|
+
export declare function parseFillFormArgs(args: string[]): {
|
|
19
|
+
entries: {
|
|
20
|
+
uid: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
export interface EmulateArgs {
|
|
25
|
+
viewport?: string;
|
|
26
|
+
colorScheme?: string;
|
|
27
|
+
networkConditions?: string;
|
|
28
|
+
cpuThrottlingRate?: number;
|
|
29
|
+
geolocation?: string;
|
|
30
|
+
userAgent?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function parseEmulateArgs(args: string[]): EmulateArgs;
|
|
33
|
+
export declare function parseConsoleArgs(args: string[]): {
|
|
34
|
+
types?: string[];
|
|
35
|
+
pageSize?: number;
|
|
36
|
+
pageIdx?: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function parseNetworkArgs(args: string[]): {
|
|
39
|
+
resourceTypes?: string[];
|
|
40
|
+
pageSize?: number;
|
|
41
|
+
pageIdx?: number;
|
|
42
|
+
};
|
|
43
|
+
export declare function parseNetworkGetArgs(args: string[]): {
|
|
44
|
+
reqid?: number;
|
|
45
|
+
responseFilePath?: string;
|
|
46
|
+
requestFilePath?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function parseLighthouseArgs(args: string[]): {
|
|
49
|
+
device?: string;
|
|
50
|
+
mode?: string;
|
|
51
|
+
outputDirPath?: string;
|
|
52
|
+
};
|
|
53
|
+
export declare function parsePerfStartArgs(args: string[]): {
|
|
54
|
+
reload?: boolean;
|
|
55
|
+
autoStop?: boolean;
|
|
56
|
+
filePath?: string;
|
|
57
|
+
};
|
|
58
|
+
export declare function formatStopOutput(wasStopped: boolean): string;
|
|
1
59
|
export declare function main(argv: string[]): Promise<void>;
|