ax-grep 0.0.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +106 -1
- package/dist/browser.d.ts +11 -0
- package/dist/browser.js +12 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-HPZ32BKV.js +612 -0
- package/dist/chunk-HPZ32BKV.js.map +1 -0
- package/dist/chunk-ZXTURCRT.js +925 -0
- package/dist/chunk-ZXTURCRT.js.map +1 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +22364 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +436 -0
- package/dist/index.js.map +1 -0
- package/dist/static.d.ts +6 -0
- package/dist/static.js +8 -0
- package/dist/static.js.map +1 -0
- package/dist/types-gwHWhYmw.d.ts +3660 -0
- package/docs/README.md +19 -0
- package/docs/agent-handoff.md +95 -0
- package/docs/agent-readiness.md +38 -0
- package/docs/assets/ax-grep-benchmark.png +0 -0
- package/docs/assets/ax-grep-og.png +0 -0
- package/docs/assets/ax-grep-search.png +0 -0
- package/docs/benchmarks.md +123 -0
- package/docs/cli-agent.md +194 -0
- package/docs/comparison-baseline.md +625 -0
- package/docs/features.md +28 -0
- package/docs/library-api.md +211 -0
- package/docs/progress.md +1306 -0
- package/package.json +92 -6
- package/skills/ax-grep-cli/SKILL.md +89 -0
- package/skills.sh +24 -0
- package/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,14 +1,100 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ax-grep",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A browser-native semantic accessibility tree extractor that runs without DevTools or CDP.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/hmmhmmhm/ax-lite.git"
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18"
|
|
10
8
|
},
|
|
9
|
+
"packageManager": "pnpm@10.33.4",
|
|
11
10
|
"publishConfig": {
|
|
12
11
|
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/hmmhmmhm/ax-grep.git"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/hmmhmmhm/ax-grep#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/hmmhmmhm/ax-grep/issues"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./browser": {
|
|
27
|
+
"types": "./dist/browser.d.ts",
|
|
28
|
+
"import": "./dist/browser.js"
|
|
29
|
+
},
|
|
30
|
+
"./static": {
|
|
31
|
+
"types": "./dist/static.d.ts",
|
|
32
|
+
"import": "./dist/static.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"bin": {
|
|
36
|
+
"ax-grep": "./dist/cli.js"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"docs",
|
|
41
|
+
"skills",
|
|
42
|
+
"skills.sh"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup && tsc --noEmit",
|
|
46
|
+
"check": "tsc --noEmit",
|
|
47
|
+
"check:processes": "tsx scripts/check-project-processes.ts",
|
|
48
|
+
"readiness:audit": "tsx scripts/check-agent-readiness.ts",
|
|
49
|
+
"readiness:real-page-smoke": "tsx scripts/check-real-page-smoke.ts",
|
|
50
|
+
"readiness:search-smoke": "tsx scripts/check-search-smoke.ts",
|
|
51
|
+
"readiness:agent-browser-smoke": "tsx scripts/check-agent-browser-smoke.ts",
|
|
52
|
+
"readiness:agent-browser-text-heavy-smoke": "tsx scripts/check-agent-browser-text-heavy-smoke.ts",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:coverage": "vitest run --coverage",
|
|
55
|
+
"test:watch": "vitest",
|
|
56
|
+
"compare": "tsx scripts/compare.ts",
|
|
57
|
+
"compare:static": "tsx scripts/compare-static.ts",
|
|
58
|
+
"compare:tokens": "tsx scripts/compare-token-cost.ts",
|
|
59
|
+
"benchmark:agent-cost": "tsx scripts/benchmark-agent-cost.ts",
|
|
60
|
+
"compare:browser:fixture": "tsx scripts/compare-browser-fixture.ts",
|
|
61
|
+
"compare:gate": "tsx scripts/check-comparison-gates.ts",
|
|
62
|
+
"compare:sample": "tsx scripts/compare.ts https://example.com https://www.wikipedia.org https://developer.mozilla.org/en-US/docs/Web/Accessibility https://news.ycombinator.com https://github.com/features https://libraries.io/npm/typescript https://www.npmjs.com/package/typescript",
|
|
63
|
+
"compare:korea": "tsx scripts/compare.ts https://ko.wikipedia.org/wiki/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD https://www.hani.co.kr/ https://www.korea.kr/ https://www.yonhapnewstv.co.kr/",
|
|
64
|
+
"compare:static:fixtures": "tsx scripts/compare-static.ts --target-set agent-fixtures",
|
|
65
|
+
"compare:static:fixtures:gate": "tsx scripts/check-fixture-static-gate.ts",
|
|
66
|
+
"compare:static:agent": "tsx scripts/compare-static.ts --target-set agent-executor",
|
|
67
|
+
"compare:static:korea-social": "tsx scripts/compare-static.ts --target-set korea-social",
|
|
68
|
+
"compare:tokens:korea-social": "tsx scripts/compare-token-cost.ts --target-set korea-social",
|
|
69
|
+
"compare:static:china-japan": "tsx scripts/compare-static.ts --target-set china-japan",
|
|
70
|
+
"compare:tokens:china-japan": "tsx scripts/compare-token-cost.ts --target-set china-japan",
|
|
71
|
+
"compare:static:diverse": "tsx scripts/compare-static.ts https://www.bbc.com/news https://www.npr.org/2025/03/11/nx-s1-5324543/ntsb-dca-mid-air-collision-american-black-hawk https://www.theguardian.com/international https://www.gov.uk/foreign-travel-advice https://www.nottinghamshire.gov.uk/global-content/how-to-create-accessible-content/how-to-make-web-pages-accessible/checklist-web-page https://books.toscrape.com/ https://old.reddit.com/r/programming/ https://www.reddit.com/r/programming/ https://x.com/NASA https://www.instagram.com/nasa/",
|
|
72
|
+
"compare:tokens:diverse": "tsx scripts/compare-token-cost.ts https://www.bbc.com/news https://www.npr.org/2025/03/11/nx-s1-5324543/ntsb-dca-mid-air-collision-american-black-hawk https://www.gov.uk/foreign-travel-advice https://books.toscrape.com/ https://old.reddit.com/r/programming/ https://x.com/NASA https://www.instagram.com/nasa/"
|
|
73
|
+
},
|
|
74
|
+
"keywords": [
|
|
75
|
+
"accessibility",
|
|
76
|
+
"a11y",
|
|
77
|
+
"semantic-tree",
|
|
78
|
+
"webview",
|
|
79
|
+
"agent"
|
|
80
|
+
],
|
|
81
|
+
"license": "MIT",
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@types/node": "^25.0.0",
|
|
84
|
+
"@vitest/coverage-v8": "4.1.8",
|
|
85
|
+
"agent-browser": "^0.27.0",
|
|
86
|
+
"puppeteer": "^24.31.0",
|
|
87
|
+
"tsup": "^8.5.1",
|
|
88
|
+
"tsx": "^4.21.0",
|
|
89
|
+
"typescript": "^5.9.3",
|
|
90
|
+
"vitest": "^4.1.0"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"domhandler": "^6.0.1",
|
|
94
|
+
"htmlparser2": "^12.0.0",
|
|
95
|
+
"js-tiktoken": "^1.0.21"
|
|
96
|
+
},
|
|
97
|
+
"optionalDependencies": {
|
|
98
|
+
"impit": "^0.14.1"
|
|
13
99
|
}
|
|
14
100
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ax-grep-cli
|
|
3
|
+
description: Use ax-grep as a CLI-first page search and page-check tool before opening a browser. Best for agents that need compact semantic trees, source links, hidden app signals, forms, tables, citations, and browser handoff guidance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ax-grep CLI
|
|
7
|
+
|
|
8
|
+
Use `ax-grep` before browser automation when a subagent needs to inspect a
|
|
9
|
+
search result, URL, HTML file, or captured page.
|
|
10
|
+
|
|
11
|
+
## First Command
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
ax-grep "https://example.com" --agent
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If `ax-grep` is not on `PATH`, use the npm executable:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx --yes ax-grep@latest "https://example.com" --agent
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For smaller context:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
ax-grep "https://example.com" --agent-brief
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Search
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
ax-grep --search "official docs pricing" --agent
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use the returned `agent.*CommandArgs` fields when continuing. They are JSON argv
|
|
36
|
+
arrays in execution order. Use `agent.*Command` when you need a shell string.
|
|
37
|
+
|
|
38
|
+
## Agent Policy
|
|
39
|
+
|
|
40
|
+
- Prefer `--agent` or `--agent-brief` over raw text output for subagents.
|
|
41
|
+
- Read `agent.executor`, `agent.handoff`, `agent.next`, `agent.readTargets`,
|
|
42
|
+
and any returned `agent.sourceChoices` or `agent.resultChoices` before
|
|
43
|
+
deciding.
|
|
44
|
+
- If `agent.executor.decision` is `return`, answer from the referenced
|
|
45
|
+
`readFrom` payload instead of opening a browser.
|
|
46
|
+
- If a URL follow-up is needed, run the provided `commandArgs` one command at a
|
|
47
|
+
time.
|
|
48
|
+
- Escalate to browser automation only when `needsBrowserHtml`,
|
|
49
|
+
`needsBrowserInteraction`, or the executor/handoff fields say it is needed.
|
|
50
|
+
- Do not run multiple browser-backed checks in parallel.
|
|
51
|
+
|
|
52
|
+
## Useful Patterns
|
|
53
|
+
|
|
54
|
+
Inspect a result and open the best match in one step:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
ax-grep --search "site:example.com api reference" --open-result best --agent
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If an engine rejects `best`, open the top ranked result directly:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
ax-grep --search "site:example.com api reference" --open-result 1 --agent
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Check a page for specific terms:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
ax-grep "https://example.com/docs" --find "rate limit" --find "authentication" --agent
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Read static HTML from another tool:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
curl -fsSL "https://example.com" | ax-grep --stdin --agent
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## What ax-grep Sees
|
|
79
|
+
|
|
80
|
+
`ax-grep --agent` can expose:
|
|
81
|
+
|
|
82
|
+
- semantic headings, landmarks, links, buttons, forms, tables, and lists
|
|
83
|
+
- source-like links and ranked search choices
|
|
84
|
+
- JSON-LD schema facts, metadata, policies, topics, provenance, and citations
|
|
85
|
+
- hydration URLs, API endpoints, runtime hints, app config, and mobile hints
|
|
86
|
+
- recommended next commands and browser handoff reasons
|
|
87
|
+
|
|
88
|
+
Treat the full JSON payload as source of truth; top-level shortcuts are for
|
|
89
|
+
fast routing.
|
package/skills.sh
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
skill_name="ax-grep-cli"
|
|
5
|
+
target_root="${CODEX_HOME:-"$HOME/.codex"}/skills"
|
|
6
|
+
target_dir="$target_root/$skill_name"
|
|
7
|
+
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" 2>/dev/null && pwd)
|
|
8
|
+
local_skill="$script_dir/skills/$skill_name/SKILL.md"
|
|
9
|
+
remote_skill="${AX_GREP_SKILL_URL:-https://raw.githubusercontent.com/hmmhmmhm/ax-grep/main/skills/ax-grep-cli/SKILL.md}"
|
|
10
|
+
|
|
11
|
+
mkdir -p "$target_dir"
|
|
12
|
+
|
|
13
|
+
if [ -f "$local_skill" ]; then
|
|
14
|
+
cp "$local_skill" "$target_dir/SKILL.md"
|
|
15
|
+
elif command -v curl >/dev/null 2>&1; then
|
|
16
|
+
curl -fsSL "$remote_skill" -o "$target_dir/SKILL.md"
|
|
17
|
+
elif command -v wget >/dev/null 2>&1; then
|
|
18
|
+
wget -qO "$target_dir/SKILL.md" "$remote_skill"
|
|
19
|
+
else
|
|
20
|
+
echo "Could not find local skill file, curl, or wget." >&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
echo "Installed $skill_name skill to $target_dir"
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|