ax
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseax — the AI-era curl: fetch, discover, extract
ax — AI时代的curl:获取、探索、提取
One command: . Never write regex over
HTML, and never use bare curl (it returns nothing on empty bodies).
ax <url|file|-> [selector] [flags]一个命令:。再也不用在HTML上写正则表达式,也不用使用裸curl(它遇到空内容时会返回空值)。
ax <url|file|-> [selector] [flags]Cheatsheet
速查表
sh
ax https://api.site.example/users # {status, ok, ms, headers, body} — never silent
ax https://api.site.example/users -H 'authorization: Bearer x' -X POST -d '{"a":1}'sh
ax https://api.site.example/users # {status, ok, ms, headers, body} — 绝不会静默
ax https://api.site.example/users -H 'authorization: Bearer x' -X POST -d '{"a":1}'curl reflexes work: -u -I -o -k -m --data-raw (and -L/-i/-s/-f are no-ops)
curl的常用参数均适用:-u -I -o -k -m --data-raw(而-L/-i/-s/-f为无效操作)
ax https://site.example --outline # discover: repeating structures
ax https://site.example --locate 'some text' # discover: which selector holds this
ax https://site.example '.card' --count # confirm a hypothesis
ax https://site.example '.card' --row 'title=a, href=a@href, id=@data-id'
ax https://site.example 'table' --table --where 'Stars >= 30000'
ax https://site.example 'table' --table --where ' ~ /x/'
ax https://docs.site.example/guide --md --budget 800 # read docs as markdown
Col With Spaces
The workflow: fetch/--outline once → --locate/--count to confirm → ONE
--row/--table call. Repeat fetches of the same URL are cached ~2min, so
probing is free (--fresh to bypass).ax https://site.example --outline # 探索:重复结构
ax https://site.example --locate 'some text' # 探索:定位包含该文本的选择器
ax https://site.example '.card' --count # 验证假设
ax https://site.example '.card' --row 'title=a, href=a@href, id=@data-id'
ax https://site.example 'table' --table --where 'Stars >= 30000'
ax https://site.example 'table' --table --where ' ~ /x/'
ax https://docs.site.example/guide --md --budget 800 # 将文档以Markdown格式读取
Col With Spaces
工作流程:先执行一次获取/--outline → 用--locate/--count确认 → 执行一次--row/--table调用。同一URL的重复请求会被缓存约2分钟,因此探测无需额外成本(使用--fresh可绕过缓存)。Speed discipline
速度准则
Aim for ≤3 tool calls: one batched look (),
one extraction call, then answer. Turns cost more than commands — semicolons
are free. Every --row/--table run prints + empty-field counts on stderr — that IS the verification; do not re-probe.
Answer with the data, concisely — no methodology narration.
ax URL --outline; ax URL '.guess' --countN rows extracted目标是使用≤3次工具调用:一次批量查看(),一次提取调用,然后给出结果。转换操作的成本高于命令执行 —— 分号是免费的。每次--row/--table运行都会在标准错误输出中打印以及空字段计数 —— 这就是验证;无需重新探测。
简洁地返回数据即可 —— 无需说明方法流程。
ax URL --outline; ax URL '.guess' --countN rows extractedOutput rules
输出规则
- Default cap 50 results; stderr announces anything hidden. ,
--limit,--allcontrol it. Rows default to token-cheap TSV; add--budget <tokens>if you need JSON.--json - Errors are one stderr line with a hint — fix the flag, not the approach.
- For plain text files and non-web work, use your usual tools — ax is for the web.
- 默认最多返回50条结果;标准错误输出会提示隐藏的内容。、
--limit、--all可控制结果数量。行默认采用低令牌消耗的TSV格式;如果需要JSON格式,添加--budget <tokens>参数即可。--json - 错误信息为标准错误输出中的一行提示 —— 修正参数即可,无需调整方法。
- 对于纯文本文件和非网页相关工作,请使用你常用的工具 —— ax专为网页场景设计。