rlmgrep 0.1.1__py3-none-any.whl → 0.1.2__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/cli.py CHANGED
@@ -83,6 +83,11 @@ def _parse_args(argv: list[str]) -> argparse.Namespace:
83
83
  parser.add_argument("-a", "--text", dest="binary_as_text", action="store_true", help="Search binary files as text")
84
84
  parser.add_argument("--answer", action="store_true", help="Print a narrative answer before grep output")
85
85
  parser.add_argument("-y", "--yes", action="store_true", help="Skip file count confirmation")
86
+ parser.add_argument(
87
+ "--stdin-files",
88
+ action="store_true",
89
+ help="Treat stdin as newline-delimited file paths",
90
+ )
86
91
 
87
92
  parser.add_argument("-g", "--glob", dest="globs", action="append", default=[], help="Include files matching glob (may repeat)")
88
93
  parser.add_argument("--type", dest="types", action="append", default=[], help="Include file types (py, js, md, etc.). May repeat")
@@ -336,11 +341,27 @@ def main(argv: list[str] | None = None) -> int:
336
341
  for w in md_warnings:
337
342
  _warn(w)
338
343
 
339
- if not args.paths:
344
+ input_paths: list[str] | None = None
345
+ stdin_text: str | None = None
346
+ if args.paths:
347
+ input_paths = list(args.paths)
348
+ elif args.stdin_files:
340
349
  if sys.stdin.isatty():
341
350
  _warn("no input paths and stdin is empty")
342
351
  return 2
343
- text = sys.stdin.read()
352
+ raw = sys.stdin.read()
353
+ input_paths = [line.strip() for line in raw.splitlines() if line.strip()]
354
+ if not input_paths:
355
+ _warn("stdin contained no file paths")
356
+ return 2
357
+ else:
358
+ if sys.stdin.isatty():
359
+ _warn("no input paths and stdin is empty")
360
+ return 2
361
+ stdin_text = sys.stdin.read()
362
+
363
+ if input_paths is None:
364
+ text = stdin_text or ""
344
365
  files = {
345
366
  "<stdin>": FileRecord(path="<stdin>", text=text, lines=text.split("\n"))
346
367
  }
@@ -356,7 +377,7 @@ def main(argv: list[str] | None = None) -> int:
356
377
  hard_max = None
357
378
 
