Skip to content
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
把这段 prompt 直接贴给 Codex:

```text
打开这个仓库后,严格按照 README.md、AGENTS.md、docs/codex-bootstrap-playbook.md、docs/feishu-console-automation.md 执行。优先走 Docker,不要把普通的控制台配置步骤推回给我。先运行 pnpm install、pnpm bootstrap:env、pnpm chrome:debug;如果我没登录飞书开放平台或 OpenAI/Codex,再停下来让我登录。登录完成后,Chrome CDP 自动配置飞书开发者平台,拿到 FEISHU_APP_ID 和 FEISHU_APP_SECRET 后写回 .env.real,然后用 Docker 启动并验证服务,最后告诉我怎么在飞书里测试。
打开这个仓库后,严格按照 README.md、AGENTS.md、docs/codex-bootstrap-playbook.md、docs/feishu-console-automation.md 执行。优先走 Docker,不要把普通的控制台配置步骤推回给我。先运行 pnpm install、pnpm bootstrap:env、pnpm chrome:debug。然后先明确问我一个问题:是否要创建新的机器人。如果我回答“要”,就异步执行 `npx -y lark-op-cli@latest create-bot --name "Codex 机器人"` 并持续读取输出;如果过程中出现扫码登录,请把 ASCII 二维码原样转发给我。如果我回答“不要”,再确认我是否已经登录飞书开放平台或 OpenAI/Codex;如果我没登录,再停下来让我登录。登录完成后,就继续走原来的浏览器和 agent-browser / Chrome CDP 方案,只选择已有机器人并完成后续配置,不要再创建新的机器人。拿到 FEISHU_APP_ID 和 FEISHU_APP_SECRET 后写回 .env.real,然后用 Docker 启动并验证服务,最后告诉我怎么在飞书里测试。
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep auth checkpoint in the create-bot branch

This prompt now gates the Feishu/OpenAI login check behind the 如果我回答“不要” branch, so users who answer “要” can be sent down create-bot without first handling missing auth state (for example, no local ~/.codex login). In that case the run can stall or fail later instead of stopping at the intended human checkpoint, which regresses the bootstrap reliability for fresh environments; keep the login check unconditional or duplicate it in the create-bot branch.

Useful? React with 👍 / 👎.

```

同样的 prompt 也单独放在 [docs/codex-bootstrap-prompt.md](docs/codex-bootstrap-prompt.md)。
Expand Down
25 changes: 15 additions & 10 deletions docs/codex-bootstrap-playbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@ agent-browser install

## Browser Automation Path

1. Connect to the Chrome CDP endpoint started by `pnpm chrome:debug`.
2. Open the Feishu Open Platform app list.
3. If the user is not logged in, stop and ask them to finish login in that browser window.
4. After login, continue without asking the user to click through normal console steps.
5. Follow the target state in `docs/feishu-console-automation.md`.
6. Persist the resulting `FEISHU_APP_ID` and `FEISHU_APP_SECRET` into `.env.real`.
7. If the user's machine already has `~/.codex/auth.json`, set `CODEX_HOME_SOURCE` in `.env.real` to that absolute host path. Only use `OPENAI_API_KEY` when local Codex auth is missing.
8. Keep `CODEX_ARTIFACTS_DIR` pointed at the default artifact directory unless the user explicitly wants another export location.
9. Keep `CODEX_WORKSPACE_HOST_PATH` pointed at the dedicated runtime workspace. Do not mount the repository checkout itself to `/workspace`.
1. Ask the user one explicit question first: whether they want to create a new bot.
2. If the answer is yes, run `npx -y lark-op-cli@latest create-bot --name "Codex 机器人"`.
3. In the create-bot branch, read the command output continuously instead of waiting for process exit.
4. In the create-bot branch, if the command shows an ASCII QR code or other login prompt, surface it to the user immediately so they can scan or confirm.
5. If the answer is no, connect to the Chrome CDP endpoint started by `pnpm chrome:debug`.
6. Open the Feishu Open Platform app list.
7. If the user is not logged in, stop and ask them to finish login in that browser window.
8. In the browser branch, continue with the original browser/CDP path and select an existing target bot in Feishu Open Platform. Do not create a new bot in this branch.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve app creation in browser fallback path

This step now forbids creating a bot in the browser fallback (Do not create a new bot in this branch), which regresses the prior flow where the browser path could still create an app when none existed. If a user answers “no” to the CLI create-bot branch (for example due to CLI/login constraints) and their tenant has no existing bot, the bootstrap process dead-ends and cannot reach the documented target state or produce FEISHU_APP_ID/FEISHU_APP_SECRET.

Useful? React with 👍 / 👎.

9. After the target bot/app is confirmed, continue without asking the user to click through normal console steps.
10. Follow the target state in `docs/feishu-console-automation.md`.
11. Persist the resulting `FEISHU_APP_ID` and `FEISHU_APP_SECRET` into `.env.real`.
12. If the user's machine already has `~/.codex/auth.json`, set `CODEX_HOME_SOURCE` in `.env.real` to that absolute host path. Only use `OPENAI_API_KEY` when local Codex auth is missing.
13. Keep `CODEX_ARTIFACTS_DIR` pointed at the default artifact directory unless the user explicitly wants another export location.
14. Keep `CODEX_WORKSPACE_HOST_PATH` pointed at the dedicated runtime workspace. Do not mount the repository checkout itself to `/workspace`.

## Runtime Setup

Expand All @@ -52,7 +57,7 @@ pnpm docker:smoke
If smoke passes, provide the user with:

- the app name used
- whether a new app was created or an existing one was reused
- whether an existing app was reused or a new one was created
- the Docker status
- how to test the bot in Feishu

Expand Down
2 changes: 1 addition & 1 deletion docs/codex-bootstrap-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Copy this prompt into Codex after opening or cloning the repository:

```text
严格按 README.md、AGENTS.md、docs/codex-bootstrap-playbook.md、docs/feishu-console-automation.md 执行,不要把普通控制台配置步骤推回给我。先运行 pnpm install、pnpm bootstrap:env、pnpm chrome:debug;如果我没登录飞书开放平台或 OpenAI/Codex,再停下来让我登录。登录完成后,使用 Chrome CDP 自动配置飞书开发者平台,拿到 FEISHU_APP_ID 和 FEISHU_APP_SECRET 后写回 .env.real,然后用 Docker 启动并验证服务,最后告诉我怎么在飞书里测试。
严格按 README.md、AGENTS.md、docs/codex-bootstrap-playbook.md、docs/feishu-console-automation.md 执行,不要把普通控制台配置步骤推回给我。先运行 pnpm install、pnpm bootstrap:env、pnpm chrome:debug。然后先明确问我一个问题:是否要创建新的机器人。如果我回答“要”,就异步执行 `npx -y lark-op-cli@latest create-bot --name "Codex 机器人"` 并持续读取输出;如果过程中出现扫码登录,请把 ASCII 二维码原样转发给我。如果我回答“不要”,再确认我是否已经登录飞书开放平台或 OpenAI/Codex;如果我没登录,再停下来让我登录。登录完成后,就继续走原来的浏览器和 agent-browser / Chrome CDP 方案,只选择已有机器人并完成后续配置,不要再创建新的机器人。拿到 FEISHU_APP_ID 和 FEISHU_APP_SECRET 后写回 .env.real,然后用 Docker 启动并验证服务,最后告诉我怎么在飞书里测试。
```