jsharness 1.11.0 → 1.12.3
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/.harness/README.md +1 -1
- package/.harness/agents/agent-dispatcher.md +66 -349
- package/.harness/agents/gate-controller/contract.yaml +1 -1
- package/.harness/agents/gate-controller/prompt.md +1 -1
- package/.harness/agents/gate-controller.md +1 -1
- package/.harness/agents/project-manager/contract.yaml +1 -1
- package/.harness/agents/project-manager/prompt.md +4 -1
- package/.harness/agents/project-manager.md +1 -1
- package/.harness/agents/requirements-analyst/contract.yaml +1 -1
- package/.harness/agents/requirements-analyst/prompt.md +2 -1
- package/.harness/agents/requirements-analyst.md +1 -1
- package/.harness/agents/solution-designer/contract.yaml +1 -1
- package/.harness/agents/solution-designer/prompt.md +1 -1
- package/.harness/agents/solution-designer.md +1 -1
- package/.harness/agents/tester.md +2 -0
- package/.harness/commands/js/deliver.md +43 -0
- package/.harness/commands/js/explore.md +18 -5
- package/.harness/commands/js/propose.md +4 -4
- package/.harness/doc/originRequirements/origin-main/.gitkeep +0 -0
- package/.harness/doc/prd/.gitkeep +0 -0
- package/.harness/doc/prd/prd-main/.gitkeep +0 -0
- package/.harness/doc/prd/prd-main/README.md +33 -0
- package/.harness/doc/team-guidelines/pm-team.md +1 -1
- package/.harness/doc/ttspec/.gitkeep +0 -0
- package/.harness/doc/ttspec/README.md +3 -3
- package/.harness/mcp/config.yaml +282 -0
- package/.harness/rules/global/design-document-boundary.md +4 -2
- package/.harness/rules/project/frontend-coding-basics.md +519 -0
- package/.harness/skills/design-context-reader/SKILL.md +80 -0
- package/.harness/skills/docker-build/SKILL.md +1 -1
- package/.harness/skills/jsspec-deliver/SKILL.md +134 -0
- package/.harness/skills/{openspec-explore → jsspec-explore}/SKILL.md +35 -13
- package/.harness/skills/{openspec-propose → jsspec-propose}/SKILL.md +31 -16
- package/.harness/skills/{openspec-skill-creator → jsspec-skill-creator}/SKILL.md +17 -17
- package/.harness/skills/test-case-designer/SKILL.md +196 -0
- package/.harness/workflow/definition.yaml +4 -4
- package/.harness/workflow/validate.js +1 -1
- package/files/front-coding-rules.md +665 -0
- package/lib/index.mjs +70 -1
- package/package.json +1 -1
- package/.harness/commands/js/apply.md +0 -31
- package/.harness/commands/js/archive.md +0 -31
- package/.harness/skills/openspec-apply/SKILL.md +0 -90
- package/.harness/skills/openspec-archive/SKILL.md +0 -77
|
@@ -46,10 +46,12 @@ outputFormat: .harness/doc/test-report/test-report-{task-id}.md
|
|
|
46
46
|
3. 记录和跟踪缺陷
|
|
47
47
|
4. 输出完整的测试报告
|
|
48
48
|
5. 评估回归风险
|
|
49
|
+
6. 设计阶段测试用例编写(使用 test-case-designer Skill)
|
|
49
50
|
|
|
50
51
|
## 测试覆盖矩阵
|
|
51
52
|
| 测试类型 | 执行时机 | 负责人 | 必须? | 引用Skill |
|
|
52
53
|
|----------|----------|--------|-------|-----------|
|
|
54
|
+
| 测试用例设计 | 设计阶段 | Tester | ✅ 必须 | test-case-designer |
|
|
53
55
|
| 单元测试 | 开发时 | Developer | ✅ 必须 | test-unit |
|
|
54
56
|
| 静态检查 | 每次 commit | Dev/CI | ✅ 必须 | lint-check |
|
|
55
57
|
| API 集成测试 | PR 前 | Tester | ✅ 必须 | test-api |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deliver
|
|
3
|
+
description: 交付归档命令 — 执行实施+归档的两阶段工作流,调用 jsspec-deliver Skill 执行
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
enabled: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 交付归档命令(deliver)
|
|
9
|
+
|
|
10
|
+
> **触发时机**: propose 产出完成且用户确认设计后
|
|
11
|
+
> **执行 Skill**: `jsspec-deliver`
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 使用方式
|
|
16
|
+
|
|
17
|
+
当用户确认设计方案后,使用本命令进入交付归档阶段。
|
|
18
|
+
|
|
19
|
+
参数:
|
|
20
|
+
- `{name}` — ttspec change 名称
|
|
21
|
+
|
|
22
|
+
## 前置条件
|
|
23
|
+
|
|
24
|
+
- propose 产出已完成(proposal.md、design.md、specs/、tasks.md)
|
|
25
|
+
- 用户已确认设计方案
|
|
26
|
+
- PRD 已生成(如适用)
|
|
27
|
+
|
|
28
|
+
## 执行
|
|
29
|
+
|
|
30
|
+
调用 `jsspec-deliver` Skill 执行两阶段工作流:
|
|
31
|
+
|
|
32
|
+
### Phase 1: 实施任务
|
|
33
|
+
|
|
34
|
+
按 tasks.md 逐步实施,完成后询问用户确认进入归档阶段。
|
|
35
|
+
|
|
36
|
+
### Phase 2: 归档
|
|
37
|
+
|
|
38
|
+
1. 移动 change 目录到 archive/
|
|
39
|
+
2. 移动原始需求到 origin-main/
|
|
40
|
+
3. 移动 PRD 到 prd-main/{module}/
|
|
41
|
+
4. 更新 prd-main/README.md 索引
|
|
42
|
+
|
|
43
|
+
详细执行逻辑详见 `jsspec-deliver` Skill。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: explore
|
|
3
|
-
description: 需求深度探索命令 — 在需求分析阶段进行需求澄清、矛盾发现、方案对比、风险识别,调用
|
|
3
|
+
description: 需求深度探索命令 — 在需求分析阶段进行需求澄清、矛盾发现、方案对比、风险识别,调用 jsspec-explore Skill 执行
|
|
4
4
|
alwaysApply: false
|
|
5
5
|
enabled: true
|
|
6
6
|
---
|
|
@@ -8,7 +8,7 @@ enabled: true
|
|
|
8
8
|
# 需求深度探索命令(explore)
|
|
9
9
|
|
|
10
10
|
> **触发时机**: 收到新需求后、生成任何文档之前
|
|
11
|
-
> **执行 Skill**: `
|
|
11
|
+
> **执行 Skill**: `jsspec-explore`
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -18,14 +18,27 @@ enabled: true
|
|
|
18
18
|
|
|
19
19
|
参数:
|
|
20
20
|
- `{name}` — ttspec change 名称(从原始需求文件名派生,去除日期前缀)
|
|
21
|
+
- 或者用户提供需求文件路径(可选)
|
|
22
|
+
|
|
23
|
+
## 输入源优先级
|
|
24
|
+
|
|
25
|
+
explore 命令按以下顺序查找需求文件:
|
|
26
|
+
|
|
27
|
+
1. **优先扫描 `.harness/doc/originRequirements/`**:列出该目录下所有 `.md` 文件(排除 `README.md`、`.gitkeep` 和 `origin-main/` 子目录)
|
|
28
|
+
- 单个文件 → 自动选择
|
|
29
|
+
- 多个文件 → 列表供用户选择
|
|
30
|
+
2. **回退用户指定路径**:如果 originRequirements/ 下没有需求文件,使用用户提供的文件路径
|
|
31
|
+
3. **提示创建**:如果以上都没有,提示用户 "未找到需求文件。请在 .harness/doc/originRequirements/ 下创建需求文件,或提供需求文件路径"
|
|
21
32
|
|
|
22
33
|
## 前置条件
|
|
23
34
|
|
|
24
|
-
-
|
|
35
|
+
- 需求文件已通过上述输入源优先级逻辑找到
|
|
25
36
|
- 对应的 ttspec change 目录已创建于 `.harness/doc/ttspec/change/{name}/`
|
|
26
37
|
|
|
27
38
|
## 执行
|
|
28
39
|
|
|
29
|
-
调用 `
|
|
40
|
+
调用 `jsspec-explore` Skill 执行深度探索,产出存放于 `.harness/doc/ttspec/change/{name}/explore-notes.md`。
|
|
41
|
+
|
|
42
|
+
**重要**:explore 完成后,**必须**等待用户确认探索结果,禁止自动进入 propose 阶段。详见 `jsspec-explore` Skill 的 Step 5 门禁。
|
|
30
43
|
|
|
31
|
-
详细执行逻辑(四维度探索框架、探索笔记模板、完成判定标准)详见 `
|
|
44
|
+
详细执行逻辑(四维度探索框架、探索笔记模板、完成判定标准)详见 `jsspec-explore` Skill。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: propose
|
|
3
|
-
description: 结构化提案命令 — 基于 explore 探索结果生成 proposal/design/specs/tasks,调用
|
|
3
|
+
description: 结构化提案命令 — 基于 explore 探索结果生成 proposal/design/specs/tasks,调用 jsspec-propose Skill 执行
|
|
4
4
|
alwaysApply: false
|
|
5
5
|
enabled: true
|
|
6
6
|
---
|
|
@@ -8,7 +8,7 @@ enabled: true
|
|
|
8
8
|
# 结构化提案命令(propose)
|
|
9
9
|
|
|
10
10
|
> **触发时机**: explore 步骤完成后
|
|
11
|
-
> **执行 Skill**: `
|
|
11
|
+
> **执行 Skill**: `jsspec-propose`
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -26,6 +26,6 @@ explore 步骤完成后,使用本命令生成结构化提案。
|
|
|
26
26
|
|
|
27
27
|
## 执行
|
|
28
28
|
|
|
29
|
-
调用 `
|
|
29
|
+
调用 `jsspec-propose` Skill 执行结构化提案生成,产出存放于 `.harness/doc/ttspec/change/{name}/`(proposal.md, design.md, specs/, tasks.md)。
|
|
30
30
|
|
|
31
|
-
详细执行逻辑(产出物规范、与 PRD 的衔接)详见 `
|
|
31
|
+
详细执行逻辑(产出物规范、与 PRD 的衔接)详见 `jsspec-propose` Skill。
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# PRD 总仓库
|
|
2
|
+
|
|
3
|
+
本目录是产品需求文档(PRD)的总仓库,按模块组织归档的 PRD 文件。
|
|
4
|
+
|
|
5
|
+
## 目录结构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.harness/doc/prd/prd-main/
|
|
9
|
+
├── README.md # 本文件(自动生成的索引)
|
|
10
|
+
├── general/ # 未识别模块的 PRD 归档
|
|
11
|
+
│ └── requirements-{name}.md
|
|
12
|
+
├── user-module/ # 用户模块 PRD
|
|
13
|
+
│ └── requirements-{name}.md
|
|
14
|
+
└── order-module/ # 订单模块 PRD
|
|
15
|
+
└── requirements-{name}.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 模块索引
|
|
19
|
+
|
|
20
|
+
| 模块 | 路径 | PRD 文件 |
|
|
21
|
+
|------|------|---------|
|
|
22
|
+
| general | `general/` | 未识别模块的 PRD |
|
|
23
|
+
|
|
24
|
+
> 本索引由归档流程自动更新。每次 PRD 归档时,会追加或更新对应的模块行。
|
|
25
|
+
|
|
26
|
+
## 归档规则
|
|
27
|
+
|
|
28
|
+
1. 归档时从 PRD 文件的"涉及产品线/模块"字段提取模块名
|
|
29
|
+
2. 如果有模块信息 → 移动到 `prd-main/{module}/`
|
|
30
|
+
3. 如果没有模块信息 → 移动到 `prd-main/general/`
|
|
31
|
+
4. 归档后自动更新本 README 的模块索引表
|
|
32
|
+
|
|
33
|
+
> 本目录由 Harness Engineering 系统管理。
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ttspec — 变更规格管理目录
|
|
2
2
|
|
|
3
|
-
本目录用于存放 Harness 流程中
|
|
3
|
+
本目录用于存放 Harness 流程中 JSSpec 的产出物,包括变更管理(change)和能力规格(specs)。
|
|
4
4
|
|
|
5
5
|
## 目录结构
|
|
6
6
|
|
|
@@ -25,9 +25,9 @@ change 名称从原始需求文件名派生:去除日期前缀,保留 kebab-
|
|
|
25
25
|
|
|
26
26
|
示例:需求文件 `2026-05-22-user-avatar-upload.md` → change 名 `user-avatar-upload`
|
|
27
27
|
|
|
28
|
-
## 与
|
|
28
|
+
## 与 jsspec/ 的关系
|
|
29
29
|
|
|
30
|
-
- `
|
|
30
|
+
- `jsspec/` — JSSpec 原生操作目录(历史数据保持不动)
|
|
31
31
|
- `.harness/doc/ttspec/` — Harness 流程中的变更管理产出目录
|
|
32
32
|
|
|
33
33
|
> 本目录由 Harness Engineering 系统管理。
|
package/.harness/mcp/config.yaml
CHANGED
|
@@ -34,6 +34,34 @@ mcp_server:
|
|
|
34
34
|
credentials_ref: "DOCKER_REGISTRY_TOKEN"
|
|
35
35
|
enabled: false # 阶段二才启用
|
|
36
36
|
|
|
37
|
+
# === 基础设施系统 ===
|
|
38
|
+
nacos:
|
|
39
|
+
type: "nacos_api"
|
|
40
|
+
base_url: "${NACOS_ADDR:http://localhost:8848}"
|
|
41
|
+
username_ref: "NACOS_USERNAME" # 环境变量注入,禁止硬编码
|
|
42
|
+
password_ref: "NACOS_PASSWORD"
|
|
43
|
+
enabled: true
|
|
44
|
+
description: "Nacos 3.0 — 服务注册发现 + 配置管理"
|
|
45
|
+
|
|
46
|
+
mysql:
|
|
47
|
+
type: "mysql_api"
|
|
48
|
+
host: "${MYSQL_HOST:localhost}"
|
|
49
|
+
port: "${MYSQL_PORT:3306}"
|
|
50
|
+
database: "${MYSQL_DATABASE:jieshun}"
|
|
51
|
+
username_ref: "MYSQL_USERNAME"
|
|
52
|
+
password_ref: "MYSQL_PASSWORD"
|
|
53
|
+
enabled: true
|
|
54
|
+
description: "MySQL 8.0 — 主数据存储(utf8mb4)"
|
|
55
|
+
|
|
56
|
+
redis:
|
|
57
|
+
type: "redis_api"
|
|
58
|
+
host: "${REDIS_HOST:localhost}"
|
|
59
|
+
port: "${REDIS_PORT:6379}"
|
|
60
|
+
password_ref: "REDIS_PASSWORD"
|
|
61
|
+
database: "${REDIS_DATABASE:0}"
|
|
62
|
+
enabled: true
|
|
63
|
+
description: "Redis 5.x — 缓存 + 分布式锁(Redisson)"
|
|
64
|
+
|
|
37
65
|
# 安全设置
|
|
38
66
|
security:
|
|
39
67
|
rate_limit:
|
|
@@ -44,6 +72,12 @@ mcp_server:
|
|
|
44
72
|
- "git:*" # Git 操作(阶段二细分)
|
|
45
73
|
- "ci:status:read" # CI 状态读取
|
|
46
74
|
- "issue:list" # Issue 列表读取
|
|
75
|
+
- "nacos:config:read" # Nacos 配置读取
|
|
76
|
+
- "nacos:service:read" # Nacos 服务发现读取
|
|
77
|
+
- "mysql:status:read" # MySQL 状态读取
|
|
78
|
+
- "mysql:schema:read" # MySQL 表结构读取
|
|
79
|
+
- "redis:info:read" # Redis 信息读取
|
|
80
|
+
- "redis:key:read" # Redis Key TTL/类型读取
|
|
47
81
|
```
|
|
48
82
|
|
|
49
83
|
## 阶段一:只读集成 Tools 定义
|
|
@@ -191,6 +225,231 @@ mcp_server:
|
|
|
191
225
|
|
|
192
226
|
---
|
|
193
227
|
|
|
228
|
+
# ════════════════════════════════════════════════════════
|
|
229
|
+
# 基础设施 Tools 定义(Nacos / MySQL / Redis)
|
|
230
|
+
# ════════════════════════════════════════════════════════
|
|
231
|
+
|
|
232
|
+
> **安全原则**: 所有基础设施 Tool 均为只读,禁止通过 MCP 修改配置/数据/缓存值
|
|
233
|
+
|
|
234
|
+
## Nacos 只读 Tools
|
|
235
|
+
|
|
236
|
+
```javascript
|
|
237
|
+
// mcp/tools/nacos-read.js
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Tool: nacos_config_get
|
|
241
|
+
* 读取 Nacos 配置中心指定 DataId 的配置内容
|
|
242
|
+
*/
|
|
243
|
+
{
|
|
244
|
+
name: "nacos_config_get",
|
|
245
|
+
description: "读取 Nacos 配置中心指定 DataId 的配置内容(只读)",
|
|
246
|
+
parameters: {
|
|
247
|
+
dataId: { type: "string", description: "配置 DataId(如 jieshun-app-server.yaml)" },
|
|
248
|
+
group: { type: "string", description: "配置 Group", default: "DEFAULT_GROUP" },
|
|
249
|
+
namespace: { type: "string", description: "命名空间 ID", optional: true, default: "public" }
|
|
250
|
+
},
|
|
251
|
+
readOnly: true,
|
|
252
|
+
handler: async ({ dataId, group, namespace }) => {
|
|
253
|
+
// GET /nacos/v1/cs/configs?dataId=...&group=...&tenant=...
|
|
254
|
+
// 返回配置内容(YAML/Properties 文本)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Tool: nacos_config_list
|
|
260
|
+
* 列出 Nacos 配置中心指定 Group 下的配置列表
|
|
261
|
+
*/
|
|
262
|
+
{
|
|
263
|
+
name: "nacos_config_list",
|
|
264
|
+
description: "列出 Nacos 配置中心指定 Group 下的所有配置项(只读)",
|
|
265
|
+
parameters: {
|
|
266
|
+
group: { type: "string", description: "配置 Group", optional: true, default: "DEFAULT_GROUP" },
|
|
267
|
+
namespace: { type: "string", description: "命名空间 ID", optional: true, default: "public" },
|
|
268
|
+
page: { type: "number", description: "页码", default: 1 },
|
|
269
|
+
pageSize: { type: "number", description: "每页数量", default: 50 }
|
|
270
|
+
},
|
|
271
|
+
readOnly: true
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Tool: nacos_service_list
|
|
276
|
+
* 列出注册到 Nacos 的服务实例
|
|
277
|
+
*/
|
|
278
|
+
{
|
|
279
|
+
name: "nacos_service_list",
|
|
280
|
+
description: "列出 Nacos 注册中心的所有服务实例(服务发现,只读)",
|
|
281
|
+
parameters: {
|
|
282
|
+
namespace: { type: "string", description: "命名空间 ID", optional: true, default: "public" },
|
|
283
|
+
groupName: { type: "string", description: "服务分组", optional: true, default: "DEFAULT_GROUP" },
|
|
284
|
+
serviceName: { type: "string", description: "服务名过滤(可选)", optional: true },
|
|
285
|
+
healthyOnly: { type: "boolean", description: "仅健康实例", default: true }
|
|
286
|
+
},
|
|
287
|
+
readOnly: true
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Tool: nacos_service_detail
|
|
292
|
+
* 获取指定服务实例的详细信息
|
|
293
|
+
*/
|
|
294
|
+
{
|
|
295
|
+
name: "nacos_service_detail",
|
|
296
|
+
description: "获取 Nacos 中指定服务实例的详细信息(IP、端口、权重、健康状态)",
|
|
297
|
+
parameters: {
|
|
298
|
+
serviceName: { type: "string", description: "服务名" },
|
|
299
|
+
namespace: { type: "string", description: "命名空间 ID", optional: true, default: "public" },
|
|
300
|
+
groupName: { type: "string", description: "服务分组", optional: true, default: "DEFAULT_GROUP" }
|
|
301
|
+
},
|
|
302
|
+
readOnly: true
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## MySQL 只读 Tools
|
|
307
|
+
|
|
308
|
+
```javascript
|
|
309
|
+
// mcp/tools/mysql-read.js
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Tool: mysql_query_status
|
|
313
|
+
* 查询 MySQL 服务器状态信息
|
|
314
|
+
*/
|
|
315
|
+
{
|
|
316
|
+
name: "mysql_query_status",
|
|
317
|
+
description: "查询 MySQL 服务器运行状态(连接数、线程数、QPS 等,只读)",
|
|
318
|
+
parameters: {
|
|
319
|
+
metrics: {
|
|
320
|
+
type: "array",
|
|
321
|
+
description: "需要查询的状态指标",
|
|
322
|
+
optional: true,
|
|
323
|
+
default: ["Threads_connected", "Threads_running", "Queries", "Slow_queries"]
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
readOnly: true,
|
|
327
|
+
handler: async ({ metrics }) => {
|
|
328
|
+
// 执行 SHOW STATUS LIKE 'Threads%' 等
|
|
329
|
+
// 返回各指标的当前值
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Tool: mysql_schema_list
|
|
335
|
+
* 列出指定数据库的表结构概要
|
|
336
|
+
*/
|
|
337
|
+
{
|
|
338
|
+
name: "mysql_schema_list",
|
|
339
|
+
description: "列出 MySQL 指定数据库中的表名和行数概要(不读取业务数据,只读)",
|
|
340
|
+
parameters: {
|
|
341
|
+
database: { type: "string", description: "数据库名", optional: true },
|
|
342
|
+
tablePattern: { type: "string", description: "表名匹配模式(LIKE)", optional: true }
|
|
343
|
+
},
|
|
344
|
+
readOnly: true
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Tool: mysql_table_structure
|
|
349
|
+
* 查询指定表的 DDL 结构
|
|
350
|
+
*/
|
|
351
|
+
{
|
|
352
|
+
name: "mysql_table_structure",
|
|
353
|
+
description: "获取 MySQL 表的 CREATE TABLE 语句(表结构定义,只读)",
|
|
354
|
+
parameters: {
|
|
355
|
+
table: { type: "string", description: "表名" },
|
|
356
|
+
database: { type: "string", description: "数据库名", optional: true }
|
|
357
|
+
},
|
|
358
|
+
readOnly: true
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Tool: mysql_index_list
|
|
363
|
+
* 查询指定表的索引信息
|
|
364
|
+
*/
|
|
365
|
+
{
|
|
366
|
+
name: "mysql_index_list",
|
|
367
|
+
description: "获取 MySQL 表的索引定义(SHOW INDEX,只读)",
|
|
368
|
+
parameters: {
|
|
369
|
+
table: { type: "string", description: "表名" },
|
|
370
|
+
database: { type: "string", description: "数据库名", optional: true }
|
|
371
|
+
},
|
|
372
|
+
readOnly: true
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## Redis 只读 Tools
|
|
377
|
+
|
|
378
|
+
```javascript
|
|
379
|
+
// mcp/tools/redis-read.js
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Tool: redis_server_info
|
|
383
|
+
* 查询 Redis 服务器信息
|
|
384
|
+
*/
|
|
385
|
+
{
|
|
386
|
+
name: "redis_server_info",
|
|
387
|
+
description: "查询 Redis 服务器运行信息(内存、连接数、命中率等,只读)",
|
|
388
|
+
parameters: {
|
|
389
|
+
sections: {
|
|
390
|
+
type: "array",
|
|
391
|
+
description: "需要查询的 INFO 区段",
|
|
392
|
+
optional: true,
|
|
393
|
+
default: ["Server", "Memory", "Clients", "Stats", "Keyspace"]
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
readOnly: true,
|
|
397
|
+
handler: async ({ sections }) => {
|
|
398
|
+
// 执行 INFO Server / INFO Memory 等
|
|
399
|
+
// 返回关键指标:used_memory, connected_clients, keyspace_hits/misses
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Tool: redis_key_scan
|
|
405
|
+
* 扫描 Redis 中匹配模式的 Key 列表
|
|
406
|
+
*/
|
|
407
|
+
{
|
|
408
|
+
name: "redis_key_scan",
|
|
409
|
+
description: "扫描 Redis 中匹配模式的 Key 列表(不读取值,只读)",
|
|
410
|
+
parameters: {
|
|
411
|
+
pattern: { type: "string", description: "Key 匹配模式(如 user:login:token:*)", default: "*" },
|
|
412
|
+
count: { type: "number", description: "扫描数量限制", default: 100 },
|
|
413
|
+
database: { type: "number", description: "Redis 数据库编号", optional: true, default: 0 }
|
|
414
|
+
},
|
|
415
|
+
readOnly: true
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Tool: redis_key_ttl
|
|
420
|
+
* 查询指定 Key 的 TTL 和类型
|
|
421
|
+
*/
|
|
422
|
+
{
|
|
423
|
+
name: "redis_key_ttl",
|
|
424
|
+
description: "查询 Redis Key 的剩余过期时间和数据类型(只读,不返回 value)",
|
|
425
|
+
parameters: {
|
|
426
|
+
key: { type: "string", description: "Redis Key 名称" },
|
|
427
|
+
database: { type: "number", description: "Redis 数据库编号", optional: true, default: 0 }
|
|
428
|
+
},
|
|
429
|
+
readOnly: true,
|
|
430
|
+
handler: async ({ key, database }) => {
|
|
431
|
+
// 执行 TTL key / TYPE key
|
|
432
|
+
// 返回 { key, type, ttl } — 不返回 value(安全红线)
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Tool: redis_key_type_scan
|
|
438
|
+
* 按 Key 前缀统计各类型数量
|
|
439
|
+
*/
|
|
440
|
+
{
|
|
441
|
+
name: "redis_key_type_scan",
|
|
442
|
+
description: "按 Key 前缀统计 Redis 中各类型(String/Hash/List/Set/ZSet)的数量分布(只读)",
|
|
443
|
+
parameters: {
|
|
444
|
+
prefix: { type: "string", description: "Key 前缀(如 user:)", default: "" },
|
|
445
|
+
database: { type: "number", description: "Redis 数据库编号", optional: true, default: 0 }
|
|
446
|
+
},
|
|
447
|
+
readOnly: true
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
194
453
|
# ════════════════════════════════════════════════════════
|
|
195
454
|
# Java 后端专属 Tools 定义
|
|
196
455
|
# ════════════════════════════════════════════════════════
|
|
@@ -403,21 +662,44 @@ permission_matrix:
|
|
|
403
662
|
- "ci:status:read"
|
|
404
663
|
- "pr:create" # 阶段二
|
|
405
664
|
- "pr:read:*"
|
|
665
|
+
- "nacos:config:read" # 读取 Nacos 配置
|
|
666
|
+
- "nacos:service:read" # 读取服务注册信息
|
|
667
|
+
- "mysql:status:read" # 读取 MySQL 状态
|
|
668
|
+
- "mysql:schema:read" # 读取数据库表结构
|
|
669
|
+
- "redis:info:read" # 读取 Redis 服务器信息
|
|
670
|
+
- "redis:key:read" # 读取 Key TTL/类型(不读 value)
|
|
406
671
|
blocked_tools:
|
|
407
672
|
- "ci:trigger:*" # 必须审批
|
|
408
673
|
- "deploy:*"
|
|
674
|
+
- "nacos:config:write" # 禁止修改 Nacos 配置
|
|
675
|
+
- "mysql:data:read" # 禁止读取业务数据(安全红线)
|
|
676
|
+
- "mysql:data:write" # 禁止写入数据
|
|
677
|
+
- "redis:key:value:read" # 禁止读取缓存值(可能含敏感数据)
|
|
678
|
+
- "redis:key:write" # 禁止修改缓存
|
|
409
679
|
|
|
410
680
|
gate_controller:
|
|
411
681
|
allowed_tools:
|
|
412
682
|
- "git:read:*"
|
|
413
683
|
- "ci:status:read"
|
|
414
684
|
- "security:scan:*"
|
|
685
|
+
- "nacos:config:read" # 读取 Nacos 配置(检查合规性)
|
|
686
|
+
- "nacos:service:read" # 读取服务注册信息(检查健康)
|
|
687
|
+
- "mysql:status:read" # 读取 MySQL 运行状态
|
|
688
|
+
- "mysql:schema:read" # 读取表结构(检查 DDL 合规性)
|
|
689
|
+
- "redis:info:read" # 读取 Redis 运行信息
|
|
690
|
+
- "redis:key:read" # 读取 Key TTL/类型
|
|
415
691
|
|
|
416
692
|
tester:
|
|
417
693
|
allowed_tools:
|
|
418
694
|
- "git:read:*"
|
|
419
695
|
- "ci:status:read"
|
|
420
696
|
- "ci:logs:read"
|
|
697
|
+
- "nacos:config:read" # 测试环境配置查看
|
|
698
|
+
- "nacos:service:read" # 测试服务状态查看
|
|
699
|
+
- "mysql:status:read" # 测试数据库状态查看
|
|
700
|
+
- "mysql:schema:read" # 测试表结构查看
|
|
701
|
+
- "redis:info:read" # 测试 Redis 信息查看
|
|
702
|
+
- "redis:key:read" # 测试 Key TTL 查看
|
|
421
703
|
```
|
|
422
704
|
|
|
423
705
|
### 凭证注入方案
|
|
@@ -20,7 +20,7 @@ enabled: true
|
|
|
20
20
|
| # | 禁止内容 | 说明 | 应在哪个阶段 |
|
|
21
21
|
|---|---------|------|-------------|
|
|
22
22
|
| DDB-01 | 具体的代码实现和示例 | 含伪代码实现、代码片段 | 开发实现阶段 |
|
|
23
|
-
| DDB-02 |
|
|
23
|
+
| DDB-02 | 测试执行方案 | 测试执行策略、测试环境配置、自动化测试脚本、测试报告 | 测试验证阶段 |
|
|
24
24
|
| DDB-03 | 监控和日志设计 | 日志格式、监控指标、告警规则 | 部署/运维阶段 |
|
|
25
25
|
| DDB-04 | 部署设计 | 部署架构、容器编排、CI/CD 流水线 | 部署/运维阶段 |
|
|
26
26
|
| DDB-05 | 数据库优化方案 | 索引优化、分库分表策略、SQL 调优 | 开发实现 + 性能优化 |
|
|
@@ -44,6 +44,7 @@ enabled: true
|
|
|
44
44
|
| DDA-08 | 类图设计 | 核心类的静态结构和关系 |
|
|
45
45
|
| DDA-09 | 关键实现逻辑 | 文字描述(非代码),阐述核心流程和决策 |
|
|
46
46
|
| DDA-10 | 影响面分析与风险 | 变更影响范围和缓解策略 |
|
|
47
|
+
| DDA-11 | 测试用例文件引用 | 设计文档可引用独立存放的测试用例文件路径(如 `[用例](../test-cases/xxx/feature-points.md)`),但不得内嵌测试用例内容 |
|
|
47
48
|
|
|
48
49
|
---
|
|
49
50
|
|
|
@@ -106,7 +107,8 @@ enabled: true
|
|
|
106
107
|
设计文档完成后,方案设计师必须自检:
|
|
107
108
|
|
|
108
109
|
- [ ] 文档中无代码实现和示例(DDB-01)
|
|
109
|
-
- [ ]
|
|
110
|
+
- [ ] 文档中无测试执行方案内容(DDB-02)
|
|
111
|
+
- [ ] 测试用例仅引用未内嵌(DDA-11)
|
|
110
112
|
- [ ] 文档中无监控和日志设计(DDB-03)
|
|
111
113
|
- [ ] 文档中无部署设计(DDB-04)
|
|
112
114
|
- [ ] 文档中无数据库优化方案(DDB-05)
|