@iola_adm/iola-cli 0.1.53 → 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 +16 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.53",
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) {
@@ -1343,23 +1347,26 @@ function clearAgentInputArea(state = null) {
1343
1347
  }
1344
1348
 
1345
1349
  function startActivityIndicator(label = "работаю") {
1350
+ const doneLabel = "готово";
1346
1351
  if (!output.isTTY || process.env.NO_COLOR === "1") {
1347
1352
  output.write(`${label}...\n`);
1348
- return () => {};
1353
+ const started = Date.now();
1354
+ return () => {
1355
+ const seconds = ((Date.now() - started) / 1000).toFixed(1);
1356
+ output.write(`- ${doneLabel} ${seconds}s\n`);
1357
+ };
1349
1358
  }
1350
- const frames = ["|", "/", "-", "\\"];
1351
1359
  const started = Date.now();
1352
- let index = 0;
1353
1360
  const render = () => {
1354
1361
  const seconds = ((Date.now() - started) / 1000).toFixed(1);
1355
- output.write(`\r\x1b[2K${colorMuted(`${frames[index % frames.length]} ${label} ${seconds}s`)}`);
1356
- index += 1;
1362
+ output.write(`\r\x1b[2K${colorMuted(`─ ${label} ${seconds}s`)}`);
1357
1363
  };
1358
1364
  render();
1359
1365
  const timer = setInterval(render, 120);
1360
1366
  return () => {
1361
1367
  clearInterval(timer);
1362
- output.write("\r\x1b[2K");
1368
+ const seconds = ((Date.now() - started) / 1000).toFixed(1);
1369
+ output.write(`\r\x1b[2K${colorMuted(`─ ${doneLabel} ${seconds}s`)}\n`);
1363
1370
  };
1364
1371
  }
1365
1372