-
Notifications
You must be signed in to change notification settings - Fork 0
Add commands to manage Teams and Members #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add commands to manage Teams and Members #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive team and member management capabilities to the CLI tool, allowing users to create/delete teams and add/remove team members programmatically.
Key changes:
- Added team commands for creating and deleting teams with validation
- Added member subcommands for adding and removing team members with role assignment
- Extended the client interface with new API methods for team and member operations
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/rootcommand/rootcommand.go |
Wires up new team create/delete commands and member subcommand group |
pkg/commands/teams/create.go |
Implements team creation with name/description validation |
pkg/commands/teams/delete.go |
Implements team deletion by name lookup |
pkg/commands/teams/member/add.go |
Implements adding members to teams with role assignment and helper functions for ID lookups |
pkg/commands/teams/member/remove.go |
Implements removing members from teams using helper functions |
pkg/client/teams.go |
Adds REST client methods for team CRUD operations and member management |
pkg/client/client.go |
Extends client interfaces with TeamsClient and new MemberClient interface |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if teamName == "" { | ||
| return errEmptyName | ||
| } | ||
|
|
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function retrieves all teams from the API to find one by name. This could be inefficient if there are many teams. Consider adding a query parameter to the API or implement pagination if the API supports it. At minimum, document this potential performance limitation.
| // NOTE: This retrieves all teams to find one by name, which may be inefficient if there are many teams. | |
| // Consider updating the API to support querying by name or pagination to improve performance. |
| type MemberClient interface { | ||
| AddTeamMember(ctx context.Context, teamId string, request []AddTeamMemberRequest) error | ||
| RemoveTeamMember(ctx context.Context, teamId string, memberId string) error | ||
| } |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The member management methods (AddTeamMember and RemoveTeamMember) are defined in a separate MemberClient interface, but these are logically part of team management. Consider consolidating these methods into the TeamsClient interface for better cohesion, as members are a sub-resource of teams. This would align with the pattern used for GetTeamMembers which is already in TeamsClient.
pkg/commands/teams/member/add.go
Outdated
| teams, err := set.PlatformClient.ListTeams(ctx) | ||
| if err != nil { | ||
| return "", redact.Errorf("could not list teams: %w", redact.Safe(err)) | ||
| } |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function retrieves all teams from the API to find one by name. This could be inefficient if there are many teams. Consider adding a query parameter to the API or implement pagination if the API supports it. At minimum, document this potential performance limitation.
pkg/commands/teams/member/add.go
Outdated
| users, err := set.PlatformClient.ListUsers(ctx) | ||
| if err != nil { | ||
| return "", redact.Errorf("could not list users: %w", redact.Safe(err)) |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function retrieves all users from the API to find one by UPN. This could be inefficient with a large user base. Consider adding a query parameter to the API or implement pagination if the API supports it. At minimum, document this potential performance limitation.
No description provided.