mcp-probe-kit 3.0.5 → 3.0.6
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 +453 -435
- package/build/index.js +434 -140
- package/build/lib/template-loader.js +317 -317
- package/build/lib/tool-execution-context.d.ts +8 -0
- package/build/lib/tool-execution-context.js +20 -0
- package/build/schemas/git-tools.js +16 -16
- package/build/tools/__tests__/start_bugfix.unit.test.js +14 -14
- package/build/tools/__tests__/start_ui.unit.test.js +11 -11
- package/build/tools/add_feature.js +79 -79
- package/build/tools/ask_user.js +5 -5
- package/build/tools/interview.js +9 -9
- package/build/tools/start_bugfix.d.ts +2 -1
- package/build/tools/start_bugfix.js +131 -122
- package/build/tools/start_feature.d.ts +2 -1
- package/build/tools/start_feature.js +113 -104
- package/build/tools/start_onboard.d.ts +2 -1
- package/build/tools/start_onboard.js +57 -51
- package/build/tools/start_product.d.ts +2 -1
- package/build/tools/start_product.js +9 -1
- package/build/tools/start_ralph.d.ts +2 -1
- package/build/tools/start_ralph.js +9 -3
- package/build/tools/start_ui.d.ts +2 -1
- package/build/tools/start_ui.js +102 -88
- package/build/tools/ui-ux-tools.d.ts +2 -1
- package/build/tools/ui-ux-tools.js +19 -3
- package/build/utils/ui-sync.d.ts +6 -2
- package/build/utils/ui-sync.js +125 -29
- package/docs/assets/font/MaterialSymbolsOutlined.codepoints +4102 -0
- package/docs/assets/font/MaterialSymbolsOutlined.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-400.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-700.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-900.ttf +0 -0
- package/docs/assets/js/i18n.js +122 -21
- package/docs/assets/js/tailwind.js +83 -83
- package/docs/data/tools.js +416 -416
- package/docs/debug-i18n.html +163 -0
- package/docs/i18n/all-tools/en.json +157 -0
- package/docs/i18n/all-tools/ja.json +157 -0
- package/docs/i18n/all-tools/ko.json +157 -0
- package/docs/i18n/all-tools/zh-CN.json +157 -0
- package/docs/pages/all-tools.html +514 -352
- package/docs/pages/examples.html +689 -689
- package/docs/pages/getting-started.html +589 -589
- package/docs/pages/migration.html +298 -298
- package/package.json +3 -3
- package/docs/project-context/architecture.md +0 -0
- package/docs/project-context/how-to-develop.md +0 -313
- package/docs/project-context/how-to-test.md +0 -457
- package/docs/project-context/tech-stack.md +0 -96
- package/docs/project-context.md +0 -53
- package/docs/specs/git-work-report/design.md +0 -568
- package/docs/specs/git-work-report/requirements.md +0 -131
- package/docs/specs/git-work-report/tasks.md +0 -197
|
@@ -2,6 +2,7 @@ import { parseArgs, getString, getNumber } from "../utils/parseArgs.js";
|
|
|
2
2
|
import { okStructured } from "../lib/response.js";
|
|
3
3
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
4
4
|
import { FeatureReportSchema, RequirementsLoopSchema } from "../schemas/structured-output.js";
|
|
5
|
+
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
5
6
|
/**
|
|
6
7
|
* start_feature 智能编排工具
|
|
7
8
|
*
|
|
@@ -48,110 +49,110 @@ function extractFeatureInfo(input) {
|
|
|
48
49
|
description: input,
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
|
-
const PROMPT_TEMPLATE = `# 🚀 新功能开发编排(委托式)
|
|
52
|
-
|
|
53
|
-
本工具仅生成 **执行计划(steps)**。AI 需要按顺序调用对应工具并落盘文档。
|
|
54
|
-
|
|
55
|
-
## 🎯 目标
|
|
56
|
-
开发新功能:**{feature_name}**
|
|
57
|
-
功能描述:{description}
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## ✅ 执行计划(按顺序)
|
|
62
|
-
|
|
63
|
-
### 0) 项目上下文(如缺失)
|
|
64
|
-
**检查**: \`{docs_dir}/project-context.md\`
|
|
65
|
-
**缺失则调用**: \`init_project_context\`
|
|
66
|
-
\`\`\`json
|
|
67
|
-
{ "docs_dir": "{docs_dir}" }
|
|
68
|
-
\`\`\`
|
|
69
|
-
|
|
70
|
-
### 1) 生成功能规格
|
|
71
|
-
**调用**: \`add_feature\`
|
|
72
|
-
\`\`\`json
|
|
73
|
-
{
|
|
74
|
-
"feature_name": "{feature_name}",
|
|
75
|
-
"description": "{description}",
|
|
76
|
-
"docs_dir": "{docs_dir}",
|
|
77
|
-
"template_profile": "{template_profile}"
|
|
78
|
-
}
|
|
79
|
-
\`\`\`
|
|
80
|
-
**预期输出**:
|
|
81
|
-
- \`{docs_dir}/specs/{feature_name}/requirements.md\`
|
|
82
|
-
- \`{docs_dir}/specs/{feature_name}/design.md\`
|
|
83
|
-
- \`{docs_dir}/specs/{feature_name}/tasks.md\`
|
|
84
|
-
|
|
85
|
-
### 2) 工作量估算
|
|
86
|
-
**调用**: \`estimate\`
|
|
87
|
-
\`\`\`json
|
|
88
|
-
{
|
|
89
|
-
"task_description": "实现 {feature_name} 功能:{description}",
|
|
90
|
-
"code_context": "参考生成的 tasks.md 中的任务列表"
|
|
91
|
-
}
|
|
92
|
-
\`\`\`
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## ✅ 输出汇总(执行完成后)
|
|
97
|
-
1. 规格文档位置: \`{docs_dir}/specs/{feature_name}/\`
|
|
98
|
-
2. 估算结果: 故事点 + 时间区间
|
|
99
|
-
3. 主要风险(如有)
|
|
100
|
-
4. 下一步: 按 tasks.md 开始开发
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
52
|
+
const PROMPT_TEMPLATE = `# 🚀 新功能开发编排(委托式)
|
|
53
|
+
|
|
54
|
+
本工具仅生成 **执行计划(steps)**。AI 需要按顺序调用对应工具并落盘文档。
|
|
55
|
+
|
|
56
|
+
## 🎯 目标
|
|
57
|
+
开发新功能:**{feature_name}**
|
|
58
|
+
功能描述:{description}
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## ✅ 执行计划(按顺序)
|
|
63
|
+
|
|
64
|
+
### 0) 项目上下文(如缺失)
|
|
65
|
+
**检查**: \`{docs_dir}/project-context.md\`
|
|
66
|
+
**缺失则调用**: \`init_project_context\`
|
|
67
|
+
\`\`\`json
|
|
68
|
+
{ "docs_dir": "{docs_dir}" }
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
### 1) 生成功能规格
|
|
72
|
+
**调用**: \`add_feature\`
|
|
73
|
+
\`\`\`json
|
|
74
|
+
{
|
|
75
|
+
"feature_name": "{feature_name}",
|
|
76
|
+
"description": "{description}",
|
|
77
|
+
"docs_dir": "{docs_dir}",
|
|
78
|
+
"template_profile": "{template_profile}"
|
|
79
|
+
}
|
|
80
|
+
\`\`\`
|
|
81
|
+
**预期输出**:
|
|
82
|
+
- \`{docs_dir}/specs/{feature_name}/requirements.md\`
|
|
83
|
+
- \`{docs_dir}/specs/{feature_name}/design.md\`
|
|
84
|
+
- \`{docs_dir}/specs/{feature_name}/tasks.md\`
|
|
85
|
+
|
|
86
|
+
### 2) 工作量估算
|
|
87
|
+
**调用**: \`estimate\`
|
|
88
|
+
\`\`\`json
|
|
89
|
+
{
|
|
90
|
+
"task_description": "实现 {feature_name} 功能:{description}",
|
|
91
|
+
"code_context": "参考生成的 tasks.md 中的任务列表"
|
|
92
|
+
}
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## ✅ 输出汇总(执行完成后)
|
|
98
|
+
1. 规格文档位置: \`{docs_dir}/specs/{feature_name}/\`
|
|
99
|
+
2. 估算结果: 故事点 + 时间区间
|
|
100
|
+
3. 主要风险(如有)
|
|
101
|
+
4. 下一步: 按 tasks.md 开始开发
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
104
105
|
*编排工具: MCP Probe Kit - start_feature*`;
|
|
105
|
-
const LOOP_PROMPT_TEMPLATE = `# 🧭 需求澄清与补全(Requirements Loop)
|
|
106
|
-
|
|
107
|
-
本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐关键要素,并输出可审计的结构化结果。
|
|
108
|
-
|
|
109
|
-
## 🎯 目标
|
|
110
|
-
开发新功能:**{feature_name}**
|
|
111
|
-
功能描述:{description}
|
|
112
|
-
|
|
113
|
-
## ✅ 规则
|
|
114
|
-
1. **不覆盖用户原始需求**
|
|
115
|
-
2. **补全内容必须标注来源**(User / Derived / Assumption)
|
|
116
|
-
3. **假设必须进入待确认列表**
|
|
117
|
-
4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## 🔁 执行步骤(每轮)
|
|
122
|
-
|
|
123
|
-
### 1) 生成待确认问题
|
|
124
|
-
使用 \`ask_user\` 提问,问题来源于“功能需求补全清单”(角色/触发/约束/异常/依赖等)。
|
|
125
|
-
|
|
126
|
-
**调用示例**:
|
|
127
|
-
\`\`\`json
|
|
128
|
-
{
|
|
129
|
-
"questions": [
|
|
130
|
-
{ "question": "目标用户或角色是谁?", "context": "角色定义", "required": true },
|
|
131
|
-
{ "question": "触发场景是什么?", "context": "业务场景", "required": true }
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
\`\`\`
|
|
135
|
-
|
|
136
|
-
### 2) 更新结构化输出
|
|
137
|
-
将回答补入 \`requirements\`,并标注来源:
|
|
138
|
-
- User:用户明确回答
|
|
139
|
-
- Derived:合理推导
|
|
140
|
-
- Assumption:无法确认但补全(需确认)
|
|
141
|
-
|
|
142
|
-
### 3) 自检与结束
|
|
143
|
-
若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入规格生成与估算。
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## ✅ 结束后继续
|
|
148
|
-
当满足结束条件时,执行:
|
|
149
|
-
1. 调用 \`add_feature\` 生成规格文档
|
|
150
|
-
2. 调用 \`estimate\` 进行工作量估算
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
*编排工具: MCP Probe Kit - start_feature (requirements loop)*
|
|
106
|
+
const LOOP_PROMPT_TEMPLATE = `# 🧭 需求澄清与补全(Requirements Loop)
|
|
107
|
+
|
|
108
|
+
本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐关键要素,并输出可审计的结构化结果。
|
|
109
|
+
|
|
110
|
+
## 🎯 目标
|
|
111
|
+
开发新功能:**{feature_name}**
|
|
112
|
+
功能描述:{description}
|
|
113
|
+
|
|
114
|
+
## ✅ 规则
|
|
115
|
+
1. **不覆盖用户原始需求**
|
|
116
|
+
2. **补全内容必须标注来源**(User / Derived / Assumption)
|
|
117
|
+
3. **假设必须进入待确认列表**
|
|
118
|
+
4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 🔁 执行步骤(每轮)
|
|
123
|
+
|
|
124
|
+
### 1) 生成待确认问题
|
|
125
|
+
使用 \`ask_user\` 提问,问题来源于“功能需求补全清单”(角色/触发/约束/异常/依赖等)。
|
|
126
|
+
|
|
127
|
+
**调用示例**:
|
|
128
|
+
\`\`\`json
|
|
129
|
+
{
|
|
130
|
+
"questions": [
|
|
131
|
+
{ "question": "目标用户或角色是谁?", "context": "角色定义", "required": true },
|
|
132
|
+
{ "question": "触发场景是什么?", "context": "业务场景", "required": true }
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
\`\`\`
|
|
136
|
+
|
|
137
|
+
### 2) 更新结构化输出
|
|
138
|
+
将回答补入 \`requirements\`,并标注来源:
|
|
139
|
+
- User:用户明确回答
|
|
140
|
+
- Derived:合理推导
|
|
141
|
+
- Assumption:无法确认但补全(需确认)
|
|
142
|
+
|
|
143
|
+
### 3) 自检与结束
|
|
144
|
+
若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入规格生成与估算。
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## ✅ 结束后继续
|
|
149
|
+
当满足结束条件时,执行:
|
|
150
|
+
1. 调用 \`add_feature\` 生成规格文档
|
|
151
|
+
2. 调用 \`estimate\` 进行工作量估算
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
*编排工具: MCP Probe Kit - start_feature (requirements loop)*
|
|
155
156
|
`;
|
|
156
157
|
function buildOpenQuestions(questionBudget) {
|
|
157
158
|
const base = [
|
|
@@ -163,8 +164,10 @@ function buildOpenQuestions(questionBudget) {
|
|
|
163
164
|
];
|
|
164
165
|
return base.slice(0, Math.max(0, questionBudget));
|
|
165
166
|
}
|
|
166
|
-
export async function startFeature(args) {
|
|
167
|
+
export async function startFeature(args, context) {
|
|
167
168
|
try {
|
|
169
|
+
throwIfAborted(context?.signal, "start_feature 已取消");
|
|
170
|
+
await reportToolProgress(context, 10, "start_feature: 解析参数");
|
|
168
171
|
// 智能参数解析,支持自然语言输入
|
|
169
172
|
const parsedArgs = parseArgs(args, {
|
|
170
173
|
defaultValues: {
|
|
@@ -197,6 +200,8 @@ export async function startFeature(args) {
|
|
|
197
200
|
const maxRounds = getNumber(parsedArgs.loop_max_rounds, 2);
|
|
198
201
|
const questionBudget = getNumber(parsedArgs.loop_question_budget, 5);
|
|
199
202
|
const assumptionCap = getNumber(parsedArgs.loop_assumption_cap, 3);
|
|
203
|
+
throwIfAborted(context?.signal, "start_feature 已取消");
|
|
204
|
+
await reportToolProgress(context, 35, "start_feature: 参数解析完成");
|
|
200
205
|
// 如果是纯自然语言输入(input 字段有值但 feature_name 和 description 为空)
|
|
201
206
|
const input = getString(parsedArgs.input);
|
|
202
207
|
if (input && !featureName && !description) {
|
|
@@ -221,6 +226,8 @@ export async function startFeature(args) {
|
|
|
221
226
|
"- JSON格式:{\"feature_name\": \"user-auth\", \"description\": \"用户认证功能\"}");
|
|
222
227
|
}
|
|
223
228
|
if (requirementsMode === "loop") {
|
|
229
|
+
throwIfAborted(context?.signal, "start_feature(loop) 已取消");
|
|
230
|
+
await reportToolProgress(context, 70, "start_feature: 生成 loop 计划");
|
|
224
231
|
const openQuestions = buildOpenQuestions(questionBudget).map((q, index) => ({
|
|
225
232
|
id: `Q-${index + 1}`,
|
|
226
233
|
...q,
|
|
@@ -324,6 +331,7 @@ export async function startFeature(args) {
|
|
|
324
331
|
plan,
|
|
325
332
|
},
|
|
326
333
|
};
|
|
334
|
+
await reportToolProgress(context, 95, "start_feature: loop 输出已生成");
|
|
327
335
|
return okStructured(guide, loopReport, {
|
|
328
336
|
schema: RequirementsLoopSchema,
|
|
329
337
|
note: 'AI 应按轮次澄清需求并更新结构化输出,满足结束条件后再进入 add_feature / estimate',
|
|
@@ -426,6 +434,7 @@ export async function startFeature(args) {
|
|
|
426
434
|
plan,
|
|
427
435
|
},
|
|
428
436
|
};
|
|
437
|
+
await reportToolProgress(context, 95, "start_feature: 执行计划输出已生成");
|
|
429
438
|
return okStructured(guide, featureReport, {
|
|
430
439
|
schema: FeatureReportSchema,
|
|
431
440
|
note: 'AI 应该按照指南执行步骤,并在每个步骤完成后更新 structuredContent 中的状态和估算信息',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ToolExecutionContext } from "../lib/tool-execution-context.js";
|
|
2
|
+
export declare function startOnboard(args: any, context?: ToolExecutionContext): Promise<import("../lib/response.js").ToolResponse | {
|
|
2
3
|
content: {
|
|
3
4
|
type: string;
|
|
4
5
|
text: string;
|
|
@@ -2,47 +2,48 @@ import { parseArgs, getString } from "../utils/parseArgs.js";
|
|
|
2
2
|
import { okStructured } from "../lib/response.js";
|
|
3
3
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
4
4
|
import { OnboardingReportSchema } from "../schemas/structured-output.js";
|
|
5
|
+
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
5
6
|
/**
|
|
6
7
|
* start_onboard 智能编排工具
|
|
7
8
|
*
|
|
8
9
|
* 场景:快速上手项目
|
|
9
10
|
* 编排:init_project_context
|
|
10
11
|
*/
|
|
11
|
-
const PROMPT_TEMPLATE = `# 📚 快速上手编排指南
|
|
12
|
-
|
|
13
|
-
## 🎯 目标
|
|
14
|
-
|
|
15
|
-
快速了解并上手当前项目
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 📝 步骤 1: 生成项目上下文
|
|
20
|
-
|
|
21
|
-
**调用工具**: \`init_project_context\`
|
|
22
|
-
|
|
23
|
-
**参数**:
|
|
24
|
-
\`\`\`json
|
|
25
|
-
{
|
|
26
|
-
"docs_dir": "{docs_dir}",
|
|
27
|
-
"project_root": "{project_path}"
|
|
28
|
-
}
|
|
29
|
-
\`\`\`
|
|
30
|
-
|
|
31
|
-
**生成内容**:
|
|
32
|
-
- 技术栈文档
|
|
33
|
-
- 架构说明
|
|
34
|
-
- 编码规范
|
|
35
|
-
- 开发指南
|
|
36
|
-
|
|
37
|
-
**产出**: \`{docs_dir}/project-context.md\`
|
|
12
|
+
const PROMPT_TEMPLATE = `# 📚 快速上手编排指南
|
|
13
|
+
|
|
14
|
+
## 🎯 目标
|
|
15
|
+
|
|
16
|
+
快速了解并上手当前项目
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📝 步骤 1: 生成项目上下文
|
|
21
|
+
|
|
22
|
+
**调用工具**: \`init_project_context\`
|
|
23
|
+
|
|
24
|
+
**参数**:
|
|
25
|
+
\`\`\`json
|
|
26
|
+
{
|
|
27
|
+
"docs_dir": "{docs_dir}",
|
|
28
|
+
"project_root": "{project_path}"
|
|
29
|
+
}
|
|
30
|
+
\`\`\`
|
|
31
|
+
|
|
32
|
+
**生成内容**:
|
|
33
|
+
- 技术栈文档
|
|
34
|
+
- 架构说明
|
|
35
|
+
- 编码规范
|
|
36
|
+
- 开发指南
|
|
37
|
+
|
|
38
|
+
**产出**: \`{docs_dir}/project-context.md\`
|
|
38
39
|
|
|
39
40
|
---
|
|
40
41
|
|
|
41
42
|
## ✅ 完成检查
|
|
42
43
|
|
|
43
|
-
- [ ] 技术栈已识别
|
|
44
|
-
- [ ] 项目上下文已生成
|
|
45
|
-
- [ ] 文档已保存
|
|
44
|
+
- [ ] 技术栈已识别
|
|
45
|
+
- [ ] 项目上下文已生成
|
|
46
|
+
- [ ] 文档已保存
|
|
46
47
|
|
|
47
48
|
---
|
|
48
49
|
|
|
@@ -50,25 +51,25 @@ const PROMPT_TEMPLATE = `# 📚 快速上手编排指南
|
|
|
50
51
|
|
|
51
52
|
完成后,向用户提供:
|
|
52
53
|
|
|
53
|
-
### 1. 项目概览
|
|
54
|
-
|
|
55
|
-
| 项目 | 内容 |
|
|
56
|
-
|------|------|
|
|
57
|
-
| 项目名称 | [名称] |
|
|
58
|
-
| 项目类型 | [前端/后端/全栈/库] |
|
|
59
|
-
| 主要语言 | [语言] |
|
|
60
|
-
| 框架 | [框架] |
|
|
61
|
-
|
|
62
|
-
### 2. 技术栈
|
|
63
|
-
|
|
64
|
-
| 类别 | 技术 |
|
|
65
|
-
|------|------|
|
|
66
|
-
| 语言 | [语言列表] |
|
|
67
|
-
| 框架 | [框架列表] |
|
|
68
|
-
| 构建工具 | [工具列表] |
|
|
69
|
-
| 测试框架 | [框架列表] |
|
|
70
|
-
|
|
71
|
-
### 3. 快速开始
|
|
54
|
+
### 1. 项目概览
|
|
55
|
+
|
|
56
|
+
| 项目 | 内容 |
|
|
57
|
+
|------|------|
|
|
58
|
+
| 项目名称 | [名称] |
|
|
59
|
+
| 项目类型 | [前端/后端/全栈/库] |
|
|
60
|
+
| 主要语言 | [语言] |
|
|
61
|
+
| 框架 | [框架] |
|
|
62
|
+
|
|
63
|
+
### 2. 技术栈
|
|
64
|
+
|
|
65
|
+
| 类别 | 技术 |
|
|
66
|
+
|------|------|
|
|
67
|
+
| 语言 | [语言列表] |
|
|
68
|
+
| 框架 | [框架列表] |
|
|
69
|
+
| 构建工具 | [工具列表] |
|
|
70
|
+
| 测试框架 | [框架列表] |
|
|
71
|
+
|
|
72
|
+
### 3. 快速开始
|
|
72
73
|
|
|
73
74
|
\`\`\`bash
|
|
74
75
|
# 安装依赖
|
|
@@ -81,7 +82,7 @@ const PROMPT_TEMPLATE = `# 📚 快速上手编排指南
|
|
|
81
82
|
[测试命令]
|
|
82
83
|
\`\`\`
|
|
83
84
|
|
|
84
|
-
### 4. 下一步建议
|
|
85
|
+
### 4. 下一步建议
|
|
85
86
|
|
|
86
87
|
1. 阅读 \`{docs_dir}/project-context.md\` 了解详细信息
|
|
87
88
|
2. 查看 README.md 了解项目背景
|
|
@@ -92,8 +93,10 @@ const PROMPT_TEMPLATE = `# 📚 快速上手编排指南
|
|
|
92
93
|
|
|
93
94
|
*编排工具: MCP Probe Kit - start_onboard*
|
|
94
95
|
`;
|
|
95
|
-
export async function startOnboard(args) {
|
|
96
|
+
export async function startOnboard(args, context) {
|
|
96
97
|
try {
|
|
98
|
+
throwIfAborted(context?.signal, "start_onboard 已取消");
|
|
99
|
+
await reportToolProgress(context, 10, "start_onboard: 解析参数");
|
|
97
100
|
// 智能参数解析,支持自然语言输入
|
|
98
101
|
const parsedArgs = parseArgs(args, {
|
|
99
102
|
defaultValues: {
|
|
@@ -108,6 +111,8 @@ export async function startOnboard(args) {
|
|
|
108
111
|
});
|
|
109
112
|
const projectPath = getString(parsedArgs.project_path) || ".";
|
|
110
113
|
const docsDir = getString(parsedArgs.docs_dir) || "docs";
|
|
114
|
+
throwIfAborted(context?.signal, "start_onboard 已取消");
|
|
115
|
+
await reportToolProgress(context, 85, "start_onboard: 生成执行计划");
|
|
111
116
|
const header = renderOrchestrationHeader({
|
|
112
117
|
tool: 'start_onboard',
|
|
113
118
|
goal: '快速了解并上手项目',
|
|
@@ -165,6 +170,7 @@ export async function startOnboard(args) {
|
|
|
165
170
|
plan,
|
|
166
171
|
},
|
|
167
172
|
};
|
|
173
|
+
await reportToolProgress(context, 95, "start_onboard: 输出已生成");
|
|
168
174
|
return okStructured(guide, onboardingReport, {
|
|
169
175
|
schema: OnboardingReportSchema,
|
|
170
176
|
note: 'AI 应该按照指南执行步骤,并在上下文生成后更新 structuredContent 中的项目信息',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type ToolExecutionContext } from "../lib/tool-execution-context.js";
|
|
1
2
|
/**
|
|
2
3
|
* start_product - 产品设计完整工作流指导
|
|
3
4
|
*
|
|
4
5
|
* 返回从需求到 HTML 原型的完整工作流执行指导,由 AI 按步骤调用工具并创建文件
|
|
5
6
|
*/
|
|
6
|
-
export declare function startProduct(args: any): Promise<import("../lib/response.js").ToolResponse | {
|
|
7
|
+
export declare function startProduct(args: any, context?: ToolExecutionContext): Promise<import("../lib/response.js").ToolResponse | {
|
|
7
8
|
content: {
|
|
8
9
|
type: string;
|
|
9
10
|
text: string;
|
|
@@ -3,13 +3,16 @@ import { promises as fs } from "fs";
|
|
|
3
3
|
import { okStructured } from "../lib/response.js";
|
|
4
4
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
5
5
|
import { WorkflowReportSchema } from "../schemas/structured-output.js";
|
|
6
|
+
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
6
7
|
/**
|
|
7
8
|
* start_product - 产品设计完整工作流指导
|
|
8
9
|
*
|
|
9
10
|
* 返回从需求到 HTML 原型的完整工作流执行指导,由 AI 按步骤调用工具并创建文件
|
|
10
11
|
*/
|
|
11
|
-
export async function startProduct(args) {
|
|
12
|
+
export async function startProduct(args, context) {
|
|
12
13
|
try {
|
|
14
|
+
throwIfAborted(context?.signal, "start_product 已取消");
|
|
15
|
+
await reportToolProgress(context, 10, "start_product: 解析参数");
|
|
13
16
|
// 使用智能参数解析
|
|
14
17
|
const parsedArgs = parseArgs(args, {
|
|
15
18
|
defaultValues: {
|
|
@@ -36,9 +39,13 @@ export async function startProduct(args) {
|
|
|
36
39
|
const productType = getString(parsedArgs.product_type) || "SaaS";
|
|
37
40
|
const skipDesignSystem = getBoolean(parsedArgs.skip_design_system);
|
|
38
41
|
const docsDir = getString(parsedArgs.docs_dir) || "docs";
|
|
42
|
+
throwIfAborted(context?.signal, "start_product 已取消");
|
|
43
|
+
await reportToolProgress(context, 35, "start_product: 参数解析完成");
|
|
39
44
|
// 如果提供了需求文件,读取文件内容
|
|
40
45
|
let requirementsSource = '';
|
|
41
46
|
if (requirementsFile) {
|
|
47
|
+
throwIfAborted(context?.signal, "start_product 已取消");
|
|
48
|
+
await reportToolProgress(context, 55, "start_product: 读取需求文档");
|
|
42
49
|
try {
|
|
43
50
|
description = await fs.readFile(requirementsFile, 'utf-8');
|
|
44
51
|
requirementsSource = `需求文档文件: ${requirementsFile}`;
|
|
@@ -468,6 +475,7 @@ ${!skipDesignSystem ? `├── design-system.json # 设计系统配
|
|
|
468
475
|
plan,
|
|
469
476
|
},
|
|
470
477
|
};
|
|
478
|
+
await reportToolProgress(context, 95, "start_product: 工作流输出已生成");
|
|
471
479
|
return okStructured(guidanceText, report, {
|
|
472
480
|
schema: WorkflowReportSchema,
|
|
473
481
|
note: 'AI 应该严格按照执行计划调用工具并创建文档',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type ToolExecutionContext } from "../lib/tool-execution-context.js";
|
|
1
2
|
/**
|
|
2
3
|
* start_ralph 主函数
|
|
3
4
|
*/
|
|
4
|
-
export declare function startRalph(args: any): Promise<import("../lib/response.js").ToolResponse | {
|
|
5
|
+
export declare function startRalph(args: any, context?: ToolExecutionContext): Promise<import("../lib/response.js").ToolResponse | {
|
|
5
6
|
content: {
|
|
6
7
|
type: string;
|
|
7
8
|
text: string;
|
|
@@ -2,6 +2,7 @@ import { parseArgs, getString, getNumber } from "../utils/parseArgs.js";
|
|
|
2
2
|
import { okStructured } from "../lib/response.js";
|
|
3
3
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
4
4
|
import { RalphLoopReportSchema } from "../schemas/structured-output.js";
|
|
5
|
+
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
5
6
|
// 默认值(保守安全)
|
|
6
7
|
const DEFAULTS = {
|
|
7
8
|
mode: "safe",
|
|
@@ -664,8 +665,10 @@ cat .ralph/last_output_*.txt
|
|
|
664
665
|
/**
|
|
665
666
|
* start_ralph 主函数
|
|
666
667
|
*/
|
|
667
|
-
export async function startRalph(args) {
|
|
668
|
+
export async function startRalph(args, context) {
|
|
668
669
|
try {
|
|
670
|
+
throwIfAborted(context?.signal, "start_ralph 已取消");
|
|
671
|
+
await reportToolProgress(context, 10, "start_ralph: 解析参数");
|
|
669
672
|
const parsedArgs = parseArgs(args, {
|
|
670
673
|
defaultValues: DEFAULTS,
|
|
671
674
|
primaryField: "goal",
|
|
@@ -705,6 +708,8 @@ export async function startRalph(args) {
|
|
|
705
708
|
};
|
|
706
709
|
// 检测操作系统
|
|
707
710
|
const isWindows = process.platform === "win32";
|
|
711
|
+
throwIfAborted(context?.signal, "start_ralph 已取消");
|
|
712
|
+
await reportToolProgress(context, 60, "start_ralph: 生成脚本模板");
|
|
708
713
|
// 生成所有文件内容
|
|
709
714
|
const promptMd = generatePromptTemplate(params.goal, params.completion_promise, params.test_command);
|
|
710
715
|
const fixPlanMd = generateFixPlanTemplate(params.goal);
|
|
@@ -724,7 +729,7 @@ export async function startRalph(args) {
|
|
|
724
729
|
'按指南运行 loop 并监控结果',
|
|
725
730
|
],
|
|
726
731
|
});
|
|
727
|
-
const output = `${header}${guide}
|
|
732
|
+
const output = `${header}${guide}
|
|
728
733
|
|
|
729
734
|
---
|
|
730
735
|
|
|
@@ -774,7 +779,7 @@ ${normalScript}
|
|
|
774
779
|
5. Run \`ralph_loop_safe.${scriptExt}\`
|
|
775
780
|
6. Monitor progress and logs
|
|
776
781
|
|
|
777
|
-
**Happy coding! 🚀**
|
|
782
|
+
**Happy coding! 🚀**
|
|
778
783
|
`;
|
|
779
784
|
const plan = {
|
|
780
785
|
mode: 'delegated',
|
|
@@ -899,6 +904,7 @@ ${normalScript}
|
|
|
899
904
|
plan,
|
|
900
905
|
},
|
|
901
906
|
};
|
|
907
|
+
await reportToolProgress(context, 95, "start_ralph: 输出已生成");
|
|
902
908
|
return okStructured(output, ralphReport, {
|
|
903
909
|
schema: RalphLoopReportSchema,
|
|
904
910
|
note: 'AI 应该帮助用户创建 .ralph/ 目录并复制文件,然后指导用户启动循环',
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* 3. 搜索/生成 UI 模板
|
|
8
8
|
* 4. 渲染最终代码
|
|
9
9
|
*/
|
|
10
|
+
import { type ToolExecutionContext } from "../lib/tool-execution-context.js";
|
|
10
11
|
/**
|
|
11
12
|
* 统一 UI 开发编排工具
|
|
12
13
|
*/
|
|
13
|
-
export declare function startUi(args: any): Promise<import("../lib/response.js").ToolResponse | {
|
|
14
|
+
export declare function startUi(args: any, context?: ToolExecutionContext): Promise<import("../lib/response.js").ToolResponse | {
|
|
14
15
|
content: {
|
|
15
16
|
type: string;
|
|
16
17
|
text: string;
|