create-dwy 0.12.0 → 0.12.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-dwy",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "项目脚手架与 Claude Code 配置同步工具",
5
5
  "type": "module",
6
6
  "bin": {
package/src/sync.js CHANGED
@@ -109,17 +109,22 @@ async function scanHooks(sourceDir) {
109
109
  const hooksDir = path.join(sourceDir, 'hooks')
110
110
  if (!await fs.pathExists(hooksDir)) return []
111
111
 
112
- const entries = await fs.readdir(hooksDir, { withFileTypes: true })
113
- return entries
114
- .filter(e => e.name !== '.gitkeep')
115
- .map(e => ({
116
- name: e.name,
117
- description: e.isDirectory() ? '钩子目录' : '钩子脚本',
118
- category: '其他',
119
- sourcePath: path.join(hooksDir, e.name),
120
- type: 'hook',
121
- }))
122
- .sort((a, b) => a.name.localeCompare(b.name))
112
+ const hooks = []
113
+ for (const cat of await fs.readdir(hooksDir, { withFileTypes: true })) {
114
+ if (!cat.isDirectory()) continue
115
+ const catDir = path.join(hooksDir, cat.name)
116
+ for (const entry of await fs.readdir(catDir, { withFileTypes: true })) {
117
+ if (entry.name === '.gitkeep') continue
118
+ hooks.push({
119
+ name: entry.name,
120
+ description: entry.isDirectory() ? '钩子目录' : '钩子脚本',
121
+ category: cat.name,
122
+ sourcePath: path.join(catDir, entry.name),
123
+ type: 'hook',
124
+ })
125
+ }
126
+ }
127
+ return hooks.sort((a, b) => a.name.localeCompare(b.name))
123
128
  }
124
129
 
125
130
  async function scanExisting(projectTargetDir, typePlural) {