@robinpath/cli 2.2.0 → 2.4.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 +51 -23
  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.2.0" : "2.2.0";
18601
+ var CLI_VERSION = true ? "2.4.0" : "2.4.0";
18602
18602
  var FLAG_QUIET = false;
18603
18603
  var FLAG_VERBOSE = false;
18604
18604
  var FLAG_AUTO_ACCEPT = false;
@@ -22868,7 +22868,7 @@ var MAX_FILE_SIZE = 5e4;
22868
22868
  var MAX_TOTAL_SIZE = 2e5;
22869
22869
  function findFileRefs(prompt) {
22870
22870
  const refs = [];
22871
- const regex = /@\/([\w.\-\/\\*]+)/g;
22871
+ const regex = /@([\w.\-\/\\*]+)/g;
22872
22872
  let match;
22873
22873
  while ((match = regex.exec(prompt)) !== null) {
22874
22874
  refs.push(match[1]);
@@ -22948,7 +22948,7 @@ ${f.content}
22948
22948
  }
22949
22949
  let cleaned = prompt;
22950
22950
  for (const pattern of patterns) {
22951
- cleaned = cleaned.replace(`@/${pattern}`, "").trim();
22951
+ cleaned = cleaned.replace(`@${pattern}`, "").trim();
22952
22952
  }
22953
22953
  const expanded = fileBlocks.length > 0 ? `${fileBlocks.join("\n\n")}
22954
22954
 
@@ -22965,7 +22965,7 @@ function listReferenceableFiles(cwd, prefix) {
22965
22965
  try {
22966
22966
  const stat2 = statSync4(join10(workDir, entry));
22967
22967
  if (stat2.isFile() && stat2.size <= MAX_FILE_SIZE) {
22968
- const ref = `@/${entry}`;
22968
+ const ref = `@${entry}`;
22969
22969
  if (!prefix || ref.startsWith(prefix)) {
22970
22970
  results.push(ref);
22971
22971
  }
@@ -24242,7 +24242,7 @@ function Markdown({ children }) {
24242
24242
  // src/ink-repl.tsx
24243
24243
  import { homedir as homedir8, platform as platform7 } from "node:os";
24244
24244
  import { randomUUID as randomUUID4 } from "node:crypto";
24245
- import { existsSync as existsSync11, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "node:fs";
24245
+ import { existsSync as existsSync11, readdirSync as readdirSync6, statSync as statSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "node:fs";
24246
24246
  import { join as join12 } from "node:path";
24247
24247
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
24248
24248
  var nextId = 0;
@@ -24271,6 +24271,24 @@ function InputArea({ onSubmit, placeholder, statusText }) {
24271
24271
  return Object.entries(COMMANDS).filter(([cmd]) => cmd.startsWith(value));
24272
24272
  }, [value]);
24273
24273
  const showHints = value.startsWith("/") && matchingCommands.length > 0;
24274
+ const showFiles = useMemo(() => {
24275
+ const atMatch = value.match(/@(\S*)$/);
24276
+ if (!atMatch) return [];
24277
+ const prefix = atMatch[1] || "";
24278
+ try {
24279
+ const entries = readdirSync6(process.cwd());
24280
+ return entries.filter((e) => !e.startsWith(".") && (!prefix || e.toLowerCase().startsWith(prefix.toLowerCase()))).slice(0, 10).map((e) => {
24281
+ try {
24282
+ const s = statSync6(join12(process.cwd(), e));
24283
+ return { name: e, isDir: s.isDirectory() };
24284
+ } catch {
24285
+ return { name: e, isDir: false };
24286
+ }
24287
+ });
24288
+ } catch {
24289
+ return [];
24290
+ }
24291
+ }, [value]);
24274
24292
  useInput((ch, key) => {
24275
24293
  if (key.return) {
24276
24294
  if (value.endsWith("\\")) {
@@ -24302,7 +24320,17 @@ function InputArea({ onSubmit, placeholder, statusText }) {
24302
24320
  return;
24303
24321
  }
24304
24322
  if (key.tab) {
24305
- if (matchingCommands.length === 1) setValue(matchingCommands[0][0]);
24323
+ if (matchingCommands.length === 1) {
24324
+ setValue(matchingCommands[0][0]);
24325
+ return;
24326
+ }
24327
+ if (showFiles.length === 1) {
24328
+ const atMatch = value.match(/@(\S*)$/);
24329
+ if (atMatch) {
24330
+ const before = value.slice(0, value.length - atMatch[0].length);
24331
+ setValue(before + "@" + showFiles[0].name + " ");
24332
+ }
24333
+ }
24306
24334
  return;
24307
24335
  }
24308
24336
  if (ch === "") {
@@ -24335,8 +24363,13 @@ function InputArea({ onSubmit, placeholder, statusText }) {
24335
24363
  ] }, i)) }),
24336
24364
  /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(Math.max(process.stdout.columns || 80, 40)) })
24337
24365
  ] }),
24366
+ showFiles.length > 0 && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", paddingX: 2, marginTop: 1, children: showFiles.map((f) => /* @__PURE__ */ jsxs2(Text2, { children: [
24367
+ /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "+ " }),
24368
+ /* @__PURE__ */ jsx2(Text2, { bold: f.name.endsWith(".rp") || f.name.endsWith(".robin"), children: f.name }),
24369
+ f.isDir ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "/" }) : null
24370
+ ] }, f.name)) }),
24338
24371
  /* @__PURE__ */ jsxs2(Box2, { paddingX: 2, justifyContent: "space-between", children: [
24339
- /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "/ for commands" }),
24372
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "/ for commands \xB7 @ for files" }),
24340
24373
  /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: statusText || "" })
24341
24374
  ] })
24342
24375
  ] });
@@ -24531,13 +24564,7 @@ function ChatApp({ engine }) {
24531
24564
  /* @__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: [
24532
24565
  /* @__PURE__ */ jsx2(Text2, { color: "cyan", bold: true, children: "\u276F" }),
24533
24566
  /* @__PURE__ */ jsx2(Text2, { bold: true, children: msg.text.slice(1) })
24534
- ] }) : msg.text.startsWith("\u2713") ? /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24535
- /* @__PURE__ */ jsx2(Text2, { color: "green", children: "\u2713" }),
24536
- msg.text.slice(1)
24537
- ] }) : msg.text.startsWith("\u2717") ? /* @__PURE__ */ jsxs2(Text2, { children: [
24538
- /* @__PURE__ */ jsx2(Text2, { color: "red", children: "\u2717" }),
24539
- msg.text.slice(1)
24540
- ] }) : msg.dim ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, wrap: "wrap", children: msg.text }) : /* @__PURE__ */ jsx2(Markdown, { children: msg.text }) }, msg.id) }),
24567
+ ] }) : 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) }),
24541
24568
  showModelPicker ? /* @__PURE__ */ jsx2(
24542
24569
  ModelSelector,
24543
24570
  {
@@ -24790,24 +24817,25 @@ Type / to see available commands.`;
24790
24817
  await new Promise((r) => setTimeout(r, 100));
24791
24818
  const cmdResults = [];
24792
24819
  for (const cmd of commands) {
24793
- const firstLine = cmd.split("\n")[0].slice(0, 60);
24820
+ const firstLine = cmd.split("\n")[0].slice(0, 70);
24821
+ const isMultiline = cmd.includes("\n");
24794
24822
  const r = await executeShellCommand(cmd);
24795
24823
  cmdResults.push({ command: cmd, stdout: r.stdout || "", stderr: r.stderr || "", exitCode: r.exitCode });
24796
24824
  if (r.exitCode === 0) {
24797
24825
  const output = (r.stdout || "").trim();
24798
24826
  if (output) {
24799
24827
  const lines = output.split("\n");
24800
- const short = lines.length <= 3 ? output : lines.slice(0, 3).join("\n") + `
24801
- (${lines.length - 3} more lines)`;
24802
- ui?.addMessage(`\u2713 ${firstLine}
24803
- ${short}`, true);
24828
+ const preview = lines.length <= 4 ? lines.map((l) => ` ${l}`).join("\n") : lines.slice(0, 3).map((l) => ` ${l}`).join("\n") + `
24829
+ \u2026 ${lines.length - 3} more lines`;
24830
+ ui?.addMessage(` \u23BF Execute(${firstLine}${isMultiline ? " \u2026" : ""})
24831
+ ${preview}`, true);
24804
24832
  } else {
24805
- ui?.addMessage(`\u2713 ${firstLine}`, true);
24833
+ ui?.addMessage(` \u23BF Execute(${firstLine}${isMultiline ? " \u2026" : ""})`, true);
24806
24834
  }
24807
24835
  } else {
24808
- const errLine = (r.stderr || "").trim().split("\n")[0].slice(0, 80);
24809
- ui?.addMessage(`\u2717 ${firstLine}
24810
- ${errLine}`, true);
24836
+ const errLine = (r.stderr || "").trim().split("\n")[0].slice(0, 70);
24837
+ ui?.addMessage(` \u23BF Execute(${firstLine}${isMultiline ? " \u2026" : ""})
24838
+ \u2717 ${errLine}`, true);
24811
24839
  }
24812
24840
  }
24813
24841
  const summary = cmdResults.map((r) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",