Support adding `!tool`s in chat
(mostly copilot-generated pr description)
This pull request introduces the ability to dynamically add tools to conversations using the !tool command, along with supporting functionality and documentation updates. The changes include updates to the CLI, new helper functions for processing and updating tools, and extensive documentation and testing enhancements.
For now, !tool can't support adding toolboxes due to https://github.com/simonw/llm/issues/1092 so it just logs an error to the user.
New Feature: Dynamic Tool Addition
- Added the
!toolcommand to allow users to dynamically add tools during conversations. This functionality is integrated into thechatCLI command. (llm/cli.py) [1] [2] - Implemented
process_tools_in_chatandupdate_toolshelper functions to handle parsing and updating tools in the conversation. (llm/cli.py)
Documentation Updates
- Updated multiple documentation files (
README.md,docs/fragments.md,docs/index.md,docs/plugins/plugin-hooks.md,docs/tools.md,docs/usage.md) to include details about the new!toolcommand. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
Testing Enhancements
- Added unit tests for
process_tools_in_chatandupdate_toolsfunctions to ensure proper parsing and deduplication of tools. (tests/test_chat.py) - Extended existing chat tests to validate the integration of the
!toolcommand and its functionality. (tests/test_chat.py) [1] [2] [3] [4] - Introduced a new integration test for the
!toolcommand to verify its behavior in real-world scenarios. (tests/test_chat.py)
note: maybe there should be a click.echo confirmation to the user when a tool is successfully added to chat. ditto for !fragment honestly
@simonw , bumping this, it should be good to merge?