myskillshub 1.0.9 → 1.0.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myskillshub",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "CLI tool for SkillHub skill management",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -45,10 +45,8 @@ program
45
45
  spinner.text = 'Reading skill metadata...';
46
46
  const skillMdContent = fs.readFileSync(skillMdPath, 'utf8');
47
47
 
48
- // Parse skill.md content (basic parsing)
49
- const skillData = parseSkillMd(skillMdContent);
50
48
  const frontmatter = parseFrontmatter(skillMdContent);
51
- skillData.description = normalizeDescription(frontmatter.description || skillData.description, skillData.name);
49
+ const skillData = buildSkillDataFromFrontmatter(frontmatter);
52
50
  skillData.tags = normalizeTags(frontmatter.tags || []);
53
51
  spinner.succeed(chalk.green(`Found skill: ${skillData.name}`));
54
52
 
@@ -155,56 +153,27 @@ function stripQuotes(value) {
155
153
  return String(value || '').replace(/^['"]|['"]$/g, '');
156
154
  }
157
155
 
158
- function parseSkillMd(content) {
159
- const lines = content.split('\n');
160
- const skillData = {
161
- name: '',
162
- description: '',
163
- version: '1.0.0',
164
- author: '',
165
- keywords: [],
166
- installCommand: '',
167
- tags: []
168
- };
156
+ function buildSkillDataFromFrontmatter(frontmatter) {
157
+ const name = String(frontmatter.name || '').trim();
158
+ const description = String(frontmatter.description || '').trim();
169
159
 
170
- let inDescription = false;
171
-
172
- for (const line of lines) {
173
- const trimmed = line.trim();
174
- if (trimmed.startsWith('# ')) {
175
- skillData.name = trimmed.substring(2);
176
- } else if (trimmed.startsWith('## Description')) {
177
- inDescription = true;
178
- } else if (trimmed.startsWith('## ')) {
179
- inDescription = false;
180
- } else if (inDescription && trimmed) {
181
- if (!skillData.description) {
182
- skillData.description = trimmed;
183
- } else {
184
- skillData.description += ' ' + trimmed;
185
- }
186
- } else if (trimmed.startsWith('Version:')) {
187
- skillData.version = trimmed.split(':')[1].trim();
188
- } else if (trimmed.startsWith('Author:')) {
189
- skillData.author = trimmed.split(':')[1].trim();
190
- } else if (trimmed.startsWith('Keywords:')) {
191
- skillData.keywords = trimmed.split(':')[1].split(',').map(k => k.trim());
192
- } else if (trimmed.startsWith('Install:')) {
193
- skillData.installCommand = trimmed.split(':')[1].trim();
194
- }
160
+ if (!name) {
161
+ throw new Error('SKILL.md frontmatter "name" is required');
195
162
  }
196
163
 
197
- return skillData;
198
- }
164
+ if (!description) {
165
+ throw new Error('SKILL.md frontmatter "description" is required');
166
+ }
199
167
 
200
- function normalizeDescription(description, skillName) {
201
- const text = String(description || '').trim();
202
- if (text.length >= 10 && text.length <= 500) {
203
- return text;
168
+ if (description.length < 10 || description.length > 500) {
169
+ throw new Error('SKILL.md frontmatter "description" must be between 10 and 500 characters');
204
170
  }
205
171
 
206
- const fallback = `Skill "${skillName || 'unknown'}" published via myskillshub CLI.`;
207
- return fallback.slice(0, 500);
172
+ return {
173
+ name,
174
+ description,
175
+ tags: []
176
+ };
208
177
  }
209
178
 
210
179
  function normalizeTags(tags) {