({
value,
configDir,
}: {
value: string;
configDir: string;
})
| 82 | * @see https://opencode.ai/docs/agents/ |
| 83 | */ |
| 84 | export async function resolveOpencodeFileTemplate({ |
| 85 | value, |
| 86 | configDir, |
| 87 | }: { |
| 88 | value: string; |
| 89 | configDir: string; |
| 90 | }): Promise<string> { |
| 91 | const match = OPENCODE_FILE_TEMPLATE_PATTERN.exec(value); |
| 92 | if (!match) { |
| 93 | return value; |
| 94 | } |
| 95 | |
| 96 | const referencedPath = match[1]?.trim().replace(/^\.\//, ""); |
| 97 | if (!referencedPath) { |
| 98 | return value; |
| 99 | } |
| 100 | |
| 101 | return (await readFileContentOrNull(join(configDir, referencedPath))) ?? value; |
| 102 | } |
no test coverage detected
searching dependent graphs…