fix(3562): generate Codex skill surface; $gsd-* commands discoverable after install
Closes #3562 Codex CLI 0.130.0 only registers commands from skills/<name>/SKILL.md; it does NOT auto-discover from get-shit-done/workflows/*.md or agents/*.md. Prior installer logic (#3427/#3433) removed the gsd-* skill copies under the assumption that Codex would discover the official skills directly. That assumption does not hold — users ended up with workflows on disk and zero $gsd-* entrypoints after restart. Fix: re-wire copyCommandsAsCodexSkills() (line 5519, already present) into the Codex install dispatch path (line 8090). Generates one ~/.codex/skills/gsd-<name>/SKILL.md per commands/gsd/*.md — same shape the Copilot/Antigravity/Cursor/Windsurf/Augment/Trae installs use. Behaviour change: the pre-existing test in bug-3427-3433-codex-install-shape asserted "does not regenerate gsd-* skill copies". Updated it to assert the new behaviour (regenerate gsd-* with refreshed body, preserve non-gsd user skills). Tests: - New tests/bug-3562-codex-install-skill-surface.test.cjs (4 cases): - skills/gsd-help/SKILL.md exists - SKILL.md has YAML frontmatter with name: gsd-help - >= 10 gsd-* skill directories produced (lower-bound, currently 67) - Pre-existing custom-user-skill directory preserved - tests/bug-3427-3433-codex-install-shape.test.cjs: updated to assert regeneration + body refresh + unrelated-skill preservation. Verified by re-running the issue's repro: `node bin/install.js --codex --global --config-dir <tmp>` now produces 67 gsd-* skills and the target ~/.codex/skills/gsd-help/SKILL.md exists with valid frontmatter. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -55,7 +55,9 @@ describe('#3427 + #3433 — Codex installer avoids duplicate skills and mixed ho
|
||||
cleanup(tmpRoot);
|
||||
});
|
||||
|
||||
test('removes legacy gsd-* copies from ~/.codex/skills and does not regenerate them', () => {
|
||||
test('regenerates managed gsd-* skill copies and preserves unrelated user skills (#3562 reverses prior #3427/#3433 behaviour)', () => {
|
||||
// Stale legacy body — fresh install must overwrite this so Codex sees the
|
||||
// current SKILL.md, not whatever was last on disk.
|
||||
const legacySkillBody = '# old managed\n';
|
||||
fs.mkdirSync(path.join(codexHome, 'skills', 'gsd-help'), { recursive: true });
|
||||
fs.writeFileSync(path.join(codexHome, 'skills', 'gsd-help', 'SKILL.md'), legacySkillBody);
|
||||
@@ -77,7 +79,15 @@ describe('#3427 + #3433 — Codex installer avoids duplicate skills and mixed ho
|
||||
? fs.readdirSync(skillsDir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name)
|
||||
: [];
|
||||
|
||||
assert.equal(entries.some((name) => name.startsWith('gsd-')), false);
|
||||
// #3562: $gsd-* commands are discoverable only when skills/gsd-*/SKILL.md
|
||||
// exists. The installer must regenerate (not remove) the managed gsd-*
|
||||
// directories.
|
||||
assert.equal(entries.includes('gsd-help'), true);
|
||||
const refreshedBody = fs.readFileSync(path.join(skillsDir, 'gsd-help', 'SKILL.md'), 'utf8');
|
||||
assert.notEqual(refreshedBody, legacySkillBody, 'stale legacy body must be overwritten');
|
||||
assert.ok(refreshedBody.startsWith('---'), 'refreshed SKILL.md must be valid frontmatter shape');
|
||||
|
||||
// Unrelated user skills are preserved — the regen scope is `gsd-*` only.
|
||||
assert.equal(entries.includes('custom-user-skill'), true);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user