mcp-probe-kit 3.0.3 → 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 +457 -423
- 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 +375 -0
- package/docs/assets/js/tailwind.js +83 -83
- package/docs/assets/logo-zh.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/data/tools.js +21 -21
- 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/i18n/en.json +518 -0
- package/docs/i18n/ja.json +518 -0
- package/docs/i18n/ko.json +518 -0
- package/docs/i18n/zh-CN.json +518 -0
- package/docs/index.html +43 -32
- package/docs/pages/all-tools.html +514 -330
- package/docs/pages/examples.html +689 -673
- package/docs/pages/getting-started.html +589 -577
- package/docs/pages/migration.html +298 -283
- package/package.json +6 -6
- 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
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
# 如何编写测试
|
|
2
|
-
|
|
3
|
-
> 本文档描述 MCP Probe Kit 的测试框架和测试编写规范。
|
|
4
|
-
|
|
5
|
-
## 概述
|
|
6
|
-
|
|
7
|
-
MCP Probe Kit 使用 **Vitest** 作为测试框架,支持单元测试、集成测试和属性测试(Property-based Testing)。
|
|
8
|
-
|
|
9
|
-
## 测试框架
|
|
10
|
-
|
|
11
|
-
### 核心工具
|
|
12
|
-
|
|
13
|
-
| 工具 | 版本 | 用途 |
|
|
14
|
-
|------|------|------|
|
|
15
|
-
| Vitest | 4.0.18 | 测试框架(类似 Jest) |
|
|
16
|
-
| @vitest/ui | 4.0.18 | 测试 UI 界面 |
|
|
17
|
-
| fast-check | 4.5.3 | 属性测试库 |
|
|
18
|
-
|
|
19
|
-
### 测试命令
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# 运行所有测试(单次)
|
|
23
|
-
npm test
|
|
24
|
-
|
|
25
|
-
# 监听模式(自动重新运行)
|
|
26
|
-
npm run test:watch
|
|
27
|
-
|
|
28
|
-
# 启动测试 UI 界面
|
|
29
|
-
npm run test:ui
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## 测试文件组织
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
src/
|
|
36
|
-
├── tools/
|
|
37
|
-
│ ├── __tests__/ # 工具测试目录
|
|
38
|
-
│ │ ├── add_feature.test.ts
|
|
39
|
-
│ │ └── estimate.test.ts
|
|
40
|
-
│ ├── add_feature.ts
|
|
41
|
-
│ └── estimate.ts
|
|
42
|
-
└── utils/
|
|
43
|
-
├── __tests__/ # 工具函数测试目录
|
|
44
|
-
│ ├── bm25.test.ts
|
|
45
|
-
│ └── parseArgs.test.ts
|
|
46
|
-
├── bm25.ts
|
|
47
|
-
└── parseArgs.ts
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**命名规范:**
|
|
51
|
-
- 测试文件名:`*.test.ts` 或 `*.spec.ts`
|
|
52
|
-
- 测试目录:`__tests__/`
|
|
53
|
-
|
|
54
|
-
## 编写单元测试
|
|
55
|
-
|
|
56
|
-
### 基本结构
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { describe, it, expect } from 'vitest';
|
|
60
|
-
import { functionToTest } from '../module.js';
|
|
61
|
-
|
|
62
|
-
describe('模块名称', () => {
|
|
63
|
-
it('应该做某事', () => {
|
|
64
|
-
// Arrange - 准备测试数据
|
|
65
|
-
const input = 'test';
|
|
66
|
-
|
|
67
|
-
// Act - 执行被测试的函数
|
|
68
|
-
const result = functionToTest(input);
|
|
69
|
-
|
|
70
|
-
// Assert - 验证结果
|
|
71
|
-
expect(result).toBe('expected');
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### 实际示例 - 测试参数解析
|
|
77
|
-
|
|
78
|
-
**被测试代码** (`src/utils/parseArgs.ts`):
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
export function parseArgs(input: string): Record<string, any> {
|
|
82
|
-
const args: Record<string, any> = {};
|
|
83
|
-
const regex = /--(\w+)(?:=(\S+))?/g;
|
|
84
|
-
let match;
|
|
85
|
-
|
|
86
|
-
while ((match = regex.exec(input)) !== null) {
|
|
87
|
-
const key = match[1];
|
|
88
|
-
const value = match[2] || true;
|
|
89
|
-
args[key] = value;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return args;
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**测试代码** (`src/utils/__tests__/parseArgs.test.ts`):
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
import { describe, it, expect } from 'vitest';
|
|
100
|
-
import { parseArgs } from '../parseArgs.js';
|
|
101
|
-
|
|
102
|
-
describe('parseArgs', () => {
|
|
103
|
-
it('应该解析带值的参数', () => {
|
|
104
|
-
const result = parseArgs('--name=test --age=25');
|
|
105
|
-
expect(result).toEqual({
|
|
106
|
-
name: 'test',
|
|
107
|
-
age: '25',
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('应该解析布尔标志', () => {
|
|
112
|
-
const result = parseArgs('--verbose --debug');
|
|
113
|
-
expect(result).toEqual({
|
|
114
|
-
verbose: true,
|
|
115
|
-
debug: true,
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('应该处理空字符串', () => {
|
|
120
|
-
const result = parseArgs('');
|
|
121
|
-
expect(result).toEqual({});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('应该处理混合参数', () => {
|
|
125
|
-
const result = parseArgs('--mode=auto --force --output=file.txt');
|
|
126
|
-
expect(result).toEqual({
|
|
127
|
-
mode: 'auto',
|
|
128
|
-
force: true,
|
|
129
|
-
output: 'file.txt',
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## 测试异步函数
|
|
136
|
-
|
|
137
|
-
### 使用 async/await
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
import { describe, it, expect } from 'vitest';
|
|
141
|
-
import { asyncFunction } from '../module.js';
|
|
142
|
-
|
|
143
|
-
describe('异步函数测试', () => {
|
|
144
|
-
it('应该返回正确的结果', async () => {
|
|
145
|
-
const result = await asyncFunction('input');
|
|
146
|
-
expect(result).toBe('expected');
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('应该处理错误', async () => {
|
|
150
|
-
await expect(asyncFunction('invalid')).rejects.toThrow('错误信息');
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### 实际示例 - 测试工具函数
|
|
156
|
-
|
|
157
|
-
```typescript
|
|
158
|
-
import { describe, it, expect } from 'vitest';
|
|
159
|
-
import { gitWorkReport } from '../git_work_report.js';
|
|
160
|
-
|
|
161
|
-
describe('gitWorkReport', () => {
|
|
162
|
-
it('应该在无提交时返回提示', async () => {
|
|
163
|
-
const result = await gitWorkReport({ date: '2020-01-01' });
|
|
164
|
-
|
|
165
|
-
expect(result.content).toBeDefined();
|
|
166
|
-
expect(result.content[0].type).toBe('text');
|
|
167
|
-
expect(result.content[0].text).toContain('当日无代码提交');
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('应该验证必需参数', async () => {
|
|
171
|
-
const result = await gitWorkReport({});
|
|
172
|
-
|
|
173
|
-
expect(result.content[0].text).toContain('请提供');
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('应该支持日期范围', async () => {
|
|
177
|
-
const result = await gitWorkReport({
|
|
178
|
-
start_date: '2026-02-01',
|
|
179
|
-
end_date: '2026-02-06',
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
expect(result.content).toBeDefined();
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Mock 和 Stub
|
|
188
|
-
|
|
189
|
-
### 使用 vi.mock
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
193
|
-
import { exec } from 'child_process';
|
|
194
|
-
|
|
195
|
-
// Mock child_process 模块
|
|
196
|
-
vi.mock('child_process', () => ({
|
|
197
|
-
exec: vi.fn(),
|
|
198
|
-
}));
|
|
199
|
-
|
|
200
|
-
describe('使用 Mock 的测试', () => {
|
|
201
|
-
it('应该调用 exec', async () => {
|
|
202
|
-
const mockExec = exec as any;
|
|
203
|
-
mockExec.mockImplementation((cmd: string, callback: Function) => {
|
|
204
|
-
callback(null, { stdout: 'output', stderr: '' });
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// 测试代码...
|
|
208
|
-
|
|
209
|
-
expect(mockExec).toHaveBeenCalledWith(
|
|
210
|
-
expect.stringContaining('git log'),
|
|
211
|
-
expect.any(Function)
|
|
212
|
-
);
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## 属性测试(Property-based Testing)
|
|
218
|
-
|
|
219
|
-
使用 `fast-check` 进行属性测试,验证函数在各种输入下的行为。
|
|
220
|
-
|
|
221
|
-
### 实际示例 - 测试 BM25 搜索
|
|
222
|
-
|
|
223
|
-
**被测试代码** (`src/utils/bm25.ts`):
|
|
224
|
-
|
|
225
|
-
```typescript
|
|
226
|
-
export function bm25Search(
|
|
227
|
-
query: string,
|
|
228
|
-
documents: string[],
|
|
229
|
-
k1 = 1.5,
|
|
230
|
-
b = 0.75
|
|
231
|
-
): number[] {
|
|
232
|
-
// BM25 算法实现
|
|
233
|
-
// 返回每个文档的相关性分数
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**属性测试** (`src/utils/__tests__/bm25.test.ts`):
|
|
238
|
-
|
|
239
|
-
```typescript
|
|
240
|
-
import { describe, it, expect } from 'vitest';
|
|
241
|
-
import * as fc from 'fast-check';
|
|
242
|
-
import { bm25Search } from '../bm25.js';
|
|
243
|
-
|
|
244
|
-
describe('bm25Search - 属性测试', () => {
|
|
245
|
-
it('应该返回与文档数量相同的分数数组', () => {
|
|
246
|
-
fc.assert(
|
|
247
|
-
fc.property(
|
|
248
|
-
fc.string(),
|
|
249
|
-
fc.array(fc.string(), { minLength: 1, maxLength: 100 }),
|
|
250
|
-
(query, documents) => {
|
|
251
|
-
const scores = bm25Search(query, documents);
|
|
252
|
-
expect(scores.length).toBe(documents.length);
|
|
253
|
-
}
|
|
254
|
-
)
|
|
255
|
-
);
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
it('分数应该都是非负数', () => {
|
|
259
|
-
fc.assert(
|
|
260
|
-
fc.property(
|
|
261
|
-
fc.string(),
|
|
262
|
-
fc.array(fc.string(), { minLength: 1 }),
|
|
263
|
-
(query, documents) => {
|
|
264
|
-
const scores = bm25Search(query, documents);
|
|
265
|
-
expect(scores.every(score => score >= 0)).toBe(true);
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
);
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
it('空查询应该返回全零分数', () => {
|
|
272
|
-
fc.assert(
|
|
273
|
-
fc.property(
|
|
274
|
-
fc.array(fc.string(), { minLength: 1 }),
|
|
275
|
-
(documents) => {
|
|
276
|
-
const scores = bm25Search('', documents);
|
|
277
|
-
expect(scores.every(score => score === 0)).toBe(true);
|
|
278
|
-
}
|
|
279
|
-
)
|
|
280
|
-
);
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
## 测试覆盖率
|
|
286
|
-
|
|
287
|
-
### 查看覆盖率
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
# 运行测试并生成覆盖率报告
|
|
291
|
-
npm test -- --coverage
|
|
292
|
-
|
|
293
|
-
# 在浏览器中查看详细报告
|
|
294
|
-
# 报告位于 coverage/index.html
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
### 覆盖率目标
|
|
298
|
-
|
|
299
|
-
- **语句覆盖率**: > 80%
|
|
300
|
-
- **分支覆盖率**: > 75%
|
|
301
|
-
- **函数覆盖率**: > 80%
|
|
302
|
-
- **行覆盖率**: > 80%
|
|
303
|
-
|
|
304
|
-
## 测试最佳实践
|
|
305
|
-
|
|
306
|
-
### 1. 测试命名
|
|
307
|
-
|
|
308
|
-
使用清晰的描述性名称:
|
|
309
|
-
|
|
310
|
-
```typescript
|
|
311
|
-
// ✅ 好的命名
|
|
312
|
-
it('应该在日期无效时抛出错误', () => {});
|
|
313
|
-
it('应该返回包含 3 个元素的数组', () => {});
|
|
314
|
-
|
|
315
|
-
// ❌ 不好的命名
|
|
316
|
-
it('测试1', () => {});
|
|
317
|
-
it('works', () => {});
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
### 2. 一个测试一个断言
|
|
321
|
-
|
|
322
|
-
```typescript
|
|
323
|
-
// ✅ 好的做法
|
|
324
|
-
it('应该返回正确的名称', () => {
|
|
325
|
-
expect(result.name).toBe('test');
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it('应该返回正确的年龄', () => {
|
|
329
|
-
expect(result.age).toBe(25);
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
// ❌ 不好的做法
|
|
333
|
-
it('应该返回正确的结果', () => {
|
|
334
|
-
expect(result.name).toBe('test');
|
|
335
|
-
expect(result.age).toBe(25);
|
|
336
|
-
expect(result.email).toBe('test@example.com');
|
|
337
|
-
});
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
### 3. 使用 describe 分组
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
describe('gitWorkReport', () => {
|
|
344
|
-
describe('日报模式', () => {
|
|
345
|
-
it('应该接受单个日期', () => {});
|
|
346
|
-
it('应该在无提交时返回提示', () => {});
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
describe('周期报模式', () => {
|
|
350
|
-
it('应该接受日期范围', () => {});
|
|
351
|
-
it('应该验证结束日期晚于开始日期', () => {});
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
describe('参数验证', () => {
|
|
355
|
-
it('应该要求至少一个日期参数', () => {});
|
|
356
|
-
it('应该验证日期格式', () => {});
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### 4. 测试边界条件
|
|
362
|
-
|
|
363
|
-
```typescript
|
|
364
|
-
describe('边界条件测试', () => {
|
|
365
|
-
it('应该处理空数组', () => {});
|
|
366
|
-
it('应该处理单个元素', () => {});
|
|
367
|
-
it('应该处理大量元素', () => {});
|
|
368
|
-
it('应该处理 null 值', () => {});
|
|
369
|
-
it('应该处理 undefined 值', () => {});
|
|
370
|
-
});
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
### 5. 避免测试实现细节
|
|
374
|
-
|
|
375
|
-
```typescript
|
|
376
|
-
// ✅ 测试行为
|
|
377
|
-
it('应该返回排序后的数组', () => {
|
|
378
|
-
const result = sortArray([3, 1, 2]);
|
|
379
|
-
expect(result).toEqual([1, 2, 3]);
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
// ❌ 测试实现
|
|
383
|
-
it('应该调用 Array.sort', () => {
|
|
384
|
-
const spy = vi.spyOn(Array.prototype, 'sort');
|
|
385
|
-
sortArray([3, 1, 2]);
|
|
386
|
-
expect(spy).toHaveBeenCalled();
|
|
387
|
-
});
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
## 常用断言
|
|
391
|
-
|
|
392
|
-
```typescript
|
|
393
|
-
// 相等性
|
|
394
|
-
expect(value).toBe(expected); // 严格相等 (===)
|
|
395
|
-
expect(value).toEqual(expected); // 深度相等
|
|
396
|
-
expect(value).not.toBe(expected); // 不相等
|
|
397
|
-
|
|
398
|
-
// 真值
|
|
399
|
-
expect(value).toBeTruthy(); // 真值
|
|
400
|
-
expect(value).toBeFalsy(); // 假值
|
|
401
|
-
expect(value).toBeNull(); // null
|
|
402
|
-
expect(value).toBeUndefined(); // undefined
|
|
403
|
-
expect(value).toBeDefined(); // 已定义
|
|
404
|
-
|
|
405
|
-
// 数字
|
|
406
|
-
expect(value).toBeGreaterThan(3); // > 3
|
|
407
|
-
expect(value).toBeGreaterThanOrEqual(3);// >= 3
|
|
408
|
-
expect(value).toBeLessThan(5); // < 5
|
|
409
|
-
expect(value).toBeCloseTo(0.3); // 浮点数近似
|
|
410
|
-
|
|
411
|
-
// 字符串
|
|
412
|
-
expect(string).toMatch(/pattern/); // 正则匹配
|
|
413
|
-
expect(string).toContain('substring'); // 包含子串
|
|
414
|
-
|
|
415
|
-
// 数组
|
|
416
|
-
expect(array).toContain(item); // 包含元素
|
|
417
|
-
expect(array).toHaveLength(3); // 长度为 3
|
|
418
|
-
|
|
419
|
-
// 对象
|
|
420
|
-
expect(object).toHaveProperty('key'); // 有属性
|
|
421
|
-
expect(object).toMatchObject({ a: 1 }); // 部分匹配
|
|
422
|
-
|
|
423
|
-
// 异常
|
|
424
|
-
expect(() => fn()).toThrow(); // 抛出异常
|
|
425
|
-
expect(() => fn()).toThrow('error'); // 抛出特定消息
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
## 调试测试
|
|
429
|
-
|
|
430
|
-
### 使用 console.log
|
|
431
|
-
|
|
432
|
-
```typescript
|
|
433
|
-
it('调试测试', () => {
|
|
434
|
-
const result = functionToTest();
|
|
435
|
-
console.log('Result:', result); // 输出到控制台
|
|
436
|
-
expect(result).toBe('expected');
|
|
437
|
-
});
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
### 使用 .only 运行单个测试
|
|
441
|
-
|
|
442
|
-
```typescript
|
|
443
|
-
it.only('只运行这个测试', () => {
|
|
444
|
-
// 只有这个测试会运行
|
|
445
|
-
});
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
### 使用 .skip 跳过测试
|
|
449
|
-
|
|
450
|
-
```typescript
|
|
451
|
-
it.skip('暂时跳过这个测试', () => {
|
|
452
|
-
// 这个测试会被跳过
|
|
453
|
-
});
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
---
|
|
457
|
-
*返回索引: [../project-context.md](../project-context.md)*
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# 技术栈
|
|
2
|
-
|
|
3
|
-
> 本文档描述 MCP Probe Kit 的技术栈信息。
|
|
4
|
-
|
|
5
|
-
## 基本信息
|
|
6
|
-
|
|
7
|
-
| 属性 | 值 |
|
|
8
|
-
|------|-----|
|
|
9
|
-
| 项目名称 | MCP Probe Kit |
|
|
10
|
-
| 版本 | 3.0.1 |
|
|
11
|
-
| 语言 | TypeScript |
|
|
12
|
-
| 框架 | Model Context Protocol (MCP) SDK |
|
|
13
|
-
|
|
14
|
-
## 技术栈详情
|
|
15
|
-
|
|
16
|
-
### 核心技术
|
|
17
|
-
|
|
18
|
-
| 类别 | 技术 | 版本 |
|
|
19
|
-
|------|------|------|
|
|
20
|
-
| 语言 | TypeScript | 5.3.0+ |
|
|
21
|
-
| 运行时 | Node.js | 16.0.0+ |
|
|
22
|
-
| 模块系统 | ES Modules (Node16) | - |
|
|
23
|
-
| 框架 | @modelcontextprotocol/sdk | 1.25.3 |
|
|
24
|
-
|
|
25
|
-
### 开发工具
|
|
26
|
-
|
|
27
|
-
| 类别 | 工具 | 用途 |
|
|
28
|
-
|------|------|------|
|
|
29
|
-
| 构建工具 | TypeScript Compiler (tsc) | 编译 TypeScript 到 JavaScript |
|
|
30
|
-
| 测试框架 | Vitest | 单元测试和集成测试 |
|
|
31
|
-
| 测试工具 | fast-check | 属性测试(Property-based Testing) |
|
|
32
|
-
| 开发工具 | tsx | TypeScript 脚本执行 |
|
|
33
|
-
|
|
34
|
-
### 主要依赖
|
|
35
|
-
|
|
36
|
-
| 依赖包 | 版本 | 用途 |
|
|
37
|
-
|--------|------|------|
|
|
38
|
-
| @modelcontextprotocol/sdk | ^1.25.3 | MCP 协议核心 SDK,提供服务器和客户端实现 |
|
|
39
|
-
| csv-parse | ^6.1.0 | CSV 文件解析,用于 UI/UX 数据处理 |
|
|
40
|
-
| tar | ^7.5.6 | TAR 归档文件处理,用于数据同步 |
|
|
41
|
-
|
|
42
|
-
### 开发依赖
|
|
43
|
-
|
|
44
|
-
| 依赖包 | 版本 | 用途 |
|
|
45
|
-
|--------|------|------|
|
|
46
|
-
| @types/node | ^20.0.0 | Node.js 类型定义 |
|
|
47
|
-
| @types/tar | ^6.1.13 | tar 库类型定义 |
|
|
48
|
-
| @vitest/ui | ^4.0.18 | Vitest 测试 UI 界面 |
|
|
49
|
-
| fast-check | ^4.5.3 | 属性测试库 |
|
|
50
|
-
| tsx | ^4.21.0 | TypeScript 执行器 |
|
|
51
|
-
| typescript | ^5.3.0 | TypeScript 编译器 |
|
|
52
|
-
| vitest | ^4.0.18 | 测试框架 |
|
|
53
|
-
|
|
54
|
-
## 编译配置
|
|
55
|
-
|
|
56
|
-
### TypeScript 配置 (tsconfig.json)
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"compilerOptions": {
|
|
61
|
-
"target": "ES2022",
|
|
62
|
-
"module": "Node16",
|
|
63
|
-
"moduleResolution": "Node16",
|
|
64
|
-
"outDir": "./build",
|
|
65
|
-
"rootDir": "./src",
|
|
66
|
-
"strict": true,
|
|
67
|
-
"esModuleInterop": true,
|
|
68
|
-
"skipLibCheck": true,
|
|
69
|
-
"forceConsistentCasingInFileNames": true,
|
|
70
|
-
"resolveJsonModule": true,
|
|
71
|
-
"declaration": true
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**关键配置说明:**
|
|
77
|
-
- `target: ES2022` - 编译目标为 ES2022
|
|
78
|
-
- `module: Node16` - 使用 Node.js 16+ 的 ES 模块系统
|
|
79
|
-
- `strict: true` - 启用所有严格类型检查
|
|
80
|
-
- `declaration: true` - 生成 .d.ts 类型声明文件
|
|
81
|
-
|
|
82
|
-
## 脚本命令
|
|
83
|
-
|
|
84
|
-
| 命令 | 用途 |
|
|
85
|
-
|------|------|
|
|
86
|
-
| `npm run build` | 编译 TypeScript 代码 |
|
|
87
|
-
| `npm run watch` | 监听模式编译 |
|
|
88
|
-
| `npm run dev` | 开发模式(编译并运行) |
|
|
89
|
-
| `npm test` | 运行测试(单次) |
|
|
90
|
-
| `npm run test:watch` | 监听模式运行测试 |
|
|
91
|
-
| `npm run test:ui` | 启动测试 UI 界面 |
|
|
92
|
-
| `npm run inspector` | 启动 MCP Inspector 调试工具 |
|
|
93
|
-
| `npm run sync-ui-data` | 同步 UI/UX 数据 |
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
*返回索引: [../project-context.md](../project-context.md)*
|
package/docs/project-context.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# MCP Probe Kit - 项目上下文
|
|
2
|
-
|
|
3
|
-
> 本文档是项目上下文的索引文件,提供项目概览和文档导航。
|
|
4
|
-
|
|
5
|
-
## 📊 项目概览
|
|
6
|
-
|
|
7
|
-
| 属性 | 值 |
|
|
8
|
-
|------|-----|
|
|
9
|
-
| 项目名称 | MCP Probe Kit |
|
|
10
|
-
| 版本 | 3.0.1 |
|
|
11
|
-
| 语言 | TypeScript |
|
|
12
|
-
| 框架 | Model Context Protocol (MCP) SDK |
|
|
13
|
-
| 类型 | MCP Server / CLI Tool |
|
|
14
|
-
| 描述 | AI 驱动的完整研发工具集,提供 20 个精简工具,覆盖从产品分析到最终发布的全流程 |
|
|
15
|
-
|
|
16
|
-
## 📚 文档导航
|
|
17
|
-
|
|
18
|
-
### [技术栈](./project-context/tech-stack.md)
|
|
19
|
-
项目使用的语言、框架、工具
|
|
20
|
-
|
|
21
|
-
### [架构设计](./project-context/architecture.md)
|
|
22
|
-
项目结构、目录说明、设计模式
|
|
23
|
-
|
|
24
|
-
### [如何开发](./project-context/how-to-develop.md)
|
|
25
|
-
开发新功能的基本步骤
|
|
26
|
-
|
|
27
|
-
### [如何编写测试](./project-context/how-to-test.md)
|
|
28
|
-
测试框架和测试编写规范
|
|
29
|
-
|
|
30
|
-
## 🚀 快速开始
|
|
31
|
-
|
|
32
|
-
1. 阅读 [技术栈](./project-context/tech-stack.md) 了解项目使用的技术
|
|
33
|
-
2. 阅读 [架构设计](./project-context/architecture.md) 了解项目结构
|
|
34
|
-
3. 根据需要查看具体的操作指南
|
|
35
|
-
|
|
36
|
-
## 💡 开发时查看对应文档
|
|
37
|
-
|
|
38
|
-
根据你要做的事情,查看对应的文档:
|
|
39
|
-
|
|
40
|
-
### 添加新工具
|
|
41
|
-
- **架构设计**: [architecture.md](./project-context/architecture.md) - 了解工具系统架构
|
|
42
|
-
- **如何开发**: [how-to-develop.md](./project-context/how-to-develop.md) - 开发新工具的步骤
|
|
43
|
-
|
|
44
|
-
### 调试问题
|
|
45
|
-
- **技术栈**: [tech-stack.md](./project-context/tech-stack.md) - 了解使用的技术
|
|
46
|
-
- **架构设计**: [architecture.md](./project-context/architecture.md) - 了解项目结构
|
|
47
|
-
|
|
48
|
-
### 编写测试
|
|
49
|
-
- **如何编写测试**: [how-to-test.md](./project-context/how-to-test.md)
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
*生成时间: 2026-02-03*
|
|
53
|
-
*生成工具: MCP Probe Kit - init_project_context v3.0*
|