--- name: wechat-rebuild description: Rebuilds the WeChat mini program with a configurable API base URL. Use when the user types /wechat-rebuild or asks to rebuild the WeChat mini program. --- # WeChat Mini Program Rebuild When the user invokes `/wechat-rebuild` or asks to rebuild the WeChat mini program, follow these exact steps: 1. **Ask for the API Base URL**: You MUST first use the `AskQuestion` tool to ask the user which `TARO_APP_API_BASE` they want to use. Provide these exact options: - Option 1: `http://localhost:8001/api/v1` (本地后端测试地址) - Option 2: `https://kis.china-norm.com/api/v1` (火山云后端地址,体验版正式版使用) - Option 3: 请输入其他的后端请求地址 (If they select this, you must ask them to type the URL in the chat) 2. **Execute the Build**: Once you have the selected or inputted URL (let's call it ``), run the following command at the git repo root path using the `Shell` tool. Since the user is on Windows, use PowerShell syntax to set the environment variable: Command to run: ```powershell $env:TARO_APP_API_BASE=""; pnpm --filter @cn-kis/wechat-mini run build ``` 3. **Analyze the Output**: - **If the command fails**: Just tell the user what went wrong and how to fix it. Do nothing more. - **If the command succeeds**: You MUST respond to the user with EXACTLY the following Chinese message, replacing `` with the actual URL used: ```text 我已经帮你执行了打包命令,并且打包成功了! 如果你以后要在 Windows 的 PowerShell 里自己运行这个命令,直接在根目录执行即可: $env:TARO_APP_API_BASE=""; pnpm --filter @cn-kis/wechat-mini run build 检查结果: 打包一切顺利,没有任何报错。我也检查了打包后的产物,可以确认 API Base 已经成功重置为 。 ``` 4. **Append the Environment Warning**: - If `` is exactly `https://kis.china-norm.com/api/v1`, append this line to the end of your response: `现在你可以启用单机模拟器测试了(请确保取消勾选不校验合法域名) 或者去微信开发者工具里点击上传,然后去微信公众平台设为体验版了(别忘了在手机上先删掉旧的体验版再重新扫码)。` - If `` is anything else, append this line instead: `请注意这只是测试环境,不要上传体验版, 本地测试请确保勾选不校验合法域名。`