Remove list_files tool
This commit is contained in:
13
nanocode.py
13
nanocode.py
@@ -40,7 +40,7 @@ def read_file(path: str, offset: int = 0, limit: int = None) -> str:
|
||||
selected = lines[offset : offset + limit]
|
||||
content = "".join(f"{offset + idx + 1:4}| {line}" for idx, line in enumerate(selected))
|
||||
tokens = len(content) // 4 # ~4 chars per token estimate
|
||||
print(f"{MAGENTA}⏺ Reading file: {path} (~{tokens:,} tokens){RESET}")
|
||||
print(f"{MAGENTA}⏺ Reading file({path}) (~{tokens:,} tokens){RESET}")
|
||||
return content
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ def write_file(path: str, content: str) -> str:
|
||||
|
||||
lines = content.count("\n") + (1 if content and not content.endswith("\n") else 0)
|
||||
tokens = len(content) // 4
|
||||
print(f"{MAGENTA}⏺ {action} file: {path} ({lines} lines, ~{tokens:,} tokens){RESET}")
|
||||
print(f"{MAGENTA}⏺ {action} file({path}) ({lines} lines, ~{tokens:,} tokens){RESET}")
|
||||
return f"ok: wrote {lines} lines ({tokens:,} tokens) to {path}"
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ def edit_file(path: str, old: str, new: str, replace_all: bool = False) -> str:
|
||||
Returns:
|
||||
'ok' on success, error message on failure
|
||||
"""
|
||||
print(f"{MAGENTA}⏺ Editing file: {path}{RESET}")
|
||||
print(f"{MAGENTA}⏺ Edit({path}){RESET}")
|
||||
|
||||
text = open(path).read()
|
||||
if old not in text:
|
||||
@@ -109,7 +109,7 @@ def glob_files(pattern: str, path: str = ".") -> str:
|
||||
Returns:
|
||||
Newline-separated list of matching files
|
||||
"""
|
||||
print(f"{MAGENTA}⏺ Glob: {pattern}{RESET}")
|
||||
print(f"{MAGENTA}⏺ Glob({pattern}): {path}{RESET}")
|
||||
|
||||
cmd = ["rg", "--files", "-g", pattern, path]
|
||||
try:
|
||||
@@ -228,8 +228,8 @@ Do NOT confuse REPL variables with external files. Reading a file into a variabl
|
||||
|
||||
class RLMCodingConfig(PrecompiledConfig):
|
||||
max_iters: int = 50
|
||||
lm: str = "openrouter/openai/gpt-5.2-codex"
|
||||
sub_lm: str = "openrouter/openai/gpt-5-mini"
|
||||
lm: str = "openrouter/anthropic/claude-opus-4.5"
|
||||
sub_lm: str = "openrouter/qwen/qwen-coder"
|
||||
api_base: str = "https://openrouter.ai/api/v1"
|
||||
max_tokens: int = 50000
|
||||
max_output_chars: int = 100000
|
||||
@@ -420,4 +420,3 @@ if __name__ == "__main__":
|
||||
branch=branch,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user