bob-core 0.9.7 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,9 +93,10 @@ class CommandRegistry {
93
93
  }
94
94
  async suggestCommand(command) {
95
95
  const availableCommands = this.getAvailableCommands();
96
- const similarCommands = SS.findBestMatch(command, availableCommands).ratings.filter(r => r.rating > 0.3).map(r => r.target);
97
- if (similarCommands.length === 1) {
98
- const commandToAsk = similarCommands[0];
96
+ const { bestMatch, bestMatchIndex, ratings } = SS.findBestMatch(command, availableCommands);
97
+ const similarCommands = ratings.filter(r => r.rating > 0.3).map(r => r.target);
98
+ if ((bestMatch.rating > 0 && similarCommands.length <= 1) || (bestMatch.rating > 0.7 && similarCommands.length > 1)) {
99
+ const commandToAsk = availableCommands[bestMatchIndex];
99
100
  const runCommand = await this.askRunSimilarCommand(command, commandToAsk);
100
101
  if (runCommand) {
101
102
  return commandToAsk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bob-core",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "BOB Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",