@catcuts-skills/hello-world 1.0.6 → 1.0.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.
package/README.md CHANGED
@@ -70,15 +70,44 @@ npm test
70
70
 
71
71
  ### 卸载
72
72
 
73
+ **重要**:由于 npm 的限制,全局卸载时 preuninstall hook 可能不会执行。请按照以下步骤正确卸载:
74
+
75
+ #### 方式 1:使用 npm scripts(推荐)
76
+
73
77
  ```bash
74
78
  # 全局卸载
79
+ npm run uninstall:global
75
80
  npm uninstall -g @catcuts-skills/hello-world
76
81
 
77
82
  # 项目级卸载
83
+ npm run uninstall:local
78
84
  npm uninstall @catcuts-skills/hello-world
79
85
  ```
80
86
 
81
- 卸载时会自动清理 skill 文件。
87
+ #### 方式 2:手动清理(如果方式 1 失败)
88
+
89
+ ```bash
90
+ # 1. 清理技能文件
91
+ rm -rf ~/.claude/skills/hello-world
92
+ rm -rf ~/.agents/skills/hello-world
93
+
94
+ # 2. 卸载 npm 包
95
+ npm uninstall -g @catcuts-skills/hello-world
96
+ ```
97
+
98
+ **Windows PowerShell**:
99
+ ```powershell
100
+ # 1. 清理技能文件
101
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\skills\hello-world"
102
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.agents\skills\hello-world"
103
+
104
+ # 2. 卸载 npm 包
105
+ npm uninstall -g @catcuts-skills/hello-world
106
+ ```
107
+
108
+ #### 为什么需要两步?
109
+
110
+ npm 的 `preuninstall` hook 在全局卸载时**不保证被执行**,这是 npm 的已知限制。因此需要先手动清理技能文件,再卸载 npm 包。
82
111
 
83
112
  ## 使用示例
84
113
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@catcuts-skills/hello-world",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "简单的 Hello World 示例技能,用于验证技能安装是否成功。显示欢迎信息、环境信息和使用示例。",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "postinstall": "node scripts/install-skill.js",
8
- "preuninstall": "node scripts/uninstall-skill.js",
8
+ "preuninstall": "node scripts/uninstall-skill.js || exit 0",
9
9
  "test": "node scripts/install-skill.js --dry-run",
10
10
  "install:global": "node scripts/install-skill.js --global",
11
11
  "install:local": "node scripts/install-skill.js --local",
@@ -84,7 +84,7 @@ function isSymlink(filePath) {
84
84
  function safeRemovePath(filePath, description) {
85
85
  try {
86
86
  if (!fs.existsSync(filePath)) {
87
- return { success: true, removed: false, message: '不存在' };
87
+ return { success: true, removed: false, message: `不存在:${description}(${filePath})` };
88
88
  }
89
89
 
90
90
  const stats = fs.lstatSync(filePath);
@@ -96,28 +96,28 @@ function safeRemovePath(filePath, description) {
96
96
  return {
97
97
  success: true,
98
98
  removed: true,
99
- message: `已删除符号链接: ${description}`
99
+ message: `已删除符号链接: ${description}(${filePath})`
100
100
  };
101
101
  } else if (isDir) {
102
102
  fs.rmSync(filePath, { recursive: true, force: true });
103
103
  return {
104
104
  success: true,
105
105
  removed: true,
106
- message: `已删除目录: ${description}`
106
+ message: `已删除目录: ${description}(${filePath})`
107
107
  };
108
108
  } else {
109
109
  fs.unlinkSync(filePath);
110
110
  return {
111
111
  success: true,
112
112
  removed: true,
113
- message: `已删除文件: ${description}`
113
+ message: `已删除文件: ${description}(${filePath})`
114
114
  };
115
115
  }
116
116
  } catch (error) {
117
117
  return {
118
118
  success: false,
119
119
  removed: false,
120
- message: `删除失败: ${error.message}`
120
+ message: `删除失败: ${description}(${filePath}) - ${error.message}`
121
121
  };
122
122
  }
123
123
  }