Merge pull request #3568 from gsd-build/fix/3562-codex-0-130-0-gsd-1-42-2-installs-workfl

fix(3562): generate Codex skill surface so $gsd-* commands resolve on Codex CLI 0.130.0+
This commit is contained in:
Tom Boucher
2026-05-15 15:03:04 -04:00
committed by GitHub
9 changed files with 180 additions and 23 deletions

View File

@@ -8114,23 +8114,27 @@ function install(isGlobal, runtime = 'claude', options = {}) {
failures.push('command/gsd-*');
}
} else if (isCodex) {
// Codex CLI (0.130.0 at time of #3562) does NOT auto-discover commands
// from get-shit-done/workflows/*.md or agents/*.md. It only registers
// commands from skills/<name>/SKILL.md. The earlier "Codex discovers
// official skills directly" branch left users with workflows on disk and
// no $gsd-* entrypoints. Regenerate the skill surface the same way the
// other runtimes do — copyCommandsAsCodexSkills() rewrites each
// commands/gsd/*.md as ~/.codex/skills/gsd-<name>/SKILL.md and converts
// Claude-flavored command frontmatter into Codex skill frontmatter.
const skillsDir = path.join(targetDir, 'skills');
// Codex now discovers repo/user/admin/system skills from .agents/skills and
// warns if a layer mixes redundant hook/skill representations. Legacy
// gsd-* copies under ~/.codex/skills are therefore removed and no longer
// regenerated.
let removedLegacyCodexSkills = 0;
const gsdSrc = _stageSkills(_commandsDir);
copyCommandsAsCodexSkills(gsdSrc, skillsDir, 'gsd', pathPrefix, runtime);
if (fs.existsSync(skillsDir)) {
for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
if (!entry.isDirectory() || !entry.name.startsWith('gsd-')) continue;
fs.rmSync(path.join(skillsDir, entry.name), { recursive: true, force: true });
removedLegacyCodexSkills += 1;
const count = fs.readdirSync(skillsDir, { withFileTypes: true })
.filter(e => e.isDirectory() && e.name.startsWith('gsd-')).length;
if (count > 0) {
console.log(` ${green}✓${reset} Installed ${count} skills to skills/`);
} else {
failures.push('skills/gsd-*');
}
}
if (removedLegacyCodexSkills > 0) {
console.log(` ${green}✓${reset} Removed ${removedLegacyCodexSkills} legacy Codex gsd-* skill copies from skills/`);
} else {
console.log(` ${dim}↳${reset} Skipped Codex skill-copy generation (Codex discovers official skills directly)`);
failures.push('skills/gsd-*');
}
} else if (isCopilot) {
const skillsDir = path.join(targetDir, 'skills');