@robinpath/cli 1.82.0 → 1.83.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 +137 -37
  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.82.0" : "1.82.0";
18601
+ var CLI_VERSION = true ? "1.83.0" : "1.83.0";
18602
18602
  var FLAG_QUIET = false;
18603
18603
  var FLAG_VERBOSE = false;
18604
18604
  var FLAG_AUTO_ACCEPT = false;
@@ -24156,11 +24156,111 @@ ${resultSummary}`
24156
24156
 
24157
24157
  // src/ink-repl.tsx
24158
24158
  import { useState, useCallback, useEffect, useMemo } from "react";
24159
- import { render, Box, Text, Static, useInput, useApp } from "ink";
24159
+ import { render, Box as Box2, Text as Text2, Static, useInput, useApp } from "ink";
24160
24160
  import InkSpinner from "ink-spinner";
24161
+
24162
+ // src/ui/Markdown.tsx
24163
+ import { Box, Text } from "ink";
24164
+ import { jsx, jsxs } from "react/jsx-runtime";
24165
+ function parseBlocks(text) {
24166
+ const blocks = [];
24167
+ const codeBlockRegex = /```(\w*)\n([\s\S]*?)```/g;
24168
+ let lastIndex = 0;
24169
+ let match;
24170
+ while ((match = codeBlockRegex.exec(text)) !== null) {
24171
+ if (match.index > lastIndex) {
24172
+ blocks.push({ type: "text", content: text.slice(lastIndex, match.index) });
24173
+ }
24174
+ blocks.push({ type: "code", content: match[2].trimEnd(), lang: match[1] || void 0 });
24175
+ lastIndex = match.index + match[0].length;
24176
+ }
24177
+ if (lastIndex < text.length) {
24178
+ blocks.push({ type: "text", content: text.slice(lastIndex) });
24179
+ }
24180
+ return blocks;
24181
+ }
24182
+ function renderInlineMarkdown(line) {
24183
+ const parts = [];
24184
+ let remaining = line;
24185
+ let key = 0;
24186
+ while (remaining.length > 0) {
24187
+ const boldMatch = remaining.match(/^\*\*(.*?)\*\*/);
24188
+ if (boldMatch) {
24189
+ parts.push(/* @__PURE__ */ jsx(Text, { bold: true, children: boldMatch[1] }, key++));
24190
+ remaining = remaining.slice(boldMatch[0].length);
24191
+ continue;
24192
+ }
24193
+ const codeMatch = remaining.match(/^`([^`]+)`/);
24194
+ if (codeMatch) {
24195
+ parts.push(/* @__PURE__ */ jsx(Text, { color: "yellow", children: codeMatch[1] }, key++));
24196
+ remaining = remaining.slice(codeMatch[0].length);
24197
+ continue;
24198
+ }
24199
+ const nextSpecial = remaining.search(/\*\*|`/);
24200
+ if (nextSpecial === -1) {
24201
+ parts.push(/* @__PURE__ */ jsx(Text, { children: remaining }, key++));
24202
+ break;
24203
+ }
24204
+ parts.push(/* @__PURE__ */ jsx(Text, { children: remaining.slice(0, nextSpecial) }, key++));
24205
+ remaining = remaining.slice(nextSpecial);
24206
+ }
24207
+ return parts;
24208
+ }
24209
+ function TextBlock({ content }) {
24210
+ const lines = content.split("\n");
24211
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: lines.map((line, i) => {
24212
+ const trimmed = line.trimStart();
24213
+ if (!trimmed) return /* @__PURE__ */ jsx(Text, { children: " " }, i);
24214
+ if (trimmed.startsWith("## ")) {
24215
+ return /* @__PURE__ */ jsx(Text, { bold: true, children: trimmed.slice(3) }, i);
24216
+ }
24217
+ if (trimmed.startsWith("# ")) {
24218
+ return /* @__PURE__ */ jsx(Text, { bold: true, children: trimmed.slice(2) }, i);
24219
+ }
24220
+ if (trimmed.startsWith("- ") || trimmed.startsWith("* ")) {
24221
+ return /* @__PURE__ */ jsxs(Text, { children: [
24222
+ /* @__PURE__ */ jsx(Text, { color: "cyan", children: " \u2022 " }),
24223
+ renderInlineMarkdown(trimmed.slice(2))
24224
+ ] }, i);
24225
+ }
24226
+ const numMatch = trimmed.match(/^(\d+)\.\s/);
24227
+ if (numMatch) {
24228
+ return /* @__PURE__ */ jsxs(Text, { children: [
24229
+ /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
24230
+ " ",
24231
+ numMatch[1],
24232
+ ". "
24233
+ ] }),
24234
+ renderInlineMarkdown(trimmed.slice(numMatch[0].length))
24235
+ ] }, i);
24236
+ }
24237
+ return /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: renderInlineMarkdown(line) }, i);
24238
+ }) });
24239
+ }
24240
+ function CodeBlock({ content, lang }) {
24241
+ const w = Math.min(process.stdout.columns - 6 || 72, 72);
24242
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, marginX: 1, children: [
24243
+ /* @__PURE__ */ jsxs(Text, { children: [
24244
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u250C" }),
24245
+ lang ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${lang} ` }) : null,
24246
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2500".repeat(Math.max(0, w - (lang ? lang.length + 5 : 3))) })
24247
+ ] }),
24248
+ content.split("\n").map((line, i) => /* @__PURE__ */ jsxs(Text, { children: [
24249
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2502 " }),
24250
+ /* @__PURE__ */ jsx(Text, { color: "white", children: line })
24251
+ ] }, i)),
24252
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2514" + "\u2500".repeat(w - 3) })
24253
+ ] });
24254
+ }
24255
+ function Markdown({ children }) {
24256
+ const blocks = parseBlocks(children);
24257
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: blocks.map((block, i) => block.type === "code" ? /* @__PURE__ */ jsx(CodeBlock, { content: block.content, lang: block.lang }, i) : /* @__PURE__ */ jsx(TextBlock, { content: block.content }, i)) });
24258
+ }
24259
+
24260
+ // src/ink-repl.tsx
24161
24261
  import { platform as platform7 } from "node:os";
