From 56183179a03de8b9247eb4301174ea0a601a0462 Mon Sep 17 00:00:00 2001 From: Martin Battaglino Date: Thu, 12 Sep 2019 09:03:22 -0300 Subject: [PATCH] [Botskills] Use botWebAppName and resourceGroupName from the appsettings file (#2346) * Create AppSetting model * Rename CognitiveModel model * Separate initializacion, validation, assignment. Use appsettings for botname and rgname * Remove partial initialization for connect command * Separate initializacion, validation, assignment for disconnect * Separate initializacion, validation, assignment for list * Separate initializacion, validation, assignment for refresh * Separate initializacion, validation, assignment. Use appsettings for botname and rgname * Remove unused attribute for models * Update refresh documentation attributes * Update whole documentation removing botName parameter * Update warning removing botName parameter * Fix tests * Update comments and fix tslint issues * Replicate comment of appsettings validation --- docs/_docs/howto/skills/addingskills.md | 4 +- docs/_docs/reference/knownissues.md | 2 +- docs/_docs/reference/skills/botskills.md | 4 +- .../add-prebuilt-skill/4_connect_skill.md | 2 +- .../csharp/create-skill/6_add_your_skill.md | 2 +- .../create-skill/6_add_your_skill.md | 2 +- tools/botskills/docs/connect.md | 1 - tools/botskills/docs/refresh.md | 1 - tools/botskills/docs/update.md | 1 - tools/botskills/src/botskills-connect.ts | 106 +++++++++++------- tools/botskills/src/botskills-disconnect.ts | 72 +++++++----- tools/botskills/src/botskills-list.ts | 19 ++-- tools/botskills/src/botskills-refresh.ts | 57 ++++++---- tools/botskills/src/botskills-update.ts | 105 +++++++++++------ .../src/functionality/updateSkill.ts | 2 +- tools/botskills/src/models/appSetting.ts | 14 +++ tools/botskills/src/models/authentication.ts | 6 - .../{cognitiveFile.ts => cognitiveModel.ts} | 2 +- .../src/models/disconnectConfiguration.ts | 1 - tools/botskills/src/models/index.ts | 4 +- .../src/models/refreshConfiguration.ts | 1 - .../src/utils/authenticationUtils.ts | 4 +- tools/botskills/test/disconnect.test.js | 10 -- tools/botskills/test/refresh.test.js | 4 - tools/botskills/test/update.test.js | 2 +- 25 files changed, 255 insertions(+), 173 deletions(-) create mode 100644 tools/botskills/src/models/appSetting.ts rename tools/botskills/src/models/{cognitiveFile.ts => cognitiveModel.ts} (86%) diff --git a/docs/_docs/howto/skills/addingskills.md b/docs/_docs/howto/skills/addingskills.md index 87e6b50283..9bfba2d2af 100644 --- a/docs/_docs/howto/skills/addingskills.md +++ b/docs/_docs/howto/skills/addingskills.md @@ -52,7 +52,7 @@ Run the following command to add each Skill to your Virtual Assistant. This assu The `--luisFolder` parameter can be used to point the Skill CLI at the source LU files for trigger utterances. For Skills provided within this repo these can be found in the `Deployment/Resources/LU` folder of each Skill. The CLI will automatically traverse locale folder hierarchies. This can be omitted for any of the skills we provide as the LU files are provided locally. Also, you have to specify the `--cs` (for C#) or `--ts` (for TypeScript) argument for determining the coding language of your assistant, since each language takes different folder structures that need to be taken into consideration. ```bash -botskills connect --botName YOUR_BOT_NAME --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder [path] --cs +botskills connect --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder [path] --cs ``` See the [Skill CLI documentation]({{site.baseurl}}/reference/botskills) for detailed CLI documentation. @@ -96,7 +96,7 @@ Run the following command to update a Skill to your Virtual Assistant. This assu The `--luisFolder` parameter can be used to point the Skill CLI at the source LU files for trigger utterances. For Skills provided within this repo these can be found in the `Deployment/Resources/LU` folder of each Skill. The CLI will automatically traverse locale folder hierarchies. This can be omitted for any of the skills we provide as the LU files are provided locally. Also, you have to specify the `--cs` (for C#) or `--ts` (for TypeScript) argument for determining the coding language of your assistant, since each language takes different folder structures that need to be taken into consideration. ```bash -botskills update --botName YOUR_BOT_NAME --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder [path] --cs +botskills update --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder [path] --cs ``` ## Refresh Connected Skills diff --git a/docs/_docs/reference/knownissues.md b/docs/_docs/reference/knownissues.md index 612ccf66bf..2a509d0414 100644 --- a/docs/_docs/reference/knownissues.md +++ b/docs/_docs/reference/knownissues.md @@ -145,7 +145,7 @@ There is a known issue in the `Botskills` CLI tool during the command's executio Example of the `connect` command with a trailing backslash in the `luisFolder` argument: ``` bash -botskills connect --botName "" --localManifest "" --luisFolder "/" --ts +botskills connect --localManifest "" --luisFolder "/" --ts ``` So, to avoid this, it's highly recommended to use `PowerShell 6` to execute the CLI tool commands. Also, you can remove the trailing backslash of the argument. diff --git a/docs/_docs/reference/skills/botskills.md b/docs/_docs/reference/skills/botskills.md index f8ee96f21a..2ccc137dba 100644 --- a/docs/_docs/reference/skills/botskills.md +++ b/docs/_docs/reference/skills/botskills.md @@ -46,7 +46,7 @@ The `connect` command allows you to connect a Skill, be it local or remote, to y Here is an example: ```bash -botskills connect --botName --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder --cs +botskills connect --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder --cs ``` *Remember to re-publish your Assistant to Azure after you've added a Skill unless you plan on testing locally only* @@ -70,7 +70,7 @@ The `update` command allows you to update a Skill, be it local or remote, to you Here is an example: ```bash -botskills update --botName --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder --cs +botskills update --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder --cs ``` For further information, see the [Update command documentation]({{site.repo}}/tree/master/tools/botskills/docs/update.md). diff --git a/docs/_docs/tutorials/add-prebuilt-skill/4_connect_skill.md b/docs/_docs/tutorials/add-prebuilt-skill/4_connect_skill.md index f6204a5d1b..71cee9561c 100644 --- a/docs/_docs/tutorials/add-prebuilt-skill/4_connect_skill.md +++ b/docs/_docs/tutorials/add-prebuilt-skill/4_connect_skill.md @@ -17,7 +17,7 @@ To add your new Skill to your assistant/Bot we provide a `botskills` command lin Run the following command from a command prompt **within the directory of your assistant/Bot**. ```bash -botskills connect --botName YOUR_BOT_NAME --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder "\Deployment\Resources\LU\en\" --cs +botskills connect --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder "\Deployment\Resources\LU\en\" --cs ``` **Remember to re-publish your Assistant to Azure after you've added a Skill unless you plan on testing locally only** diff --git a/docs/_docs/tutorials/csharp/create-skill/6_add_your_skill.md b/docs/_docs/tutorials/csharp/create-skill/6_add_your_skill.md index f84f44b0af..3634085e73 100644 --- a/docs/_docs/tutorials/csharp/create-skill/6_add_your_skill.md +++ b/docs/_docs/tutorials/csharp/create-skill/6_add_your_skill.md @@ -19,7 +19,7 @@ To add your new Skill to your assistant/Bot we provide a `botskills` command lin Run the following command from a command prompt **within the directory of your assistant/Bot**. ```bash -botskills connect --botName YOUR_BOT_NAME --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder "/Deployment/Resources/LU/en/" --cs +botskills connect --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder "/Deployment/Resources/LU/en/" --cs ``` See the [Adding Skills]({{site.baseurl}}/howto/skills/addingskills) for more detail on how to add skills. \ No newline at end of file diff --git a/docs/_docs/tutorials/typescript/create-skill/6_add_your_skill.md b/docs/_docs/tutorials/typescript/create-skill/6_add_your_skill.md index 3c450a46be..18478fcb8b 100644 --- a/docs/_docs/tutorials/typescript/create-skill/6_add_your_skill.md +++ b/docs/_docs/tutorials/typescript/create-skill/6_add_your_skill.md @@ -19,7 +19,7 @@ To add your new Skill to your assistant/Bot we provide a `botskills` command lin Run the following command from a command prompt **within the directory of your assistant/Bot**. ```bash -botskills connect --botName YOUR_BOT_NAME --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder "/Deployment/Resources/LU/en/" --cs +botskills connect --remoteManifest "http://.azurewebsites.net/api/skill/manifest" --luisFolder "/Deployment/Resources/LU/en/" --cs ``` See the [Adding Skills]({{site.baseurl}}/howto/skills/addingskills) for more detail on how to add skills. \ No newline at end of file diff --git a/tools/botskills/docs/connect.md b/tools/botskills/docs/connect.md index fb45f2928f..e09922999c 100644 --- a/tools/botskills/docs/connect.md +++ b/tools/botskills/docs/connect.md @@ -35,7 +35,6 @@ For Skills that require other Authentication connection configuration please fol | Option | Description | |-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| -b, --botName \ | Name of your Virtual Assistant bot | | -l, --localManifest \ | Path to local Skill Manifest file | | -r, --remoteManifest \ | URL to remote Skill Manifest | | --cs | Determine your Virtual Assistant project structure to be a csharp-like structure | diff --git a/tools/botskills/docs/refresh.md b/tools/botskills/docs/refresh.md index 0c3070786e..5632931abf 100644 --- a/tools/botskills/docs/refresh.md +++ b/tools/botskills/docs/refresh.md @@ -18,7 +18,6 @@ botskills refresh [options] | --ts | Determine your Virtual Assistant project structure to be a TypeScript-like structure | | --dispatchName [name] | (OPTIONAL) Name of your Virtual Assistant's '.dispatch' file (defaults to the name displayed in your Cognitive Models file) | | --language [language] | (OPTIONAL) Locale used for LUIS culture (defaults to 'en-us') | -| --luisFolder [path] | (OPTIONAL) Path to the folder containing your Skills' '.lu' files (defaults to './deployment/resources/skills/en' inside your Virtual Assistant folder) | | --dispatchFolder [path] | (OPTIONAL) Path to the folder containing your Virtual Assistant's '.dispatch' file (defaults to './deployment/resources/dispatch/en' inside your Virtual Assistant folder) | | --outFolder [path] | (OPTIONAL) Path for any output file that may be generated (defaults to your Virtual Assistant's root folder) | | --lgOutFolder [path] | (OPTIONAL) Path for the LuisGen output (defaults to a 'service' folder inside your Virtual Assistant's folder) | diff --git a/tools/botskills/docs/update.md b/tools/botskills/docs/update.md index b7ab31e264..feeaad58ef 100644 --- a/tools/botskills/docs/update.md +++ b/tools/botskills/docs/update.md @@ -14,7 +14,6 @@ botskills update [options] | Option | Description | |-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| -b, --botName \ | Name of your Virtual Assistant bot | | -l, --localManifest \ | Path to local Skill Manifest file | | -r, --remoteManifest \ | URL to remote Skill Manifest | | --cs | Determine your Virtual Assistant project structure to be a csharp-like structure | diff --git a/tools/botskills/src/botskills-connect.ts b/tools/botskills/src/botskills-connect.ts index 8092ddf8b3..8eb34ab335 100644 --- a/tools/botskills/src/botskills-connect.ts +++ b/tools/botskills/src/botskills-connect.ts @@ -8,7 +8,7 @@ import { existsSync, readFileSync } from 'fs'; import { extname, isAbsolute, join, resolve } from 'path'; import { ConnectSkill } from './functionality'; import { ConsoleLogger, ILogger } from './logger'; -import { ICognitiveModelFile, IConnectConfiguration } from './models'; +import { IAppSetting, ICognitiveModel, IConnectConfiguration } from './models'; import { sanitizePath, validatePairOfArgs } from './utils'; function showErrorHelp(): void { @@ -31,7 +31,6 @@ program.Command.prototype.unknownOption = (flag: string): void => { program .name('botskills connect') .description('Connect a skill to your assistant bot. Only one of both path or URL to Skill is needed.') - .option('-b, --botName ', 'Name of your assistant bot') .option('-l, --localManifest ', 'Path to local Skill Manifest file') .option('-r, --remoteManifest ', 'URL to remote Skill Manifest') .option('--cs', 'Determine your assistant project structure to be a CSharp-like structure') @@ -57,8 +56,23 @@ if (process.argv.length < 3) { process.exit(0); } -logger.isVerbose = args.verbose; +let botName: string = ''; +let localManifest: string; +let remoteManifest: string; let noRefresh: boolean = false; +let dispatchName: string; +let language: string; +let luisFolder: string; +let dispatchFolder: string; +let outFolder: string; +let lgOutFolder: string; +let skillsFile: string = ''; +let resourceGroup: string = ''; +let appSettingsFile: string; +let cognitiveModelsFile: string; +let lgLanguage: string; + +logger.isVerbose = args.verbose; // Validation of arguments // cs and ts validation @@ -71,19 +85,13 @@ if (csAndTsValidationResult) { process.exit(1); } -const projectLanguage: string = args.cs ? 'cs' : 'ts'; +lgLanguage = args.cs ? 'cs' : 'ts'; // noRefresh validation if (args.noRefresh) { noRefresh = true; } -// botName validation -if (!args.botName) { - logger.error(`The 'botName' argument should be provided.`); - process.exit(1); -} - // localManifest && remoteManifest validation const manifestValidationResult: string = validatePairOfArgs(args.localManifest, args.remoteManifest); if (manifestValidationResult) { @@ -98,22 +106,15 @@ if (args.localManifest && extname(args.localManifest) !== '.json') { process.exit(1); } -// Initialize an instance of IConnectConfiguration to send the needed arguments to the connectSkill function -const configuration: Partial = { - botName: args.botName, - localManifest: args.localManifest, - remoteManifest: args.remoteManifest, - noRefresh: noRefresh, - lgLanguage: projectLanguage -}; +localManifest = args.localManifest; +remoteManifest = args.remoteManifest; -// outFolder validation -- the const is needed for reassuring 'configuration.outFolder' is not undefined -const outFolder: string = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); -configuration.outFolder = outFolder; +// outFolder validation -- the var is needed for reassuring 'configuration.outFolder' is not undefined +outFolder = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); // skillsFile validation if (!args.skillsFile) { - configuration.skillsFile = join(configuration.outFolder, (args.ts ? join('src', 'skills.json') : 'skills.json')); + skillsFile = join(outFolder, (args.ts ? join('src', 'skills.json') : 'skills.json')); } else if (extname(args.skillsFile) !== '.json') { logger.error(`The 'skillsFile' argument should be a JSON file.`); process.exit(1); @@ -124,44 +125,69 @@ if (!args.skillsFile) { Please make sure to provide a valid path to your Assistant Skills configuration file using the '--skillsFile' argument.`); process.exit(1); } - configuration.skillsFile = skillsFilePath; + skillsFile = skillsFilePath; } -// resourceGroup validation -configuration.resourceGroup = args.resourceGroup || configuration.botName; - // appSettingsFile validation -configuration.appSettingsFile = args.appSettingsFile || join(configuration.outFolder, (args.ts ? join('src', 'appsettings.json') : 'appsettings.json')); +appSettingsFile = args.appSettingsFile || join(outFolder, (args.ts ? join('src', 'appsettings.json') : 'appsettings.json')); + +// validate the existence of the appsettings file +if (appSettingsFile !== undefined) { + const appSettings: IAppSetting = JSON.parse(readFileSync(appSettingsFile, 'UTF8')); + // use botWebAppName and resourceGroupName properties from appsettings file + botName = appSettings.botWebAppName; + resourceGroup = appSettings.resourceGroupName; +} else { + logger.error(`The 'appSettings' file doesn't exist`); + process.exit(1); +} // cognitiveModelsFile validation -const cognitiveModelsFilePath: string = args.cognitiveModelsFile || join(configuration.outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); -configuration.cognitiveModelsFile = cognitiveModelsFilePath; +const cognitiveModelsFilePath: string = args.cognitiveModelsFile || join(outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); +cognitiveModelsFile = cognitiveModelsFilePath; // language validation -const language: string = args.language || 'en-us'; -configuration.language = language; +language = args.language || 'en-us'; const languageCode: string = (language.split('-'))[0]; // luisFolder validation -configuration.luisFolder = args.luisFolder ? sanitizePath(args.luisFolder) : join(configuration.outFolder, 'Deployment', 'Resources', 'Skills', languageCode); +luisFolder = args.luisFolder ? sanitizePath(args.luisFolder) : join(outFolder, 'Deployment', 'Resources', 'Skills', languageCode); // dispatchFolder validation -configuration.dispatchFolder = args.dispatchFolder ? sanitizePath(args.dispatchFolder) : join(configuration.outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); +dispatchFolder = args.dispatchFolder ? sanitizePath(args.dispatchFolder) : join(outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); // lgOutFolder validation -configuration.lgOutFolder = args.lgOutFolder ? sanitizePath(args.lgOutFolder) : join(configuration.outFolder, (args.ts ? join('src', 'Services') : 'Services')); +lgOutFolder = args.lgOutFolder ? sanitizePath(args.lgOutFolder) : join(outFolder, (args.ts ? join('src', 'Services') : 'Services')); // dispatchName validation if (!args.dispatchName) { // try get the dispatch name from the cognitiveModels file - const cognitiveModelsFile: ICognitiveModelFile = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); - configuration.dispatchName = cognitiveModelsFile.cognitiveModels[languageCode].dispatchModel.name; + const cognitiveModels: ICognitiveModel = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); + dispatchName = cognitiveModels.cognitiveModels[languageCode].dispatchModel.name; } else { - configuration.dispatchName = args.dispatchName; + dispatchName = args.dispatchName; } -configuration.logger = logger; - // End of arguments validation -new ConnectSkill(logger).connectSkill( configuration); +// Initialize an instance of IConnectConfiguration to send the needed arguments to the connectSkill function +const configuration: IConnectConfiguration = { + botName: botName, + localManifest: localManifest, + remoteManifest: remoteManifest, + noRefresh: noRefresh, + dispatchName: dispatchName, + language: language, + luisFolder: luisFolder, + dispatchFolder: dispatchFolder, + outFolder: outFolder, + lgOutFolder: lgOutFolder, + skillsFile: skillsFile, + resourceGroup: resourceGroup, + appSettingsFile: appSettingsFile, + cognitiveModelsFile: cognitiveModelsFile, + lgLanguage: lgLanguage, + logger: logger +}; + +new ConnectSkill(logger).connectSkill(configuration); diff --git a/tools/botskills/src/botskills-disconnect.ts b/tools/botskills/src/botskills-disconnect.ts index d1869fcaeb..c37c335337 100644 --- a/tools/botskills/src/botskills-disconnect.ts +++ b/tools/botskills/src/botskills-disconnect.ts @@ -8,7 +8,7 @@ import { existsSync, readFileSync } from 'fs'; import { extname, isAbsolute, join, resolve } from 'path'; import { DisconnectSkill } from './functionality'; import { ConsoleLogger, ILogger} from './logger'; -import { ICognitiveModelFile, IDisconnectConfiguration } from './models'; +import { ICognitiveModel, IDisconnectConfiguration } from './models'; import { sanitizePath, validatePairOfArgs } from './utils'; function showErrorHelp(): void { @@ -49,10 +49,21 @@ const args: program.Command = program.parse(process.argv); if (process.argv.length < 3) { program.help(); + process.exit(0); } -logger.isVerbose = args.verbose; +let skillId: string = ''; +let skillsFile: string = ''; +let outFolder: string; let noRefresh: boolean = false; +let cognitiveModelsFile: string; +let language: string; +let dispatchFolder: string; +let lgOutFolder: string; +let dispatchName: string; +let lgLanguage: string; + +logger.isVerbose = args.verbose; // Validation of arguments // cs and ts validation @@ -64,7 +75,7 @@ if (csAndTsValidationResult) { ); process.exit(1); } -const projectLanguage: string = args.cs ? 'cs' : 'ts'; +lgLanguage = args.cs ? 'cs' : 'ts'; // noRefresh validation if (args.noRefresh) { @@ -77,20 +88,13 @@ if (!args.skillId) { process.exit(1); } -const configuration: Partial = { - skillId: args.skillId, - lgLanguage: projectLanguage, - noRefresh: noRefresh, - logger: logger -}; - -// outFolder validation -- the const is needed for reassuring 'configuration.outFolder' is not undefined -const outFolder: string = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); -configuration.outFolder = outFolder; +skillId = args.skillId; +// outFolder validation -- the var is needed for reassuring 'configuration.outFolder' is not undefined +outFolder = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); // skillsFile validation if (!args.skillsFile) { - configuration.skillsFile = join(configuration.outFolder, (args.ts ? join('src', 'skills.json') : 'skills.json')); + skillsFile = join(outFolder, (args.ts ? join('src', 'skills.json') : 'skills.json')); } else if (extname(args.skillsFile) !== '.json') { logger.error(`The 'skillsFile' argument should be a JSON file.`); process.exit(1); @@ -101,35 +105,49 @@ if (!args.skillsFile) { Please make sure to provide a valid path to your Assistant Skills configuration file using the '--skillsFile' argument.`); process.exit(1); } - configuration.skillsFile = skillsFilePath; + skillsFile = skillsFilePath; } // cognitiveModelsFile validation const cognitiveModelsFilePath: string = args.cognitiveModelsFile || join( - configuration.outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); -configuration.cognitiveModelsFile = cognitiveModelsFilePath; + outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); +cognitiveModelsFile = cognitiveModelsFilePath; // language validation -const language: string = args.language || 'en-us'; -configuration.language = language; +language = args.language || 'en-us'; const languageCode: string = (language.split('-'))[0]; // dispatchFolder validation -configuration.dispatchFolder = args.dispatchFolder ? - sanitizePath(args.dispatchFolder) : join(configuration.outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); +dispatchFolder = args.dispatchFolder ? + sanitizePath(args.dispatchFolder) : join(outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); // lgOutFolder validation -configuration.lgOutFolder = args.lgOutFolder ? - sanitizePath(args.lgOutFolder) : join(configuration.outFolder, (args.ts ? join('src', 'Services') : 'Services')); +lgOutFolder = args.lgOutFolder ? + sanitizePath(args.lgOutFolder) : join(outFolder, (args.ts ? join('src', 'Services') : 'Services')); // dispatchName validation if (!args.dispatchName) { // try get the dispatch name from the cognitiveModels file // tslint:disable-next-line - const cognitiveModelsFile: ICognitiveModelFile = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); - configuration.dispatchName = cognitiveModelsFile.cognitiveModels[languageCode].dispatchModel.name; + const cognitiveModels: ICognitiveModel = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); + dispatchName = cognitiveModels.cognitiveModels[languageCode].dispatchModel.name; } else { - configuration.dispatchName = args.dispatchName; + dispatchName = args.dispatchName; } -new DisconnectSkill(logger).disconnectSkill( configuration); +// Initialize an instance of IDisconnectConfiguration to send the needed arguments to the disconnectSkill function +const configuration: IDisconnectConfiguration = { + skillId: skillId, + skillsFile: skillsFile, + outFolder: outFolder, + noRefresh: noRefresh, + cognitiveModelsFile: cognitiveModelsFile, + language: language, + dispatchFolder: dispatchFolder, + lgOutFolder: lgOutFolder, + dispatchName: dispatchName, + lgLanguage: lgLanguage, + logger: logger +}; + +new DisconnectSkill(logger).disconnectSkill(configuration); diff --git a/tools/botskills/src/botskills-list.ts b/tools/botskills/src/botskills-list.ts index 3aa74d5a70..e2c096cda1 100644 --- a/tools/botskills/src/botskills-list.ts +++ b/tools/botskills/src/botskills-list.ts @@ -19,9 +19,9 @@ function showErrorHelp(): void { process.exit(1); } -function checkSkillsFile(skillsFile: string): boolean { - const skillsFilePath: string = isAbsolute(skillsFile) ? skillsFile : join(resolve('./'), skillsFile); - if (!existsSync(skillsFilePath)) { +function existFile(file: string): boolean { + const filePath: string = isAbsolute(file) ? file : join(resolve('./'), file); + if (!existsSync(filePath)) { return false; } @@ -45,14 +45,16 @@ program const args: program.Command = program.parse(process.argv); +let skillsFile: string = ''; + logger.isVerbose = args.verbose; // skillsFile validation if (!args.skillsFile) { args.skillsFile = join('src', 'skills.json'); - if (!checkSkillsFile(args.skillsFile)) { + if (!existFile(args.skillsFile)) { args.skillsFile = 'skills.json'; - if (!checkSkillsFile(args.skillsFile)) { + if (!existFile(args.skillsFile)) { logger.error(`The 'skillsFile' argument is absent or leads to a non-existing file. Please make sure to provide a valid path to your Assistant Skills configuration file using the '--skillsFile' argument.`); process.exit(1); @@ -62,15 +64,18 @@ Please make sure to provide a valid path to your Assistant Skills configuration logger.error(`The 'skillsFile' argument should be a JSON file.`); process.exit(1); } else { - if (!checkSkillsFile(args.skillsFile)) { + if (!existFile(args.skillsFile)) { logger.error(`The 'skillsFile' argument is absent or leads to a non-existing file. Please make sure to provide a valid path to your Assistant Skills configuration file using the '--skillsFile' argument.`); process.exit(1); } } +skillsFile = isAbsolute(args.skillsFile) ? args.skillsFile : join(resolve('./'), args.skillsFile); + +// Initialize an instance of IListConfiguration to send the needed arguments to the listSkill function const configuration: IListConfiguration = { - skillsFile: isAbsolute(args.skillsFile) ? args.skillsFile : join(resolve('./'), args.skillsFile), + skillsFile: skillsFile, logger: logger }; diff --git a/tools/botskills/src/botskills-refresh.ts b/tools/botskills/src/botskills-refresh.ts index 044416edf8..e188a718c9 100644 --- a/tools/botskills/src/botskills-refresh.ts +++ b/tools/botskills/src/botskills-refresh.ts @@ -8,7 +8,7 @@ import { readFileSync } from 'fs'; import { join, resolve } from 'path'; import { RefreshSkill } from './functionality'; import { ConsoleLogger, ILogger} from './logger'; -import { ICognitiveModelFile, IRefreshConfiguration } from './models'; +import { ICognitiveModel, IRefreshConfiguration } from './models'; import { sanitizePath, validatePairOfArgs } from './utils'; function showErrorHelp(): void { @@ -35,7 +35,6 @@ program .option('--ts', 'Determine your assistant project structure to be a TypeScript-like structure') .option('--dispatchName [name]', '[OPTIONAL] Name of your assistant\'s \'.dispatch\' file (defaults to the name displayed in your Cognitive Models file)') .option('--language [language]', '[OPTIONAL] Locale used for LUIS culture (defaults to \'en-us\')') - .option('--luisFolder [path]', '[OPTIONAL] Path to the folder containing your Skills\' .lu files (defaults to \'./deployment/resources/skills/en\' inside your assistant folder)') .option('--dispatchFolder [path]', '[OPTIONAL] Path to the folder containing your assistant\'s \'.dispatch\' file (defaults to \'./deployment/resources/dispatch/en\' inside your assistant folder)') .option('--outFolder [path]', '[OPTIONAL] Path for any output file that may be generated (defaults to your assistant\'s root folder)') .option('--lgOutFolder [path]', '[OPTIONAL] Path for the LuisGen output (defaults to a \'service\' folder inside your assistant\'s folder)') @@ -47,8 +46,17 @@ const args: program.Command = program.parse(process.argv); if (process.argv.length < 3) { program.help(); + process.exit(0); } +let dispatchName: string; +let dispatchFolder: string; +let language: string; +let lgLanguage: string; +let outFolder: string; +let lgOutFolder: string; +let cognitiveModelsFile: string; + logger.isVerbose = args.verbose; // Validation of arguments @@ -62,43 +70,46 @@ if (csAndTsValidationResult) { process.exit(1); } -const projectLanguage: string = args.cs ? 'cs' : 'ts'; -// Initialize an instance of IConnectConfiguration to send the needed arguments to the connectSkill function -const configuration: Partial = { - lgLanguage: projectLanguage -}; +lgLanguage = args.cs ? 'cs' : 'ts'; // language validation -const language: string = args.language || 'en-us'; -configuration.language = language; +language = args.language || 'en-us'; const languageCode: string = (language.split('-'))[0]; -// outFolder validation -- the const is needed for reassuring 'configuration.outFolder' is not undefined -const outFolder: string = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); -configuration.outFolder = outFolder; +// outFolder validation -- the var is needed for reassuring 'configuration.outFolder' is not undefined +outFolder = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); // cognitiveModelsFile validation -const cognitiveModelsFilePath: string = args.cognitiveModelsFile || join(configuration.outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); -configuration.cognitiveModelsFile = cognitiveModelsFilePath; -// luisFolder validation -configuration.luisFolder = args.luisFolder ? sanitizePath(args.luisFolder) : join(configuration.outFolder, 'Deployment', 'Resources', 'Skills', languageCode); +const cognitiveModelsFilePath: string = args.cognitiveModelsFile || join(outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); +cognitiveModelsFile = cognitiveModelsFilePath; // dispatchFolder validation -configuration.dispatchFolder = args.dispatchFolder ? sanitizePath(args.dispatchFolder) : join(configuration.outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); +dispatchFolder = args.dispatchFolder ? sanitizePath(args.dispatchFolder) : join(outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); // lgOutFolder validation -configuration.lgOutFolder = args.lgOutFolder ? sanitizePath(args.lgOutFolder) : join(configuration.outFolder, (args.ts ? join('src', 'Services') : 'Services')); +lgOutFolder = args.lgOutFolder ? sanitizePath(args.lgOutFolder) : join(outFolder, (args.ts ? join('src', 'Services') : 'Services')); // dispatchName validation if (!args.dispatchName) { // try get the dispatch name from the cognitiveModels file - const cognitiveModelsFile: ICognitiveModelFile = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); - configuration.dispatchName = cognitiveModelsFile.cognitiveModels[languageCode].dispatchModel.name; + const cognitiveModels: ICognitiveModel = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); + dispatchName = cognitiveModels.cognitiveModels[languageCode].dispatchModel.name; } else { - configuration.dispatchName = args.dispatchName; + dispatchName = args.dispatchName; } -configuration.logger = logger; // End of arguments validation -new RefreshSkill(logger).refreshSkill( configuration); +// Initialize an instance of IRefreshConfiguration to send the needed arguments to the refreshskill function +const configuration: IRefreshConfiguration = { + dispatchName: dispatchName, + dispatchFolder: dispatchFolder, + language: language, + lgLanguage: lgLanguage, + outFolder: outFolder, + lgOutFolder: lgOutFolder, + cognitiveModelsFile: cognitiveModelsFile, + logger: logger +}; + +new RefreshSkill(logger).refreshSkill(configuration); diff --git a/tools/botskills/src/botskills-update.ts b/tools/botskills/src/botskills-update.ts index 4369203657..413549eb39 100644 --- a/tools/botskills/src/botskills-update.ts +++ b/tools/botskills/src/botskills-update.ts @@ -8,7 +8,7 @@ import { existsSync, readFileSync } from 'fs'; import { extname, isAbsolute, join, resolve } from 'path'; import { UpdateSkill } from './functionality'; import { ConsoleLogger, ILogger } from './logger'; -import { ICognitiveModelFile, IUpdateConfiguration } from './models'; +import { IAppSetting, ICognitiveModel, IUpdateConfiguration } from './models'; import { sanitizePath, validatePairOfArgs } from './utils'; function showErrorHelp(): void { @@ -31,12 +31,11 @@ program.Command.prototype.unknownOption = (flag: string): void => { program .name('botskills update') .description('Update a specific skill from your assistant bot.') - .option('-b, --botName ', 'Name of your assistant bot') .option('-l, --localManifest ', 'Path to local Skill Manifest file') .option('-r, --remoteManifest ', 'URL to remote Skill Manifest') .option('--cs', 'Determine your assistant project structure to be a CSharp-like structure') .option('--ts', 'Determine your assistant project structure to be a TypeScript-like structure') - .option('--noRefresh', '[OPTIONAL] Determine whether the model of your skills connected are not going to be trained (by default they are trained)') + .option('--noRefresh', '[OPTIONAL] Determine whether the model of your skills connected are not going to be refreshed (by default they are refreshed)') .option('--dispatchName [name]', '[OPTIONAL] Name of your assistant\'s \'.dispatch\' file (defaults to the name displayed in your Cognitive Models file)') .option('--language [language]', '[OPTIONAL] Locale used for LUIS culture (defaults to \'en-us\')') .option('--luisFolder [path]', '[OPTIONAL] Path to the folder containing your Skills\' .lu files (defaults to \'./deployment/resources/skills/en\' inside your assistant folder)') @@ -57,8 +56,24 @@ if (process.argv.length < 3) { process.exit(0); } -logger.isVerbose = args.verbose; +const skillId: string = ''; +let botName: string = ''; +let localManifest: string; +let remoteManifest: string; let noRefresh: boolean = false; +let dispatchName: string; +let language: string; +let luisFolder: string; +let dispatchFolder: string; +let outFolder: string; +let lgOutFolder: string; +let skillsFile: string = ''; +let resourceGroup: string = ''; +let appSettingsFile: string; +let cognitiveModelsFile: string; +let lgLanguage: string; + +logger.isVerbose = args.verbose; // Validation of arguments // cs and ts validation @@ -71,7 +86,7 @@ if (csAndTsValidationResult) { process.exit(1); } -const projectLanguage: string = args.cs ? 'cs' : 'ts'; +lgLanguage = args.cs ? 'cs' : 'ts'; // noRefresh validation if (args.noRefresh) { @@ -92,23 +107,15 @@ if (args.localManifest && extname(args.localManifest) !== '.json') { process.exit(1); } -// Initialize an instance of IUpdateConfiguration to send the needed arguments to the updateSkill function -const configuration: Partial = { - botName: args.botName, - localManifest: args.localManifest, - remoteManifest: args.remoteManifest, - noRefresh: noRefresh, - logger: logger, - lgLanguage: projectLanguage -}; +localManifest = args.localManifest; +remoteManifest = args.remoteManifest; -// outFolder validation -- the const is needed for reassuring 'configuration.outFolder' is not undefined -const outFolder: string = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); -configuration.outFolder = outFolder; +// outFolder validation -- the var is needed for reassuring 'configuration.outFolder' is not undefined +outFolder = args.outFolder ? sanitizePath(args.outFolder) : resolve('./'); // skillsFile validation if (!args.skillsFile) { - configuration.skillsFile = join(configuration.outFolder, (args.ts ? join('src', 'skills.json') : 'skills.json')); + skillsFile = join(outFolder, (args.ts ? join('src', 'skills.json') : 'skills.json')); } else if (extname(args.skillsFile) !== '.json') { logger.error(`The 'skillsFile' argument should be a JSON file.`); process.exit(1); @@ -119,44 +126,70 @@ if (!args.skillsFile) { Please make sure to provide a valid path to your Assistant Skills configuration file using the '--skillsFile' argument.`); process.exit(1); } - configuration.skillsFile = skillsFilePath; + skillsFile = skillsFilePath; } -// resourceGroup validation -configuration.resourceGroup = args.resourceGroup || configuration.botName; - // appSettingsFile validation -configuration.appSettingsFile = args.appSettingsFile || join(configuration.outFolder, (args.ts ? join('src', 'appsettings.json') : 'appsettings.json')); +appSettingsFile = args.appSettingsFile || join(outFolder, (args.ts ? join('src', 'appsettings.json') : 'appsettings.json')); + +// validate the existence of the appsettings file +if (appSettingsFile !== undefined) { + const appSettings: IAppSetting = JSON.parse(readFileSync(appSettingsFile, 'UTF8')); + // use botWebAppName and resourceGroupName properties from appsettings file + botName = appSettings.botWebAppName; + resourceGroup = appSettings.resourceGroupName; +} else { + logger.error(`The 'appSettings' file doesn't exist`); + process.exit(1); +} // cognitiveModelsFile validation -const cognitiveModelsFilePath: string = args.cognitiveModelsFile || join(configuration.outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); -configuration.cognitiveModelsFile = cognitiveModelsFilePath; +const cognitiveModelsFilePath: string = args.cognitiveModelsFile || join(outFolder, (args.ts ? join('src', 'cognitivemodels.json') : 'cognitivemodels.json')); +cognitiveModelsFile = cognitiveModelsFilePath; // language validation -const language: string = args.language || 'en-us'; -configuration.language = language; +language = args.language || 'en-us'; const languageCode: string = (language.split('-'))[0]; // luisFolder validation -configuration.luisFolder = args.luisFolder ? sanitizePath(args.luisFolder) : join(configuration.outFolder, 'Deployment', 'Resources', 'Skills', languageCode); +luisFolder = args.luisFolder ? sanitizePath(args.luisFolder) : join(outFolder, 'Deployment', 'Resources', 'Skills', languageCode); // dispatchFolder validation -configuration.dispatchFolder = args.dispatchFolder ? sanitizePath(args.dispatchFolder) : join(configuration.outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); +dispatchFolder = args.dispatchFolder ? sanitizePath(args.dispatchFolder) : join(outFolder, 'Deployment', 'Resources', 'Dispatch', languageCode); // lgOutFolder validation -configuration.lgOutFolder = args.lgOutFolder ? sanitizePath(args.lgOutFolder) : join(configuration.outFolder, (args.ts ? join('src', 'Services') : 'Services')); +lgOutFolder = args.lgOutFolder ? sanitizePath(args.lgOutFolder) : join(outFolder, (args.ts ? join('src', 'Services') : 'Services')); // dispatchName validation if (!args.dispatchName) { // try get the dispatch name from the cognitiveModels file - const cognitiveModelsFile: ICognitiveModelFile = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); - configuration.dispatchName = cognitiveModelsFile.cognitiveModels[languageCode].dispatchModel.name; + const cognitiveModels: ICognitiveModel = JSON.parse(readFileSync(cognitiveModelsFilePath, 'UTF8')); + dispatchName = cognitiveModels.cognitiveModels[languageCode].dispatchModel.name; } else { - configuration.dispatchName = args.dispatchName; + dispatchName = args.dispatchName; } -configuration.logger = logger; - // End of arguments validation -new UpdateSkill(logger).updateSkill( configuration); +// Initialize an instance of IUpdateConfiguration to send the needed arguments to the updateSkill function +const configuration: IUpdateConfiguration = { + skillId: skillId, + botName: botName, + localManifest: localManifest, + remoteManifest: remoteManifest, + noRefresh: noRefresh, + dispatchName: dispatchName, + language: language, + luisFolder: luisFolder, + dispatchFolder: dispatchFolder, + outFolder: outFolder, + lgOutFolder: lgOutFolder, + skillsFile: skillsFile, + resourceGroup: resourceGroup, + appSettingsFile: appSettingsFile, + cognitiveModelsFile: cognitiveModelsFile, + lgLanguage: lgLanguage, + logger: logger +}; + +new UpdateSkill(logger).updateSkill(configuration); diff --git a/tools/botskills/src/functionality/updateSkill.ts b/tools/botskills/src/functionality/updateSkill.ts index 305b5e0cc9..5411c7e564 100644 --- a/tools/botskills/src/functionality/updateSkill.ts +++ b/tools/botskills/src/functionality/updateSkill.ts @@ -81,7 +81,7 @@ Please make sure to provide a valid path to your Skill manifest using the '--loc ? `--localManifest "${configuration.localManifest}"` : `--remoteManifest "${configuration.remoteManifest}"`; // tslint:disable: max-line-length - throw new Error(`The Skill doesn't exist in the Assistant, run 'botskills connect --botName ${configuration.botName} ${manifestParameter} --luisFolder "${configuration.luisFolder}" --${configuration.lgLanguage}'`); + throw new Error(`The Skill doesn't exist in the Assistant, run 'botskills connect ${manifestParameter} --luisFolder "${configuration.luisFolder}" --${configuration.lgLanguage}'`); } return true; diff --git a/tools/botskills/src/models/appSetting.ts b/tools/botskills/src/models/appSetting.ts new file mode 100644 index 0000000000..1cadd297b5 --- /dev/null +++ b/tools/botskills/src/models/appSetting.ts @@ -0,0 +1,14 @@ +/** + * Copyright(c) Microsoft Corporation.All rights reserved. + * Licensed under the MIT License. + */ + +import { IOauthConnection } from './authentication'; + +export interface IAppSetting { + oauthConnections: IOauthConnection[]; + microsoftAppId: string; + microsoftAppPassword: string; + botWebAppName: string; + resourceGroupName: string; +} diff --git a/tools/botskills/src/models/authentication.ts b/tools/botskills/src/models/authentication.ts index af1669767c..abe1a7fbe7 100644 --- a/tools/botskills/src/models/authentication.ts +++ b/tools/botskills/src/models/authentication.ts @@ -40,12 +40,6 @@ export interface IAzureAuthSetting { type: string; } -export interface IAppSettingOauthConnection { - oauthConnections: IOauthConnection[]; - microsoftAppId: string; - microsoftAppPassword: string; -} - export interface IOauthConnection { name: string; provider: string; diff --git a/tools/botskills/src/models/cognitiveFile.ts b/tools/botskills/src/models/cognitiveModel.ts similarity index 86% rename from tools/botskills/src/models/cognitiveFile.ts rename to tools/botskills/src/models/cognitiveModel.ts index 0c344c68a1..5e818be8f3 100644 --- a/tools/botskills/src/models/cognitiveFile.ts +++ b/tools/botskills/src/models/cognitiveModel.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -export interface ICognitiveModelFile { +export interface ICognitiveModel { cognitiveModels: { [key: string]: { dispatchModel: { diff --git a/tools/botskills/src/models/disconnectConfiguration.ts b/tools/botskills/src/models/disconnectConfiguration.ts index d1b81f765a..0e0cfcc1a2 100644 --- a/tools/botskills/src/models/disconnectConfiguration.ts +++ b/tools/botskills/src/models/disconnectConfiguration.ts @@ -12,7 +12,6 @@ export interface IDisconnectConfiguration { noRefresh: boolean; cognitiveModelsFile: string; language: string; - luisFolder: string; dispatchFolder: string; lgOutFolder: string; dispatchName: string; diff --git a/tools/botskills/src/models/index.ts b/tools/botskills/src/models/index.ts index 729c4e6a6e..2f75a54f1d 100644 --- a/tools/botskills/src/models/index.ts +++ b/tools/botskills/src/models/index.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. */ +export { IAppSetting } from './appSetting'; export { - IAppSettingOauthConnection, IAppShowReplyUrl, IAzureAuthSetting, IOauthConnection, IResourceAccess, IScopeManifest } from './authentication'; -export { ICognitiveModelFile } from './cognitiveFile'; +export { ICognitiveModel } from './cognitiveModel'; export { IConnectConfiguration } from './connectConfiguration'; export { IDisconnectConfiguration } from './disconnectConfiguration'; export { IUpdateConfiguration } from './updateConfiguration'; diff --git a/tools/botskills/src/models/refreshConfiguration.ts b/tools/botskills/src/models/refreshConfiguration.ts index ae0e2dd5fa..1437058e42 100644 --- a/tools/botskills/src/models/refreshConfiguration.ts +++ b/tools/botskills/src/models/refreshConfiguration.ts @@ -9,7 +9,6 @@ export interface IRefreshConfiguration { dispatchName: string; dispatchFolder: string; language: string; - luisFolder: string; lgLanguage: string; outFolder: string; lgOutFolder: string; diff --git a/tools/botskills/src/utils/authenticationUtils.ts b/tools/botskills/src/utils/authenticationUtils.ts index 30ee6ae3aa..f347e2683f 100644 --- a/tools/botskills/src/utils/authenticationUtils.ts +++ b/tools/botskills/src/utils/authenticationUtils.ts @@ -6,7 +6,7 @@ import { readFileSync, writeFileSync } from 'fs'; import { ILogger } from '../logger'; import { - IAppSettingOauthConnection, + IAppSetting, IAppShowReplyUrl, IAuthenticationConnection, IAzureAuthSetting, @@ -164,7 +164,7 @@ export class AuthenticationUtils { // update appsettings.json logger.message('Updating appsettings.json ...'); - const appSettings: IAppSettingOauthConnection = JSON.parse(readFileSync(configuration.appSettingsFile, 'UTF8')); + const appSettings: IAppSetting = JSON.parse(readFileSync(configuration.appSettingsFile, 'UTF8')); // check for and remove existing aad connections if (appSettings.oauthConnections) { diff --git a/tools/botskills/test/disconnect.test.js b/tools/botskills/test/disconnect.test.js index fbacef6953..ada76515c4 100644 --- a/tools/botskills/test/disconnect.test.js +++ b/tools/botskills/test/disconnect.test.js @@ -65,7 +65,6 @@ describe("The disconnect command", function () { outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : "", lgOutFolder: resolve(__dirname, "mocks", "success", "luis"), dispatchName : "", @@ -87,7 +86,6 @@ Please make sure to provide a valid path to your Assistant Skills configuration outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : "", lgOutFolder: resolve(__dirname, "mocks", "success", "luis"), dispatchName : "", @@ -109,7 +107,6 @@ SyntaxError: Unexpected token N in JSON at position 0`); outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : resolve(__dirname, "mocks", "success", "nonexistentDispatch"), lgOutFolder: resolve(__dirname, "mocks", "success", "luis"), dispatchName : "missingDispatch", @@ -133,7 +130,6 @@ SyntaxError: Unexpected token N in JSON at position 0`); outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : resolve(__dirname, "mocks", "success", "dispatch"), lgOutFolder: resolve(__dirname, "mocks", "success", "luis"), dispatchName : "filledDispatchNoJson", @@ -156,7 +152,6 @@ Error: There was an error while refreshing the Dispatch model.`); outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : resolve(__dirname, "mocks", "success", "dispatch"), lgOutFolder: resolve(__dirname, "mocks", "success", "nonexistentLuis"), dispatchName : "filledDispatch", @@ -178,7 +173,6 @@ Please make sure to provide a valid path to your LUISGen output folder using the outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : resolve(__dirname, "mocks", "success", "dispatch"), lgOutFolder : resolve(__dirname, "mocks", "success", "luis"), dispatchName : "filledDispatch", @@ -201,7 +195,6 @@ It should be either 'cs' or 'ts' depending on your assistant's language. Please outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : resolve(__dirname, "mocks", "success", "dispatch"), lgOutFolder : resolve(__dirname, "mocks", "success", "luis"), dispatchName : "filledDispatch", @@ -226,7 +219,6 @@ Error: Mocked function throws an Error`); outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : "", lgOutFolder : resolve(__dirname, "mocks", "success", "luis"), dispatchName : "", @@ -248,7 +240,6 @@ Run 'botskills list --skillsFile ""' in order t outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : resolve(__dirname, "mocks", "success", "dispatch"), lgOutFolder : resolve(__dirname, "mocks", "success", "luis"), dispatchName : "filledDispatch", @@ -272,7 +263,6 @@ Run 'botskills list --skillsFile ""' in order t outFolder : "", cognitiveModelsFile : "", language : "", - luisFolder : "", dispatchFolder : resolve(__dirname, "mocks", "success", "dispatch"), lgOutFolder : resolve(__dirname, "mocks", "success", "luis"), dispatchName : "filledDispatch", diff --git a/tools/botskills/test/refresh.test.js b/tools/botskills/test/refresh.test.js index 9e820d065e..4888c9d714 100644 --- a/tools/botskills/test/refresh.test.js +++ b/tools/botskills/test/refresh.test.js @@ -22,7 +22,6 @@ describe("The refresh command", function () { dispatchName : "", dispatchFolder : resolve(__dirname, "mocks", "fail", "nonexistentDispatch"), language: "ts", - luisFolder: "", lgLanguage: "cs", outFolder: "", lgOutFolder: resolve(__dirname, "mocks", "success", "luis"), @@ -43,7 +42,6 @@ Remember to use the argument '--dispatchFolder' for your Assistant's Dispatch fo dispatchName : "nonexistentDispatch", dispatchFolder : resolve(__dirname, join("mocks", "success", "dispatch")), language: "ts", - luisFolder: "", lgLanguage: "cs", outFolder: "", lgOutFolder: resolve(__dirname, "mocks", "success", "luis"), @@ -70,7 +68,6 @@ Make sure to use the argument '--dispatchName' for your Assistant's Dispatch fil dispatchName: "connectableSkill", dispatchFolder : resolve(__dirname, join("mocks", "success", "dispatch")), language: "ts", - luisFolder: "", lgLanguage: "cs", outFolder: "", lgOutFolder: "", @@ -97,7 +94,6 @@ Error: Mocked function throws an Error`); dispatchName : "connectableSkill", dispatchFolder : resolve(__dirname, join("mocks", "success", "dispatch")), language: "ts", - luisFolder: "", lgLanguage: "cs", outFolder: "", lgOutFolder: resolve(__dirname, "mocks", "success", "luis"), diff --git a/tools/botskills/test/update.test.js b/tools/botskills/test/update.test.js index ef3c5c35d9..e154d531bc 100644 --- a/tools/botskills/test/update.test.js +++ b/tools/botskills/test/update.test.js @@ -62,7 +62,7 @@ describe("The update command", function () { const errorList = this.logger.getError(); strictEqual(errorList[errorList.length - 1], `There was an error while updating the Skill from the Assistant: -Error: The Skill doesn't exist in the Assistant, run 'botskills connect --botName ${config.botName} --localManifest "${config.localManifest}" --luisFolder "${config.luisFolder}" --${config.lgLanguage}'`); +Error: The Skill doesn't exist in the Assistant, run 'botskills connect --localManifest "${config.localManifest}" --luisFolder "${config.luisFolder}" --${config.lgLanguage}'`); }); it("when the localManifest points to a nonexisting Skill manifest file", async function () {