()
| 137 | } |
| 138 | |
| 139 | function getEmail(): string | undefined { |
| 140 | // Return cached email if available (from async initialization) |
| 141 | if (cachedEmail !== null) { |
| 142 | return cachedEmail |
| 143 | } |
| 144 | |
| 145 | // Only include OAuth email when actively using OAuth authentication |
| 146 | const oauthAccount = getOauthAccountInfo() |
| 147 | if (oauthAccount?.emailAddress) { |
| 148 | return oauthAccount.emailAddress |
| 149 | } |
| 150 | |
| 151 | // Ant-only fallbacks below (no execSync) |
| 152 | if (process.env.USER_TYPE !== 'ant') { |
| 153 | return undefined |
| 154 | } |
| 155 | |
| 156 | if (process.env.COO_CREATOR) { |
| 157 | return `${process.env.COO_CREATOR}@anthropic.com` |
| 158 | } |
| 159 | |
| 160 | // If initUser() wasn't called, we return undefined instead of blocking |
| 161 | return undefined |
| 162 | } |
| 163 | |
| 164 | async function getEmailAsync(): Promise<string | undefined> { |
| 165 | // Only include OAuth email when actively using OAuth authentication |
no test coverage detected