mcp-probe-kit 1.11.0 → 1.13.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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ask_user - 向用户提问工具
3
+ * 当 AI 需要更多信息时,可以主动向用户提问
4
+ */
5
+ export declare function askUser(args: any): Promise<{
6
+ content: {
7
+ type: string;
8
+ text: string;
9
+ }[];
10
+ isError?: undefined;
11
+ } | {
12
+ content: {
13
+ type: string;
14
+ text: string;
15
+ }[];
16
+ isError: boolean;
17
+ }>;
@@ -0,0 +1,124 @@
1
+ /**
2
+ * ask_user - 向用户提问工具
3
+ * 当 AI 需要更多信息时,可以主动向用户提问
4
+ */
5
+ import { parseArgs } from "../utils/parseArgs.js";
6
+ export async function askUser(args) {
7
+ try {
8
+ // 解析参数
9
+ const parsed = parseArgs(args, {
10
+ primaryField: "question",
11
+ fieldAliases: {
12
+ question: ["q", "ask"],
13
+ },
14
+ });
15
+ const question = parsed.question;
16
+ const questions = parsed.questions;
17
+ const context = parsed.context;
18
+ const reason = parsed.reason;
19
+ if (!question && !questions) {
20
+ return {
21
+ content: [
22
+ {
23
+ type: "text",
24
+ text: `# ❓ 向用户提问工具
25
+
26
+ ## 使用方法
27
+
28
+ ### 单个问题
29
+ \`\`\`
30
+ ask_user "你希望支持哪些支付方式?"
31
+ \`\`\`
32
+
33
+ ### 多个问题
34
+ \`\`\`
35
+ ask_user --questions [
36
+ "目标用户是谁?",
37
+ "预期的并发量是多少?",
38
+ "有预算限制吗?"
39
+ ]
40
+ \`\`\`
41
+
42
+ ### 带上下文的问题
43
+ \`\`\`
44
+ ask_user "是否需要支持移动端?" --context "当前只有 PC 端实现"
45
+ \`\`\`
46
+
47
+ ## 使用场景
48
+
49
+ - 需求不明确时主动澄清
50
+ - 技术方案选择需要用户决策
51
+ - 发现潜在风险需要确认
52
+ - 需要补充业务背景信息
53
+
54
+ ## 最佳实践
55
+
56
+ 1. **问题要具体** - 避免过于宽泛的问题
57
+ 2. **提供上下文** - 说明为什么要问这个问题
58
+ 3. **给出选项** - 如果有明确的选项,列出来
59
+ 4. **标注重要性** - 区分必答和可选问题`,
60
+ },
61
+ ],
62
+ };
63
+ }
64
+ const lines = [];
65
+ lines.push("# ❓ AI 需要向你确认一些信息");
66
+ lines.push("");
67
+ if (reason) {
68
+ lines.push(`**提问原因**: ${reason}`);
69
+ lines.push("");
70
+ }
71
+ if (context) {
72
+ lines.push("## 背景信息");
73
+ lines.push("");
74
+ lines.push(context);
75
+ lines.push("");
76
+ }
77
+ lines.push("## 问题");
78
+ lines.push("");
79
+ if (questions && questions.length > 0) {
80
+ // 多个问题
81
+ for (let i = 0; i < questions.length; i++) {
82
+ const q = questions[i];
83
+ const required = q.required !== false ? "**[必答]**" : "_[可选]_";
84
+ lines.push(`### ${i + 1}. ${q.question} ${required}`);
85
+ lines.push("");
86
+ if (q.context) {
87
+ lines.push(`_${q.context}_`);
88
+ lines.push("");
89
+ }
90
+ if (q.options && q.options.length > 0) {
91
+ lines.push("**可选项**:");
92
+ for (const option of q.options) {
93
+ lines.push(`- ${option}`);
94
+ }
95
+ lines.push("");
96
+ }
97
+ lines.push("**你的回答**: ");
98
+ lines.push("");
99
+ lines.push("---");
100
+ lines.push("");
101
+ }
102
+ }
103
+ else if (question) {
104
+ // 单个问题
105
+ lines.push(`**${question}**`);
106
+ lines.push("");
107
+ lines.push("**你的回答**: ");
108
+ lines.push("");
109
+ }
110
+ lines.push("---");
111
+ lines.push("");
112
+ lines.push("💡 **提示**: 请回答上述问题,我会根据你的回答继续工作。");
113
+ return {
114
+ content: [{ type: "text", text: lines.join("\n") }],
115
+ };
116
+ }
117
+ catch (error) {
118
+ const errorMsg = error instanceof Error ? error.message : String(error);
119
+ return {
120
+ content: [{ type: "text", text: `❌ 提问失败: ${errorMsg}` }],
121
+ isError: true,
122
+ };
123
+ }
124
+ }
@@ -1,61 +1,61 @@
1
1
  // css_order 工具实现
