fix: sync Claude Code skills/commands to Codex sessions

Codex sessions now also receive skills and commands from ~/.claude/
in addition to ~/.codex/, so both agents share the same tool set
(patch, linear, sentry, coolify, exa, playwright, sprite, etc.)
This commit is contained in:
Eyejoker
2026-03-13 16:45:36 +09:00
parent bd7f4408ae
commit 922ec60517

View File

@@ -241,22 +241,37 @@ function prepareGroupEnvironment(
fs.copyFileSync(src, dst); fs.copyFileSync(src, dst);
} }
} }
// Sync skills into Codex session dir (same sources as Claude Code) // Sync skills and commands into Codex session dir
const codexSkillsDst = path.join(sessionCodexDir, 'skills'); // Sources: ~/.codex/, ~/.claude/ (shared), container/skills/
const codexSkillSources = [ const codexSyncDirs = [
path.join(hostCodexDir, 'skills'), {
path.join(projectRoot, 'container', 'skills'), dst: path.join(sessionCodexDir, 'skills'),
sources: [
path.join(hostCodexDir, 'skills'),
path.join(os.homedir(), '.claude', 'skills'),
path.join(projectRoot, 'container', 'skills'),
],
},
{
dst: path.join(sessionCodexDir, 'commands'),
sources: [
path.join(hostCodexDir, 'commands'),
path.join(os.homedir(), '.claude', 'commands'),
],
},
]; ];
for (const src of codexSkillSources) { for (const { dst, sources } of codexSyncDirs) {
if (!fs.existsSync(src)) continue; for (const src of sources) {
for (const entry of fs.readdirSync(src)) { if (!fs.existsSync(src)) continue;
const srcPath = path.join(src, entry); for (const entry of fs.readdirSync(src)) {
const dstPath = path.join(codexSkillsDst, entry); const srcPath = path.join(src, entry);
if (fs.statSync(srcPath).isDirectory()) { const dstPath = path.join(dst, entry);
fs.cpSync(srcPath, dstPath, { recursive: true }); if (fs.statSync(srcPath).isDirectory()) {
} else { fs.cpSync(srcPath, dstPath, { recursive: true });
fs.mkdirSync(codexSkillsDst, { recursive: true }); } else {
fs.copyFileSync(srcPath, dstPath); fs.mkdirSync(dst, { recursive: true });
fs.copyFileSync(srcPath, dstPath);
}
} }
} }
} }