ripperdoc 0.2.0__py3-none-any.whl → 0.2.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.
- ripperdoc/__init__.py +1 -1
- ripperdoc/cli/cli.py +66 -8
- ripperdoc/cli/commands/__init__.py +4 -0
- ripperdoc/cli/commands/agents_cmd.py +22 -0
- ripperdoc/cli/commands/context_cmd.py +11 -1
- ripperdoc/cli/commands/doctor_cmd.py +200 -0
- ripperdoc/cli/commands/memory_cmd.py +209 -0
- ripperdoc/cli/commands/models_cmd.py +25 -0
- ripperdoc/cli/commands/tasks_cmd.py +27 -0
- ripperdoc/cli/ui/rich_ui.py +156 -9
- ripperdoc/core/agents.py +4 -2
- ripperdoc/core/config.py +48 -3
- ripperdoc/core/default_tools.py +16 -2
- ripperdoc/core/permissions.py +19 -0
- ripperdoc/core/query.py +231 -297
- ripperdoc/core/query_utils.py +537 -0
- ripperdoc/core/system_prompt.py +2 -1
- ripperdoc/core/tool.py +13 -0
- ripperdoc/tools/background_shell.py +9 -3
- ripperdoc/tools/bash_tool.py +15 -0
- ripperdoc/tools/file_edit_tool.py +7 -0
- ripperdoc/tools/file_read_tool.py +7 -0
- ripperdoc/tools/file_write_tool.py +7 -0
- ripperdoc/tools/glob_tool.py +55 -15
- ripperdoc/tools/grep_tool.py +7 -0
- ripperdoc/tools/ls_tool.py +242 -73
- ripperdoc/tools/mcp_tools.py +32 -10
- ripperdoc/tools/multi_edit_tool.py +11 -0
- ripperdoc/tools/notebook_edit_tool.py +6 -3
- ripperdoc/tools/task_tool.py +7 -0
- ripperdoc/tools/todo_tool.py +159 -25
- ripperdoc/tools/tool_search_tool.py +9 -0
- ripperdoc/utils/git_utils.py +276 -0
- ripperdoc/utils/json_utils.py +28 -0
- ripperdoc/utils/log.py +130 -29
- ripperdoc/utils/mcp.py +71 -6
- ripperdoc/utils/memory.py +14 -1
- ripperdoc/utils/message_compaction.py +26 -5
- ripperdoc/utils/messages.py +63 -4
- ripperdoc/utils/output_utils.py +36 -9
- ripperdoc/utils/permissions/path_validation_utils.py +6 -0
- ripperdoc/utils/safe_get_cwd.py +4 -0
- ripperdoc/utils/session_history.py +27 -9
- ripperdoc/utils/todo.py +2 -2
- {ripperdoc-0.2.0.dist-info → ripperdoc-0.2.2.dist-info}/METADATA +4 -2
- ripperdoc-0.2.2.dist-info/RECORD +86 -0
- ripperdoc-0.2.0.dist-info/RECORD +0 -81
- {ripperdoc-0.2.0.dist-info → ripperdoc-0.2.2.dist-info}/WHEEL +0 -0
- {ripperdoc-0.2.0.dist-info → ripperdoc-0.2.2.dist-info}/entry_points.txt +0 -0
- {ripperdoc-0.2.0.dist-info → ripperdoc-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {ripperdoc-0.2.0.dist-info → ripperdoc-0.2.2.dist-info}/top_level.txt +0 -0
ripperdoc/tools/mcp_tools.py
CHANGED
|
@@ -31,13 +31,14 @@ from ripperdoc.utils.mcp import (
|
|
|
31
31
|
shutdown_mcp_runtime,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
+
|
|
35
|
+
logger = get_logger()
|
|
36
|
+
|
|
34
37
|
try:
|
|
35
38
|
import mcp.types as mcp_types # type: ignore
|
|
36
39
|
except Exception: # pragma: no cover - SDK may be missing at runtime
|
|
37
40
|
mcp_types = None # type: ignore[assignment]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
logger = get_logger()
|
|
41
|
+
logger.exception("[mcp_tools] MCP SDK unavailable during import")
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
def _content_block_to_text(block: Any) -> str:
|
|
@@ -272,6 +273,7 @@ class ListMcpResourcesTool(Tool[ListMcpResourcesInput, ListMcpResourcesOutput]):
|
|
|
272
273
|
try:
|
|
273
274
|
return json.dumps(output.resources, indent=2, ensure_ascii=False)
|
|
274
275
|
except Exception:
|
|
276
|
+
logger.exception("[mcp_tools] Failed to serialize MCP resources for assistant output")
|
|
275
277
|
return str(output.resources)
|
|
276
278
|
|
|
277
279
|
def render_tool_use_message(
|
|
@@ -313,7 +315,10 @@ class ListMcpResourcesTool(Tool[ListMcpResourcesInput, ListMcpResourcesOutput]):
|
|
|
313
315
|
for res in response.resources
|
|
314
316
|
]
|
|
315
317
|
except Exception as exc: # pragma: no cover - runtime errors
|
|
316
|
-
logger.
|
|
318
|
+
logger.exception(
|
|
319
|
+
"Failed to fetch resources from MCP server",
|
|
320
|
+
extra={"server": server.name, "error": str(exc)},
|
|
321
|
+
)
|
|
317
322
|
fetched = []
|
|
318
323
|
|
|
319
324
|
candidate_resources = fetched if fetched else server.resources
|
|
@@ -494,6 +499,10 @@ class ReadMcpResourceTool(Tool[ReadMcpResourceInput, ReadMcpResourceOutput]):
|
|
|
494
499
|
try:
|
|
495
500
|
raw_bytes = base64.b64decode(blob_data)
|
|
496
501
|
except Exception:
|
|
502
|
+
logger.exception(
|
|
503
|
+
"[mcp_tools] Failed to decode base64 blob content",
|
|
504
|
+
extra={"server": input_data.server, "uri": input_data.uri},
|
|
505
|
+
)
|
|
497
506
|
raw_bytes = None
|
|
498
507
|
else:
|
|
499
508
|
raw_bytes = None
|
|
@@ -521,8 +530,9 @@ class ReadMcpResourceTool(Tool[ReadMcpResourceInput, ReadMcpResourceOutput]):
|
|
|
521
530
|
text_parts = [p.text for p in parts if p.text]
|
|
522
531
|
content_text = "\n".join([p for p in text_parts if p]) or None
|
|
523
532
|
except Exception as exc: # pragma: no cover - runtime errors
|
|
524
|
-
logger.
|
|
525
|
-
|
|
533
|
+
logger.exception(
|
|
534
|
+
"Error reading MCP resource",
|
|
535
|
+
extra={"server": input_data.server, "uri": input_data.uri, "error": str(exc)},
|
|
526
536
|
)
|
|
527
537
|
content_text = f"Error reading MCP resource: {exc}"
|
|
528
538
|
else:
|
|
@@ -575,6 +585,7 @@ def _annotation_flag(tool_info: Any, key: str) -> bool:
|
|
|
575
585
|
try:
|
|
576
586
|
return bool(annotations.get(key, False))
|
|
577
587
|
except Exception:
|
|
588
|
+
logger.debug("[mcp_tools] Failed to read annotation flag", exc_info=True)
|
|
578
589
|
return False
|
|
579
590
|
return False
|
|
580
591
|
|
|
@@ -718,8 +729,13 @@ class DynamicMcpTool(Tool[BaseModel, McpToolCallOutput]):
|
|
|
718
729
|
structured_content=None,
|
|
719
730
|
is_error=True,
|
|
720
731
|
)
|
|
721
|
-
logger.
|
|
722
|
-
|
|
732
|
+
logger.exception(
|
|
733
|
+
"Error calling MCP tool",
|
|
734
|
+
extra={
|
|
735
|
+
"server": self.server_name,
|
|
736
|
+
"tool": self.tool_info.name,
|
|
737
|
+
"error": str(exc),
|
|
738
|
+
},
|
|
723
739
|
)
|
|
724
740
|
yield ToolResult(
|
|
725
741
|
data=output,
|
|
@@ -768,7 +784,10 @@ def load_dynamic_mcp_tools_sync(project_path: Optional[Path] = None) -> List[Dyn
|
|
|
768
784
|
try:
|
|
769
785
|
return asyncio.run(_load_and_cleanup())
|
|
770
786
|
except Exception as exc: # pragma: no cover - SDK/runtime failures
|
|
771
|
-
logger.
|
|
787
|
+
logger.exception(
|
|
788
|
+
"Failed to initialize MCP runtime for dynamic tools (sync)",
|
|
789
|
+
extra={"error": str(exc)},
|
|
790
|
+
)
|
|
772
791
|
return []
|
|
773
792
|
|
|
774
793
|
|
|
@@ -777,7 +796,10 @@ async def load_dynamic_mcp_tools_async(project_path: Optional[Path] = None) -> L
|
|
|
777
796
|
try:
|
|
778
797
|
runtime = await ensure_mcp_runtime(project_path)
|
|
779
798
|
except Exception as exc: # pragma: no cover - SDK/runtime failures
|
|
780
|
-
logger.
|
|
799
|
+
logger.exception(
|
|
800
|
+
"Failed to initialize MCP runtime for dynamic tools (async)",
|
|
801
|
+
extra={"error": str(exc)},
|
|
802
|
+
)
|
|
781
803
|
return []
|
|
782
804
|
return _build_dynamic_mcp_tools(runtime)
|
|
783
805
|
|
|
@@ -17,6 +17,9 @@ from ripperdoc.core.tool import (
|
|
|
17
17
|
ToolUseExample,
|
|
18
18
|
ValidationResult,
|
|
19
19
|
)
|
|
20
|
+
from ripperdoc.utils.log import get_logger
|
|
21
|
+
|
|
22
|
+
logger = get_logger()
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
DEFAULT_ACTION = "Edit"
|
|
@@ -307,6 +310,10 @@ class MultiEditTool(Tool[MultiEditToolInput, MultiEditToolOutput]):
|
|
|
307
310
|
if existing:
|
|
308
311
|
original_content = file_path.read_text(encoding="utf-8")
|
|
309
312
|
except Exception as exc: # pragma: no cover - unlikely permission issue
|
|
313
|
+
logger.exception(
|
|
314
|
+
"[multi_edit_tool] Error reading file before edits",
|
|
315
|
+
extra={"file_path": str(file_path)},
|
|
316
|
+
)
|
|
310
317
|
output = MultiEditToolOutput(
|
|
311
318
|
file_path=str(file_path),
|
|
312
319
|
replacements_made=0,
|
|
@@ -354,6 +361,10 @@ class MultiEditTool(Tool[MultiEditToolInput, MultiEditToolOutput]):
|
|
|
354
361
|
try:
|
|
355
362
|
file_path.write_text(updated_content, encoding="utf-8")
|
|
356
363
|
except Exception as exc:
|
|
364
|
+
logger.exception(
|
|
365
|
+
"[multi_edit_tool] Error writing edited file",
|
|
366
|
+
extra={"file_path": str(file_path)},
|
|
367
|
+
)
|
|
357
368
|
output = MultiEditToolOutput(
|
|
358
369
|
file_path=str(file_path),
|
|
359
370
|
replacements_made=0,
|
|
@@ -165,8 +165,8 @@ class NotebookEditTool(Tool[NotebookEditInput, NotebookEditOutput]):
|
|
|
165
165
|
try:
|
|
166
166
|
raw = path.read_text(encoding="utf-8")
|
|
167
167
|
nb_json = json.loads(raw)
|
|
168
|
-
except Exception
|
|
169
|
-
logger.
|
|
168
|
+
except Exception:
|
|
169
|
+
logger.exception("Failed to parse notebook", extra={"path": str(path)})
|
|
170
170
|
return ValidationResult(
|
|
171
171
|
result=False, message="Notebook is not valid JSON.", error_code=6
|
|
172
172
|
)
|
|
@@ -285,7 +285,10 @@ class NotebookEditTool(Tool[NotebookEditInput, NotebookEditOutput]):
|
|
|
285
285
|
data=output, result_for_assistant=self.render_result_for_assistant(output)
|
|
286
286
|
)
|
|
287
287
|
except Exception as exc: # pragma: no cover - error path
|
|
288
|
-
logger.
|
|
288
|
+
logger.exception(
|
|
289
|
+
"Error editing notebook",
|
|
290
|
+
extra={"path": input_data.notebook_path, "error": str(exc)},
|
|
291
|
+
)
|
|
289
292
|
output = NotebookEditOutput(
|
|
290
293
|
new_source=new_source,
|
|
291
294
|
cell_type=cell_type or "code",
|
ripperdoc/tools/task_tool.py
CHANGED
|
@@ -19,6 +19,9 @@ from ripperdoc.core.query import QueryContext, query
|
|
|
19
19
|
from ripperdoc.core.system_prompt import build_environment_prompt
|
|
20
20
|
from ripperdoc.core.tool import Tool, ToolOutput, ToolProgress, ToolResult, ToolUseContext
|
|
21
21
|
from ripperdoc.utils.messages import AssistantMessage, create_user_message
|
|
22
|
+
from ripperdoc.utils.log import get_logger
|
|
23
|
+
|
|
24
|
+
logger = get_logger()
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
class TaskToolInput(BaseModel):
|
|
@@ -284,6 +287,10 @@ class TaskTool(Tool[TaskToolInput, TaskToolOutput]):
|
|
|
284
287
|
try:
|
|
285
288
|
serialized = json.dumps(inp, ensure_ascii=False)
|
|
286
289
|
except Exception:
|
|
290
|
+
logger.exception(
|
|
291
|
+
"[task_tool] Failed to serialize tool_use input",
|
|
292
|
+
extra={"tool_use_input": str(inp)},
|
|
293
|
+
)
|
|
287
294
|
serialized = str(inp)
|
|
288
295
|
return serialized if len(serialized) <= 120 else serialized[:117] + "..."
|
|
289
296
|
|
ripperdoc/tools/todo_tool.py
CHANGED
|
@@ -14,6 +14,7 @@ from ripperdoc.core.tool import (
|
|
|
14
14
|
ToolUseExample,
|
|
15
15
|
ValidationResult,
|
|
16
16
|
)
|
|
17
|
+
from ripperdoc.utils.log import get_logger
|
|
17
18
|
from ripperdoc.utils.todo import (
|
|
18
19
|
TodoItem,
|
|
19
20
|
TodoPriority,
|
|
@@ -27,9 +28,14 @@ from ripperdoc.utils.todo import (
|
|
|
27
28
|
validate_todos,
|
|
28
29
|
)
|
|
29
30
|
|
|
31
|
+
logger = get_logger()
|
|
32
|
+
|
|
33
|
+
DEFAULT_ACTION = "Edit"
|
|
34
|
+
|
|
30
35
|
TODO_WRITE_PROMPT = dedent(
|
|
31
|
-
"""\
|
|
32
|
-
Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
36
|
+
f"""\
|
|
37
|
+
Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
38
|
+
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
33
39
|
|
|
34
40
|
## When to Use This Tool
|
|
35
41
|
Use this tool proactively in these scenarios:
|
|
@@ -52,30 +58,155 @@ TODO_WRITE_PROMPT = dedent(
|
|
|
52
58
|
|
|
53
59
|
NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
|
|
54
60
|
|
|
61
|
+
## Examples of When to Use the Todo List
|
|
62
|
+
|
|
63
|
+
<example>
|
|
64
|
+
User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
|
|
65
|
+
Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
|
|
66
|
+
*Creates todo list with the following items:*
|
|
67
|
+
1. Create dark mode toggle component in Settings page
|
|
68
|
+
2. Add dark mode state management (context/store)
|
|
69
|
+
3. Implement CSS-in-JS styles for dark theme
|
|
70
|
+
4. Update existing components to support theme switching
|
|
71
|
+
5. Run tests and build process, addressing any failures or errors that occur
|
|
72
|
+
*Begins working on the first task*
|
|
73
|
+
|
|
74
|
+
<reasoning>
|
|
75
|
+
The assistant used the todo list because:
|
|
76
|
+
1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
|
|
77
|
+
2. The user explicitly requested tests and build be run afterward
|
|
78
|
+
3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
|
|
79
|
+
</reasoning>
|
|
80
|
+
</example>
|
|
81
|
+
|
|
82
|
+
<example>
|
|
83
|
+
User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
|
|
84
|
+
Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'.
|
|
85
|
+
*Uses grep or search tools to locate all instances of getCwd in the codebase*
|
|
86
|
+
Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
|
|
87
|
+
*Creates todo list with specific items for each file that needs updating*
|
|
88
|
+
|
|
89
|
+
<reasoning>
|
|
90
|
+
The assistant used the todo list because:
|
|
91
|
+
1. First, the assistant searched to understand the scope of the task
|
|
92
|
+
2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
|
|
93
|
+
3. The todo list helps ensure every instance is tracked and updated systematically
|
|
94
|
+
4. This approach prevents missing any occurrences and maintains code consistency
|
|
95
|
+
</reasoning>
|
|
96
|
+
</example>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<example>
|
|
100
|
+
User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
|
|
101
|
+
Assistant: I'll help implement these features. First, let's add all the features to the todo list.
|
|
102
|
+
*Creates a todo list breaking down each feature into specific tasks based on the project architecture*
|
|
103
|
+
Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
|
|
104
|
+
|
|
105
|
+
<reasoning>
|
|
106
|
+
The assistant used the todo list because:
|
|
107
|
+
1. The user provided multiple complex features to implement in a comma separated list
|
|
108
|
+
2. The todo list helps organize these large features into manageable tasks
|
|
109
|
+
3. This approach allows for tracking progress across the entire implementation
|
|
110
|
+
</reasoning>
|
|
111
|
+
</example>
|
|
112
|
+
|
|
113
|
+
<example>
|
|
114
|
+
User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
|
|
115
|
+
Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
|
|
116
|
+
*Reviews component structure, render patterns, state management, and data fetching*
|
|
117
|
+
Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
|
|
118
|
+
*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*
|
|
119
|
+
Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
|
|
120
|
+
|
|
121
|
+
<reasoning>
|
|
122
|
+
The assistant used the todo list because:
|
|
123
|
+
1. First, the assistant examined the codebase to identify specific performance issues
|
|
124
|
+
2. Based on this analysis, it identified multiple optimization opportunities
|
|
125
|
+
3. Performance optimization is a non-trivial task requiring multiple steps
|
|
126
|
+
4. The todo list helps methodically track improvements across different components
|
|
127
|
+
5. This systematic approach ensures all performance bottlenecks are addressed
|
|
128
|
+
</reasoning>
|
|
129
|
+
</example>
|
|
130
|
+
|
|
131
|
+
## Examples of When NOT to Use the Todo List
|
|
132
|
+
|
|
133
|
+
<example>
|
|
134
|
+
User: How do I print 'Hello World' in Python?
|
|
135
|
+
Assistant: In Python, you can print "Hello World" with this simple code:
|
|
136
|
+
|
|
137
|
+
python
|
|
138
|
+
print("Hello World")
|
|
139
|
+
|
|
140
|
+
This will output the text "Hello World" to the console when executed.</assistant>
|
|
141
|
+
|
|
142
|
+
<reasoning>
|
|
143
|
+
The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
|
|
144
|
+
</reasoning>
|
|
145
|
+
</example>
|
|
146
|
+
|
|
147
|
+
<example>
|
|
148
|
+
User: What does the git status command do?
|
|
149
|
+
Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
|
|
150
|
+
|
|
151
|
+
<reasoning>
|
|
152
|
+
The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
|
|
153
|
+
</reasoning>
|
|
154
|
+
</example>
|
|
155
|
+
|
|
156
|
+
<example>
|
|
157
|
+
User: Can you add a comment to the calculateTotal function to explain what it does?
|
|
158
|
+
Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
|
|
159
|
+
* Uses the ${DEFAULT_ACTION} tool to add a comment to the calculateTotal function *
|
|
160
|
+
|
|
161
|
+
<reasoning>
|
|
162
|
+
The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
|
|
163
|
+
</reasoning>
|
|
164
|
+
</example>
|
|
165
|
+
|
|
166
|
+
<example>
|
|
167
|
+
User: Run npm install for me and tell me what happens.
|
|
168
|
+
Assistant: I'll run the npm install command for you.
|
|
169
|
+
|
|
170
|
+
*Executes: npm install*
|
|
171
|
+
|
|
172
|
+
The command completed successfully. Here's the output:
|
|
173
|
+
[Output of npm install command]
|
|
174
|
+
|
|
175
|
+
All dependencies have been installed according to your package.json file.
|
|
176
|
+
|
|
177
|
+
<reasoning>
|
|
178
|
+
The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
|
|
179
|
+
</reasoning>
|
|
180
|
+
</example>
|
|
181
|
+
|
|
55
182
|
## Task States and Management
|
|
56
183
|
|
|
57
|
-
1. Task States:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
2. Task Management
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
3. Task Completion Requirements
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
184
|
+
1. **Task States**: Use these states to track progress:
|
|
185
|
+
- pending: Task not yet started
|
|
186
|
+
- in_progress: Currently working on (limit to ONE task at a time)
|
|
187
|
+
- completed: Task finished successfully
|
|
188
|
+
|
|
189
|
+
2. **Task Management**:
|
|
190
|
+
- Update task status in real-time as you work
|
|
191
|
+
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
|
|
192
|
+
- Only have ONE task in_progress at any time
|
|
193
|
+
- Complete current tasks before starting new ones
|
|
194
|
+
- Remove tasks that are no longer relevant from the list entirely
|
|
195
|
+
|
|
196
|
+
3. **Task Completion Requirements**:
|
|
197
|
+
- ONLY mark a task as completed when you have FULLY accomplished it
|
|
198
|
+
- If you encounter errors, blockers, or cannot finish, keep the task as in_progress
|
|
199
|
+
- When blocked, create a new task describing what needs to be resolved
|
|
200
|
+
- Never mark a task as completed if:
|
|
201
|
+
- Tests are failing
|
|
202
|
+
- Implementation is partial
|
|
203
|
+
- You encountered unresolved errors
|
|
204
|
+
- You couldn't find necessary files or dependencies
|
|
205
|
+
|
|
206
|
+
4. **Task Breakdown**:
|
|
207
|
+
- Create specific, actionable items
|
|
208
|
+
- Break complex tasks into smaller, manageable steps
|
|
209
|
+
- Use clear, descriptive task names
|
|
79
210
|
|
|
80
211
|
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
|
|
81
212
|
"""
|
|
@@ -130,7 +261,7 @@ class TodoWriteTool(Tool[TodoWriteToolInput, TodoToolOutput]):
|
|
|
130
261
|
return "TodoWrite"
|
|
131
262
|
|
|
132
263
|
async def description(self) -> str:
|
|
133
|
-
return "
|
|
264
|
+
return "Update the todo list for the current session. To be used proactively and often to track progress and pending tasks."
|
|
134
265
|
|
|
135
266
|
@property
|
|
136
267
|
def input_schema(self) -> type[TodoWriteToolInput]:
|
|
@@ -230,6 +361,9 @@ class TodoWriteTool(Tool[TodoWriteToolInput, TodoToolOutput]):
|
|
|
230
361
|
)
|
|
231
362
|
yield ToolResult(data=output, result_for_assistant=result_text)
|
|
232
363
|
except Exception as exc:
|
|
364
|
+
logger.exception(
|
|
365
|
+
"[todo_tool] Error updating todos", extra={"error": str(exc)}
|
|
366
|
+
)
|
|
233
367
|
error = f"Error updating todos: {exc}"
|
|
234
368
|
yield ToolResult(
|
|
235
369
|
data=TodoToolOutput(
|
|
@@ -19,6 +19,10 @@ from ripperdoc.core.tool import (
|
|
|
19
19
|
ValidationResult,
|
|
20
20
|
build_tool_description,
|
|
21
21
|
)
|
|
22
|
+
from ripperdoc.utils.log import get_logger
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
logger = get_logger()
|
|
22
26
|
|
|
23
27
|
|
|
24
28
|
class ToolSearchInput(BaseModel):
|
|
@@ -174,6 +178,7 @@ class ToolSearchTool(Tool[ToolSearchInput, ToolSearchOutput]):
|
|
|
174
178
|
regex = re.compile(normalized[1:-1], re.IGNORECASE)
|
|
175
179
|
except re.error:
|
|
176
180
|
regex = None
|
|
181
|
+
logger.exception("[tool_search] Invalid regex search query", extra={"query": query})
|
|
177
182
|
|
|
178
183
|
def _tokenize(text: str) -> List[str]:
|
|
179
184
|
return re.findall(r"[a-z0-9]+", text.lower())
|
|
@@ -186,6 +191,10 @@ class ToolSearchTool(Tool[ToolSearchInput, ToolSearchOutput]):
|
|
|
186
191
|
)
|
|
187
192
|
except Exception:
|
|
188
193
|
description = ""
|
|
194
|
+
logger.exception(
|
|
195
|
+
"[tool_search] Failed to build tool description",
|
|
196
|
+
extra={"tool_name": getattr(tool, "name", None)},
|
|
197
|
+
)
|
|
189
198
|
doc_text = " ".join([name, tool.user_facing_name(), description])
|
|
190
199
|
tokens = _tokenize(doc_text)
|
|
191
200
|
corpus.append((name, tool, tokens, len(tokens), description))
|