feat(3663): implement stageSkillsForRuntimeAsSkills iteration+write loop

RED-2/GREEN-2: wildcard skills='*' stages all *.md as <prefix><stem>/SKILL.md
with converter applied. Includes existence guard and error cleanup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-05-17 00:13:00 -04:00
parent 11e74f9a25
commit 235f527635
2 changed files with 45 additions and 1 deletions

View File

@@ -42,6 +42,27 @@ describe('stageSkillsForRuntimeAsSkills', () => {
test('is exported as a function', () => {
assert.strictEqual(typeof stageSkillsForRuntimeAsSkills, 'function');
});
test('skills === "*" stages all md files as <prefix><stem>/SKILL.md', () => {
const src = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-rta-src-'));
let stagedDir;
try {
for (const name of ['alpha', 'beta', 'gamma']) {
fs.writeFileSync(path.join(src, `${name}.md`), `# ${name}\n`);
}
const converter = (content, _skillName) => content;
stagedDir = stageSkillsForRuntimeAsSkills(src, { skills: '*' }, converter, 'gsd-');
const entries = fs.readdirSync(stagedDir).sort();
assert.deepStrictEqual(entries, ['gsd-alpha', 'gsd-beta', 'gsd-gamma']);
for (const name of ['alpha', 'beta', 'gamma']) {
const content = fs.readFileSync(path.join(stagedDir, `gsd-${name}`, 'SKILL.md'), 'utf8');
assert.strictEqual(content, `# ${name}\n`);
}
} finally {
fs.rmSync(src, { recursive: true, force: true });
if (stagedDir) cleanupStagedSkills();
}
});
});
describe('stageSkillsForProfile', () => {