Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 7223ea3

Browse files
committed
Merge branch 'master' into emimunoz/config
2 parents af1e0bf + 2132729 commit 7223ea3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+990
-878
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+

packages/chatdown/src/commands/chatdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default class Chatdown extends Command {
1818

1919
static flags = {
2020
in: flags.string({char: 'i', description: 'The path of the chat file or directory to be parsed. A glob expression may be passed containing chat files to be processed all at once, ex. ./**/*.chat. If flag is omitted, stdin will be used. If an output directory is not present (-o), it will default the output to the current working directory.'}),
21-
out: flags.string({char: 'o', description: 'Path to the directory where the output of the multiple chat file processing (-f) will be placed.'}),
21+
out: flags.string({char: 'o', description: 'Path to the directory where the output of the multiple chat file processing (-o) will be placed.'}),
2222
static: flags.boolean({char: 's', description: 'Use static timestamps when generating timestamps on activities.'}),
2323
prefix: flags.boolean({char: 'p', description: 'Prefix stdout with package name.'}),
2424
help: flags.help({char: 'h', description: 'Chatdown command help'})

packages/cli/README.md

Lines changed: 164 additions & 260 deletions
Large diffs are not rendered by default.

packages/cli/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"@oclif/plugin-help": "~2.1.6",
1313
"@microsoft/bf-chatdown": "1.0.0",
1414
"@microsoft/bf-cli-config": "1.0.0",
15-
"@microsoft/bf-dialog": "1.0.0",
1615
"@microsoft/bf-qnamaker": "1.0.0",
1716
"chalk": "2.4.1",
1817
"cli-ux": "^5.3.0",
@@ -61,7 +60,6 @@
6160
"@oclif/plugin-help",
6261
"@microsoft/bf-chatdown",
6362
"@microsoft/bf-cli-config",
64-
"@microsoft/bf-dialog",
6563
"@microsoft/bf-qnamaker"
6664
],
6765
"hooks": {

packages/config/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ USAGE
3333
* [`bf config:set:qnamaker`](#bf-configsetqnamaker)
3434
* [`bf config:set:telemetry`](#bf-configsettelemetry)
3535
* [`bf config:show`](#bf-configshow)
36-
* [`bf config:show:qnamaker [FILE]`](#bf-configshowqnamaker-file)
36+
* [`bf config:show:qnamaker`](#bf-configshowqnamaker)
3737
* [`bf config:show:telemetry`](#bf-configshowtelemetry)
3838

3939
## `bf `
@@ -73,8 +73,10 @@ USAGE
7373
$ bf config:set:qnamaker
7474
7575
OPTIONS
76-
--kbid=kbid QnAMaker kbid to be set
77-
--subscriptionkey=subscriptionkey QnAMaker subscriptionkey to be set
76+
--endpointKey=endpointKey QnAMaker endpointKey to be set
77+
--hostname=hostname QnAMaker hostname to be set
78+
--kbId=kbId QnAMaker kbId to be set
79+
--subscriptionKey=subscriptionKey QnAMaker subscriptionkey to be set
7880
```
7981

8082
_See code: [src/commands/config/set/qnamaker.ts](https://github.com/microsoft/botframework-cli/blob/v1.0.0/src/commands/config/set/qnamaker.ts)_
@@ -108,18 +110,16 @@ OPTIONS
108110

109111
_See code: [src/commands/config/show.ts](https://github.com/microsoft/botframework-cli/blob/v1.0.0/src/commands/config/show.ts)_
110112

111-
## `bf config:show:qnamaker [FILE]`
113+
## `bf config:show:qnamaker`
112114

113-
describe the command here
115+
Display QnAMaker settings
114116

115117
```
116118
USAGE
117-
$ bf config:show:qnamaker [FILE]
119+
$ bf config:show:qnamaker
118120
119121
OPTIONS
120-
-f, --force
121-
-h, --help show CLI help
122-
-n, --name=name name to print
122+
-h, --help show CLI help
123123
```
124124

125125
_See code: [src/commands/config/show/qnamaker.ts](https://github.com/microsoft/botframework-cli/blob/v1.0.0/src/commands/config/show/qnamaker.ts)_

packages/config/src/commands/config/set/qnamaker.ts

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,47 @@ export default class ConfigSetQnamaker extends Command {
55
static description = 'Set the QnAMaker config data'
66

77
static flags = {
8-
kbid: flags.string({description: 'QnAMaker kbid to be set'}),
9-
subscriptionkey: flags.string({description: 'QnAMaker subscriptionkey to be set'}),
8+
kbId: flags.string({description: 'QnAMaker kbId to be set'}),
9+
subscriptionKey: flags.string({description: 'QnAMaker subscriptionkey to be set'}),
10+
hostname: flags.string({description: 'QnAMaker hostname to be set'}),
11+
endpointKey: flags.string({description: 'QnAMaker endpointKey to be set'}),
1012
}
1113

1214
async run() {
1315
const {flags} = this.parse(ConfigSetQnamaker)
1416
let userConfig: Config = await getConfigFile(this.config.configDir)
15-
let qnamaker = userConfig.qnamaker
1617

17-
if (flags.subscriptionkey) {
18-
if (qnamaker) {
19-
qnamaker.subscriptionKey = flags.subscriptionkey
20-
} else {
21-
userConfig.qnamaker = {subscriptionKey: flags.subscriptionkey}
22-
}
23-
this.log('Subscriptionkey set to ' + flags.subscriptionkey)
18+
if (flags.subscriptionKey) {
19+
this.setValue('subscriptionKey', flags.subscriptionKey, userConfig)
20+
}
21+
22+
if (flags.kbId) {
23+
this.setValue('kbId', flags.kbId, userConfig)
24+
}
25+
26+
if (flags.hostname) {
27+
this.setValue('hostname', flags.hostname, userConfig)
2428
}
2529

26-
if (flags.kbid) {
27-
if (qnamaker) {
28-
qnamaker.kbId = flags.kbid
29-
} else {
30-
userConfig.qnamaker = {kbId: flags.kbid}
31-
}
32-
this.log('Kbid set to ' + flags.kbid)
30+
if (flags.endpointKey) {
31+
this.setValue('endpointKey', flags.endpointKey, userConfig)
3332
}
3433

35-
if (flags.kbid || flags.subscriptionkey) {
34+
if (flags.kbId || flags.subscriptionKey || flags.hostname || flags.endpointKey) {
3635
await writeConfigFile(this.config.configDir, userConfig)
3736
} else {
3837
this.log('Plase specify flag')
3938
this._help()
4039
}
4140
}
41+
42+
setValue(key: string, value: string, userConfig: Config) {
43+
let qnamaker = userConfig.qnamaker
44+
if (!qnamaker) {
45+
userConfig.qnamaker = {}
46+
}
47+
48+
userConfig.qnamaker[key] = value
49+
this.log(`${key} set to ${value}`)
50+
}
4251
}

packages/config/test/commands/config/set/qnamaker.test.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,56 @@ describe('config:set:qnamaker', () => {
1313

1414
test
1515
.stdout()
16-
.command(['config:set:qnamaker', '--kbid', 'aaaaaaaa'])
16+
.command(['config:set:qnamaker', '--kbId', 'aaaaaaaa'])
1717
.it('Sets kbid in config file', async ctx => {
1818
let config = await fs.readJSON(getConfigFile())
1919
expect(config.qnamaker.kbId).to.contain('aaaaaaaa')
2020
})
2121

2222
test
2323
.stdout()
24-
.command(['config:set:qnamaker', '--subscriptionkey', 'aaaaaaaa'])
24+
.command(['config:set:qnamaker', '--subscriptionKey', 'aaaaaaaa'])
2525
.it('Sets subscriptionkey in config file', async ctx => {
2626
let config = await fs.readJSON(getConfigFile())
2727
expect(config.qnamaker.subscriptionKey).to.contain('aaaaaaaa')
2828
})
2929

30+
test
31+
.stdout()
32+
.command(['config:set:qnamaker', '--endpointKey', 'aaaaaaaa'])
33+
.it('Sets endpointKey in config file', async ctx => {
34+
let config = await fs.readJSON(getConfigFile())
35+
expect(config.qnamaker.subscriptionKey).to.contain('aaaaaaaa')
36+
})
37+
38+
test
39+
.stdout()
40+
.command(['config:set:qnamaker', '--hostname', 'aaaaaaaa'])
41+
.it('Sets hostname in config file', async ctx => {
42+
let config = await fs.readJSON(getConfigFile())
43+
expect(config.qnamaker.subscriptionKey).to.contain('aaaaaaaa')
44+
})
45+
3046
test
3147
.stdout()
3248
.command(['config:set:qnamaker'])
3349
.it('Asks for a flag', ctx => {
3450
expect(ctx.stdout).to.contain('Plase specify flag')
3551
})
3652
})
53+
54+
describe('config:set:qnamaker empty config file', () => {
55+
56+
after(async function() {
57+
await deleteTestConfigFile()
58+
});
59+
60+
test
61+
.stdout()
62+
.command(['config:set:qnamaker', '--kbId', 'aaaaaaaa'])
63+
.it('Sets kbid in config file', async ctx => {
64+
let config = await fs.readJSON(getConfigFile())
65+
expect(config.qnamaker.kbId).to.contain('aaaaaaaa')
66+
})
67+
})
68+

packages/luis/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.0",
44
"author": "Microsoft",
55
"bugs": "https://github.com/microsoft/botframework-cli/issues",
6+
"main": "parser/index.js",
67
"dependencies": {
78
"@microsoft/bf-cli-command": "1.0.0",
89
"@oclif/config": "~1.13.3",

packages/luis/parser/converters/lumerger.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,9 @@ const resolveReferencesInUtterances = async function(allParsedContent) {
161161
let newPatternsToAdd = [];
162162
let spliceList = [];
163163
(luisModel.LUISJsonStructure.utterances || []).forEach((utterance,idx) => {
164-
// Deep references must have [link name](link-value) notation
165-
if (utterance.text.indexOf('[') !== 0) return;
166-
// does this utterance have a deep link uri?
167-
let linkExp = (utterance.text || '').trim().match(new RegExp(/\(.*?\)/g));
168-
if (linkExp && linkExp.length !== 0) {
164+
// Fix for BF-CLI #122.
165+
// Ensure only links are detected and passed on to be parsed.
166+
if (helpers.isUtteranceLinkRef(utterance.text || '')) {
169167
// we have stuff to parse and resolve
170168
let parsedUtterance = helpers.parseLinkURI(utterance.text);
171169
if (!path.isAbsolute(parsedUtterance.luFile)) parsedUtterance.luFile = path.resolve(path.dirname(luisModel.srcFile), parsedUtterance.luFile);

packages/luis/parser/lufile/exports.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)