← 返回 Skills 市场
openlark

WeChat Mini Program CI

作者 OpenLark · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
53
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install miniprogram-ci
功能描述
Automate WeChat Mini Program code upload, preview, npm build, and cloud deployments with CI/CD support using Node.js or CLI without opening DevTools.
使用说明 (SKILL.md)

miniprogram-ci

WeChat Mini Program CI tool · v2.1.31 · Node >= 16.1.0

A compilation module extracted from the WeChat Developer Tools for mini program/mini game projects. Supports both Node.js script calls and CLI commands.

Installation

npm install miniprogram-ci
# Global install (for CLI usage)
npm install -g miniprogram-ci

Prerequisites

  1. Get AppID — appid of your mini program/mini game
  2. Generate private key — WeChat Official Platform → Management → Development → Development Settings → Mini Program Code Upload → Generate "Upload Private Key" (.key file)
  3. Configure IP whitelist (recommended) — Only whitelisted IPs can call upload/preview APIs
  4. Key security — Private keys are not stored in plaintext on the platform. Must reset if lost.

Quick Start

const ci = require("miniprogram-ci");

(async () => {
  const project = new ci.Project({
    appid: "wx0000000000000000",
    type: "miniProgram",            // miniProgram | miniProgramPlugin | miniGame | miniGamePlugin
    projectPath: "./dist/build/mp-weixin",
    privateKeyPath: "./key/private.wx.xxxxx.key",
    ignores: ["node_modules/**/*"],
  });

  // Upload code
  const uploadResult = await ci.upload({
    project,
    version: "1.0.0",
    desc: "Fixed several issues",
    setting: { es6: true, minify: true },
    onProgressUpdate: console.log,
    robot: 1,
  });
  console.log("subPackageInfo:", uploadResult.subPackageInfo);

  // Preview (generate QR code)
  await ci.preview({
    project,
    desc: "Preview version",
    setting: { es6: true },
    qrcodeFormat: "image",          // image | base64 | terminal
    qrcodeOutputDest: "./preview.jpg",
    pagePath: "pages/index/index",
    searchQuery: "id=123",
    onProgressUpdate: console.log,
    robot: 1,
  });
})();

Main API

Method Purpose Key Parameters
ci.upload() Upload code project, version(required), desc, setting, robot
ci.preview() Preview (QR code) project, qrcodeOutputDest(required), desc, setting, robot
ci.buildNpm() Build npm project, options.ignores
ci.getDevSourceMap() Get latest sourceMap project, robot(required), sourceMapSavePath(required)
ci.cloudFunctionDeploy() Upload cloud function project, env(required), name(required), path(required)
ci.cloudFileUpload() Upload cloud storage/static hosting project, env(required), path(required) [alpha]
ci.cloudContainerDeploy() Deploy cloud container version project, env(required), containerRoot + version [alpha]
ci.proxy() Set proxy proxyUrl(optional)

Compile Settings

{
  es6: true,           // ES6 → ES5
  es7: true,           // Enhanced compilation
  minifyJS: true,      // Minify JS
  minifyWXML: true,    // Minify WXML
  minifyWXSS: true,    // Minify WXSS
  minify: true,        // Minify all
  codeProtect: true,   // Code protection
  autoPrefixWXSS: true, // Auto prefix CSS
}

Project Object

new ci.Project({
  appid: "wx...",           // required
  projectPath: "./dist",    // required (directory containing project.config.json)
  privateKeyPath: "./key",  // required
  type: "miniProgram",      // optional, defaults to miniProgram
  ignores: ["node_modules"],// optional
})

CLI Commands

# Upload
miniprogram-ci upload \
  --pp ./dist \
  --pkp ./key/private.key \
  --appid wx0000000000000000 \
  --uv 1.0.0 \
  --ud "Version description" \
  --r 1

