browse 0.9.3 → 0.9.4
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 +3 -3
- package/dist/commands/snapshot.js +10 -4
- package/dist/lib/driver/commands/snapshot.js +9 -10
- package/oclif.manifest.json +10 -4
- package/package.json +1 -1
- package/skills/browse/SKILL.md +2 -2
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ npm install -g browse
|
|
|
33
33
|
npm install -g browse
|
|
34
34
|
|
|
35
35
|
browse open https://example.com
|
|
36
|
-
browse snapshot
|
|
36
|
+
browse snapshot
|
|
37
37
|
browse click @0-12
|
|
38
38
|
browse fill @0-8 "hello"
|
|
39
39
|
browse get title
|
|
@@ -89,8 +89,8 @@ browse forward # Navigate forward
|
|
|
89
89
|
The accessibility snapshot is the recommended way for agents to discover elements. It prints a tree of refs like `@0-12` that the element commands accept directly.
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
browse snapshot # Accessibility
|
|
93
|
-
browse snapshot --
|
|
92
|
+
browse snapshot # Accessibility tree + cached refs (lean by default)
|
|
93
|
+
browse snapshot --full # Also include the ref maps (xpathMap, urlMap)
|
|
94
94
|
browse snapshot --filter submit # Filter lines by text or /regex/, keeping ancestors
|
|
95
95
|
browse snapshot --max-depth 4 # Trim output deeper than this depth
|
|
96
96
|
```
|
|
@@ -2,17 +2,20 @@ import { Flags } from "@oclif/core";
|
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
3
|
import { driverCommandFlags, runDriverCommandFromFlags, } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Snapshot extends BrowseCommand {
|
|
5
|
-
static description = "Print the active page accessibility snapshot and cache refs for element commands.";
|
|
5
|
+
static description = "Print the active page accessibility snapshot and cache refs for element commands. Pass --full to also include the ref maps (xpathMap, urlMap).";
|
|
6
6
|
static examples = [
|
|
7
7
|
"browse snapshot",
|
|
8
|
-
"browse snapshot --
|
|
8
|
+
"browse snapshot --full",
|
|
9
9
|
"browse snapshot --filter submit",
|
|
10
10
|
"browse snapshot --max-depth 4",
|
|
11
11
|
];
|
|
12
12
|
static flags = {
|
|
13
13
|
...driverCommandFlags,
|
|
14
|
+
full: Flags.boolean({
|
|
15
|
+
description: "Also include the ref maps (xpathMap, urlMap).",
|
|
16
|
+
}),
|
|
14
17
|
compact: Flags.boolean({
|
|
15
|
-
description: "
|
|
18
|
+
description: "Deprecated and has no effect; use --full to include the ref maps.",
|
|
16
19
|
}),
|
|
17
20
|
filter: Flags.string({
|
|
18
21
|
description: "Filter output lines by text or /regex/ while preserving matching ancestors.",
|
|
@@ -25,8 +28,11 @@ export default class Snapshot extends BrowseCommand {
|
|
|
25
28
|
};
|
|
26
29
|
async run() {
|
|
27
30
|
const { flags } = await this.parse(Snapshot);
|
|
31
|
+
if (flags.compact && process.stderr.isTTY) {
|
|
32
|
+
this.warn("`--compact` is deprecated and has no effect; use `--full` to include the ref maps.");
|
|
33
|
+
}
|
|
28
34
|
await runDriverCommandFromFlags("snapshot", {
|
|
29
|
-
|
|
35
|
+
full: flags.full,
|
|
30
36
|
filter: flags.filter,
|
|
31
37
|
maxDepth: flags["max-depth"],
|
|
32
38
|
}, flags);
|
|
@@ -2,9 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
import { formatSnapshotTree } from "./snapshot-format.js";
|
|
3
3
|
export const snapshotHandlers = {
|
|
4
4
|
async snapshot(manager, params) {
|
|
5
|
-
const {
|
|
5
|
+
const { full, filter, maxDepth } = z
|
|
6
6
|
.object({
|
|
7
|
-
|
|
7
|
+
full: z.boolean().optional(),
|
|
8
8
|
filter: z.string().optional(),
|
|
9
9
|
maxDepth: z.number().int().nonnegative().optional(),
|
|
10
10
|
})
|
|
@@ -16,17 +16,16 @@ export const snapshotHandlers = {
|
|
|
16
16
|
xpathMap: snapshot.xpathMap ?? {},
|
|
17
17
|
});
|
|
18
18
|
const tree = formatSnapshotTree(snapshot.formattedTree, {
|
|
19
|
-
compact,
|
|
20
19
|
filter,
|
|
21
20
|
maxDepth,
|
|
22
21
|
});
|
|
23
|
-
if (
|
|
24
|
-
return {
|
|
22
|
+
if (full) {
|
|
23
|
+
return {
|
|
24
|
+
tree,
|
|
25
|
+
urlMap: snapshot.urlMap,
|
|
26
|
+
xpathMap: snapshot.xpathMap,
|
|
27
|
+
};
|
|
25
28
|
}
|
|
26
|
-
return {
|
|
27
|
-
tree,
|
|
28
|
-
urlMap: snapshot.urlMap,
|
|
29
|
-
xpathMap: snapshot.xpathMap,
|
|
30
|
-
};
|
|
29
|
+
return { tree };
|
|
31
30
|
},
|
|
32
31
|
};
|
package/oclif.manifest.json
CHANGED
|
@@ -2093,10 +2093,10 @@
|
|
|
2093
2093
|
"snapshot": {
|
|
2094
2094
|
"aliases": [],
|
|
2095
2095
|
"args": {},
|
|
2096
|
-
"description": "Print the active page accessibility snapshot and cache refs for element commands.",
|
|
2096
|
+
"description": "Print the active page accessibility snapshot and cache refs for element commands. Pass --full to also include the ref maps (xpathMap, urlMap).",
|
|
2097
2097
|
"examples": [
|
|
2098
2098
|
"browse snapshot",
|
|
2099
|
-
"browse snapshot --
|
|
2099
|
+
"browse snapshot --full",
|
|
2100
2100
|
"browse snapshot --filter submit",
|
|
2101
2101
|
"browse snapshot --max-depth 4"
|
|
2102
2102
|
],
|
|
@@ -2190,8 +2190,14 @@
|
|
|
2190
2190
|
"allowNo": false,
|
|
2191
2191
|
"type": "boolean"
|
|
2192
2192
|
},
|
|
2193
|
+
"full": {
|
|
2194
|
+
"description": "Also include the ref maps (xpathMap, urlMap).",
|
|
2195
|
+
"name": "full",
|
|
2196
|
+
"allowNo": false,
|
|
2197
|
+
"type": "boolean"
|
|
2198
|
+
},
|
|
2193
2199
|
"compact": {
|
|
2194
|
-
"description": "
|
|
2200
|
+
"description": "Deprecated and has no effect; use --full to include the ref maps.",
|
|
2195
2201
|
"name": "compact",
|
|
2196
2202
|
"allowNo": false,
|
|
2197
2203
|
"type": "boolean"
|
|
@@ -6392,5 +6398,5 @@
|
|
|
6392
6398
|
]
|
|
6393
6399
|
}
|
|
6394
6400
|
},
|
|
6395
|
-
"version": "0.9.
|
|
6401
|
+
"version": "0.9.4"
|
|
6396
6402
|
}
|
package/package.json
CHANGED
package/skills/browse/SKILL.md
CHANGED
|
@@ -132,8 +132,8 @@ browse wait selector "#result"
|
|
|
132
132
|
Page state:
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
-
browse snapshot
|
|
136
|
-
browse snapshot --
|
|
135
|
+
browse snapshot # formatted tree only
|
|
136
|
+
browse snapshot --full # also include ref maps (xpathMap, urlMap)
|
|
137
137
|
browse get url
|
|
138
138
|
browse get title
|
|
139
139
|
browse get text body
|