ripperdoc 0.2.2__py3-none-any.whl → 0.2.4__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.
Files changed (61) hide show
  1. ripperdoc/__init__.py +1 -1
  2. ripperdoc/cli/cli.py +9 -2
  3. ripperdoc/cli/commands/agents_cmd.py +8 -4
  4. ripperdoc/cli/commands/context_cmd.py +3 -3
  5. ripperdoc/cli/commands/cost_cmd.py +5 -0
  6. ripperdoc/cli/commands/doctor_cmd.py +12 -4
  7. ripperdoc/cli/commands/memory_cmd.py +6 -13
  8. ripperdoc/cli/commands/models_cmd.py +36 -6
  9. ripperdoc/cli/commands/resume_cmd.py +4 -2
  10. ripperdoc/cli/commands/status_cmd.py +1 -1
  11. ripperdoc/cli/ui/rich_ui.py +135 -2
  12. ripperdoc/cli/ui/thinking_spinner.py +128 -0
  13. ripperdoc/core/agents.py +174 -6
  14. ripperdoc/core/config.py +9 -1
  15. ripperdoc/core/default_tools.py +6 -0
  16. ripperdoc/core/providers/__init__.py +47 -0
  17. ripperdoc/core/providers/anthropic.py +147 -0
  18. ripperdoc/core/providers/base.py +236 -0
  19. ripperdoc/core/providers/gemini.py +496 -0
  20. ripperdoc/core/providers/openai.py +253 -0
  21. ripperdoc/core/query.py +337 -141
  22. ripperdoc/core/query_utils.py +65 -24
  23. ripperdoc/core/system_prompt.py +67 -61
  24. ripperdoc/core/tool.py +12 -3
  25. ripperdoc/sdk/client.py +12 -1
  26. ripperdoc/tools/ask_user_question_tool.py +433 -0
  27. ripperdoc/tools/background_shell.py +104 -18
  28. ripperdoc/tools/bash_tool.py +33 -13
  29. ripperdoc/tools/enter_plan_mode_tool.py +223 -0
  30. ripperdoc/tools/exit_plan_mode_tool.py +150 -0
  31. ripperdoc/tools/file_edit_tool.py +13 -0
  32. ripperdoc/tools/file_read_tool.py +16 -0
  33. ripperdoc/tools/file_write_tool.py +13 -0
  34. ripperdoc/tools/glob_tool.py +5 -1
  35. ripperdoc/tools/ls_tool.py +14 -10
  36. ripperdoc/tools/mcp_tools.py +113 -4
  37. ripperdoc/tools/multi_edit_tool.py +12 -0
  38. ripperdoc/tools/notebook_edit_tool.py +12 -0
  39. ripperdoc/tools/task_tool.py +88 -5
  40. ripperdoc/tools/todo_tool.py +1 -3
  41. ripperdoc/tools/tool_search_tool.py +8 -4
  42. ripperdoc/utils/file_watch.py +134 -0
  43. ripperdoc/utils/git_utils.py +36 -38
  44. ripperdoc/utils/json_utils.py +1 -2
  45. ripperdoc/utils/log.py +3 -4
  46. ripperdoc/utils/mcp.py +49 -10
  47. ripperdoc/utils/memory.py +1 -3
  48. ripperdoc/utils/message_compaction.py +5 -11
  49. ripperdoc/utils/messages.py +9 -13
  50. ripperdoc/utils/output_utils.py +1 -3
  51. ripperdoc/utils/prompt.py +17 -0
  52. ripperdoc/utils/session_usage.py +7 -0
  53. ripperdoc/utils/shell_utils.py +159 -0
  54. ripperdoc/utils/token_estimation.py +33 -0
  55. {ripperdoc-0.2.2.dist-info → ripperdoc-0.2.4.dist-info}/METADATA +3 -1
  56. ripperdoc-0.2.4.dist-info/RECORD +99 -0
  57. ripperdoc-0.2.2.dist-info/RECORD +0 -86
  58. {ripperdoc-0.2.2.dist-info → ripperdoc-0.2.4.dist-info}/WHEEL +0 -0
  59. {ripperdoc-0.2.2.dist-info → ripperdoc-0.2.4.dist-info}/entry_points.txt +0 -0
  60. {ripperdoc-0.2.2.dist-info → ripperdoc-0.2.4.dist-info}/licenses/LICENSE +0 -0
  61. {ripperdoc-0.2.2.dist-info → ripperdoc-0.2.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,223 @@
1
+ """Enter plan mode tool for complex task planning.
2
+
3
+ This tool allows the AI to request entering plan mode for complex tasks
4
+ that require careful exploration and design before implementation.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from textwrap import dedent
10
+ from typing import AsyncGenerator, Optional
11
+
12
+ from pydantic import BaseModel
13
+
14
+ from ripperdoc.core.tool import (
15
+ Tool,
16
+ ToolOutput,
17
+ ToolResult,
18
+ ToolUseContext,
19
+ ValidationResult,
20
+ )
21
+ from ripperdoc.utils.log import get_logger
22
+
23
+ logger = get_logger()
24
+
25
+ TOOL_NAME = "EnterPlanMode"
26
+ ASK_USER_QUESTION_TOOL = "AskUserQuestion"
27
+
28
+ ENTER_PLAN_MODE_PROMPT = dedent(
29
+ """\
30
+ Use this tool when you encounter a complex task that requires careful planning and exploration before implementation. This tool transitions you into plan mode where you can thoroughly explore the codebase and design an implementation approach.
31
+
32
+ ## When to Use This Tool
33
+
34
+ Use EnterPlanMode when ANY of these conditions apply:
35
+
36
+ 1. **Multiple Valid Approaches**: The task can be solved in several different ways, each with trade-offs
37
+ - Example: "Add caching to the API" - could use Redis, in-memory, file-based, etc.
38
+ - Example: "Improve performance" - many optimization strategies possible
39
+
40
+ 2. **Significant Architectural Decisions**: The task requires choosing between architectural patterns
41
+ - Example: "Add real-time updates" - WebSockets vs SSE vs polling
42
+ - Example: "Implement state management" - Redux vs Context vs custom solution
43
+
44
+ 3. **Large-Scale Changes**: The task touches many files or systems
45
+ - Example: "Refactor the authentication system"
46
+ - Example: "Migrate from REST to GraphQL"
47
+
48
+ 4. **Unclear Requirements**: You need to explore before understanding the full scope
49
+ - Example: "Make the app faster" - need to profile and identify bottlenecks
50
+ - Example: "Fix the bug in checkout" - need to investigate root cause
51
+
52
+ 5. **User Input Needed**: You'll need to ask clarifying questions before starting
53
+ - If you would use {ask_tool} to clarify the approach, consider EnterPlanMode instead
54
+ - Plan mode lets you explore first, then present options with context
55
+
56
+ ## When NOT to Use This Tool
57
+
58
+ Do NOT use EnterPlanMode for:
59
+ - Simple, straightforward tasks with obvious implementation
60
+ - Small bug fixes where the solution is clear
61
+ - Adding a single function or small feature
62
+ - Tasks you're already confident how to implement
63
+ - Research-only tasks (use the Task tool with explore agent instead)
64
+
65
+ ## What Happens in Plan Mode
66
+
67
+ In plan mode, you'll:
68
+ 1. Thoroughly explore the codebase using Glob, Grep, and Read tools
69
+ 2. Understand existing patterns and architecture
70
+ 3. Design an implementation approach
71
+ 4. Present your plan to the user for approval
72
+ 5. Use {ask_tool} if you need to clarify approaches
73
+ 6. Exit plan mode with ExitPlanMode when ready to implement
74
+
75
+ ## Examples
76
+
77
+ ### GOOD - Use EnterPlanMode:
78
+ User: "Add user authentication to the app"
79
+ - This requires architectural decisions (session vs JWT, where to store tokens, middleware structure)
80
+
81
+ User: "Optimize the database queries"
82
+ - Multiple approaches possible, need to profile first, significant impact
83
+
84
+ User: "Implement dark mode"
85
+ - Architectural decision on theme system, affects many components
86
+
87
+ ### BAD - Don't use EnterPlanMode:
88
+ User: "Fix the typo in the README"
89
+ - Straightforward, no planning needed
90
+
91
+ User: "Add a console.log to debug this function"
92
+ - Simple, obvious implementation
93
+
94
+ User: "What files handle routing?"
95
+ - Research task, not implementation planning
96
+
97
+ ## Important Notes
98
+
99
+ - This tool REQUIRES user approval - they must consent to entering plan mode
100
+ - Be thoughtful about when to use it - unnecessary plan mode slows down simple tasks
101
+ - If unsure whether to use it, err on the side of starting implementation
102
+ - You can always ask the user "Would you like me to plan this out first?"
103
+ """
104
+ ).format(ask_tool=ASK_USER_QUESTION_TOOL)
105
+
106
+
107
+ PLAN_MODE_INSTRUCTIONS = dedent(
108
+ """\
109
+ In plan mode, you should:
110
+ 1. Thoroughly explore the codebase to understand existing patterns
111
+ 2. Identify similar features and architectural approaches
112
+ 3. Consider multiple approaches and their trade-offs
113
+ 4. Use AskUserQuestion if you need to clarify the approach
114
+ 5. Design a concrete implementation strategy
115
+ 6. When ready, use ExitPlanMode to present your plan for approval
116
+
117
+ Remember: DO NOT write or edit any files yet. This is a read-only exploration and planning phase."""
118
+ )
119
+
120
+
121
+ class EnterPlanModeToolInput(BaseModel):
122
+ """Input for the EnterPlanMode tool.
123
+
124
+ This tool takes no input parameters - it simply requests to enter plan mode.
125
+ """
126
+
127
+ pass
128
+
129
+
130
+ class EnterPlanModeToolOutput(BaseModel):
131
+ """Output from the EnterPlanMode tool."""
132
+
133
+ message: str
134
+ entered: bool = True
135
+
136
+
137
+ class EnterPlanModeTool(Tool[EnterPlanModeToolInput, EnterPlanModeToolOutput]):
138
+ """Tool for entering plan mode for complex tasks."""
139
+
140
+ @property
141
+ def name(self) -> str:
142
+ return TOOL_NAME
143
+
144
+ async def description(self) -> str:
145
+ return (
146
+ "Requests permission to enter plan mode for complex tasks "
147
+ "requiring exploration and design"
148
+ )
149
+
150
+ @property
151
+ def input_schema(self) -> type[EnterPlanModeToolInput]:
152
+ return EnterPlanModeToolInput
153
+
154
+ async def prompt(self, safe_mode: bool = False) -> str: # noqa: ARG002
155
+ return ENTER_PLAN_MODE_PROMPT
156
+
157
+ def user_facing_name(self) -> str:
158
+ return ""
159
+
160
+ def is_read_only(self) -> bool:
161
+ return True
162
+
163
+ def is_concurrency_safe(self) -> bool:
164
+ return True
165
+
166
+ def needs_permissions(
167
+ self, input_data: Optional[EnterPlanModeToolInput] = None # noqa: ARG002
168
+ ) -> bool:
169
+ return True
170
+
171
+ async def validate_input(
172
+ self,
173
+ input_data: EnterPlanModeToolInput,
174
+ context: Optional[ToolUseContext] = None,
175
+ ) -> ValidationResult:
176
+ """Validate that this tool is not being used in an agent context."""
177
+ if context and context.agent_id:
178
+ return ValidationResult(
179
+ result=False,
180
+ message="EnterPlanMode tool cannot be used in agent contexts",
181
+ )
182
+ return ValidationResult(result=True)
183
+
184
+ def render_result_for_assistant(self, output: EnterPlanModeToolOutput) -> str:
185
+ """Render the tool output for the AI assistant."""
186
+ if not output.entered:
187
+ return "User declined to enter plan mode. Continue with normal implementation."
188
+ return f"{output.message}\n\n{PLAN_MODE_INSTRUCTIONS}"
189
+
190
+ def render_tool_use_message(
191
+ self, input_data: EnterPlanModeToolInput, verbose: bool = False # noqa: ARG002
192
+ ) -> str:
193
+ """Render the tool use message for display."""
194
+ return "Requesting to enter plan mode"
195
+
196
+ async def call(
197
+ self,
198
+ input_data: EnterPlanModeToolInput, # noqa: ARG002
199
+ context: ToolUseContext,
200
+ ) -> AsyncGenerator[ToolOutput, None]:
201
+ """Execute the tool to enter plan mode."""
202
+ if context.agent_id:
203
+ output = EnterPlanModeToolOutput(
204
+ message="EnterPlanMode tool cannot be used in agent contexts",
205
+ entered=False,
206
+ )
207
+ yield ToolResult(
208
+ data=output,
209
+ result_for_assistant=self.render_result_for_assistant(output),
210
+ )
211
+ return
212
+
213
+ output = EnterPlanModeToolOutput(
214
+ message=(
215
+ "Entered plan mode. You should now focus on exploring "
216
+ "the codebase and designing an implementation approach."
217
+ ),
218
+ entered=True,
219
+ )
220
+ yield ToolResult(
221
+ data=output,
222
+ result_for_assistant=self.render_result_for_assistant(output),
223
+ )
@@ -0,0 +1,150 @@
1
+ """Exit plan mode tool for presenting implementation plans.
2
+
3
+ This tool allows the AI to exit plan mode and present an implementation
4
+ plan to the user for approval before starting to code.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from textwrap import dedent
10
+ from typing import AsyncGenerator, Optional
11
+
12
+ from pydantic import BaseModel, Field
13
+
14
+ from ripperdoc.core.tool import (
15
+ Tool,
16
+ ToolOutput,
17
+ ToolResult,
18
+ ToolUseContext,
19
+ ValidationResult,
20
+ )
21
+ from ripperdoc.utils.log import get_logger
22
+
23
+ logger = get_logger()
24
+
25
+ TOOL_NAME = "ExitPlanMode"
26
+
27
+ EXIT_PLAN_MODE_PROMPT = dedent(
28
+ """\
29
+ Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.
30
+
31
+ ## How This Tool Works
32
+ - You should have already written your plan to the plan file specified in the plan mode system message
33
+ - This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote
34
+ - This tool simply signals that you're done planning and ready for the user to review and approve
35
+ - The user will see the contents of your plan file when they review it
36
+
37
+ ## When to Use This Tool
38
+ IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
39
+
40
+ ## Handling Ambiguity in Plans
41
+ Before using this tool, ensure your plan is clear and unambiguous. If there are multiple valid approaches or unclear requirements:
42
+ 1. Use the AskUserQuestion tool to clarify with the user
43
+ 2. Ask about specific implementation choices (e.g., architectural patterns, which library to use)
44
+ 3. Clarify any assumptions that could affect the implementation
45
+ 4. Edit your plan file to incorporate user feedback
46
+ 5. Only proceed with ExitPlanMode after resolving ambiguities and updating the plan file
47
+
48
+ ## Examples
49
+
50
+ 1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.
51
+ 2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.
52
+ 3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach.
53
+ """
54
+ )
55
+
56
+
57
+ class ExitPlanModeToolInput(BaseModel):
58
+ """Input for the ExitPlanMode tool."""
59
+
60
+ plan: str = Field(
61
+ description="The plan you came up with, that you want to run by the user for approval. "
62
+ "Supports markdown. The plan should be pretty concise."
63
+ )
64
+
65
+
66
+ class ExitPlanModeToolOutput(BaseModel):
67
+ """Output from the ExitPlanMode tool."""
68
+
69
+ plan: str
70
+ is_agent: bool = False
71
+
72
+
73
+ class ExitPlanModeTool(Tool[ExitPlanModeToolInput, ExitPlanModeToolOutput]):
74
+ """Tool for exiting plan mode and presenting a plan for approval."""
75
+
76
+ @property
77
+ def name(self) -> str:
78
+ return TOOL_NAME
79
+
80
+ async def description(self) -> str:
81
+ return "Prompts the user to exit plan mode and start coding"
82
+
83
+ @property
84
+ def input_schema(self) -> type[ExitPlanModeToolInput]:
85
+ return ExitPlanModeToolInput
86
+
87
+ async def prompt(self, safe_mode: bool = False) -> str: # noqa: ARG002
88
+ return EXIT_PLAN_MODE_PROMPT
89
+
90
+ def user_facing_name(self) -> str:
91
+ return "Exit plan mode"
92
+
93
+ def is_read_only(self) -> bool:
94
+ return True
95
+
96
+ def is_concurrency_safe(self) -> bool:
97
+ return True
98
+
99
+ def needs_permissions(
100
+ self, input_data: Optional[ExitPlanModeToolInput] = None # noqa: ARG002
101
+ ) -> bool:
102
+ return True
103
+
104
+ async def validate_input(
105
+ self,
106
+ input_data: ExitPlanModeToolInput,
107
+ context: Optional[ToolUseContext] = None, # noqa: ARG002
108
+ ) -> ValidationResult:
109
+ """Validate that plan is not empty."""
110
+ if not input_data.plan or not input_data.plan.strip():
111
+ return ValidationResult(
112
+ result=False,
113
+ message="Plan cannot be empty",
114
+ )
115
+ return ValidationResult(result=True)
116
+
117
+ def render_result_for_assistant(self, output: ExitPlanModeToolOutput) -> str:
118
+ """Render the tool output for the AI assistant."""
119
+ return f"Exit plan mode and start coding now. Plan:\n{output.plan}"
120
+
121
+ def render_tool_use_message(
122
+ self, input_data: ExitPlanModeToolInput, verbose: bool = False # noqa: ARG002
123
+ ) -> str:
124
+ """Render the tool use message for display."""
125
+ plan = input_data.plan
126
+ snippet = f"{plan[:77]}..." if len(plan) > 80 else plan
127
+ return f"Share plan for approval: {snippet}"
128
+
129
+ async def call(
130
+ self,
131
+ input_data: ExitPlanModeToolInput,
132
+ context: ToolUseContext,
133
+ ) -> AsyncGenerator[ToolOutput, None]:
134
+ """Execute the tool to exit plan mode."""
135
+ # Invoke the exit plan mode callback if available
136
+ if context.on_exit_plan_mode:
137
+ try:
138
+ context.on_exit_plan_mode()
139
+ except Exception:
140
+ logger.debug("[exit_plan_mode_tool] Failed to call on_exit_plan_mode")
141
+
142
+ is_agent = bool(context.agent_id)
143
+ output = ExitPlanModeToolOutput(
144
+ plan=input_data.plan,
145
+ is_agent=is_agent,
146
+ )
147
+ yield ToolResult(
148
+ data=output,
149
+ result_for_assistant=self.render_result_for_assistant(output),
150
+ )
@@ -16,6 +16,7 @@ from ripperdoc.core.tool import (
16
16
  ValidationResult,
17
17
  )
18
18
  from ripperdoc.utils.log import get_logger
19
+ from ripperdoc.utils.file_watch import record_snapshot
19
20
 
20
21
  logger = get_logger()
21
22
 
@@ -185,6 +186,18 @@ match exactly (including whitespace and indentation)."""
185
186
  with open(input_data.file_path, "w", encoding="utf-8") as f:
186
187
  f.write(new_content)
187
188
 
189
+ try:
190
+ record_snapshot(
191
+ input_data.file_path,
192
+ new_content,
193
+ getattr(context, "file_state_cache", {}),
194
+ )
195
+ except Exception:
196
+ logger.exception(
197
+ "[file_edit_tool] Failed to record file snapshot",
198
+ extra={"file_path": input_data.file_path},
199
+ )
200
+
188
201
  # Generate diff for display
189
202
  import difflib
190
203
 
@@ -16,6 +16,7 @@ from ripperdoc.core.tool import (
16
16
  ValidationResult,
17
17
  )
18
18
  from ripperdoc.utils.log import get_logger
19
+ from ripperdoc.utils.file_watch import record_snapshot
19
20
 
20
21
  logger = get_logger()
21
22
 
@@ -143,6 +144,21 @@ and limit to read only a portion of the file."""
143
144
 
144
145
  content = "".join(selected_lines)
145
146
 
147
+ # Remember what we read so we can detect user edits later.
148
+ try:
149
+ record_snapshot(
150
+ input_data.file_path,
151
+ content,
152
+ getattr(context, "file_state_cache", {}),
153
+ offset=offset,
154
+ limit=limit,
155
+ )
156
+ except Exception:
157
+ logger.exception(
158
+ "[file_read_tool] Failed to record file snapshot",
159
+ extra={"file_path": input_data.file_path},
160
+ )
161
+
146
162
  output = FileReadToolOutput(
147
163
  content=content,
148
164
  file_path=input_data.file_path,
@@ -17,6 +17,7 @@ from ripperdoc.core.tool import (
17
17
  ValidationResult,
18
18
  )
19
19
  from ripperdoc.utils.log import get_logger
20
+ from ripperdoc.utils.file_watch import record_snapshot
20
21
 
21
22
  logger = get_logger()
22
23
 
@@ -125,6 +126,18 @@ NEVER write new files unless explicitly required by the user."""
125
126
 
126
127
  bytes_written = len(input_data.content.encode("utf-8"))
127
128
 
129
+ try:
130
+ record_snapshot(
131
+ input_data.file_path,
132
+ input_data.content,
133
+ getattr(context, "file_state_cache", {}),
134
+ )
135
+ except Exception:
136
+ logger.exception(
137
+ "[file_write_tool] Failed to record file snapshot",
138
+ extra={"file_path": input_data.file_path},
139
+ )
140
+
128
141
  output = FileWriteToolOutput(
129
142
  file_path=input_data.file_path,
130
143
  bytes_written=bytes_written,
@@ -112,7 +112,11 @@ class GlobTool(Tool[GlobToolInput, GlobToolOutput]):
112
112
  rendered_path = ""
113
113
  if input_data.path:
114
114
  candidate_path = Path(input_data.path)
115
- absolute_path = candidate_path if candidate_path.is_absolute() else (base_path / candidate_path).resolve()
115
+ absolute_path = (
116
+ candidate_path
117
+ if candidate_path.is_absolute()
118
+ else (base_path / candidate_path).resolve()
119
+ )
116
120
 
117
121
  try:
118
122
  relative_path = absolute_path.relative_to(base_path)
@@ -142,22 +142,22 @@ def _should_skip(
142
142
  path: Path,
143
143
  root_path: Path,
144
144
  patterns: list[str],
145
- ignore_map: Optional[Dict[Optional[Path], List[str]]] = None
145
+ ignore_map: Optional[Dict[Optional[Path], List[str]]] = None,
146
146
  ) -> bool:
147
147
  name = path.name
148
148
  if name.startswith("."):
149
149
  return True
150
150
  if "__pycache__" in path.parts:
151
151
  return True
152
-
152
+
153
153
  # Check against ignore patterns
154
154
  if ignore_map and should_ignore_path(path, root_path, ignore_map):
155
155
  return True
156
-
156
+
157
157
  # Also check against direct patterns for backward compatibility
158
158
  if patterns and _matches_ignore(path, root_path, patterns):
159
159
  return True
160
-
160
+
161
161
  return False
162
162
 
163
163
 
@@ -346,7 +346,9 @@ class LSTool(Tool[LSToolInput, LSToolOutput]):
346
346
  try:
347
347
  root_path = _resolve_directory_path(input_data.path)
348
348
  except Exception:
349
- return ValidationResult(result=False, message=f"Unable to resolve path: {input_data.path}")
349
+ return ValidationResult(
350
+ result=False, message=f"Unable to resolve path: {input_data.path}"
351
+ )
350
352
 
351
353
  if not root_path.is_absolute():
352
354
  return ValidationResult(result=False, message=f"Path is not absolute: {root_path}")
@@ -392,7 +394,9 @@ class LSTool(Tool[LSToolInput, LSToolOutput]):
392
394
  return f'path: "{input_data.path}"{ignore_display}'
393
395
 
394
396
  try:
395
- relative_path = _relative_path_for_display(resolved_path, base_path) or resolved_path.as_posix()
397
+ relative_path = (
398
+ _relative_path_for_display(resolved_path, base_path) or resolved_path.as_posix()
399
+ )
396
400
  except Exception:
397
401
  relative_path = str(resolved_path)
398
402
 
@@ -431,18 +435,18 @@ class LSTool(Tool[LSToolInput, LSToolOutput]):
431
435
  git_root = get_git_root(root_path)
432
436
  if git_root:
433
437
  git_info["repository"] = str(git_root)
434
-
438
+
435
439
  branch = get_current_git_branch(root_path)
436
440
  if branch:
437
441
  git_info["branch"] = branch
438
-
442
+
439
443
  commit_hash = get_git_commit_hash(root_path)
440
444
  if commit_hash:
441
445
  git_info["commit"] = commit_hash
442
-
446
+
443
447
  is_clean = is_working_directory_clean(root_path)
444
448
  git_info["clean"] = "yes" if is_clean else "no (uncommitted changes)"
445
-
449
+
446
450
  tracked, untracked = get_git_status_files(root_path)
447
451
  if tracked or untracked:
448
452
  status_info = []