rlmgrep 0.1.16__py3-none-any.whl → 0.1.18__py3-none-any.whl

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.
rlmgrep/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "0.1.16"
2
+ __version__ = "0.1.18"
rlmgrep/cli.py CHANGED
@@ -3,6 +3,8 @@ from __future__ import annotations
3
3
  import argparse
4
4
  import os
5
5
  import sys
6
+ import shutil
7
+ import subprocess
6
8
  from pathlib import Path
7
9
 
8
10
  import dspy
@@ -172,6 +174,47 @@ def _find_git_root(start: Path) -> tuple[Path | None, Path | None]:
172
174
  return None, None
173
175
 
174
176
 
177
+ def _global_ignore_paths(cwd: Path | None = None) -> list[Path]:
178
+ paths: list[Path] = []
179
+ cwd = cwd or Path.cwd()
180
+ if shutil.which("git"):
181
+ try:
182
+ result = subprocess.run(
183
+ ["git", "config", "--get", "--path", "core.excludesfile"],
184
+ cwd=cwd,
185
+ capture_output=True,
186
+ text=True,
187
+ check=False,
188
+ )
189
+ value = (result.stdout or "").strip()
190
+ except Exception:
191
+ value = ""
192
+ if value:
193
+ candidate = Path(value).expanduser()
194
+ if candidate.exists():
195
+ paths.append(candidate)
196
+
197
+ xdg_config = os.getenv("XDG_CONFIG_HOME")
198
+ if xdg_config:
199
+ default_path = Path(xdg_config) / "git" / "ignore"
200
+ else:
201
+ default_path = Path.home() / ".config" / "git" / "ignore"
202
+ if default_path.exists():
203
+ paths.append(default_path)
204
+
205
+ legacy = Path.home() / ".gitignore_global"
206
+ if legacy.exists():
207
+ paths.append(legacy)
208
+
209
+ seen: set[Path] = set()
210
+ unique: list[Path] = []
211
+ for p in paths:
212
+ if p not in seen:
213
+ seen.add(p)
214
+ unique.append(p)
215
+ return unique
216
+
217
+
175
218
  def _env_value(name: str) -> str | None:
176
219
  val = os.getenv(name)
177
220
  if val is None:
@@ -465,6 +508,7 @@ def main(argv: list[str] | None = None) -> int:
465
508
  extra_ignores: list[Path] = []
466
509
  if git_dir is not None:
467
510
  extra_ignores.append(git_dir / "info" / "exclude")
511
+ extra_ignores.extend(_global_ignore_paths(ignore_root))
468
512
  ignore_spec = build_ignore_spec(ignore_root, extra_paths=extra_ignores)
469
513
 
