Skip to content

Commit f7e4c88

Browse files
2234839claude
andcommitted
docs: add SETUP.md for agent self-configuration and fix README prompts
- Add SETUP.md: step-by-step guide for AI agents to auto-configure pilot - Fix README prompts: send to chat (not paste to CLAUDE.md) - Fix English README: use English prompt instead of Chinese - Remove skill-specific references, keep CLI-only usage guide Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9223c70 commit f7e4c88

4 files changed

Lines changed: 67 additions & 7 deletions

File tree

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ npm install -D vite-plugin-pilot
5353

5454
### Option 1: Vite Plugin Mode
5555

56-
Send the following to your AI agent (paste into Claude Code `CLAUDE.md` or Cursor `.cursorrules`):
56+
Copy the following and **send it to your AI agent in the chat**:
5757

5858
```
59-
Read https://raw.githubusercontent.com/2234839/vite-plugin-pilot/master/SKILL.md,
60-
follow its instructions to install vite-plugin-pilot and configure yourself, then start testing browser pages.
59+
Read https://raw.githubusercontent.com/2234839/vite-plugin-pilot/master/SETUP.md and follow its steps to configure vite-plugin-pilot for my project, including installing the plugin, configuring vite.config.ts, and writing the usage guide into the project instruction file.
6160
```
6261

62+
The agent will automatically install the plugin, configure options, and write the usage guide into your project's instruction file.
63+
6364
### Option 2: Standalone Server Mode (No Vite Required)
6465

6566
```bash

README_zh.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ npm install -D vite-plugin-pilot
4848

4949
### 方式一:Vite 插件模式
5050

51-
把以下内容发送给你的 AI Agent(粘贴到 Claude Code 的 `CLAUDE.md` 或 Cursor 的 `.cursorrules`
51+
复制以下内容,**粘贴到 AI Agent 的对话框中发送**
5252

5353
```
54-
请阅读 https://raw.githubusercontent.com/2234839/vite-plugin-pilot/master/SKILL.md ,
55-
按照其中的指示安装 vite-plugin-pilot 并配置自己,然后开始测试浏览器页面。
54+
请阅读 https://raw.githubusercontent.com/2234839/vite-plugin-pilot/master/SETUP.md ,按照其中的步骤为我配置 vite-plugin-pilot,包括安装插件、配置 vite.config.ts、将使用指南写入项目指令文件。
5655
```
5756

57+
Agent 会自动完成安装、配置,并将使用指南写入项目的 AI 指令文件。
58+
5859
### 方式二:独立 Server 模式(不依赖 Vite)
5960

6061
```bash

SETUP.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# vite-plugin-pilot — 自动配置指南
2+
3+
你是 AI Agent(Claude Code、Cursor、Windsurf、Cline 等),请按照以下步骤为用户项目配置 vite-plugin-pilot。
4+
5+
## 步骤 1:安装插件
6+
7+
检查项目是否已安装 vite-plugin-pilot:
8+
- 检查 `package.json``devDependencies` 是否包含 `vite-plugin-pilot`
9+
- 如果没有,执行 `pnpm add -D vite-plugin-pilot`(或 `npm install -D vite-plugin-pilot`
10+
11+
检查 Vite 配置是否已包含插件:
12+
- 检查 `vite.config.ts`(或 `vite.config.js`)的 `plugins` 数组是否包含 `pilot()`
13+
- 如果没有,在文件顶部添加 `import pilot from 'vite-plugin-pilot'`,并在 plugins 数组中添加 `pilot()`
14+
- 如果已有 `pilot({...})` 配置,不要覆盖已有字段
15+
16+
## 步骤 2:配置插件选项
17+
18+
**语言环境**:分析项目语言环境(UI 文本、README 语言、i18n 配置等),在 vite.config.ts 中追加 `locale` 字段:
19+
- 中文项目:`pilot({ locale: 'zh' })`
20+
- 英文项目:`pilot({ locale: 'en' })`
21+
- 默认 `zh`,已有配置时只追加字段不覆盖
22+
23+
**更新检查**:默认开启 CLI 自动检查 npm 新版本。如用户选择关闭,追加 `checkUpdate: false`
24+
25+
## 步骤 3:确保 .gitignore 包含 .pilot
26+
27+
检查项目根目录的 `.gitignore` 是否包含 `.pilot`(运行时数据目录,不应提交),如果没有则添加。
28+
29+
## 步骤 4:将使用指南写入项目指令文件
30+
31+
**这是最关键的一步**:在你自己的项目指令文件中追加 pilot 使用指南,让未来的会话自动获得浏览器测试能力。
32+
33+
例如 Claude Code 写入 `CLAUDE.md`,Cursor 写入 `.cursorrules`,其他 agent 写入对应的指令文件。
34+
35+
读取文件现有内容,在末尾追加以下内容(不要覆盖已有内容):
36+
37+
````markdown
38+
## 浏览器测试(vite-plugin-pilot)
39+
40+
使用 vite-plugin-pilot 操控浏览器页面进行测试。已安装并配置。
41+
42+
- `npx pilot run '代码'` — 执行 JS 并获取结果+日志+页面快照
43+
- `npx pilot page` — 查看页面状态
44+
- `npx pilot status` — 查看已连接的实例
45+
46+
详见 https://raw.githubusercontent.com/2234839/vite-plugin-pilot/master/SKILL.md
47+
````
48+
49+
**重要**:不要删除或覆盖文件中的已有内容,只追加。
50+
51+
## 步骤 5:启动 dev server 并验证
52+
53+
1. 启动 dev server(`pnpm dev``npm run dev`
54+
2. 在浏览器中打开页面
55+
3. 执行 `npx pilot status` 确认浏览器已连接
56+
4. 执行 `npx pilot page` 确认能看到页面快照
57+
58+
全部完成后告诉用户:配置完成,现在可以通过 `/pilot``npx pilot` 命令测试浏览器页面了。

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vite-plugin-pilot",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "AI Agent 驾驶浏览器的导航工具 — 打通 浏览器运行时 → Dev Server → 源码 → IDE 的完整链路",
55
"type": "module",
66
"bin": {

0 commit comments

Comments
 (0)