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);
}
}
// Sync skills into Codex session dir (same sources as Claude Code)
const codexSkillsDst = path.join(sessionCodexDir, 'skills');
const codexSkillSources = [
path.join(hostCodexDir, 'skills'),
path.join(projectRoot, 'container', 'skills'),
// Sync skills and commands into Codex session dir
// Sources: ~/.codex/, ~/.claude/ (shared), container/skills/
const codexSyncDirs = [
{
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) {
if (!fs.existsSync(src)) continue;
for (const entry of fs.readdirSync(src)) {
const srcPath = path.join(src, entry);
const dstPath = path.join(codexSkillsDst, entry);
if (fs.statSync(srcPath).isDirectory()) {
fs.cpSync(srcPath, dstPath, { recursive: true });
} else {
fs.mkdirSync(codexSkillsDst, { recursive: true });
fs.copyFileSync(srcPath, dstPath);
for (const { dst, sources } of codexSyncDirs) {
for (const src of sources) {
if (!fs.existsSync(src)) continue;
for (const entry of fs.readdirSync(src)) {
const srcPath = path.join(src, entry);
const dstPath = path.join(dst, entry);
if (fs.statSync(srcPath).isDirectory()) {
fs.cpSync(srcPath, dstPath, { recursive: true });
} else {
fs.mkdirSync(dst, { recursive: true });
fs.copyFileSync(srcPath, dstPath);
}
}
}
}