@robinpath/cli 2.6.0 → 2.7.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 +49 -13
  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 ? "2.6.0" : "2.6.0";
18601
+ var CLI_VERSION = true ? "2.7.0" : "2.7.0";
18602
18602
  var FLAG_QUIET = false;
18603
18603
  var FLAG_VERBOSE = false;
18604
18604
  var FLAG_AUTO_ACCEPT = false;
@@ -24220,10 +24220,33 @@ function CodeBlock({ content, lang }) {
24220
24220
  const MAX_CODE_LINES = 30;
24221
24221
  const truncated = allLines.length > MAX_CODE_LINES;
24222
24222
  const lines = truncated ? [...allLines.slice(0, 20), `\u2026 ${allLines.length - 25} more lines`, ...allLines.slice(-5)] : allLines;
24223
- return /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginY: 0, paddingLeft: 2, children: lines.map((line, i) => /* @__PURE__ */ jsxs(Text, { children: [
24224
- /* @__PURE__ */ jsx(Text, { children: " " }),
24225
- /* @__PURE__ */ jsx(Text, { children: line })
24226
- ] }, i)) });
24223
+ const isDiff = lang === "diff" || lines.some((l) => /^[+-]\s/.test(l) || /^@@/.test(l));
24224
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginY: 0, paddingLeft: 2, children: lines.map((line, i) => {
24225
+ if (isDiff) {
24226
+ if (line.startsWith("+") && !line.startsWith("+++")) {
24227
+ return /* @__PURE__ */ jsxs(Text, { backgroundColor: "green", color: "white", children: [
24228
+ " ",
24229
+ line
24230
+ ] }, i);
24231
+ }
24232
+ if (line.startsWith("-") && !line.startsWith("---")) {
24233
+ return /* @__PURE__ */ jsxs(Text, { backgroundColor: "red", color: "white", children: [
24234
+ " ",
24235
+ line
24236
+ ] }, i);
24237
+ }
24238
+ if (line.startsWith("@@")) {
24239
+ return /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
24240
+ " ",
24241
+ line
24242
+ ] }, i);
24243
+ }
24244
+ }
24245
+ return /* @__PURE__ */ jsxs(Text, { children: [
24246
+ /* @__PURE__ */ jsx(Text, { children: " " }),
24247
+ /* @__PURE__ */ jsx(Text, { children: line })
24248
+ ] }, i);
24249
+ }) });
24227
24250
  }
24228
24251
  function Markdown({ children }) {
24229
24252
  const blocks = parseBlocks(children);
@@ -24574,6 +24597,12 @@ function ChatApp({ engine }) {
24574
24597
  /* @__PURE__ */ jsx2(Static, { items: messages, children: (msg) => /* @__PURE__ */ jsx2(Box2, { paddingX: 1, marginBottom: msg.text.startsWith("\u276F") ? 0 : 1, flexDirection: "column", children: msg.text.startsWith("\u276F") ? /* @__PURE__ */ jsxs2(Text2, { children: [
24575
24598
  /* @__PURE__ */ jsx2(Text2, { color: "cyan", bold: true, children: "\u276F" }),
24576
24599
  /* @__PURE__ */ jsx2(Text2, { bold: true, children: msg.text.slice(1) })
24600
+ ] }) : msg.text.includes("\u23BF") && msg.text.includes("Write") ? /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
24601
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: msg.text.split("\n")[0] }),
24602
+ msg.text.includes("+ ") ? /* @__PURE__ */ jsx2(Text2, { backgroundColor: "green", color: "white", children: msg.text.split("\n").slice(1).join("\n") }) : null
24603
+ ] }) : msg.text.includes("\u23BF") && msg.text.includes("\u2717") ? /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
24604
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: msg.text.split("\n")[0] }),
24605
+ /* @__PURE__ */ jsx2(Text2, { backgroundColor: "red", color: "white", children: msg.text.split("\n").slice(1).join("\n") })
24577
24606
  ] }) : msg.text.includes("\u23BF") ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, wrap: "wrap", children: msg.text }) : msg.dim ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, wrap: "wrap", children: msg.text }) : /* @__PURE__ */ jsx2(Markdown, { children: msg.text }) }, msg.id) }),
24578
24607
  showModelPicker ? /* @__PURE__ */ jsx2(
24579
24608
  ModelSelector,
@@ -24827,24 +24856,31 @@ Type / to see available commands.`;
24827
24856
  await new Promise((r) => setTimeout(r, 100));
24828
24857
  const cmdResults = [];
24829
24858
  for (const cmd of commands) {
24830
- const firstLine = cmd.split("\n")[0].slice(0, 70);
24831
- const isMultiline = cmd.includes("\n");
24832
24859
  const r = await executeShellCommand(cmd);
24833
24860
  cmdResults.push({ command: cmd, stdout: r.stdout || "", stderr: r.stderr || "", exitCode: r.exitCode });
24861
+ const isWrite = cmd.includes(">") || cmd.includes("Set-Content") || cmd.includes("Out-File");
24862
+ const isRun = cmd.startsWith("robinpath ") || cmd.includes("node ") || cmd.includes("npm ");
24863
+ const cmdLines = cmd.split("\n");
24864
+ const lineCount = isWrite ? cmdLines.length - 1 : 0;
24865
+ const firstLine = cmdLines[0].slice(0, 70);
24834
24866
  if (r.exitCode === 0) {
24835
- const output = (r.stdout || "").trim();
24836
- if (output) {
24837
- const lines = output.split("\n");
24867
+ if (isWrite && lineCount > 0) {
24868
+ const fileMatch = firstLine.match(/["']([^"']+\.\w+)["']/);
24869
+ const fileName = fileMatch ? fileMatch[1] : firstLine.slice(0, 30);
24870
+ ui?.addMessage(` \u23BF Write(${fileName})
24871
+ + ${lineCount} lines`, true);
24872
+ } else if (r.stdout?.trim()) {
24873
+ const lines = r.stdout.trim().split("\n");
24838
24874
  const preview = lines.length <= 4 ? lines.map((l) => ` ${l}`).join("\n") : lines.slice(0, 3).map((l) => ` ${l}`).join("\n") + `
24839
24875
  \u2026 ${lines.length - 3} more lines`;
24840
- ui?.addMessage(` \u23BF Execute(${firstLine}${isMultiline ? " \u2026" : ""})
24876
+ ui?.addMessage(` \u23BF Execute(${firstLine})
24841
24877
  ${preview}`, true);
24842
24878
  } else {
24843
- ui?.addMessage(` \u23BF Execute(${firstLine}${isMultiline ? " \u2026" : ""})`, true);
24879
+ ui?.addMessage(` \u23BF Execute(${firstLine})`, true);
24844
24880
  }
24845
24881
  } else {
24846
24882
  const errLine = (r.stderr || "").trim().split("\n")[0].slice(0, 70);
24847
- ui?.addMessage(` \u23BF Execute(${firstLine}${isMultiline ? " \u2026" : ""})
24883
+ ui?.addMessage(` \u23BF Execute(${firstLine})
24848
24884
  \u2717 ${errLine}`, true);
24849
24885
  }
24850
24886
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",