470
514
  candidates = collect_candidates(
rlmgrep/ingest.py CHANGED
@@ -347,6 +347,12 @@ def collect_candidates(
347
347
  ) -> list[Path]:
348
348
  files = collect_files(paths, recursive=recursive)
349
349
  explicit_files: set[Path] = set()
350
+ ignore_root_resolved: Path | None = None
351
+ if ignore_root is not None:
352
+ try:
353
+ ignore_root_resolved = ignore_root.resolve()
354
+ except Exception:
355
+ ignore_root_resolved = ignore_root
350
356
  for raw in paths:
351
357
  p = Path(raw)
352
358
  if p.exists() and p.is_file():
@@ -363,9 +369,9 @@ def collect_candidates(
363
369
  except ValueError:
364
370
  key = fp.as_posix()
365
371
 
366
- if ignore_spec is not None and ignore_root is not None and not is_explicit:
372
+ if ignore_spec is not None and ignore_root_resolved is not None and not is_explicit:
367
373
  try:
368
- rel = fp.relative_to(ignore_root).as_posix()
374
+ rel = fp_resolved.relative_to(ignore_root_resolved).as_posix()
369
375
  except ValueError:
370
376
  rel = None
371
377
  if rel and ignore_spec.match_file(rel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rlmgrep
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: Grep-shaped CLI search powered by DSPy RLM
5
5
  Author: rlmgrep
6
6
  License: MIT
@@ -0,0 +1,14 @@
1
+ rlmgrep/__init__.py,sha256=4P4PJ704cude_tDknqGG0LoqrFcJS7Bpzjp_q0uTPNg,49
2
+ rlmgrep/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
3
+ rlmgrep/cli.py,sha256=DbA8WDqkUrWYV5lItA_mlYB9v0H9ZOPm8JjZLIX1Y7E,23291
4
+ rlmgrep/config.py,sha256=u1iz-nI8dj-dZETbpIki3RQefHJEyi5oE5zE4_IR8kg,2399
5
+ rlmgrep/file_map.py,sha256=x2Ri1wzK8_87GUorsAV01K_nYLZcv30yIquDeTCcdEw,876
6
+ rlmgrep/ingest.py,sha256=3qPJ-FZfWpxwTJBSj_EPWNDCdDDgNgZIGyCTXyXOZfk,12891
7
+ rlmgrep/interpreter.py,sha256=s_nMRxLlAU9C0JmUzUBW5NbVbuH67doVWF54K54STlA,2478
8
+ rlmgrep/render.py,sha256=mCTT6yuKNv7HJ46LzOyLkCbyBedCWSNd7UeubyLXcyM,3356
9
+ rlmgrep/rlm.py,sha256=i3rCTp8OABByF60Un5gO7265gaW4spwU0OFKIz4surg,5750
10
+ rlmgrep-0.1.18.dist-info/METADATA,sha256=6doosFWzRkxGxbKynYyUMMmF6ih0rs8BWGdi0BMeCFs,7969
11
+ rlmgrep-0.1.18.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
+ rlmgrep-0.1.18.dist-info/entry_points.txt,sha256=UV6QkEbkwBO1JJ53mm84_n35tVyOczPvOQ14ga7vrCI,45
13
+ rlmgrep-0.1.18.dist-info/top_level.txt,sha256=gTujSRsO58c80eN7aRH2cfe51FHxx8LJ1w1Y2YlHti0,8
14
+ rlmgrep-0.1.18.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- rlmgrep/__init__.py,sha256=bJX6YPY5JOkDgVGHB_OzdE80oQjB2sVUuoGFrBuXuds,49
2
- rlmgrep/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
3
- rlmgrep/cli.py,sha256=VZTfuMKXTafPtIYwzY93A_rOjUI-txLOCAZ7d5uVjdQ,22002
4
- rlmgrep/config.py,sha256=u1iz-nI8dj-dZETbpIki3RQefHJEyi5oE5zE4_IR8kg,2399
5
- rlmgrep/file_map.py,sha256=x2Ri1wzK8_87GUorsAV01K_nYLZcv30yIquDeTCcdEw,876
6
- rlmgrep/ingest.py,sha256=AetMIjiZFD5Yz9W3QA1_Zu0bQqEcCU32-1kRy4fr1PE,12644
7
- rlmgrep/interpreter.py,sha256=s_nMRxLlAU9C0JmUzUBW5NbVbuH67doVWF54K54STlA,2478
8
- rlmgrep/render.py,sha256=mCTT6yuKNv7HJ46LzOyLkCbyBedCWSNd7UeubyLXcyM,3356
9
- rlmgrep/rlm.py,sha256=i3rCTp8OABByF60Un5gO7265gaW4spwU0OFKIz4surg,5750
10
- rlmgrep-0.1.16.dist-info/METADATA,sha256=GogEzHgvS_j1PO_QKr7Q3UcL-09ENHMJ9UL4XiezmqU,7969
11
- rlmgrep-0.1.16.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
- rlmgrep-0.1.16.dist-info/entry_points.txt,sha256=UV6QkEbkwBO1JJ53mm84_n35tVyOczPvOQ14ga7vrCI,45
13
- rlmgrep-0.1.16.dist-info/top_level.txt,sha256=gTujSRsO58c80eN7aRH2cfe51FHxx8LJ1w1Y2YlHti0,8
14
- rlmgrep-0.1.16.dist-info/RECORD,,