Skip to content

Commit 8f9fa1d

Browse files
committed
remove unused code, move deprecated tool aliases to its own file
1 parent 66a5699 commit 8f9fa1d

File tree

3 files changed

+14
-40
lines changed

3 files changed

+14
-40
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// tool_aliases.go
2+
package github
3+
4+
// DeprecatedToolAliases maps old tool names to their new canonical names.
5+
// When tools are renamed, add an entry here to maintain backward compatibility.
6+
// Users referencing the old name will receive the new tool with a deprecation warning.
7+
//
8+
// Example:
9+
//
10+
// "get_issue": "issue_read",
11+
// "create_pr": "pull_request_create",
12+
var DeprecatedToolAliases = map[string]string{
13+
// Add entries as tools are renamed
14+
}

pkg/github/tools.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ func GetDefaultToolsetIDs() []string {
160160
}
161161
}
162162

163-
// DeprecatedToolAliases maps old tool names to their new canonical names.
164-
// This allows tool renames without breaking existing user configurations.
165-
// When a user requests an old tool name, it will silently resolve to the new name.
166-
// Example: "get_issue" : "issue_read"
167-
var DeprecatedToolAliases = map[string]string{}
168-
169163
func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetGQLClientFn, getRawClient raw.GetRawClientFn, t translations.TranslationHelperFunc, contentWindowSize int, flags FeatureFlags, cache *lockdown.RepoAccessCache) *toolsets.ToolsetGroup {
170164
tsg := toolsets.NewToolsetGroup(readOnly)
171165

pkg/toolsets/toolsets.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,6 @@ func NewToolDoesNotExistError(name string) *ToolDoesNotExistError {
326326
return &ToolDoesNotExistError{Name: name}
327327
}
328328

329-
// ToolLookupResult contains the result of a tool lookup operation.
330-
type ToolLookupResult struct {
331-
Tool *ServerTool
332-
ToolsetName string
333-
RequestedName string // The name that was requested (may differ from Tool.Name if alias was used)
334-
AliasUsed bool // True if the requested name was a deprecated alias
335-
}
336-
337329
// FindToolByName searches all toolsets (enabled or disabled) for a tool by name.
338330
// It resolves deprecated aliases automatically and logs a warning when an alias is used.
339331
// Returns the tool, its parent toolset name, and an error if not found.
@@ -361,32 +353,6 @@ func (tg *ToolsetGroup) FindToolByName(toolName string) (*ServerTool, string, er
361353
return nil, "", NewToolDoesNotExistError(toolName)
362354
}
363355

364-
// FindToolWithAliasInfo searches all toolsets for a tool by name and returns
365-
// additional metadata about whether a deprecated alias was used.
366-
// Use this when you need to track/log deprecated alias usage (e.g., for telemetry).
367-
func (tg *ToolsetGroup) FindToolWithAliasInfo(toolName string) (*ToolLookupResult, error) {
368-
requestedName := toolName
369-
aliasUsed := false
370-
371-
// Check if this is a deprecated alias and resolve to canonical name
372-
if canonicalName, isAlias := tg.deprecatedAliases[toolName]; isAlias {
373-
toolName = canonicalName
374-
aliasUsed = true
375-
}
376-
377-
tool, toolsetName, err := tg.FindToolByName(toolName)
378-
if err != nil {
379-
return nil, NewToolDoesNotExistError(requestedName)
380-
}
381-
382-
return &ToolLookupResult{
383-
Tool: tool,
384-
ToolsetName: toolsetName,
385-
RequestedName: requestedName,
386-
AliasUsed: aliasUsed,
387-
}, nil
388-
}
389-
390356
// RegisterSpecificTools registers only the specified tools.
391357
// Respects read-only mode (skips write tools if readOnly=true).
392358
// Returns error if any tool is not found.

0 commit comments

Comments
 (0)