组件库存 component-inventory

组件库存技能是一款用于自动化审计和盘点前端代码库中UI组件的工具。它能扫描React、Vue、Angular等框架的组件,识别重复项和变体,分析组件属性和使用频率,生成详细报告并提供整合建议。关键词:UI组件审计、代码库盘点、组件分析、前端代码扫描、设计系统管理、重复组件检测、React组件分析、Vue组件分析。

前端开发 0 次安装 0 次浏览 更新于 2/26/2026

name: component-inventory description: 审计和盘点代码库中现有的UI组件 allowed-tools:

  • Read
  • Write
  • Edit
  • Bash
  • Glob
  • Grep

组件库存技能

目的

扫描代码库以审计和盘点现有的UI组件,识别变体、使用模式以及整合机会。

能力

  • 扫描代码库中的React/Vue/Angular组件
  • 识别组件变体和重复项
  • 映射组件在应用程序中的使用情况
  • 生成全面的库存报告
  • 检测组件实现中的不一致性
  • 追踪组件依赖关系

目标流程

  • component-library.js
  • design-system.js

集成点

  • 通过AST解析进行React组件分析
  • Vue单文件组件分析
  • TypeScript/JavaScript AST解析
  • CSS-in-JS检测

输入模式

{
  "type": "object",
  "properties": {
    "scanPath": {
      "type": "string",
      "description": "扫描组件的根路径"
    },
    "framework": {
      "type": "string",
      "enum": ["react", "vue", "angular", "svelte", "auto"],
      "default": "auto"
    },
    "patterns": {
      "type": "array",
      "items": { "type": "string" },
      "default": ["**/*.tsx", "**/*.jsx", "**/*.vue"]
    },
    "excludePaths": {
      "type": "array",
      "items": { "type": "string" },
      "default": ["node_modules", "dist", "build"]
    },
    "analyzeProps": {
      "type": "boolean",
      "default": true
    },
    "detectDuplicates": {
      "type": "boolean",
      "default": true
    }
  },
  "required": ["scanPath"]
}

输出模式

{
  "type": "object",
  "properties": {
    "components": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "path": { "type": "string" },
          "props": { "type": "array" },
          "usageCount": { "type": "number" }
        }
      }
    },
    "duplicates": {
      "type": "array",
      "description": "相似或重复的组件"
    },
    "variations": {
      "type": "object",
      "description": "按类型分组的组件变体"
    },
    "usageMap": {
      "type": "object",
      "description": "组件使用位置"
    },
    "statistics": {
      "type": "object",
      "properties": {
        "totalComponents": { "type": "number" },
        "uniqueComponents": { "type": "number" },
        "averagePropsCount": { "type": "number" }
      }
    },
    "recommendations": {
      "type": "array",
      "description": "整合建议"
    }
  }
}

使用示例

const result = await skill.execute({
  scanPath: './src',
  framework: 'react',
  patterns: ['**/*.tsx', '**/*.jsx'],
  detectDuplicates: true
});