(options: {
targetName: string
outputRoot: string
codexHome: string
piHome: string
pluginName?: string
hasExplicitOutput: boolean
scope?: TargetScope
})
| 3 | import { resolveOpenCodeGlobalRoot } from "./opencode-config" |
| 4 | |
| 5 | export function resolveTargetOutputRoot(options: { |
| 6 | targetName: string |
| 7 | outputRoot: string |
| 8 | codexHome: string |
| 9 | piHome: string |
| 10 | pluginName?: string |
| 11 | hasExplicitOutput: boolean |
| 12 | scope?: TargetScope |
| 13 | }): string { |
| 14 | const { targetName, outputRoot, codexHome, piHome, hasExplicitOutput } = options |
| 15 | if (targetName === "codex") return codexHome |
| 16 | if (targetName === "pi") return piHome |
| 17 | if (targetName === "antigravity") { |
| 18 | const base = hasExplicitOutput ? outputRoot : process.cwd() |
| 19 | return path.join(base, ".agy") |
| 20 | } |
| 21 | if (targetName === "kiro") { |
| 22 | const base = hasExplicitOutput ? outputRoot : process.cwd() |
| 23 | return path.join(base, ".kiro") |
| 24 | } |
| 25 | if (targetName === "opencode") { |
| 26 | // Without an explicit --output, default to the OpenCode global-config root |
| 27 | // (OPENCODE_CONFIG_DIR or ~/.config/opencode). With an explicit --output, |
| 28 | // honor it as a workspace root and let the writer nest under .opencode/. |
| 29 | if (!hasExplicitOutput) return resolveOpenCodeGlobalRoot() |
| 30 | return outputRoot |
| 31 | } |
| 32 | return outputRoot |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Returns "global" when the OpenCode writer should use the flat global-config |
no test coverage detected