-
Notifications
You must be signed in to change notification settings - Fork 1.3k
🔧 Refactor: Standardize Tool Naming and Configuration System #1004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📋 Review SummaryThis PR introduces a significant refactoring of the tool naming and configuration system to provide better consistency, backward compatibility, and user experience. The changes include centralizing tool name management, enhancing tool configuration logic with robust identifier matching, updating all core tools to use centralized display names, and adding comprehensive test coverage. The implementation appears well-structured and addresses the stated goals effectively. 🔍 General Feedback
🎯 Specific Feedback🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
pomelo-nwu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Overview
This PR refactors the tool naming and configuration system to provide better consistency, backward compatibility, and user experience when configuring tool access in Qwen Code.
Key Changes
1. Centralized Tool Name Management (
tool-names.ts)ToolDisplayNamesconstants for consistent display names across all toolsToolNamesMigration: Maps old tool names (e.g.,search_file_content→grep_search)ToolDisplayNamesMigration: Maps old display names (e.g.,SearchFiles→Grep)2. Enhanced Tool Configuration Logic (
config.ts,tool-utils.ts)isToolEnabled()function that supports multiple identifier formats:run_shell_command)Shell)ShellTool)search_file_content)Shell(git status))3. Tool Updates
Updated all core tools to use centralized display name constants:
Edit,Glob,Grep,ListFiles,ReadFile,ReadManyFilesSaveMemory,Shell,Task,TodoWrite,ExitPlanModeWebFetch,WebSearch,WriteFile4. Comprehensive Test Coverage
config.test.tsfor tool filtering scenariostool-utils.test.tswith 10 test cases covering:5. Documentation Updates
6. Subagent Integration
subagent-manager.tsto support display name migration when matching tools in subagent configurationsBenefits
✅ User-Friendly: Users can reference tools by intuitive display names (e.g.,
Shell) instead of technical names (e.g.,run_shell_command)✅ Backward Compatible: Existing configurations with old tool names continue to work seamlessly
✅ Maintainable: Centralized constants prevent inconsistencies and circular dependencies
✅ Robust: Comprehensive test coverage ensures reliability
✅ Future-Proof: Flexible alias system makes it easy to support name changes
Migration Path
Users can now use any of these formats in
coreToolsorexcludeToolsconfiguration:{ "coreTools": [ "Shell", // Display name (recommended) "ShellTool", // Class name "run_shell_command", // Canonical name "Shell(git status)" // Argument-specific pattern ] }Legacy names are automatically mapped to their new equivalents, requiring no immediate action from users.
Linked issues / bugs