@robinpath/cli 2.3.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 +40 -7
  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.3.0" : "2.3.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
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "2.3.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",