Skip to content

refactor: centralize tool definitions#95

Merged
mikolajbadyl merged 1 commit intomainfrom
refactor/tool-registry-pattern
Feb 28, 2026
Merged

refactor: centralize tool definitions#95
mikolajbadyl merged 1 commit intomainfrom
refactor/tool-registry-pattern

Conversation

@mikolajbadyl
Copy link
Member

@mikolajbadyl mikolajbadyl commented Feb 28, 2026

Centralize tool definitions into a single source of truth.

@kilo-code-bot
Copy link

kilo-code-bot bot commented Feb 28, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (6 files)
  • internal/agents/chat.go - Refactored to use centralized tool registry
  • internal/agents/tools.go - New file with tool constants and registry
  • internal/cli/handlers.go - Replaced string literals with constants
  • internal/cli/tui.go - Updated to use agent constants
  • internal/cli/update.go - Replaced string literals with constants
  • internal/cli/update_tests.go - Replaced string literals with constants
  • internal/cli/utils.go - Updated to use agent constants

Overview

This PR is a refactoring that centralizes tool name constants into a new tools.go file. The changes:

  1. New file internal/agents/tools.go: Introduces:

    • Tool name constants (ToolGetEndpointsDetails, ToolGenerateTestPlan, etc.)
    • ToolMeta struct combining LLM tool definitions with UI display hints
    • Centralized registry with GetToolDefinitions() and GetToolMeta() functions
  2. Updated files: All hardcoded tool name strings replaced with constants from the agent package

Assessment

The refactoring is well-executed:

  • ✅ Constants match the original string values
  • ✅ All string literals successfully replaced
  • ✅ System prompt tool names align with constant values
  • ✅ Import aliases properly maintained (agent)
  • ✅ No typos or logic bugs introduced

This is a best-practice refactor that improves maintainability and prevents future typos.

@mikolajbadyl mikolajbadyl changed the title refactor: centralize tool definitions with registry pattern refactor: centralize tool definitions Feb 28, 2026
@mikolajbadyl mikolajbadyl merged commit f035549 into main Feb 28, 2026
1 check passed
@mikolajbadyl mikolajbadyl deleted the refactor/tool-registry-pattern branch February 28, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant