eskill 1.0.11 → 1.0.12
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 +8 -0
- package/lib/search.js +1 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -116,6 +116,14 @@ program
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
const skills = result.data || result.skills || result.results || [];
|
|
119
|
+
|
|
120
|
+
// 确保 skills 是数组
|
|
121
|
+
if (!Array.isArray(skills)) {
|
|
122
|
+
console.log('搜索返回数据格式异常');
|
|
123
|
+
console.log('调试信息:', JSON.stringify(result, null, 2));
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
|
|
119
127
|
console.log(formatSkillList(skills));
|
|
120
128
|
|
|
121
129
|
// 显示分页信息
|
package/lib/search.js
CHANGED
|
@@ -71,7 +71,7 @@ export async function searchSkills(query, options = {}) {
|
|
|
71
71
|
* 格式化技能列表显示
|
|
72
72
|
*/
|
|
73
73
|
export function formatSkillList(skills, showIndex = true) {
|
|
74
|
-
if (!skills || skills.length === 0) {
|
|
74
|
+
if (!skills || !Array.isArray(skills) || skills.length === 0) {
|
|
75
75
|
return '未找到相关技能';
|
|
76
76
|
}
|
|
77
77
|
|