@robinpath/cli 3.1.0 → 3.2.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 +39 -8
- 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 ? "3.
|
|
18601
|
+
var CLI_VERSION = true ? "3.2.0" : "3.2.0";
|
|
18602
18602
|
var FLAG_QUIET = false;
|
|
18603
18603
|
var FLAG_VERBOSE = false;
|
|
18604
18604
|
var FLAG_AUTO_ACCEPT = false;
|
|
@@ -20076,9 +20076,7 @@ async function loadInstalledModules(rp2) {
|
|
|
20076
20076
|
}
|
|
20077
20077
|
if (FLAG_VERBOSE) logVerbose(`Loaded module: ${packageName}@${info.version}`);
|
|
20078
20078
|
} catch (err) {
|
|
20079
|
-
|
|
20080
|
-
color.yellow("Warning:") + ` Failed to load module ${packageName}: ${err.message}`
|
|
20081
|
-
);
|
|
20079
|
+
logVerbose(`Failed to load module ${packageName}: ${err.message}`);
|
|
20082
20080
|
}
|
|
20083
20081
|
}
|
|
20084
20082
|
}
|
|
@@ -24141,6 +24139,7 @@ import { render, Box as Box2, Text as Text2, useInput, useApp } from "ink";
|
|
|
24141
24139
|
import InkSpinner from "ink-spinner";
|
|
24142
24140
|
|
|
24143
24141
|
// src/ui/Markdown.tsx
|
|
24142
|
+
import React from "react";
|
|
24144
24143
|
import { Box, Text } from "ink";
|
|
24145
24144
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24146
24145
|
function parseBlocks(text) {
|
|
@@ -24187,11 +24186,42 @@ function renderInlineMarkdown(line) {
|
|
|
24187
24186
|
}
|
|
24188
24187
|
return parts;
|
|
24189
24188
|
}
|
|
24189
|
+
function renderTable(tableLines) {
|
|
24190
|
+
const rows = tableLines.filter((l) => !l.match(/^\s*\|[-:\s|]+\|\s*$/)).map((l) => l.split("|").slice(1, -1).map((cell) => cell.trim()));
|
|
24191
|
+
if (rows.length === 0) return null;
|
|
24192
|
+
const colCount = rows[0].length;
|
|
24193
|
+
const widths = Array(colCount).fill(0);
|
|
24194
|
+
for (const row of rows) {
|
|
24195
|
+
for (let c = 0; c < Math.min(row.length, colCount); c++) {
|
|
24196
|
+
widths[c] = Math.max(widths[c], row[c].length);
|
|
24197
|
+
}
|
|
24198
|
+
}
|
|
24199
|
+
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginY: 1, children: rows.map((row, ri) => /* @__PURE__ */ jsxs(Text, { bold: ri === 0, dimColor: ri === 0, children: [
|
|
24200
|
+
" ",
|
|
24201
|
+
row.map((cell, ci) => cell.padEnd(widths[ci] || 0) + " ").join("")
|
|
24202
|
+
] }, ri)) });
|
|
24203
|
+
}
|
|
24190
24204
|
function TextBlock({ content }) {
|
|
24191
24205
|
const lines = content.split("\n");
|
|
24192
|
-
|
|
24206
|
+
const rendered = [];
|
|
24207
|
+
let i = 0;
|
|
24208
|
+
while (i < lines.length) {
|
|
24209
|
+
if (lines[i].trim().startsWith("|") && lines[i].trim().endsWith("|")) {
|
|
24210
|
+
const tableStart = i;
|
|
24211
|
+
while (i < lines.length && lines[i].trim().startsWith("|")) i++;
|
|
24212
|
+
if (i - tableStart >= 2) {
|
|
24213
|
+
rendered.push(/* @__PURE__ */ jsx(React.Fragment, { children: renderTable(lines.slice(tableStart, i)) }, tableStart));
|
|
24214
|
+
continue;
|
|
24215
|
+
}
|
|
24216
|
+
i = tableStart;
|
|
24217
|
+
}
|
|
24218
|
+
rendered.push(/* @__PURE__ */ jsx(React.Fragment, { children: renderTextLine(lines[i], i) }, i));
|
|
24219
|
+
i++;
|
|
24220
|
+
}
|
|
24221
|
+
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: rendered });
|
|
24222
|
+
function renderTextLine(line, idx) {
|
|
24193
24223
|
const trimmed = line.trimStart();
|
|
24194
|
-
if (!trimmed) return /* @__PURE__ */ jsx(Text, { children: " " },
|
|
24224
|
+
if (!trimmed) return /* @__PURE__ */ jsx(Text, { children: " " }, idx);
|
|
24195
24225
|
if (trimmed.startsWith("## ")) {
|
|
24196
24226
|
return /* @__PURE__ */ jsx(Text, { bold: true, children: trimmed.slice(3) }, i);
|
|
24197
24227
|
}
|
|
@@ -24215,8 +24245,8 @@ function TextBlock({ content }) {
|
|
|
24215
24245
|
renderInlineMarkdown(trimmed.slice(numMatch[0].length))
|
|
24216
24246
|
] }, i);
|
|
24217
24247
|
}
|
|
24218
|
-
return /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: renderInlineMarkdown(line) },
|
|
24219
|
-
}
|
|
24248
|
+
return /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: renderInlineMarkdown(line) }, idx);
|
|
24249
|
+
}
|
|
24220
24250
|
}
|
|
24221
24251
|
function CodeBlock({ content, lang }) {
|
|
24222
24252
|
const allLines = content.split("\n");
|
|
@@ -24581,6 +24611,7 @@ function ChatApp({ engine }) {
|
|
|
24581
24611
|
const elapsed = Date.now() - startTime;
|
|
24582
24612
|
const timeStr = elapsed < 1e3 ? `${elapsed}ms` : elapsed < 6e4 ? `${(elapsed / 1e3).toFixed(1)}s` : `${Math.floor(elapsed / 6e4)}m ${Math.round(elapsed % 6e4 / 1e3)}s`;
|
|
24583
24613
|
setResponseTime(timeStr);
|
|
24614
|
+
if (elapsed > 1e4) process.stdout.write("\x07");
|
|
24584
24615
|
engine.updateStatus();
|
|
24585
24616
|
}
|
|
24586
24617
|
}, [engine]);
|