( teamName: string, )
| 145 | * Reads a team file by name (async — for tool handlers and other async contexts) |
| 146 | */ |
| 147 | export async function readTeamFileAsync( |
| 148 | teamName: string, |
| 149 | ): Promise<TeamFile | null> { |
| 150 | try { |
| 151 | const content = await readFile(getTeamFilePath(teamName), 'utf-8') |
| 152 | return jsonParse(content) as TeamFile |
| 153 | } catch (e) { |
| 154 | if (getErrnoCode(e) === 'ENOENT') return null |
| 155 | logForDebugging( |
| 156 | `[TeammateTool] Failed to read team file for ${teamName}: ${errorMessage(e)}`, |
| 157 | ) |
| 158 | return null |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Writes a team file (sync — for sync contexts) |
no test coverage detected