@robinpath/cli 2.4.0 → 2.6.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 +27 -17
  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.4.0" : "2.4.0";
18601
+ var CLI_VERSION = true ? "2.6.0" : "2.6.0";
18602
18602
  var FLAG_QUIET = false;
18603
18603
  var FLAG_VERBOSE = false;
18604
18604
  var FLAG_AUTO_ACCEPT = false;
@@ -24216,23 +24216,14 @@ 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), `... (${allLines.length - 25} lines hidden)`, ...allLines.slice(-5)] : allLines;
24224
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, marginX: 1, children: [
24225
- /* @__PURE__ */ jsxs(Text, { children: [
24226
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u250C" }),
24227
- lang ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${lang} ` }) : null,
24228
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2500".repeat(Math.max(0, w - (lang ? lang.length + 5 : 3))) })
24229
- ] }),
24230
- lines.map((line, i) => /* @__PURE__ */ jsxs(Text, { children: [
24231
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2502 " }),
24232
- /* @__PURE__ */ jsx(Text, { color: "white", children: line.slice(0, w - 5) })
24233
- ] }, i)),
24234
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \u2514" + "\u2500".repeat(w - 3) })
24235
- ] });
24222
+ const lines = truncated ? [...allLines.slice(0, 20), `\u2026 ${allLines.length - 25} more lines`, ...allLines.slice(-5)] : allLines;
24223
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginY: 0, paddingLeft: 2, children: lines.map((line, i) => /* @__PURE__ */ jsxs(Text, { children: [
24224
+ /* @__PURE__ */ jsx(Text, { children: " " }),
24225
+ /* @__PURE__ */ jsx(Text, { children: line })
24226
+ ] }, i)) });
24236
24227
  }
24237
24228
  function Markdown({ children }) {
24238
24229
  const blocks = parseBlocks(children);
@@ -24324,7 +24315,7 @@ function InputArea({ onSubmit, placeholder, statusText }) {
24324
24315
  setValue(matchingCommands[0][0]);
24325
24316
  return;
24326
24317
  }
24327
- if (showFiles.length === 1) {
24318
+ if (showFiles.length > 0) {
24328
24319
  const atMatch = value.match(/@(\S*)$/);
24329
24320
  if (atMatch) {
24330
24321
  const before = value.slice(0, value.length - atMatch[0].length);
@@ -24346,6 +24337,25 @@ function InputArea({ onSubmit, placeholder, statusText }) {
24346
24337
  const lines = value.split("\n");
24347
24338
  const empty = value === "";
24348
24339
  const w = Math.min(process.stdout.columns - 4 || 76, 76);
24340
+ function renderLineWithFileRefs(line) {
24341
+ const parts = [];
24342
+ const refRegex = /@([\w.\-]+)/g;
24343
+ let lastIdx = 0;
24344
+ let m;
24345
+ let k2 = 0;
24346
+ while ((m = refRegex.exec(line)) !== null) {
24347
+ if (m.index > lastIdx) parts.push(/* @__PURE__ */ jsx2(Text2, { children: line.slice(lastIdx, m.index) }, k2++));
24348
+ const fileName = m[1];
24349
+ const fileExists = existsSync11(join12(process.cwd(), fileName));
24350
+ parts.push(/* @__PURE__ */ jsxs2(Text2, { color: fileExists ? "cyan" : void 0, bold: fileExists, children: [
24351
+ "@",
24352
+ fileName
24353
+ ] }, k2++));
24354
+ lastIdx = m.index + m[0].length;
24355
+ }
24356
+ if (lastIdx < line.length) parts.push(/* @__PURE__ */ jsx2(Text2, { children: line.slice(lastIdx) }, k2++));
24357
+ return parts.length > 0 ? parts : [/* @__PURE__ */ jsx2(Text2, { children: line }, 0)];
24358
+ }
24349
24359
  return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", marginTop: 1, children: [
24350
24360
  showHints && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", marginX: 2, marginBottom: 1, children: matchingCommands.slice(0, 8).map(([cmd, desc]) => /* @__PURE__ */ jsxs2(Text2, { children: [
24351
24361
  /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: cmd.padEnd(14) }),
@@ -24358,7 +24368,7 @@ function InputArea({ onSubmit, placeholder, statusText }) {
24358
24368
  placeholder
24359
24369
  ] }) : lines.map((line, i) => /* @__PURE__ */ jsxs2(Text2, { children: [
24360
24370
  i === 0 ? /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "> " }) : /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: " " }),
24361
- line,
24371
+ renderLineWithFileRefs(line),
24362
24372
  i === lines.length - 1 ? /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "\u258E" }) : null
24363
24373
  ] }, i)) }),
24364
24374
  /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(Math.max(process.stdout.columns || 80, 40)) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",