asc-plugins
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseasc plugins
asc 插件
Install executable plugins in to handle ASC lifecycle events — send Slack messages, post to Telegram, trigger webhooks, or run any custom automation when builds upload or versions submit.
~/.asc/plugins/<name>/在目录中安装可执行插件,以处理ASC生命周期事件——当构建上传或版本提交时,发送Slack消息、发布到Telegram、触发Webhook或运行任何自定义自动化任务。
~/.asc/plugins/<name>/Commands
命令
list — show all installed plugins
list — 显示所有已安装插件
bash
asc plugins list [--pretty]bash
asc plugins list [--pretty]install — install from a local directory
install — 从本地目录安装
bash
asc plugins install <path> # directory must contain manifest.json + run executablebash
asc plugins install <path> # 目录必须包含manifest.json和可执行文件rununinstall
uninstall — 卸载插件
bash
asc plugins uninstall --name <name>bash
asc plugins uninstall --name <name>enable / disable
enable / disable — 启用/禁用插件
bash
asc plugins enable --name <name>
asc plugins disable --name <name> # leaves plugin installed, just suppressedbash
asc plugins enable --name <name>
asc plugins disable --name <name> # 插件仍保留在本地,仅被禁用run — manually test a plugin
run — 手动测试插件
bash
asc plugins run --name <name> --event <event> \
[--app-id <id>] [--version-id <id>] [--build-id <id>]Events: · · ·
build.uploadedversion.submittedversion.approvedversion.rejectedbash
asc plugins run --name <name> --event <event> \
[--app-id <id>] [--version-id <id>] [--build-id <id>]事件类型: · · ·
build.uploadedversion.submittedversion.approvedversion.rejectedPlugin Protocol
插件协议
A plugin is any directory with:
| File | Purpose |
|---|---|
| Name, version, description, subscribed events |
| Executable (any language, |
stdin → plugin:
json
{
"event": "build.uploaded",
"payload": {
"event": "build.uploaded",
"appId": "123456789",
"buildId": "upload-42",
"timestamp": "2026-03-01T12:00:00Z",
"metadata": {}
}
}plugin → stdout:
json
{"success": true, "message": "Slack notification sent"}Exit code 0 = success. Non-zero = logged to stderr, other plugins continue unaffected.
插件是包含以下文件的任意目录:
| 文件 | 用途 |
|---|---|
| 定义插件名称、版本、描述及订阅的事件 |
| 可执行文件(支持任意语言,需执行 |
标准输入 → 插件:
json
{
"event": "build.uploaded",
"payload": {
"event": "build.uploaded",
"appId": "123456789",
"buildId": "upload-42",
"timestamp": "2026-03-01T12:00:00Z",
"metadata": {}
}
}插件 → 标准输出:
json
{"success": true, "message": "Slack notification sent"}退出码0表示成功。非0退出码会将错误信息输出到标准错误流,且不会影响其他插件运行。
manifest.json
manifest.json 示例
json
{
"name": "slack-notify",
"version": "1.0.0",
"description": "Send Slack notifications for App Store events",
"author": "Your Name",
"events": ["build.uploaded", "version.submitted"]
}json
{
"name": "slack-notify",
"version": "1.0.0",
"description": "为App Store事件发送Slack通知",
"author": "Your Name",
"events": ["build.uploaded", "version.submitted"]
}Typical Workflow — Create & Install a Slack Plugin
典型工作流 — 创建并安装Slack插件
bash
undefinedbash
undefined1. Create plugin directory
1. 创建插件目录
mkdir ~/slack-notify
cat > ~/slack-notify/manifest.json <<'EOF'
{
"name": "slack-notify",
"version": "1.0.0",
"description": "Slack notifications",
"events": ["build.uploaded", "version.submitted"]
}
EOF
cat > ~/slack-notify/run <<'EOF'
#!/bin/bash
INPUT=$(cat)
EVENT=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin)['event'])")
curl -s -X POST "$SLACK_WEBHOOK_URL"
-H 'Content-type: application/json'
--data "{"text":":rocket: ASC event: $EVENT"}" > /dev/null echo '{"success": true, "message": "Sent to Slack"}' EOF chmod +x ~/slack-notify/run
-H 'Content-type: application/json'
--data "{"text":":rocket: ASC event: $EVENT"}" > /dev/null echo '{"success": true, "message": "Sent to Slack"}' EOF chmod +x ~/slack-notify/run
mkdir ~/slack-notify
cat > ~/slack-notify/manifest.json <<'EOF'
{
"name": "slack-notify",
"version": "1.0.0",
"description": "Slack notifications",
"events": ["build.uploaded", "version.submitted"]
}
EOF
cat > ~/slack-notify/run <<'EOF'
#!/bin/bash
INPUT=$(cat)
EVENT=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin)['event'])")
curl -s -X POST "$SLACK_WEBHOOK_URL"
-H 'Content-type: application/json'
--data "{"text":":rocket: ASC event: $EVENT"}" > /dev/null echo '{"success": true, "message": "Sent to Slack"}' EOF chmod +x ~/slack-notify/run
-H 'Content-type: application/json'
--data "{"text":":rocket: ASC event: $EVENT"}" > /dev/null echo '{"success": true, "message": "Sent to Slack"}' EOF chmod +x ~/slack-notify/run
2. Install
2. 安装插件
asc plugins install ~/slack-notify
asc plugins install ~/slack-notify
3. Test (dry-run before uploading a real build)
3. 测试(在上传真实构建前进行空运行)
asc plugins run --name slack-notify --event build.uploaded
--app-id 123456789 --build-id test-build --pretty
--app-id 123456789 --build-id test-build --pretty
asc plugins run --name slack-notify --event build.uploaded
--app-id 123456789 --build-id test-build --pretty
--app-id 123456789 --build-id test-build --pretty
4. Upload — plugin fires automatically
4. 上传构建 — 插件自动触发
asc builds upload --app-id 123456789 --file MyApp.ipa --version 1.0.0 --build-number 42
asc builds upload --app-id 123456789 --file MyApp.ipa --version 1.0.0 --build-number 42
5. Manage
5. 管理插件
asc plugins list
asc plugins disable --name slack-notify
asc plugins enable --name slack-notify
asc plugins uninstall --name slack-notify
undefinedasc plugins list
asc plugins disable --name slack-notify
asc plugins enable --name slack-notify
asc plugins uninstall --name slack-notify
undefinedAuto-fired Events
自动触发的事件
| Command | Event emitted |
|---|---|
| |
| |
Individual plugin failures are logged to stderr and never block other plugins or the primary command output.
| 命令 | 触发的事件 |
|---|---|
| |
| |
单个插件失败会将错误日志输出到标准错误流,绝不会阻塞其他插件或主命令的输出。
JSON Output
JSON输出示例
json
{
"data": [
{
"affordances": {
"disable": "asc plugins disable --name slack-notify",
"listPlugins": "asc plugins list",
"run.build.uploaded": "asc plugins run --name slack-notify --event build.uploaded",
"run.version.submitted": "asc plugins run --name slack-notify --event version.submitted",
"uninstall": "asc plugins uninstall --name slack-notify"
},
"author": "Your Name",
"description": "Send Slack notifications for App Store events",
"executablePath": "~/.asc/plugins/slack-notify/run",
"id": "slack-notify",
"isEnabled": true,
"name": "slack-notify",
"subscribedEvents": ["build.uploaded", "version.submitted"],
"version": "1.0.0"
}
]
}Disabled plugins show affordance instead of .
"enable""disable"json
{
"data": [
{
"affordances": {
"disable": "asc plugins disable --name slack-notify",
"listPlugins": "asc plugins list",
"run.build.uploaded": "asc plugins run --name slack-notify --event build.uploaded",
"run.version.submitted": "asc plugins run --name slack-notify --event version.submitted",
"uninstall": "asc plugins uninstall --name slack-notify"
},
"author": "Your Name",
"description": "Send Slack notifications for App Store events",
"executablePath": "~/.asc/plugins/slack-notify/run",
"id": "slack-notify",
"isEnabled": true,
"name": "slack-notify",
"subscribedEvents": ["build.uploaded", "version.submitted"],
"version": "1.0.0"
}
]
}已禁用的插件会显示操作选项,而非。
"enable""disable"Plugin Storage
插件存储位置
~/.asc/plugins/
└── slack-notify/
├── manifest.json
├── run ← executable (chmod +x)
└── .disabled ← optional: present = disabled~/.asc/plugins/
└── slack-notify/
├── manifest.json
├── run ← 可执行文件(需执行chmod +x赋予权限)
└── .disabled ← 可选:存在该文件表示插件已禁用See Also
另请参阅
- Full feature doc:
docs/features/plugins.md - CAEOAS: follow from any
affordances.listPluginsresponseasc plugins list
- 完整功能文档:
docs/features/plugins.md - CAEOAS:从任意响应中遵循
asc plugins list操作affordances.listPlugins