
Vue Harvest
io.github.virgilvox由 GitHub 帳號 virgilvox 發布v0.0.3更新於 Oct 24, 2026
Extract reusable component libraries and design tokens from Vue applications
概覽
分析 Vue 專案,找出可重複使用的元件與設計權杖,並讓助理透過工具處理難以抽取的元件。
- 可以做什麼
- 對指定的 Vue 專案路徑執行完整分析流程,並依層級或信心度篩選列出元件
- 檢視單一元件的 props、事件、插槽、相依性與耦合問題
- 將元件抽取為獨立套件,支援重寫後再抽取
- 深入分析耦合情況,產生重構前後程式碼建議,或為綁定 store 的元件產生組合式封裝
- 批次分流待複核的元件,並輸出專案層級的耦合報告
- 抽取設計權杖(顏色、字型、間距、圓角、陰影)並依類型回傳
- 適用情境
- 適合從既有 Vue 應用中提煉元件庫或設計系統,也適合元件落在 30-70% 信心度區間、需要判斷如何與 store、路由或 i18n 解耦後再抽取的情境。
- 執行需求
- 以本機 stdio 程序在桌面端執行,透過 npm 套件 vue-harvest-mcp 安裝(需要 Node.js)。它會讀取本機的 Vue 專案目錄,包含 .vue 檔案以及用於路徑別名的 tsconfig.json。未宣告需要帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Vue Harvest,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
vue-harvest
Point it at a Vue project. It finds every component, figures out which ones are reusable, and extracts them. It also pulls out your design tokens (colors, spacing, typography) and gives you a visual report.
The hard cases that need judgment (store-coupled components, ambiguous dependencies) get handled by an MCP server that feeds structured analysis to an LLM.
What it does
Component extraction. Parses every .vue file in a project using @vue/compiler-sfc. For each component it extracts the full interface (props, emits, slots), maps out the dependency graph, detects coupling issues, and scores a confidence level for safe extraction. Components above the threshold get auto-extracted into standalone bundles with rewritten imports and a manifest of peer dependencies.
Design token extraction. Scans all CSS (scoped styles, standalone stylesheets) and pulls out colors, font families, font sizes, font weights, spacing values, border radii, and shadows. Outputs a CSS custom properties file, a JSON dump, and a visual HTML explorer showing swatches and scales.
MCP server. Twelve tools that give an LLM the structured data it needs to reason about the harder cases: components in the 30-70% confidence range that could be extracted with some refactoring. The LLM can deep-analyze coupling, generate decoupling suggestions with before/after code, create composable wrappers for store-bound components, and do full rewrite-and-extract in one shot.
Install
For the MCP server:
CLI
vue-harvest analyze [path]
Full analysis pipeline. Discovers .vue files, parses interfaces, builds the dependency graph, classifies every component, auto-extracts the safe ones, and generates a registry + catalog.
Output goes to .vue-harvest/ by default:
vue-harvest list [path]
Lists all components sorted by extraction confidence.
vue-harvest inspect <name>
Full breakdown of a single component: props, events, slots, dependencies, coupling issues, style analysis.
vue-harvest extract <name>
Extracts a specific component and all its local dependencies into a standalone bundle.
vue-harvest tokens [path]
Extracts design system tokens from the project.
Outputs:
tokens.csswith CSS custom propertiestokens.jsonwith the full token datasetdesign-system.htmlwith a visual explorer (color swatches, font scales, spacing visualization)
vue-harvest init
Creates a harvest.config.json with detected project settings.
Configuration
Optional. Place a harvest.config.json in the project root:
Path aliases are auto-detected from tsconfig.json. If your project has @ mapped to ./src, vue-harvest picks that up.
Component classification
Every component gets classified into a reusability tier based on its interface, dependencies, and coupling:
Components at or above the extraction threshold (default 70%) are auto-extracted. The 30-70% band is where the MCP server comes in.
Coupling issues
The analyzer detects these coupling patterns:
MCP server
Setup with Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
Setup with Claude Code
Available tools
Resources
The server exposes these as MCP resources after analysis:
harvest://registry: full registry JSONharvest://graph: dependency graphharvest://summary: analysis summaryharvest://component/{name}: individual component analysisharvest://design-system: extracted design tokens
Prompts
analyze-new-project: guided first analysisextraction-sprint: batch refactor and extract sessionrefactor-component: single component deep refactorextract-design-system: design token extraction and analysis
Example conversations
"Analyze my Vue project at /Users/me/projects/my-app"
"Show me all the components that need review"
"Deep analyze the UserProfileCard component and suggest how to decouple it from the auth store"
"Do an extraction sprint, go through all reviewable components and extract what you can"
"Extract the design system tokens and recommend a naming convention"
Programmatic API
vue-harvest exports its analysis engine for use in other tools:
Architecture
The split between CLI and MCP is deliberate. The CLI handles everything deterministic: parsing, graph building, classification, extraction. The MCP handles the 20% that needs reasoning: decoupling suggestions, refactoring code generation, ambiguity resolution.
Development
Watch mode for the CLI:
Run a specific test file:
How it works internally
- Discovery. Globs for
.vuefiles, readstsconfig.jsonfor path aliases. - SFC parsing.
@vue/compiler-sfcsplits each file into template, script, and style blocks. - Interface extraction. Regex-based extraction of
defineProps,defineEmits,<slot>tags. Handles generic type syntax,withDefaults, and object syntax with nested options. - Dependency analysis.
es-module-lexerparses imports. Each import gets classified by kind (internal component, composable, store, util, external package, etc). - Coupling detection. Pattern matching on the script and template AST for store access, hardcoded APIs, router usage, i18n, inject, env vars, unscoped CSS.
- Classification. Confidence scoring starts at 1.0 and gets penalized for coupling issues, store access, and page-path patterns. Boosted for props/slots interfaces and UI-path patterns.
- Graph building. Resolves import paths, builds adjacency lists, runs Tarjan's strongly connected components algorithm for cycle detection, computes transitive dependency closures.
- Extraction. For components above threshold: collects the component plus all its local deps (composables, utils, types, styles), rewrites import paths to be relative within the extracted bundle, generates a manifest listing peer dependencies and required globals.
- Token extraction. PostCSS value parser identifies colors (hex, rgb, hsl), font properties, spacing values, radii, and shadows from CSS declarations. Deduplicates, normalizes hex values, and groups by type.
License
MIT
來源:README.md,提交 47c29cf
工具
0版本歷史
1- v0.0.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分