MCPcopy
hub / github.com/EveryInc/compound-engineering-plugin / resolveTargetOutputRoot

Function resolveTargetOutputRoot

src/utils/resolve-output.ts:5–33  ·  view source on GitHub ↗
(options: {
  targetName: string
  outputRoot: string
  codexHome: string
  piHome: string
  pluginName?: string
  hasExplicitOutput: boolean
  scope?: TargetScope
})

Source from the content-addressed store, hash-verified

3import { resolveOpenCodeGlobalRoot } from "./opencode-config"
4
5export 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

Callers 3

runFunction · 0.90
runFunction · 0.90

Calls 1

Tested by

no test coverage detected