# Preview
miniprogram-ci preview \
  --pp ./dist \
  --pkp ./key/private.key \
  --appid wx0000000000000000 \
  --uv 1.0.0 \
  --ud "Preview description" \
  --qrcode-format image \
  --qrcode-output-dest ./preview.jpg

Proxy Configuration

Auto-detection order: HTTPS_PROXYhttps_proxyHTTP_PROXYhttp_proxy → npm config → manual

ci.proxy("http://127.0.0.1:8888");   // manual
ci.proxy();                           // clear, restore auto

servicewechat.com is automatically added to no_proxy.

Return Values (upload/preview)

{
  subPackageInfo: [
    { name: "__FULL__", size: 123456 },    // entire package
    { name: "__APP__", size: 100000 },     // main package
    { name: "subPack1", size: 23456 },     // sub package
  ],
  pluginInfo: [
    { pluginProviderAppid: "wx...", version: "1.0.0", size: 12345 },
  ],
  devPluginId: "wx...",
}

Third-Party Platform

Supported since 1.0.28. Note:

  • Project must have a valid ext.json
  • Use the private key of the development mini program bound to the third-party platform
  • IP whitelist also belongs to that development mini program
  • The appid passed in must be the bound development mini program's appid

Robot Parameter

Specify which CI robot to use (1~30), enabling concurrent operations without conflicts.

Reference Files

File Content
references/cloud.md Cloud development (cloud functions/cloud containers/cloud storage)
references/cli.md CLI command detailed options
安全使用建议
Install only if you intend to let an agent help with WeChat Mini Program CI/CD. Treat the WeChat upload private key as a deployment credential: keep it out of repositories and chat logs, inject it through a CI secret store, restrict access and IPs where possible, rotate it if exposed, and require explicit confirmation before upload, preview, cloud function, storage, or container deployment commands.
能力标签
cryptorequires-walletrequires-sensitive-credentials
能力评估
Purpose & Capability
The artifact is a documentation skill for miniprogram-ci, covering upload, preview, npm build, cloud function deployment, cloud storage upload, and cloud container deployment, which match the stated CI/CD purpose.
Instruction Scope
Examples require explicit project path, appid, private key path, version, robot, and cloud environment parameters, but the docs do not strongly require user confirmation before remote upload or deployment actions.
Install Mechanism
The package contents are Markdown documentation only; it suggests npm installation of miniprogram-ci, including optional global CLI installation, with no bundled executable, install hook, or obfuscated code.
Credentials
Use of WeChat app IDs, upload private keys, IP whitelisting, proxies, and cloud environment IDs is sensitive but proportionate for a CI/CD deployment tool. Secret-handling guidance is present only at a minimal level.
Persistence & Privilege
No background worker, recurring execution, credential persistence, privilege escalation, destructive local file operation, or autonomous execution mechanism is defined by the artifacts.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install miniprogram-ci
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /miniprogram-ci 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of miniprogram-ci v1.0.0: - Provides Node.js module and CLI for WeChat Mini Program/mini game CI/CD without opening DevTools. - Supports code upload, preview (QR code), npm build, cloud function/cloud container deployment, and cloud storage upload. - Includes comprehensive API and CLI usage documentation. - Requires appid, private key, and optional IP whitelist for secure access. - Allows custom compile settings and robot selection for concurrent operations. - Details return values and advanced use (e.g., third-party platform integration, proxy configuration).
元数据
Slug miniprogram-ci
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

WeChat Mini Program CI 是什么?

Automate WeChat Mini Program code upload, preview, npm build, and cloud deployments with CI/CD support using Node.js or CLI without opening DevTools. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 53 次。

如何安装 WeChat Mini Program CI?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install miniprogram-ci」即可一键安装,无需额外配置。

WeChat Mini Program CI 是免费的吗?

是的,WeChat Mini Program CI 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

WeChat Mini Program CI 支持哪些平台?

WeChat Mini Program CI 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 WeChat Mini Program CI?

由 OpenLark(@openlark)开发并维护,当前版本 v1.0.0。

💬 留言讨论