Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.
Closed
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
4 changes: 3 additions & 1 deletion src/kimi_cli/tools/file/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ async def __call__(self, params: Params) -> ToolReturnValue:
elif len(lines) < params.n_lines:
message += " End of file reached."
if truncated_line_numbers:
message += f" Lines {truncated_line_numbers} were truncated."
# Format line numbers as comma-separated list for better readability
lines_str = ", ".join(str(n) for n in truncated_line_numbers)
message += f" Lines {lines_str} were truncated."
return ToolOk(
output="".join(lines_with_no), # lines already contain \n, just join them
message=message,
Expand Down
10 changes: 7 additions & 3 deletions src/kimi_cli/tools/file/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,17 @@ async def __call__(self, params: Params) -> ToolReturnValue:
# Write the modified content back to the file
await p.write_text(content, errors="replace")

# Count changes for success message
# Count changes for success message by re-applying edits to count
total_replacements = 0
temp_content = original_content
for edit in edits:
if edit.replace_all:
total_replacements += original_content.count(edit.old)
total_replacements += temp_content.count(edit.old)
temp_content = temp_content.replace(edit.old, edit.new)
else:
total_replacements += 1 if edit.old in original_content else 0
if edit.old in temp_content:
total_replacements += 1
temp_content = temp_content.replace(edit.old, edit.new, 1)

return ToolReturnValue(
is_error=False,
Expand Down
5 changes: 3 additions & 2 deletions src/kimi_cli/ui/shell/slash.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,9 @@ def feedback(app: Shell, args: str):

ISSUE_URL = "https://github.com/MoonshotAI/kimi-cli/issues"
if webbrowser.open(ISSUE_URL):
return
console.print(f"Please submit feedback at [underline]{ISSUE_URL}[/underline].")
console.print("Opening GitHub issues in your browser...")
else:
console.print(f"Could not open browser. Please visit: [underline]{ISSUE_URL}[/underline]")


@registry.command(aliases=["reset"])
Expand Down
3 changes: 1 addition & 2 deletions tests/tools/test_read_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ async def test_line_truncation_and_messaging(read_file_tool: ReadFile, temp_work
assert not result.is_error
assert isinstance(result.output, str)
assert result.message == snapshot(
"3 lines read from file starting from line 1. End of file reached. "
"Lines [1, 3] were truncated."
"3 lines read from file starting from line 1. End of file reached. Lines 1, 3 were truncated."
)

# Verify truncation actually happened for specific lines
Expand Down
Loading