# opsxclaw **Repository Path**: attacker/opsxclaw ## Basic Information - **Project Name**: opsxclaw - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-24 - **Last Updated**: 2026-02-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpsXClaw
![OpsXClaw Logo](docs/logo.png) **强大的运维自动化平台,灵感来源于 OpenClaw** [![Go Version](https://img.shields.io/badge/go-1.21+-00ADD8?style=flat-square&logo=go)](https://golang.org/) [![Vue.js Version](https://img.shields.io/badge/vue.js-3.4+-4FC08D?style=flat-square&logo=vue.js)](https://vuejs.org/) [![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE)
## 功能特性 - **Agent 管理**: 在基础设施中部署和管理分布式 Agent - **技能系统**: 模块化技能扩展功能 - **任务调度**: 类 Cron 的任务调度,支持 Web 界面管理 - **Web 控制台**: 现代化的 Vue3 管理界面 - **消息网关**: Agent 通信的中央枢纽 - **身份认证**: 基于 JWT 的认证和角色权限控制 - **实时通信**: WebSocket 支持实时更新 - **通知渠道**: 支持企业微信、钉钉、飞书、WhatsApp 等多种通知渠道 - **迁移工具**: 从 OpenClaw 轻松迁移 ## 系统架构 ``` ┌─────────────────────────────────────────────────────────────┐ │ OpsXClaw │ ├─────────────────────────────────────────────────────────────┤ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Agent │ │ Gateway │ │ Skills │ │ │ │ (工作者) │ │ (WebSocket)│ │ (模块) │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ ├─────────────────────────────────────────────────────────────┤ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Cron │ │ Auth │ │ Channels │ │ │ │ (调度器) │ │ (JWT/RBAC) │ │ (通知渠道) │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ ├─────────────────────────────────────────────────────────────┤ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ SQLite │ │ MySQL │ │ PostgreSQL │ │ │ │ (默认) │ │ (可选) │ │ (可选) │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ └─────────────────────────────────────────────────────────────┘ ``` ## 快速开始 ### 安装 ```bash # 克隆仓库 git clone https://github.com/opsxclaw/opsxclaw.git cd opsxclaw # 构建项目 make build # 或者手动安装依赖并构建 go mod download cd web && npm install && npm run build cd .. go build -o opsxclaw . ``` ### 初始化设置 ```bash # 运行交互式初始化向导 ./opsxclaw onboard # 或者使用默认配置快速设置 ./opsxclaw onboard --quick ``` ### 启动控制台 ```bash # 启动 Web 控制台 ./opsxclaw dashboard # 访问 http://localhost:8080 ``` ## 命令列表 ``` 命令: onboard 首次命令行交互初始化 dashboard Web 页面管理 agent Agent 交互管理 auth 认证管理 (登录、登出、状态) gateway 启动消息网关 status 显示系统状态 cron 定时任务管理 skills 技能管理 (安装、列表、删除) channels 通知渠道管理 version 显示版本信息 ``` ## 配置 配置文件位置: `~/.opsxclaw/config.yaml` **默认目录结构:** ``` ~/.opsxclaw/ ├── config.yaml # 主配置文件 ├── sqlite3.db # SQLite 数据库 (默认) ├── agent/ # Agent 工作目录 ├── workspace/ # 沙箱工作空间 └── logs/ └── opsxclaw.log # 日志文件 ``` **环境变量:** - `OPSXCLAW_HOME` - 覆盖默认工作目录 - 所有配置项可通过 `OPSXCLAW_<节>_<键>` 覆盖 ```yaml server: host: "0.0.0.0" port: "8080" mode: "release" database: type: "sqlite" path: "sqlite3.db" # 相对于 ~/.opsxclaw/ auth: jwt_secret: "" # 首次运行自动生成 token_expiry: 24 refresh_expiry: 7 agent: enabled: true auto_start: true max_workers: 10 gateway: enabled: false port: "9090" cron: enabled: true worker_count: 5 channels: enabled: true sandbox: enabled: true ``` ## 通知渠道 OpsXClaw 支持多种通知渠道: | 渠道 | 类型 | 说明 | |------|------|------| | 企业微信 | `wecom` | 企业微信机器人/Webhook | | 钉钉 | `dingtalk` | 钉钉机器人/Webhook | | 飞书 | `feishu` | 飞书机器人/Webhook | | WhatsApp | `whatsapp` | WhatsApp Business API | | Telegram | `telegram` | Telegram Bot API | | Email | `email` | SMTP 邮件通知 | | Webhook | `webhook` | 通用 HTTP Webhook | ### 渠道管理 ```bash # 列出所有渠道 opsxclaw channels list # 添加渠道 opsxclaw channels add --type wecom --name "运维告警" --config '{"webhook":"https://..."}' # 测试渠道 opsxclaw channels test --name "运维告警" # 删除渠道 opsxclaw channels remove --name "运维告警" ``` ## 开发 ### 后端开发 ```bash # 开发模式运行后端 go run . dashboard --mode debug # 运行测试 go test ./... # 运行集成测试 ./test/scripts/test_api.sh ./test/scripts/test_channels.sh # 生成 API 文档 make docs ``` ### 前端开发 ```bash cd web # 安装依赖 npm install # 启动开发服务器 npm run dev # 生产构建 npm run build ``` ## 项目结构 ``` opsxclaw/ ├── cmd/ # CLI 命令 │ ├── onboard/ # 初始化向导 │ ├── dashboard/ # 控制台服务 │ ├── agent/ # Agent 命令 │ ├── auth/ # 认证命令 │ ├── gateway/ # 网关服务 │ ├── cron/ # 定时任务管理 │ ├── skills/ # 技能管理 │ ├── channels/ # 渠道管理 │ └── version/ # 版本信息 ├── internal/ # 内部包 │ ├── api/ # REST API 处理 │ ├── agent/ # Agent 核心 │ ├── auth/ # 认证服务 │ ├── config/ # 配置管理 │ ├── cron/ # 定时调度 │ ├── gateway/ # 网关核心 │ ├── logger/ # 日志 │ ├── middleware/ # HTTP 中间件 │ ├── models/ # 数据库模型 │ ├── channels/ # 通知渠道 │ ├── sandbox/ # 沙箱执行 │ └── skills/ # 技能管理 ├── pkg/ # 公共包 │ └── utils/ # 工具函数 ├── test/ # 测试 │ ├── integration/ # 集成测试 │ ├── e2e/ # 端到端测试 │ ├── fixtures/ # 测试数据 │ └── scripts/ # 测试脚本 ├── web/ # Vue3 前端 └── docs/ # 文档 ``` ## OpenClaw 迁移 OpsXClaw 支持从 OpenClaw 自动迁移: 1. 首次运行时自动检测 OpenClaw 安装 2. 自动导入数据库模型 (agents, tasks, cron jobs) 3. 自动导入渠道配置 (企业微信, 钉钉, 飞书等) 4. 自动导入用户账户和凭证 无需手动操作,迁移在启动时自动完成。 ## API 文档 在 debug 模式下访问 `/api/docs` 查看 API 文档。 ### 认证示例 ```bash # 获取 Token curl -X POST http://localhost:8080/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"username":"admin","password":"secret"}' # 使用 Token curl http://localhost:8080/api/v1/agents \ -H "Authorization: Bearer " ``` ## 贡献指南 1. Fork 本仓库 2. 创建功能分支 (`git checkout -b feature/amazing-feature`) 3. 提交更改 (`git commit -m 'Add amazing feature'`) 4. 推送到分支 (`git push origin feature/amazing-feature`) 5. 创建 Pull Request ## 许可证 本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件 ## 致谢 - 灵感来源于 [OpenClaw](https://github.com/openclaw/openclaw) - 使用 [Gin](https://gin-gonic.com/) 和 [Vue3](https://vuejs.org/) 构建 ## 支持 - 文档: https://docs.opsxclaw.io - Issues: https://github.com/opsxclaw/opsxclaw/issues - 讨论区: https://github.com/opsxclaw/opsxclaw/discussions