@iola_adm/iola-cli 0.1.54 → 0.1.55

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "description": "CLI и AI-агент городского округа Йошкар-Ола.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/adm-iola/iola-cli#readme",
package/src/cli.js CHANGED
@@ -1285,9 +1285,13 @@ function printSlashMenu(filter = "", options = {}) {
1285
1285
 
1286
1286
  function getSlashCommandMatches(filter = "") {
1287
1287
  const normalized = String(filter || "").replace(/^\//, "").toLocaleLowerCase("ru-RU");
1288
- return SLASH_COMMANDS.filter((item) => !normalized
1289
- || item.command.toLocaleLowerCase("ru-RU").includes(normalized)
1290
- || item.description.toLocaleLowerCase("ru-RU").includes(normalized));
1288
+ if (!normalized) return SLASH_COMMANDS;
1289
+ const commandPrefix = SLASH_COMMANDS.filter((item) => item.command.toLocaleLowerCase("ru-RU").startsWith(`/${normalized}`));
1290
+ if (commandPrefix.length > 0) return commandPrefix;
1291
+ const commandWordPrefix = SLASH_COMMANDS.filter((item) =>
1292
+ item.command.toLocaleLowerCase("ru-RU").split(/\s+/).some((part) => part.replace(/^\//, "").startsWith(normalized)));
1293
+ if (commandWordPrefix.length > 0) return commandWordPrefix;
1294
+ return SLASH_COMMANDS.filter((item) => item.description.toLocaleLowerCase("ru-RU").startsWith(normalized));
1291
1295
  }
1292
1296
 
1293
1297
  function updateSlashState(state) {