@robinpath/cli 1.83.0 → 1.84.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 +35 -19
  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.84.0" : "1.84.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
  ] });
@@ -24659,18 +24652,41 @@ Type / to see available commands.`;
24659
24652
  break;
24660
24653
  }
24661
24654
  if (cleaned) ui?.addMessage(cleaned);
24655
+ const cmdResults = [];
24662
24656
  for (const cmd of commands) {
24663
24657
  const preview = cmd.split("\n")[0].slice(0, 80);
24664
24658
  ui?.addMessage(`$ ${preview}${cmd.includes("\n") ? " ..." : ""}`, true);
24665
24659
  const r = await executeShellCommand(cmd);
24660
+ cmdResults.push({ command: cmd, stdout: r.stdout || "", stderr: r.stderr || "", exitCode: r.exitCode });
24666
24661
  if (r.exitCode === 0 && r.stdout?.trim()) {
24667
- ui?.addMessage(r.stdout.trim().split("\n").slice(0, 5).join("\n"), true);
24662
+ const lines = r.stdout.trim().split("\n");
24663
+ if (lines.length <= 15) {
24664
+ ui?.addMessage(lines.join("\n"), true);
24665
+ } else {
24666
+ ui?.addMessage(
24667
+ `${lines.slice(0, 5).join("\n")}
24668
+ ... (${lines.length - 10} lines hidden)
24669
+ ${lines.slice(-5).join("\n")}`,
24670
+ true
24671
+ );
24672
+ }
24668
24673
  } else if (r.exitCode !== 0) {
24669
- ui?.addMessage(`exit ${r.exitCode}: ${(r.stderr || "").slice(0, 100)}`, true);
24674
+ ui?.addMessage(`exit ${r.exitCode}: ${(r.stderr || "").slice(0, 200)}`, true);
24675
+ } else {
24676
+ ui?.addMessage("done", true);
24670
24677
  }
24671
24678
  }
24672
- const summary = commands.map((cmd) => `$ ${cmd}
24673
- (executed)`).join("\n");
24679
+ const summary = cmdResults.map((r) => {
24680
+ let out = `$ ${r.command}
24681
+ `;
24682
+ if (r.exitCode === 0) out += (r.stdout || "(no output)").slice(0, 5e3);
24683
+ else {
24684
+ out += `Exit: ${r.exitCode}
24685
+ `;
24686
+ if (r.stderr) out += r.stderr.slice(0, 2e3);
24687
+ }
24688
+ return out;
24689
+ }).join("\n\n");
24674
24690
  this.conversationMessages.push({ role: "user", content: `[Results]
24675
24691
  ${summary}` });
24676
24692
  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.84.0",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",