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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Only write entries that are worth mentioning to users.

## Unreleased

- Tools: Shell tool headlines now keep the full command string instead of applying the generic 50-character middle truncation, making long paths and arguments visible when reviewing repeated or failed commands

## 1.47.0 (2026-06-05)

- Shell: Guide users to the new standalone Kimi Code — adds a `/upgrade` command that installs it (migrating your config & sessions automatically), a welcome-screen nudge, and a once-per-day tip shown on exit
Expand Down
3 changes: 2 additions & 1 deletion src/kimi_cli/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def extract_key_argument(json_content: str | streamingjson.Lexer, tool_name: str
key_argument = "".join(content)
else:
key_argument = json_content
key_argument = shorten_middle(key_argument, width=50)
if tool_name != "Shell":
key_argument = shorten_middle(key_argument, width=50)
return key_argument


Expand Down
17 changes: 17 additions & 0 deletions tests/tools/test_extract_key_argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,28 @@ def test_shell(self):
result = extract_key_argument('{"command": "ls -la"}', "Shell")
assert result == "ls -la"

def test_shell_long_command_keeps_path_and_arguments(self):
command = (
"python scripts/really/deeply/nested/path/for/reproducing/issue_2142.py "
"--input /tmp/moonshot/kimi-cli/very/long/source/file.txt "
"--output /tmp/moonshot/kimi-cli/very/long/result.json"
)
result = extract_key_argument(f'{{"command": "{command}"}}', "Shell")
assert result == command
assert "..." not in result

def test_readfile(self):
result = extract_key_argument('{"path": "foo/bar.py"}', "ReadFile")
assert result is not None
assert "foo/bar.py" in result

def test_readfile_long_path_still_shortens(self):
long_path = "/workspace/" + "/".join(f"directory_{i:02d}" for i in range(12)) + "/target.py"
result = extract_key_argument(f'{{"path": "{long_path}"}}', "ReadFile")
assert result is not None
assert "..." in result
assert len(result) <= 53

def test_grep(self):
result = extract_key_argument('{"pattern": "hello"}', "Grep")
assert result == "hello"
Expand Down