ai-engineering-init 1.11.0 → 1.12.0
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/.claude/{skills/openspec-apply-change/SKILL.md → commands/opsx-apply.md} +1 -19
- package/.claude/{skills/openspec-archive-change/SKILL.md → commands/opsx-archive.md} +1 -18
- package/.claude/{skills/openspec-bulk-archive-change/SKILL.md → commands/opsx-bulk-archive.md} +1 -18
- package/.claude/{skills/openspec-continue-change/SKILL.md → commands/opsx-continue.md} +1 -18
- package/.claude/{skills/openspec-explore/SKILL.md → commands/opsx-explore.md} +1 -19
- package/.claude/{skills/openspec-ff-change/SKILL.md → commands/opsx-ff.md} +1 -18
- package/.claude/{skills/openspec-new-change/SKILL.md → commands/opsx-new.md} +1 -18
- package/.claude/{skills/openspec-onboard/SKILL.md → commands/opsx-onboard.md} +1 -18
- package/.claude/{skills/openspec-sync-specs/SKILL.md → commands/opsx-sync.md} +1 -18
- package/.claude/{skills/openspec-verify-change/SKILL.md → commands/opsx-verify.md} +1 -18
- package/.claude/hooks/skill-forced-eval.js +0 -10
- package/.claude/skills/fix-bug/SKILL.md +103 -57
- package/.claude/skills/loki-log-query/SKILL.md +4 -4
- package/.codex/skills/fix-bug/SKILL.md +103 -57
- package/.codex/skills/loki-log-query/SKILL.md +4 -4
- package/.cursor/skills/fix-bug/SKILL.md +103 -57
- package/.cursor/skills/loki-log-query/SKILL.md +4 -4
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/platform-map.json +40 -0
- package/src/skills/fix-bug/SKILL.md +103 -57
- package/src/skills/loki-log-query/SKILL.md +4 -4
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-apply-change
|
|
3
|
-
description: |
|
|
4
|
-
Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 需要实现 OpenSpec 变更中的任务
|
|
8
|
-
- 执行变更制品中定义的实现步骤
|
|
9
|
-
- 将规格和设计转化为实际代码
|
|
10
|
-
- 逐个完成 tasks.md 中的待办事项
|
|
11
|
-
|
|
12
|
-
触发词:实现任务、开始实现、opsx:apply、openspec apply、执行变更、开始编码、实现变更
|
|
13
|
-
license: MIT
|
|
14
|
-
compatibility: Requires openspec CLI.
|
|
15
|
-
metadata:
|
|
16
|
-
author: openspec
|
|
17
|
-
version: "1.0"
|
|
18
|
-
generatedBy: "1.1.1"
|
|
19
|
-
---
|
|
1
|
+
# /opsx-apply - 实现 OpenSpec 变更任务
|
|
20
2
|
|
|
21
3
|
Implement tasks from an OpenSpec change.
|
|
22
4
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-archive-change
|
|
3
|
-
description: |
|
|
4
|
-
Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 变更实现完毕,需要归档保存
|
|
8
|
-
- 完成的变更需要移入 archive 目录
|
|
9
|
-
- 项目决策记录需要持久化保存
|
|
10
|
-
|
|
11
|
-
触发词:归档变更、归档、opsx:archive、openspec archive、完成变更、存档、归档完成
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-archive - 归档 OpenSpec 变更
|
|
19
2
|
|
|
20
3
|
Archive a completed change in the experimental workflow.
|
|
21
4
|
|
package/.claude/{skills/openspec-bulk-archive-change/SKILL.md → commands/opsx-bulk-archive.md}
RENAMED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-bulk-archive-change
|
|
3
|
-
description: |
|
|
4
|
-
Archive multiple completed changes at once. Use when archiving several parallel changes.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 多个变更同时完成,需要批量归档
|
|
8
|
-
- 清理多个已完成的并行变更
|
|
9
|
-
- 需要处理多个变更之间的规格冲突后统一归档
|
|
10
|
-
|
|
11
|
-
触发词:批量归档、全部归档、opsx:bulk-archive、一起归档、归档所有变更、批量存档
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-bulk-archive - 批量归档 OpenSpec 变更
|
|
19
2
|
|
|
20
3
|
Archive multiple completed changes in a single operation.
|
|
21
4
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-continue-change
|
|
3
|
-
description: |
|
|
4
|
-
Continue working on an OpenSpec change by creating the next artifact. Use when the user wants to progress their change, create the next artifact, or continue their workflow.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 需要继续推进已有变更的下一个制品
|
|
8
|
-
- 上次中断后恢复变更工作
|
|
9
|
-
- 逐步创建变更的 proposal/specs/design/tasks
|
|
10
|
-
|
|
11
|
-
触发词:继续变更、继续、opsx:continue、openspec continue、下一步、推进变更、继续工作
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-continue - 继续 OpenSpec 变更
|
|
19
2
|
|
|
20
3
|
Continue working on a change by creating the next artifact.
|
|
21
4
|
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-explore
|
|
3
|
-
description: |
|
|
4
|
-
Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 需要在实现前先探索和思考问题
|
|
8
|
-
- 比较多种技术方案的优劣
|
|
9
|
-
- 调查代码库中的现有架构和模式
|
|
10
|
-
- 在变更实现过程中遇到困惑需要深入分析
|
|
11
|
-
|
|
12
|
-
触发词:探索、opsx:explore、openspec explore、想一想、分析问题、调研方案、头脑风暴
|
|
13
|
-
license: MIT
|
|
14
|
-
compatibility: Requires openspec CLI.
|
|
15
|
-
metadata:
|
|
16
|
-
author: openspec
|
|
17
|
-
version: "1.0"
|
|
18
|
-
generatedBy: "1.1.1"
|
|
19
|
-
---
|
|
1
|
+
# /opsx-explore - OpenSpec 探索模式
|
|
20
2
|
|
|
21
3
|
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
|
22
4
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-ff-change
|
|
3
|
-
description: |
|
|
4
|
-
Fast-forward through OpenSpec artifact creation. Use when the user wants to quickly create all artifacts needed for implementation without stepping through each one individually.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 需要快速一次性生成所有变更制品
|
|
8
|
-
- 跳过逐步创建,直接生成 proposal/specs/design/tasks
|
|
9
|
-
- 想快速启动一个变更并立即进入实现阶段
|
|
10
|
-
|
|
11
|
-
触发词:快速创建、快进、opsx:ff、openspec ff、一键生成、快速开始、fast forward
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-ff - 快速推进 OpenSpec 变更
|
|
19
2
|
|
|
20
3
|
Fast-forward through artifact creation - generate everything needed to start implementation in one go.
|
|
21
4
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-new-change
|
|
3
|
-
description: |
|
|
4
|
-
Start a new OpenSpec change using the experimental artifact workflow. Use when the user wants to create a new feature, fix, or modification with a structured step-by-step approach.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 需要创建一个新的 OpenSpec 变更
|
|
8
|
-
- 开始一个新功能或修复的结构化工作流
|
|
9
|
-
- 初始化变更目录并查看第一个制品模板
|
|
10
|
-
|
|
11
|
-
触发词:新建变更、新变更、opsx:new、openspec new、创建变更、开始新功能、新增变更
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-new - 新建 OpenSpec 变更
|
|
19
2
|
|
|
20
3
|
Start a new change using the experimental artifact-driven approach.
|
|
21
4
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-onboard
|
|
3
|
-
description: |
|
|
4
|
-
Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 首次使用 OpenSpec,需要引导式教学
|
|
8
|
-
- 想通过实际操作学习 OpenSpec 完整工作流
|
|
9
|
-
- 需要了解 OpenSpec 的所有命令和流程
|
|
10
|
-
|
|
11
|
-
触发词:入门、onboard、opsx:onboard、openspec 教程、学习 openspec、新手引导、openspec 入门
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-onboard - OpenSpec 新手引导
|
|
19
2
|
|
|
20
3
|
Guide the user through their first complete OpenSpec workflow cycle. This is a teaching experience—you'll do real work in their codebase while explaining each step.
|
|
21
4
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-sync-specs
|
|
3
|
-
description: |
|
|
4
|
-
Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 需要将变更中的增量规格同步到主规格
|
|
8
|
-
- 变更的 delta spec 需要合并到 openspec/specs 目录
|
|
9
|
-
- 在归档前手动同步规格变更
|
|
10
|
-
|
|
11
|
-
触发词:同步规格、同步specs、opsx:sync、openspec sync、合并规格、同步变更规格
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-sync - 同步 OpenSpec 规格
|
|
19
2
|
|
|
20
3
|
Sync delta specs from a change to main specs.
|
|
21
4
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: openspec-verify-change
|
|
3
|
-
description: |
|
|
4
|
-
Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.
|
|
5
|
-
|
|
6
|
-
触发场景:
|
|
7
|
-
- 实现完成后需要验证是否与规格一致
|
|
8
|
-
- 归档前检查任务完成度和代码正确性
|
|
9
|
-
- 需要生成变更的完整性/正确性/一致性报告
|
|
10
|
-
|
|
11
|
-
触发词:验证变更、验证、opsx:verify、openspec verify、检查实现、校验变更、验收
|
|
12
|
-
license: MIT
|
|
13
|
-
compatibility: Requires openspec CLI.
|
|
14
|
-
metadata:
|
|
15
|
-
author: openspec
|
|
16
|
-
version: "1.0"
|
|
17
|
-
generatedBy: "1.1.1"
|
|
18
|
-
---
|
|
1
|
+
# /opsx-verify - 验证 OpenSpec 变更
|
|
19
2
|
|
|
20
3
|
Verify that an implementation matches the change artifacts (specs, tasks, design).
|
|
21
4
|
|
|
@@ -96,16 +96,6 @@ const instructions = `## 强制技能激活流程(必须执行)
|
|
|
96
96
|
- sms-mail: 短信/邮件/SMS/验证码/通知
|
|
97
97
|
- social-login: 第三方登录/OAuth/OAuth2/社交登录/授权登录
|
|
98
98
|
- tenant-management: 多租户/租户隔离/SaaS/数据隔离
|
|
99
|
-
- openspec-new-change: 新建变更/开始新功能/opsx:new/openspec new
|
|
100
|
-
- openspec-ff-change: 快速推进/opsx:ff/openspec ff/fast-forward
|
|
101
|
-
- openspec-apply-change: 实现任务/opsx:apply/openspec apply
|
|
102
|
-
- openspec-continue-change: 继续变更/opsx:continue/openspec continue
|
|
103
|
-
- openspec-archive-change: 归档变更/opsx:archive/openspec archive
|
|
104
|
-
- openspec-bulk-archive-change: 批量归档/opsx:bulk-archive
|
|
105
|
-
- openspec-explore: 探索模式/opsx:explore/openspec explore
|
|
106
|
-
- openspec-onboard: 新手引导/opsx:onboard/openspec onboard
|
|
107
|
-
- openspec-sync-specs: 同步规格/opsx:sync/openspec sync
|
|
108
|
-
- openspec-verify-change: 验证变更/opsx:verify/openspec verify
|
|
109
99
|
- ui-pc: 前端组件/Element UI/页面开发
|
|
110
100
|
- store-pc: Vuex/状态管理/store模块
|
|
111
101
|
- mysql-debug: MySQL调试/查数据库/执行SQL/数据库排查
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fix-bug
|
|
3
3
|
description: |
|
|
4
|
-
Bug
|
|
4
|
+
Bug 修复全流程编排。两阶段 Agent 排查 + 报告确认 + git-workflow 提交。
|
|
5
5
|
|
|
6
6
|
触发场景:
|
|
7
7
|
- 修复 Bug(含日志/traceId/数据库信息)
|
|
@@ -16,20 +16,20 @@ description: |
|
|
|
16
16
|
|
|
17
17
|
## 核心原则
|
|
18
18
|
|
|
19
|
-
**先判断复杂度,简单 Bug 直接修,复杂 Bug
|
|
19
|
+
**先判断复杂度,简单 Bug 直接修,复杂 Bug 走两阶段 Agent 排查。搞清原因后先出报告,用户确认后再修复代码。**
|
|
20
20
|
|
|
21
21
|
## 步骤 0:复杂度判断(必须先做)
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
用户提供 Bug 线索
|
|
25
25
|
│
|
|
26
|
-
├─ 简单 Bug? ──→
|
|
26
|
+
├─ 简单 Bug? ──→ 快速路径
|
|
27
27
|
│ - 明显的代码错误(NPE、空判断遗漏、拼写错误)
|
|
28
28
|
│ - 用户已明确指出问题和修改方案
|
|
29
29
|
│ - 单文件改动,逻辑清晰
|
|
30
30
|
│ - 不需要查数据库/日志验证
|
|
31
31
|
│
|
|
32
|
-
└─ 复杂 Bug? ──→ Agent
|
|
32
|
+
└─ 复杂 Bug? ──→ Agent 路径(两阶段排查)
|
|
33
33
|
- 需要查日志确认线上行为(提供了 traceId)
|
|
34
34
|
- 需要查数据库验证数据正确性(提供了 DB 信息)
|
|
35
35
|
- 问题根因不明确,需要多维度分析
|
|
@@ -39,10 +39,10 @@ description: |
|
|
|
39
39
|
## 快速路径(简单 Bug)
|
|
40
40
|
|
|
41
41
|
```
|
|
42
|
-
读代码 → 定位问题 → 修复 →
|
|
42
|
+
读代码 → 定位问题 → 输出排查报告 → 用户确认 → 修复 → git-workflow 提交
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
不启动 Agent
|
|
45
|
+
不启动 Agent,直接在主对话中完成。即使是简单 Bug,也先说明问题原因和修复方案,等用户确认再动手。
|
|
46
46
|
|
|
47
47
|
## Agent 路径(复杂 Bug)
|
|
48
48
|
|
|
@@ -53,31 +53,111 @@ description: |
|
|
|
53
53
|
- Loki 日志环境
|
|
54
54
|
- Bug 描述 / 期望行为
|
|
55
55
|
|
|
56
|
-
步骤 2
|
|
57
|
-
├── bug-analyzer
|
|
58
|
-
├──
|
|
59
|
-
└──
|
|
56
|
+
步骤 2(阶段一):并行启动 Agent
|
|
57
|
+
├── bug-analyzer: 读代码分析根因
|
|
58
|
+
├── loki-runner: 查 Loki 日志(有 traceId 时)
|
|
59
|
+
└── mysql-runner: 查数据库验证数据(有 DB 信息时)
|
|
60
60
|
|
|
61
|
-
步骤 3
|
|
61
|
+
步骤 3(阶段二):日志驱动二次查询
|
|
62
|
+
从 loki-runner 结果中提取:
|
|
63
|
+
├── 表名(INSERT/UPDATE/DELETE/FROM/JOIN 后面的表名)
|
|
64
|
+
├── 数据 ID(id=xxx、orderId=xxx 等)
|
|
65
|
+
├── 租户 ID(tenantId、MERCHANT-ID 请求头)
|
|
66
|
+
└── SQL 语句片段
|
|
67
|
+
如果提取到有效的表名+ID → 自动启动 mysql-runner 二次查询
|
|
62
68
|
|
|
63
|
-
步骤 4
|
|
69
|
+
步骤 4:汇总所有结果 → 输出排查报告(见下方模板)
|
|
64
70
|
|
|
65
|
-
步骤 5
|
|
71
|
+
步骤 5:⏸️ 等待用户确认修复方案
|
|
72
|
+
|
|
73
|
+
步骤 6:用户确认后 → 修复代码
|
|
74
|
+
|
|
75
|
+
步骤 7:走 git-workflow 提交
|
|
66
76
|
```
|
|
67
77
|
|
|
78
|
+
## 排查报告模板(必须输出)
|
|
79
|
+
|
|
80
|
+
无论简单还是复杂 Bug,修复代码前**必须先输出报告**:
|
|
81
|
+
|
|
82
|
+
```markdown
|
|
83
|
+
## 🔍 Bug 排查报告
|
|
84
|
+
|
|
85
|
+
### 问题描述
|
|
86
|
+
{用户报告的现象}
|
|
87
|
+
|
|
88
|
+
### 根因分析
|
|
89
|
+
{代码层面的根本原因,指出具体文件和行号}
|
|
90
|
+
|
|
91
|
+
### 数据验证(如有)
|
|
92
|
+
{从日志/数据库中发现的关键数据,证实根因}
|
|
93
|
+
|
|
94
|
+
### 修复方案
|
|
95
|
+
- 修改文件:`xxx.java` 第 N 行
|
|
96
|
+
- 修改内容:{具体改动描述}
|
|
97
|
+
- 影响范围:{改动是否影响其他功能}
|
|
98
|
+
|
|
99
|
+
### 风险评估
|
|
100
|
+
- 低/中/高
|
|
101
|
+
- {风险说明}
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
确认修复请回复"修",需要调整方案请说明。
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**⚠️ 禁止跳过报告直接修改代码。必须等用户明确确认后才能开始修复。**
|
|
108
|
+
|
|
109
|
+
## 阶段二:日志驱动二次查询
|
|
110
|
+
|
|
111
|
+
当阶段一的 loki-runner 返回日志后,主会话检查日志内容:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
loki-runner 返回日志
|
|
115
|
+
│
|
|
116
|
+
├─ 日志中包含 SQL/表名/数据ID?
|
|
117
|
+
│ │
|
|
118
|
+
│ ├─ 阶段一已启动 mysql-runner?
|
|
119
|
+
│ │ → 检查是否需要追加查询(不同的表或ID)
|
|
120
|
+
│ │ → 需要则启动新的 mysql-runner 查询
|
|
121
|
+
│ │
|
|
122
|
+
│ └─ 阶段一未启动 mysql-runner?
|
|
123
|
+
│ → 从日志提取表名+ID+租户ID
|
|
124
|
+
│ → 自动启动 mysql-runner 二次查询
|
|
125
|
+
│
|
|
126
|
+
└─ 日志中无数据库相关信息?
|
|
127
|
+
→ 跳过,直接汇总现有结果
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 日志中常见的可提取信息
|
|
131
|
+
|
|
132
|
+
| 日志模式 | 提取内容 | 查询方式 |
|
|
133
|
+
|---------|---------|---------|
|
|
134
|
+
| `INSERT INTO order_info` | 表名 order_info | `SELECT * FROM order_info WHERE id = ?` |
|
|
135
|
+
| `UPDATE account SET balance=` | 表名 account | `SELECT * FROM account WHERE id = ?` |
|
|
136
|
+
| `orderId=123456` | 数据 ID | 按 ID 查对应表 |
|
|
137
|
+
| `MERCHANT-ID: 100` | 租户 ID | 切换到对应租户库查询 |
|
|
138
|
+
| `Duplicate entry 'xxx'` | 唯一键冲突 | 查重复数据 |
|
|
139
|
+
| `Data truncation` | 字段溢出 | 查表结构 `DESC table_name` |
|
|
140
|
+
|
|
68
141
|
## Agent 启动规则
|
|
69
142
|
|
|
70
|
-
###
|
|
143
|
+
### 阶段一:必须并行(单条消息多个 Agent tool call)
|
|
71
144
|
|
|
72
145
|
```
|
|
73
|
-
# 正确:一条消息同时启动
|
|
146
|
+
# 正确:一条消息同时启动
|
|
74
147
|
Agent(bug-analyzer, "分析 xxx 代码的 bug...")
|
|
75
|
-
Agent(mysql-runner, "查询 xxx 数据库验证...")
|
|
76
148
|
Agent(loki-runner, "查询 traceId xxx 的日志...")
|
|
149
|
+
Agent(mysql-runner, "查询 xxx 数据库验证...")
|
|
77
150
|
|
|
78
151
|
# 错误:串行启动(等一个完再启动下一个)
|
|
79
152
|
```
|
|
80
153
|
|
|
154
|
+
### 阶段二:按需启动(阶段一结果返回后)
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
# 从 loki-runner 结果中发现了表名和数据ID
|
|
158
|
+
Agent(mysql-runner, "根据日志发现涉及 order_info 表,查询 id=xxx 的数据...")
|
|
159
|
+
```
|
|
160
|
+
|
|
81
161
|
### 各 Agent 职责
|
|
82
162
|
|
|
83
163
|
| Agent | subagent_type | 职责 | 输入 |
|
|
@@ -106,50 +186,16 @@ Agent(loki-runner, "查询 traceId xxx 的日志...")
|
|
|
106
186
|
└─ 配置文件不存在? → 创建模板文件(占位符) → 提示用户填写 → 等确认后继续
|
|
107
187
|
```
|
|
108
188
|
|
|
109
|
-
**创建 MySQL 模板**:
|
|
110
|
-
```json
|
|
111
|
-
{
|
|
112
|
-
"environments": {
|
|
113
|
-
"test21": {
|
|
114
|
-
"name": "test21 测试环境",
|
|
115
|
-
"host": "YOUR_HOST",
|
|
116
|
-
"port": 3306,
|
|
117
|
-
"user": "YOUR_USER",
|
|
118
|
-
"password": "YOUR_PASSWORD",
|
|
119
|
-
"db_prefix": "testcore_",
|
|
120
|
-
"aliases": ["test21", "21"]
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"default": "test21",
|
|
124
|
-
"mysql_path": "/opt/homebrew/opt/mysql-client/bin/mysql"
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**创建 Loki 模板**:
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"active": "test13",
|
|
132
|
-
"environments": {
|
|
133
|
-
"test13": {
|
|
134
|
-
"name": "测试13(主测试环境)",
|
|
135
|
-
"url": "https://test13.xnzn.net/grafana",
|
|
136
|
-
"token": "YOUR_TOKEN",
|
|
137
|
-
"aliases": ["test13", "13"]
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
189
|
**敏感信息由用户手动填写,禁止 AI 将对话中的密码/token 写入配置文件。**
|
|
144
190
|
|
|
145
191
|
### 按信息量决定启动哪些 Agent
|
|
146
192
|
|
|
147
|
-
| 用户提供的信息 |
|
|
148
|
-
|
|
149
|
-
| 只有 Bug 描述 | bug-analyzer |
|
|
150
|
-
| Bug 描述 + traceId | bug-analyzer + loki-runner |
|
|
151
|
-
| Bug 描述 + DB 信息 | bug-analyzer + mysql-runner |
|
|
152
|
-
| Bug 描述 + traceId + DB 信息 |
|
|
193
|
+
| 用户提供的信息 | 阶段一启动 | 阶段二(日志驱动) |
|
|
194
|
+
|---------------|-----------|-----------------|
|
|
195
|
+
| 只有 Bug 描述 | bug-analyzer | — |
|
|
196
|
+
| Bug 描述 + traceId | bug-analyzer + loki-runner | 日志中有表名/ID → mysql-runner |
|
|
197
|
+
| Bug 描述 + DB 信息 | bug-analyzer + mysql-runner | — |
|
|
198
|
+
| Bug 描述 + traceId + DB 信息 | 全部 | 日志中有新表/ID → mysql-runner 追加查询 |
|
|
153
199
|
|
|
154
200
|
## 提交规则
|
|
155
201
|
|
|
@@ -161,6 +207,6 @@ Agent(loki-runner, "查询 traceId xxx 的日志...")
|
|
|
161
207
|
|
|
162
208
|
## 注意
|
|
163
209
|
|
|
164
|
-
- 简单 Bug
|
|
210
|
+
- 简单 Bug 不要过度编排,直接修就行(但仍需先报告再修复)
|
|
165
211
|
- 如果用户没提供 DB/Loki 信息但 Bug 涉及数据问题,主动询问
|
|
166
212
|
- 与 `bug-detective` 技能的区别:`bug-detective` 是排查指南,`fix-bug` 是全流程编排(包含排查+修复+提交)
|
|
@@ -140,7 +140,7 @@ print('Token updated for monitor-dev')
|
|
|
140
140
|
```bash
|
|
141
141
|
TRACE_ID="a53dd0b0cc62bf4a79a63e77444f6f3f"
|
|
142
142
|
END=$(date +%s)000000000
|
|
143
|
-
START=$(( $(date +%s) -
|
|
143
|
+
START=$(( $(date +%s) - 21600 ))000000000 # 最近6小时
|
|
144
144
|
|
|
145
145
|
curl -s "${API}/query_range" \
|
|
146
146
|
-H "Authorization: Bearer ${TOKEN}" \
|
|
@@ -172,7 +172,7 @@ else:
|
|
|
172
172
|
```bash
|
|
173
173
|
API_PATH="/security/summary/order/mealtime/classify/page"
|
|
174
174
|
END=$(date +%s)000000000
|
|
175
|
-
START=$(( $(date +%s) -
|
|
175
|
+
START=$(( $(date +%s) - 21600 ))000000000 # 最近6小时
|
|
176
176
|
|
|
177
177
|
curl -s "${API}/query_range" \
|
|
178
178
|
-H "Authorization: Bearer ${TOKEN}" \
|
|
@@ -221,7 +221,7 @@ if len(all_lines) > 30:
|
|
|
221
221
|
```bash
|
|
222
222
|
KEYWORD="LeException"
|
|
223
223
|
END=$(date +%s)000000000
|
|
224
|
-
START=$(( $(date +%s) -
|
|
224
|
+
START=$(( $(date +%s) - 21600 ))000000000 # 最近6小时
|
|
225
225
|
|
|
226
226
|
curl -s "${API}/query_range" \
|
|
227
227
|
-H "Authorization: Bearer ${TOKEN}" \
|
|
@@ -269,7 +269,7 @@ curl -s "${API}/query_range" \
|
|
|
269
269
|
# Step 1: 找 traceId
|
|
270
270
|
API_PATH="/api/v2/web/order/list"
|
|
271
271
|
END=$(date +%s)000000000
|
|
272
|
-
START=$(( $(date +%s) -
|
|
272
|
+
START=$(( $(date +%s) - 21600 ))000000000 # 最近6小时
|
|
273
273
|
|
|
274
274
|
TRACE_IDS=$(curl -s "${API}/query_range" \
|
|
275
275
|
-H "Authorization: Bearer ${TOKEN}" \
|