Conversation
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Extract core logic from CLI commands into reusable functions (print_status, print_list, run_lint) so the chat REPL can call them directly instead of duplicating code. /add uses asyncio.to_thread since _add_single_file internally calls asyncio.run which cannot be nested.
- Rename _add_single_file → add_single_file (public API, consistent with print_status/print_list/run_lint already being public) - Add progress counter [i/total] for /add when processing directories - Move `import asyncio` to module-level imports in chat.py - Add 12 tests covering all new slash commands in _handle_slash
When users type /add '/path/to file' the quotes were included as part of the path, causing "Path does not exist" errors. Now single and double quotes wrapping the argument are stripped.
- Tab on / prefix completes slash commands (/status, /list, etc.) - Tab after /add completes file paths with expanduser support - Handles quoted paths (strips leading quote before path completion)
Store prompt history in .openkb/chat_history so users can press up/down arrows to recall previous inputs across chat sessions.
a3446d1 to
09743c2
Compare
Code reviewFound 1 issue:
OpenKB/tests/test_add_command.py Lines 65 to 76 in 09743c2 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Code reviewFound 2 issues:
The rename from OpenKB/tests/test_add_command.py Lines 65 to 76 in 09743c2
The Lines 528 to 547 in 09743c2 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
- Show command descriptions next to completions (e.g. /status → "Show knowledge base status") - Switch completion display to MULTI_COLUMN (zsh-like, listed below the prompt instead of a dropdown menu)
- Filter out dotfiles from /add path completion unless the user explicitly types a dot prefix (e.g. /add ./. will show dotfiles) - Restyle completion menu: transparent background, subtle text colors, no heavy inverted bar
Disable complete_while_typing so completions only appear on Tab press. Subsequent Tabs cycle through candidates, like zsh.
Custom key bindings so that: - Tab with no menu open: trigger completion - Arrow keys: navigate candidates in the menu - Tab with menu open: accept current selection and insert
Guard against current_completion being None when the menu is open but no item is highlighted. Falls back to selecting the first item.
When only one candidate matches, Tab inserts it directly without requiring arrow key selection first.
Code reviewFound 2 issues:
Lines 528 to 547 in adbb200
OpenKB/tests/test_add_command.py Lines 66 to 75 in adbb200 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
- Restore underscore in test_add_single_file_calls_helper (accidental removal during _add_single_file rename) - Catch KeyboardInterrupt around _handle_slash so Ctrl-C during /add or /lint aborts the command instead of triggering the exit prompt - Add test for Ctrl-C behavior during slash command execution
- Append closing quote for file completions so quotes stay paired - Skip closing quote for directory completions to allow continued navigation - Fallback strip unmatched leading quote in _handle_slash
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
Summary
/status,/list,/lint,/add <path>slash commands to the interactive chat REPLprint_status(),print_list(),run_lint()from CLI command callbacks into reusable functions so both CLI and chat REPL share the same logic/addusesasyncio.to_thread()to wrapadd_single_file(which internally callsasyncio.run()and can't be nested in the REPL's event loop)/st→/status) and file paths after/addFileHistory(up/down arrows recall previous inputs)Test plan
python -m pytest tests/— 213 passedopenkb chat→/helpshows new commands/statusdisplays KB status/listlists documents/lintruns structural + knowledge lint/add <path>adds a document from within chat/add '/path/with spaces'works with quoted pathsopenkb status,openkb list,openkb lint) still work unchanged