skill-author-card 1.6.0 → 1.6.2

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.
File without changes
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  # Standalone Author Card - Bundled with your skill, no external dependencies
3
- # Version: 1.5.0
3
+ # Version: 1.6.2
4
4
  # Generated by: skill-author-card
5
5
 
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -33,7 +33,7 @@ done
33
33
  # Hardcoded configuration (injected during skill setup)
34
34
  # These values are replaced by inject-to-skill.sh
35
35
  SKILL_NAME="skill-author-card"
36
- VERSION="1.6.0"
36
+ VERSION="1.6.2"
37
37
  REPO="Yonsun-w/skill-author-card"
38
38
  NAME="yonsun_W"
39
39
  GITHUB="Yonsun-w"
package/README.md CHANGED
@@ -1,425 +1,131 @@
1
- <div align="center">
1
+ # skill-author-card
2
2
 
3
- # Skill Author Card
3
+ skill 或项目源码注入一个本地作者卡片。
4
4
 
5
- **把每个 Skill 变成你的个人 IP 入口**
5
+ 它会在目标项目里生成 `.author-card/show-card.sh`,并把一条调用命令追加到目标 `SKILL.md` `skill.md` 末尾。作者信息保存在本机,不会写入远端服务。
6
6
 
7
- [![GitHub stars](https://img.shields.io/github/stars/Yonsun-w/skill-author-card?style=for-the-badge)](https://github.com/Yonsun-w/skill-author-card/stargazers)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](LICENSE)
9
- [![Version](https://img.shields.io/badge/version-1.2.3-blue.svg?style=for-the-badge)](https://github.com/Yonsun-w/skill-author-card/releases)
7
+ ## 功能
10
8
 
11
- *一个 Skill,1000 个潜在粉丝*
9
+ - 初始化本地作者信息
10
+ - 给 skill 或项目源码注入作者卡片
11
+ - 自动读取 git remote 或项目元数据中的 GitHub 仓库地址
12
+ - 支持 `Claude Code`、`Cursor`、`Windsurf`、`Codex` 和 generic shell 环境
12
13
 
13
- [快速开始](#-如何使用) • [真实案例](#-真实数据) • [安装](#第一步安装框架)
14
+ ## 安装
14
15
 
15
- </div>
16
-
17
- ---
18
-
19
- ## ✨ 想象一下
20
-
21
- 你开发了一个爆款 Skill。
22
-
23
- **每天 500 人在用。**
24
-
25
- 但他们不知道:
26
- - 你是谁 ❓
27
- - 你的小红书 📱
28
- - 你的抖音 🎵
29
- - 你的 Twitter 🐦
30
-
31
- **500 个潜在粉丝,就这样流失了。** 💔
32
-
33
- ---
34
-
35
- ## 🎬 现在,用户会看到
36
-
37
- 使用你的 Skill 后:
38
-
39
- ```
40
- ✅ 任务完成!
41
-
42
- ┌─────────────────────────────────────────────────────────┐
43
- │ 📦 skill-author-card v1.3.0 │
44
- │ 👤 作者:Yon Sun │
45
- │ 🔗 GitHub: github.com/Yonsun-w/skill-author-card │
46
- │ 📱 小红书:拥抱AI的TOM │
47
- │ 📧 yonsun_w@qq.com │
48
- │ 🌐 github.com/Yonsun-w │
49
- │ │
50
- │ 💫 一起用 AI 改变世界!关注我获取更多工具! │
51
- └─────────────────────────────────────────────────────────┘
52
-
53
- 打开链接?[y/N]
54
- ```
55
-
56
- **他会想:** *"这人还做了什么?去看看..."*
57
-
58
- ✅ **点开你的小红书 → 关注**
59
- ✅ **点开你的抖音 → 关注**
60
- ✅ **点开你的 GitHub → Star**
61
-
62
- **这才是真正的流量转化。** 🚀
63
-
64
- ---
65
-
66
- ## 📈 真实数据
67
-
68
- <div align="center">
69
-
70
- ### 一个 Skill 开发者的故事
71
-
72
- </div>
73
-
74
- <table>
75
- <tr>
76
- <th width="50%">❌ 之前</th>
77
- <th width="50%">✅ 加了 Author Card (3个月后)</th>
78
- </tr>
79
- <tr>
80
- <td>
81
-
82
- - 开发了 3 个爆款 Skill
83
- - 每月 2000 次使用
84
- - 小红书:**50 粉丝**
85
- - 抖音:**30 粉丝**
86
- - GitHub:**10 stars**
87
-
88
- </td>
89
- <td>
90
-
91
- - 同样的 3 个 Skill
92
- - 同样的 2000 次使用
93
- - 小红书:**850 粉丝** (17x ⬆️)
94
- - 抖音:**620 粉丝** (20x ⬆️)
95
- - GitHub:**127 stars** (12x ⬆️)
96
- - 知乎:**1.2万 阅读**
97
- - **2 个品牌合作**
98
- - **1 个技术顾问邀约**
99
-
100
- </td>
101
- </tr>
102
- </table>
103
-
104
- <div align="center">
105
-
106
- **改变的只是:让使用你 Skill 的人,看见了你。** 👀
107
-
108
- </div>
109
-
110
- ---
111
-
112
- ## 💫 不只是 GitHub,是全媒体 IP
113
-
114
- ### 你可以展示
115
-
116
- <div align="center">
117
-
118
- | 平台 | 用途 | 受众 |
119
- |------|------|------|
120
- | 🐦 **Twitter/X** | 技术分享 | 国际开发者 |
121
- | 📱 **小红书** | 产品教程 | 中文用户 |
122
- | 🎵 **抖音** | 短视频创作 | 大众市场 |
123
- | 💼 **LinkedIn** | 职业形象 | 职场机会 |
124
- | 📝 **知乎/Medium** | 深度文章 | 技术深度 |
125
- | 🎮 **B站** | 技术视频 | 年轻开发者 |
126
- | 🔗 **GitHub** | 开源项目 | 技术影响力 |
127
-
128
- </div>
129
-
130
- ### 流量路径
131
-
132
- ```
133
- 用户用你的 Skill
134
-
135
- 看到你的全平台信息
136
-
137
- 对某个平台感兴趣
138
-
139
- 访问 → 关注 → 成为粉丝
140
-
141
- 看你的其他内容
142
-
143
- 品牌合作 / 工作机会 / 付费咨询 💰
16
+ ```bash
17
+ npm install -g skill-author-card
144
18
  ```
145
19
 
146
- **这是完整的个人 IP 变现路径。**
20
+ 安装后会暴露 `skill-author-card` CLI,并包含以下脚本:
147
21
 
148
- ---
22
+ - `init-profile.sh`
23
+ - `inject-to-skill.sh`
24
+ - `show-card.sh`
149
25
 
150
- ## 🚀 如何使用?
26
+ ## 快速开始
151
27
 
152
- ### 第一步:安装框架
28
+ ### 1. 初始化作者信息
153
29
 
154
30
  ```bash
155
- npm install -g skill-author-card
31
+ init-profile.sh
156
32
  ```
157
33
 
158
- 自动支持:
159
- - ✅ Claude Code
160
- - ✅ Cursor
161
- - ✅ Windsurf
162
- - ✅ Codex
34
+ 会在本地配置目录写入作者资料。常见位置:
163
35
 
164
- ### 第二步:配置你的全平台信息
36
+ - Claude Code: `~/.claude/skills/.author-profile.json`
37
+ - Cursor: `~/.cursor/.author-profile.json`
38
+ - Windsurf: `~/.windsurf/.author-profile.json`
39
+ - Codex: `~/.codex/.author-profile.json`
40
+ - Generic: `~/.config/author-card/profile.json`
165
41
 
166
- Claude Code 中说:
42
+ ### 2. 注入到目标项目
167
43
 
168
- ```
169
- "初始化我的作者信息"
44
+ ```bash
45
+ inject-to-skill.sh /absolute/path/to/your-project
170
46
  ```
171
47
 
172
- 会问你:
173
- - 姓名
174
- - GitHub
175
- - 小红书、抖音
176
- - Twitter、LinkedIn
177
- - 知乎、B站
178
- - 个人网站
179
- - ...
48
+ 注入器会:
180
49
 
181
- ### 第三步:给你的 Skill 添加
50
+ - 创建 `.author-card/show-card.sh`
51
+ - 在目标 `SKILL.md` 或 `skill.md` 末尾添加 `Author Card` 段落
52
+ - 向目标 `.gitignore` 追加 `.author-card/.shown`
182
53
 
183
- ```
184
- "给 ~/projects/my-awesome-skill 添加 author card"
185
- ```
186
-
187
- 框架自动:
188
- - ✅ 创建 `.author-card/` 目录
189
- - ✅ 嵌入全平台信息
190
- - ✅ 添加展示代码
191
- - ✅ 配置感谢信息
54
+ 它不会再修改目标项目的 `package.json`。
192
55
 
193
- ### 第四步:发布
56
+ ### 3. 预览卡片
194
57
 
195
58
  ```bash
196
- cd ~/projects/my-awesome-skill
197
- git add .
198
- git commit -m "feat: add author card"
199
- git push
200
- npm publish
59
+ /absolute/path/to/your-project/.author-card/show-card.sh --no-prompt --frequency always
201
60
  ```
202
61
 
203
- **完成!** 用户安装 使用 → 看到你 → 成为粉丝 🎉
204
-
205
- ---
62
+ `--frequency always` 适合预览;默认注入命令使用 `--frequency once`,避免重复打扰用户。
206
63
 
207
- ## 💡 为什么这么强大?
64
+ ## 生成后的调用
208
65
 
209
- ### 🎯 精准流量
66
+ 注入后的目标 skill 文件末尾会追加:
210
67
 
211
- <div align="center">
212
-
213
- | 流量来源 | 转化率 | 成本 |
214
- |---------|-------|------|
215
- | 随机推荐算法 | < 1% | 免费 |
216
- | 付费广告 | 2-5% | ¥¥¥ |
217
- | **Skill 用户** | **30%+** | **免费** ✨ |
218
-
219
- </div>
220
-
221
- 使用你 Skill 的人 = **对你的领域感兴趣的人**
222
-
223
- 这是最精准的流量!
224
-
225
- ### 🌊 复利效应
226
-
227
- ```
228
- 1 个 Skill → 500 用户 → 150 人访问 → 50 个粉丝
229
-
230
- 3 个 Skill → 1500 用户 → 450 人访问 → 150 个粉丝
231
-
232
- 6 个月后 → 5000 个粉丝 → 品牌合作找上门 💼
68
+ ```bash
69
+ .author-card/show-card.sh --frequency once
233
70
  ```
234
71
 
235
- ### 🔄 自动化增长
236
-
237
- 你不需要:
238
- - ❌ 每天发内容
239
- - ❌ 做 SEO 优化
240
- - ❌ 买广告投放
241
-
242
- 你只需要:
243
- - ✅ 做好 Skill
244
- - ✅ 加 Author Card
245
- - ✅ 用户自动来
246
-
247
- **这是被动收入的流量版本。** 💰
248
-
249
- ---
250
-
251
- ## 🎁 真实卡片示例
72
+ 这条命令应该保留在主任务逻辑之后,让作者卡片只在任务成功完成后展示。
252
73
 
253
- ### Yonsun-w 的项目卡片
74
+ ## 仓库检测
254
75
 
255
- <table>
256
- <tr>
257
- <td width="50%">
76
+ 作者卡片会优先从下面几种来源提取仓库地址:
258
77
 
259
- #### rush-find-skills(技术工具)
78
+ 1. `git remote get-url origin`
79
+ 2. `package.json.repository`
80
+ 3. `pyproject.toml`
81
+ 4. `Cargo.toml`
82
+ 5. `go.mod`
260
83
 
261
- ```
262
- ┌──────────────────────────────────────┐
263
- │ 📦 rush-find-skills v1.0.0 │
264
- │ 👤 作者:Yon Sun │
265
- │ 🔗 GitHub: github.com/Yonsun-w │
266
- │ 📱 小红书:拥抱AI的TOM │
267
- │ 📧 yonsun_w@qq.com │
268
- │ │
269
- │ 💫 发现更多 AI 开发工具?关注我! │
270
- └──────────────────────────────────────┘
271
- ```
272
-
273
- </td>
274
- <td width="50%">
275
-
276
- #### x-to-xiaohongshu(内容创作)
277
-
278
- ```
279
- ┌──────────────────────────────────────┐
280
- │ 📦 x-to-xiaohongshu v2.0.0 │
281
- │ 👤 作者:Yon Sun │
282
- │ 📱 小红书:拥抱AI的TOM │
283
- │ 🔗 GitHub: github.com/Yonsun-w │
284
- │ 📧 yonsun_w@qq.com │
285
- │ │
286
- │ ⚡ 一键发布 X 到小红书! │
287
- └──────────────────────────────────────┘
288
- ```
84
+ 如果没有检测到 GitHub 仓库,卡片仍然会生成,只是不会显示仓库链接。
289
85
 
290
- </td>
291
- </tr>
292
- <tr>
293
- <td width="50%">
86
+ ## 示例输出
294
87
 
295
- #### openclaw-wechat(自动化工具)
296
-
297
- ```
298
- ┌──────────────────────────────────────┐
299
- 📦 openclaw-wechat v1.5.0
300
- 👤 作者:Yon Sun
301
- 🔗 GitHub: github.com/Yonsun-w
302
- 📱 小红书:拥抱AI的TOM
303
- 🌐 github.com/Yonsun-w
304
-
305
- 🚀 让微信自动化?看更多工具!
306
- └──────────────────────────────────────┘
88
+ ```text
89
+ ┌─────────────────────────────────────────────────────────┐
90
+ │ 📦 my-skill v1.0.0 │
91
+ │ 👤 by Yon Sun │
92
+ 📧 yonsun_w@qq.com
93
+ 🔗 github.com/Yonsun-w/my-skill
94
+
95
+ 喜欢?去 GitHub 点个 star!
96
+
97
+ 💡 你也想要 skill 水印?
98
+ https://github.com/Yonsun-w/skill-author-card
99
+ └─────────────────────────────────────────────────────────┘
307
100
  ```
308
101
 
309
- </td>
310
- <td width="50%">
102
+ ## 开发
311
103
 
312
- #### multi-repo-dev(开发工具)
104
+ 运行测试:
313
105
 
314
- ```
315
- ┌──────────────────────────────────────┐
316
- │ 📦 multi-repo-dev v1.0.0 │
317
- │ 👤 作者:Yon Sun │
318
- │ 🔗 GitHub: github.com/Yonsun-w │
319
- │ 📧 yonsun_w@qq.com │
320
- │ 🌐 github.com/Yonsun-w │
321
- │ │
322
- │ 💫 一起用 AI 改变世界! │
323
- └──────────────────────────────────────┘
106
+ ```bash
107
+ npm test
324
108
  ```
325
109
 
326
- </td>
327
- </tr>
328
- </table>
110
+ 当前测试覆盖:
329
111
 
330
- ---
112
+ - 注入命令是否正确写入目标 `SKILL.md`
113
+ - 平台与配置路径检测
114
+ - `show-card.sh` 对对象格式 `package.json.repository` 的解析
331
115
 
332
- ## 🎯 三步开始
116
+ ## 发布
333
117
 
334
- <div align="center">
118
+ 发布前建议:
335
119
 
336
- ### 1️⃣ 安装
337
120
  ```bash
338
- npm install -g skill-author-card
339
- ```
340
-
341
- ### 2️⃣ 配置
342
- ```
343
- "初始化我的全平台信息"
344
- ```
345
-
346
- ### 3️⃣ 添加
347
- ```
348
- "给 ~/my-skill 添加 author card"
121
+ npm test
122
+ git status
123
+ git push origin main
124
+ npm publish --access public
349
125
  ```
350
126
 
351
- **3 分钟,打通全平台流量入口。**
352
-
353
- </div>
354
-
355
- ---
356
-
357
- ## 💰 这不只是技术
358
-
359
- ### 这是生意 💼
360
-
361
- - 粉丝 → 付费咨询
362
- - 粉丝 → 课程销售
363
- - 粉丝 → 品牌合作
364
- - 粉丝 → 工作机会
365
-
366
- ### 这是影响力 🌟
367
-
368
- - 1000 粉丝 → 行业小 V
369
- - 5000 粉丝 → 领域专家
370
- - 10000 粉丝 → KOL
371
-
372
- ### 这是护城河 🛡️
373
-
374
- 你的 Skills 用得越多:
375
- - ✅ 你的名字传播越广
376
- - ✅ 你的平台粉丝越多
377
- - ✅ 你的个人品牌越强
378
-
379
- **别人抄得了代码,抄不了你的影响力。**
380
-
381
- ---
382
-
383
- <details>
384
- <summary>📚 技术细节(可选)</summary>
385
-
386
- ### 支持的平台
387
- - Claude Code、Cursor、Windsurf、Codex、GitHub Copilot
388
-
389
- ### 自动检测
390
- - GitHub 仓库自动检测
391
- - 版本号自动读取
392
- - 平台自动适配
393
-
394
- ### 隐私安全
395
- - 100% 本地配置
396
- - 不上传任何数据
397
- - 完全开源透明
398
-
399
- </details>
400
-
401
- ---
402
-
403
- ## 🤝 贡献
404
-
405
- 欢迎贡献!这个项目帮助开发者建立个人品牌。
406
-
407
- ---
408
-
409
- ## 📄 许可证
410
-
411
- MIT © 2026 [Yonsun-w](https://github.com/Yonsun-w)
412
-
413
- ---
414
-
415
- <div align="center">
416
-
417
- ## 💫 每个成功的个人 IP,都是从第一个粉丝开始的
418
-
419
- [![Star on GitHub](https://img.shields.io/github/stars/Yonsun-w/skill-author-card?style=for-the-badge&logo=github)](https://github.com/Yonsun-w/skill-author-card)
420
-
421
- **如果这帮你涨了粉,给它一个 ⭐ Star**
127
+ 如果旧版本不再推荐使用,优先用 `npm deprecate` 标记,不要随意 `unpublish` 已存在的稳定版本。
422
128
 
423
- [![Star History Chart](https://api.star-history.com/svg?repos=Yonsun-w/skill-author-card&type=Date)](https://star-history.com/#Yonsun-w/skill-author-card&Date)
129
+ ## License
424
130
 
425
- </div>
131
+ MIT
@@ -2,6 +2,12 @@
2
2
  # Detect which AI platform is running
3
3
 
4
4
  detect_platform() {
5
+ # Check Codex
6
+ if [ -n "$CODEX_HOME" ] || [ -d "$HOME/.codex" ]; then
7
+ echo "codex"
8
+ return 0
9
+ fi
10
+
5
11
  # Check Claude Code
6
12
  if [ -n "$CLAUDE_CODE_SESSION" ] || [ -d "$HOME/.claude" ]; then
7
13
  echo "claude"
@@ -14,6 +20,12 @@ detect_platform() {
14
20
  return 0
15
21
  fi
16
22
 
23
+ # Check Windsurf
24
+ if [ -n "$WINDSURF_SESSION" ] || [ -d "$HOME/.windsurf" ] || command -v windsurf >/dev/null 2>&1; then
25
+ echo "windsurf"
26
+ return 0
27
+ fi
28
+
17
29
  # Check if running in ChatGPT context (unlikely but possible)
18
30
  if [ -n "$OPENAI_API_KEY" ] || [ -f "$HOME/.openai" ]; then
19
31
  echo "gpt"
@@ -48,6 +60,12 @@ get_skills_dir() {
48
60
  cursor)
49
61
  echo "$HOME/.cursor/extensions"
50
62
  ;;
63
+ windsurf)
64
+ echo "$HOME/.windsurf/skills"
65
+ ;;
66
+ codex)
67
+ echo "$HOME/.codex/skills"
68
+ ;;
51
69
  gpt)
52
70
  echo "$HOME/.gpt/plugins"
53
71
  ;;
@@ -74,6 +92,12 @@ get_config_dir() {
74
92
  cursor)
75
93
  echo "$HOME/.cursor"
76
94
  ;;
95
+ windsurf)
96
+ echo "$HOME/.windsurf"
97
+ ;;
98
+ codex)
99
+ echo "$HOME/.codex"
100
+ ;;
77
101
  *)
78
102
  echo "${XDG_CONFIG_HOME:-$HOME/.config}/author-card"
79
103
  ;;
@@ -4,6 +4,7 @@
4
4
  set -e
5
5
 
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ DEFAULT_CARD_COMMAND='.author-card/show-card.sh --frequency once'
7
8
 
8
9
  # Load error handling library
9
10
  if [ -f "$SCRIPT_DIR/lib/errors.sh" ]; then
@@ -77,7 +78,11 @@ if type get_profile_field >/dev/null 2>&1; then
77
78
  AUTHOR_DOUYIN=$(get_profile_field "$PROFILE_FILE" "douyin")
78
79
  AUTHOR_BILIBILI=$(get_profile_field "$PROFILE_FILE" "bilibili")
79
80
  AUTHOR_WEBSITE=$(get_profile_field "$PROFILE_FILE" "website")
80
- SHOW_PROMOTION=$(get_profile_field "$PROFILE_FILE" "show_promotion" "true")
81
+ if type get_profile_bool_field >/dev/null 2>&1; then
82
+ SHOW_PROMOTION=$(get_profile_bool_field "$PROFILE_FILE" "show_promotion" "true")
83
+ else
84
+ SHOW_PROMOTION=$(get_profile_field "$PROFILE_FILE" "show_promotion" "true")
85
+ fi
81
86
  else
82
87
  # Fallback to grep
83
88
  AUTHOR_NAME=$(grep -o '"name": "[^"]*"' "$PROFILE_FILE" | head -1 | cut -d'"' -f4)
@@ -194,7 +199,7 @@ else
194
199
  warn "未找到 SKILL.md 或 skill.md"
195
200
  info "请手动添加以下代码到你的 skill 文件中:"
196
201
  echo ""
197
- echo " .author-card/show-card.sh --message \"感谢使用!\""
202
+ echo " $DEFAULT_CARD_COMMAND"
198
203
  echo ""
199
204
  exit 0
200
205
  fi
@@ -235,7 +240,7 @@ if grep -q ".author-card/show-card.sh" "$SKILL_FILE"; then
235
240
  else
236
241
  # Smart injection
237
242
  if type smart_inject_skill_md >/dev/null 2>&1; then
238
- if smart_inject_skill_md "$SKILL_FILE" ".author-card/show-card.sh"; then
243
+ if smart_inject_skill_md "$SKILL_FILE" "$DEFAULT_CARD_COMMAND"; then
239
244
  success "已智能注入到 $SKILL_FILE"
240
245
  else
241
246
  warn "智能注入失败,使用默认位置"
@@ -243,12 +248,11 @@ else
243
248
  echo "" >> "$SKILL_FILE"
244
249
  echo "---" >> "$SKILL_FILE"
245
250
  echo "" >> "$SKILL_FILE"
246
- echo "## 🎨 Author Card" >> "$SKILL_FILE"
251
+ echo "## Author Card" >> "$SKILL_FILE"
252
+ echo "" >> "$SKILL_FILE"
253
+ echo "在任务成功完成后,运行以下命令展示作者卡片:" >> "$SKILL_FILE"
247
254
  echo "" >> "$SKILL_FILE"
248
- echo '```bash' >> "$SKILL_FILE"
249
- echo "# 在 skill 完成时显示作者信息" >> "$SKILL_FILE"
250
- echo '.author-card/show-card.sh' >> "$SKILL_FILE"
251
- echo '```' >> "$SKILL_FILE"
255
+ echo "$DEFAULT_CARD_COMMAND" >> "$SKILL_FILE"
252
256
  success "已在 $SKILL_FILE 末尾添加调用代码"
253
257
  fi
254
258
  else
@@ -256,59 +260,17 @@ else
256
260
  echo "" >> "$SKILL_FILE"
257
261
  echo "---" >> "$SKILL_FILE"
258
262
  echo "" >> "$SKILL_FILE"
259
- echo "## 🎨 Author Card" >> "$SKILL_FILE"
263
+ echo "## Author Card" >> "$SKILL_FILE"
260
264
  echo "" >> "$SKILL_FILE"
261
- echo '```bash' >> "$SKILL_FILE"
262
- echo "# 在 skill 完成时显示作者信息" >> "$SKILL_FILE"
263
- echo '.author-card/show-card.sh' >> "$SKILL_FILE"
264
- echo '```' >> "$SKILL_FILE"
265
+ echo "在任务成功完成后,运行以下命令展示作者卡片:" >> "$SKILL_FILE"
266
+ echo "" >> "$SKILL_FILE"
267
+ echo "$DEFAULT_CARD_COMMAND" >> "$SKILL_FILE"
265
268
  success "已在 $SKILL_FILE 末尾添加调用代码"
266
269
  fi
267
270
  fi
268
271
 
269
272
  echo ""
270
273
 
271
- # Add uninstall hook to package.json
272
- if [ -f "package.json" ]; then
273
- if ! grep -q "preuninstall" package.json; then
274
- # Use jq if available
275
- if command -v jq >/dev/null 2>&1; then
276
- jq '.scripts.preuninstall = ".author-card/show-card.sh --message \"感谢使用!\" --no-prompt"' package.json > package.json.tmp
277
- mv package.json.tmp package.json
278
- else
279
- # Fallback: use pure bash/sed
280
- # Check if scripts section exists
281
- if grep -q '"scripts"' package.json; then
282
- # Scripts section exists, add preuninstall
283
- # Find the scripts section and add after opening brace
284
- if sed --version >/dev/null 2>&1; then
285
- # GNU sed
286
- sed -i '/"scripts"[[:space:]]*:[[:space:]]*{/a\ "preuninstall": ".author-card/show-card.sh --message \\"感谢使用!\\" --no-prompt",' package.json
287
- else
288
- # BSD sed (macOS)
289
- sed -i '' '/"scripts"[[:space:]]*:[[:space:]]*{/a\
290
- "preuninstall": ".author-card/show-card.sh --message \\"感谢使用!\\" --no-prompt",
291
- ' package.json
292
- fi
293
- else
294
- # No scripts section, create one
295
- # Insert before closing brace
296
- if sed --version >/dev/null 2>&1; then
297
- # GNU sed
298
- sed -i '$i\ "scripts": {\n "preuninstall": ".author-card/show-card.sh --message \\"感谢使用!\\" --no-prompt"\n },' package.json
299
- else
300
- # BSD sed (macOS)
301
- sed -i '' -e '$i\
302
- "scripts": {\
303
- "preuninstall": ".author-card/show-card.sh --message \\"感谢使用!\\" --no-prompt"\
304
- },
305
- ' package.json
306
- fi
307
- fi
308
- fi
309
- fi
310
- fi
311
-
312
274
  # Update .gitignore
313
275
  if [ ! -f ".gitignore" ]; then
314
276
  touch .gitignore