()
| 37 | |
| 38 | /** Resolve the GitCode PAT from env, then ~/.netrc. Returns null when absent. */ |
| 39 | export function getGitCodeToken(): string | null { |
| 40 | for (const raw of [process.env.GITCODE_TOKEN, process.env.GC_TOKEN]) { |
| 41 | const token = raw?.trim(); |
| 42 | if (token) return token; |
| 43 | } |
| 44 | return readNetrcToken(); |
| 45 | } |
| 46 | |
| 47 | function requireToken(): string { |
| 48 | const token = getGitCodeToken(); |
no test coverage detected