@iola_adm/iola-cli 0.1.43 → 0.1.45

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 +26 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
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
@@ -270,7 +270,7 @@ const SLASH_COMMANDS = [
270
270
  { command: "/help", description: "список slash-команд" },
271
271
  { command: "/health", description: "проверка публичного API/MCP" },
272
272
  { command: "/doctor", description: "диагностика CLI" },
273
- { command: "/wizard", description: "мастер настройки" },
273
+ { command: "/master", description: "мастер настройки" },
274
274
  { command: "/db status", description: "статус локальной SQLite-БД" },
275
275
  { command: "/sessions", description: "AI-сессии" },
276
276
  { command: "/resume SESSION_ID", description: "продолжить сессию" },
@@ -408,6 +408,7 @@ const COMMANDS = new Map([
408
408
  ["mcp-info", showMcpInfo],
409
409
  ["setup", setupClient],
410
410
  ["onboard", onboard],
411
+ ["master", onboard],
411
412
  ["wizard", onboard],
412
413
  ]);
413
414
 
@@ -465,7 +466,7 @@ async function showHelp() {
465
466
 
466
467
  Запуск:
467
468
  iola открыть интерактивный агент
468
- iola wizard мастер настройки
469
+ iola master мастер настройки
469
470
  iola ask "найди школу 29" задать вопрос
470
471
  iola search "Петрова" поиск по открытым данным
471
472
 
@@ -589,6 +590,7 @@ Usage:
589
590
  iola mcp-info [--json]
590
591
  iola setup codex
591
592
  iola onboard
593
+ iola master
592
594
  iola wizard
593
595
  iola version
594
596
 
@@ -622,9 +624,10 @@ async function runDefaultCli() {
622
624
  }
623
625
 
624
626
  async function startAgent() {
627
+ setTerminalTitle(`iola - ${path.basename(process.cwd()) || process.cwd()}`);
625
628
  await showBanner();
626
629
  await ensureAgentAiReady();
627
- console.log("Интерактивный режим. Введите /help для списка команд, /exit для выхода.");
630
+ console.log("Интерактивный режим. Введите /help для списка команд, /master чтобы запустить мастер настройки, /exit для выхода.");
628
631
  await runHooks("SessionStart", { mode: "agent" });
629
632
 
630
633
  if (input.isTTY && output.isTTY) {
@@ -648,7 +651,7 @@ async function ensureAgentAiReady() {
648
651
 
649
652
  if (onboardRanThisProcess) {
650
653
  console.log("AI-провайдер пока не настроен. Агент откроется, но AI-запросы потребуют настройки.");
651
- console.log("Повторно открыть мастер можно командой: /wizard");
654
+ console.log("Повторно открыть мастер можно командой: /master");
652
655
  return readiness;
653
656
  }
654
657
 
@@ -661,7 +664,7 @@ async function ensureAgentAiReady() {
661
664
  if (!updated.ready) {
662
665
  console.log("");
663
666
  console.log("AI-провайдер пока не настроен. Агент откроется, но AI-запросы потребуют настройки.");
664
- console.log("Повторно открыть мастер можно командой: /wizard");
667
+ console.log("Повторно открыть мастер можно командой: /master");
665
668
  }
666
669
  return updated;
667
670
  }
@@ -788,13 +791,7 @@ async function startAgentRawInput() {
788
791
  if (key?.name === "return" || key?.name === "enter") {
789
792
  const matches = currentSlashMatches(state);
790
793
  const selected = matches[state.selected];
791
- if (state.slashOpen && selected && state.buffer.trim() !== selected.command) {
792
- state.buffer = selected.command;
793
- state.slashOpen = false;
794
- render();
795
- continue;
796
- }
797
- const line = state.buffer.trim();
794
+ const line = state.slashOpen && selected ? selected.command : state.buffer.trim();
798
795
  state.buffer = "";
799
796
  state.slashOpen = false;
800
797
  clearAgentInputArea(state);
@@ -820,6 +817,8 @@ async function startAgentRawInput() {
820
817
  }
821
818
  } finally {
822
819
  if (!wasRaw) input.setRawMode(false);
820
+ clearAgentInputArea(state);
821
+ output.write("\n");
823
822
  }
824
823
  }
825
824
 
@@ -1188,6 +1187,7 @@ async function handleAgentLine(line, state) {
1188
1187
  search: ["search", args],
1189
1188
  "mcp-info": ["mcp-info", args],
1190
1189
  setup: ["setup", args],
1190
+ master: ["wizard", args],
1191
1191
  wizard: ["wizard", args],
1192
1192
  onboard: ["onboard", args],
1193
1193
  }[command];
@@ -1253,6 +1253,7 @@ function renderAgentInput(state) {
1253
1253
  const prompt = "iola> ";
1254
1254
  const lines = state.buffer.split("\n");
1255
1255
  const inputLines = [`${prompt}${lines[0] || ""}`, ...lines.slice(1).map((line) => ` ${line}`)];
1256
+ const cwdLine = colorMuted(` ${process.cwd()}`);
1256
1257
  const menuLines = [];
1257
1258
  if (state.slashOpen) {
1258
1259
  const matches = currentSlashMatches(state);
@@ -1269,10 +1270,10 @@ function renderAgentInput(state) {
1269
1270
  }
1270
1271
  }
1271
1272
 
1272
- const renderedLines = [...inputLines, ...menuLines];
1273
+ const renderedLines = [...inputLines, "", ...menuLines, cwdLine];
1273
1274
  output.write(renderedLines.join("\n"));
1274
- if (menuLines.length > 0 && output.isTTY) {
1275
- output.write(`\x1b[${menuLines.length}A`);
1275
+ if (output.isTTY) {
1276
+ output.write(`\x1b[${2 + menuLines.length}A`);
1276
1277
  }
1277
1278
  if (output.isTTY) {
1278
1279
  const cursorColumn = visibleLength(inputLines[inputLines.length - 1]);
@@ -1294,6 +1295,16 @@ function colorSlashSelection(row) {
1294
1295
  return `\x1b[38;5;213m${row}\x1b[0m`;
1295
1296
  }
1296
1297
 
1298
+ function colorMuted(row) {
1299
+ if (!output.isTTY || process.env.NO_COLOR === "1") return row;
1300
+ return `\x1b[38;5;245m${row}\x1b[0m`;
1301
+ }
1302
+
1303
+ function setTerminalTitle(title) {
1304
+ if (!output.isTTY) return;
1305
+ output.write(`\x1b]0;${String(title).replace(/[\x00-\x1f\x7f]/g, "")}\x07`);
1306
+ }
1307
+
1297
1308
  function readKeypress() {
1298
1309
  return new Promise((resolve) => {
1299
1310
  const handler = (str, key) => {