mcp-probe-kit 3.2.0 → 3.3.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 (104) hide show
  1. package/README.md +10 -0
  2. package/build/lib/__tests__/memory-orchestration.unit.test.js +88 -0
  3. package/build/lib/__tests__/memory-payload.unit.test.js +35 -0
  4. package/build/lib/__tests__/quality-constraints.unit.test.d.ts +1 -0
  5. package/build/lib/__tests__/quality-constraints.unit.test.js +54 -0
  6. package/build/lib/__tests__/spec-validator.unit.test.js +106 -74
  7. package/build/lib/agents-md-template.js +32 -32
  8. package/build/lib/cursor-history-client.d.ts +54 -0
  9. package/build/lib/cursor-history-client.js +240 -0
  10. package/build/lib/quality-constraints.d.ts +54 -0
  11. package/build/lib/quality-constraints.js +155 -0
  12. package/build/lib/skill-bridge.js +12 -12
  13. package/build/lib/spec-validator.js +16 -3
  14. package/build/lib/template-loader.js +83 -23
  15. package/build/resources/ui-ux-data/guidelines/vercel-web-interface.json +1632 -1632
  16. package/build/resources/ui-ux-data/metadata.json +30 -30
  17. package/build/resources/ui-ux-data/shadcn/blocks.json +2541 -2541
  18. package/build/resources/ui-ux-data/shadcn/components.json +997 -997
  19. package/build/resources/ui-ux-data/themes/presets.json +483 -483
  20. package/build/tools/__tests__/cursor-history.unit.test.d.ts +1 -0
  21. package/build/tools/__tests__/cursor-history.unit.test.js +38 -0
  22. package/build/tools/check_spec.js +16 -16
  23. package/build/tools/code_insight.js +41 -41
  24. package/build/tools/code_review.js +11 -4
  25. package/build/tools/cursor_read_conversation.d.ts +7 -0
  26. package/build/tools/cursor_read_conversation.js +36 -0
  27. package/build/tools/fix_bug.js +161 -161
  28. package/build/tools/gencommit.js +60 -60
  29. package/build/tools/init_project_context.js +432 -432
  30. package/build/tools/start_product.js +1 -1
  31. package/build/tools/start_ui.js +17 -0
  32. package/build/tools/ui-ux-tools.d.ts +3 -0
  33. package/build/tools/ui-ux-tools.js +302 -290
  34. package/build/utils/__tests__/vercel-guidelines-sync.unit.test.js +12 -12
  35. package/build/utils/design-reasoning-engine.d.ts +2 -0
  36. package/build/utils/design-reasoning-engine.js +3 -0
  37. package/build/utils/themes-sync.js +8 -8
  38. package/package.json +3 -2
  39. package/build/resources/index.d.ts +0 -4
  40. package/build/resources/index.js +0 -4
  41. package/build/resources/tool-params-guide.d.ts +0 -571
  42. package/build/resources/tool-params-guide.js +0 -488
  43. package/build/tools/analyze_project.d.ts +0 -1
  44. package/build/tools/analyze_project.js +0 -527
  45. package/build/tools/check_deps.d.ts +0 -13
  46. package/build/tools/check_deps.js +0 -204
  47. package/build/tools/convert.d.ts +0 -13
  48. package/build/tools/convert.js +0 -599
  49. package/build/tools/css_order.d.ts +0 -13
  50. package/build/tools/css_order.js +0 -81
  51. package/build/tools/debug.d.ts +0 -13
  52. package/build/tools/debug.js +0 -131
  53. package/build/tools/design2code.d.ts +0 -20
  54. package/build/tools/design2code.js +0 -426
  55. package/build/tools/detect_shell.d.ts +0 -6
  56. package/build/tools/detect_shell.js +0 -151
  57. package/build/tools/explain.d.ts +0 -13
  58. package/build/tools/explain.js +0 -390
  59. package/build/tools/fix.d.ts +0 -13
  60. package/build/tools/fix.js +0 -303
  61. package/build/tools/gen_mock.d.ts +0 -22
  62. package/build/tools/gen_mock.js +0 -269
  63. package/build/tools/gen_skill.d.ts +0 -13
  64. package/build/tools/gen_skill.js +0 -560
  65. package/build/tools/genapi.d.ts +0 -13
  66. package/build/tools/genapi.js +0 -174
  67. package/build/tools/genchangelog.d.ts +0 -13
  68. package/build/tools/genchangelog.js +0 -250
  69. package/build/tools/gendoc.d.ts +0 -13
  70. package/build/tools/gendoc.js +0 -232
  71. package/build/tools/genpr.d.ts +0 -13
  72. package/build/tools/genpr.js +0 -194
  73. package/build/tools/genreadme.d.ts +0 -13
  74. package/build/tools/genreadme.js +0 -626
  75. package/build/tools/gensql.d.ts +0 -13
  76. package/build/tools/gensql.js +0 -320
  77. package/build/tools/genui.d.ts +0 -13
  78. package/build/tools/genui.js +0 -803
  79. package/build/tools/init_component_catalog.d.ts +0 -22
  80. package/build/tools/init_component_catalog.js +0 -809
  81. package/build/tools/init_setting.d.ts +0 -13
  82. package/build/tools/init_setting.js +0 -47
  83. package/build/tools/perf.d.ts +0 -13
  84. package/build/tools/perf.js +0 -409
  85. package/build/tools/render_ui.d.ts +0 -22
  86. package/build/tools/render_ui.js +0 -384
  87. package/build/tools/resolve_conflict.d.ts +0 -13
  88. package/build/tools/resolve_conflict.js +0 -349
  89. package/build/tools/security_scan.d.ts +0 -22
  90. package/build/tools/security_scan.js +0 -323
  91. package/build/tools/split.d.ts +0 -13
  92. package/build/tools/split.js +0 -599
  93. package/build/tools/start_api.d.ts +0 -13
  94. package/build/tools/start_api.js +0 -193
  95. package/build/tools/start_doc.d.ts +0 -13
  96. package/build/tools/start_doc.js +0 -207
  97. package/build/tools/start_refactor.d.ts +0 -13
  98. package/build/tools/start_refactor.js +0 -188
  99. package/build/tools/start_release.d.ts +0 -13
  100. package/build/tools/start_release.js +0 -167
  101. package/build/tools/start_review.d.ts +0 -13
  102. package/build/tools/start_review.js +0 -175
  103. /package/build/{utils/design-docs-generator.d.ts → lib/__tests__/memory-orchestration.unit.test.d.ts} +0 -0
  104. /package/build/{utils/design-docs-generator.js → lib/__tests__/memory-payload.unit.test.d.ts} +0 -0
