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