358
379
  candidates = collect_candidates(
359
- args.paths,
380
+ input_paths,
360
381
  cwd=cwd,
361
382
  recursive=args.recursive,
362
383
  include_globs=globs,
rlmgrep/config.py CHANGED
@@ -3,10 +3,7 @@ from __future__ import annotations
3
3
  from pathlib import Path
4
4
  from typing import Any
5
5
 
6
- try: # Python 3.11+
7
- import tomllib as _tomllib # type: ignore
8
- except Exception: # pragma: no cover - fallback
9
- import tomli as _tomllib # type: ignore
6
+ import tomllib
10
7
 
11
8
 
12
9
  DEFAULT_CONFIG_TEXT = "\n".join(
@@ -67,7 +64,7 @@ def load_config(path: Path | None = None) -> tuple[dict[str, Any], list[str]]:
67
64
  return {}, [f"config path is not a file: {config_path}"]
68
65
 
69
66
  try:
70
- data = _tomllib.loads(config_path.read_text())
67
+ data = tomllib.loads(config_path.read_text())
71
68
  except Exception as exc: # pragma: no cover - defensive
72
69
  return {}, [f"failed to read config {config_path}: {exc}"]
73
70
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rlmgrep
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Grep-shaped CLI search powered by DSPy RLM
5
5
  Author: rlmgrep
6
6
  License: MIT
@@ -72,6 +72,7 @@ Common options:
72
72
  - `--no-recursive` do not recurse directories
73
73
  - `-a`, `--text` treat binary files as text
74
74
  - `-y`, `--yes` skip file count confirmation
75
+ - `--stdin-files` treat stdin as newline-delimited file paths
75
76
  - `--model`, `--sub-model` override model names
76
77
  - `--api-key`, `--api-base`, `--model-type` override provider settings
77
78
  - `--max-iterations`, `--max-llm-calls` cap RLM search effort
@@ -91,6 +92,9 @@ rlmgrep "error handling" -g "**/*.py" -g "**/*.md" .
91
92
 
92
93
  # Read from stdin (only when no paths are provided)
93
94
  cat README.md | rlmgrep "install"
95
+
96
+ # Use rg/grep to find candidate files, then rlmgrep over that list
97
+ rg -l "token" . | rlmgrep --stdin-files --answer "what does this token control?"
94
98
  ```
95
99
 
96
100
  ## Input selection
@@ -118,6 +122,18 @@ cat README.md | rlmgrep "install"
118
122
 
119
123
  Agent tip: use `-n -H` and no context for parse-friendly output, then key off exit codes.
120
124
 
125
+ ## Regex-style queries (best effort)
126
+
127
+ rlmgrep can interpret traditional regex-style patterns inside a natural-language prompt. The RLM may use Python (including `re`) in its internal REPL to approximate regex logic, but it is **not guaranteed** to behave exactly like `grep`/`rg`.
128
+
129
+ Example (best-effort regex semantics + extra context):
130
+
131
+ ```sh
132
+ rlmgrep -n "Find Python functions that look like `def test_\\w+` and are marked as slow or flaky in nearby comments." .
133
+ ```
134
+
135
+ If you need strict, deterministic regex behavior, use `rg`/`grep`.
136
+
121
137
  ## Configuration
122
138
 
123
139
  rlmgrep creates a default config automatically if missing. The config path is:
@@ -1,14 +1,14 @@
1
1
  rlmgrep/__init__.py,sha256=tXbRXsO0NE_UV1kIHiZTTQQH0fj0U2KoxxNusu_gzrM,48
2
2
  rlmgrep/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
3
- rlmgrep/cli.py,sha256=dgv0GLL8nZ193h7b7EKum9mYDebWh-kd4drSufzmapw,17973
4
- rlmgrep/config.py,sha256=xk8uB9M01Ih9yQDemY0BMVKTJQgBlvFGU51Zg01p3yE,2536
3
+ rlmgrep/cli.py,sha256=-R8wosqWIibuWVYNFNQ2NpTh-uRpeQms3OqqBX9vuwk,18653
4
+ rlmgrep/config.py,sha256=A6VLuuXSgQ1vM207CP0G92Mg3et93dGSmkkLQ0IOfwk,2388
5
5
  rlmgrep/file_map.py,sha256=x2Ri1wzK8_87GUorsAV01K_nYLZcv30yIquDeTCcdEw,876
6
6
  rlmgrep/ingest.py,sha256=uCz2el9B-RIT9umFo-gFEdAsmWPP1IJOArFFQY0D_1A,9127
7
7
  rlmgrep/interpreter.py,sha256=s_nMRxLlAU9C0JmUzUBW5NbVbuH67doVWF54K54STlA,2478
8
8
  rlmgrep/render.py,sha256=w6KOfont2M7pQz_EEngTFMY5xJEE11N_ko8P9x5FdH8,3097
9
9
  rlmgrep/rlm.py,sha256=LZfkyWxjvtf8dwo5JxetKvvpBYeGKhajwHEVpCb2eo4,4474
10
- rlmgrep-0.1.1.dist-info/METADATA,sha256=W47e42Foa9jbgzqy-LPWpAyftVjhCZqbWJ8UeEJAW3s,5867
11
- rlmgrep-0.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
- rlmgrep-0.1.1.dist-info/entry_points.txt,sha256=UV6QkEbkwBO1JJ53mm84_n35tVyOczPvOQ14ga7vrCI,45
13
- rlmgrep-0.1.1.dist-info/top_level.txt,sha256=gTujSRsO58c80eN7aRH2cfe51FHxx8LJ1w1Y2YlHti0,8
14
- rlmgrep-0.1.1.dist-info/RECORD,,
10
+ rlmgrep-0.1.2.dist-info/METADATA,sha256=9_EA5Gy94JFgSLy9nFuoR1B0auVlhNhIyEBTtUyBTaY,6615
11
+ rlmgrep-0.1.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
+ rlmgrep-0.1.2.dist-info/entry_points.txt,sha256=UV6QkEbkwBO1JJ53mm84_n35tVyOczPvOQ14ga7vrCI,45
13
+ rlmgrep-0.1.2.dist-info/top_level.txt,sha256=gTujSRsO58c80eN7aRH2cfe51FHxx8LJ1w1Y2YlHti0,8
14
+ rlmgrep-0.1.2.dist-info/RECORD,,