@robinpath/cli 1.83.0 → 1.85.0

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/dist/cli.mjs +44 -38
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -18598,7 +18598,7 @@ function getNativeModules() {
18598
18598
  import { join as join3, basename as basename2 } from "node:path";
18599
18599
  import { homedir as homedir2, platform as platform2 } from "node:os";
18600
18600
  import { existsSync as existsSync2 } from "node:fs";
18601
- var CLI_VERSION = true ? "1.83.0" : "1.83.0";
18601
+ var CLI_VERSION = true ? "1.85.0" : "1.85.0";
18602
18602
  var FLAG_QUIET = false;
18603
18603
  var FLAG_VERBOSE = false;
18604
18604
  var FLAG_AUTO_ACCEPT = false;
@@ -21938,11 +21938,6 @@ async function fetchBrainStream(prompt, { onToken, conversationHistory, provider
21938
21938
  if (onToken) onToken(delta);
21939
21939
  } else if (eventType === "validation") {
21940
21940
  if (parsed.retrying) {
21941
- const lines = fullText.split("\n").length;
21942
- for (let i = 0; i < lines; i++) {
21943
- process.stdout.write("\x1B[2K\x1B[1A");
21944
- }
21945
- process.stdout.write("\x1B[2K\r");
21946
21941
  fullText = "";
21947
21942
  if (onToken) {
21948
21943
  onToken("\x1B[RETRY]");
@@ -22571,13 +22566,7 @@ function executeShellCommand(command, timeout = 3e4) {
22571
22566
  stdio: ["pipe", "pipe", "pipe"]
22572
22567
  });
22573
22568
  child.stdout.on("data", (data) => {
22574
- const chunk = data.toString();
22575
- stdout += chunk;
22576
- const lines = chunk.replace(/\n$/, "").split("\n");
22577
- for (const line of lines) {
22578
- if (line.trim()) process.stdout.write(color.dim(` ${line}
22579
- `));
22580
- }
22569
+ stdout += data.toString();
22581
22570
  });
22582
22571
  child.stderr.on("data", (data) => {
22583
22572
  stderr += data.toString();
@@ -24239,15 +24228,19 @@ function TextBlock({ content }) {
24239
24228
  }
24240
24229
  function CodeBlock({ content, lang }) {
24241
24230
  const w = Math.min(process.stdout.columns - 6 || 72, 72);
24231
+ const allLines = content.split("\n");
24232
+ const MAX_CODE_LINES = 30;
24233
+ const truncated = allLines.length > MAX_CODE_LINES;
24234
+ const lines = truncated ? [...allLines.slice(0, 20), `... (${allLines.length - 25} lines hidden)`, ...allLines.slice(-5)] : allLines;
24242
24235
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, marginX: 1, children: [
24243
24236
  /* @__PURE__ */ jsxs(Text, { children: [
24244
24237
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u250C" }),
24245
24238
  lang ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${lang} ` }) : null,
24246
24239
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2500".repeat(Math.max(0, w - (lang ? lang.length + 5 : 3))) })
24247
24240
  ] }),
24248
- content.split("\n").map((line, i) => /* @__PURE__ */ jsxs(Text, { children: [
24241
+ lines.map((line, i) => /* @__PURE__ */ jsxs(Text, { children: [
24249
24242
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2502 " }),
24250
- /* @__PURE__ */ jsx(Text, { color: "white", children: line })
24243
+ /* @__PURE__ */ jsx(Text, { color: "white", children: line.slice(0, w - 5) })
24251
24244
  ] }, i)),
24252
24245
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2514" + "\u2500".repeat(w - 3) })
24253
24246
  ] });
@@ -24339,9 +24332,9 @@ function InputArea({ onSubmit, placeholder }) {
24339
24332
  /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: cmd.padEnd(14) }),
24340
24333
  /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: desc })
24341
24334
  ] }, cmd)) }),
24342
- /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", marginX: 1, children: [
24343
- /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(w) }),
24344
- /* @__PURE__ */ jsx2(Box2, { paddingX: 1, flexDirection: "column", children: empty ? /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24335
+ /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
24336
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(Math.max(process.stdout.columns || 80, 40)) }),
24337
+ /* @__PURE__ */ jsx2(Box2, { paddingX: 2, flexDirection: "column", children: empty ? /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24345
24338
  "> ",
24346
24339
  placeholder
24347
24340
  ] }) : lines.map((line, i) => /* @__PURE__ */ jsxs2(Text2, { children: [
@@ -24349,20 +24342,9 @@ function InputArea({ onSubmit, placeholder }) {
24349
24342
  line,
24350
24343
  i === lines.length - 1 ? /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "\u258E" }) : null
24351
24344
  ] }, i)) }),
24352
- /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(w) })
24345
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(Math.max(process.stdout.columns || 80, 40)) })
24353
24346
  ] }),
24354
- /* @__PURE__ */ jsx2(Box2, { marginX: 2, children: /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24355
- /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "enter" }),
24356
- " send ",
24357
- /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "\\" }),
24358
- " newline ",
24359
- /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "/" }),
24360
- " commands ",
24361
- /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "tab" }),
24362
- " complete ",
24363
- /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "@/" }),
24364
- " files"
24365
- ] }) })
24347
+ /* @__PURE__ */ jsx2(Box2, { paddingX: 2, children: /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "enter send \xB7 \\ newline \xB7 / commands \xB7 @/ files" }) })
24366
24348
  ] });
24367
24349
  }
24368
24350
  function ChatApp({ engine }) {
@@ -24487,9 +24469,10 @@ var ReplEngine = class {
24487
24469
  }
24488
24470
  updateStatus() {
24489
24471
  const m = this.model.includes("/") ? this.model.split("/").pop() : this.model;
24490
- const cost = this.usage.cost > 0 ? ` \xB7 $${this.usage.cost.toFixed(4)}` : "";
24491
- const tokens = this.usage.totalTokens > 0 ? ` \xB7 ${this.usage.totalTokens.toLocaleString()} tok` : "";
24492
- this.ui?.setStatus(`${m} \xB7 ${getShellConfig().name} \xB7 ${this.autoAccept ? "auto" : "confirm"}${tokens}${cost}`);
24472
+ const parts = [m || "default"];
24473
+ if (this.usage.totalTokens > 0) parts.push(`${this.usage.totalTokens.toLocaleString()} tokens`);
24474
+ if (this.usage.cost > 0) parts.push(`$${this.usage.cost.toFixed(4)}`);
24475
+ this.ui?.setStatus(parts.join(" \xB7 "));
24493
24476
  }
24494
24477
  exit() {
24495
24478
  if (this.conversationMessages.length > 1) saveSession(this.sessionId, this.sessionName, this.conversationMessages, this.usage);
@@ -24659,18 +24642,41 @@ Type / to see available commands.`;
24659
24642
  break;
24660
24643
  }
24661
24644
  if (cleaned) ui?.addMessage(cleaned);
24645
+ const cmdResults = [];
24662
24646
  for (const cmd of commands) {
24663
24647
  const preview = cmd.split("\n")[0].slice(0, 80);
24664
24648
  ui?.addMessage(`$ ${preview}${cmd.includes("\n") ? " ..." : ""}`, true);
24665
24649
  const r = await executeShellCommand(cmd);
24650
+ cmdResults.push({ command: cmd, stdout: r.stdout || "", stderr: r.stderr || "", exitCode: r.exitCode });
24666
24651
  if (r.exitCode === 0 && r.stdout?.trim()) {
24667
- ui?.addMessage(r.stdout.trim().split("\n").slice(0, 5).join("\n"), true);
24652
+ const lines = r.stdout.trim().split("\n");
24653
+ if (lines.length <= 15) {
24654
+ ui?.addMessage(lines.join("\n"), true);
24655
+ } else {
24656
+ ui?.addMessage(
24657
+ `${lines.slice(0, 5).join("\n")}
24658
+ ... (${lines.length - 10} lines hidden)
24659
+ ${lines.slice(-5).join("\n")}`,
24660
+ true
24661
+ );
24662
+ }
24668
24663
  } else if (r.exitCode !== 0) {
24669
- ui?.addMessage(`exit ${r.exitCode}: ${(r.stderr || "").slice(0, 100)}`, true);
24664
+ ui?.addMessage(`exit ${r.exitCode}: ${(r.stderr || "").slice(0, 200)}`, true);
24665
+ } else {
24666
+ ui?.addMessage("done", true);
24670
24667
  }
24671
24668
  }
24672
- const summary = commands.map((cmd) => `$ ${cmd}
24673
- (executed)`).join("\n");
24669
+ const summary = cmdResults.map((r) => {
24670
+ let out = `$ ${r.command}
24671
+ `;
24672
+ if (r.exitCode === 0) out += (r.stdout || "(no output)").slice(0, 5e3);
24673
+ else {
24674
+ out += `Exit: ${r.exitCode}
24675
+ `;
24676
+ if (r.stderr) out += r.stderr.slice(0, 2e3);
24677
+ }
24678
+ return out;
24679
+ }).join("\n\n");
24674
24680
  this.conversationMessages.push({ role: "user", content: `[Results]
24675
24681
  ${summary}` });
24676
24682
  ui?.setStreaming("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "1.83.0",
3
+ "version": "1.85.0",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",