2
2
  export async function cssOrder(_args) {
3
3
  try {
4
- const message = `请根据以下规则**书写或重排 CSS**(不是解释规则)。目标是让 CSS 属性顺序更一致、可读、可维护。
5
-
6
- 如果我提供了 CSS 片段/文件,请直接给出**已按规则整理后的 CSS**;如果没提供,请先让我提供需要处理的 CSS。
7
-
8
- ---
9
-
10
- ## 排序逻辑(由外向内,由大到小)
11
-
12
- 将属性分为五类,按顺序排列:
13
-
14
- ### 1. 定位属性 (Positioning)
15
- 决定元素“在哪里”。
16
- - \`position\` / \`z-index\` / \`top\` / \`right\` / \`bottom\` / \`left\` / \`float\` / \`clear\`
17
-
18
- ### 2. 盒子模型 (Box Model)
19
- 决定元素“占多大空间”。
20
- - \`display\` / \`flex\` / \`grid\` 相关属性
21
- - \`width\` / \`height\` / \`max-width\` / \`min-width\`
22
- - \`margin\` / \`padding\` / \`border\`
23
- - \`box-sizing\` / \`overflow\`
24
-
25
- ### 3. 文本排版 (Typography)
26
- 决定元素内“文字内容”的样式。
27
- - \`font-family\` / \`font-size\` / \`font-weight\` / \`line-height\`
28
- - \`text-align\` / \`text-transform\` / \`text-decoration\` / \`letter-spacing\` / \`white-space\` / \`color\`
29
-
30
- ### 4. 视觉表现 (Visual/Decoration)
31
- 决定元素“皮肤”的外观。
32
- - \`background\` / \`box-shadow\` / \`opacity\` / \`visibility\` / \`cursor\` / \`outline\`
33
-
34
- ### 5. 其他与交互 (Misc/Transitions)
35
- 动效和交互相关。
36
- - \`transition\` / \`animation\` / \`transform\` / \`will-change\`
37
-
38
- ---
39
-
40
- ## 处理要求
41
-
42
- 1. **只调整属性顺序,不改动语义**(除非存在明显重复/冲突属性)。
43
- 2. **保留注释与格式风格**(缩进、空行、选择器顺序不变)。
44
- 3. **同类属性保持原有相对顺序**,除非有明显更合理的排序。
45
- 4. 如果存在 **CSS 变量**(\`--*\`)或自定义属性,放在**当前类的最前**。
46
- 5. 如遇 CSS-in-JS、Tailwind 或非标准语法,**只处理可确定的纯 CSS 属性**。
47
-
48
- ---
49
-
50
- ## 快速对比表
51
-
52
- | 顺序 | 类别 | 常用属性举例 | 核心目的 |
53
- | --- | --- | --- | --- |
54
- | **1** | **定位** | \`position\`, \`z-index\`, \`top\` | 确定位置 |
55
- | **2** | **盒模型** | \`display\`, \`width\`, \`margin\`, \`padding\` | 确定形状和间距 |
56
- | **3** | **排版** | \`font\`, \`line-height\`, \`color\`, \`text-align\` | 确定内容样式 |
57
- | **4** | **视觉** | \`background\`, \`border-radius\`, \`box-shadow\` | 确定外观修饰 |
58
- | **5** | **其他** | \`transition\`, \`transform\`, \`animation\` | 确定动态交互 |
4
+ const message = `请根据以下规则**书写或重排 CSS**(不是解释规则)。目标是让 CSS 属性顺序更一致、可读、可维护。
5
+
6
+ 如果我提供了 CSS 片段/文件,请直接给出**已按规则整理后的 CSS**;如果没提供,请先让我提供需要处理的 CSS。
7
+
8
+ ---
9
+
10
+ ## 排序逻辑(由外向内,由大到小)
11
+
12
+ 将属性分为五类,按顺序排列:
13
+
14
+ ### 1. 定位属性 (Positioning)
15
+ 决定元素“在哪里”。
16
+ - \`position\` / \`z-index\` / \`top\` / \`right\` / \`bottom\` / \`left\` / \`float\` / \`clear\`
17
+
18
+ ### 2. 盒子模型 (Box Model)
19
+ 决定元素“占多大空间”。
20
+ - \`display\` / \`flex\` / \`grid\` 相关属性
21
+ - \`width\` / \`height\` / \`max-width\` / \`min-width\`
22
+ - \`margin\` / \`padding\` / \`border\`
23
+ - \`box-sizing\` / \`overflow\`
24
+
25
+ ### 3. 文本排版 (Typography)
26
+ 决定元素内“文字内容”的样式。
27
+ - \`font-family\` / \`font-size\` / \`font-weight\` / \`line-height\`
28
+ - \`text-align\` / \`text-transform\` / \`text-decoration\` / \`letter-spacing\` / \`white-space\` / \`color\`
29
+
30
+ ### 4. 视觉表现 (Visual/Decoration)
31
+ 决定元素“皮肤”的外观。
32
+ - \`background\` / \`box-shadow\` / \`opacity\` / \`visibility\` / \`cursor\` / \`outline\`
33
+
34
+ ### 5. 其他与交互 (Misc/Transitions)
35
+ 动效和交互相关。
36
+ - \`transition\` / \`animation\` / \`transform\` / \`will-change\`
37
+
38
+ ---
39
+
40
+ ## 处理要求
41
+
42
+ 1. **只调整属性顺序,不改动语义**(除非存在明显重复/冲突属性)。
43
+ 2. **保留注释与格式风格**(缩进、空行、选择器顺序不变)。
44
+ 3. **同类属性保持原有相对顺序**,除非有明显更合理的排序。
45
+ 4. 如果存在 **CSS 变量**(\`--*\`)或自定义属性,放在**当前类的最前**。
46
+ 5. 如遇 CSS-in-JS、Tailwind 或非标准语法,**只处理可确定的纯 CSS 属性**。
47
+
48
+ ---
49
+
50
+ ## 快速对比表
51
+
52
+ | 顺序 | 类别 | 常用属性举例 | 核心目的 |
53
+ | --- | --- | --- | --- |
54
+ | **1** | **定位** | \`position\`, \`z-index\`, \`top\` | 确定位置 |
55
+ | **2** | **盒模型** | \`display\`, \`width\`, \`margin\`, \`padding\` | 确定形状和间距 |
56
+ | **3** | **排版** | \`font\`, \`line-height\`, \`color\`, \`text-align\` | 确定内容样式 |
57
+ | **4** | **视觉** | \`background\`, \`border-radius\`, \`box-shadow\` | 确定外观修饰 |
58
+ | **5** | **其他** | \`transition\`, \`transform\`, \`animation\` | 确定动态交互 |
59
59
  `;
60
60
  return {
61
61
  content: [
@@ -38,3 +38,6 @@ export { startOnboard } from "./start_onboard.js";
38
38
  export { startApi } from "./start_api.js";
39
39
  export { startDoc } from "./start_doc.js";
40
40
  export { genSkill } from "./gen_skill.js";
41
+ export { startRalph } from "./start_ralph.js";
42
+ export { interview } from "./interview.js";
43
+ export { askUser } from "./ask_user.js";
@@ -39,3 +39,7 @@ export { startOnboard } from "./start_onboard.js";
39
39
  export { startApi } from "./start_api.js";
40
40
  export { startDoc } from "./start_doc.js";
41
41
  export { genSkill } from "./gen_skill.js";
42
+ export { startRalph } from "./start_ralph.js";
43
+ // 访谈工具
44
+ export { interview } from "./interview.js";
45
+ export { askUser } from "./ask_user.js";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * interview - 需求访谈工具
3
+ * 在开发前通过结构化访谈澄清需求,避免理解偏差
4
+ * 生成访谈记录文件,供后续 start_feature/add_feature 使用
5
+ */
6
+ export declare function interview(args: any): Promise<{
7
+ content: {
8
+ type: string;
9
+ text: string;
10
+ }[];
11
+ isError?: undefined;
12
+ } | {
13
+ content: {
14
+ type: string;
15
+ text: string;
16
+ }[];
17
+ isError: boolean;
18
+ }>;