cli/slash: remove the /clear command

This commit is contained in:
2026-10-09 21:15:48 +08:00
parent 287b838db9
commit 6807055b9f
4 changed files with 3 additions and 14 deletions
-8
View File
@@ -478,14 +478,6 @@ slash.add_command(quit_cmd, name="exit")
slash.add_command(quit_cmd, name="q") slash.add_command(quit_cmd, name="q")
@slash.command("clear")
@click.pass_obj
def clear_cmd(state: ReplState) -> None:
"""Clear in-memory conversation (keeps session id)."""
state.agent.messages.clear()
click.echo("conversation cleared (in-memory only; DB history kept)")
@slash.command("edit") @slash.command("edit")
@click.pass_obj @click.pass_obj
def edit_cmd(state: ReplState) -> None: def edit_cmd(state: ReplState) -> None:
+1 -1
View File
@@ -9,7 +9,7 @@ for every printed row (``-vv``).
Numbering is a **display ordinal** over the conversation rows (1-based, in the Numbering is a **display ordinal** over the conversation rows (1-based, in the
order the session holds them): it is what ``/history`` prints and what order the session holds them): it is what ``/history`` prints and what
``/history --message N`` addresses. Database row numbers are deliberately never ``/history --message N`` addresses. Database row numbers are deliberately never
shown or used — they are an implementation detail that shifts with ``/clear``. shown or used — they are an implementation detail of the store.
Local-only rows (the injected system prompt) have no number. Local-only rows (the injected system prompt) have no number.
""" """
+1 -1
View File
@@ -149,7 +149,7 @@ def test_completer_help_commands(tmp_path: object, monkeypatch: object) -> None:
found.append(item) found.append(item)
index += 1 index += 1
assert "compact" in found assert "compact" in found
assert "clear" in found assert "config" in found
def test_completer_stream_on_off(tmp_path: object, monkeypatch: object) -> None: def test_completer_stream_on_off(tmp_path: object, monkeypatch: object) -> None:
+1 -4
View File
@@ -87,11 +87,8 @@ async def state(tmp_path: Path) -> AsyncIterator[ReplState]:
await memory.close() await memory.close()
async def test_help_and_clear(state: ReplState) -> None: async def test_help(state: ReplState) -> None:
assert await handle_slash(state, "/help") is True assert await handle_slash(state, "/help") is True
state.agent.messages.append(AssistantChatMessage(content="x"))
assert await handle_slash(state, "/clear") is True
assert state.agent.messages == []
async def test_auto_continue_limits_installs_on_limit(tmp_path: Path) -> None: async def test_auto_continue_limits_installs_on_limit(tmp_path: Path) -> None: