vitexec
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesevitexec
vitexec
Use when the truth lives in the running browser: client state, imported app modules, DOM, canvas/WebGL, screenshots, recordings, or browser-only errors.
vitexecDo not use it for questions static files, unit tests, or TypeScript can answer directly.
当真实状态存在于运行中的浏览器时使用:客户端状态、导入的应用模块、DOM、canvas/WebGL、截图、录制内容或仅浏览器环境下的错误。
vitexec请勿将其用于静态文件、单元测试或TypeScript可直接解答的问题。
References
参考资料
- For mouse, keyboard, pointer lock, gamepad, or other input, read references/inputs.md.
- For CPU, network, performance timeline, or heap analysis, read references/performance.md.
- For WebXR, read references/webxr.md.
- 如需了解鼠标、键盘、指针锁定、游戏手柄或其他输入相关内容,请阅读references/inputs.md。
- 如需了解CPU、网络、性能时间线或堆分析相关内容,请阅读references/performance.md。
- 如需了解WebXR相关内容,请阅读references/webxr.md。
Workflow
工作流程
- Identify the page path if it is not .
/ - Write the smallest snippet that performs the user-like action or reads the browser-only state.
- Run , adding
vitexec '<snippet>',--path,--gpu,--screenshot,--record,--cpu-profile,--network-trace,--performance-trace,--heap-snapshot, or--timeoutonly when needed.--config - Treat stdout as browser logs. It starts with .
logs:
If itself is missing, install with the package manager already used by the project.
vitexecvitexecsh
vitexec 'console.log("ready")'For structured state, log JSON:
sh
vitexec --path /cart '
import { useCartStore } from "/src/store/cart.ts";
document.querySelector("[data-testid=add-to-cart]")?.click();
await new Promise((resolve) => requestAnimationFrame(resolve));
console.log("cart", JSON.stringify(useCartStore.getState()));
'- 若页面路径不是,请明确页面路径。
/ - 编写最小化的代码片段,以执行类用户操作或读取仅浏览器环境下的状态。
- 运行,仅在需要时添加
vitexec '<snippet>'、--path、--gpu、--screenshot、--record、--cpu-profile、--network-trace、--performance-trace、--heap-snapshot或--timeout参数。--config - 将标准输出视为browser logs,其以开头。
logs:
若缺少,请使用项目已有的包管理器安装。
vitexecvitexecsh
vitexec 'console.log("ready")'如需输出结构化状态,请记录JSON:
sh
vitexec --path /cart '
import { useCartStore } from "/src/store/cart.ts";
document.querySelector("[data-testid=add-to-cart]")?.click();
await new Promise((resolve) => requestAnimationFrame(resolve));
console.log("cart", JSON.stringify(useCartStore.getState()));
'Guidance
指导原则
- Prefer importing exported app state over scraping DOM when state is available.
- Use direct state reads for observation and assertions, not to bypass user interaction.
- Use live progress logs and focused assertions to early-exit on failures and see current progress.
- Keep logs concise; overly verbose logs become unreadable and unnecessarily fill the context.
- Prefer browser-root imports such as , not local filesystem paths.
/src/store.ts - Use for WebGL, canvas, Three.js, and WebXR behavior.
--gpu - If the local machine has no usable GPU, use to connect to a remote Playwright server that was started with the right host-specific GPU settings.
--gpu --browser-ws-endpoint <ws-url> - If repeated runs need the same endpoint or artifact settings, prefer environment variables over repeating long flags.
VITEXEC_* - Use screenshots or recordings only when visual evidence matters.
- Do not leave temporary code in the app when can inspect it from outside.
vitexec
- 当状态可获取时,优先导入应用导出的状态,而非抓取DOM。
- 使用直接读取状态的方式进行观察和断言,而非绕过用户交互。
- 使用实时进度日志和聚焦断言,以便在失败时提前退出并查看当前进度。
- 保持日志简洁;过于冗长的日志会变得难以阅读,且不必要地占用上下文空间。
- 优先使用浏览器根路径导入,如,而非本地文件系统路径。
/src/store.ts - 针对WebGL、canvas、Three.js和WebXR行为,使用参数。
--gpu - 若本地机器无可用GPU,请使用连接到已启动并配置了正确主机特定GPU设置的远程Playwright服务器。
--gpu --browser-ws-endpoint <ws-url> - 若重复运行需要相同的端点或工件设置,优先使用环境变量,而非重复使用冗长的参数。
VITEXEC_* - 仅当视觉证据重要时才使用截图或录制功能。
- 当可从外部检查应用时,请勿在应用中留下临时代码。
vitexec