@robinpath/cli 2.5.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.
- package/dist/cli.mjs +50 -23
- 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.7.0" : "2.7.0";
|
|
18602
18602
|
var FLAG_QUIET = false;
|
|
18603
18603
|
var FLAG_VERBOSE = false;
|
|
18604
18604
|
var FLAG_AUTO_ACCEPT = false;
|
|
@@ -24216,23 +24216,37 @@ function TextBlock({ content }) {
|
|
|
24216
24216
|
}) });
|
|
24217
24217
|
}
|
|
24218
24218
|
function CodeBlock({ content, lang }) {
|
|
24219
|
-
const w = Math.min(process.stdout.columns - 6 || 72, 72);
|
|
24220
24219
|
const allLines = content.split("\n");
|
|
24221
24220
|
const MAX_CODE_LINES = 30;
|
|
24222
24221
|
const truncated = allLines.length > MAX_CODE_LINES;
|
|
24223
|
-
const lines = truncated ? [...allLines.slice(0, 20),
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
24227
|
-
|
|
24228
|
-
|
|
24229
|
-
|
|
24230
|
-
|
|
24231
|
-
|
|
24232
|
-
|
|
24233
|
-
|
|
24234
|
-
|
|
24235
|
-
|
|
24222
|
+
const lines = truncated ? [...allLines.slice(0, 20), `\u2026 ${allLines.length - 25} more lines`, ...allLines.slice(-5)] : allLines;
|
|
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
|
+
}) });
|
|
24236
24250
|
}
|
|
24237
24251
|
function Markdown({ children }) {
|
|
24238
24252
|
const blocks = parseBlocks(children);
|
|
@@ -24583,6 +24597,12 @@ function ChatApp({ engine }) {
|
|
|
24583
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: [
|
|
24584
24598
|
/* @__PURE__ */ jsx2(Text2, { color: "cyan", bold: true, children: "\u276F" }),
|
|
24585
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") })
|
|
24586
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) }),
|
|
24587
24607
|
showModelPicker ? /* @__PURE__ */ jsx2(
|
|
24588
24608
|
ModelSelector,
|
|
@@ -24836,24 +24856,31 @@ Type / to see available commands.`;
|
|
|
24836
24856
|
await new Promise((r) => setTimeout(r, 100));
|
|
24837
24857
|
const cmdResults = [];
|
|
24838
24858
|
for (const cmd of commands) {
|
|
24839
|
-
const firstLine = cmd.split("\n")[0].slice(0, 70);
|
|
24840
|
-
const isMultiline = cmd.includes("\n");
|
|
24841
24859
|
const r = await executeShellCommand(cmd);
|
|
24842
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);
|
|
24843
24866
|
if (r.exitCode === 0) {
|
|
24844
|
-
|
|
24845
|
-
|
|
24846
|
-
const
|
|
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");
|
|
24847
24874
|
const preview = lines.length <= 4 ? lines.map((l) => ` ${l}`).join("\n") : lines.slice(0, 3).map((l) => ` ${l}`).join("\n") + `
|
|
24848
24875
|
\u2026 ${lines.length - 3} more lines`;
|
|
24849
|
-
ui?.addMessage(` \u23BF Execute(${firstLine}
|
|
24876
|
+
ui?.addMessage(` \u23BF Execute(${firstLine})
|
|
24850
24877
|
${preview}`, true);
|
|
24851
24878
|
} else {
|
|
24852
|
-
ui?.addMessage(` \u23BF Execute(${firstLine}
|
|
24879
|
+
ui?.addMessage(` \u23BF Execute(${firstLine})`, true);
|
|
24853
24880
|
}
|
|
24854
24881
|
} else {
|
|
24855
24882
|
const errLine = (r.stderr || "").trim().split("\n")[0].slice(0, 70);
|
|
24856
|
-
ui?.addMessage(` \u23BF Execute(${firstLine}
|
|
24883
|
+
ui?.addMessage(` \u23BF Execute(${firstLine})
|
|
24857
24884
|
\u2717 ${errLine}`, true);
|
|
24858
24885
|
}
|
|
24859
24886
|
}
|