@@ -28,10 +28,12 @@ var (
2828 ToolsetMetadataContext = toolsets.ToolsetMetadata {
2929 ID : "context" ,
3030 Description : "Tools that provide context about the current user and GitHub context you are operating in" ,
31+ Default : true ,
3132 }
3233 ToolsetMetadataRepos = toolsets.ToolsetMetadata {
3334 ID : "repos" ,
3435 Description : "GitHub Repository related tools" ,
36+ Default : true ,
3537 }
3638 ToolsetMetadataGit = toolsets.ToolsetMetadata {
3739 ID : "git" ,
@@ -40,14 +42,17 @@ var (
4042 ToolsetMetadataIssues = toolsets.ToolsetMetadata {
4143 ID : "issues" ,
4244 Description : "GitHub Issues related tools" ,
45+ Default : true ,
4346 }
4447 ToolsetMetadataPullRequests = toolsets.ToolsetMetadata {
4548 ID : "pull_requests" ,
4649 Description : "GitHub Pull Request related tools" ,
50+ Default : true ,
4751 }
4852 ToolsetMetadataUsers = toolsets.ToolsetMetadata {
4953 ID : "users" ,
5054 Description : "GitHub User related tools" ,
55+ Default : true ,
5156 }
5257 ToolsetMetadataOrgs = toolsets.ToolsetMetadata {
5358 ID : "orgs" ,
@@ -107,53 +112,6 @@ var (
107112 }
108113)
109114
110- func AvailableToolsets () []toolsets.ToolsetMetadata {
111- return []toolsets.ToolsetMetadata {
112- ToolsetMetadataContext ,
113- ToolsetMetadataRepos ,
114- ToolsetMetadataGit ,
115- ToolsetMetadataIssues ,
116- ToolsetMetadataPullRequests ,
117- ToolsetMetadataUsers ,
118- ToolsetMetadataOrgs ,
119- ToolsetMetadataActions ,
120- ToolsetMetadataCodeSecurity ,
121- ToolsetMetadataSecretProtection ,
122- ToolsetMetadataDependabot ,
123- ToolsetMetadataNotifications ,
124- ToolsetMetadataExperiments ,
125- ToolsetMetadataDiscussions ,
126- ToolsetMetadataGists ,
127- ToolsetMetadataSecurityAdvisories ,
128- ToolsetMetadataProjects ,
129- ToolsetMetadataStargazers ,
130- ToolsetMetadataDynamic ,
131- ToolsetLabels ,
132- }
133- }
134-
135- // GetValidToolsetIDs returns a map of all valid toolset IDs for quick lookup
136- func GetValidToolsetIDs () map [toolsets.ToolsetID ]bool {
137- validIDs := make (map [toolsets.ToolsetID ]bool )
138- for _ , toolset := range AvailableToolsets () {
139- validIDs [toolset .ID ] = true
140- }
141- // Add special keywords
142- validIDs [ToolsetMetadataAll .ID ] = true
143- validIDs [ToolsetMetadataDefault .ID ] = true
144- return validIDs
145- }
146-
147- func GetDefaultToolsetIDs () []toolsets.ToolsetID {
148- return []toolsets.ToolsetID {
149- ToolsetMetadataContext .ID ,
150- ToolsetMetadataRepos .ID ,
151- ToolsetMetadataIssues .ID ,
152- ToolsetMetadataPullRequests .ID ,
153- ToolsetMetadataUsers .ID ,
154- }
155- }
156-
157115// AllTools returns all tools with their embedded toolset metadata.
158116// Tool functions return ServerTool directly with toolset info.
159117func AllTools (t translations.TranslationHelperFunc ) []toolsets.ServerTool {
@@ -304,16 +262,19 @@ func ToStringPtr(s string) *string {
304262
305263// GenerateToolsetsHelp generates the help text for the toolsets flag
306264func GenerateToolsetsHelp () string {
307- // Format default tools
308- defaultIDs := GetDefaultToolsetIDs ()
265+ // Get toolset group to derive defaults and available toolsets
266+ tsg := NewToolsetGroup (stubTranslator )
267+
268+ // Format default tools from metadata
269+ defaultIDs := tsg .DefaultToolsetIDs ()
309270 defaultStrings := make ([]string , len (defaultIDs ))
310271 for i , id := range defaultIDs {
311272 defaultStrings [i ] = string (id )
312273 }
313274 defaultTools := strings .Join (defaultStrings , ", " )
314275
315- // Format available tools with line breaks for better readability
316- allToolsets := AvailableToolsets ()
276+ // Get all available toolsets (excludes context and dynamic for display)
277+ allToolsets := tsg . AvailableToolsets ("context" , "dynamic" )
317278 var availableToolsLines []string
318279 const maxLineLength = 70
319280 currentLine := ""
@@ -349,6 +310,10 @@ func GenerateToolsetsHelp() string {
349310 return toolsetsHelp
350311}
351312
313+ // stubTranslator is a passthrough translator for cases where we need a ToolsetGroup
314+ // but don't need actual translations (e.g., getting toolset IDs for CLI help).
315+ func stubTranslator (_ , fallback string ) string { return fallback }
316+
352317// AddDefaultToolset removes the default toolset and expands it to the actual default toolset IDs
353318func AddDefaultToolset (result []string ) []string {
354319 hasDefault := false
@@ -367,43 +332,16 @@ func AddDefaultToolset(result []string) []string {
367332
368333 result = RemoveToolset (result , string (ToolsetMetadataDefault .ID ))
369334
370- for _ , defaultToolset := range GetDefaultToolsetIDs () {
371- if ! seen [string (defaultToolset )] {
372- result = append (result , string (defaultToolset ))
335+ // Get default toolset IDs from the ToolsetGroup
336+ tsg := NewToolsetGroup (stubTranslator )
337+ for _ , id := range tsg .DefaultToolsetIDs () {
338+ if ! seen [string (id )] {
339+ result = append (result , string (id ))
373340 }
374341 }
375342 return result
376343}
377344
378- // cleanToolsets cleans and handles special toolset keywords:
379- // - Duplicates are removed from the result
380- // - Removes whitespaces
381- // - Validates toolset names and returns invalid ones separately - for warning reporting
382- // Returns: (toolsets, invalidToolsets)
383- func CleanToolsets (enabledToolsets []string ) ([]string , []string ) {
384- seen := make (map [string ]bool )
385- result := make ([]string , 0 , len (enabledToolsets ))
386- invalid := make ([]string , 0 )
387- validIDs := GetValidToolsetIDs ()
388-
389- // Add non-default toolsets, removing duplicates and trimming whitespace
390- for _ , toolset := range enabledToolsets {
391- trimmed := strings .TrimSpace (toolset )
392- if trimmed == "" {
393- continue
394- }
395- if ! seen [trimmed ] {
396- seen [trimmed ] = true
397- result = append (result , trimmed )
398- if ! validIDs [toolsets .ToolsetID (trimmed )] {
399- invalid = append (invalid , trimmed )
400- }
401- }
402- }
403-
404- return result , invalid
405- }
406-
407345func RemoveToolset (tools []string , toRemove string ) []string {
408346 result := make ([]string , 0 , len (tools ))
409347 for _ , tool := range tools {
0 commit comments