core/cli: fix /help command usage line and help Tab completion

Use a standalone Click context so /help compact shows Usage: /compact,
not nested under help. Complete /help <cmd> from the slash registry.
This commit is contained in:
2026-07-15 13:09:24 +08:00
parent 972bcd78ee
commit 5e016c012b
4 changed files with 50 additions and 13 deletions
+8
View File
@@ -96,6 +96,14 @@ async def test_help_and_clear(state: ReplState) -> None:
assert state.agent.messages == []
async def test_help_command_usage_line(state: ReplState, capsys: pytest.CaptureFixture[str]) -> None:
assert await handle_slash(state, "/help compact") is True
out = capsys.readouterr().out
assert "Usage: /compact" in out
assert "help [COMMAND] compact" not in out
assert "Soft-compact" in out
async def test_quit(state: ReplState) -> None:
assert await handle_slash(state, "/quit") is False