mcp-probe-kit 1.10.1 → 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.
- package/README.md +164 -21
- package/build/index.js +30 -451
- package/build/resources/index.d.ts +4 -0
- package/build/resources/index.js +4 -0
- package/build/resources/tool-params-guide.d.ts +571 -0
- package/build/resources/tool-params-guide.js +488 -0
- package/build/schemas/basic-tools.d.ts +54 -0
- package/build/schemas/basic-tools.js +58 -0
- package/build/schemas/code-analysis-tools.d.ts +156 -0
- package/build/schemas/code-analysis-tools.js +165 -0
- package/build/schemas/code-gen-tools.d.ts +150 -0
- package/build/schemas/code-gen-tools.js +158 -0
- package/build/schemas/doc-util-tools.d.ts +85 -0
- package/build/schemas/doc-util-tools.js +93 -0
- package/build/schemas/git-tools.d.ts +76 -0
- package/build/schemas/git-tools.js +81 -0
- package/build/schemas/index.d.ts +893 -0
- package/build/schemas/index.js +22 -0
- package/build/schemas/interview-tools.d.ts +72 -0
- package/build/schemas/interview-tools.js +64 -0
- package/build/schemas/orchestration-tools.d.ts +244 -0
- package/build/schemas/orchestration-tools.js +255 -0
- package/build/schemas/project-tools.d.ts +84 -0
- package/build/schemas/project-tools.js +89 -0
- package/build/tools/add_feature.js +68 -5
- package/build/tools/ask_user.d.ts +17 -0
- package/build/tools/ask_user.js +124 -0
- package/build/tools/css_order.js +55 -55
- package/build/tools/index.d.ts +3 -0
- package/build/tools/index.js +4 -0
- package/build/tools/interview.d.ts +18 -0
- package/build/tools/interview.js +418 -0
- package/build/tools/start_feature.js +64 -7
- package/build/tools/start_ralph.d.ts +16 -0
- package/build/tools/start_ralph.js +779 -0
- package/build/utils/parseArgs.js +12 -1
- package/docs/BEST_PRACTICES.md +200 -6
- package/docs/HOW_TO_TRIGGER.html +14 -2
- package/docs/HOW_TO_TRIGGER.md +125 -64
- package/docs/MCP-Probe-Kit-/344/275/277/347/224/250/346/211/213/345/206/214.html +83 -48
- package/docs/MCP-Probe-Kit-/344/275/277/347/224/250/346/211/213/345/206/214.md +291 -34
- package/package.json +2 -2
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 项目管理工具的 Schema 定义
|
|
3
|
+
*/
|
|
4
|
+
export declare const projectToolSchemas: readonly [{
|
|
5
|
+
readonly name: "analyze_project";
|
|
6
|
+
readonly description: "当用户需要了解项目结构、分析项目技术栈时使用。分析项目结构、技术栈、架构模式,输出项目全景报告";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly project_path: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "项目路径。可选,默认为当前目录";
|
|
13
|
+
};
|
|
14
|
+
readonly max_depth: {
|
|
15
|
+
readonly type: "number";
|
|
16
|
+
readonly description: "分析深度。可选,默认 5";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly required: readonly [];
|
|
20
|
+
readonly additionalProperties: true;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "init_project_context";
|
|
24
|
+
readonly description: "当用户需要生成项目上下文文档、帮助团队快速上手时使用。生成项目上下文文档(技术栈/架构/编码规范),供后续开发参考";
|
|
25
|
+
readonly inputSchema: {
|
|
26
|
+
readonly type: "object";
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly docs_dir: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly description: "文档目录。可选,默认 docs";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly required: readonly [];
|
|
34
|
+
readonly additionalProperties: true;
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "add_feature";
|
|
38
|
+
readonly description: "当用户需要添加新功能、生成功能规格文档时使用。生成新功能规格文档(需求/设计/任务清单),基于项目上下文";
|
|
39
|
+
readonly inputSchema: {
|
|
40
|
+
readonly type: "object";
|
|
41
|
+
readonly properties: {
|
|
42
|
+
readonly feature_name: {
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
readonly description: "功能名称(kebab-case 格式,如 user-auth)。可选,如果不提供会从 description 自动提取";
|
|
45
|
+
};
|
|
46
|
+
readonly description: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
readonly description: "功能详细描述。可以是简短的自然语言(如'添加用户认证功能')或详细的需求说明";
|
|
49
|
+
};
|
|
50
|
+
readonly docs_dir: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly description: "文档输出目录,默认为 docs";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly required: readonly [];
|
|
56
|
+
readonly additionalProperties: true;
|
|
57
|
+
};
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "estimate";
|
|
60
|
+
readonly description: "当用户需要估算开发工作量、评估任务时间时使用。估算开发工作量,输出故事点、时间范围(乐观/正常/悲观)、风险点";
|
|
61
|
+
readonly inputSchema: {
|
|
62
|
+
readonly type: "object";
|
|
63
|
+
readonly properties: {
|
|
64
|
+
readonly task_description: {
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly description: "任务描述。可以是简短的自然语言(如'估算开发工作量')或详细的任务说明";
|
|
67
|
+
};
|
|
68
|
+
readonly code_context: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
readonly description: "相关代码或文件上下文。可选,有助于更准确的估算";
|
|
71
|
+
};
|
|
72
|
+
readonly team_size: {
|
|
73
|
+
readonly type: "number";
|
|
74
|
+
readonly description: "团队规模(人数)。可选,默认为 1";
|
|
75
|
+
};
|
|
76
|
+
readonly experience_level: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly description: "经验水平:junior(初级)、mid(中级)、senior(高级)。可选,默认为 mid";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly required: readonly [];
|
|
82
|
+
readonly additionalProperties: true;
|
|
83
|
+
};
|
|
84
|
+
}];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 项目管理工具的 Schema 定义
|
|
3
|
+
*/
|
|
4
|
+
export const projectToolSchemas = [
|
|
5
|
+
{
|
|
6
|
+
name: "analyze_project",
|
|
7
|
+
description: "当用户需要了解项目结构、分析项目技术栈时使用。分析项目结构、技术栈、架构模式,输出项目全景报告",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
project_path: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "项目路径。可选,默认为当前目录",
|
|
14
|
+
},
|
|
15
|
+
max_depth: {
|
|
16
|
+
type: "number",
|
|
17
|
+
description: "分析深度。可选,默认 5",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: [],
|
|
21
|
+
additionalProperties: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "init_project_context",
|
|
26
|
+
description: "当用户需要生成项目上下文文档、帮助团队快速上手时使用。生成项目上下文文档(技术栈/架构/编码规范),供后续开发参考",
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
docs_dir: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "文档目录。可选,默认 docs",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: [],
|
|
36
|
+
additionalProperties: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "add_feature",
|
|
41
|
+
description: "当用户需要添加新功能、生成功能规格文档时使用。生成新功能规格文档(需求/设计/任务清单),基于项目上下文",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
feature_name: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "功能名称(kebab-case 格式,如 user-auth)。可选,如果不提供会从 description 自动提取",
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "功能详细描述。可以是简短的自然语言(如'添加用户认证功能')或详细的需求说明",
|
|
52
|
+
},
|
|
53
|
+
docs_dir: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "文档输出目录,默认为 docs",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
required: [],
|
|
59
|
+
additionalProperties: true,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "estimate",
|
|
64
|
+
description: "当用户需要估算开发工作量、评估任务时间时使用。估算开发工作量,输出故事点、时间范围(乐观/正常/悲观)、风险点",
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {
|
|
68
|
+
task_description: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "任务描述。可以是简短的自然语言(如'估算开发工作量')或详细的任务说明",
|
|
71
|
+
},
|
|
72
|
+
code_context: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "相关代码或文件上下文。可选,有助于更准确的估算",
|
|
75
|
+
},
|
|
76
|
+
team_size: {
|
|
77
|
+
type: "number",
|
|
78
|
+
description: "团队规模(人数)。可选,默认为 1",
|
|
79
|
+
},
|
|
80
|
+
experience_level: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "经验水平:junior(初级)、mid(中级)、senior(高级)。可选,默认为 mid",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
required: [],
|
|
86
|
+
additionalProperties: true,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseArgs, getString
|
|
1
|
+
import { parseArgs, getString } from "../utils/parseArgs.js";
|
|
2
2
|
/**
|
|
3
3
|
* add_feature 工具
|
|
4
4
|
*
|
|
@@ -12,6 +12,46 @@ import { parseArgs, getString, validateRequired } from "../utils/parseArgs.js";
|
|
|
12
12
|
*/
|
|
13
13
|
// 默认文档目录
|
|
14
14
|
const DEFAULT_DOCS_DIR = "docs";
|
|
15
|
+
/**
|
|
16
|
+
* 从自然语言输入中提取功能名和描述
|
|
17
|
+
* @param input - 自然语言输入
|
|
18
|
+
* @returns 提取的功能名和描述
|
|
19
|
+
*/
|
|
20
|
+
function extractFeatureInfo(input) {
|
|
21
|
+
// 移除常见的引导词
|
|
22
|
+
let text = input
|
|
23
|
+
.replace(/^(添加|实现|开发|创建|新增|生成|构建|做|要|想要|需要|帮我|请|麻烦)/i, "")
|
|
24
|
+
.trim();
|
|
25
|
+
// 移除结尾的"功能"、"模块"等词
|
|
26
|
+
text = text.replace(/(功能|模块|特性|组件|系统|服务)$/i, "").trim();
|
|
27
|
+
// 如果文本很短(少于20个字符),直接作为功能名
|
|
28
|
+
if (text.length < 20) {
|
|
29
|
+
const name = text
|
|
30
|
+
.toLowerCase()
|
|
31
|
+
.replace(/[\s\u4e00-\u9fa5]+/g, "-") // 将空格和中文替换为连字符
|
|
32
|
+
.replace(/[^a-z0-9-]/g, "") // 移除非字母数字和连字符
|
|
33
|
+
.replace(/-+/g, "-") // 合并多个连字符
|
|
34
|
+
.replace(/^-|-$/g, ""); // 移除首尾连字符
|
|
35
|
+
return {
|
|
36
|
+
name: name || "new-feature",
|
|
37
|
+
description: input,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// 如果文本较长,尝试提取关键词作为功能名
|
|
41
|
+
// 提取前几个关键词
|
|
42
|
+
const words = text.split(/[\s,,、]+/).filter(w => w.length > 0);
|
|
43
|
+
const keyWords = words.slice(0, 3).join(" ");
|
|
44
|
+
const name = keyWords
|
|
45
|
+
.toLowerCase()
|
|
46
|
+
.replace(/[\s\u4e00-\u9fa5]+/g, "-")
|
|
47
|
+
.replace(/[^a-z0-9-]/g, "")
|
|
48
|
+
.replace(/-+/g, "-")
|
|
49
|
+
.replace(/^-|-$/g, "");
|
|
50
|
+
return {
|
|
51
|
+
name: name || "new-feature",
|
|
52
|
+
description: input,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
15
55
|
// 提示词模板
|
|
16
56
|
const PROMPT_TEMPLATE = `# 添加新功能指南
|
|
17
57
|
|
|
@@ -431,18 +471,41 @@ export async function addFeature(args) {
|
|
|
431
471
|
description: "",
|
|
432
472
|
docs_dir: DEFAULT_DOCS_DIR,
|
|
433
473
|
},
|
|
434
|
-
primaryField: "
|
|
474
|
+
primaryField: "input", // 纯文本输入默认映射到 input 字段
|
|
435
475
|
fieldAliases: {
|
|
436
476
|
feature_name: ["name", "feature", "功能名", "功能名称"],
|
|
437
477
|
description: ["desc", "requirement", "描述", "需求"],
|
|
438
478
|
docs_dir: ["dir", "output", "目录", "文档目录"],
|
|
439
479
|
},
|
|
440
480
|
});
|
|
441
|
-
|
|
442
|
-
|
|
481
|
+
let featureName = getString(parsedArgs.feature_name);
|
|
482
|
+
let description = getString(parsedArgs.description);
|
|
443
483
|
const docsDir = getString(parsedArgs.docs_dir) || DEFAULT_DOCS_DIR;
|
|
484
|
+
// 如果是纯自然语言输入(input 字段有值但 feature_name 和 description 为空)
|
|
485
|
+
const input = getString(parsedArgs.input);
|
|
486
|
+
if (input && !featureName && !description) {
|
|
487
|
+
// 智能提取功能名和描述
|
|
488
|
+
// 尝试从自然语言中提取功能名(通常是关键词)
|
|
489
|
+
const extracted = extractFeatureInfo(input);
|
|
490
|
+
featureName = extracted.name;
|
|
491
|
+
description = extracted.description;
|
|
492
|
+
}
|
|
493
|
+
// 如果只有 description 没有 feature_name,尝试从 description 提取
|
|
494
|
+
if (!featureName && description) {
|
|
495
|
+
const extracted = extractFeatureInfo(description);
|
|
496
|
+
featureName = extracted.name;
|
|
497
|
+
if (!description || description === featureName) {
|
|
498
|
+
description = extracted.description;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
444
501
|
// 验证必填参数
|
|
445
|
-
|
|
502
|
+
if (!featureName || !description) {
|
|
503
|
+
throw new Error("请提供功能名称和描述。\n\n" +
|
|
504
|
+
"示例用法:\n" +
|
|
505
|
+
"- 自然语言:'添加用户认证功能'\n" +
|
|
506
|
+
"- 详细描述:'实现用户登录、注册和密码重置功能'\n" +
|
|
507
|
+
"- JSON格式:{\"feature_name\": \"user-auth\", \"description\": \"用户认证功能\"}");
|
|
508
|
+
}
|
|
446
509
|
// 构建指南文本(替换占位符)
|
|
447
510
|
const guide = PROMPT_TEMPLATE
|
|
448
511
|
.replace(/{feature_name}/g, featureName)
|
|
@@ -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
|
+
}
|
package/build/tools/css_order.js
CHANGED
|
@@ -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: [
|
package/build/tools/index.d.ts
CHANGED
|
@@ -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";
|
package/build/tools/index.js
CHANGED
|
@@ -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
|
+
}>;
|