自动化与脚本
当用户明确提到 AEM RDE、aio aem rde 或…
在 Adobe AEM Rapid Development Environments 上通过 @adobe/aio-cli-plugin-aem-rde 进行部署、巡检、日志、快照与故障排查的适用场景。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 59/100 ×0.15
适用场景
当用户明确提到 AEM RDE、aio 特定
解决思路
- 仅在用户明确提到 RDE 概念时启用:AEM RDE、Rapid Development Environment、`aio aem rde`、`aio aem:rde`、`aem-rde`、RDE snapshots、RDE deploy/install、`rde install`、`rde inspect`、`rde status`、`rde history`、`rde reset`、`@adobe/aio-cli-plugin-aem-rde`,或明确针对 RDE 的 Cloud Manager program/environment 配置;否则不要激活。
- 把用户目标翻译为正确的 `aio aem rde` 命令,确定部署 type、target(author/publish)和必要的 post-deploy 步骤。
- 组合 `status`、`history <id>`、`logs`、`inspect` 输出来诊断 RDE 问题。
- 指导 setup/configuration(org/program/env)、local vs global config、experimental feature flags 和 CI/build-environment 用法。
- 指导 snapshot create/restore/delete/undelete 流程,用于 rebase 或备份环境状态。
- 信任用户意图;未经确认不要运行 destructive commands(`reset`、`snapshot delete --all`、force-deletes)。
- 插件包:`@adobe/aio-cli-plugin-aem-rde`(`aio` / Adobe I/O CLI 10.3+ 或 11+ 的 oclif 插件)。
- 安装:`aio plugins:install @adobe/aio-cli-plugin-aem-rde`。
- 更新:`aio plugins:update`。
- 仓库:`https://github.com/adobe/aio-cli-plugin-aem-rde`。
- 主题:`aem:rde` 稳定命令;`aem:rde:inspect` 实验、opt-in;`aem:rde:snapshot` 实验、opt-in。
- 两种写法等价:`aio aem rde …` 和 `aio aem:rde:…`。
- 每个 RDE 命令需要三个 Cloud Manager ID:`cloudmanager_orgid`(IMS organization)、`cloudmanager_programid`(Cloud Manager program)、`cloudmanager_environmentid`(RDE environment id)。
- 交互式配置(推荐给人用):`aio login` 然后 `aio aem rde setup`,按 org → program → env 选择,可选择把配置存到当前工作目录的本地 `.aio` 文件。
- 脚本/CI 配置:`aio config:set cloudmanager_orgid <id>` 等;强烈优先加 `-l`/`--local`,让每个项目固定自己的 RDE,否则 global config 会跨 repo 污染。
- 查看当前配置:`aio aem rde setup --show`。
- 开关桌面通知:`aio aem rde setup --enable-notifications` / `--disable-notifications`。
- 多个 RDE 时始终推荐 local config;参考 `references/configuration.md` 的存储层级和多环境 recipe。
- `inspect` 和 `snapshot` 需要 opt-in flag;未开启时命令存在但不能运行。
- 本地启用 inspect:`aio config set -l -j aem-rde.experimental-features '[\"aem:rde:inspect\"]'`。
- 同时启用 inspect 和 snapshot:`aio config set -l -j aem-rde.experimental-features '[\"aem:rde:inspect\",\"aem:rde:snapshot\"]'`。
- snapshot 还要求客户加入相关 EAP;否则 API 返回 `451 NON_EAP`。
- Stable command:`aio aem rde setup` 交互式 org/program/env picker。
- Stable command:`aio aem rde status` 显示 env state + deployed artifacts(bundles/configs 按 author/publish 分组)。
- Stable command:`aio aem rde install <location>` 部署 bundle/config/content/dispatcher/frontend/env-config artifact(URL 或 path)。
- Stable command:`aio aem rde delete <id>` 移除 bundle(BSN[-version])或 OSGi config(PID)。
- Stable command:`aio aem rde history [id]` 列出最近更新;带 id 时深入查看某次更新的日志。
- Stable command:`aio aem rde logs` tail AEM 日志,支持 logger-level filters 和高亮。
- Stable command:`aio aem rde restart` 重启 author + publish。
- Stable command:`aio aem rde reset` 将 env 重置到 base;long-running,可保留 mutable content。
- Experimental inspect command:`aio aem rde inspect inventory [id]` 列出或获取 inventory(status info)条目。
- Experimental inspect command:`aio aem rde inspect osgi-bundles [id]` 列出或获取单个 OSGi bundle。
- Experimental inspect command:`aio aem rde inspect osgi-components [name]` 列出或获取 OSGi component。
- Experimental inspect command:`aio aem rde inspect osgi-configurations [pid]` 列出或获取 OSGi configuration。
- Experimental inspect command:`aio aem rde inspect osgi-services [id]` 列出或获取 OSGi service。
- Experimental inspect command:`aio aem rde inspect request-logs [id]` 列出 request log entries / 深入查看一条。
- Experimental inspect command:`aio aem rde inspect request-logs enable` 按 target 打开 request logging。
- Experimental inspect command:`aio aem rde inspect request-logs disable` 关闭 request logging。
- Experimental snapshot command:`aio aem rde snapshot` 列出 snapshots(table 按 Last Used 排序)。
- Experimental snapshot command:`aio aem rde snapshot create <name> [-d <desc>]` 创建 content+deployment snapshot(锁定 RDE 2–5 分钟)。
- Experimental snapshot command:`aio aem rde snapshot restore <name> [--only-mutable-content]` 恢复 snapshot;full restore 会重启 RDE。
- Experimental snapshot command:`aio aem rde snapshot delete <name> [-f] [--all]` 标记 snapshot 待删除(7-day retention)或立即清除。
- Experimental snapshot command:`aio aem rde snapshot undelete <name>` 取消待删除。
- 每个命令完整 args/flags 看 `references/commands.md`。
- `-s, --target <author|publish>` 限制到一个实例;`install`/`delete` 默认部署到两者;`inspect`/`logs` 默认 `author`。
- `--organizationId / --programId / --environmentId` 一次性覆盖已存配置(适合 ad-hoc scripts)。
- `-q, --quiet` 无日志输出、无提示;与 `--json` 搭配用于机器消费。
- `--json` 输出 JSON 结果(`setup`、`logs`、`inspect:request-logs:enable/disable` 不支持,它们声明 `enableJsonFlag: false`)。
- `--no-color` 适合 CI 捕获。
- `aio aem rde install <location>` 接受本地路径或公开 URL;`--type` 选择:`osgi-bundle | osgi-config | content-package | content-file | content-xml | dispatcher-config | frontend | env-config`。
- 省略 `--type` 时插件根据扩展名和 zip 内容猜测:`*.jar` -> `osgi-bundle`;`*.json` -> `osgi-config`;包含 `jcr_root/` 的 zip -> `content-package`;包含 `conf.dispatcher.d/` 的 zip -> `dispatcher-config`;含 `dist/` + `package.json` 的 zip -> `frontend`;含任意 `*.yaml` 条目的 zip -> `env-config`;带 `--path` 的 `*.xml` -> `content-xml`;带 `--path` 的其他文件 -> `content-file`。
- 对目录,只有 `frontend`、`dispatcher-config`、`env-config` 可用;插件即时构建 zip;其他类型会明确报错。
- 对 `content-file`/`content-xml`,`--path` 是 JCR repository path;如果源路径位于 `…/jcr_root/…` 下,插件会猜路径;否则显式传入。
- `-r, --restart` 会追加执行 `restart`;默认避免,因为 RDE 几乎都支持 hot deployment;只有 OSGi 或 config 变更确实需要完整重启时使用。
- `-f, --force` 用于前次上传被放弃后解卡环境;少用。
- 用户描述 artifact 时,先推断 type 和 target 再建议命令;看 `references/deployment-types.md` 获取逐类型指引和坑。
- `aio aem rde logs` 打开持续 tail 直到 Ctrl-C;在服务器创建 AEM log configuration,每 500 ms 轮询,输出彩色。
- 按级别传 logger,可重复 flag:`-i org.foo -i org.bar -d com.adobe.aem`;级别为 `-t/--trace`、`-d/--debug`、`-i/--info`、`-w/--warn`、`-e/--error`。
- 未提供 logger 时默认 `-i \"\"`(INFO+)。
- `-H \"<substring>\"` 用白色高亮匹配行(可重复)。
- `-f \"<logback-pattern>\"` 覆盖格式;默认含 timestamp、level、thread、logger、message。
- `--choose` 在已有 log configs 上交互选择(他人已启用时有用)。
- `-s/--target` 默认 `author`;传 `publish` 跟踪 publish leg。
- AEM 每个 env 只允许少量并发 log configs;遇到 `405` 时插件提供移除已有配置。
- 结合 `logs` 与 `status`/`history` 的 triage workflows 看 `references/workflows.md`。
- 插件退出码:`1` generic/uncaught;`2` configuration;`3` flag/argument validation;`4` deployment;`5` internal(可重试);`40` deployment-not-fully-performed(pipeline 中有时可接受)。
- 诊断 playbook 按顺序:1 `aio aem rde setup --show` 确认指向正确 env;2 `aio aem rde status` 检查 env 是否 `Ready`、实际部署了什么;3 `aio aem rde history` 看最近更新并取失败 update id;4 `aio aem rde history <id>` 看该 update 的完整 per-instance log;5 `aio aem rde logs -e \"\" -w \"\"` tail errors+warnings 找新症状;6 若启用,`aio aem rde inspect …` 读 OSGi 状态确认 bundles/components/configs 正确接线。
- `references/troubleshooting.md` 有详细 error → likely-cause → fix 映射,包括 snapshot-specific error codes(`SNAPSHOT_NOT_FOUND`、`SNAPSHOT_LIMIT`、`INVALID_STATE`、`SNAPSHOT_CREATION_STUCK` 等)和 `NON_EAP` / `DIFFERENT_ENV_TYPE` 配置错误。
- 当用户问「How do I deploy X?」:识别 artifact、选择正确 `--type`、决定 author/publish、建议 `install`;只有需要时才指出 `--restart`;type 选择不明显时参考 `deployment-types.md`。
- 当用户问「My deploy failed.」:走上面的 diagnostic playbook;从用户输出里找 update id,没有就询问并让其运行 `history <id>`。
- 当用户问「I want to switch programs/envs.」:建议 `aio aem rde setup`(切换 IMS orgs 时 `aio logout` + `setup`);如果用户管理多个 RDE,推荐 `-l` 存储。
- 当用户问「I want a snapshot.」:确认客户已启用 snapshot EAP,然后指导 create/restore;始终说明预计耗时(create 约 3–8 分钟,restore 约 7–15 分钟),避免用户中断进程。
- 当用户问「Show me what's deployed.」:先 `aio aem rde status`;OSGi 级别细节用 `inspect osgi-bundles`/`osgi-components`/`osgi-configurations`。
- 当用户问「How do I script this in CI?」:推荐对三个 ID 用 `aio config:set -l`,命令用 `--quiet --json`,并警告不要用 `setup`(交互式)。
- 如果问题需要单个命令的深层细节,读取对应 reference 文件,不要猜;描述、flags、error codes 会随 release 漂移。
- 按需读取:`references/commands.md`、`references/configuration.md`、`references/deployment-types.md`、`references/workflows.md`、`references/troubleshooting.md`。
适用边界 · 注意事项
- 不适用于泛化 AEMaaCS 请求(如 deploy to AEM Cloud、push my bundle、tail the publish log、cloud sandbox、未限定 RDE 的 dispatcher-config/frontend/env-config deployments);这些属于 Cloud Manager pipelines,而不是 RDE。
- Beta skill,生产项目应用前必须验证所有输出。
- 缺少 Adobe I/O CLI、Cloud Manager RDE、EAP(snapshot)或付费/Adobe 生态账号时不要使用。