@shiyuhang0/ticloud-oncall 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,52 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @shiyuhang0/ticloud-oncall
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TiDB Cloud oncall plugin for [opencode](https://opencode.ai).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
- `ticloud` 主协调 agent
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
10
|
-
-
|
|
7
|
+
- `ticloud` — 主协调 agent,自动编排日志分析和元数据查询
|
|
8
|
+
- `log-analyzer` — Loki 日志分析 subagent
|
|
9
|
+
- `metadata-querier` — 集群元数据查询 subagent
|
|
10
|
+
- `clinic_cluster_query` — Clinic 集群元数据查询 tool
|
|
11
|
+
- `loki_log_query` — Loki 直连日志查询 tool
|
|
12
|
+
- 循环检测 — 自动检测重复 tool 调用并中断
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
## Quickstart
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
- `explore` 只应搜索从 `REPO_ROOTS` 缩小出的候选 repo,不应盲搜整个 workspace
|
|
16
|
+
### 1. Install
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
2. 在 opencode plugin 参数里配置:`CLINIC_API_KEY`、`CLINIC_ENV`、`REPO_ROOTS`
|
|
21
|
-
3. 构建:`npm run build`
|
|
22
|
-
4. 在 opencode 配置中加载 `dist/src/index.js`
|
|
23
|
-
|
|
24
|
-
日志查询规则摘要:
|
|
18
|
+
```bash
|
|
19
|
+
npm install @shiyuhang0/ticloud-oncall
|
|
20
|
+
```
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
- 先 `labels`,再 `label_values`,最后 `query_range`
|
|
28
|
-
- 先宽搜,再窄搜
|
|
29
|
-
- 单次查询时间范围必须在 30 天内
|
|
22
|
+
### 2. Configure opencode
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
在 opencode 配置文件中加载 plugin:
|
|
32
25
|
|
|
33
26
|
```json
|
|
34
27
|
{
|
|
35
|
-
"plugin": [
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
"plugin": [
|
|
29
|
+
["@shiyuhang0/ticloud-oncall", {
|
|
30
|
+
"CLINIC_API_KEY": "<your-clinic-api-key>",
|
|
31
|
+
"CLINIC_ENV": "prod",
|
|
32
|
+
"REPO_ROOTS": [
|
|
33
|
+
"/Users/you/github/tidb-cloud",
|
|
34
|
+
"/Users/you/github/platform-services"
|
|
35
|
+
]
|
|
36
|
+
}]
|
|
37
|
+
]
|
|
43
38
|
}
|
|
44
39
|
```
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
### 3. Use
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Analyze cluster 10004146697249526430 for recent errors.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
结合代码搜索:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
Diagnose issue INC-1234.
|
|
51
|
+
Cluster ID: 10004146697249526430
|
|
52
|
+
Use metadata and logs to narrow candidate repos from REPO_ROOTS.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
| Key | Required | Default | Description |
|
|
58
|
+
|-----|----------|---------|-------------|
|
|
59
|
+
| `CLINIC_API_KEY` | Yes | — | Clinic API key |
|
|
60
|
+
| `CLINIC_ENV` | No | `prod` | Clinic environment |
|
|
61
|
+
| `REPO_ROOTS` | No | `[]` | Local repo paths for code search |
|
|
62
|
+
|
|
63
|
+
## Constraints
|
|
64
|
+
|
|
65
|
+
- 日志查询必须先 `labels` / `label_values`,再宽搜,再窄搜
|
|
66
|
+
- 单次 Loki 查询时间范围不超过 30 天
|
|
67
|
+
- `explore` 只应搜索从 `REPO_ROOTS` 中缩小后的候选 repo
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install
|
|
73
|
+
npm run build
|
|
74
|
+
npm test
|
|
75
|
+
npm run typecheck
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Publish
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm publish --access public
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Docs
|
|
47
85
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
- 实现计划:`docs/superpowers/plans/2026-06-03-ticloud-oncall-plugin.md`
|
|
52
|
-
- 使用部署:`docs/guides/ticloud-oncall-plugin-usage.md`
|
|
86
|
+
- [Architecture & Highlights](docs/architecture/overview-and-highlights.md)
|
|
87
|
+
- [Design](docs/architecture/ticloud-oncall-plugin-design.md)
|
|
88
|
+
- [Usage Guide](docs/guides/ticloud-oncall-plugin-usage.md)
|