@iola_adm/iola-cli 0.1.110 → 0.1.111

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.110",
3
+ "version": "0.1.111",
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
@@ -1524,7 +1524,7 @@ function flushPendingAgentOutput(state) {
1524
1524
  const text = state.pendingOutput;
1525
1525
  state.pendingOutput = "";
1526
1526
  if (!text) return;
1527
- console.log(text);
1527
+ printAiAnswer(text);
1528
1528
  }
1529
1529
 
1530
1530
  function colorSlashSelection(row) {
@@ -1537,6 +1537,26 @@ function colorMuted(row) {
1537
1537
  return `\x1b[38;5;245m${row}\x1b[0m`;
1538
1538
  }
1539
1539
 
1540
+ function printAiAnswer(text) {
1541
+ output.write(`${renderTerminalMarkdown(text)}\n`);
1542
+ }
1543
+
1544
+ function renderTerminalMarkdown(text) {
1545
+ const source = String(text || "");
1546
+ if (!output.isTTY || process.env.NO_COLOR === "1") return source;
1547
+ return source
1548
+ .split(/(```[\s\S]*?```)/g)
1549
+ .map((part) => part.startsWith("```") ? part : renderInlineMarkdown(part))
1550
+ .join("");
1551
+ }
1552
+
1553
+ function renderInlineMarkdown(text) {
1554
+ return String(text || "")
1555
+ .replace(/\*\*([^*\n][\s\S]*?[^*\n])\*\*/g, "\x1b[1m$1\x1b[22m")
1556
+ .replace(/__([^_\n][\s\S]*?[^_\n])__/g, "\x1b[1m$1\x1b[22m")
1557
+ .replace(/`([^`\n]+)`/g, "\x1b[36m$1\x1b[39m");
1558
+ }
1559
+
1540
1560
  function setTerminalTitle(title) {
1541
1561
  if (!output.isTTY) return;
1542
1562
  output.write(`\x1b]0;${String(title).replace(/[\x00-\x1f\x7f]/g, "")}\x07`);
@@ -6496,7 +6516,7 @@ async function aiAsk(args, context = {}) {
6496
6516
  return answer;
6497
6517
  }
6498
6518
 
6499
- if (!options.quiet) console.log(answer);
6519
+ if (!options.quiet) printAiAnswer(answer);
6500
6520
  return answer;
6501
6521
  }
6502
6522
 
@@ -6723,7 +6743,7 @@ async function localToolAsk(question, providerConfig, options) {
6723
6743
  if (options.format === "json" || options.schema === "json") {
6724
6744
  printJson({ answer, plan: validated, result });
6725
6745
  } else {
6726
- if (!options.quiet) console.log(answer);
6746
+ if (!options.quiet) printAiAnswer(answer);
6727
6747
  }
6728
6748
  return answer;
6729
6749
  }
@@ -50,6 +50,8 @@ assertIncludes(cliSource, "force: Boolean(options.force)", "IOLA setup should no
50
50
  assertIncludes(cliSource, "MAIN_OPENROUTER_DEVELOPERS", "OpenRouter model selection should group models by developer");
51
51
  assertIncludes(cliSource, "isOpenRouterTextGenerationModel", "OpenRouter model selection should prefer text-generation models");
52
52
  assertIncludes(cliSource, "console.log(\" 0. Назад\")", "OpenRouter model selection should return to developer menu");
53
+ assertIncludes(cliSource, "renderTerminalMarkdown", "AI answers should render inline markdown in the terminal");
54
+ assertIncludes(cliSource, "\\x1b[1m$1\\x1b[22m", "AI answer renderer should support bold markdown");
53
55
 
54
56
  const commands = await runCli(["commands"]);
55
57
  assertIncludes(commands, "iola browser status|install|open|text|html|screenshot|pdf|click|type|eval", "commands");