wechat-miniprogram-ci-upload
Skill3 starsChanged 15 days agoApache-2.0View on GitHub
Open, name, test, preview, and upload WeChat Mini Program builds with WeChat DevTools CLI preferred, including prompts such as 上传体验版, 上传开发版, 用 miniprogram-ci 上传, 生成小程序预览二维码, 打开微信开发者工具, 项目名称/projectname, 代码上传密钥/private key/ci机器人, dev/build产物选择, 上传版本管理, or uploading uni-app mp-weixin output after build. Prefer WeChat DevTools CLI when installed and logged in; fall back to miniprogram-ci only when DevTools CLI is unavailable or the user explicitly requests key-based CI upload. Synchronize build-upload versions; keep Git publication separately authorized. Complete experience-version selection through the public platform only when requested; dev upload and preview do not change versions or tags.
- Commits and pushes
In this repository11 other files it gives its agents.
- .codex/AGENTS.mdAGENTS.md
- codebase-designSkill
- develop-uniapp-miniappSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- frontend-designSkill
- git-auto-commitSkill
- github-cli-opsSkill
- harness-engineeringSkill
- release-opsSkill
- tddSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
82 rules. About 0 are common, 41 are distinctive, and 41 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈41
Distinctive · estimate
This author's own choices. Worth a look.
41
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Default path (macOS): /Applications/wechatwebdevtools.app/Contents/MacOS/cli
- Distinctive: line 31
Do not silently switch tools.
- Very specific: line 35
Use a meaningful mode-specific display name instead of generic names such as src or mp-weixin: <业务名>-build for build output and <业务名>-dev …
- Distinctive: line 42
When the user asks to visibly open or test the project, inspect the DevTools main process.
- Very specific: line 46
Verify the visible window title and the project-list card use the expected display name.
- Very specific: line 55
If the IDE console or CLI reports 41002 appid missing, appid missing, 测试号不支持上传, or shows a test/tourist project, stop all upload/preview …
- Very specific: line 72
If the user says 上传体验版, complete development-version upload and then Experience-Version Selection.
- Very specific: line 80
Read package.json, src/manifest.json, and existing output project.config.json when present.
- Very specific: line 82
Use build mode by default.
- Very specific: line 83
Use dev mode when the user explicitly says dev, 开发产物, dist/dev, or asks to upload/preview the dev output.
- Very specific: line 84
Use build mode when the user explicitly says build, 生产构建, dist/build, or asks to upload/preview the build output.
- Distinctive: line 93
Check tag availability only when tag creation is separately authorized.
- Distinctive: line 95
Always generate the latest mini-program output for the resolved mode before upload or preview.
- Distinctive: line 98
If no exact script exists, inspect package scripts and choose the closest WeChat mini-program script for the requested mode.
- Distinctive: line 99
If no script matches the requested mode, stop and explain which mode and script are missing.
- Distinctive: line 101
Stop if the build fails; do not upload stale output.
- Distinctive: line 102
Use the freshly generated output directory for the resolved mode.
- Very specific: line 105
Verify it exists and contains project.config.json and app.json (or equivalent mini-program root files) before continuing.
- Very specific: line 106
Treat the output's generated project.config.json as authoritative for that output root.
- Very specific: line 108
Prefer the built output project.config.json.
- Very specific: line 115
If the user only asks to generate a preview QR code and the purpose is unclear, use 验证小程序当前构建效果 as <变更目的>, then apply the Upload …
- Very specific: line 116
Default robot is 1 only when using miniprogram-ci.
- Distinctive: line 117
Prefer WeChat DevTools CLI for upload/preview.
- Very specific: line 119
Use the freshly generated dist/build/mp-weixin directly by default.
- Distinctive: line 124
Never overlay that file with a repository-root or source-tree project config.
- Very specific: line 125
When the copied directory itself is the mini-program root, miniprogramRoot and srcMiniprogramRoot must be absent or "./".
- Very specific: line 127
Treat a successful cli open only as confirmation that the IDE accepted the path.
- Distinctive: line 128
Run upload or preview with DevTools CLI.
- Very specific: line 132
Do not treat 41002 appid missing, 测试号不支持上传, or an AppID mismatch as a generic CLI availability failure.
- Distinctive: line 137
Verify the key file exists, but never display its contents.
- Very specific: line 138
Do not search broad filesystem locations such as ~/Downloads unless the user provided the path.
- Very specific: line 139
If no usable key exists, stop and report that DevTools CLI failed/unavailable and no key is available for miniprogram-ci.
- Distinctive: line 144
After build upload succeeds, follow Build Upload Git Finalization.
- Distinctive: line 145
If the user requested an experience version, complete Experience-Version Selection after a successful upload, independently of optional Git …
- Distinctive: line 150
Use this section only when the user explicitly requests an experience version for the uploaded project.
- Distinctive: line 152
After successful upload with the expected AppID, use the platform browser per the global Browser And Web Access rules (Codex Chrome plugin …
- Distinctive: line 155
If access, account scope, or available platform controls prevent selection, report the completed upload and remaining selection step.
- Very specific: line 163
Stop immediately when the IDE or CLI shows 41002 appid missing, appid missing, 测试号不支持上传, a test/tourist project, or any AppID mismatch.
- Very specific: line 164
Do not edit WeChat DevTools internal cache or local-storage files to manufacture a binding.
- Very specific: line 165
If a new path was cached as unbound, close it.
- Distinctive: line 201
If the purpose is unclear, use:
- Distinctive: line 208
Do not include commit hashes in the upload description by default.
- Very specific: line 209
Avoid vague or tool-noisy descriptions such as 体验版, test, upload, or miniprogram-ci 体验版 ff373be.
- Distinctive: line 217
If the user provides an explicit SemVer version, use it.
- Very specific: line 219
If manifest versionName is missing, read package.json version.
- Very specific: line 220
Treat missing values, empty values, and 0.0.0 as placeholders.
- Very specific: line 221
If both package and manifest versions exist but differ, prefer manifest versionName for uni-app mini-program uploads.
- Very specific: line 222
If no usable version exists, start from 1.0.0.
- Distinctive: line 226
If the user explicitly provides a final version, do not bump it.
- Very specific: line 227
If the user explicitly says major, minor, or patch, apply that SemVer bump.
- Very specific: line 232
When inference is uncertain, default to patch and report that default in the final result.
- Distinctive: line 239
Use structured JSON parsing/editing when possible.
- Distinctive: line 240
Do not update version files for dev upload or preview-only requests.
- Distinctive: line 242
Before a build upload with separately authorized tag creation, check tag availability for that Git publication:
- Distinctive: line 249
If either local or remote tag already exists, stop tag creation and report the conflict.
- Distinctive: line 253
Run this section only after a build upload command succeeds in a Git repository.
- Distinctive: line 258
If no version fields changed, skip the version commit.
- Distinctive: line 259
Commit message must be exactly:
- Distinctive: line 265
Only with explicit authorization for the exact tag, create a lightweight tag on the verified commit representing the uploaded source and …
- Distinctive: line 281
Do not commit generated mini-program output unless it is required by the authorized task or project rules.
- Distinctive: line 295
Default macOS CLI path:
- Very specific: line 301
If that path is missing, try to locate wechatwebdevtools.app under /Applications only.
- Very specific: line 345
If CLI reports app.json is not found in the project root directory:
- Very specific: line 348
Stop a live watcher or prepare .tmp/upload-mp-weixin under the stable-copy rules above.
- Very specific: line 349
Run cli open --project <path> once, then retry upload.
- Very specific: line 350
Only then consider miniprogram-ci fallback if a key is available.
- Very specific: line 352
If the CLI reports that the account is not logged in, the service port is unavailable, or automation is not enabled, either fall back to …
- Distinctive: line 356
Use only under the Tool Priority fallback conditions.
- Distinctive: line 429
Prefer WeChat DevTools CLI.
- Distinctive: line 430
Do not add upload private keys to Git.
- Distinctive: line 431
Do not echo private key contents into logs.
- Distinctive: line 432
Do not upload when the latest build failed.
- Very specific: line 433
Do not accept cli open success as AppID validation.
- Very specific: line 434
Do not upload, commit, tag, or push after 41002 appid missing, 测试号不支持上传, a tourist/test project, or an AppID mismatch.
- Very specific: line 435
Do not overwrite a generated output project.config.json with a config from another directory level.
- Distinctive: line 436
Do not edit WeChat DevTools internal cache or local-storage files to force an AppID binding.
- Very specific: line 438
Do not run miniprogram-ci from the repository root when avoidable, because it may create 32-character hash temporary directories in the …
- Very specific: line 439
Do not fall back to miniprogram-ci silently.
- Distinctive: line 440
Do not tag before build upload succeeds or without explicit tag authorization.
- Distinctive: line 441
Do not tag or push for dev upload or preview-only requests.
- Distinctive: line 442
Do not modify version files for dev upload or preview-only requests.
- Distinctive: line 443
Do not overwrite existing local or remote tags.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WeChat Mini Program CI Upload
Tool Priority
- Primary: WeChat DevTools CLI
- Default path (macOS):
/Applications/wechatwebdevtools.app/Contents/MacOS/cli - Requires WeChat DevTools installed, account logged in, and CLI/local service/automation available.
- The CLI may start or reuse the DevTools local service; the IDE window may or may not open visibly.
- Default path (macOS):
- Fallback:
miniprogram-ci- Use only when:
- DevTools CLI binary is missing under
/Applications, or - DevTools CLI fails because it is not logged in / service port is unavailable / automation is disabled, or
- The user explicitly asks for
miniprogram-ci/ 代码上传密钥 / CI robot upload.
- DevTools CLI binary is missing under
- Requires a usable private key from the user-provided path or project
.tmp.
- Use only when:
- Do not silently switch tools. When falling back, tell the user the exact reason.
DevTools GUI And Project Naming
- Use a meaningful mode-specific display name instead of generic names such as
srcormp-weixin:<业务名>-buildfor build output and<业务名>-devfor dev output. Reuse an established project name when the repository already defines one. - For uni-app, set the source
project.config.json#projectnameto the plain display name andproject.private.config.json#projectnameto the same value encoded with JavaScriptencodeURIComponent. Rebuild and verify both generated output configs; do not patch generated configs as the durable fix. - When the user asks to visibly open or test the project, inspect the DevTools main
process. If it is running only as
Electron --cli, close that instance normally, launch/Applications/wechatwebdevtools.appas a visible GUI, then runcli open --project <output-dir>against the validated output path. - Verify the visible window title and the project-list card use the expected display
name. A successful
cli openis insufficient. If the card remains stale, use the DevTools Manage/remove-and-import flow; never edit DevTools internal cache.
Cold-start AppID Binding Recheck
- A correct window title or project name does not prove that DevTools has bound the project to the expected AppID. DevTools can reuse a cached tourist/test registration for the same path after a cold start.
- If the IDE console or CLI reports
41002 appid missing,appid missing,测试号不支持上传, or shows a test/tourist project, stop all upload/preview and Git finalization actions. Do not fall back tominiprogram-cijust because the project name is correct. - Close the unbound project, then use DevTools Manage/导入 to remove the stale
registration and import the freshly generated
mp-weixinoutput. Enter the expected AppID during import and confirm the project is a non-tourist project (isTourist = falsewhen that field is available). - Reopen the visible GUI and recheck all of: window title, project-list card,
AppID, and a clean compile/run console. Only after the cold-start check is clean
may
cli uploadorcli previewbe retried.cli opensuccess alone remains insufficient evidence of binding.
Boundaries
- Both tools upload a WeChat Mini Program development version (开发版).
- CLI upload success alone does not establish experience-version selection (体验版).
- If the user says
上传体验版, complete development-version upload and then Experience-Version Selection. A development-version upload or preview-only request ends after that requested result; do not add public-platform operations or login steps. - The upload private key is only needed for
miniprogram-ci. Do not guess, generate, search broad filesystem locations for, commit, or print private key contents. - Build upload synchronizes version files and follows the global rules for local commits. Upload authorization does not grant Git tag, branch push, production, or MR/PR permissions. Resolve any separately authorized Git publication before uploading; missing optional Git publication authority does not block upload. Dev upload and preview QR generation do not edit versions, commit, tag, or push as part of this skill.
Required Workflow
- Confirm the repository has a WeChat Mini Program target.
- For uni-app projects, prefer
mp-weixinoutput. - Read
package.json,src/manifest.json, and existing outputproject.config.jsonwhen present.
- For uni-app projects, prefer
- Resolve the output mode before upload or preview.
- Use
buildmode by default. - Use
devmode when the user explicitly saysdev,开发产物,dist/dev, or asks to upload/preview the dev output. - Use
buildmode when the user explicitly saysbuild,生产构建,dist/build, or asks to upload/preview the build output. - Resolve the upload-description suffix from the output mode:
build->(RELEASE);dev->(UAT). Do not infer it from the Git branch. - Report the resolved mode in the final result.
- Use
- For build upload requests, resolve source ownership, version, and any Git publication scope before building.
- In a Git repository, inspect the current branch,
git status --short, and staged/unstaged diffs. Git and anoriginremote are not prerequisites for uploading a valid project; require the relevant Git state only for authorized Git operations. - Attribute business-file changes. Validate and commit current-task changes under the existing global authorization with
$git-auto-commit; do not ask the user to repeat an already authorized commit request. Preserve unrelated changes and isolate the upload source when they would otherwise be included. Ask only when source ownership, required dependencies, or the intended upload content cannot be determined safely. - Upload-managed version files are
package.json,manifest.json, andsrc/manifest.json. - Resolve the upload version using the Version Management section, then synchronize only the intended version fields before building. Preserve unrelated changes in those files too.
- Identify separately authorized branch/tag publication, its exact target, and side effects under the global Git workflow. If no publication is authorized, complete the upload without adding a Git publication approval step. If Git publication is required by the user but its scope is missing, prepare the concrete Git result and ask only about that operation while continuing the independently authorized upload.
- Check tag availability only when tag creation is separately authorized. A tag conflict blocks tag publication, not an independently authorized upload; never overwrite a tag or silently change the requested version.
- Skip this step for dev upload and all preview requests.
- In a Git repository, inspect the current branch,
- Always generate the latest mini-program output for the resolved mode before upload or preview.
- In
buildmode, preferpnpm build:mp-weixin; default output isdist/build/mp-weixin. - In
devmode, preferpnpm dev:mp-weixinor the closestuni -p mp-weixin/pnpm run devscript; default output isdist/dev/mp-weixin. - If no exact script exists, inspect package scripts and choose the closest WeChat mini-program script for the requested mode.
- If no script matches the requested mode, stop and explain which mode and script are missing.
- For long-running dev/watch builds, wait until
app.jsonandproject.config.jsonexist and the target pages are present, then stop the watch process before upload when practical. - Stop if the build fails; do not upload stale output.
- In
- Use the freshly generated output directory for the resolved mode.
- Build mode output:
dist/build/mp-weixin. - Dev mode output:
dist/dev/mp-weixin. - Verify it exists and contains
project.config.jsonandapp.json(or equivalent mini-program root files) before continuing. - Treat the output's generated
project.config.jsonas authoritative for that output root. Never replace it with a repository-root or source-treeproject.config.json.
- Build mode output:
- Resolve AppID.
- Prefer the built output
project.config.json. - Fall back to
src/manifest.jsonor user-provided AppID. - Record this value as the expected AppID. Stop if the available sources disagree, or if the resolved value is empty,
touristappid, or another test/placeholder value.
- Prefer the built output
- Resolve command version and upload description.
- For build upload, use the synchronized version from step 3.
- For dev upload, use read-only version resolution: user-provided version, then
src/manifest.jsonormanifest.jsonversionName, thenpackage.jsonversion. Do not edit files for dev upload. - For preview, use the same read-only version resolution as dev upload.
- If the user only asks to generate a preview QR code and the purpose is unclear, use
验证小程序当前构建效果as<变更目的>, then apply the Upload Description Policy suffix for the resolved mode. - Default robot is
1only when usingminiprogram-ci; DevTools CLI does not use robot.
- Prefer WeChat DevTools CLI for upload/preview.
- Resolve CLI path (see WeChat DevTools CLI section).
- Use the freshly generated
dist/build/mp-weixindirectly by default. A completed build output is already stable. - For dev mode, stop the watcher when practical and use the completed
dist/dev/mp-weixindirectly. - Prepare
<repo>/.tmp/upload-mp-weixin/only when the resolved output is still volatile or a stable copy is otherwise necessary:- Recreate only that exact task-owned temporary directory before copying; do not merge a fresh build into stale files.
- Copy the complete generated output, including its own
project.config.json. - Never overlay that file with a repository-root or source-tree project config.
- When the copied directory itself is the mini-program root,
miniprogramRootandsrcMiniprogramRootmust be absent or"./". Reject a copied config that still points todist/build/mp-weixin/,dist/dev/mp-weixin/, or another nested source path.
- Optionally
cli open --project <path>beforeupload/previewif the first compile attempt fails with missingapp.json. - Treat a successful
cli openonly as confirmation that the IDE accepted the path; it does not prove that the project is bound to the expected AppID. - Run upload or preview with DevTools CLI.
- Apply the DevTools AppID Binding Guardrail before treating the command as successful.
- Fall back to
miniprogram-cionly when step 8 cannot proceed.- Explain the fallback reason to the user first.
- Do not treat
41002 appid missing,测试号不支持上传, or an AppID mismatch as a generic CLI availability failure. Resolve the DevTools project binding or stop; do not fall back solely because of one of these errors. - Resolve private key path:
- User-provided path, or
- project-local
.tmp/private.<appid>.key, or - project-local
.tmp/private.key.
- Verify the key file exists, but never display its contents.
- Do not search broad filesystem locations such as
~/Downloadsunless the user provided the path. - If no usable key exists, stop and report that DevTools CLI failed/unavailable and no key is available for
miniprogram-ci. - Prepare
.tmp/miniprogram-ci-work/and runminiprogram-cifrom that directory with absolute paths.
- Clean up temporary artifacts after the command finishes.
- For DevTools path: leave
.tmp/upload-mp-weixin/in place unless the user asks to clean it. - For
miniprogram-ci: remove empty.tmp/miniprogram-ci-work/[0-9a-f]{32}directories automatically; leave non-empty ones and report the path.
- For DevTools path: leave
- After build upload succeeds, follow Build Upload Git Finalization. Keep upload success separate from any blocked or failed Git operation. Skip this step for dev upload and all preview requests.
- If the user requested an experience version, complete Experience-Version Selection after a successful upload, independently of optional Git publication. Otherwise finish at the requested development-version upload or preview.
- Report command outcome, output mode (
devorbuild), output directory, tool, AppID, version, robot when applicable, description, and Git status for build uploads. Distinguish development-version upload, experience-version selection, and preview QR. For dev upload, report that this skill skipped version sync and tag/push. If experience selection is blocked, report开发版上传成功;体验版选择尚未完成with the concrete blocker; do not describe the whole experience-version request as complete.
Experience-Version Selection
Use this section only when the user explicitly requests an experience version for the uploaded project. That request covers selecting the uploaded development version as the experience version, not submitting it for review, publishing production, or changing members or tester permissions.
- After successful upload with the expected AppID, use the platform browser per the global Browser And Web Access rules (Codex Chrome plugin / Claude in Chrome, in an agent-owned tab) to inspect the WeChat public platform. Follow current visible navigation rather than assuming fixed selectors.
- Verify the account/project AppID and identify the uploaded development version using its version, description, upload time, and other available evidence. Do not select a different or ambiguous record. Reuse a signed-in session; if login, QR verification, CAPTCHA, or a browser-owned approval requires the user, hand off under the global human-verification rules and resume only after the user confirms.
- Select that record as the experience version within the authorized scope. Read the resulting platform state to verify the selected version. Keep any experience QR or result page available only when needed by the user, following the current browser completion policy.
- If access, account scope, or available platform controls prevent selection, report the completed upload and remaining selection step. Continue independent authorized work; do not bypass access controls or substitute a production-release action.
DevTools AppID Binding Guardrail
Apply this guardrail to every DevTools CLI upload or preview:
- Compare the user-requested AppID when present, the expected AppID resolved from project files, and the AppID reported by the CLI. All available values must match exactly.
- For upload, require the CLI output to report the expected AppID, such as
使用 AppID: <expected-appid>, before acceptinguploadsuccess. - Stop immediately when the IDE or CLI shows
41002 appid missing,appid missing,测试号不支持上传, a test/tourist project, or any AppID mismatch. Do not upload, commit version files, create a tag, or push. - Do not edit WeChat DevTools internal cache or local-storage files to manufacture a binding. Reopening the same path after changing
project.config.jsonmay reuse an earlier unbound/test-project cache entry and is not a valid fix. - If a new path was cached as unbound, close it. Prefer the DevTools
Manage/导入 flow to remove the stale registration and import the exact
validated output with the expected AppID; confirm
isTourist = falsewhen available. Rebuilding or reopening the same path without re-importing does not repair the binding. - Re-run the visible GUI cold-start check and then the CLI command after
correcting the binding. Accept success only after the expected AppID is
reported and no
appid missingerror remains.
Upload Description Policy
Preserve the base remark format and append exactly one full-width suffix based only on the resolved output mode:
| Output mode | Suffix |
build | (RELEASE) |
dev | (UAT) |
release v<版本号> <变更目的><模式后缀>Examples:
build: release v1.0.0 更新小程序开发版本(RELEASE)
dev: release v1.0.0 验证账单解析与预算统计流程(UAT)Rules:
- Resolve the output mode before creating any upload description, using the mode rules in the Required Workflow section.
- Map
buildto(RELEASE)anddevto(UAT); use this mapping for every upload and preview description. - Append exactly one suffix at the end. Never omit it, use half-width parentheses, or append both
(UAT)and(RELEASE). - In command templates, replace
<模式后缀>with the literal suffix for the resolved mode; never upload the placeholder unchanged. - Infer
<变更目的>from the user's request, recent task context, README, page names, or recent commit subjects when it is clear. - If the purpose is unclear, use:
build: release v<版本号> 更新小程序开发版本(RELEASE)
dev: release v<版本号> 更新小程序开发版本(UAT)- Do not include commit hashes in the upload description by default; report them separately if useful.
- Avoid vague or tool-noisy descriptions such as
体验版,test,upload, orminiprogram-ci 体验版 ff373be.
Version Management
Apply this section only to build upload requests. Dev upload and preview QR requests must resolve a version read-only and must not edit, commit, tag, or push version files.
Upload version resolution:
- If the user provides an explicit SemVer version, use it.
- Otherwise read
versionNamefromsrc/manifest.jsonormanifest.json. - If manifest
versionNameis missing, readpackage.jsonversion. - Treat missing values, empty values, and
0.0.0as placeholders. - If both package and manifest versions exist but differ, prefer manifest
versionNamefor uni-app mini-program uploads. - If no usable version exists, start from
1.0.0.
Upload version bump:
- If the user explicitly provides a final version, do not bump it.
- If the user explicitly says
major,minor, orpatch, apply that SemVer bump. - Otherwise infer the bump from the user request, current
git diff, staged diff, and recent commit subjects using the same change-type spirit as$git-auto-commit:- New features, new pages, or substantial user-facing capability:
minor. - Fixes, style changes, copy changes, API adaptation, small UI adjustments, or local optimizations:
patch. majoronly when the user explicitly asks for it or the change is clearly breaking.
- New features, new pages, or substantial user-facing capability:
- When inference is uncertain, default to
patchand report that default in the final result.
Synchronize version files before building:
- Set
package.jsonversionto the resolved upload version whenpackage.jsonexists. - Set
manifest.jsonorsrc/manifest.jsonversionNameto the same version when present. - Set manifest
versionCodeto the SemVer digits without dots, such as1.0.0 -> 100,1.2.3 -> 123, and1.10.3 -> 1103. - Use structured JSON parsing/editing when possible; preserve unrelated fields.
- Do not update version files for dev upload or preview-only requests.
Before a build upload with separately authorized tag creation, check tag availability for that Git publication:
git rev-parse -q --verify refs/tags/v<version>
git ls-remote --tags origin v<version>If either local or remote tag already exists, stop tag creation and report the conflict. Do not overwrite, delete, or auto-bump after a tag conflict. This Git conflict does not block an independently authorized upload of the resolved version.
Build Upload Git Finalization
Run this section only after a build upload command succeeds in a Git repository. Do not run it for dev upload, preview QR generation, or any failed upload. Git publication is optional unless the user's request separately requires it.
Rules:
- Stage only attributable version changes in
package.json,manifest.json, andsrc/manifest.json; never stage unrelated fields or business changes wholesale. Follow the global local-commit rules and task-history safeguards. Business commits use$git-auto-commitwithin their existing authorization and need no repeated request. - If no version fields changed, skip the version commit. A no-op version commit does not create tag or push authority.
- Commit message must be exactly:
chore: release v<version>- Only with explicit authorization for the exact tag, create a lightweight tag on the verified commit representing the uploaded source and version. Recheck for source drift and local/remote tag conflicts first:
git tag v<version> <verified-upload-commit>- Execute only separately authorized Git publication. Use the global Git workflow's validation and integration preflight for the exact authorized branch target; never choose a publication target solely because it is the current branch. Tag publication requires explicit authorization and a verified tag target. Commands for the independently authorized operations are:
# Only when branch publication is authorized and preflight permits it:
git push origin <validated-task-ref>:refs/heads/<authorized-target>
# Only when this exact tag publication is explicitly authorized:
git push origin refs/tags/v<version>:refs/tags/v<version>- Without Git publication authority, finish the upload and eligible local commit, then report
Git 发布:未执行(未授权); do not ask for an optional publication. If an authorized Git operation fails, preserve the successful upload and report the exact Git blocker separately. - Do not commit generated mini-program output unless it is required by the authorized task or project rules.
Command Templates
In every command below, <absolute-mp-weixin-output-dir> is the freshly generated output for the resolved mode. Use a stable copy only under the step 8 conditions:
build -> <repo>/dist/build/mp-weixin
dev -> <repo>/dist/dev/mp-weixin
stable copy (only when needed) -> <repo>/.tmp/upload-mp-weixinPrimary: WeChat DevTools CLI
Default macOS CLI path:
/Applications/wechatwebdevtools.app/Contents/MacOS/cliIf that path is missing, try to locate wechatwebdevtools.app under /Applications only. Do not perform broad filesystem searches.
Upload a build-mode development version:
/Applications/wechatwebdevtools.app/Contents/MacOS/cli upload \
--project <absolute-mp-weixin-output-dir> \
--version <version> \
--desc "release v<版本号> <变更目的>(RELEASE)" \
--lang zhUpload a dev-mode development version:
/Applications/wechatwebdevtools.app/Contents/MacOS/cli upload \
--project <absolute-mp-weixin-output-dir> \
--version <version> \
--desc "release v<版本号> <变更目的>(UAT)" \
--lang zhGenerate a preview QR code:
/Applications/wechatwebdevtools.app/Contents/MacOS/cli preview \
--project <absolute-mp-weixin-output-dir> \
--qr-format image \
--qr-output <absolute-preview-image-path> \
--lang zhPreview output should default to .tmp/miniprogram-ci-preview.png unless the user specifies another path. The DevTools CLI preview command has no description flag; any recorded preview description still follows build -> (RELEASE) and dev -> (UAT).
Stable-copy prep when the generated output cannot be used directly:
# if this exact task-owned directory exists, move it to Trash before recreating it
mkdir -p <repo>/.tmp/upload-mp-weixin
cp -R <absolute-mp-weixin-output-dir>/. <repo>/.tmp/upload-mp-weixin/
# keep the generated project.config.json; never overlay a repository-root config
# require miniprogramRoot/srcMiniprogramRoot to be absent or "./"If CLI reports app.json is not found in the project root directory:
- Confirm
app.jsonexists in the project root used for--project. - Stop a live watcher or prepare
.tmp/upload-mp-weixinunder the stable-copy rules above. - Run
cli open --project <path>once, then retry upload. - Only then consider
miniprogram-cifallback if a key is available.
If the CLI reports that the account is not logged in, the service port is unavailable, or automation is not enabled, either fall back to miniprogram-ci when a key exists, or stop and tell the user the specific missing condition.
Fallback: miniprogram-ci
Use only under the Tool Priority fallback conditions.
Upload a build-mode development version:
cd <repo>/.tmp/miniprogram-ci-work && pnpm dlx miniprogram-ci upload \
--appid <appid> \
--project-path <absolute-mp-weixin-output-dir> \
--private-key-path <private-key-path> \
--upload-version <version> \
--upload-description "release v<版本号> <变更目的>(RELEASE)" \
--robot <robot> \
--use-project-config \
--locales zhUpload a dev-mode development version:
cd <repo>/.tmp/miniprogram-ci-work && pnpm dlx miniprogram-ci upload \
--appid <appid> \
--project-path <absolute-mp-weixin-output-dir> \
--private-key-path <private-key-path> \
--upload-version <version> \
--upload-description "release v<版本号> <变更目的>(UAT)" \
--robot <robot> \
--use-project-config \
--locales zhGenerate a build-mode preview QR code:
cd <repo>/.tmp/miniprogram-ci-work && pnpm dlx miniprogram-ci preview \
--appid <appid> \
--project-path <absolute-mp-weixin-output-dir> \
--private-key-path <absolute-private-key-path> \
--upload-version <version> \
--upload-description "release v<版本号> <变更目的>(RELEASE)" \
--robot <robot> \
--use-project-config \
--enable-qrcode \
--qrcode-format image \
--qrcode-output-dest <absolute-preview-image-path> \
--locales zhGenerate a dev-mode preview QR code:
cd <repo>/.tmp/miniprogram-ci-work && pnpm dlx miniprogram-ci preview \
--appid <appid> \
--project-path <absolute-mp-weixin-output-dir> \
--private-key-path <absolute-private-key-path> \
--upload-version <version> \
--upload-description "release v<版本号> <变更目的>(UAT)" \
--robot <robot> \
--use-project-config \
--enable-qrcode \
--qrcode-format image \
--qrcode-output-dest <absolute-preview-image-path> \
--locales zhFor a plain 生成预览二维码 request, use this default description unless task context provides a clearer purpose:
build: release v<版本号> 验证小程序当前构建效果(RELEASE)
dev: release v<版本号> 验证小程序当前构建效果(UAT)Safety Notes
- Prefer WeChat DevTools CLI; do not require a private key for the default path.
- Do not add upload private keys to Git.
- Do not echo private key contents into logs.
- Do not upload when the latest build failed.
- Do not accept
cli opensuccess as AppID validation. - Do not upload, commit, tag, or push after
41002 appid missing,测试号不支持上传, a tourist/test project, or an AppID mismatch. - Do not overwrite a generated output
project.config.jsonwith a config from another directory level. - Do not edit WeChat DevTools internal cache or local-storage files to force an AppID binding.
- Public-platform access is limited to explicitly requested experience-version selection. Preserve login/CAPTCHA handoff and separate production, review-submission, and permission-change authorization.
- Do not run
miniprogram-cifrom the repository root when avoidable, because it may create 32-character hash temporary directories in the current working directory. - Do not fall back to
miniprogram-cisilently; always state the DevTools failure or user request reason first. - Do not tag before build upload succeeds or without explicit tag authorization.
- Do not tag or push for dev upload or preview-only requests.
- Do not modify version files for dev upload or preview-only requests.
- Do not overwrite existing local or remote tags.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

