(workingDirectory: string)
| 173 | } |
| 174 | |
| 175 | function resolvePromptPaths(workingDirectory: string): PromptPaths { |
| 176 | const configHome = process.env.XDG_CONFIG_HOME || join(homedir(), ".config") |
| 177 | const globalRoot = join(configHome, "opencode", "dcp-prompts") |
| 178 | const defaultsDir = join(globalRoot, "defaults") |
| 179 | const globalOverridesDir = join(globalRoot, "overrides") |
| 180 | |
| 181 | const configDirOverridesDir = process.env.OPENCODE_CONFIG_DIR |
| 182 | ? join(process.env.OPENCODE_CONFIG_DIR, "dcp-prompts", "overrides") |
| 183 | : null |
| 184 | |
| 185 | const opencodeDir = findOpencodeDir(workingDirectory) |
| 186 | const projectOverridesDir = opencodeDir ? join(opencodeDir, "dcp-prompts", "overrides") : null |
| 187 | |
| 188 | return { |
| 189 | defaultsDir, |
| 190 | globalOverridesDir, |
| 191 | configDirOverridesDir, |
| 192 | projectOverridesDir, |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | function stripConditionalTag(content: string, tagName: string): string { |
| 197 | const regex = new RegExp(`<${tagName}>[\\s\\S]*?<\/${tagName}>`, "gi") |
no test coverage detected