@devflow-tools/plugin-react 0.8.10 → 0.9.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 (2) hide show
  1. package/README.md +30 -14
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @devflow-tools/plugin-react
2
2
 
3
- React 18 expert plugin for DevFlow bug diagnosis, component refactoring, performance auditing, and hooks review.
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
- ## Workflows
11
+ ## MCP Tools
12
12
 
13
- | Workflow | Description |
14
- |----------|-------------|
15
- | `react:diagnose-bug` | Diagnose React bugs from error to fix |
16
- | `react:new-feature` | Build new React features with tests |
17
- | `react:audit-performance` | Audit rendering performance + optimize |
18
- | `react:review-hooks` | Review hooks for rule violations + auto-fix |
19
- | `react:refactor-component` | Refactor complex components safely |
20
- | `react:new-component` | Create typed React components with tests |
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
- ## Usage with DevFlow CLI
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
- devflow init
26
- # Then in Claude Code:
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.10",
3
+ "version": "0.9.0",
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": "ac4f93d6a52fa40b4126b514e899eee581f8f46e"
29
+ "gitHead": "7872bccedbacd09cc92b983f30b3702db6878125"
30
30
  }