@@ -18,11 +18,11 @@ import (
1818)
1919
2020var (
21- sourceURL string
22- sourceFile string
23- outputDir string
24- verbose bool
25- dryRun bool
21+ sourceURL string
22+ sourceFile string
23+ outputDir string
24+ verbose bool
25+ dryRun bool
2626)
2727
2828var rootCmd = & cobra.Command {
@@ -174,7 +174,7 @@ func importEntry(name string, server *toolhiveRegistry.ImageMetadata, outputDir
174174# Import timestamp: %s
175175# ---
176176` , name , time .Now ().UTC ().Format (time .RFC3339 ))
177-
177+
178178 finalContent := header + string (yamlData )
179179
180180 // Write the spec.yaml file
@@ -207,26 +207,26 @@ func sanitizeName(name string) string {
207207 "\\ " , "-" ,
208208 )
209209 sanitized := replacer .Replace (name )
210-
210+
211211 // Convert to lowercase
212212 sanitized = strings .ToLower (sanitized )
213-
213+
214214 // Remove any remaining non-alphanumeric characters except hyphens
215215 var result strings.Builder
216216 for _ , r := range sanitized {
217217 if (r >= 'a' && r <= 'z' ) || (r >= '0' && r <= '9' ) || r == '-' {
218218 result .WriteRune (r )
219219 }
220220 }
221-
221+
222222 // Remove leading/trailing hyphens
223223 finalName := strings .Trim (result .String (), "-" )
224-
224+
225225 // Collapse multiple hyphens into one
226226 for strings .Contains (finalName , "--" ) {
227227 finalName = strings .ReplaceAll (finalName , "--" , "-" )
228228 }
229-
229+
230230 return finalName
231231}
232232
@@ -237,41 +237,41 @@ func shouldCreateReadme(server *toolhiveRegistry.ImageMetadata) bool {
237237
238238func generateReadme (name string , server * toolhiveRegistry.ImageMetadata ) string {
239239 var readme strings.Builder
240-
240+
241241 readme .WriteString (fmt .Sprintf ("# %s\n \n " , name ))
242-
242+
243243 if server .Description != "" {
244244 readme .WriteString (fmt .Sprintf ("%s\n \n " , server .Description ))
245245 }
246-
246+
247247 // Basic information section
248248 readme .WriteString ("## Basic Information\n \n " )
249-
249+
250250 if server .Image != "" {
251251 readme .WriteString (fmt .Sprintf ("- **Image:** `%s`\n " , server .Image ))
252252 }
253-
253+
254254 if server .RepositoryURL != "" {
255255 readme .WriteString (fmt .Sprintf ("- **Repository:** [%s](%s)\n " , server .RepositoryURL , server .RepositoryURL ))
256256 }
257-
257+
258258 if server .Tier != "" {
259259 readme .WriteString (fmt .Sprintf ("- **Tier:** %s\n " , server .Tier ))
260260 }
261-
261+
262262 if server .Status != "" {
263263 readme .WriteString (fmt .Sprintf ("- **Status:** %s\n " , server .Status ))
264264 }
265-
265+
266266 if server .Transport != "" {
267267 readme .WriteString (fmt .Sprintf ("- **Transport:** %s\n " , server .Transport ))
268268 }
269-
269+
270270 // Tools section
271271 if len (server .Tools ) > 0 {
272272 readme .WriteString ("\n ## Available Tools\n \n " )
273273 readme .WriteString (fmt .Sprintf ("This server provides %d tools:\n \n " , len (server .Tools )))
274-
274+
275275 // Group tools in columns for better readability if there are many
276276 if len (server .Tools ) > 10 {
277277 for i := 0 ; i < len (server .Tools ); i += 3 {
@@ -289,11 +289,11 @@ func generateReadme(name string, server *toolhiveRegistry.ImageMetadata) string
289289 }
290290 }
291291 }
292-
292+
293293 // Environment Variables section
294294 if len (server .EnvVars ) > 0 {
295295 readme .WriteString ("\n ## Environment Variables\n \n " )
296-
296+
297297 // Separate required and optional
298298 var required , optional []* toolhiveRegistry.EnvVar
299299 for _ , env := range server .EnvVars {
@@ -303,7 +303,7 @@ func generateReadme(name string, server *toolhiveRegistry.ImageMetadata) string
303303 optional = append (optional , env )
304304 }
305305 }
306-
306+
307307 if len (required ) > 0 {
308308 readme .WriteString ("### Required\n \n " )
309309 for _ , env := range required {
@@ -314,7 +314,7 @@ func generateReadme(name string, server *toolhiveRegistry.ImageMetadata) string
314314 readme .WriteString (fmt .Sprintf ("- **%s**%s: %s\n " , env .Name , secret , env .Description ))
315315 }
316316 }
317-
317+
318318 if len (optional ) > 0 {
319319 readme .WriteString ("\n ### Optional\n \n " )
320320 for _ , env := range optional {
@@ -329,7 +329,7 @@ func generateReadme(name string, server *toolhiveRegistry.ImageMetadata) string
329329 }
330330 }
331331 }
332-
332+
333333 // Tags section
334334 if len (server .Tags ) > 0 {
335335 readme .WriteString ("\n ## Tags\n \n " )
@@ -338,7 +338,7 @@ func generateReadme(name string, server *toolhiveRegistry.ImageMetadata) string
338338 }
339339 readme .WriteString ("\n " )
340340 }
341-
341+
342342 // Metadata section
343343 if server .Metadata != nil {
344344 readme .WriteString ("\n ## Statistics\n \n " )
@@ -352,6 +352,6 @@ func generateReadme(name string, server *toolhiveRegistry.ImageMetadata) string
352352 readme .WriteString (fmt .Sprintf ("- 🕐 Last Updated: %s\n " , server .Metadata .LastUpdated ))
353353 }
354354 }
355-
355+
356356 return readme .String ()
357357}
0 commit comments