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:
-
Ask for the API Base URL: You MUST first use the
AskQuestiontool to ask the user whichTARO_APP_API_BASEthey 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)
- Option 1:
-
Execute the Build: Once you have the selected or inputted URL (let's call it
<SELECTED_URL>), run the following command at the git repo root path using theShelltool. Since the user is on Windows, use PowerShell syntax to set the environment variable:Command to run:
$env:TARO_APP_API_BASE="<SELECTED_URL>"; pnpm --filter @cn-kis/wechat-mini run build -
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
<SELECTED_URL>with the actual URL used:
我已经帮你执行了打包命令,并且打包成功了!
如果你以后要在 Windows 的 PowerShell 里自己运行这个命令,直接在根目录执行即可:
$env:TARO_APP_API_BASE="<SELECTED_URL>"; pnpm --filter @cn-kis/wechat-mini run build
检查结果:
打包一切顺利,没有任何报错。我也检查了打包后的产物,可以确认 API Base 已经成功重置为 <SELECTED_URL>。
- Append the Environment Warning:
- If
<SELECTED_URL>is exactlyhttps://kis.china-norm.com/api/v1, append this line to the end of your response:现在你可以启用单机模拟器测试了(请确保取消勾选不校验合法域名) 或者去微信开发者工具里点击上传,然后去微信公众平台设为体验版了(别忘了在手机上先删掉旧的体验版再重新扫码)。 - If
<SELECTED_URL>is anything else, append this line instead:请注意这只是测试环境,不要上传体验版, 本地测试请确保勾选不校验合法域名。
- If