diff --git a/src/targets/droid.ts b/src/targets/droid.ts index 85600766..bdf72f43 100644 --- a/src/targets/droid.ts +++ b/src/targets/droid.ts @@ -9,7 +9,16 @@ export async function writeDroidBundle(outputRoot: string, bundle: DroidBundle): if (bundle.commands.length > 0) { await ensureDir(paths.commandsDir) for (const command of bundle.commands) { - await writeText(path.join(paths.commandsDir, `${command.name}.md`), command.content + "\n") + // Split colon-separated names into nested directories (e.g. "ce:plan" -> "ce/plan.md") + // to avoid colons in filenames which are invalid on Windows/NTFS + const parts = command.name.split(":") + if (parts.length > 1) { + const nestedDir = path.join(paths.commandsDir, ...parts.slice(0, -1)) + await ensureDir(nestedDir) + await writeText(path.join(nestedDir, `${parts[parts.length - 1]}.md`), command.content + "\n") + } else { + await writeText(path.join(paths.commandsDir, `${command.name}.md`), command.content + "\n") + } } } diff --git a/src/targets/gemini.ts b/src/targets/gemini.ts index 0bc8c666..e818d1e9 100644 --- a/src/targets/gemini.ts +++ b/src/targets/gemini.ts @@ -20,7 +20,16 @@ export async function writeGeminiBundle(outputRoot: string, bundle: GeminiBundle if (bundle.commands.length > 0) { for (const command of bundle.commands) { - await writeText(path.join(paths.commandsDir, `${command.name}.toml`), command.content + "\n") + // Split colon-separated names into nested directories (e.g. "ce:plan" -> "ce/plan.toml") + // to avoid colons in filenames which are invalid on Windows/NTFS + const parts = command.name.split(":") + if (parts.length > 1) { + const nestedDir = path.join(paths.commandsDir, ...parts.slice(0, -1)) + await ensureDir(nestedDir) + await writeText(path.join(nestedDir, `${parts[parts.length - 1]}.toml`), command.content + "\n") + } else { + await writeText(path.join(paths.commandsDir, `${command.name}.toml`), command.content + "\n") + } } } diff --git a/src/targets/opencode.ts b/src/targets/opencode.ts index b4bf53e7..894cf2ce 100644 --- a/src/targets/opencode.ts +++ b/src/targets/opencode.ts @@ -75,7 +75,17 @@ export async function writeOpenCodeBundle(outputRoot: string, bundle: OpenCodeBu } for (const commandFile of bundle.commandFiles) { - const dest = path.join(openCodePaths.commandDir, `${commandFile.name}.md`) + // Split colon-separated names into nested directories (e.g. "ce:plan" -> "ce/plan.md") + // to avoid colons in filenames which are invalid on Windows/NTFS + const parts = commandFile.name.split(":") + let dest: string + if (parts.length > 1) { + const nestedDir = path.join(openCodePaths.commandDir, ...parts.slice(0, -1)) + await ensureDir(nestedDir) + dest = path.join(nestedDir, `${parts[parts.length - 1]}.md`) + } else { + dest = path.join(openCodePaths.commandDir, `${commandFile.name}.md`) + } const cmdBackupPath = await backupFile(dest) if (cmdBackupPath) { console.log(`Backed up existing command file to ${cmdBackupPath}`)