24162
24262
  import { randomUUID as randomUUID4 } from "node:crypto";
24163
- import { jsx, jsxs } from "react/jsx-runtime";
24263
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
24164
24264
  var nextId = 0;
24165
24265
  var COMMANDS = {
24166
24266
  "/model": "Switch AI model",
@@ -24234,33 +24334,33 @@ function InputArea({ onSubmit, placeholder }) {
24234
24334
  const lines = value.split("\n");
24235
24335
  const empty = value === "";
24236
24336
  const w = Math.min(process.stdout.columns - 4 || 76, 76);
24237
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
24238
- showHints && /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginX: 2, marginBottom: 1, children: matchingCommands.slice(0, 8).map(([cmd, desc]) => /* @__PURE__ */ jsxs(Text, { children: [
24239
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: cmd.padEnd(14) }),
24240
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: desc })
24337
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", marginTop: 1, children: [
24338
+ showHints && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", marginX: 2, marginBottom: 1, children: matchingCommands.slice(0, 8).map(([cmd, desc]) => /* @__PURE__ */ jsxs2(Text2, { children: [
24339
+ /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: cmd.padEnd(14) }),
24340
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: desc })
24241
24341
  ] }, cmd)) }),
24242
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginX: 1, children: [
24243
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2500".repeat(w) }),
24244
- /* @__PURE__ */ jsx(Box, { paddingX: 1, flexDirection: "column", children: empty ? /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
24342
+ /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", marginX: 1, children: [
24343
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(w) }),
24344
+ /* @__PURE__ */ jsx2(Box2, { paddingX: 1, flexDirection: "column", children: empty ? /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24245
24345
  "> ",
24246
24346
  placeholder
24247
- ] }) : lines.map((line, i) => /* @__PURE__ */ jsxs(Text, { children: [
24248
- i === 0 ? /* @__PURE__ */ jsx(Text, { color: "cyan", children: "> " }) : /* @__PURE__ */ jsx(Text, { dimColor: true, children: " " }),
24347
+ ] }) : lines.map((line, i) => /* @__PURE__ */ jsxs2(Text2, { children: [
24348
+ i === 0 ? /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "> " }) : /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: " " }),
24249
24349
  line,
24250
- i === lines.length - 1 ? /* @__PURE__ */ jsx(Text, { color: "cyan", children: "\u258E" }) : null
24350
+ i === lines.length - 1 ? /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "\u258E" }) : null
24251
24351
  ] }, i)) }),
24252
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2500".repeat(w) })
24352
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(w) })
24253
24353
  ] }),
24254
- /* @__PURE__ */ jsx(Box, { marginX: 2, children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
24255
- /* @__PURE__ */ jsx(Text, { color: "gray", children: "enter" }),
24354
+ /* @__PURE__ */ jsx2(Box2, { marginX: 2, children: /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24355
+ /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "enter" }),
24256
24356
  " send ",
24257
- /* @__PURE__ */ jsx(Text, { color: "gray", children: "\\" }),
24357
+ /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "\\" }),
24258
24358
  " newline ",
24259
- /* @__PURE__ */ jsx(Text, { color: "gray", children: "/" }),
24359
+ /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "/" }),
24260
24360
  " commands ",
24261
- /* @__PURE__ */ jsx(Text, { color: "gray", children: "tab" }),
24361
+ /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "tab" }),
24262
24362
  " complete ",
