File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 2121from kimi_cli .soul .kimisoul import KimiSoul
2222from kimi_cli .soul .runtime import Runtime
2323from kimi_cli .utils .logging import StreamToLogger , logger
24+ from kimi_cli .utils .path import shorten_home
2425
2526
2627def enable_logging (debug : bool = False ) -> None :
@@ -150,7 +151,9 @@ async def run_shell_mode(self, command: str | None = None) -> bool:
150151 from kimi_cli .ui .shell import ShellApp , WelcomeInfoItem
151152
152153 welcome_info = [
153- WelcomeInfoItem (name = "Directory" , value = str (self ._runtime .session .work_dir )),
154+ WelcomeInfoItem (
155+ name = "Directory" , value = str (shorten_home (self ._runtime .session .work_dir ))
156+ ),
154157 WelcomeInfoItem (name = "Session" , value = self ._runtime .session .id ),
155158 ]
156159 if base_url := self ._env_overrides .get ("KIMI_BASE_URL" ):
Original file line number Diff line number Diff line change @@ -72,3 +72,15 @@ def list_directory(work_dir: Path) -> str:
7272 errors = "replace" ,
7373 )
7474 return ls .stdout .strip ()
75+
76+
77+ def shorten_home (path : Path ) -> Path :
78+ """
79+ Convert absolute path to use `~` for home directory.
80+ """
81+ try :
82+ home = Path .home ()
83+ p = path .relative_to (home )
84+ return Path ("~" ) / p
85+ except ValueError :
86+ return path
You can’t perform that action at this time.
0 commit comments