Skip to content

The design language that makes your AI harness better at design.

JavaScript

Fix Codex pinned skill frontmatter (#519)

Paul Bakaus6886ab8c0eb9
diff --git a/skill/scripts/pin.mjs b/skill/scripts/pin.mjs
index 23466273f..27eb8be35 100644
--- a/skill/scripts/pin.mjs
+++ b/skill/scripts/pin.mjs
@@ -93,15 +93,17 @@ function commandPrefixForSkillsDir(skillsDir) {
return CODEX_HARNESSES.has(basename(dirname(skillsDir))) ? '$' : '/';
}
-function generatePinnedSkill(command, metadata, commandPrefix) {
+function generatePinnedSkill(command, metadata, commandPrefix, isCodex) {
const desc = metadata[command]?.description || `Shortcut for ${commandPrefix}impeccable ${command}.`;
const hint = metadata[command]?.argumentHint || '[target]';
+ const providerFrontmatter = isCodex
+ ? `metadata:\n argument-hint: "${hint}"`
+ : `argument-hint: "${hint}"\nuser-invocable: true`;
return `---
name: ${command}
description: "${desc}"
-argument-hint: "${hint}"
-user-invocable: true
+${providerFrontmatter}
---
${PIN_MARKER}
@@ -128,7 +130,7 @@ function pin(command, projectRoot) {
for (const skillsDir of harnessDirs) {
const commandPrefix = commandPrefixForSkillsDir(skillsDir);
- const content = generatePinnedSkill(command, metadata, commandPrefix);
+ const content = generatePinnedSkill(command, metadata, commandPrefix, commandPrefix === '$');
// Check if skill already exists (and isn't a pin)
const skillDir = join(skillsDir, command);
if (existsSync(skillDir)) {
diff --git a/tests/pin.test.mjs b/tests/pin.test.mjs
index ae58a8dec..8c6012458 100644
--- a/tests/pin.test.mjs
+++ b/tests/pin.test.mjs
@@ -35,12 +35,17 @@ describe('pin command provider syntax', () => {
const skill = fs.readFileSync(path.join(project, harness, 'skills', 'audit', 'SKILL.md'), 'utf8');
assert.match(skill, /\/impeccable audit/);
assert.doesNotMatch(skill, /\$impeccable audit/);
+ assert.match(skill, /^argument-hint:/m);
+ assert.match(skill, /^user-invocable: true$/m);
}
for (const harness of ['.agents', '.codex']) {
const skill = fs.readFileSync(path.join(project, harness, 'skills', 'audit', 'SKILL.md'), 'utf8');
assert.match(skill, /\$impeccable audit/);
assert.doesNotMatch(skill, /\/impeccable audit/);
+ assert.doesNotMatch(skill, /^argument-hint:/m);
+ assert.doesNotMatch(skill, /^user-invocable:/m);
+ assert.match(skill, /^metadata:\n argument-hint:/m);
}
});
});