eskill 1.0.23 → 1.0.25
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/cli.js +41 -4
- package/lib/installer.js +18 -7
- 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.0.
|
|
16
|
+
.version('1.0.25');
|
|
17
17
|
|
|
18
18
|
// 安装命令
|
|
19
19
|
program
|
|
@@ -160,9 +160,9 @@ program
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// 从 API 返回的数据结构中提取技能和分页信息
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
let skills = result.data?.skills || result.data || result.skills || result.results || [];
|
|
164
|
+
let pagination = result.data?.pagination || result.pagination || {};
|
|
165
|
+
let total = pagination.total || result.total || skills.length;
|
|
166
166
|
|
|
167
167
|
// 确保 skills 是数组
|
|
168
168
|
if (!Array.isArray(skills)) {
|
|
@@ -171,6 +171,43 @@ program
|
|
|
171
171
|
process.exit(1);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
// 智能搜索:如果没有结果且是 name@author 格式
|
|
175
|
+
if (skills.length === 0) {
|
|
176
|
+
const match = query.match(/^([^@]+)@([^@]+)$/);
|
|
177
|
+
if (match) {
|
|
178
|
+
const [, skillName, author] = match;
|
|
179
|
+
console.log(`\n💡 未找到 "${query}",尝试按技能名 "${skillName}" 和作者 "${author}" 搜索...\n`);
|
|
180
|
+
|
|
181
|
+
// 重新搜索技能名
|
|
182
|
+
const newResult = await searchSkills(skillName, {
|
|
183
|
+
page: 1,
|
|
184
|
+
limit: 100,
|
|
185
|
+
sortBy: options.sort,
|
|
186
|
+
ai: options.ai
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const allSkills = newResult.data?.skills || newResult.data || newResult.skills || newResult.results || [];
|
|
190
|
+
|
|
191
|
+
// 筛选匹配作者的技能(不区分大小写)
|
|
192
|
+
skills = allSkills.filter(skill => {
|
|
193
|
+
const skillAuthor = (skill.author || skill.owner || '').toLowerCase();
|
|
194
|
+
return skillAuthor === author.toLowerCase();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
total = skills.length;
|
|
198
|
+
|
|
199
|
+
if (skills.length > 0) {
|
|
200
|
+
console.log(`✓ 找到 ${total} 个匹配的技能\n`);
|
|
201
|
+
} else {
|
|
202
|
+
console.log(`❌ 仍然未找到匹配的技能\n`);
|
|
203
|
+
console.log('提示:');
|
|
204
|
+
console.log(` - 尝试只搜索技能名: eskill search ${skillName}`);
|
|
205
|
+
console.log(` - 尝试只搜索作者: eskill search ${author}\n`);
|
|
206
|
+
process.exit(0);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
174
211
|
console.log(formatSkillList(skills));
|
|
175
212
|
|
|
176
213
|
// 显示分页信息和提示
|
package/lib/installer.js
CHANGED
|
@@ -200,7 +200,7 @@ async function handleSkillAtAuthorFormat(input) {
|
|
|
200
200
|
|
|
201
201
|
const [, skillName, author] = match;
|
|
202
202
|
console.log(`\n检测到技能名称格式: ${skillName}@${author}`);
|
|
203
|
-
console.log(`正在搜索 "${skillName}"...\n`);
|
|
203
|
+
console.log(`正在搜索 "${skillName}" 和作者 "${author}"...\n`);
|
|
204
204
|
|
|
205
205
|
try {
|
|
206
206
|
// 搜索技能
|
|
@@ -212,17 +212,28 @@ async function handleSkillAtAuthorFormat(input) {
|
|
|
212
212
|
|
|
213
213
|
const skills = result.data?.skills || result.data || result.skills || result.results || [];
|
|
214
214
|
|
|
215
|
-
//
|
|
215
|
+
// 筛选出匹配作者的技能(不区分大小写)
|
|
216
216
|
const matchedSkills = skills.filter(skill => {
|
|
217
|
-
const skillAuthor = skill.author || skill.owner || '';
|
|
218
|
-
return skillAuthor
|
|
217
|
+
const skillAuthor = (skill.author || skill.owner || '').toLowerCase();
|
|
218
|
+
return skillAuthor === author.toLowerCase();
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
if (matchedSkills.length === 0) {
|
|
222
222
|
// 没有找到匹配的作者
|
|
223
223
|
console.log(`❌ 未找到作者 "${author}" 的技能 "${skillName}"\n`);
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
|
|
225
|
+
// 显示找到的同名技能(如果有)
|
|
226
|
+
if (skills.length > 0) {
|
|
227
|
+
console.log(`找到 ${skills.length} 个名为 "${skillName}" 的技能,但作者不匹配:\n`);
|
|
228
|
+
console.log(formatSkillList(skills));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 给出建议
|
|
232
|
+
console.log(`💡 建议:`);
|
|
233
|
+
console.log(` - 尝试搜索其他作者: eskill search ${skillName}`);
|
|
234
|
+
console.log(` - 尝试搜索该作者的其他技能: eskill search ${author}`);
|
|
235
|
+
console.log(` - 或直接使用 GitHub URL 安装\n`);
|
|
236
|
+
|
|
226
237
|
throw new Error(`未找到匹配的技能`);
|
|
227
238
|
}
|
|
228
239
|
|
|
@@ -234,7 +245,7 @@ async function handleSkillAtAuthorFormat(input) {
|
|
|
234
245
|
throw new Error('技能信息中没有 GitHub URL');
|
|
235
246
|
}
|
|
236
247
|
|
|
237
|
-
console.log(
|
|
248
|
+
console.log(`✓ 找到匹配的技能:`);
|
|
238
249
|
console.log(` 名称: ${skillName}@${author}`);
|
|
239
250
|
console.log(` Stars: ⭐ ${matchedSkill.stars || 'N/A'}`);
|
|
240
251
|
console.log(` GitHub: ${githubUrl}\n`);
|