mcp-probe-kit 3.2.0 → 3.6.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.
Files changed (180) hide show
  1. package/README.md +25 -7
  2. package/build/index.js +45 -79
  3. package/build/lib/__tests__/agents-md-template.unit.test.js +1 -0
  4. package/build/lib/__tests__/dev-workflow.unit.test.js +22 -0
  5. package/build/lib/__tests__/handles.unit.test.js +19 -0
  6. package/build/lib/__tests__/mcp-apps.unit.test.d.ts +1 -0
  7. package/build/lib/__tests__/mcp-apps.unit.test.js +52 -0
  8. package/build/lib/__tests__/mcp-tool-skill-registry.unit.test.d.ts +1 -0
  9. package/build/lib/__tests__/mcp-tool-skill-registry.unit.test.js +18 -0
  10. package/build/lib/__tests__/memory-client.unit.test.js +105 -0
  11. package/build/lib/__tests__/memory-orchestration.unit.test.d.ts +1 -0
  12. package/build/lib/__tests__/memory-orchestration.unit.test.js +88 -0
  13. package/build/lib/__tests__/memory-payload.unit.test.d.ts +1 -0
  14. package/build/lib/__tests__/memory-payload.unit.test.js +35 -0
  15. package/build/lib/__tests__/quality-constraints.unit.test.d.ts +1 -0
  16. package/build/lib/__tests__/quality-constraints.unit.test.js +54 -0
  17. package/build/lib/__tests__/spec-gate.unit.test.d.ts +1 -0
  18. package/build/lib/__tests__/spec-gate.unit.test.js +54 -0
  19. package/build/lib/__tests__/spec-validator.unit.test.js +106 -74
  20. package/build/lib/__tests__/task-defaults.unit.test.d.ts +1 -0
  21. package/build/lib/__tests__/task-defaults.unit.test.js +27 -0
  22. package/build/lib/__tests__/workflow-skill-installer.unit.test.d.ts +1 -0
  23. package/build/lib/__tests__/workflow-skill-installer.unit.test.js +110 -0
  24. package/build/lib/agents-md-template.js +40 -32
  25. package/build/lib/cursor-history-client.d.ts +54 -0
  26. package/build/lib/cursor-history-client.js +240 -0
  27. package/build/lib/dev-workflow.d.ts +36 -0
  28. package/build/lib/dev-workflow.js +497 -0
  29. package/build/lib/handles.d.ts +31 -0
  30. package/build/lib/handles.js +36 -0
  31. package/build/lib/mcp-apps.d.ts +14 -0
  32. package/build/lib/mcp-apps.js +234 -0
  33. package/build/lib/mcp-tool-skill-registry.d.ts +46 -0
  34. package/build/lib/mcp-tool-skill-registry.js +256 -0
  35. package/build/lib/memory-client.d.ts +19 -0
  36. package/build/lib/memory-client.js +69 -0
  37. package/build/lib/memory-orchestration.d.ts +5 -0
  38. package/build/lib/memory-orchestration.js +20 -0
  39. package/build/lib/merge-agents-md.d.ts +2 -2
  40. package/build/lib/merge-agents-md.js +7 -4
  41. package/build/lib/output-schema-registry.d.ts +11 -0
  42. package/build/lib/output-schema-registry.js +80 -0
  43. package/build/lib/quality-constraints.d.ts +54 -0
  44. package/build/lib/quality-constraints.js +155 -0
  45. package/build/lib/skill-bridge.js +12 -12
  46. package/build/lib/spec-gate.d.ts +32 -0
  47. package/build/lib/spec-gate.js +83 -0
  48. package/build/lib/spec-validator.js +16 -3
  49. package/build/lib/task-defaults.d.ts +6 -0
  50. package/build/lib/task-defaults.js +20 -0
  51. package/build/lib/template-loader.js +83 -23
  52. package/build/lib/tool-annotations.js +3 -0
  53. package/build/lib/toolset-manager.js +2 -0
  54. package/build/lib/workflow-skill-installer.d.ts +38 -0
  55. package/build/lib/workflow-skill-installer.js +158 -0
  56. package/build/lib/workflow-skill-template.d.ts +9 -0
  57. package/build/lib/workflow-skill-template.js +85 -0
  58. package/build/lib/workflow-skill-version.d.ts +15 -0
  59. package/build/lib/workflow-skill-version.js +68 -0
  60. package/build/resources/ui-ux-data/guidelines/vercel-web-interface.json +1632 -1632
  61. package/build/resources/ui-ux-data/metadata.json +30 -30
  62. package/build/resources/ui-ux-data/shadcn/blocks.json +2541 -2541
  63. package/build/resources/ui-ux-data/shadcn/components.json +997 -997
  64. package/build/resources/ui-ux-data/themes/presets.json +483 -483
  65. package/build/schemas/index.d.ts +110 -0
  66. package/build/schemas/index.js +1 -0
  67. package/build/schemas/memory-tools.d.ts +83 -0
  68. package/build/schemas/memory-tools.js +43 -0
  69. package/build/schemas/orchestration-tools.d.ts +8 -0
  70. package/build/schemas/orchestration-tools.js +8 -0
  71. package/build/schemas/output/code-insight-tools.d.ts +65 -0
  72. package/build/schemas/output/code-insight-tools.js +42 -0
  73. package/build/schemas/output/memory-tools.d.ts +576 -0
  74. package/build/schemas/output/memory-tools.js +148 -0
  75. package/build/schemas/project-tools.d.ts +19 -0
  76. package/build/schemas/project-tools.js +20 -0
  77. package/build/tools/__tests__/cursor-history.unit.test.d.ts +1 -0
  78. package/build/tools/__tests__/cursor-history.unit.test.js +38 -0
  79. package/build/tools/__tests__/delete_memory_asset.unit.test.d.ts +1 -0
  80. package/build/tools/__tests__/delete_memory_asset.unit.test.js +87 -0
  81. package/build/tools/__tests__/search_memory.unit.test.js +1 -0
  82. package/build/tools/__tests__/start_bugfix.unit.test.js +34 -1
  83. package/build/tools/__tests__/update_memory_asset.unit.test.d.ts +1 -0
  84. package/build/tools/__tests__/update_memory_asset.unit.test.js +82 -0
  85. package/build/tools/__tests__/workflow.unit.test.d.ts +1 -0
  86. package/build/tools/__tests__/workflow.unit.test.js +24 -0
  87. package/build/tools/check_spec.js +16 -16
  88. package/build/tools/code_insight.js +46 -42
  89. package/build/tools/code_review.js +11 -4
  90. package/build/tools/cursor_read_conversation.d.ts +7 -0
  91. package/build/tools/cursor_read_conversation.js +36 -0
  92. package/build/tools/delete_memory_asset.d.ts +7 -0
  93. package/build/tools/delete_memory_asset.js +57 -0
  94. package/build/tools/fix_bug.js +161 -161
  95. package/build/tools/gencommit.js +60 -60
  96. package/build/tools/index.d.ts +3 -0
  97. package/build/tools/index.js +3 -0
  98. package/build/tools/init_project_context.js +432 -432
  99. package/build/tools/search_memory.js +5 -2
  100. package/build/tools/start_bugfix.js +37 -4
  101. package/build/tools/start_feature.js +4 -3
  102. package/build/tools/start_product.js +1 -1
  103. package/build/tools/start_ui.js +22 -4
  104. package/build/tools/ui-ux-tools.d.ts +3 -0
  105. package/build/tools/ui-ux-tools.js +302 -290
  106. package/build/tools/update_memory_asset.d.ts +7 -0
  107. package/build/tools/update_memory_asset.js +98 -0
  108. package/build/tools/workflow.d.ts +13 -0
  109. package/build/tools/workflow.js +69 -0
  110. package/build/utils/__tests__/vercel-guidelines-sync.unit.test.js +12 -12
  111. package/build/utils/design-reasoning-engine.d.ts +2 -0
  112. package/build/utils/design-reasoning-engine.js +3 -0
  113. package/build/utils/themes-sync.js +8 -8
  114. package/package.json +6 -3
  115. package/build/resources/index.d.ts +0 -4
  116. package/build/resources/index.js +0 -4
  117. package/build/resources/tool-params-guide.d.ts +0 -571
  118. package/build/resources/tool-params-guide.js +0 -488
  119. package/build/tools/analyze_project.d.ts +0 -1
  120. package/build/tools/analyze_project.js +0 -527
  121. package/build/tools/check_deps.d.ts +0 -13
  122. package/build/tools/check_deps.js +0 -204
  123. package/build/tools/convert.d.ts +0 -13
  124. package/build/tools/convert.js +0 -599
  125. package/build/tools/css_order.d.ts +0 -13
  126. package/build/tools/css_order.js +0 -81
  127. package/build/tools/debug.d.ts +0 -13
  128. package/build/tools/debug.js +0 -131
  129. package/build/tools/design2code.d.ts +0 -20
  130. package/build/tools/design2code.js +0 -426
  131. package/build/tools/detect_shell.d.ts +0 -6
  132. package/build/tools/detect_shell.js +0 -151
  133. package/build/tools/explain.d.ts +0 -13
  134. package/build/tools/explain.js +0 -390
  135. package/build/tools/fix.d.ts +0 -13
  136. package/build/tools/fix.js +0 -303
  137. package/build/tools/gen_mock.d.ts +0 -22
  138. package/build/tools/gen_mock.js +0 -269
  139. package/build/tools/gen_skill.d.ts +0 -13
  140. package/build/tools/gen_skill.js +0 -560
  141. package/build/tools/genapi.d.ts +0 -13
  142. package/build/tools/genapi.js +0 -174
  143. package/build/tools/genchangelog.d.ts +0 -13
  144. package/build/tools/genchangelog.js +0 -250
  145. package/build/tools/gendoc.d.ts +0 -13
  146. package/build/tools/gendoc.js +0 -232
  147. package/build/tools/genpr.d.ts +0 -13
  148. package/build/tools/genpr.js +0 -194
  149. package/build/tools/genreadme.d.ts +0 -13
  150. package/build/tools/genreadme.js +0 -626
  151. package/build/tools/gensql.d.ts +0 -13
  152. package/build/tools/gensql.js +0 -320
  153. package/build/tools/genui.d.ts +0 -13
  154. package/build/tools/genui.js +0 -803
  155. package/build/tools/init_component_catalog.d.ts +0 -22
  156. package/build/tools/init_component_catalog.js +0 -809
  157. package/build/tools/init_setting.d.ts +0 -13
  158. package/build/tools/init_setting.js +0 -47
  159. package/build/tools/perf.d.ts +0 -13
  160. package/build/tools/perf.js +0 -409
  161. package/build/tools/render_ui.d.ts +0 -22
  162. package/build/tools/render_ui.js +0 -384
  163. package/build/tools/resolve_conflict.d.ts +0 -13
  164. package/build/tools/resolve_conflict.js +0 -349
  165. package/build/tools/security_scan.d.ts +0 -22
  166. package/build/tools/security_scan.js +0 -323
  167. package/build/tools/split.d.ts +0 -13
  168. package/build/tools/split.js +0 -599
  169. package/build/tools/start_api.d.ts +0 -13
  170. package/build/tools/start_api.js +0 -193
  171. package/build/tools/start_doc.d.ts +0 -13
  172. package/build/tools/start_doc.js +0 -207
  173. package/build/tools/start_refactor.d.ts +0 -13
  174. package/build/tools/start_refactor.js +0 -188
  175. package/build/tools/start_release.d.ts +0 -13
  176. package/build/tools/start_release.js +0 -167
  177. package/build/tools/start_review.d.ts +0 -13
  178. package/build/tools/start_review.js +0 -175
  179. /package/build/{utils/design-docs-generator.d.ts → lib/__tests__/dev-workflow.unit.test.d.ts} +0 -0
  180. /package/build/{utils/design-docs-generator.js → lib/__tests__/handles.unit.test.d.ts} +0 -0
