@devflow-tools/plugin-react 0.8.9 → 0.8.11
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 +30 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @devflow-tools/plugin-react
|
|
2
2
|
|
|
3
|
-
React 18
|
|
3
|
+
React 18 专家插件 — Bug 诊断、组件重构、性能审计、Hooks 审查、新功能开发。
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,25 +8,41 @@ React 18 expert plugin for DevFlow — bug diagnosis, component refactoring, per
|
|
|
8
8
|
npm install @devflow-tools/plugin-react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## MCP Tools
|
|
12
12
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
13
|
+
| Tool | 说明 | 关键参数 |
|
|
14
|
+
|------|------|---------|
|
|
15
|
+
| `react_diagnose_bug` | Bug 诊断:错误分析 → 根因定位 → 修复建议 | `projectRoot`, `errorMessage`, `stackTrace` |
|
|
16
|
+
| `react_new_component` | 新建 React 组件:模式分析 → 代码生成 → 遵循项目约定 | `projectRoot`, `componentName`, `props` |
|
|
17
|
+
| `react_new_feature` | 新功能开发流程:需求分析 → 代码 → 测试 → Review | `projectRoot` |
|
|
18
|
+
| `react_audit_performance` | 性能审计:检测缺少 React.memo 的纯展示组件、内联对象、大列表 | `projectRoot` |
|
|
19
|
+
| `react_review_hooks` | 审查所有 Hooks 调用:顶层调用规则、依赖数组完整性、清理函数缺失 | `projectRoot` |
|
|
20
|
+
| `react_refactor_component` | 组件重构:复杂度评估、异味检测、拆分建议 | `filePath`, `projectRoot` |
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Knowledge Sources
|
|
23
|
+
|
|
24
|
+
| 来源 | URL | SPA |
|
|
25
|
+
|------|-----|-----|
|
|
26
|
+
| React 官方文档 | https://react.dev/reference | Yes |
|
|
27
|
+
|
|
28
|
+
## Memory
|
|
29
|
+
|
|
30
|
+
插件自动注入以下最佳实践:
|
|
31
|
+
- 函数组件 + Hooks 优先于 Class 组件
|
|
32
|
+
- 组件保持纯函数,副作用放在 useEffect/useLayoutEffect
|
|
33
|
+
- 遵守 Hooks 规则(顶层调用、条件限制)
|
|
34
|
+
- Props 使用解构 + 默认值模式
|
|
35
|
+
- 复杂条件渲染使用 useMemo/useCallback
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
23
38
|
|
|
24
39
|
```bash
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# /devflow:react 分析项目中违反 react 最佳实践的地方
|
|
40
|
+
# 在 Claude Code 中使用
|
|
41
|
+
/devflow:react 分析项目中违反最佳实践的地方
|
|
28
42
|
```
|
|
29
43
|
|
|
44
|
+
Claude Code 会自动加载插件并通过 MCP 调用对应 tool。
|
|
45
|
+
|
|
30
46
|
## License
|
|
31
47
|
|
|
32
48
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devflow-tools/plugin-react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a0a0b61377aa88ebbd380f50a5d532f63175ef45"
|
|
30
30
|
}
|