跳到正文
Skillpedia
智能体58k · #3185

cli-anything-browser

它能做什么

这个技能让智能体用类似文件夹的命令在 Chrome 打开的网页中移动,例如列出项目、打开各个部分和点击。适合希望通过简单命令界面让 AI 使用网站的人。

适用场景

  • ✓当你想让智能体在 Chrome 打开的网页上查找并点击某个内容的时候。
  • ✓当你想读取网页某一部分的文字,而不想截图的时候。
  • ✓当你想在网页中搜索某个特定词语或短语的时候。

技能链接

https://github.com/HKUDS/CLI-Anything/blob/main/browser/agent-harness/cli_anything/browser/skills/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/CLI-Anything/blob/main/browser/agent-harness/cli_anything/browser/skills/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在 Chrome 中打开定价页面,并找出它在哪里列出了企业版套餐。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能连接到 Chrome 中的 DOMShell 扩展,它会把网页结构转换为类似文件夹的视图。然后你的智能体使用 ls、cd、cat、grep 等命令进行浏览,需要时还可以点击或输入。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

cli-anything-browser

A command-line interface for browser automation using DOMShell's MCP server. Navigate web pages using filesystem commands: ls, cd, cat, grep, click.

Installation

Prerequisites

  1. Node.js and npx (for DOMShell MCP server):

    # Install Node.js from https://nodejs.org/
    npx --version
    
  2. Chrome/Chromium with DOMShell extension:

    • Install extension in Chrome
    • Ensure Chrome is running before using CLI
  3. Python 3.10+

Install CLI

cd browser/agent-harness
pip install -e .

Command Groups

page — Page Navigation

  • page open <url> — Navigate to URL
  • page reload — Reload current page
  • page back — Navigate back in history
  • page forward — Navigate forward in history
  • page info — Show current page info

fs — Filesystem Commands (Accessibility Tree)

  • fs ls [path] — List elements at path
  • fs cd <path> — Change directory
  • fs cat [path] — Read element content
  • fs grep <pattern> [path] — Search for text pattern
  • fs pwd — Print working directory

act — Action Commands

  • act click <path> — Click an element
  • act type <path> <text> — Type text into input

session — Session Management

  • session status — Show session state
  • session daemon-start — Start persistent daemon mode
  • session daemon-stop — Stop daemon mode

Usage Examples

Basic Navigation

# Open a page
cli-anything-browser page open https://example.com

# Explore structure
cli-anything-browser fs ls /
cli-anything-browser fs cd /main
cli-anything-browser fs ls

# Go back to root
cli-anything-browser fs cd /

Search and Click

cli-anything-browser fs grep "Login"
cli-anything-browser act click /main/button[0]

Form Fill

cli-anything-browser act type /main/input[0] "user@example.com"
cli-anything-browser act click /main/button[0]

JSON Output

cli-anything-browser --json fs ls /

Daemon Mode (Faster Interactive Use)

# Start persistent connection
cli-anything-browser session daemon-start

# Run commands (uses persistent connection)
cli-anything-browser fs ls /
cli-anything-browser fs cd /main

# Stop daemon when done
cli-anything-browser session daemon-stop

Interactive REPL

cli-anything-browser

Path Syntax

DOMShell uses a filesystem-like path for the Accessibility Tree:

/                           — Root (document)
/main                       — Main landmark
/main/div[0]                — First div in main
/main/div[0]/button[2]      — Third button in first div
  • Array indices are 0-based: button[0] is the first button
  • Use .. to go up one level
  • Use / for root

Agent-Specific Guidance

JSON Output for Parsing

All commands support --json flag for machine-readable output:

cli-anything-browser --json fs ls /

Returns:

{
  "path": "/",
  "entries": [
    {"name": "main", "role": "landmark", "path": "/main"}
  ]
}

Error Handling

The CLI provides clear error messages for common issues:

  • npx not found: Install Node.js from https://nodejs.org/
  • DOMShell not found: Run npx @apireno/domshell --version
  • MCP call failed: Install DOMShell Chrome extension

Check is_available() return value before running commands.

Daemon Mode for Efficiency

For agent workflows with multiple commands, use daemon mode:

  1. Start daemon: cli-anything-browser session daemon-start
  2. Run commands: Each command reuses the MCP connection
  3. Stop daemon: cli-anything-browser session daemon-stop

This avoids the 1-3 second cold start overhead for each command.

Links

Security Considerations

IMPORTANT: When using this CLI with AI agents, be aware of the following security considerations:

URL Restrictions

The browser harness validates all URLs before navigation:

  • Explicit scheme required: URLs must include http:// or https:// scheme (scheme-less URLs like example.com are rejected)
  • Blocked schemes: file://, javascript://, data://, vbscript://, about://, chrome://, and browser-internal schemes
  • **Al
常见问题

我需要安装什么?

你需要 Node.js、装有 DOMShell 扩展的 Chrome,以及 Python 3.10 或更新版本。

使用时 Chrome 必须打开吗?

是的。使用该技能前,Chrome 必须正在运行。

它能填写表单吗?

可以。它既可以点击元素,也可以在输入框中输入文字。

详情

作者的原始描述

Browser automation CLI using DOMShell MCP server. Maps Chrome's Accessibility Tree to a virtual filesystem for agent-native navigation.

repo: HKUDS/CLI-Anything

热度

GitHub 星标
58k
排名
#3185
许可证
Apache-2.0
更新时间
2026/9/21

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能