diff --git a/docs/docs/about/release-notes.mdx b/docs/docs/about/release-notes.mdx index 36e19cfd843..8a320cf7e7b 100644 --- a/docs/docs/about/release-notes.mdx +++ b/docs/docs/about/release-notes.mdx @@ -1190,8 +1190,8 @@ sidebar_position: 3 **Power Platform:** -- [pp chatbot get](../cmd/pp/chatbot/chatbot-get.mdx) - get information about the specified chatbot [#4107](https://github.com/pnp/cli-microsoft365/issues/4107) -- [pp chatbot remove](../cmd/pp/chatbot/chatbot-remove.mdx) - removes the specified chatbot [#4106](https://github.com/pnp/cli-microsoft365/issues/4106) +- [pp chatbot get](../cmd/pp/copilot/copilot-get.mdx) - get information about the specified chatbot [#4107](https://github.com/pnp/cli-microsoft365/issues/4107) +- [pp chatbot remove](../cmd/pp/copilot/copilot-remove.mdx) - removes the specified chatbot [#4106](https://github.com/pnp/cli-microsoft365/issues/4106) - [pp dataverse table row list](../cmd/pp/dataverse/dataverse-table-row-list.mdx) - lists table rows for the given Dataverse table [#3791](https://github.com/pnp/cli-microsoft365/issues/3791) - [pp solution publisher add](../cmd/pp/solution/solution-publisher-add.mdx) - adds a specified publisher in a given environment [#3977](https://github.com/pnp/cli-microsoft365/issues/3977) - [pp dataverse table row remove](../cmd/pp/dataverse/dataverse-table-row-remove.mdx) - removes a row from a dataverse table in a given environment [#4030](https://github.com/pnp/cli-microsoft365/issues/4030) @@ -1273,7 +1273,7 @@ sidebar_position: 3 - [pp card clone](../cmd/pp/card/card-clone.mdx) - clones a specific Microsoft Power Platform card in the specified Power Platform environment [#3790](https://github.com/pnp/cli-microsoft365/issues/3790) - [pp card remove](../cmd/pp/card/card-remove.mdx) - removes the specified Microsoft Power Platform card in the specified Power Platform environment [#3781](https://github.com/pnp/cli-microsoft365/issues/3781) -- [pp chatbot list](../cmd/pp/chatbot/chatbot-list.mdx) - lists Microsoft Power Platform chatbot in the specified Power Platform environment [#3650](https://github.com/pnp/cli-microsoft365/issues/3650) +- [pp chatbot list](../cmd/pp/copilot/copilot-list.mdx) - lists Microsoft Power Platform chatbot in the specified Power Platform environment [#3650](https://github.com/pnp/cli-microsoft365/issues/3650) - [pp dataverse table get](../cmd/pp/dataverse/dataverse-table-get.mdx) - lists a dataverse table in a given environment [#3726](https://github.com/pnp/cli-microsoft365/issues/3726) - [pp dataverse table remove](../cmd/pp/dataverse/dataverse-table-remove.mdx) - removes a dataverse table in a given environment [#4031](https://github.com/pnp/cli-microsoft365/issues/4031) - [pp solution remove](../cmd/pp/solution/solution-remove.mdx) - removes the specified solution in the specified Power Platform environment [#3723](https://github.com/pnp/cli-microsoft365/issues/3723) diff --git a/docs/docs/cmd/pp/chatbot/chatbot-get.mdx b/docs/docs/cmd/pp/copilot/copilot-get.mdx similarity index 80% rename from docs/docs/cmd/pp/chatbot/chatbot-get.mdx rename to docs/docs/cmd/pp/copilot/copilot-get.mdx index 0d140ffdb8e..9a24edcaa35 100644 --- a/docs/docs/cmd/pp/chatbot/chatbot-get.mdx +++ b/docs/docs/cmd/pp/copilot/copilot-get.mdx @@ -2,12 +2,18 @@ import Global from '/docs/cmd/_global.mdx'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# pp chatbot get +# pp copilot get -Get information about the specified chatbot +Get information about the specified copilot ## Usage +```sh +m365 pp copilot get [options] +``` + +## Alias + ```sh m365 pp chatbot get [options] ``` @@ -19,10 +25,10 @@ m365 pp chatbot get [options] : The name of the environment. `-i, --id [id]` -: The id of the chatbot. Specify either `id` or `name` but not both. +: The id of the copilot. Specify either `id` or `name` but not both. `-n, --name [name]` -: The name of the chatbot. Specify either `id` or `name` but not both. +: The name of the copilot. Specify either `id` or `name` but not both. `--asAdmin` : Run the command as admin for environments you do not have explicitly assigned permissions to. @@ -32,28 +38,28 @@ m365 pp chatbot get [options] ## Examples -Get a specific chatbot in a specific environment based on name. +Get a specific copilot in a specific environment based on name. ```sh -m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --name "CLI 365 Chatbot" +m365 pp copilot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --name "CLI 365 Copilot" ``` -Get a specific chatbot in a specific environment based on name as admin. +Get a specific copilot in a specific environment based on name as admin. ```sh -m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --name "CLI 365 Chatbot" --asAdmin +m365 pp copilot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --name "CLI 365 Copilot" --asAdmin ``` -Get a specific chatbot in a specific environment based on id. +Get a specific copilot in a specific environment based on id. ```sh -m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --id "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893" +m365 pp copilot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --id "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893" ``` -Get a specific chatbot in a specific environment based on id as admin. +Get a specific copilot in a specific environment based on id as admin. ```sh -m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --id "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893" --asAdmin +m365 pp copilot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --id "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893" --asAdmin ``` ## Response @@ -71,7 +77,7 @@ m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd5 "schemaname": "new_bot_23f5f58697fd43d595eb451c9797a53d", "_ownerid_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "overwritetime": "1900-01-01T00:00:00Z", - "name": "CLI 365 Chatbot", + "name": "CLI 365 Copilot", "solutionid": "fd140aae-4df4-11dd-bd17-0019b9312238", "ismanaged": false, "versionnumber": 1421457, @@ -119,7 +125,7 @@ m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd5 botid : 3a081d91-5ea8-40a7-8ac9-abbaa3fcb893 createdon : 2022-11-19T10:42:22Z modifiedon : 2022-11-19T10:42:24Z - name : CLI 365 Chatbot + name : CLI 365 Copilot publishedon: 2022-11-19T10:43:24Z ``` @@ -128,18 +134,18 @@ m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd5 ```csv name,botid,publishedon,createdon,modifiedon - CLI 365 Chatbot,3a081d91-5ea8-40a7-8ac9-abbaa3fcb893,2022-11-19T10:43:24Z,2022-11-19T10:42:22Z,2022-11-19T10:42:24Z + CLI 365 Copilot,3a081d91-5ea8-40a7-8ac9-abbaa3fcb893,2022-11-19T10:43:24Z,2022-11-19T10:42:22Z,2022-11-19T10:42:24Z ``` ```md - # pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --id "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893" + # pp copilot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --id "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893" Date: 9/1/2023 - ## CLI 365 Chatbot + ## CLI 365 Copilot Property | Value ---------|------- @@ -151,7 +157,7 @@ m365 pp chatbot get --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd5 schemaname | new\_bot\_23f5f58697fd43d595eb451c9797a53d \_ownerid\_value | 5fa787c1-1c4d-ed11-bba1-000d3a2caf7f overwritetime | 1900-01-01T00:00:00Z - name | CLI 365 Chatbot + name | CLI 365 Copilot solutionid | fd140aae-4df4-11dd-bd17-0019b9312238 ismanaged | false versionnumber | 1445843 diff --git a/docs/docs/cmd/pp/chatbot/chatbot-list.mdx b/docs/docs/cmd/pp/copilot/copilot-list.mdx similarity index 73% rename from docs/docs/cmd/pp/chatbot/chatbot-list.mdx rename to docs/docs/cmd/pp/copilot/copilot-list.mdx index 0bbc5a96c58..20cc6476913 100644 --- a/docs/docs/cmd/pp/chatbot/chatbot-list.mdx +++ b/docs/docs/cmd/pp/copilot/copilot-list.mdx @@ -2,12 +2,18 @@ import Global from '/docs/cmd/_global.mdx'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# pp chatbot list +# pp copilot list -Lists Microsoft Power Platform chatbot in the specified Power Platform environment +Lists Microsoft Power Platform copilots in the specified Power Platform environment ## Usage +```sh +m365 pp copilot list [options] +``` + +## Alias + ```sh m365 pp chatbot list [options] ``` @@ -26,16 +32,16 @@ m365 pp chatbot list [options] ## Examples -List chatbots in a specific environment. +List copilots in a specific environment. ```sh -m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" +m365 pp copilot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" ``` -List chatbots in a specific environment as admin. +List copilots in a specific environment as admin. ```sh -m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --asAdmin +m365 pp copilot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" --asAdmin ``` ## Response @@ -59,7 +65,7 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd "isManaged": false, "versionNumber": 1429641, "timezoneRuleVersionNumber": 0, - "name": "CLI Chatbot", + "name": "CLI Copilot", "statusCode": 1, "owner": "Doe, John", "overwriteTime": "1900-01-01T00:00:00Z", @@ -77,9 +83,9 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd ```text - name botid publishedOn createdOn botModifiedOn - ------------ ------------------------------------ -------------------- -------------------- -------------------- - CLI Chatbot 23f5f586-97fd-43d5-95eb-451c9797a53d 2022-11-19T19:19:53Z 2022-11-19T10:42:22Z 2022-11-19T20:19:57Z + name botid publishedOn createdOn botModifiedOn + ----------- ------------------------------------ -------------------- -------------------- -------------------- + CLI Copilot 23f5f586-97fd-43d5-95eb-451c9797a53d 2022-11-19T19:19:53Z 2022-11-19T10:42:22Z 2022-11-19T20:19:57Z ``` @@ -87,18 +93,18 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd ```csv name,botid,publishedOn,createdOn,botModifiedOn - CLI Chatbot,23f5f586-97fd-43d5-95eb-451c9797a53d,2022-11-19T19:19:53Z,2022-11-19T10:42:22Z,2022-11-19T20:19:57Z + CLI Copilot,23f5f586-97fd-43d5-95eb-451c9797a53d,2022-11-19T19:19:53Z,2022-11-19T10:42:22Z,2022-11-19T20:19:57Z ``` ```md - # pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" + # pp copilot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5" Date: 9/1/2023 - ## CLI Chatbot + ## CLI Copilot Property | Value ---------|------- @@ -115,7 +121,7 @@ m365 pp chatbot list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd isManaged | false versionNumber | 1429641 timezoneRuleVersionNumber | 0 - name | CLI Chatbot + name | CLI Copilot statusCode | 1 owner | Doe, John overwriteTime | 1900-01-01T00:00:00Z diff --git a/docs/docs/cmd/pp/chatbot/chatbot-remove.mdx b/docs/docs/cmd/pp/copilot/copilot-remove.mdx similarity index 57% rename from docs/docs/cmd/pp/chatbot/chatbot-remove.mdx rename to docs/docs/cmd/pp/copilot/copilot-remove.mdx index ceb2eb30ad6..c0d16948b43 100644 --- a/docs/docs/cmd/pp/chatbot/chatbot-remove.mdx +++ b/docs/docs/cmd/pp/copilot/copilot-remove.mdx @@ -1,11 +1,17 @@ import Global from '/docs/cmd/_global.mdx'; -# pp chatbot remove +# pp copilot remove -Removes the specified chatbot +Removes the specified copilot ## Usage +```sh +m365 pp copilot remove [options] +``` + +## Alias + ```sh m365 pp chatbot remove [options] ``` @@ -17,10 +23,10 @@ m365 pp chatbot remove [options] : The name of the environment. `-i, --id [id]` -: The id of the chatbot. Specify either `id` or `name` but not both. +: The id of the copilot. Specify either `id` or `name` but not both. `-n, --name [name]` -: The name of the chatbot. Specify either `id` or `name` but not both. +: The name of the copilot. Specify either `id` or `name` but not both. `--asAdmin` : Run the command as admin for environments you do not have explicitly assigned permissions to. @@ -33,22 +39,22 @@ m365 pp chatbot remove [options] ## Examples -Removes the specified Microsoft Power Platform chatbot owned by the currently signed-in user based on name +Removes the specified Microsoft Power Platform copilot owned by the currently signed-in user based on name ```sh -m365 pp chatbot remove --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name "Chatbot Name" +m365 pp copilot remove --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name "Chatbot Name" ``` -Removes the specified Microsoft Power Platform chatbot owned by the currently signed-in user based on id without confirmation +Removes the specified Microsoft Power Platform copilot owned by the currently signed-in user based on id without confirmation ```sh -m365 pp chatbot remove --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --id 9d9a13d0-6255-ed11-bba2-000d3adf774e --force +m365 pp copilot remove --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --id 9d9a13d0-6255-ed11-bba2-000d3adf774e --force ``` -Removes the specified Microsoft Power Platform chatbot owned by another user based on name +Removes the specified Microsoft Power Platform copilot owned by another user based on name ```sh -m365 pp chatbot remove --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name "Chatbot Name" --asAdmin +m365 pp copilot remove --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --name "Chatbot Name" --asAdmin ``` ## Response diff --git a/docs/docs/v7-upgrade-guidance.mdx b/docs/docs/v7-upgrade-guidance.mdx index c534e802736..75fa012832d 100644 --- a/docs/docs/v7-upgrade-guidance.mdx +++ b/docs/docs/v7-upgrade-guidance.mdx @@ -93,7 +93,7 @@ Besides that, when using JSON output, we had duplicate properties in the result. ### Updated output of `pp chatbot list` -The output of [pp chatbot list](./cmd/pp/chatbot/chatbot-list.mdx) contained a `displayName` property. However, the actual property coming from the API was called `name`. We changed `displayName` back to `name` so that it now aligns with the other chatbot commands where a `name` option can be used and a `name` property may be returned. +The output of [pp chatbot list](./cmd/pp/copilot/copilot-list.mdx) contained a `displayName` property. However, the actual property coming from the API was called `name`. We changed `displayName` back to `name` so that it now aligns with the other chatbot commands where a `name` option can be used and a `name` property may be returned. #### What action do I need to take? @@ -447,9 +447,9 @@ Command|Old option|New option [pp card get](./cmd/pp/card/card-get.mdx)|`environment`|`environmentName` [pp card list](./cmd/pp/card/card-list.mdx)|`environment`|`environmentName` [pp card remove](./cmd/pp/card/card-remove.mdx)|`environment`|`environmentName` -[pp chatbot get](./cmd/pp/chatbot/chatbot-get.mdx)|`environment`|`environmentName` -[pp chatbot list](./cmd/pp/chatbot/chatbot-list.mdx)|`environment`|`environmentName` -[pp chatbot remove](./cmd/pp/chatbot/chatbot-remove.mdx)|`environment`|`environmentName` +[pp chatbot get](./cmd/pp/copilot/copilot-get.mdx)|`environment`|`environmentName` +[pp chatbot list](./cmd/pp/copilot/copilot-list.mdx)|`environment`|`environmentName` +[pp chatbot remove](./cmd/pp/copilot/copilot-remove.mdx)|`environment`|`environmentName` [pp dataverse table get](./cmd/pp/dataverse/dataverse-table-get.mdx)|`environment`|`environmentName` [pp dataverse table list](./cmd/pp/dataverse/dataverse-table-list.mdx)|`environment`|`environmentName` [pp dataverse table remove](./cmd/pp/dataverse/dataverse-table-remove.mdx)|`environment`|`environmentName` diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index ef1c39e6c2e..19c68ca4d5d 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -49,6 +49,9 @@ const config: Config = { 'client-redirects', { createRedirects(routePath) { + if (routePath.includes('/copilot/copilot-')) { + return [routePath.replace('/copilot/copilot-', '/chatbot/chatbot-')]; + } if (routePath.includes('/entra')) { return [routePath.replace('/entra', '/aad')]; } diff --git a/docs/src/config/sidebars.ts b/docs/src/config/sidebars.ts index 0e622422ac6..64df3a38488 100644 --- a/docs/src/config/sidebars.ts +++ b/docs/src/config/sidebars.ts @@ -1657,21 +1657,21 @@ const sidebars: SidebarsConfig = { ] }, { - chatbot: [ + copilot: [ { type: 'doc', - label: 'chatbot get', - id: 'cmd/pp/chatbot/chatbot-get' + label: 'copilot get', + id: 'cmd/pp/copilot/copilot-get' }, { type: 'doc', - label: 'chatbot list', - id: 'cmd/pp/chatbot/chatbot-list' + label: 'copliot list', + id: 'cmd/pp/copilot/copilot-list' }, { type: 'doc', - label: 'chatbot remove', - id: 'cmd/pp/chatbot/chatbot-remove' + label: 'copilot remove', + id: 'cmd/pp/copilot/copilot-remove' } ] }, diff --git a/src/index.spec.ts b/src/index.spec.ts index e85381a1405..60572448ffc 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -77,6 +77,9 @@ describe('Lazy loading commands', () => { 'consent', 'flow connector export', 'flow connector list', + 'pp chatbot get', + 'pp chatbot list', + 'pp chatbot remove', 'search externalconnection add', 'search externalconnection get', 'search externalconnection list', diff --git a/src/m365/pp/commands.ts b/src/m365/pp/commands.ts index dae86ad2616..57132bca30c 100644 --- a/src/m365/pp/commands.ts +++ b/src/m365/pp/commands.ts @@ -11,6 +11,9 @@ export default { CHATBOT_GET: `${prefix} chatbot get`, CHATBOT_LIST: `${prefix} chatbot list`, CHATBOT_REMOVE: `${prefix} chatbot remove`, + COPILOT_GET: `${prefix} copilot get`, + COPILOT_LIST: `${prefix} copilot list`, + COPILOT_REMOVE: `${prefix} copilot remove`, DATAVERSE_TABLE_LIST: `${prefix} dataverse table list`, DATAVERSE_TABLE_GET: `${prefix} dataverse table get`, DATAVERSE_TABLE_REMOVE: `${prefix} dataverse table remove`, diff --git a/src/m365/pp/commands/chatbot/chatbot-get.spec.ts b/src/m365/pp/commands/copilot/copilot-get.spec.ts similarity index 92% rename from src/m365/pp/commands/chatbot/chatbot-get.spec.ts rename to src/m365/pp/commands/copilot/copilot-get.spec.ts index f464aa0c12b..1490dcd13eb 100644 --- a/src/m365/pp/commands/chatbot/chatbot-get.spec.ts +++ b/src/m365/pp/commands/copilot/copilot-get.spec.ts @@ -13,16 +13,16 @@ import { powerPlatform } from '../../../../utils/powerPlatform.js'; import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; -import command from './chatbot-get.js'; +import command from './copilot-get.js'; import { settingsNames } from '../../../../settingsNames.js'; import { accessToken } from '../../../../utils/accessToken.js'; -describe(commands.CHATBOT_GET, () => { +describe(commands.COPILOT_GET, () => { let commandInfo: CommandInfo; //#region Mocked Responses const validEnvironment = '4be50206-9576-4237-8b17-38d8aadfaa36'; const validId = '3a081d91-5ea8-40a7-8ac9-abbaa3fcb893'; - const validName = 'CLI 365 Chatbot'; + const validName = 'CLI 365 Copilot'; const envUrl = "https://contoso-dev.api.crm4.dynamics.com"; const botResponse = { "value": [ @@ -35,7 +35,7 @@ describe(commands.CHATBOT_GET, () => { "schemaname": "new_bot_23f5f58697fd43d595eb451c9797a53d", "_ownerid_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "overwritetime": "1900-01-01T00:00:00Z", - "name": "CLI 365 Chatbot", + "name": "CLI 365 Copilot", "solutionid": "fd140aae-4df4-11dd-bd17-0019b9312238", "ismanaged": false, "versionnumber": 1421457, @@ -130,13 +130,18 @@ describe(commands.CHATBOT_GET, () => { }); it('has correct name', () => { - assert.strictEqual(command.name, commands.CHATBOT_GET); + assert.strictEqual(command.name, commands.COPILOT_GET); }); it('has a description', () => { assert.notStrictEqual(command.description, null); }); + it('defines correct alias', () => { + const alias = command.alias(); + assert.deepStrictEqual(alias, [commands.CHATBOT_GET]); + }); + it('defines correct properties for the default output', () => { assert.deepStrictEqual(command.defaultProperties(), ['name', 'botid', 'publishedon', 'createdon', 'modifiedon']); }); @@ -161,7 +166,7 @@ describe(commands.CHATBOT_GET, () => { assert.strictEqual(actual, true); }); - it('throws error when multiple chatbots found with the same name', async () => { + it('throws error when multiple copilots found with the same name', async () => { sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => { if (settingName === settingsNames.prompt) { return false; @@ -193,10 +198,10 @@ describe(commands.CHATBOT_GET, () => { environmentName: validEnvironment, name: validName } - }), new CommandError("Multiple chatbots with name 'CLI 365 Chatbot' found. Found: 69703efe-4149-ed11-bba2-000d3adf7537, 3a081d91-5ea8-40a7-8ac9-abbaa3fcb893.")); + }), new CommandError("Multiple copilots with name 'CLI 365 Copilot' found. Found: 69703efe-4149-ed11-bba2-000d3adf7537, 3a081d91-5ea8-40a7-8ac9-abbaa3fcb893.")); }); - it('handles selecting single result when multiple chatbots with the specified name found and cli is set to prompt', async () => { + it('handles selecting single result when multiple copilots with the specified name found and cli is set to prompt', async () => { sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl); const multipleBotsResponse = { @@ -221,7 +226,7 @@ describe(commands.CHATBOT_GET, () => { assert(loggerLogSpy.calledWith(botResponse.value[0])); }); - it('throws error when no chatbot with name was found', async () => { + it('throws error when no copilot with name was found', async () => { sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl); sinon.stub(request, 'get').callsFake(async (opts) => { @@ -239,10 +244,10 @@ describe(commands.CHATBOT_GET, () => { environmentName: validEnvironment, name: validName } - }), new CommandError(`The specified chatbot '${validName}' does not exist.`)); + }), new CommandError(`The specified copilot '${validName}' does not exist.`)); }); - it('retrieves a specific chatbot with the name parameter', async () => { + it('retrieves a specific copilot with the name parameter', async () => { sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl); sinon.stub(request, 'get').callsFake(async opts => { @@ -259,7 +264,7 @@ describe(commands.CHATBOT_GET, () => { assert(loggerLogSpy.calledWith(botResponse.value[0])); }); - it('retrieves a specific chatbot with the id parameter', async () => { + it('retrieves a specific copilot with the id parameter', async () => { sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl); sinon.stub(request, 'get').callsFake(async opts => { diff --git a/src/m365/pp/commands/chatbot/chatbot-get.ts b/src/m365/pp/commands/copilot/copilot-get.ts similarity index 81% rename from src/m365/pp/commands/chatbot/chatbot-get.ts rename to src/m365/pp/commands/copilot/copilot-get.ts index 966aeefe2a1..b774d6f6f2c 100644 --- a/src/m365/pp/commands/chatbot/chatbot-get.ts +++ b/src/m365/pp/commands/copilot/copilot-get.ts @@ -19,14 +19,18 @@ export interface Options extends GlobalOptions { asAdmin?: boolean; } -class PpChatbotGetCommand extends PowerPlatformCommand { +class PpCopilotGetCommand extends PowerPlatformCommand { public get name(): string { - return commands.CHATBOT_GET; + return commands.COPILOT_GET; } public get description(): string { - return 'Get information about the specified chatbot'; + return 'Get information about the specified copilot'; + } + + public alias(): string[] | undefined { + return [commands.CHATBOT_GET]; } public defaultProperties(): string[] | undefined { @@ -88,14 +92,15 @@ class PpChatbotGetCommand extends PowerPlatformCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { + await this.showDeprecationWarning(logger, commands.CHATBOT_GET, commands.COPILOT_GET); if (this.verbose) { - await logger.logToStderr(`Retrieving chatbot '${args.options.id || args.options.name}'...`); + await logger.logToStderr(`Retrieving copilot '${args.options.id || args.options.name}'...`); } try { const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin); - const res = await this.getChatbot(dynamicsApiUrl, args.options); + const res = await this.getCopilot(dynamicsApiUrl, args.options); await logger.log(res); } catch (err: any) { @@ -103,7 +108,7 @@ class PpChatbotGetCommand extends PowerPlatformCommand { } } - private async getChatbot(dynamicsApiUrl: string, options: Options): Promise { + private async getCopilot(dynamicsApiUrl: string, options: Options): Promise { const requestOptions: CliRequestOptions = { headers: { accept: 'application/json;odata.metadata=none' @@ -122,15 +127,15 @@ class PpChatbotGetCommand extends PowerPlatformCommand { if (result.value.length > 1) { const resultAsKeyValuePair = formatting.convertArrayToHashTable('botid', result.value); - return await cli.handleMultipleResultsFound(`Multiple chatbots with name '${options.name}' found.`, resultAsKeyValuePair); + return await cli.handleMultipleResultsFound(`Multiple copilots with name '${options.name}' found.`, resultAsKeyValuePair); } if (result.value.length === 0) { - throw `The specified chatbot '${options.name}' does not exist.`; + throw `The specified copilot '${options.name}' does not exist.`; } return result.value[0]; } } -export default new PpChatbotGetCommand(); \ No newline at end of file +export default new PpCopilotGetCommand(); \ No newline at end of file diff --git a/src/m365/pp/commands/chatbot/chatbot-list.spec.ts b/src/m365/pp/commands/copilot/copilot-list.spec.ts similarity index 93% rename from src/m365/pp/commands/chatbot/chatbot-list.spec.ts rename to src/m365/pp/commands/copilot/copilot-list.spec.ts index c52ae40bd3b..d8858f6d164 100644 --- a/src/m365/pp/commands/chatbot/chatbot-list.spec.ts +++ b/src/m365/pp/commands/copilot/copilot-list.spec.ts @@ -10,10 +10,10 @@ import { powerPlatform } from '../../../../utils/powerPlatform.js'; import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; -import command from './chatbot-list.js'; +import command from './copilot-list.js'; import { accessToken } from '../../../../utils/accessToken.js'; -describe(commands.CHATBOT_LIST, () => { +describe(commands.COPILOT_LIST, () => { const envUrl = "https://contoso-dev.api.crm4.dynamics.com"; const validEnvironment = '4be50206-9576-4237-8b17-38d8aadfaa36'; const fetchXml: string = ` @@ -57,7 +57,7 @@ describe(commands.CHATBOT_LIST, () => { `; - const chatbotResponse: any = { + const copilotResponse: any = { "value": [ { "language": 1033, @@ -73,7 +73,7 @@ describe(commands.CHATBOT_LIST, () => { "isManaged": false, "versionNumber": 1429641, "timezoneRuleVersionNumber": 0, - "name": "CLI Chatbot", + "name": "CLI Copilot", "statusCode": 1, "owner": "Doe, John", "overwriteTime": "1900-01-01T00:00:00Z", @@ -129,7 +129,7 @@ describe(commands.CHATBOT_LIST, () => { }); it('has correct name', () => { - assert.strictEqual(command.name, commands.CHATBOT_LIST); + assert.strictEqual(command.name, commands.COPILOT_LIST); }); it('has a description', () => { @@ -140,7 +140,7 @@ describe(commands.CHATBOT_LIST, () => { assert.deepStrictEqual(command.defaultProperties(), ['name', 'botid', 'publishedOn', 'createdOn', 'botModifiedOn']); }); - it('retrieves chatbots', async () => { + it('retrieves copilot bots', async () => { sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl); sinon.stub(request, 'get').callsFake(async (opts) => { @@ -148,7 +148,7 @@ describe(commands.CHATBOT_LIST, () => { if (opts.headers && opts.headers.accept && (opts.headers.accept as string).indexOf('application/json') === 0) { - return chatbotResponse; + return copilotResponse; } } @@ -156,7 +156,7 @@ describe(commands.CHATBOT_LIST, () => { }); await command.action(logger, { options: { debug: true, environmentName: validEnvironment } }); - assert(loggerLogSpy.calledWith(chatbotResponse.value)); + assert(loggerLogSpy.calledWith(copilotResponse.value)); }); it('correctly handles API OData error', async () => { @@ -182,4 +182,10 @@ describe(commands.CHATBOT_LIST, () => { await assert.rejects(command.action(logger, { options: { environmentName: validEnvironment } } as any), new CommandError(`Resource '' does not exist or one of its queried reference-property objects are not present`)); }); + + it('defines correct alias', () => { + const alias = command.alias(); + assert.deepStrictEqual(alias, [commands.CHATBOT_LIST]); + }); + }); diff --git a/src/m365/pp/commands/chatbot/chatbot-list.ts b/src/m365/pp/commands/copilot/copilot-list.ts similarity index 90% rename from src/m365/pp/commands/chatbot/chatbot-list.ts rename to src/m365/pp/commands/copilot/copilot-list.ts index 934c9b70f3f..fe8d0661d21 100644 --- a/src/m365/pp/commands/chatbot/chatbot-list.ts +++ b/src/m365/pp/commands/copilot/copilot-list.ts @@ -14,13 +14,17 @@ interface Options extends GlobalOptions { asAdmin?: boolean; } -class PpChatbotListCommand extends PowerPlatformCommand { +class PpCopilotListCommand extends PowerPlatformCommand { public get name(): string { - return commands.CHATBOT_LIST; + return commands.COPILOT_LIST; } public get description(): string { - return 'Lists Microsoft Power Platform chatbots in the specified Power Platform environment'; + return 'Lists Microsoft Power Platform copilots in the specified Power Platform environment'; + } + + public alias(): string[] | undefined { + return [commands.CHATBOT_LIST]; } public defaultProperties(): string[] | undefined { @@ -54,8 +58,9 @@ class PpChatbotListCommand extends PowerPlatformCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { + await this.showDeprecationWarning(logger, commands.CHATBOT_LIST, commands.COPILOT_LIST); if (this.verbose) { - await logger.logToStderr(`Retrieving list of chatbots for environment '${args.options.environmentName}'.`); + await logger.logToStderr(`Retrieving list of copilots for environment '${args.options.environmentName}'.`); } const fetchXml: string = ` @@ -111,4 +116,4 @@ class PpChatbotListCommand extends PowerPlatformCommand { } } -export default new PpChatbotListCommand(); \ No newline at end of file +export default new PpCopilotListCommand(); \ No newline at end of file diff --git a/src/m365/pp/commands/chatbot/chatbot-remove.spec.ts b/src/m365/pp/commands/copilot/copilot-remove.spec.ts similarity index 90% rename from src/m365/pp/commands/chatbot/chatbot-remove.spec.ts rename to src/m365/pp/commands/copilot/copilot-remove.spec.ts index 0275363096f..39b9714adab 100644 --- a/src/m365/pp/commands/chatbot/chatbot-remove.spec.ts +++ b/src/m365/pp/commands/copilot/copilot-remove.spec.ts @@ -12,16 +12,16 @@ import { powerPlatform } from '../../../../utils/powerPlatform.js'; import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; -import ppChatbotGetCommand from './chatbot-get.js'; -import command from './chatbot-remove.js'; +import ppCopilotGetCommand from './copilot-get.js'; +import command from './copilot-remove.js'; import { accessToken } from '../../../../utils/accessToken.js'; -describe(commands.CHATBOT_REMOVE, () => { +describe(commands.COPILOT_REMOVE, () => { let commandInfo: CommandInfo; //#region Mocked Responses const validEnvironment = '4be50206-9576-4237-8b17-38d8aadfaa36'; const validId = '3a081d91-5ea8-40a7-8ac9-abbaa3fcb893'; - const validName = 'CLI 365 Chatbot'; + const validName = 'CLI 365 Copilot'; const envUrl = "https://contoso-dev.api.crm4.dynamics.com"; //#endregion @@ -77,13 +77,18 @@ describe(commands.CHATBOT_REMOVE, () => { }); it('has correct name', () => { - assert.strictEqual(command.name, commands.CHATBOT_REMOVE); + assert.strictEqual(command.name, commands.COPILOT_REMOVE); }); it('has a description', () => { assert.notStrictEqual(command.description, null); }); + it('defines correct alias', () => { + const alias = command.alias(); + assert.deepStrictEqual(alias, [commands.CHATBOT_REMOVE]); + }); + it('fails validation if id is not a valid guid.', async () => { const actual = await command.validate({ options: { @@ -104,7 +109,7 @@ describe(commands.CHATBOT_REMOVE, () => { assert.strictEqual(actual, true); }); - it('prompts before removing the specified chatbot owned by the currently signed-in user when force option not passed', async () => { + it('prompts before removing the specified copilot owned by the currently signed-in user when force option not passed', async () => { await command.action(logger, { options: { environmentName: validEnvironment, @@ -115,7 +120,7 @@ describe(commands.CHATBOT_REMOVE, () => { assert(promptIssued); }); - it('aborts removing the specified chatbot owned by the currently signed-in user when force option not passed and prompt not confirmed', async () => { + it('aborts removing the specified copilot owned by the currently signed-in user when force option not passed and prompt not confirmed', async () => { const postSpy = sinon.spy(request, 'post'); await command.action(logger, { @@ -127,13 +132,13 @@ describe(commands.CHATBOT_REMOVE, () => { assert(postSpy.notCalled); }); - it('removes the specified chatbot owned by the currently signed-in user when prompt confirmed by name', async () => { + it('removes the specified copilot owned by the currently signed-in user when prompt confirmed by name', async () => { sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl); sinon.stub(cli, 'executeCommandWithOutput').callsFake(async (command): Promise => { - if (command === ppChatbotGetCommand) { + if (command === ppCopilotGetCommand) { return ({ - stdout: `{ "authenticationtrigger": 0, "_owningbusinessunit_value": "6da087c1-1c4d-ed11-bba1-000d3a2caf7f", "statuscode": 1, "createdon": "2022-11-19T10:42:22Z", "statecode": 0, "schemaname": "new_bot_23f5f58697fd43d595eb451c9797a53d", "_ownerid_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "name": "CLI 365 Chatbot", "solutionid": "fd140aae-4df4-11dd-bd17-0019b9312238", "ismanaged": false, "versionnumber": 1429641, "publishedon": "2022-11-19T19:19:53Z", "timezoneruleversionnumber": 0, "language": 1033, "_modifiedby_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "overwritetime": "1900-01-01T00:00:00Z", "modifiedon": "2022-11-19T20:19:57Z", "componentstate": 0, "botid": "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893", "_createdby_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "componentidunique": "cdcd6496-e25d-4ad1-91cf-3f4d547fdd23", "authenticationmode": 1, "_owninguser_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "accesscontrolpolicy": 0, "runtimeprovider": 0, "_publishedby_value": null, "authenticationconfiguration": null, "authorizedsecuritygroupids": null, "overriddencreatedon": null, "applicationmanifestinformation": null, "importsequencenumber": null, "synchronizationstatus": null, "_modifiedonbehalfby_value": null, "template": null, "_providerconnectionreferenceid_value": null, "configuration": null, "utcconversiontimezonecode": null, "_createdonbehalfby_value": null, "iconbase64": null, "supportedlanguages": null, "_owningteam_value": null, "iscustomizable": { "Value": true, "CanBeChanged": true, "ManagedPropertyLogicalName": "iscustomizableanddeletable" } }` + stdout: `{ "authenticationtrigger": 0, "_owningbusinessunit_value": "6da087c1-1c4d-ed11-bba1-000d3a2caf7f", "statuscode": 1, "createdon": "2022-11-19T10:42:22Z", "statecode": 0, "schemaname": "new_bot_23f5f58697fd43d595eb451c9797a53d", "_ownerid_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "name": "CLI 365 Copilot", "solutionid": "fd140aae-4df4-11dd-bd17-0019b9312238", "ismanaged": false, "versionnumber": 1429641, "publishedon": "2022-11-19T19:19:53Z", "timezoneruleversionnumber": 0, "language": 1033, "_modifiedby_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "overwritetime": "1900-01-01T00:00:00Z", "modifiedon": "2022-11-19T20:19:57Z", "componentstate": 0, "botid": "3a081d91-5ea8-40a7-8ac9-abbaa3fcb893", "_createdby_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "componentidunique": "cdcd6496-e25d-4ad1-91cf-3f4d547fdd23", "authenticationmode": 1, "_owninguser_value": "5fa787c1-1c4d-ed11-bba1-000d3a2caf7f", "accesscontrolpolicy": 0, "runtimeprovider": 0, "_publishedby_value": null, "authenticationconfiguration": null, "authorizedsecuritygroupids": null, "overriddencreatedon": null, "applicationmanifestinformation": null, "importsequencenumber": null, "synchronizationstatus": null, "_modifiedonbehalfby_value": null, "template": null, "_providerconnectionreferenceid_value": null, "configuration": null, "utcconversiontimezonecode": null, "_createdonbehalfby_value": null, "iconbase64": null, "supportedlanguages": null, "_owningteam_value": null, "iscustomizable": { "Value": true, "CanBeChanged": true, "ManagedPropertyLogicalName": "iscustomizableanddeletable" } }` }); } @@ -160,7 +165,7 @@ describe(commands.CHATBOT_REMOVE, () => { assert(postStub.called); }); - it('removes the specified chatbot without confirmation prompt by id', async () => { + it('removes the specified copilot without confirmation prompt by id', async () => { sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl); sinon.stub(request, 'post').callsFake(async (opts) => { diff --git a/src/m365/pp/commands/chatbot/chatbot-remove.ts b/src/m365/pp/commands/copilot/copilot-remove.ts similarity index 77% rename from src/m365/pp/commands/chatbot/chatbot-remove.ts rename to src/m365/pp/commands/copilot/copilot-remove.ts index 66615db12aa..fda86dbe555 100644 --- a/src/m365/pp/commands/chatbot/chatbot-remove.ts +++ b/src/m365/pp/commands/copilot/copilot-remove.ts @@ -7,7 +7,7 @@ import { powerPlatform } from '../../../../utils/powerPlatform.js'; import { validation } from '../../../../utils/validation.js'; import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js'; import commands from '../../commands.js'; -import ppChatbotGetCommand, { Options as PpChatbotGetCommandOptions } from './chatbot-get.js'; +import ppCopilotGetCommand, { Options as PpCopilotGetCommandOptions } from './copilot-get.js'; interface CommandArgs { options: Options; @@ -21,14 +21,18 @@ interface Options extends GlobalOptions { force?: boolean; } -class PpChatbotRemoveCommand extends PowerPlatformCommand { +class PpCopilotRemoveCommand extends PowerPlatformCommand { public get name(): string { - return commands.CHATBOT_REMOVE; + return commands.COPILOT_REMOVE; } public get description(): string { - return 'Removes the specified chatbot'; + return 'Removes the specified copilot'; + } + + public alias(): string[] | undefined { + return [commands.CHATBOT_REMOVE]; } constructor() { @@ -90,28 +94,29 @@ class PpChatbotRemoveCommand extends PowerPlatformCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { + await this.showDeprecationWarning(logger, commands.CHATBOT_REMOVE, commands.COPILOT_REMOVE); if (this.verbose) { - await logger.logToStderr(`Removing chatbot '${args.options.id || args.options.name}'...`); + await logger.logToStderr(`Removing copilot '${args.options.id || args.options.name}'...`); } if (args.options.force) { - await this.deleteChatbot(args); + await this.deleteCopilot(args); } else { - const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove chatbot '${args.options.id || args.options.name}'?` }); + const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove copilot '${args.options.id || args.options.name}'?` }); if (result) { - await this.deleteChatbot(args); + await this.deleteCopilot(args); } } } - private async getChatbotId(args: CommandArgs): Promise { + private async getCopilotId(args: CommandArgs): Promise { if (args.options.id) { return args.options.id; } - const options: PpChatbotGetCommandOptions = { + const options: PpCopilotGetCommandOptions = { environmentName: args.options.environmentName, name: args.options.name, output: 'json', @@ -119,16 +124,16 @@ class PpChatbotRemoveCommand extends PowerPlatformCommand { verbose: this.verbose }; - const output = await cli.executeCommandWithOutput(ppChatbotGetCommand as Command, { options: { ...options, _: [] } }); + const output = await cli.executeCommandWithOutput(ppCopilotGetCommand as Command, { options: { ...options, _: [] } }); const getBotOutput = JSON.parse(output.stdout); return getBotOutput.botid; } - private async deleteChatbot(args: CommandArgs): Promise { + private async deleteCopilot(args: CommandArgs): Promise { try { const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin); - const botId = await this.getChatbotId(args); + const botId = await this.getCopilotId(args); const requestOptions: CliRequestOptions = { url: `${dynamicsApiUrl}/api/data/v9.1/bots(${botId})/Microsoft.Dynamics.CRM.PvaDeleteBot?tag=deprovisionbotondelete`, headers: { @@ -146,4 +151,4 @@ class PpChatbotRemoveCommand extends PowerPlatformCommand { } } -export default new PpChatbotRemoveCommand(); \ No newline at end of file +export default new PpCopilotRemoveCommand(); \ No newline at end of file