skiller 0.7.4 → 0.7.6
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.
|
@@ -61,6 +61,7 @@ function parseFrontmatter(content) {
|
|
|
61
61
|
// No frontmatter found
|
|
62
62
|
return {
|
|
63
63
|
frontmatter: null,
|
|
64
|
+
rawFrontmatter: null,
|
|
64
65
|
body: content,
|
|
65
66
|
};
|
|
66
67
|
}
|
|
@@ -106,6 +107,7 @@ function parseFrontmatter(content) {
|
|
|
106
107
|
// YAML parsing failed - treat as no frontmatter
|
|
107
108
|
return {
|
|
108
109
|
frontmatter: null,
|
|
110
|
+
rawFrontmatter: null,
|
|
109
111
|
body: content,
|
|
110
112
|
};
|
|
111
113
|
}
|
|
@@ -120,6 +122,7 @@ function extractFrontmatter(parsed, body) {
|
|
|
120
122
|
if (!parsed) {
|
|
121
123
|
return {
|
|
122
124
|
frontmatter: {},
|
|
125
|
+
rawFrontmatter: null,
|
|
123
126
|
body: body.trim(),
|
|
124
127
|
};
|
|
125
128
|
}
|
|
@@ -146,6 +149,7 @@ function extractFrontmatter(parsed, body) {
|
|
|
146
149
|
}
|
|
147
150
|
return {
|
|
148
151
|
frontmatter,
|
|
152
|
+
rawFrontmatter: parsed,
|
|
149
153
|
body: body.trim(),
|
|
150
154
|
};
|
|
151
155
|
}
|
|
@@ -152,10 +152,15 @@ async function syncMdcToSkillMd(skillsDir, verbose, dryRun) {
|
|
|
152
152
|
continue;
|
|
153
153
|
}
|
|
154
154
|
// Generate SKILL.md with @reference (absolute path)
|
|
155
|
+
// Keep all frontmatter from .mdc except globs and alwaysApply
|
|
155
156
|
const skillFrontmatter = {
|
|
156
157
|
name: skillName,
|
|
157
|
-
|
|
158
|
+
...Object.fromEntries(Object.entries(mdcFrontmatter || {}).filter(([key]) => key !== 'globs' && key !== 'alwaysApply')),
|
|
158
159
|
};
|
|
160
|
+
// Ensure description has a default
|
|
161
|
+
if (!skillFrontmatter.description) {
|
|
162
|
+
skillFrontmatter.description = `Skill: ${skillName}`;
|
|
163
|
+
}
|
|
159
164
|
const newSkillMd = `---
|
|
160
165
|
${yaml.dump(skillFrontmatter, { lineWidth: -1, noRefs: true }).trim()}
|
|
161
166
|
---
|
|
@@ -189,7 +194,7 @@ ${yaml.dump(skillFrontmatter, { lineWidth: -1, noRefs: true }).trim()}
|
|
|
189
194
|
}
|
|
190
195
|
}
|
|
191
196
|
// SKILL.md exists - check if it's a reference
|
|
192
|
-
const { frontmatter: skillFrontmatter, body: skillBody } = (0, FrontmatterParser_1.parseFrontmatter)(skillMdContent);
|
|
197
|
+
const { frontmatter: skillFrontmatter, rawFrontmatter: skillRawFrontmatter, body: skillBody, } = (0, FrontmatterParser_1.parseFrontmatter)(skillMdContent);
|
|
193
198
|
const refCheck = isReferenceBody(skillBody);
|
|
194
199
|
if (refCheck.isReference) {
|
|
195
200
|
// Case 2: SKILL.md is @reference → source file is truth
|
|
@@ -198,38 +203,25 @@ ${yaml.dump(skillFrontmatter, { lineWidth: -1, noRefs: true }).trim()}
|
|
|
198
203
|
const isAbsoluteSiblingRef = refCheck.referencePath ===
|
|
199
204
|
`.claude/skills/${skillName}/${skillName}.mdc`;
|
|
200
205
|
if (isRelativeSiblingRef || isAbsoluteSiblingRef) {
|
|
201
|
-
// Sibling reference pattern -
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const needsUpdate = (mdcFrontmatter?.description &&
|
|
207
|
-
mdcFrontmatter.description !==
|
|
208
|
-
skillFrontmatter?.description) ||
|
|
209
|
-
isRelativeSiblingRef; // Migrate old relative refs to absolute
|
|
210
|
-
if (needsUpdate) {
|
|
211
|
-
const newFrontmatter = {
|
|
212
|
-
name: skillFrontmatter?.name || skillName,
|
|
213
|
-
description: mdcFrontmatter?.description ||
|
|
214
|
-
skillFrontmatter?.description ||
|
|
215
|
-
`Skill: ${skillName}`,
|
|
216
|
-
};
|
|
217
|
-
const newSkillMd = `---
|
|
218
|
-
${yaml.dump(newFrontmatter, { lineWidth: -1, noRefs: true }).trim()}
|
|
206
|
+
// Sibling reference pattern - only migrate path if needed (don't touch frontmatter)
|
|
207
|
+
if (isRelativeSiblingRef) {
|
|
208
|
+
// Migrate old relative refs to absolute path, preserving existing frontmatter
|
|
209
|
+
const newSkillMd = `---
|
|
210
|
+
${yaml.dump(skillFrontmatter || { name: skillName }, { lineWidth: -1, noRefs: true }).trim()}
|
|
219
211
|
---
|
|
220
212
|
|
|
221
213
|
@.claude/skills/${skillName}/${skillName}.mdc
|
|
222
214
|
`;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
await fs.writeFile(skillMdPath, newSkillMd, 'utf8');
|
|
228
|
-
(0, constants_1.logVerboseInfo)(`Updated ${skillName}/SKILL.md frontmatter from .mdc`, verbose, dryRun);
|
|
229
|
-
}
|
|
230
|
-
synced.push(skillName);
|
|
215
|
+
if (dryRun) {
|
|
216
|
+
(0, constants_1.logVerboseInfo)(`DRY RUN: Would migrate ${skillName}/SKILL.md to absolute path`, verbose, dryRun);
|
|
231
217
|
}
|
|
218
|
+
else {
|
|
219
|
+
await fs.writeFile(skillMdPath, newSkillMd, 'utf8');
|
|
220
|
+
(0, constants_1.logVerboseInfo)(`Migrated ${skillName}/SKILL.md to absolute path`, verbose, dryRun);
|
|
221
|
+
}
|
|
222
|
+
synced.push(skillName);
|
|
232
223
|
}
|
|
224
|
+
// If already absolute path, nothing to do - SKILL.md is source of truth for frontmatter
|
|
233
225
|
}
|
|
234
226
|
else if (refCheck.referencePath) {
|
|
235
227
|
// Pre-0.7 pattern or other external reference - migrate to sibling pattern
|
|
@@ -304,10 +296,15 @@ ${yaml.dump(newFrontmatter, { lineWidth: -1, noRefs: true }).trim()}
|
|
|
304
296
|
// Generate .mdc from SKILL.md body (no frontmatter needed - description is in SKILL.md)
|
|
305
297
|
const mdcContent = skillBody;
|
|
306
298
|
// Update SKILL.md to @reference (absolute path)
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
299
|
+
// Preserve ALL existing frontmatter (use rawFrontmatter to keep custom fields like user-invocable)
|
|
300
|
+
// Only add defaults for missing name/description
|
|
301
|
+
const newSkillFrontmatter = skillRawFrontmatter ? { ...skillRawFrontmatter } : {};
|
|
302
|
+
if (!newSkillFrontmatter.name) {
|
|
303
|
+
newSkillFrontmatter.name = skillName;
|
|
304
|
+
}
|
|
305
|
+
if (!newSkillFrontmatter.description) {
|
|
306
|
+
newSkillFrontmatter.description = `Skill: ${skillName}`;
|
|
307
|
+
}
|
|
311
308
|
const newSkillMd = `---
|
|
312
309
|
${yaml.dump(newSkillFrontmatter, { lineWidth: -1, noRefs: true }).trim()}
|
|
313
310
|
---
|