@robinpath/cli 2.6.0 → 2.8.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.
- package/dist/cli.mjs +56 -13
- 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.
|
|
18601
|
+
var CLI_VERSION = true ? "2.8.0" : "2.8.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
|
-
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
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.split("\n").slice(1).map((line, li) => /* @__PURE__ */ jsx2(Text2, { backgroundColor: line.includes("+") ? "green" : void 0, color: line.includes("+") ? "white" : void 0, dimColor: !line.includes("+"), children: line }, li))
|
|
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,38 @@ 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
|
-
|
|
24836
|
-
|
|
24837
|
-
const
|
|
24867
|
+
if (isWrite && lineCount > 0) {
|
|
24868
|
+
const fileMatch = firstLine.match(/["']([^"']+\.\w+)["']/);
|
|
24869
|
+
const fileName = fileMatch ? fileMatch[1] : firstLine.slice(0, 30);
|
|
24870
|
+
const contentLines = cmdLines.slice(1).filter((l) => l.trim() && !l.match(/^(RPEOF|EOF|'@)$/));
|
|
24871
|
+
const preview = contentLines.slice(0, 8).map(
|
|
24872
|
+
(l, i) => ` ${String(i + 1).padStart(3)} + ${l}`
|
|
24873
|
+
).join("\n");
|
|
24874
|
+
const extra = contentLines.length > 8 ? `
|
|
24875
|
+
\u2026 ${contentLines.length - 8} more lines` : "";
|
|
24876
|
+
ui?.addMessage(` \u23BF Write(${fileName})
|
|
24877
|
+
+ Added ${contentLines.length} lines
|
|
24878
|
+
${preview}${extra}`, true);
|
|
24879
|
+
} else if (r.stdout?.trim()) {
|
|
24880
|
+
const lines = r.stdout.trim().split("\n");
|
|
24838
24881
|
const preview = lines.length <= 4 ? lines.map((l) => ` ${l}`).join("\n") : lines.slice(0, 3).map((l) => ` ${l}`).join("\n") + `
|
|
24839
24882
|
\u2026 ${lines.length - 3} more lines`;
|
|
24840
|
-
ui?.addMessage(` \u23BF Execute(${firstLine}
|
|
24883
|
+
ui?.addMessage(` \u23BF Execute(${firstLine})
|
|
24841
24884
|
${preview}`, true);
|
|
24842
24885
|
} else {
|
|
24843
|
-
ui?.addMessage(` \u23BF Execute(${firstLine}
|
|
24886
|
+
ui?.addMessage(` \u23BF Execute(${firstLine})`, true);
|
|
24844
24887
|
}
|
|
24845
24888
|
} else {
|
|
24846
24889
|
const errLine = (r.stderr || "").trim().split("\n")[0].slice(0, 70);
|
|
24847
|
-
ui?.addMessage(` \u23BF Execute(${firstLine}
|
|
24890
|
+
ui?.addMessage(` \u23BF Execute(${firstLine})
|
|
24848
24891
|
\u2717 ${errLine}`, true);
|
|
24849
24892
|
}
|
|
24850
24893
|
}
|