( teamName: string, memberName: string, isActive: boolean, )
| 452 | * @param isActive - Whether the member is active (true) or idle (false) |
| 453 | */ |
| 454 | export async function setMemberActive( |
| 455 | teamName: string, |
| 456 | memberName: string, |
| 457 | isActive: boolean, |
| 458 | ): Promise<void> { |
| 459 | const teamFile = await readTeamFileAsync(teamName) |
| 460 | if (!teamFile) { |
| 461 | logForDebugging( |
| 462 | `[TeammateTool] Cannot set member active: team ${teamName} not found`, |
| 463 | ) |
| 464 | return |
| 465 | } |
| 466 | |
| 467 | const member = teamFile.members.find(m => m.name === memberName) |
| 468 | if (!member) { |
| 469 | logForDebugging( |
| 470 | `[TeammateTool] Cannot set member active: member ${memberName} not found in team ${teamName}`, |
| 471 | ) |
| 472 | return |
| 473 | } |
| 474 | |
| 475 | // Only write if the value is actually changing |
| 476 | if (member.isActive === isActive) { |
| 477 | return |
| 478 | } |
| 479 | |
| 480 | member.isActive = isActive |
| 481 | await writeTeamFileAsync(teamName, teamFile) |
| 482 | logForDebugging( |
| 483 | `[TeammateTool] Set member ${memberName} in team ${teamName} to ${isActive ? 'active' : 'idle'}`, |
| 484 | ) |
| 485 | } |
| 486 | |
| 487 | /** |
| 488 | * Destroys a git worktree at the given path. |
no test coverage detected