@@ -0,0 +1,240 @@
1
+ import * as fs from 'node:fs';
2
+ import * as os from 'node:os';
3
+ import * as path from 'node:path';
4
+ import sqlite3 from 'sqlite3';
5
+ import { createToolError } from '../utils/error-handler.js';
6
+ function parseJson(value) {
7
+ if (!value) {
8
+ return null;
9
+ }
10
+ try {
11
+ return JSON.parse(value);
12
+ }
13
+ catch {
14
+ return null;
15
+ }
16
+ }
17
+ function fileExists(filePath) {
18
+ try {
19
+ return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ }
25
+ function resolveCursorGlobalDbPath() {
26
+ const appData = process.env.APPDATA?.trim();
27
+ const homeDir = os.homedir();
28
+ const candidates = [
29
+ appData ? path.join(appData, 'Cursor', 'User', 'globalStorage', 'state.vscdb') : '',
30
+ path.join(homeDir, '.config', 'Cursor', 'User', 'globalStorage', 'state.vscdb'),
31
+ path.join(homeDir, 'Library', 'Application Support', 'Cursor', 'User', 'globalStorage', 'state.vscdb'),
32
+ ].filter(Boolean);
33
+ const hit = candidates.find(fileExists);
34
+ if (!hit) {
35
+ throw createToolError('未找到 Cursor 全局状态库 state.vscdb', undefined, {
36
+ candidates,
37
+ });
38
+ }
39
+ return hit;
40
+ }
41
+ function openDatabase(dbPath) {
42
+ return new Promise((resolve, reject) => {
43
+ const db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (error) => {
44
+ if (error) {
45
+ reject(createToolError(`打开 Cursor 数据库失败: ${error.message}`, error, { dbPath }));
46
+ return;
47
+ }
48
+ resolve(db);
49
+ });
50
+ });
51
+ }
52
+ function closeDatabase(db) {
53
+ return new Promise((resolve, reject) => {
54
+ db.close((error) => {
55
+ if (error) {
56
+ reject(error);
57
+ return;
58
+ }
59
+ resolve();
60
+ });
61
+ });
62
+ }
63
+ function allRows(db, sql, params = []) {
64
+ return new Promise((resolve, reject) => {
65
+ db.all(sql, params, (error, rows) => {
66
+ if (error) {
67
+ reject(error);
68
+ return;
69
+ }
70
+ resolve((rows ?? []));
71
+ });
72
+ });
73
+ }
74
+ function getRow(db, sql, params = []) {
75
+ return new Promise((resolve, reject) => {
76
+ db.get(sql, params, (error, row) => {
77
+ if (error) {
78
+ reject(error);
79
+ return;
80
+ }
81
+ resolve(row);
82
+ });
83
+ });
84
+ }
85
+ function asString(value) {
86
+ return typeof value === 'string' ? value : '';
87
+ }
88
+ function asNumber(value) {
89
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
90
+ }
91
+ function asBoolean(value) {
92
+ return typeof value === 'boolean' ? value : undefined;
93
+ }
94
+ function extractConversationsFromHeaders(payload) {
95
+ const items = payload?.allComposers ?? [];
96
+ return items
97
+ .filter((item) => item?.type === 'head')
98
+ .map((item) => {
99
+ const workspace = item.workspaceIdentifier ?? {};
100
+ const uri = workspace.uri ?? {};
101
+ return {
102
+ composerId: asString(item.composerId),
103
+ name: asString(item.name),
104
+ createdAt: asNumber(item.createdAt),
105
+ lastUpdatedAt: asNumber(item.lastUpdatedAt),
106
+ workspaceId: asString(workspace.id) || undefined,
107
+ workspacePath: asString(uri.fsPath) || undefined,
108
+ mode: asString(item.unifiedMode) || undefined,
109
+ contextUsagePercent: asNumber(item.contextUsagePercent),
110
+ subtitle: asString(item.subtitle) || undefined,
111
+ isArchived: asBoolean(item.isArchived) ?? false,
112
+ source: 'composerHeaders',
113
+ };
114
+ });
115
+ }
116
+ function extractBubbleId(key) {
117
+ const parts = key.split(':');
118
+ return parts[parts.length - 1] || key;
119
+ }
120
+ function extractComposerId(key) {
121
+ const parts = key.split(':');
122
+ return parts.length >= 3 ? parts[1] || '' : '';
123
+ }
124
+ export class CursorHistoryClient {
125
+ async withDatabase(runner) {
126
+ const dbPath = resolveCursorGlobalDbPath();
127
+ const db = await openDatabase(dbPath);
128
+ try {
129
+ return await runner(db);
130
+ }
131
+ catch (error) {
132
+ if (error instanceof Error) {
133
+ throw createToolError(`读取 Cursor 历史失败: ${error.message}`, error, { dbPath });
134
+ }
135
+ throw error;
136
+ }
137
+ finally {
138
+ await closeDatabase(db).catch(() => undefined);
139
+ }
140
+ }
141
+ async loadConversationIndex(db) {
142
+ const row = await getRow(db, "select key, value from ItemTable where key = ?", ['composer.composerHeaders']);
143
+ const payload = parseJson(row?.value);
144
+ return extractConversationsFromHeaders(payload);
145
+ }
146
+ async listConversations(params = {}) {
147
+ return this.withDatabase(async (db) => {
148
+ const titleQuery = (params.titleQuery ?? '').trim().toLowerCase();
149
+ const workspaceQuery = (params.workspaceQuery ?? '').trim().toLowerCase();
150
+ const includeArchived = params.includeArchived ?? false;
151
+ const limit = Math.max(1, Math.min(params.limit ?? 20, 200));
152
+ const conversations = await this.loadConversationIndex(db);
153
+ return conversations
154
+ .filter((item) => includeArchived || !item.isArchived)
155
+ .filter((item) => !titleQuery || item.name.toLowerCase().includes(titleQuery))
156
+ .filter((item) => !workspaceQuery || (item.workspacePath ?? '').toLowerCase().includes(workspaceQuery))
157
+ .sort((a, b) => (b.lastUpdatedAt ?? 0) - (a.lastUpdatedAt ?? 0))
158
+ .slice(0, limit);
159
+ });
160
+ }
161
+ async searchHistory(params) {
162
+ return this.withDatabase(async (db) => {
163
+ const query = (params.query ?? '').trim().toLowerCase();
164
+ if (!query) {
165
+ throw new Error('缺少 query');
166
+ }
167
+ const limit = Math.max(1, Math.min(params.limit ?? 20, 200));
168
+ const composerId = (params.composerId ?? '').trim();
169
+ const index = await this.loadConversationIndex(db);
170
+ const names = new Map(index.map((item) => [item.composerId, item.name]));
171
+ const rows = await allRows(db, 'select key, value from cursorDiskKV where key like ?', [composerId ? `bubbleId:${composerId}:%` : 'bubbleId:%']);
172
+ const matches = rows
173
+ .map((row) => {
174
+ const parsed = parseJson(row.value);
175
+ if (!parsed) {
176
+ return null;
177
+ }
178
+ const text = asString(parsed.text);
179
+ const requestId = asString(parsed.requestId);
180
+ const haystack = `${row.key}\n${text}\n${requestId}`.toLowerCase();
181
+ if (!haystack.includes(query)) {
182
+ return null;
183
+ }
184
+ const currentComposerId = extractComposerId(row.key);
185
+ return {
186
+ composerId: currentComposerId,
187
+ conversationName: names.get(currentComposerId) ?? '',
188
+ bubbleId: extractBubbleId(row.key),
189
+ type: asNumber(parsed.type) ?? 0,
190
+ text,
191
+ createdAt: asString(parsed.createdAt) || undefined,
192
+ requestId: requestId || undefined,
193
+ };
194
+ })
195
+ .filter((item) => item !== null)
196
+ .sort((a, b) => (b.createdAt ?? '').localeCompare(a.createdAt ?? ''))
197
+ .slice(0, limit);
198
+ return matches;
199
+ });
200
+ }
201
+ async readConversation(params) {
202
+ return this.withDatabase(async (db) => {
203
+ const composerId = (params.composerId ?? '').trim();
204
+ if (!composerId) {
205
+ throw new Error('缺少 composer_id');
206
+ }
207
+ const limit = Math.max(1, Math.min(params.limit ?? 200, 2000));
208
+ const includeEmpty = params.includeEmpty ?? false;
209
+ const rows = await allRows(db, 'select key, value from cursorDiskKV where key like ?', [`bubbleId:${composerId}:%`]);
210
+ const messages = rows
211
+ .map((row) => {
212
+ const parsed = parseJson(row.value);
213
+ if (!parsed) {
214
+ return null;
215
+ }
216
+ const text = asString(parsed.text);
217
+ if (!includeEmpty && !text) {
218
+ return null;
219
+ }
220
+ return {
221
+ bubbleId: extractBubbleId(row.key),
222
+ type: asNumber(parsed.type) ?? 0,
223
+ text,
224
+ createdAt: asString(parsed.createdAt) || undefined,
225
+ requestId: asString(parsed.requestId) || undefined,
226
+ };
227
+ })
228
+ .filter((item) => item !== null)
229
+ .sort((a, b) => (a.createdAt ?? '').localeCompare(b.createdAt ?? ''))
230
+ .slice(0, limit);
231
+ return {
232
+ composerId,
233
+ messages,
234
+ };
235
+ });
236
+ }
237
+ }
238
+ export function createCursorHistoryClient() {
239
+ return new CursorHistoryClient();
240
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 开发工作流路由:根据用户意图生成「何时调哪个 MCP 工具」的委托式指南。
3
+ * 解决 Agent 直接写代码、跳过 start_* / code_insight / check_spec 的问题。
4
+ */
5
+ export type WorkflowScenario = 'feature' | 'bugfix' | 'ui' | 'explore' | 'commit' | 'review' | 'refactor' | 'onboard' | 'spec' | 'memory' | 'unknown';
6
+ export interface WorkflowToolStep {
7
+ tool: string;
8
+ required: boolean;
9
+ when: string;
10
+ note?: string;
11
+ }
12
+ export interface WorkflowPhase {
13
+ id: string;
14
+ title: string;
15
+ when: string;
16
+ steps: WorkflowToolStep[];
17
+ }
18
+ export interface DevWorkflowPlan {
19
+ scenario: WorkflowScenario;
20
+ scenarioLabel: string;
21
+ confidence: 'high' | 'medium' | 'low';
22
+ summary: string;
23
+ firstTool: string;
24
+ firstToolArgsHint?: Record<string, unknown>;
25
+ phases: WorkflowPhase[];
26
+ avoid: string[];
27
+ memoryNotes: string[];
28
+ }
29
+ export declare function detectWorkflowScenario(intent: string, explicit?: string): {
30
+ scenario: WorkflowScenario;
31
+ confidence: 'high' | 'medium' | 'low';
32
+ };
33
+ export declare function buildDevWorkflow(intent: string, options?: {
34
+ scenario?: string;
35
+ }): DevWorkflowPlan;
36
+ export declare function renderWorkflowMarkdown(plan: DevWorkflowPlan, intent: string): string;