xiaozhi-client: Command for Claude Code

.agents/commands/e2e.md

e2e is a command for Claude Code from shenjingnan/xiaozhi-client. It costs 31 tokens per session (2,726 once invoked), scanned A, original, MIT.

A Playwright end-to-end testing command for checking a web interface through a real browser. It can record video and traces, capture console and network logs, and save screenshots for test steps.

In plain words
What is it for?
Use it with a test directory containing test.md files to perform the documented steps, compare an expected screenshot when available, and store screenshots, video, and trace artifacts.
Why use it?
It collects evidence when a browser test passes or fails, making visual differences and runtime problems easier to investigate. It can run one test case or scan a directory for several cases.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: installed under .agents/ (shared by several agents).

This is shenjingnan/xiaozhi-client's own configuration. It tells Claude Code how to work on xiaozhi-client itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything xiaozhi-client configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/nemo/Projects/shenjingnan/xiaozhi-client/tests/e2e/测试MCPTool调试按钮是否正常.

Reuse

Borrowing it

Nothing to install: this file belongs to shenjingnan/xiaozhi-client. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/shenjingnan/xiaozhi-client/main/.agents/commands/e2e.md
Clone the repo
git clone --depth 1 https://github.com/shenjingnan/xiaozhi-client

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for e2e

README.md
[![agentmods](https://agentmods.dev/badge/commands/shenjingnan/xiaozhi-client/e2e.svg)](https://agentmods.dev/commands/shenjingnan/xiaozhi-client/e2e)
Your own site
<a href="https://agentmods.dev/commands/shenjingnan/xiaozhi-client/e2e"><img src="https://agentmods.dev/badge/commands/shenjingnan/xiaozhi-client/e2e.svg" alt="Measured on agentmods" height="20"></a>
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,726 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.02726
Opus 5 $0.00015 $0.01363
Sonnet 5 $0.00006 $0.00545
Haiku 4.5 $0.00003 $0.00273

Measured 6d ago against content hash 694ed89f69c0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

e2e scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/commands/e2e.md · 201 lines

How it starts

The opening of the file, as written. The whole thing — 201 lines — stays where its author put it; the contents beside it link to each section on GitHub.

上下文

  • 了解如何使用 playwright-cli: !playwright-cli --help
  • 当前 git 分支: !git branch --show-current
  • 构建产物状态: !ls -la dist/cli/index.js 2>/dev/null || echo "未构建"
  • Web 服务端口占用情况: !lsof -i :9999 2>/dev/null | head -5 || echo "端口 9999 未被占用"
  • 可用测试用例: !ls -d tests/e2e/*/ 2>/dev/null | sed 's|tests/e2e/||;s|/||' || echo "无测试用例"

输入参数

用户参数: $ARGUMENTS

模式判断

根据 $ARGUMENTS 判断执行模式:

模式一:路径模式($ARGUMENTS 是一个目录路径)

$ARGUMENTS 指向一个存在的目录路径时(支持相对路径和绝对路径),进入路径模式:

  1. 识别目标

    • 检查该目录下是否存在 test.md 文件
    • 如果存在 → 这是单个测试用例,只执行这一个
    • 如果不存在 → 扫描子目录,找出所有包含 test.md 的子目录作为待执行用例列表
  2. 执行每个测试用例

    对每个测试用例,按以下流程执行:

    a. 准备产物目录

    • 创建 artifacts/ 子目录:mkdir -p <测试用例绝对路径>/artifacts/trace
    • 创建 steps/ 子目录:mkdir -p <测试用例绝对路径>/steps
    • 清空 steps/ 目录中已有的旧截图:rm -f <测试用例绝对路径>/steps/*.png
    • 初始化截图计数器为 1

    b. 读取 test.md,理解测试步骤

    c. 检查该用例目录下是否有 expected.png

    d. 确保浏览器已打开且在正确页面(如未打开则 playwright-cli open

    e. 启动录制

    • 开始视频录制:playwright-cli video-start <测试用例绝对路径>/artifacts/recording.webm
    • 开始 Trace 录制:playwright-cli tracing-start

    f. 按照 test.md 中的步骤逐步执行操作:

    • 遇到"截图"指令时:
      • 先添加视频章节标记:playwright-cli video-chapter "步骤<N>: <描述>" --description="<步骤原文>" --duration=1500
        • 描述从截图指令的括号中提取,如 截图(对话框打开状态) → 描述为 "对话框打开状态";无括号则使用 "步骤N"
      • 截图保存到 steps/:playwright-cli screenshot --filename=<测试用例绝对路径>/steps/<两位数编号>.png
      • 如果存在 expected.png,使用视觉能力对比 expected.png 和实际截图,描述差异
      • 一致 → PASS,有明显差异 → FAIL 并说明差异
      • 截图计数器递增
    • 其他操作(导航、点击、填写等)直接执行,trace 自动记录所有操作

    g. 捕获日志(所有步骤执行完毕后):

    • 捕获完整控制台日志:playwright-cli --raw console > <测试用例绝对路径>/artifacts/console.log 2>&1
    • 捕获控制台警告:playwright-cli --raw console warning > <测试用例绝对路径>/artifacts/console-warnings.log 2>&1
    • 捕获网络活动:playwright-cli --raw network > <测试用例绝对路径>/artifacts/network.log 2>&1

    h. 停止录制

    • 停止 Trace:playwright-cli tracing-stop
      • 将 trace 文件从 .playwright-cli/traces/ 移动到用例的 artifacts/trace/ 目录:
        LATEST_TRACE=$(ls -t .playwright-cli/traces/*.trace 2>/dev/null | head -1)
        if [ -n "$LATEST_TRACE" ]; then
          TRACE_BASE=$(basename "$LATEST_TRACE" .trace)
          mv "$LATEST_TRACE" <测试用例绝对路径>/artifacts/trace/test.trace
          mv ".playwright-cli/traces/${TRACE_BASE}.network" <测试用例绝对路径>/artifacts/trace/test.network 2>/dev/null
          [ -d ".playwright-cli/traces/resources" ] && mv .playwright-cli/traces/resources <测试用例绝对路径>/artifacts/trace/resources 2>/dev/null
        fi
        
    • 停止视频录制:playwright-cli video-stop

Read the full file on GitHub · 201 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 201 lines · 31 tokens per session scan A 694ed89f69c0

Subscribe to this mod's changes

e2e is a command published in the GitHub repository shenjingnan/xiaozhi-client (338 stars, last pushed 3d ago), licensed MIT. It adds 31 tokens to every session and 2,726 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.