create-dwy 0.6.6 → 0.6.7

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/package.json +1 -1
  2. package/src/sync.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-dwy",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "项目脚手架与 Claude Code 配置同步工具",
5
5
  "type": "module",
6
6
  "bin": {
package/src/sync.js CHANGED
@@ -275,11 +275,14 @@ export async function syncClaude(opts = {}) {
275
275
  let selectedSkills, selectedRules, selectedCommands, selectedHooks
276
276
 
277
277
  if (useCache && hasAnyExisting) {
278
- // 缓存模式:直接取 模板 ∩ 已选 覆盖同步
278
+ // 缓存模式:模板 ∩ 已选 覆盖同步
279
279
  selectedSkills = skills.filter(s => existingSkills.has(s.name))
280
280
  selectedRules = rules.filter(r => existingRules.has(r.name))
281
281
  selectedCommands = commands.filter(c => existingCommands.has(c.name))
282
- selectedHooks = hooks.filter(h => existingHooks.has(h.name))
282
+ // hooks 与 settings.json 引用配套:从未装过则装全部模板 hooks,已装过则按已选覆盖
283
+ selectedHooks = existingHooks.size > 0
284
+ ? hooks.filter(h => existingHooks.has(h.name))
285
+ : hooks
283
286
  console.log(chalk.gray(`使用已选缓存覆盖同步(如需调整请加 --no-cache):`))
284
287
  console.log(chalk.gray(` ${selectedSkills.length} skills, ${selectedRules.length} rules, ${selectedCommands.length} commands, ${selectedHooks.length} hooks\n`))
285
288
  } else {