(name: string)
| 14 | const EXPECTED_KEYWORD = 'useActionState' |
| 15 | |
| 16 | function loadEnvValue(name: string): string | undefined { |
| 17 | if (process.env[name] && process.env[name] !== 'test') { |
| 18 | return process.env[name] |
| 19 | } |
| 20 | |
| 21 | for (const envPath of [ |
| 22 | path.join(homedir(), 'codebuff', '.env.local'), |
| 23 | path.join(process.cwd(), '.env.local'), |
| 24 | ]) { |
| 25 | if (!existsSync(envPath)) continue |
| 26 | |
| 27 | const contents = readFileSync(envPath, 'utf8') |
| 28 | const match = contents.match(new RegExp(`^${name}=(.*)$`, 'm')) |
| 29 | const value = match?.[1]?.trim().replace(/^['"]|['"]$/g, '') |
| 30 | if (value && value !== 'test') return value |
| 31 | } |
| 32 | |
| 33 | return undefined |
| 34 | } |
| 35 | |
| 36 | function extractOutputText(output: AgentOutput): string { |
| 37 | if (output.type === 'error') return output.message |
no outgoing calls
no test coverage detected