Adds viva engage role member add command. Closes #6819#7219
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Viva Engage command to assign (add) a role member via Microsoft Graph, including tests and documentation, aligning the Viva Engage role management feature set.
Changes:
- Introduces
viva engage role member addGraph command supporting role/user resolution by name or id. - Adds Mocha test coverage for validation, successful POST behavior, and error handling.
- Adds Docusaurus documentation page and sidebar entry for the new command.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/m365/viva/commands/engage/engage-role-member-add.ts | Implements the new command and Graph POST to add a member to a role. |
| src/m365/viva/commands/engage/engage-role-member-add.spec.ts | Adds unit tests for validation, success paths, and error handling. |
| src/m365/viva/commands.ts | Registers the new command name constant. |
| docs/src/config/sidebars.ts | Adds the new command doc to the Viva Engage sidebar. |
| docs/docs/cmd/viva/engage/engage-role-member-add.mdx | Adds command reference docs, including preview warning and permissions. |
| roleId: z.uuid().optional(), | ||
| roleName: z.string().optional(), |
There was a problem hiding this comment.
Docs advertise short options -i/-n for --roleId/--roleName (consistent with engage-role-member-list), but the command schema doesn't define these aliases. Add .alias('i') and .alias('n') (or update docs to remove the short options) so the documented CLI usage works.
| roleId: z.uuid().optional(), | |
| roleName: z.string().optional(), | |
| roleId: z.uuid().alias('i').optional(), | |
| roleName: z.string().alias('n').optional(), |
|
|
||
| :::warning | ||
|
|
||
| This command is based on a Microsoft Graph API that is currently in preview and is subject to change once the API reached general availability. |
There was a problem hiding this comment.
The warning text has a grammatical error and is inconsistent with the existing engage role member docs. Consider changing "once the API reached general availability" to "once the API reaches general availability".
| This command is based on a Microsoft Graph API that is currently in preview and is subject to change once the API reached general availability. | |
| This command is based on a Microsoft Graph API that is currently in preview and is subject to change once the API reaches general availability. |
|
Thanks, we'll try to review it ASAP. |
MartinM85
left a comment
There was a problem hiding this comment.
Thank you for the contribution @nanddeepn 🚀
Just a few notes from my side. Please check also the comments from Copilot.
| ...globalOptionsZod.shape, | ||
| roleId: z.uuid().optional(), | ||
| roleName: z.string().optional(), | ||
| userId: z.uuid().optional(), |
There was a problem hiding this comment.
Rather use the isValidGuid from the validation utils. It validated also the @meId token.
| } | ||
| }; | ||
|
|
||
| await request.post(requestOptions); |
There was a problem hiding this comment.
The endpoint returns a response, so the command should return the response back to the user.
| await request.post(requestOptions); | |
| const response = await request.post(requestOptions); | |
| await logger.log(response); |
Adds
viva engage role member addcommand. Closes #6819