@alipay/alipay-aipay 0.1.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/bin/alipay-aipay.js +6 -0
- package/dist/commands/install.d.ts +10 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +92 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/uninstall.d.ts +10 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +82 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +125 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/alipay-cli.d.ts +15 -0
- package/dist/utils/alipay-cli.d.ts.map +1 -0
- package/dist/utils/alipay-cli.js +228 -0
- package/dist/utils/alipay-cli.js.map +1 -0
- package/dist/utils/config.d.ts +48 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +207 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/file.d.ts +55 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +154 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/gpg.d.ts +14 -0
- package/dist/utils/gpg.d.ts.map +1 -0
- package/dist/utils/gpg.js +247 -0
- package/dist/utils/gpg.js.map +1 -0
- package/dist/utils/jq.d.ts +14 -0
- package/dist/utils/jq.d.ts.map +1 -0
- package/dist/utils/jq.js +221 -0
- package/dist/utils/jq.js.map +1 -0
- package/dist/utils/npm.d.ts +17 -0
- package/dist/utils/npm.d.ts.map +1 -0
- package/dist/utils/npm.js +42 -0
- package/dist/utils/npm.js.map +1 -0
- package/dist/utils/shell.d.ts +11 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +54 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +53 -0
- package/skill/SKILL.md +118 -0
- package/skill/references/integration/flow.md +487 -0
- package/skill/references/integration/modules/alipay-sdk-reminder.md +256 -0
- package/skill/references/integration/modules/checklist.md +122 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +68 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +74 -0
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +73 -0
- package/skill/references/integration/modules/code-examples/csharp/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +58 -0
- package/skill/references/integration/modules/code-examples/csharp/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +128 -0
- package/skill/references/integration/modules/code-examples/csharp/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.cs +500 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +72 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +80 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +78 -0
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
- package/skill/references/integration/modules/code-examples/java/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +66 -0
- package/skill/references/integration/modules/code-examples/java/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +135 -0
- package/skill/references/integration/modules/code-examples/java/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemoController.java +610 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +51 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +57 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +55 -0
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +54 -0
- package/skill/references/integration/modules/code-examples/nodejs/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
- package/skill/references/integration/modules/code-examples/nodejs/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
- package/skill/references/integration/modules/code-examples/nodejs/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.js +461 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +59 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +67 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +66 -0
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
- package/skill/references/integration/modules/code-examples/php/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +56 -0
- package/skill/references/integration/modules/code-examples/php/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +107 -0
- package/skill/references/integration/modules/code-examples/php/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.php +444 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +57 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +63 -0
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +62 -0
- package/skill/references/integration/modules/code-examples/python/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +48 -0
- package/skill/references/integration/modules/code-examples/python/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +43 -0
- package/skill/references/integration/modules/code-examples/python/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.py +465 -0
- package/skill/references/integration/modules/interface-guide.md +90 -0
- package/skill/references/integration/modules/product-decision.md +90 -0
- package/skill/references/integration/modules/sandbox/a2m-sandbox-test.md +270 -0
- package/skill/references/integration/modules/sandbox/alipay-sandbox-tool.md +133 -0
- package/skill/references/integration/modules/sandbox/sandbox-setup-guide.md +218 -0
- package/skill/references/integration/modules/scripts/local_402_sandbox_pay.py +659 -0
- package/skill/references/normal/alipay-cli-env.md +211 -0
- package/skill/references/normal/rejection-guide.md +37 -0
- package/skill/references/normal/scripts/common.sh +32 -0
- package/skill/references/normal/scripts/detect_dev_tool.sh +46 -0
- package/skill/references/onboarding/flow.md +571 -0
- package/skill/references/onboarding/modules/app-release.md +411 -0
- package/skill/references/onboarding/modules/authorization.md +269 -0
- package/skill/references/onboarding/modules/error-handling.md +247 -0
- package/skill/references/onboarding/modules/mcc-reference.md +209 -0
- package/skill/references/onboarding/modules/product-sign.md +304 -0
- package/skill/references/onboarding/modules/scripts/app.sh +705 -0
- package/skill/references/onboarding/modules/scripts/ar_sign_apply.sh +248 -0
- package/skill/references/onboarding/modules/scripts/auth.sh +505 -0
- package/skill/references/onboarding/modules/scripts/error_handler.sh +312 -0
- package/skill/references/onboarding/modules/scripts/query_sign_status.sh +146 -0
- package/skill/references/onboarding/modules/scripts/service.sh +267 -0
- package/skill/references/onboarding/modules/scripts/upload_screenshots.sh +152 -0
- package/skill/references/onboarding/modules/service-registration.md +294 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Alipay CLI 环境准备
|
|
2
|
+
|
|
3
|
+
> 本文档定义 alipay-cli 的检测、安装、验证规范,供集成流程和签约流程统一引用。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. CLI 检测
|
|
8
|
+
|
|
9
|
+
### 1.1 检测命令
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# 推荐:一步检测
|
|
13
|
+
which alipay-cli 2>/dev/null && alipay-cli version
|
|
14
|
+
|
|
15
|
+
# 或:分步检测
|
|
16
|
+
if ! alipay-cli version &>/dev/null; then
|
|
17
|
+
echo "⚠️ alipay-cli 未安装"
|
|
18
|
+
fi
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 1.2 检测时机
|
|
22
|
+
|
|
23
|
+
**必须在以下操作前执行 CLI 检测:**
|
|
24
|
+
- 执行 `whoami` 检查登录状态前
|
|
25
|
+
- 执行 `login` 登录授权前
|
|
26
|
+
- 执行任何 MCP 调用前
|
|
27
|
+
- 执行沙箱创建操作前
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 2. 沙箱化 Agent 网络权限规则
|
|
32
|
+
|
|
33
|
+
在存在网络沙箱或命令审批机制的 Agent 环境中,默认命令可能运行在无外网的受限沙箱内。`alipay-cli` 访问支付宝服务必须联网,若先在受限沙箱内执行,容易出现“网络连接失败”后再重试的差体验。
|
|
34
|
+
|
|
35
|
+
**应按联网命令处理的命令:**
|
|
36
|
+
- `alipay-cli login`、`alipay-cli whoami`、`alipay-cli logout`
|
|
37
|
+
- `alipay-cli mcp call ...`
|
|
38
|
+
- `alipay-cli file upload ...`
|
|
39
|
+
- `curl -fsSL https://opengw.alipay.com/alipaycli/install | bash`
|
|
40
|
+
- 按量付费沙箱测试中会访问用户服务或沙箱收银接口的 `local_402_sandbox_pay.py`
|
|
41
|
+
|
|
42
|
+
**执行要求:**
|
|
43
|
+
- 对已知需要联网的命令,如果当前 Agent 环境网络受限且支持显式授权,应首次执行即申请可联网权限,不要先在受限沙箱内试跑。
|
|
44
|
+
- 若命令已经因网络失败,重试时必须复用同一条命令并申请可联网权限;不要把该失败解释为用户网络故障。
|
|
45
|
+
- 本地纯解析、文件检查、`bash -n`、`jq` 校验等不联网命令仍可在默认沙箱内执行。
|
|
46
|
+
|
|
47
|
+
**减少重复授权:**
|
|
48
|
+
- 优先执行 Skill 内置脚本,例如 `bash modules/scripts/auth.sh ...`、`bash modules/scripts/app.sh ...`、`bash modules/scripts/service.sh ...`,不要把每次 `alipay-cli mcp call` 都展开成新的长命令。
|
|
49
|
+
- 在支持前缀持久授权的工具中,申请可联网权限时使用稳定命令前缀作为授权范围,例如 `bash modules/scripts/auth.sh` 或 `bash modules/scripts/app.sh`。同一脚本后续不同参数更容易复用授权。
|
|
50
|
+
- 避免用 `DEV_TOOL_NAME=<tool> bash ...`、`PLATFORM=<tool> alipay-cli ...` 作为常规调用形态;这类环境变量前缀会让授权规则更难复用。签约脚本会通过公共初始化设置 `DEV_TOOL_NAME`,直接执行脚本即可。
|
|
51
|
+
- 产品上下文优先通过脚本参数传入,例如 `--sales-code`、`--mcc-code`、`--product-type`;不要用 `PRODUCT_TYPE=... SALES_CODE=... bash ...` 作为常规调用形态。
|
|
52
|
+
- 只有脚本未覆盖的临时排查命令,才直接调用 `alipay-cli`;这类命令需要按具体前缀单独授权。
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. 前置依赖:GPG 与 jq
|
|
57
|
+
|
|
58
|
+
安装脚本需要 GPG 签名验证,先检查:
|
|
59
|
+
```bash
|
|
60
|
+
which gpg 2>/dev/null
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
未安装时先安装 GPG:
|
|
64
|
+
|
|
65
|
+
| 操作系统 | 安装命令 |
|
|
66
|
+
|----------|----------|
|
|
67
|
+
| macOS | `brew install gnupg`(或使用国内镜像源) |
|
|
68
|
+
| Linux (Debian/Ubuntu) | `sudo apt-get install -y gnupg` |
|
|
69
|
+
| Linux (CentOS/RHEL) | `sudo yum install -y gnupg2` |
|
|
70
|
+
|
|
71
|
+
> ⚠️ macOS 如遇下载慢,可只切换 Homebrew bottle 下载源,并跳过自动更新。`npx -y @alipay/alipay-aipay@latest install` 会按以下顺序自动重试:清华 → 阿里云 → 中科大 → 直连。
|
|
72
|
+
>
|
|
73
|
+
> 手动执行时可任选一个镜像源,例如清华:
|
|
74
|
+
> ```bash
|
|
75
|
+
> export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
|
76
|
+
> export HOMEBREW_NO_AUTO_UPDATE=1
|
|
77
|
+
> export HOMEBREW_NO_INSTALL_CLEANUP=1
|
|
78
|
+
> brew install gnupg
|
|
79
|
+
> ```
|
|
80
|
+
>
|
|
81
|
+
> 可替换的 bottle 镜像源:
|
|
82
|
+
> - 清华:`https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles`
|
|
83
|
+
> - 阿里云:`https://mirrors.aliyun.com/homebrew-bottles`
|
|
84
|
+
> - 中科大:`https://mirrors.ustc.edu.cn/homebrew-bottles`
|
|
85
|
+
>
|
|
86
|
+
> 不要额外设置 `HOMEBREW_API_DOMAIN`;formula 索引保持使用 Homebrew 默认 API,避免镜像索引不完整导致安装失败。
|
|
87
|
+
|
|
88
|
+
签约脚本需要 jq 解析 JSON,先检查:
|
|
89
|
+
```bash
|
|
90
|
+
jq --version
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
未安装时先安装 jq:
|
|
94
|
+
|
|
95
|
+
| 操作系统 | 安装命令 |
|
|
96
|
+
|----------|----------|
|
|
97
|
+
| macOS | `brew install jq` |
|
|
98
|
+
| Linux (Debian/Ubuntu) | `sudo apt-get install -y jq` |
|
|
99
|
+
| Linux (CentOS/RHEL) | `sudo yum install -y jq` |
|
|
100
|
+
|
|
101
|
+
> ⚠️ macOS 如遇下载慢,可与 GPG 使用同一套 Homebrew bottle 下载源配置。`npx -y @alipay/alipay-aipay@latest install` 会按以下顺序自动重试:清华 → 阿里云 → 中科大 → 直连。
|
|
102
|
+
>
|
|
103
|
+
> 手动执行时可任选一个镜像源,例如清华:
|
|
104
|
+
> ```bash
|
|
105
|
+
> export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
|
106
|
+
> export HOMEBREW_NO_AUTO_UPDATE=1
|
|
107
|
+
> export HOMEBREW_NO_INSTALL_CLEANUP=1
|
|
108
|
+
> brew install jq
|
|
109
|
+
> ```
|
|
110
|
+
>
|
|
111
|
+
> 可替换的 bottle 镜像源:
|
|
112
|
+
> - 清华:`https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles`
|
|
113
|
+
> - 阿里云:`https://mirrors.aliyun.com/homebrew-bottles`
|
|
114
|
+
> - 中科大:`https://mirrors.ustc.edu.cn/homebrew-bottles`
|
|
115
|
+
>
|
|
116
|
+
> 不要额外设置 `HOMEBREW_API_DOMAIN`;formula 索引保持使用 Homebrew 默认 API,避免镜像索引不完整导致安装失败。
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 4. CLI 安装
|
|
121
|
+
|
|
122
|
+
### 4.1 自动安装
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
curl -fsSL https://opengw.alipay.com/alipaycli/install | bash
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 4.2 权限问题处理
|
|
129
|
+
|
|
130
|
+
安装脚本默认写入 `/usr/local/bin`,可能需要 sudo 权限。若提示权限不足:
|
|
131
|
+
```bash
|
|
132
|
+
# 方案一:使用 sudo
|
|
133
|
+
sudo curl -fsSL https://opengw.alipay.com/alipaycli/install | bash
|
|
134
|
+
|
|
135
|
+
# 方案二:修复目录权限
|
|
136
|
+
sudo chown -R $(whoami) /usr/local/bin
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 4.3 安装验证
|
|
140
|
+
|
|
141
|
+
安装后执行以下命令确认安装成功:
|
|
142
|
+
```bash
|
|
143
|
+
alipay-cli version
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
若提示 `command not found`,尝试以下方案:
|
|
147
|
+
```bash
|
|
148
|
+
# 方案一:刷新 PATH
|
|
149
|
+
source ~/.zshrc # macOS zsh
|
|
150
|
+
source ~/.bashrc # Linux/bash
|
|
151
|
+
|
|
152
|
+
# 方案二:使用绝对路径
|
|
153
|
+
~/.local/bin/alipay-cli version
|
|
154
|
+
/usr/local/bin/alipay-cli version
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 5. 环境检测结果不透出规范
|
|
160
|
+
|
|
161
|
+
> ⚠️ **强制规范:检测结果仅供内部使用,禁止向用户输出!**
|
|
162
|
+
|
|
163
|
+
AI 编程工具检测使用通用脚本 `scripts/detect_dev_tool.sh`。shell 脚本通过 `scripts/common.sh` 提供的 `init_dev_tool_name` 初始化 `DEV_TOOL_NAME`,再用于设置 `PLATFORM` 上下文;文档示例或非 shell 流程可直接参考 `detect_dev_tool.sh` 的输出。
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
❌ 禁止:向用户输出"环境检查完成,检测到您正在使用 Claude Code 环境"等检测结果
|
|
167
|
+
❌ 禁止:向用户透出任何关于 AI 编程工具检测的信息
|
|
168
|
+
✅ 正确:检测结果仅供内部使用,只用于设置 PLATFORM 环境变量
|
|
169
|
+
✅ 正确:静默完成检测,直接进入下一步流程
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 6. 检测与安装流程图
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
开始
|
|
178
|
+
↓
|
|
179
|
+
检测 alipay-cli 是否存在
|
|
180
|
+
↓
|
|
181
|
+
┌───┐ 是否存在? ├──是→ 验证版本 → 继续下一步
|
|
182
|
+
│ │ │
|
|
183
|
+
│ ↓ │
|
|
184
|
+
│ 不存在 │
|
|
185
|
+
│ │ │
|
|
186
|
+
│ ↓ │
|
|
187
|
+
│ 检测 GPG ────┼──无→ 安装 GPG → 安装 CLI
|
|
188
|
+
│ ↓ │
|
|
189
|
+
│ 有 GPG │
|
|
190
|
+
│ ↓ │
|
|
191
|
+
│ 执行安装脚本 │
|
|
192
|
+
│ ↓ │
|
|
193
|
+
│ 安装失败? ───┼──是→ 尝试 sudo 或 提示手动安装
|
|
194
|
+
│ ↓ │
|
|
195
|
+
│ 成功 │
|
|
196
|
+
│ ↓ │
|
|
197
|
+
│ 验证安装结果 │
|
|
198
|
+
↓
|
|
199
|
+
继续下一步
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 7. 错误处理
|
|
205
|
+
|
|
206
|
+
| 错误场景 | 处理方式 |
|
|
207
|
+
|----------|----------|
|
|
208
|
+
| CLI 不存在 | 自动安装 |
|
|
209
|
+
| 安装失败(权限) | 提示使用 sudo 或手动安装 |
|
|
210
|
+
| 安装后找不到命令 | 提示刷新 PATH 或使用绝对路径 |
|
|
211
|
+
| 版本过旧 | 提示更新 CLI |
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 拒绝引导话术
|
|
2
|
+
|
|
3
|
+
> 本文件定义当用户咨询本 Skill 不支持的支付产品时的标准引导话术。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 标准拒绝引导
|
|
8
|
+
|
|
9
|
+
当用户提及以下不支持的产品时,必须使用以下统一话术:
|
|
10
|
+
|
|
11
|
+
> 抱歉,本 Skill 仅支持按量付费、网站支付、APP支付三种产品。
|
|
12
|
+
> - 如需了解其他支付产品,请查阅 [支付宝开放平台在线文档](https://open.alipay.com?form=payskill)
|
|
13
|
+
> - 如需集成传统支付产品(JSAPI、当面付、订单码、预授权、商家扣款等),可下载 [alipay-payment-integration Skill](https://github.com/alipay/ai/tree/main/skills) 进行接入
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 适用场景
|
|
18
|
+
|
|
19
|
+
| 用户提及的产品 | 引导方式 |
|
|
20
|
+
|---------------|----------|
|
|
21
|
+
| 预授权支付 | 使用标准引导 |
|
|
22
|
+
| 商家扣款 | 使用标准引导 |
|
|
23
|
+
| 订单码支付 | 使用标准引导 |
|
|
24
|
+
| 当面付 | 使用标准引导 |
|
|
25
|
+
| JSAPI支付 | 使用标准引导 |
|
|
26
|
+
|
|
27
|
+
> “手机网站支付”“H5支付”只是用户对手机浏览器网页场景的叫法,在本 Skill 中统一归为**网站支付**,不作为独立产品处理,也不使用拒绝话术。
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 调用位置
|
|
32
|
+
|
|
33
|
+
本话术在以下位置被引用:
|
|
34
|
+
- `SKILL.md` → 意图识别 → 拒绝处理
|
|
35
|
+
- `../integration/modules/product-decision.md` → 不支持的产品
|
|
36
|
+
|
|
37
|
+
**重要**:如需修改引导内容,**仅需修改本文件**,其他引用位置会自动生效。
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#=============================================================================
|
|
3
|
+
# 脚本名称: common.sh
|
|
4
|
+
# 功能描述: 集成流程和签约流程共用的 shell 基础函数
|
|
5
|
+
# 调用前置: 无
|
|
6
|
+
#=============================================================================
|
|
7
|
+
|
|
8
|
+
require_command() {
|
|
9
|
+
if ! command -v "$1" >/dev/null 2>&1; then
|
|
10
|
+
echo "❌ 缺少依赖命令: $1"
|
|
11
|
+
return 1
|
|
12
|
+
fi
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
init_dev_tool_name() {
|
|
16
|
+
if [ -n "${DEV_TOOL_NAME:-}" ] && [ "$DEV_TOOL_NAME" != "unknown" ]; then
|
|
17
|
+
export DEV_TOOL_NAME
|
|
18
|
+
return
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
local COMMON_DIR
|
|
22
|
+
COMMON_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
23
|
+
local DETECT_SCRIPT="${COMMON_DIR}/detect_dev_tool.sh"
|
|
24
|
+
|
|
25
|
+
if [ -f "$DETECT_SCRIPT" ]; then
|
|
26
|
+
# shellcheck source=/dev/null
|
|
27
|
+
source "$DETECT_SCRIPT"
|
|
28
|
+
DEV_TOOL_NAME="$(detect_dev_tool 2>/dev/null || echo unknown)"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
export DEV_TOOL_NAME="${DEV_TOOL_NAME:-unknown}"
|
|
32
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#=============================================================================
|
|
3
|
+
# 脚本名称: detect_dev_tool.sh
|
|
4
|
+
# 功能描述: 智能识别 AI 编程工具,返回工具名称
|
|
5
|
+
# 调用位置: 集成流程和签约流程的环境检查
|
|
6
|
+
# 调用前置: 无
|
|
7
|
+
# 返回值: coze | meoo | claudeCode | codex | traeSolo | cursor | qoder | unknown
|
|
8
|
+
#=============================================================================
|
|
9
|
+
|
|
10
|
+
detect_dev_tool() {
|
|
11
|
+
if [ -n "$COZE_PROJECT_ID" ]; then
|
|
12
|
+
echo "coze"
|
|
13
|
+
return
|
|
14
|
+
fi
|
|
15
|
+
if [ -n "$MEOO_PROJECT_ID" ]; then
|
|
16
|
+
echo "meoo"
|
|
17
|
+
return
|
|
18
|
+
fi
|
|
19
|
+
if [ -n "$CLAUDECODE" ] || [ -n "$CLAUDE_CODE_ENTRYPOINT" ]; then
|
|
20
|
+
echo "claudeCode"
|
|
21
|
+
return
|
|
22
|
+
fi
|
|
23
|
+
if [ -n "$CODEX_CI" ] || [ -n "$CODEX_THREAD_ID" ]; then
|
|
24
|
+
echo "codex"
|
|
25
|
+
return
|
|
26
|
+
fi
|
|
27
|
+
if [ -n "$TRAE_BRAND_NAME" ]; then
|
|
28
|
+
echo "traeSolo"
|
|
29
|
+
return
|
|
30
|
+
fi
|
|
31
|
+
if [ -n "$CURSOR_AGENT" ] || [ -n "$CURSOR_LAYOUT" ]; then
|
|
32
|
+
echo "cursor"
|
|
33
|
+
return
|
|
34
|
+
fi
|
|
35
|
+
if [ -n "$QODER_CLI" ]; then
|
|
36
|
+
echo "qoder"
|
|
37
|
+
return
|
|
38
|
+
fi
|
|
39
|
+
echo "unknown"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# 仅在直接执行时输出,被 source 时不执行
|
|
43
|
+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
44
|
+
DEV_TOOL_NAME=$(detect_dev_tool)
|
|
45
|
+
echo "$DEV_TOOL_NAME"
|
|
46
|
+
fi
|