Releases
v0.5.0
v0.5.0 — Component substitution (auto-install shadcn primitives)
Compare
Sorry, something went wrong.
No results found
What's new
Added
Component substitution. Opt-in by adding "and use shadcn" / "with shadcn components" / "replace primitives" to your modernize request. The Skill then:
Scans every UI file via the new scripts/detect-substitutions.mjs for hand-rolled native elements matching shadcn primitive shapes.
Shows a plan (which components to install, how many candidates, which files).
Asks for confirmation.
Initializes shadcn interactively if components.json is missing.
Runs npx shadcn@latest add <list>.
Rewrites the candidates — preserving every event handler, ref, aria-*, data-*, disabled, required, id, name, placeholder, value, htmlFor.
Type-checks (if TS configured). On failure, rolls back substitution edits only while preserving the className modernization.
7 substitution rules in MVP: Button, Input, Textarea, Label, Badge, Separator, Avatar — with variant + size inference.
Card pattern recognition — multi-child cards rewrite to <Card> + <CardHeader> + <CardContent>.
New references: references/component-substitution.md (workflow + safety) and references/shadcn-component-map.md (per-pattern rewriting guide).
Changed
SKILL.md — inserted Step 5b (COMPONENT SUBSTITUTION) gated on user opt-in language.
README × 2 — added "Want shadcn primitives? Just ask." subsection.
Not changed
All previous detectors (stack / brand / profiles) — stable.
Backup / rollback / report flow — unchanged. Substitution layer rolled back independently if typecheck fails.
Vue / Svelte: substitution uses shadcn-vue / shadcn-svelte ports; skipped gracefully if not set up.
新增
组件级替换 。需用户在对话里加上 "and use shadcn" / "with shadcn components" / "replace primitives" 才会触发。开启后 Skill 会:
跑新增脚本 scripts/detect-substitutions.mjs,扫描所有 UI 文件里手写的、形似 shadcn primitive 的原生元素。
展示计划:要装哪些组件、有多少候选、涉及哪些文件。
等用户确认。
如果项目里没有 components.json,先交互式跑 npx shadcn@latest init。
跑 npx shadcn@latest add <列表> 一次性安装。
重写候选元素 —— 完整保留所有 event handler、ref、aria-*、data-*、disabled、required、id、name、placeholder、value、htmlFor。
跑 type-check(如果项目有 TS)。出错时只回滚替换层 ,保留 className 现代化成果。
7 条 MVP 替换规则 :Button / Input / Textarea / Label / Badge / Separator / Avatar,自动推断 variant 和 size。
Card 模式识别 —— 多子元素卡片重写为 <Card> + <CardHeader> + <CardContent>。
新增参考文档:references/component-substitution.md(流程 + 安全)、references/shadcn-component-map.md(逐 pattern 重写指南)。
改动
SKILL.md 插入 Step 5b(COMPONENT SUBSTITUTION),靠 opt-in 触发。
中英 README 加入"Want shadcn primitives? Just ask."小节。
You can’t perform that action at this time.