feat(shell): add /new slash command to start and switch to a fresh session#1268
feat(shell): add /new slash command to start and switch to a fresh session#1268
Conversation
merge form main
There was a problem hiding this comment.
Pull request overview
Adds a shell-level /new slash command to create a fresh session rooted at the current work directory, switch to it via Reload(session_id=...), and clean up the current session directory when it’s empty (to avoid orphaned empty sessions).
Changes:
- Add
/newcommand in the shell slash-command registry to create a new session and trigger a reload into it (with an on-screen confirmation). - Implement empty-current-session cleanup when chaining
/new. - Add UI/conv tests covering
/newregistration scope, reload behavior, persistence, and cleanup semantics.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/kimi_cli/ui/shell/slash.py |
Registers /new (shell registry only), creates a new Session, optionally deletes the current empty session, prints confirmation, and raises Reload(session_id=...). |
tests/ui_and_conv/test_shell_slash_commands.py |
Adds coverage for /new registry placement, reload/session creation, disk persistence, and empty-session cleanup behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert len(set(ids)) == 3 | ||
|
|
||
| async def test_returns_early_without_kimi_soul(self) -> None: | ||
| """When soul is not a KimiSoul, the command should silently return.""" |
There was a problem hiding this comment.
The test docstring/comment says the command should “silently return” when app.soul isn’t a KimiSoul, but _ensure_kimi_soul() currently prints [red]KimiSoul required[/red] before returning None. Update the wording (or assert on output if “silent” is the intended behavior).
| """When soul is not a KimiSoul, the command should silently return.""" | |
| """When soul is not a KimiSoul, the command should return early without raising Reload.""" |
… without restarting Kimi Code CLI
Summary
/newReload(session_id=…)/newscoped to shell commands only (not shell-mode registry or soul-level registry)Checklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.