@@ -1,599 +0,0 @@
1
- import { parseArgs, getString } from "../utils/parseArgs.js";
2
- // convert 工具实现
3
- export async function convert(args) {
4
- try {
5
- // 智能参数解析,支持自然语言输入
6
- const parsedArgs = parseArgs(args, {
7
- defaultValues: {
8
- code: "",
9
- from: "",
10
- to: "",
11
- },
12
- primaryField: "code", // 纯文本输入默认映射到 code 字段
13
- fieldAliases: {
14
- code: ["source", "src", "代码", "content"],
15
- from: ["source_format", "source_type", "源格式", "源类型"],
16
- to: ["target_format", "target_type", "目标格式", "目标类型"],
17
- },
18
- });
19
- const code = getString(parsedArgs.code);
20
- const from = getString(parsedArgs.from);
21
- const to = getString(parsedArgs.to);
22
- const message = `请转换以下代码:
23
-
24
- 📝 **源代码**:
25
- ${code || "请提供需要转换的代码"}
26
-
27
- 🔄 **转换类型**:${from} → ${to}
28
-
29
- ---
30
-
31
- ## 代码转换指南
32
-
33
- ### 支持的转换类型
34
-
35
- #### 语言转换
36
- - JavaScript → TypeScript
37
- - TypeScript → JavaScript
38
- - Python → JavaScript
39
- - CommonJS → ESM
40
-
41
- #### 框架转换
42
- - Class Component → Hooks
43
- - Vue 2 → Vue 3
44
- - AngularJS → React
45
- - jQuery → Vanilla JS
46
-
47
- #### 样式转换
48
- - CSS → Tailwind CSS
49
- - SCSS → CSS-in-JS
50
- - Styled-components → Emotion
51
-
52
- #### 数据格式转换
53
- - JSON → TypeScript Interface
54
- - GraphQL → REST
55
- - XML → JSON
56
-
57
- ---
58
-
59
- ## 转换示例
60
-
61
- ### 1️⃣ JavaScript → TypeScript
62
-
63
- **JavaScript (Before):**
64
- \`\`\`javascript
65
- function calculateTotal(items, discount) {
66
- const subtotal = items.reduce((sum, item) => {
67
- return sum + item.price * item.quantity;
68
- }, 0);
69
-
70
- return discount ? subtotal * (1 - discount) : subtotal;
71
- }
72
-
73
- const order = {
74
- id: '123',
75
- items: [
76
- { name: 'Book', price: 29.99, quantity: 2 },
77
- { name: 'Pen', price: 1.99, quantity: 5 }
78
- ],
79
- discount: 0.1
80
- };
81
-
82
- const total = calculateTotal(order.items, order.discount);
83
- \`\`\`
84
-
85
- **TypeScript (After):**
86
- \`\`\`typescript
87
- interface Item {
88
- name: string;
89
- price: number;
90
- quantity: number;
91
- }
92
-
93
- interface Order {
94
- id: string;
95
- items: Item[];
96
- discount?: number;
97
- }
98
-
99
- function calculateTotal(items: Item[], discount?: number): number {
100
- const subtotal = items.reduce((sum, item) => {
101
- return sum + item.price * item.quantity;
102
- }, 0);
103
-
104
- return discount ? subtotal * (1 - discount) : subtotal;
105
- }
106
-
107
- const order: Order = {
108
- id: '123',
109
- items: [
110
- { name: 'Book', price: 29.99, quantity: 2 },
111
- { name: 'Pen', price: 1.99, quantity: 5 }
112
- ],
113
- discount: 0.1
114
- };
115
-
116
- const total: number = calculateTotal(order.items, order.discount);
117
- \`\`\`
118
-
119
- **✅ 转换要点**:
120
- 1. 添加类型接口定义
121
- 2. 函数参数和返回值添加类型注解
122
- 3. 变量添加类型声明(可选)
123
- 4. 可选属性用 \`?\` 标记
124
-
125
- ---
126
-
127
- ### 2️⃣ Class Component → React Hooks
128
-
129
- **Class Component (Before):**
130
- \`\`\`jsx
131
- import React, { Component } from 'react';
132
-
133
- class UserProfile extends Component {
134
- constructor(props) {
135
- super(props);
136
- this.state = {
137
- user: null,
138
- loading: true,
139
- error: null
140
- };
141
- }
142
-
143
- componentDidMount() {
144
- this.fetchUser();
145
- }
146
-
147
- componentDidUpdate(prevProps) {
148
- if (prevProps.userId !== this.props.userId) {
149
- this.fetchUser();
150
- }
151
- }
152
-
153
- componentWillUnmount() {
154
- this.abortController?.abort();
155
- }
156
-
157
- async fetchUser() {
158
- this.setState({ loading: true });
159
- this.abortController = new AbortController();
160
-
161
- try {
162
- const response = await fetch(\`/api/users/\${this.props.userId}\`, {
163
- signal: this.abortController.signal
164
- });
165
- const user = await response.json();
166
- this.setState({ user, loading: false });
167
- } catch (error) {
168
- if (error.name !== 'AbortError') {
169
- this.setState({ error: error.message, loading: false });
170
- }
171
- }
172
- }
173
-
174
- render() {
175
- const { user, loading, error } = this.state;
176
-
177
- if (loading) return <div>Loading...</div>;
178
- if (error) return <div>Error: {error}</div>;
179
- if (!user) return null;
180
-
181
- return (
182
- <div>
183
- <h1>{user.name}</h1>
184
- <p>{user.email}</p>
185
- </div>
186
- );
187
- }
188
- }
189
-
190
- export default UserProfile;
191
- \`\`\`
192
-
193
- **Hooks (After):**
194
- \`\`\`tsx
195
- import React, { useState, useEffect } from 'react';
196
-
197
- interface User {
198
- name: string;
199
- email: string;
200
- }
201
-
202
- interface UserProfileProps {
203
- userId: string;
204
- }
205
-
206
- const UserProfile: React.FC<UserProfileProps> = ({ userId }) => {
207
- const [user, setUser] = useState<User | null>(null);
208
- const [loading, setLoading] = useState(true);
209
- const [error, setError] = useState<string | null>(null);
210
-
211
- useEffect(() => {
212
- const abortController = new AbortController();
213
-
214
- async function fetchUser() {
215
- setLoading(true);
216
- setError(null);
217
-
218
- try {
219
- const response = await fetch(\`/api/users/\${userId}\`, {
220
- signal: abortController.signal
221
- });
222
- const userData = await response.json();
223
- setUser(userData);
224
- } catch (err) {
225
- if (err instanceof Error && err.name !== 'AbortError') {
226
- setError(err.message);
227
- }
228
- } finally {
229
- setLoading(false);
230
- }
231
- }
232
-
233
- fetchUser();
234
-
235
- return () => {
236
- abortController.abort();
237
- };
238
- }, [userId]); // userId 变化时重新获取
239
-
240
- if (loading) return <div>Loading...</div>;
241
- if (error) return <div>Error: {error}</div>;
242
- if (!user) return null;
243
-
244
- return (
245
- <div>
246
- <h1>{user.name}</h1>
247
- <p>{user.email}</p>
248
- </div>
249
- );
250
- };
251
-
252
- export default UserProfile;
253
- \`\`\`
254
-
255
- **✅ 转换要点**:
256
- 1. \`constructor\` + \`this.state\` → \`useState\`
257
- 2. \`componentDidMount\` + \`componentDidUpdate\` → \`useEffect\`
258
- 3. \`componentWillUnmount\` → \`useEffect\` 清理函数
259
- 4. \`this.props\` → 函数参数
260
- 5. \`this.setState\` → \`setState\` 函数
261
- 6. 类方法 → 函数内部函数或自定义 Hook
262
-
263
- ---
264
-
265
- ### 3️⃣ Promises → Async/Await
266
-
267
- **Promises (Before):**
268
- \`\`\`javascript
269
- function getUserData(userId) {
270
- return fetch(\`/api/users/\${userId}\`)
271
- .then(response => {
272
- if (!response.ok) {
273
- throw new Error('User not found');
274
- }
275
- return response.json();
276
- })
277
- .then(user => {
278
- return fetch(\`/api/posts?userId=\${user.id}\`);
279
- })
280
- .then(response => response.json())
281
- .then(posts => {
282
- return { user, posts };
283
- })
284
- .catch(error => {
285
- console.error('Error:', error);
286
- throw error;
287
- });
288
- }
289
-
290
- // 使用
291
- getUserData('123')
292
- .then(data => console.log(data))
293
- .catch(error => console.error(error));
294
- \`\`\`
295
-
296
- **Async/Await (After):**
297
- \`\`\`javascript
298
- async function getUserData(userId) {
299
- try {
300
- const userResponse = await fetch(\`/api/users/\${userId}\`);
301
-
302
- if (!userResponse.ok) {
303
- throw new Error('User not found');
304
- }
305
-
306
- const user = await userResponse.json();
307
- const postsResponse = await fetch(\`/api/posts?userId=\${user.id}\`);
308
- const posts = await postsResponse.json();
309
-
310
- return { user, posts };
311
- } catch (error) {
312
- console.error('Error:', error);
313
- throw error;
314
- }
315
- }
316
-
317
- // 使用
318
- try {
319
- const data = await getUserData('123');
320
- console.log(data);
321
- } catch (error) {
322
- console.error(error);
323
- }
324
- \`\`\`
325
-
326
- **✅ 转换要点**:
327
- 1. 函数前加 \`async\` 关键字
328
- 2. \`.then()\` → \`await\`
329
- 3. \`.catch()\` → \`try/catch\`
330
- 4. Promise 链条变为顺序执行
331
- 5. 代码更易读,像同步代码
332
-
333
- ---
334
-
335
- ### 4️⃣ CSS → Tailwind CSS
336
-
337
- **CSS (Before):**
338
- \`\`\`css
339
- .button {
340
- display: inline-flex;
341
- align-items: center;
342
- justify-content: center;
343
- padding: 0.5rem 1rem;
344
- font-size: 0.875rem;
345
- font-weight: 500;
346
- border-radius: 0.375rem;
347
- background-color: #3b82f6;
348
- color: white;
349
- transition: background-color 0.2s;
350
- }
351
-
352
- .button:hover {
353
- background-color: #2563eb;
354
- }
355
-
356
- .button:disabled {
357
- opacity: 0.5;
358
- cursor: not-allowed;
359
- }
360
-
361
- .button-lg {
362
- padding: 0.75rem 1.5rem;
363
- font-size: 1rem;
364
- }
365
- \`\`\`
366
-
367
- **Tailwind CSS (After):**
368
- \`\`\`jsx
369
- // 基础按钮
370
- <button className="inline-flex items-center justify-center px-4 py-2 text-sm font-medium rounded-md bg-blue-600 text-white transition-colors hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">
371
- Button
372
- </button>
373
-
374
- // 大按钮
375
- <button className="inline-flex items-center justify-center px-6 py-3 text-base font-medium rounded-md bg-blue-600 text-white transition-colors hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">
376
- Large Button
377
- </button>
378
-
379
- // 或使用组件抽象
380
- const Button = ({ size = 'default', children, ...props }) => {
381
- const sizeClasses = {
382
- default: 'px-4 py-2 text-sm',
383
- lg: 'px-6 py-3 text-base'
384
- };
385
-
386
- return (
387
- <button
388
- className={\`
389
- inline-flex items-center justify-center font-medium rounded-md
390
- bg-blue-600 text-white transition-colors
391
- hover:bg-blue-700
392
- disabled:opacity-50 disabled:cursor-not-allowed
393
- \${sizeClasses[size]}
394
- \`}
395
- {...props}
396
- >
397
- {children}
398
- </button>
399
- );
400
- };
401
- \`\`\`
402
-
403
- **✅ Tailwind 类名对照表**:
404
-
405
- | CSS 属性 | Tailwind 类名 |
406
- |----------|---------------|
407
- | \`display: flex\` | \`flex\` |
408
- | \`align-items: center\` | \`items-center\` |
409
- | \`justify-content: center\` | \`justify-center\` |
410
- | \`padding: 0.5rem 1rem\` | \`px-4 py-2\` |
411
- | \`font-size: 0.875rem\` | \`text-sm\` |
412
- | \`font-weight: 500\` | \`font-medium\` |
413
- | \`border-radius: 0.375rem\` | \`rounded-md\` |
414
- | \`background-color: #3b82f6\` | \`bg-blue-600\` |
415
- | \`color: white\` | \`text-white\` |
416
-
417
- ---
418
-
419
- ### 5️⃣ CommonJS → ESM
420
-
421
- **CommonJS (Before):**
422
- \`\`\`javascript
423
- // math.js
424
- function add(a, b) {
425
- return a + b;
426
- }
427
-
428
- function multiply(a, b) {
429
- return a * b;
430
- }
431
-
432
- module.exports = {
433
- add,
434
- multiply
435
- };
436
-
437
- // main.js
438
- const { add, multiply } = require('./math');
439
- const lodash = require('lodash');
440
-
441
- console.log(add(2, 3));
442
- \`\`\`
443
-
444
- **ESM (After):**
445
- \`\`\`javascript
446
- // math.js
447
- export function add(a, b) {
448
- return a + b;
449
- }
450
-
451
- export function multiply(a, b) {
452
- return a * b;
453
- }
454
-
455
- // 或默认导出
456
- // export default { add, multiply };
457
-
458
- // main.js
459
- import { add, multiply } from './math.js';
460
- import lodash from 'lodash';
461
-
462
- console.log(add(2, 3));
463
- \`\`\`
464
-
465
- **✅ 转换要点**:
466
- 1. \`module.exports\` → \`export\` / \`export default\`
467
- 2. \`require()\` → \`import\`
468
- 3. 文件扩展名:ESM 中通常需要 \`.js\`
469
- 4. \`package.json\` 需要设置 \`"type": "module"\`
470
-
471
- ---
472
-
473
- ### 6️⃣ JSON → TypeScript Interface
474
-
475
- **JSON (Before):**
476
- \`\`\`json
477
- {
478
- "id": "123",
479
- "name": "John Doe",
480
- "email": "john@example.com",
481
- "age": 30,
482
- "isActive": true,
483
- "roles": ["admin", "user"],
484
- "address": {
485
- "street": "123 Main St",
486
- "city": "New York",
487
- "zipCode": "10001"
488
- },
489
- "metadata": {
490
- "createdAt": "2024-01-01T00:00:00Z",
491
- "updatedAt": "2024-01-15T00:00:00Z"
492
- }
493
- }
494
- \`\`\`
495
-
496
- **TypeScript Interface (After):**
497
- \`\`\`typescript
498
- interface Address {
499
- street: string;
500
- city: string;
501
- zipCode: string;
502
- }
503
-
504
- interface Metadata {
505
- createdAt: string; // 或 Date
506
- updatedAt: string; // 或 Date
507
- }
508
-
509
- interface User {
510
- id: string;
511
- name: string;
512
- email: string;
513
- age: number;
514
- isActive: boolean;
515
- roles: string[];
516
- address: Address;
517
- metadata: Metadata;
518
- }
519
-
520
- // 使用
521
- const user: User = {
522
- id: "123",
523
- name: "John Doe",
524
- email: "john@example.com",
525
- age: 30,
526
- isActive: true,
527
- roles: ["admin", "user"],
528
- address: {
529
- street: "123 Main St",
530
- city: "New York",
531
- zipCode: "10001"
532
- },
533
- metadata: {
534
- createdAt: "2024-01-01T00:00:00Z",
535
- updatedAt: "2024-01-15T00:00:00Z"
536
- }
537
- };
538
- \`\`\`
539
-
540
- ---
541
-
542
- ## 转换注意事项
543
-
544
- ### ⚠️ 潜在问题
545
-
546
- 1. **类型安全**
547
- - 转换后需要添加类型检查
548
- - 注意 null/undefined 处理
549
-
550
- 2. **API 差异**
551
- - 不同框架的生命周期不同
552
- - 状态管理方式不同
553
-
554
- 3. **性能影响**
555
- - 某些转换可能影响性能
556
- - 需要测试和优化
557
-
558
- 4. **依赖更新**
559
- - 检查依赖包兼容性
560
- - 更新 package.json
561
-
562
- ---
563
-
564
- ---
565
-
566
- ## ⚠️ 边界约束
567
-
568
- - ❌ 仅输出转换后代码,不自动替换源文件
569
- - ❌ 不执行代码或命令
570
- - ✅ 保持功能等价,不改变业务逻辑
571
- - ✅ 输出完整可用的转换代码
572
-
573
- 现在请根据需求进行代码转换,提供:
574
- 1. 转换后的完整代码
575
- 2. 关键变更说明
576
- 3. 潜在问题提示
577
- 4. 迁移步骤(如需要)`;
578
- return {
579
- content: [
580
- {
581
- type: "text",
582
- text: message,
583
- },
584
- ],
585
- };
586
- }
587
- catch (error) {
588
- const errorMessage = error instanceof Error ? error.message : String(error);
589
- return {
590
- content: [
591
- {
592
- type: "text",
593
- text: `❌ 代码转换失败: ${errorMessage}`,
594
- },
595
- ],
596
- isError: true,
597
- };
598
- }
599
- }
@@ -1,13 +0,0 @@
1
- export declare function cssOrder(_args: any): Promise<{
2
- content: {
3
- type: string;
4
- text: string;
5
- }[];
6
- isError?: undefined;
7
- } | {
8
- content: {
9
- type: string;
10
- text: string;
11
- }[];
12
- isError: boolean;
13
- }>;
@@ -1,81 +0,0 @@
1
- // css_order 工具实现
2
- export async function cssOrder(_args) {
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\` | 确定动态交互 |
59
- `;
60
- return {
61
- content: [
62
- {
63
- type: "text",
64
- text: message,
65
- },
66
- ],
67
- };
68
- }
69
- catch (error) {
70
- const errorMessage = error instanceof Error ? error.message : String(error);
71
- return {
72
- content: [
73
- {
74
- type: "text",
75
- text: `❌ CSS 顺序规范生成失败: ${errorMessage}`,
76
- },
77
- ],
78
- isError: true,
79
- };
80
- }
81
- }
@@ -1,13 +0,0 @@
1
- export declare function debug(args: any): Promise<{
2
- content: {
3
- type: string;
4
- text: string;
5
- }[];
6
- isError?: undefined;
7
- } | {
8
- content: {
9
- type: string;
10
- text: string;
11
- }[];
12
- isError: boolean;
13
- }>;