feat: 模块化命令框架 + runbook 严格断言与查询结果回传
- core/module: 命令模板、门控(feature flag/confirm/dry-run)、ecode 错误标签、ResultFormatter - runbook executor: http.get/http.post/assert.json(expect_success 严格断言)、目标主机管理、任务落库、最终 stdout 直接回传 - cf 模块: /cf dns list 支持域名自动解析 zone_id;dns list/zones/workers list 格式化回传;API success:false 判真失败 - 全部 CF/CPA runbook 接入严格断言,杜绝假阳性 success - 新增 cpa/cfdav/mail/sub 模块与 runbooks;QQ 订阅到期提醒调度 - Web 后台: 模块设置(CF/CPA/cfdav/AI)、OPS 任务、渠道管理、审计页
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Channel Adapter Template
|
||||
|
||||
目标:新通道只做 I/O 适配,不耦合业务执行。
|
||||
|
||||
## 责任边界
|
||||
|
||||
- 接收平台消息并标准化为统一结构
|
||||
- 调用 `ops.Service.Handle(...)` 处理命令
|
||||
- 将文本回复回传到平台
|
||||
|
||||
## 禁止事项
|
||||
|
||||
- 不在通道内直接执行 shell/ssh/http 运维动作
|
||||
- 不在通道内做模块业务判断(应交给 command/module)
|
||||
|
||||
## 最小流程
|
||||
|
||||
1. `Normalize(raw)` -> `UnifiedMessage`
|
||||
2. `handled, out := opsSvc.Handle(msg.OperatorID, msg.Text)`
|
||||
3. `if handled { Reply(out) }`
|
||||
4. 未处理消息再回退到历史业务逻辑(如记账)
|
||||
|
||||
## 接入检查
|
||||
|
||||
- [ ] 仅实现消息适配与回复
|
||||
- [ ] 已接入 opsSvc.Handle
|
||||
- [ ] 未绕过 policy/runbook
|
||||
- [ ] 错误信息对用户可读
|
||||
Reference in New Issue
Block a user