init: ops-assistant codebase

This commit is contained in:
OpenClaw Agent
2026-03-19 21:23:28 +08:00
commit 81deba4766
94 changed files with 10767 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Module Adapter Template
目标:新功能模块以最小改动接入 `ops-assistant`
## 必备文件
- `internal/module/<name>/module.go`
- `runbooks/<name>_*.yaml`
## 推荐实现
1.`module.go` 内解析命令前缀(如 `/cf`
2. 构建 `core/module.Request`
3. 统一调用 `core/module.Runner.Run(...)`
4. 所有 gateflag/confirm/dry-run通过 `Request.Gate` 声明
## 最小示例(伪代码)
```go
req := coremodule.Request{
RunbookName: "cf_dns_upsert",
Inputs: map[string]string{"zone": zone, "name": name},
Meta: runbook.RunMeta{Target:"cf", RiskLevel:"medium"},
Gate: coremodule.Gate{NeedFlag:"allow_cf_write", RequireConfirm:true, ExpectedToken:"YES_CF", AllowDryRun:true},
DryRun: dryRun,
ConfirmToken: confirm,
}
jobID, out, err := runner.Run(cmd.Raw, userID, req)
```
## 接入检查
- [ ] 命令不直接执行 shell/ssh
- [ ] 使用统一 Runner
- [ ] 风险操作有 Gate
- [ ] 返回 job_id 可追踪
- [ ] runbook step 可审计