Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ build/
*.cast
*.mp4
.openplanter/
.venv/
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,28 @@ python -m pytest tests/ --ignore=tests/test_live_models.py --ignore=tests/test_i

Requires Python 3.10+. Dependencies: `rich`, `prompt_toolkit`, `pyfiglet`.

### Using uv

[uv](https://docs.astral.sh/uv/) can be used instead of pip for faster dependency management.

```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# or: brew install uv

# Create .venv, generate uv.lock, and install everything
uv sync

# Run the agent (uses .venv automatically)
uv run openplanter-agent --workspace /path/to/data

# Run tests
uv run pytest tests/

# Install as a global CLI tool (editable, available from anywhere)
uv tool install -e .
```

## License

See [VISION.md](VISION.md) for the project's design philosophy and roadmap.
21 changes: 16 additions & 5 deletions agent/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from typing import Any

_MAX_WALK_ENTRIES = 50_000
_EXCLUDED_DIRS = {".git", ".openplanter"}

from .patching import (
AddFileOp,
Expand Down Expand Up @@ -263,7 +264,9 @@ def cleanup_bg_jobs(self) -> None:
def list_files(self, glob: str | None = None) -> str:
lines: list[str]
if shutil.which("rg"):
cmd = ["rg", "--files", "--hidden", "-g", "!.git"]
cmd = ["rg", "--files", "--hidden"]
for d in _EXCLUDED_DIRS:
cmd.extend(["-g", f"!{d}"])
if glob:
cmd.extend(["-g", glob])
try:
Expand All @@ -282,11 +285,13 @@ def list_files(self, glob: str | None = None) -> str:
all_paths: list[str] = []
count = 0
for dirpath, dirnames, filenames in os.walk(self.root):
dirnames[:] = [d for d in dirnames if d != ".git"]
dirnames[:] = [d for d in dirnames if d not in _EXCLUDED_DIRS]
count += len(filenames)
if count > _MAX_WALK_ENTRIES:
break
for fn in filenames:
if glob and not fnmatch.fnmatch(fn, glob):
continue
full = Path(dirpath) / fn
rel = full.relative_to(self.root).as_posix()
all_paths.append(rel)
Expand All @@ -305,6 +310,8 @@ def search_files(self, query: str, glob: str | None = None) -> str:
return "query cannot be empty"
if shutil.which("rg"):
cmd = ["rg", "-n", "--hidden", "-S", query, "."]
for d in _EXCLUDED_DIRS:
cmd.extend(["-g", f"!{d}"])
if glob:
cmd.extend(["-g", glob])
try:
Expand Down Expand Up @@ -332,11 +339,13 @@ def search_files(self, query: str, glob: str | None = None) -> str:
lower_query = query.lower()
count = 0
for dirpath, dirnames, filenames in os.walk(self.root):
dirnames[:] = [d for d in dirnames if d != ".git"]
dirnames[:] = [d for d in dirnames if d not in _EXCLUDED_DIRS]
count += len(filenames)
if count > _MAX_WALK_ENTRIES:
break
for fn in filenames:
if glob and not fnmatch.fnmatch(fn, glob):
continue
full = Path(dirpath) / fn
try:
text = full.read_text(encoding="utf-8", errors="replace")
Expand All @@ -353,7 +362,9 @@ def search_files(self, query: str, glob: str | None = None) -> str:
def _repo_files(self, glob: str | None, max_files: int) -> list[str]:
lines: list[str]
if shutil.which("rg"):
cmd = ["rg", "--files", "--hidden", "-g", "!.git"]
cmd = ["rg", "--files", "--hidden"]
for d in _EXCLUDED_DIRS:
cmd.extend(["-g", f"!{d}"])
if glob:
cmd.extend(["-g", glob])
try:
Expand All @@ -372,7 +383,7 @@ def _repo_files(self, glob: str | None, max_files: int) -> list[str]:
lines = []
count = 0
for dirpath, dirnames, filenames in os.walk(self.root):
dirnames[:] = [d for d in dirnames if d != ".git"]
dirnames[:] = [d for d in dirnames if d not in _EXCLUDED_DIRS]
count += len(filenames)
if count > _MAX_WALK_ENTRIES:
break
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ dependencies = [
"pyfiglet>=1.0",
]

[project.optional-dependencies]
dev = ["pytest>=7.0"]

[project.scripts]
openplanter-agent = "agent.__main__:main"

Expand Down
Loading