This playbook is written for a fresh Codex session operating this repository on behalf of the user.
End state:
- Feishu developer app configured
.env.realfilled- Docker deployment up
- Health and smoke checks passing
Run from repository root:
pnpm install
pnpm bootstrap:env
pnpm chrome:debugIf agent-browser is missing and browser automation is available through shell commands, install it:
npm install -g agent-browser
agent-browser install- Ask the user one explicit question first: whether they want to create a new bot.
- If the answer is yes, run
npx -y lark-op-cli@latest create-bot --name "Codex 机器人". - In the create-bot branch, read the command output continuously instead of waiting for process exit.
- 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.
- If the answer is no, connect to the Chrome CDP endpoint started by
pnpm chrome:debug. - Open the Feishu Open Platform app list.
- If the user is not logged in, stop and ask them to finish login in that browser window.
- 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.
- After the target bot/app is confirmed, continue without asking the user to click through normal console steps.
- Follow the target state in
docs/feishu-console-automation.md. - Persist the resulting
FEISHU_APP_IDandFEISHU_APP_SECRETinto.env.real. - If the user's machine already has
~/.codex/auth.json, setCODEX_HOME_SOURCEin.env.realto that absolute host path. Only useOPENAI_API_KEYwhen local Codex auth is missing. - Keep
CODEX_ARTIFACTS_DIRpointed at the default artifact directory unless the user explicitly wants another export location. - Keep
CODEX_WORKSPACE_HOST_PATHpointed at the dedicated runtime workspace. Do not mount the repository checkout itself to/workspace.
After Feishu console setup:
pnpm docker:up
pnpm docker:smokeIf smoke passes, provide the user with:
- the app name used
- whether an existing app was reused or a new one was created
- the Docker status
- how to test the bot in Feishu
- Do not ask the user to manually configure ordinary Feishu console steps.
- Do not use
pnpm startas the primary validation path. - Do not expose secrets in terminal output beyond what is necessary to write
.env.real. - If tenant policy blocks a permission or release action, explain exactly which screen is blocked and resume after the user resolves it.