Add Agent Skills documentation and implement g3fo-bug-finder skill

- Created README.md to introduce the Agent Skills repository and its functionalities.
- Added g3fo-bug-finder skill with detailed SKILL.md for automated bug diagnosis on remote servers.
- Included service inventory reference for mapping services to server configurations.
- Implemented scripts for fetching logs and configurations from remote servers using SSH and Nacos API.
- Provided usage instructions and environment setup for Python dependencies.
This commit is contained in:
2026-01-16 17:56:29 +08:00
parent 02bf619c65
commit b88e934f86
5 changed files with 84 additions and 4 deletions
@@ -0,0 +1,56 @@
# Service Inventory (服务清单)
此文件定义了服务、错误码、端口以及远程服务器之间的映射关系。Agent 将参考此文件来决定连接哪台服务器以及如何提取日志。
## 服务详细信息表
> **提示**: 所有服务均部署在开发环境的以下两台服务器上:
> - **Server A**: `192.168.3.200` (User: `root`, Pass: `afe1234`)
> - **Server B**: `192.168.3.230` (User: `root`, Pass: `afe1234`)
| 服务名称 | 服务编号 | Redis DB | 错误码起始 | HTTP 端口 | Dubbo 端口 | Docker 服务名 | 日志路径模版 |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| `gateway` | 0 | 0 | 13000 | - | 28000 | `g3fo-gateway-service` | `/data/logs/g3fo-gateway/{level}/{level}.log` |
| `base` | 1 | 1 | 11000 | 18001 | 28001 | `g3fo-base-service` | `/data/logs/g3fo-base/{level}/{level}.log` |
| `user` | 2 | 2 | 12000 | 18002 | 28002 | `g3fo-user-service` | `/data/logs/g3fo-user/{level}/{level}.log` |
| `admin` | 3 | 3 | 15000 | 18003 | 28003 | `g3fo-admin-service` | `/data/logs/g3fo-admin/{level}/{level}.log` |
| `push` | 4 | 0 | nul | 18004 | - | `g3fo-push-service` | `/data/logs/g3fo-push/{level}/{level}.log` |
| `product` | 6 | 6 | 16000 | 18006 | 28006 | `g3fo-product-service` | `/data/logs/g3fo-product/{level}/{level}.log` |
| `trade` | 7 | 7 | 17000 | 18007 | 28007 | `g3fo-trade-service` | `/data/logs/g3fo-trade/{level}/{level}.log` |
| `notification` | 8 | 8 | 18000 | 18008 | 28008 | `g3fo-notification-service` | `/data/logs/g3fo-notification/{level}/{level}.log` |
| `dx` | 9 | 9 | 19000 | 18009 | 28009 | `g3fo-dx-service` | `/data/logs/g3fo-dx/{level}/{level}.log` |
| `margin` | 10 | 10 | 20000 | 18010 | 28010 | `g3fo-margin-service` | `/data/logs/g3fo-margin/{level}/{level}.log` |
| `utility` | - | - | 21000 | 18012 | 28012 | `g3fo-utility-service` | `/data/logs/g3fo-utility/{level}/{level}.log` |
## 日志获取规则
- **开发环境 (Dev)**: 包含 `192.168.3.200` 和 `192.168.3.230`。
- **Docker 模式**: 服务名遵循 `g3fo-{service}-service` 规则。
- 例如: `gateway` -> `g3fo-gateway-service`
- **文件模式**: 日志路径遵循 `/data/logs/g3fo-{service}/{level}/{level}.log` 规则。
- **支持级别**: `debug`, `error`, `info`, `warn`
## 运维配置参考
- **错误码范围**: 每个服务的错误码通常从“起始编号”开始,步长为 1000(例如 gateway 为 10000-10999)。
- **执行逻辑**: 由于无法确定报错发生的具体机器,**Agent 在接收到指令后应自动依次连接 Server A 和 Server B 提取日志**,并汇总分析。
## 默认服务器配置
- **SSH 目标**: `192.168.3.200`, `192.168.3.230`
- **凭据**: `root / afe1234`
- **Docker Compose 路径**: `/data/docker-compose/g3fo-docker-compose.yml` (默认路径)
## Nacos 配置获取 (HTTP 方式)
可以通过 Nacos 的 OpenAPI 获取配置信息,用于分析配置项(如数据库连接、Redis 地址等)。
- **基础 URL 示例**: `http://{IP}:8848/nacos/v1/cs/configs`
- **默认参数**:
- `tenant`: `dev`
- `group`: `DEFAULT_GROUP`
- **常用 Data ID 列表**:
- 服务专用配置: `g3fo-user-dev.yml`, `g3fo-gateway-dev.yml`, `g3fo-notification-dev.yml` 等
- 公共组件配置: `common.yml`, `dubbo.yml`, `mysql.yml`, `rocketmq.yml`, `redis.yml`
- **获取逻辑**:
1. 依次尝试 Server A (`192.168.3.200`) 和 Server B (`192.168.3.230`)。
2. 如果第一台机器获取成功,则不再尝试第二台。
3. 如果两台都获取失败,则报错。