@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.
Files changed (2) hide show
  1. package/README.md +73 -37
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,52 +1,88 @@
1
- # TiCloud Oncall Plugin
1
+ # @shiyuhang0/ticloud-oncall
2
2
 
3
- 这是一个接入 opencode 的本地 plugin 项目,用于内部 oncall 场景。
3
+ TiDB Cloud oncall plugin for [opencode](https://opencode.ai).
4
4
 
5
- 当前版本提供:
5
+ ## Features
6
6
 
7
- - `ticloud` 主协调 agent
8
- - `clinic_cluster_query` 集群元数据查询 tool
9
- - `loki_log_query` Loki 直连日志查询 tool
10
- - 复用 opencode 内置 `explore` subagent 做本地代码搜索
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
- - 当需要代码证据时,用户应提供 `REPO_ROOTS`
15
- - `explore` 只应搜索从 `REPO_ROOTS` 缩小出的候选 repo,不应盲搜整个 workspace
16
+ ### 1. Install
16
17
 
17
- ## Setup
18
-
19
- 1. 安装依赖:`npm install`
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
- - 只走 Loki 直连 API
27
- - 先 `labels`,再 `label_values`,最后 `query_range`
28
- - 先宽搜,再窄搜
29
- - 单次查询时间范围必须在 30 天内
22
+ ### 2. Configure opencode
30
23
 
31
- ## opencode config
24
+ opencode 配置文件中加载 plugin:
32
25
 
33
26
  ```json
34
27
  {
35
- "plugin": [["./dist/src/index.js", {
36
- "CLINIC_API_KEY": "<your-clinic-api-key>",
37
- "CLINIC_ENV": "prod", // optional,defauts to "prod"
38
- "REPO_ROOTS": [
39
- "/Users/you/github/tidb-cloud",
40
- "/Users/you/github/platform-services"
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
- - quickstart:`docs/guides/quickstart.md`
49
- - 架构与亮点:`docs/architecture/overview-and-highlights.md`
50
- - 设计说明:`docs/architecture/ticloud-oncall-plugin-design.md`
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shiyuhang0/ticloud-oncall",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TiDB Cloud oncall plugin for opencode",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",