joyskills-cli 0.1.3 → 0.1.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.
- package/package.json +1 -1
- package/src/commands/install.js +11 -0
- package/src/commands/sync.js +9 -13
package/package.json
CHANGED
package/src/commands/install.js
CHANGED
|
@@ -74,6 +74,13 @@ async function installPublicSkill(skillName, options, localManager, lockfileMana
|
|
|
74
74
|
console.log(`💡 Using openskills install...\n`);
|
|
75
75
|
|
|
76
76
|
try {
|
|
77
|
+
// 检查 openskills 是否可用
|
|
78
|
+
try {
|
|
79
|
+
execSync('npx openskills --version', { stdio: 'pipe' });
|
|
80
|
+
} catch (error) {
|
|
81
|
+
throw new Error('openskills not found. Please install: npm install -g openskills');
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
// 调用 openskills install
|
|
78
85
|
const cmd = `npx openskills install ${skillName}`;
|
|
79
86
|
execSync(cmd, { stdio: 'inherit' });
|
|
@@ -146,6 +153,10 @@ async function installTeamSkill(skillName, options, projectRoot, localManager, l
|
|
|
146
153
|
console.log(`Installing ${skillName} v${targetVersion} (local/custom)`);
|
|
147
154
|
}
|
|
148
155
|
|
|
156
|
+
// TODO: 实现从 Git Registry 拉取 skill
|
|
157
|
+
// 目前仅生成示例 SKILL.md
|
|
158
|
+
console.log('\n⚠️ 注意:当前版本仅生成示例 skill,完整 Git Registry 功能待开发\n');
|
|
159
|
+
|
|
149
160
|
// Create sample SKILL.md content
|
|
150
161
|
const skillMdContent = `---
|
|
151
162
|
name: ${skillName}
|
package/src/commands/sync.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
+
import * as YAML from 'yaml';
|
|
5
6
|
import { fileURLToPath } from 'url';
|
|
6
7
|
|
|
7
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -122,20 +123,15 @@ function parseSkillMetadata(content) {
|
|
|
122
123
|
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
123
124
|
if (!match) return {};
|
|
124
125
|
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const value = valueParts.join(':').trim().replace(/^["']|["']$/g, '');
|
|
135
|
-
metadata[key.trim()] = value;
|
|
126
|
+
const yamlContent = match[1];
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
// 使用 yaml 包解析(支持完整 YAML 语法)
|
|
130
|
+
return YAML.parse(yamlContent) || {};
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.warn(`⚠️ YAML 解析失败: ${error.message}`);
|
|
133
|
+
return {};
|
|
136
134
|
}
|
|
137
|
-
|
|
138
|
-
return metadata;
|
|
139
135
|
}
|
|
140
136
|
|
|
141
137
|
/**
|