eskill 1.3.2 → 1.3.4

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 (3) hide show
  1. package/cli.js +1 -1
  2. package/lib/completion.js +116 -31
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -13,7 +13,7 @@ const program = new Command();
13
13
  program
14
14
  .name('eskill')
15
15
  .description('Unified AI Agent Skills Management - Install skills from Git URLs')
16
- .version('1.3.2')
16
+ .version('1.3.4')
17
17
  .option('-g, --global', '使用全局技能目录(~/.eskill/skills/),否则使用当前目录(./.claude/skills/)', false);
18
18
 
19
19
  // 安装命令
package/lib/completion.js CHANGED
@@ -5,8 +5,7 @@
5
5
  * eskill completion >> ~/.bashrc
6
6
  * eskill completion >> ~/.zshrc
7
7
  */
8
- import { listSkills, getSkillsDir } from './installer.js';
9
- import { existsSync } from 'fs';
8
+ import { listSkills } from './installer.js';
10
9
  import { getDefaultAgent } from './agent-config.js';
11
10
 
12
11
  // 获取已安装的技能列表
@@ -43,10 +42,38 @@ export function bashCompletionScript() {
43
42
  ' break\n' +
44
43
  ' fi\n' +
45
44
  ' done\n\n' +
45
+ ' # 检测当前命令\n' +
46
+ ' local cmd=""\n' +
47
+ ' for word in "${words[@]}"; do\n' +
48
+ ' case ${word} in\n' +
49
+ ' install|add|remove|rm|uninstall|update|list|ls|link|upload|search|cleanup|config|completion|agents|help)\n' +
50
+ ' cmd="${word}"\n' +
51
+ ' break\n' +
52
+ ' ;;\n' +
53
+ ' esac\n' +
54
+ ' done\n\n' +
55
+ ' # 如果还没有输入命令,提供命令补全(支持前缀匹配)\n' +
56
+ ' if [[ -z "${cmd}" ]] && [[ $cword -gt 0 ]]; then\n' +
57
+ ' local commands="install add remove rm uninstall update list ls link upload search cleanup config agents completion help"\n' +
58
+ ' local matching_cmds=""\n' +
59
+ ' for c in ${commands}; do\n' +
60
+ ' if [[ "$c" == "${cur}"* ]]; then\n' +
61
+ ' matching_cmds="$matching_cmds $c"\n' +
62
+ ' fi\n' +
63
+ ' done\n' +
64
+ ' if [[ -n "$matching_cmds" ]]; then\n' +
65
+ ' COMPREPLY=($(compgen -W "${matching_cmds}" -- "${cur}"))\n' +
66
+ ' return\n' +
67
+ ' fi\n' +
68
+ ' fi\n\n' +
46
69
  ' case ${prev} in\n' +
70
+ ' install|add)\n' +
71
+ ' COMPREPLY=($(compgen -W "-a --agent -l --link -f --force" -- "${cur}"))\n' +
72
+ ' return\n' +
73
+ ' ;;\n' +
47
74
  ' remove|rm|uninstall)\n' +
48
75
  ' local skills=$(eskill _list_skills ${global_mode} 2>/dev/null)\n' +
49
- ' COMPREPLY=($(compgen -W "${skills}" -- "${cur}"))\n' +
76
+ ' COMPREPLY=($(compgen -W "${skills} -a --agent" -- "${cur}"))\n' +
50
77
  ' return\n' +
51
78
  ' ;;\n' +
52
79
  ' link)\n' +
@@ -61,16 +88,19 @@ export function bashCompletionScript() {
61
88
  ' ;;\n' +
62
89
  ' update)\n' +
63
90
  ' local skills=$(eskill _list_skills ${global_mode} 2>/dev/null)\n' +
64
- ' local all="all"\n' +
65
- ' COMPREPLY=($(compgen -W "${skills} ${all}" -- "${cur}"))\n' +
91
+ ' COMPREPLY=($(compgen -W "${skills} all -f --force" -- "${cur}"))\n' +
66
92
  ' return\n' +
67
93
  ' ;;\n' +
68
- ' cleanup)\n' +
69
- ' COMPREPLY=($(compgen -W "--all -a" -- "${cur}"))\n' +
94
+ ' list|ls)\n' +
95
+ ' COMPREPLY=($(compgen -W "-a --agent" -- "${cur}"))\n' +
70
96
  ' return\n' +
71
97
  ' ;;\n' +
72
98
  ' search)\n' +
73
- ' COMPREPLY=($(compgen -W "--page --limit --sort --ai -p -l -s" -- "${cur}"))\n' +
99
+ ' COMPREPLY=($(compgen -W "-p --page -l --limit -s --sort --ai" -- "${cur}"))\n' +
100
+ ' return\n' +
101
+ ' ;;\n' +
102
+ ' cleanup)\n' +
103
+ ' COMPREPLY=($(compgen -W "-a --all" -- "${cur}"))\n' +
74
104
  ' return\n' +
75
105
  ' ;;\n' +
76
106
  ' config)\n' +
@@ -78,13 +108,39 @@ export function bashCompletionScript() {
78
108
  ' return\n' +
79
109
  ' ;;\n' +
80
110
  ' completion)\n' +
81
- ' COMPREPLY=($(compgen -W "--shell -s" -- "${cur}"))\n' +
111
+ ' COMPREPLY=($(compgen -W "-s --shell" -- "${cur}"))\n' +
82
112
  ' return\n' +
83
113
  ' ;;\n' +
84
114
  ' *)\n' +
85
115
  ' case ${cur} in\n' +
86
116
  ' -*)\n' +
87
- ' COMPREPLY=($(compgen -W "-g --global -h --help -V --version" -- "${cur}"))\n' +
117
+ ' # 根据当前命令显示对应选项\n' +
118
+ ' case ${cmd} in\n' +
119
+ ' install|add)\n' +
120
+ ' COMPREPLY=($(compgen -W "-a --agent -l --link -f --force" -- "${cur}"))\n' +
121
+ ' ;;\n' +
122
+ ' remove|rm|uninstall)\n' +
123
+ ' COMPREPLY=($(compgen -W "-a --agent" -- "${cur}"))\n' +
124
+ ' ;;\n' +
125
+ ' update)\n' +
126
+ ' COMPREPLY=($(compgen -W "-f --force" -- "${cur}"))\n' +
127
+ ' ;;\n' +
128
+ ' list|ls)\n' +
129
+ ' COMPREPLY=($(compgen -W "-a --agent" -- "${cur}"))\n' +
130
+ ' ;;\n' +
131
+ ' search)\n' +
132
+ ' COMPREPLY=($(compgen -W "-p --page -l --limit -s --sort --ai" -- "${cur}"))\n' +
133
+ ' ;;\n' +
134
+ ' cleanup)\n' +
135
+ ' COMPREPLY=($(compgen -W "-a --all" -- "${cur}"))\n' +
136
+ ' ;;\n' +
137
+ ' completion)\n' +
138
+ ' COMPREPLY=($(compgen -W "-s --shell" -- "${cur}"))\n' +
139
+ ' ;;\n' +
140
+ ' *)\n' +
141
+ ' COMPREPLY=($(compgen -W "-g --global -h --help -V --version" -- "${cur}"))\n' +
142
+ ' ;;\n' +
143
+ ' esac\n' +
88
144
  ' return\n' +
89
145
  ' ;;\n' +
90
146
  ' *)\n' +
@@ -121,26 +177,46 @@ export function zshCompletionScript() {
121
177
  ' \'completion:生成自动补全脚本\'\n' +
122
178
  ' \'help:显示帮助信息\'\n' +
123
179
  ' )\n\n' +
124
- ' local -a link_commands\n' +
125
- ' link_commands=(\n' +
126
- ' \'--global:使用全局技能目录\'\n' +
127
- ' \'--help:显示帮助信息\'\n' +
180
+ ' # 启用前缀匹配\n' +
181
+ ' zstyle \':completion:*\' matcher-list \'m:{a-zA-Z}={A-Za-z}\' \'r:|[._-]=* r:|=*\' \'l:|=*\'\n\n' +
182
+ ' local -a install_options\n' +
183
+ ' install_options=(\n' +
184
+ ' \'--agent[目标 agent]\'\n' +
185
+ ' \'{-a,--agent}[目标 agent]\'\n' +
186
+ ' \'--link[使用符号链接而非复制]\'\n' +
187
+ ' \'{-l,--link}[使用符号链接而非复制]\'\n' +
188
+ ' \'--force[强制覆盖已存在的技能]\'\n' +
189
+ ' \'{-f,--force}[强制覆盖已存在的技能]\'\n' +
190
+ ' )\n\n' +
191
+ ' local -a list_options\n' +
192
+ ' list_options=(\n' +
193
+ ' \'--agent[目标 agent]\'\n' +
194
+ ' \'{-a,--agent}[目标 agent]\'\n' +
195
+ ' )\n\n' +
196
+ ' local -a update_options\n' +
197
+ ' update_options=(\n' +
198
+ ' \'--force[强制更新(即使版本相同)]\'\n' +
199
+ ' \'{-f,--force}[强制更新(即使版本相同)]\'\n' +
128
200
  ' )\n\n' +
129
- ' local -a update_commands\n' +
130
- ' update_commands=(\n' +
131
- ' \'--force:强制更新\'\n' +
132
- ' \'all:更新所有技能\'\n' +
201
+ ' local -a search_options\n' +
202
+ ' search_options=(\n' +
203
+ ' \'--page[页码]\'\n' +
204
+ ' \'{-p,--page}[页码]\'\n' +
205
+ ' \'--limit[每页数量(max: 100)]\'\n' +
206
+ ' \'{-l,--limit}[每页数量(max: 100)]\'\n' +
207
+ ' \'--sort[排序方式(stars/recent)]\'\n' +
208
+ ' \'{-s,--sort}[排序方式(stars/recent)]\'\n' +
209
+ ' \'--ai[使用 AI 语义搜索]\'\n' +
133
210
  ' )\n\n' +
134
- ' local -a search_commands\n' +
135
- ' search_commands=(\n' +
136
- ' \'--page:页码\'\n' +
137
- ' \'--limit:每页数量\'\n' +
138
- ' \'--sort:排序方式\'\n' +
139
- ' \'--ai:AI 语义搜索\'\n' +
211
+ ' local -a cleanup_options\n' +
212
+ ' cleanup_options=(\n' +
213
+ ' \'--all[清理所有数据(包括配置和技能)]\'\n' +
214
+ ' \'{-a,--all}[清理所有数据(包括配置和技能)]\'\n' +
140
215
  ' )\n\n' +
141
- ' local -a cleanup_commands\n' +
142
- ' cleanup_commands=(\n' +
143
- ' \'--all:清理所有数据\'\n' +
216
+ ' local -a completion_options\n' +
217
+ ' completion_options=(\n' +
218
+ ' \'--shell[Shell 类型(bash/zsh)]\'\n' +
219
+ ' \'{-s,--shell}[Shell 类型(bash/zsh)]\'\n' +
144
220
  ' )\n\n' +
145
221
  ' local -a config_commands\n' +
146
222
  ' config_commands=(\n' +
@@ -152,9 +228,15 @@ export function zshCompletionScript() {
152
228
  ' \'1: :_eskill_commands\' \\\n' +
153
229
  ' \'*::arg:->args\'\n\n' +
154
230
  ' case $words[1] in\n' +
231
+ ' install|add)\n' +
232
+ ' _describe \'options\' install_options\n' +
233
+ ' ;;\n' +
155
234
  ' remove|rm|uninstall)\n' +
156
235
  ' local skills=($(eskill _list_skills -g 2>/dev/null))\n' +
157
- ' _describe \'skills\' skills\n' +
236
+ ' _alternative \'args:option:(--agent -a)\' \'skills:skills:($skills)\'\n' +
237
+ ' ;;\n' +
238
+ ' list|ls)\n' +
239
+ ' _describe \'options\' list_options\n' +
158
240
  ' ;;\n' +
159
241
  ' link)\n' +
160
242
  ' local skills=($(eskill _list_global_skills 2>/dev/null))\n' +
@@ -166,17 +248,20 @@ export function zshCompletionScript() {
166
248
  ' ;;\n' +
167
249
  ' update)\n' +
168
250
  ' local skills=($(eskill _list_skills -g 2>/dev/null))\n' +
169
- ' _values "skills" ${skills} "all"\n' +
251
+ ' _alternative \'args:options:(--force -f)\' \'skills:skills:(all ${skills})\'\n' +
170
252
  ' ;;\n' +
171
253
  ' search)\n' +
172
- ' _describe \'options\' search_commands\n' +
254
+ ' _describe \'options\' search_options\n' +
173
255
  ' ;;\n' +
174
256
  ' cleanup)\n' +
175
- ' _describe \'options\' cleanup_commands\n' +
257
+ ' _describe \'options\' cleanup_options\n' +
176
258
  ' ;;\n' +
177
259
  ' config)\n' +
178
260
  ' _describe \'actions\' config_commands\n' +
179
261
  ' ;;\n' +
262
+ ' completion)\n' +
263
+ ' _describe \'options\' completion_options\n' +
264
+ ' ;;\n' +
180
265
  ' *)\n' +
181
266
  ' _describe \'command\' commands\n' +
182
267
  ' ;;\n' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eskill",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Unified AI Agent Skills Management - Install skills from Git URLs",
5
5
  "main": "index.js",
6
6
  "type": "module",