rlm-cli 0.2.18 → 0.2.19

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.
@@ -687,6 +687,8 @@ function walkDir(dir, depth = 0) {
687
687
  return results;
688
688
  }
689
689
  for (const entry of entries) {
690
+ if (results.length >= MAX_FILES)
691
+ break;
690
692
  if (entry.name.startsWith(".") && entry.name !== ".env")
691
693
  continue;
692
694
  if (entry.isSymbolicLink())
@@ -695,18 +697,25 @@ function walkDir(dir, depth = 0) {
695
697
  if (entry.isDirectory()) {
696
698
  if (SKIP_DIRS.has(entry.name))
697
699
  continue;
698
- results.push(...walkDir(full, depth + 1));
700
+ const sub = walkDir(full, depth + 1);
701
+ const remaining = MAX_FILES - results.length;
702
+ results.push(...sub.slice(0, remaining));
699
703
  }
700
704
  else if (entry.isFile()) {
701
705
  if (!isBinaryFile(full))
702
706
  results.push(full);
703
707
  }
704
- if (results.length > MAX_FILES)
705
- break;
706
708
  }
707
709
  return results;
708
710
  }
711
+ /** Normalize path separators to forward slash for consistent matching. */
712
+ function toForwardSlash(p) {
713
+ return p.replace(/\\/g, "/");
714
+ }
709
715
  function simpleGlobMatch(pattern, filePath, _braceDepth = 0) {
716
+ // Normalize both to forward slashes for cross-platform matching
717
+ pattern = toForwardSlash(pattern);
718
+ filePath = toForwardSlash(filePath);
710
719
  // Expand {a,b,c} braces into alternatives (with depth limit)
711
720
  const braceMatch = pattern.match(/\{([^}]+)\}/);
712
721
  if (braceMatch && _braceDepth < 5) {
@@ -752,8 +761,9 @@ function resolveFileArgs(args) {
752
761
  // Glob pattern (contains * or ?)
753
762
  if (arg.includes("*") || arg.includes("?")) {
754
763
  // Find the base directory (portion before the first glob char)
755
- const firstGlob = arg.search(/[*?{]/);
756
- const baseDir = firstGlob > 0 ? path.resolve(arg.slice(0, arg.lastIndexOf("/", firstGlob) + 1) || ".") : process.cwd();
764
+ const normalized = toForwardSlash(arg);
765
+ const firstGlob = normalized.search(/[*?{]/);
766
+ const baseDir = firstGlob > 0 ? path.resolve(normalized.slice(0, normalized.lastIndexOf("/", firstGlob) + 1) || ".") : process.cwd();
757
767
  const allFiles = walkDir(baseDir);
758
768
  for (const f of allFiles) {
759
769
  const rel = path.relative(process.cwd(), f);
@@ -983,7 +993,8 @@ function extractFilePath(input) {
983
993
  return { filePath, query };
984
994
  }
985
995
  }
986
- const absPathMatch = input.match(/(\/[^\s]+)/);
996
+ // Unix absolute path (/...) or Windows absolute path (C:\...)
997
+ const absPathMatch = input.match(/((?:\/|[A-Za-z]:[\\\/])[^\s]+)/);
987
998
  if (absPathMatch) {
988
999
  const filePath = absPathMatch[1];
989
1000
  if (fs.existsSync(filePath)) {
@@ -991,7 +1002,8 @@ function extractFilePath(input) {
991
1002
  return { filePath, query };
992
1003
  }
993
1004
  }
994
- const relPathMatch = input.match(/([\w\-\.]+\/[\w\-\./]+\.\w{2,6})/);
1005
+ // Relative path with forward or back slashes
1006
+ const relPathMatch = input.match(/([\w\-\.]+[\/\\][\w\-\.\/\\]+\.\w{2,6})/);
995
1007
  if (relPathMatch) {
996
1008
  const filePath = path.resolve(relPathMatch[1]);
997
1009
  if (fs.existsSync(filePath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rlm-cli",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "Standalone CLI for Recursive Language Models (RLMs) — implements Algorithm 1 from arXiv:2512.24601",
5
5
  "type": "module",
6
6
  "bin": {