24263
- /* @__PURE__ */ jsx(Text, { color: "gray", children: "@/" }),
24363
+ /* @__PURE__ */ jsx2(Text2, { color: "gray", children: "@/" }),
24264
24364
  " files"
24265
24365
  ] }) })
24266
24366
  ] });
@@ -24304,35 +24404,35 @@ function ChatApp({ engine }) {
24304
24404
  engine.updateStatus();
24305
24405
  }, [engine]);
24306
24406
  const isFirst = messages.length === 0;
24307
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", padding: 1, children: [
24308
- /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { children: [
24309
- /* @__PURE__ */ jsx(Text, { color: "cyan", bold: true, children: "\u25C6" }),
24407
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", padding: 1, children: [
24408
+ /* @__PURE__ */ jsx2(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsxs2(Text2, { children: [
24409
+ /* @__PURE__ */ jsx2(Text2, { color: "cyan", bold: true, children: "\u25C6" }),
24310
24410
  " ",
24311
- /* @__PURE__ */ jsx(Text, { bold: true, children: "RobinPath" }),
24411
+ /* @__PURE__ */ jsx2(Text2, { bold: true, children: "RobinPath" }),
24312
24412
  " ",
24313
- /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
24413
+ /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24314
24414
  "v",
24315
24415
  CLI_VERSION
24316
24416
  ] })
24317
24417
  ] }) }),
24318
- /* @__PURE__ */ jsx(Static, { items: messages, children: (msg) => /* @__PURE__ */ jsx(Box, { paddingX: 1, marginBottom: msg.text.startsWith("\u276F") ? 0 : 1, children: msg.text.startsWith("\u276F") ? /* @__PURE__ */ jsxs(Text, { children: [
24319
- /* @__PURE__ */ jsx(Text, { color: "cyan", bold: true, children: "\u276F" }),
24320
- /* @__PURE__ */ jsx(Text, { bold: true, children: msg.text.slice(1) })
24321
- ] }) : msg.dim ? /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "wrap", children: msg.text }) : /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: msg.text }) }, msg.id) }),
24322
- loading ? /* @__PURE__ */ jsx(Box, { flexDirection: "column", paddingX: 1, children: streaming ? /* @__PURE__ */ jsxs(Text, { wrap: "wrap", children: [
24323
- streaming,
24324
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: "\u258D" })
24325
- ] }) : /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
24326
- /* @__PURE__ */ jsx(InkSpinner, { type: "dots" }),
24418
+ /* @__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: [
24419
+ /* @__PURE__ */ jsx2(Text2, { color: "cyan", bold: true, children: "\u276F" }),
24420
+ /* @__PURE__ */ jsx2(Text2, { bold: true, children: msg.text.slice(1) })
24421
+ ] }) : msg.dim ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, wrap: "wrap", children: msg.text }) : /* @__PURE__ */ jsx2(Markdown, { children: msg.text }) }, msg.id) }),
24422
+ loading ? /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", paddingX: 1, children: streaming ? /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
24423
+ /* @__PURE__ */ jsx2(Markdown, { children: streaming }),
24424
+ /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "\u258D" })
24425
+ ] }) : /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24426
+ /* @__PURE__ */ jsx2(InkSpinner, { type: "dots" }),
24327
24427
  " Thinking"
24328
- ] }) }) : /* @__PURE__ */ jsx(
24428
+ ] }) }) : /* @__PURE__ */ jsx2(
24329
24429
  InputArea,
24330
24430
  {
24331
24431
  onSubmit: handleSubmit,
24332
24432
  placeholder: isFirst ? "Anything to automate with RobinPath?" : "Ask anything..."
24333
24433
  }
24334
24434
  ),
24335
- status ? /* @__PURE__ */ jsx(Box, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: status }) }) : null
24435
+ status ? /* @__PURE__ */ jsx2(Box2, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: status }) }) : null
24336
24436
  ] });
24337
24437
  }
24338
24438
  var ReplEngine = class {
@@ -24582,7 +24682,7 @@ ${summary}` });
24582
24682
  };
24583
24683
  async function startInkREPL(initialPrompt, resumeSessionId, opts = {}) {
24584
24684
  const engine = new ReplEngine(resumeSessionId, opts);
24585
- const { waitUntilExit } = render(/* @__PURE__ */ jsx(ChatApp, { engine }));
24685
+ const { waitUntilExit } = render(/* @__PURE__ */ jsx2(ChatApp, { engine }));
24586
24686
  global.__rpExit = () => engine.exit();
24587
24687
  if (initialPrompt) {
24588
24688
  await new Promise((r) => setTimeout(r, 200));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "1.82.0",
3
+ "version": "1.83.0",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",