( categories: Record<string, ToolWithAnnotations[]>, sortedCategories: string[], )
| 107 | } |
| 108 | |
| 109 | function generateToolsTOC( |
| 110 | categories: Record<string, ToolWithAnnotations[]>, |
| 111 | sortedCategories: string[], |
| 112 | ): string { |
| 113 | let toc = ''; |
| 114 | |
| 115 | for (const category of sortedCategories) { |
| 116 | const categoryTools = categories[category]; |
| 117 | const categoryName = labels[category]; |
| 118 | toc += `- **${categoryName}** (${categoryTools.length} tools)\n`; |
| 119 | |
| 120 | // Sort tools within category for TOC |
| 121 | categoryTools.sort(sortTools); |
| 122 | for (const tool of categoryTools) { |
| 123 | const anchorLink = tool.name.toLowerCase(); |
| 124 | toc += ` - [\`${tool.name}\`](docs/tool-reference.md#${anchorLink})\n`; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | return toc; |
| 129 | } |
| 130 | |
| 131 | function updateReadmeWithToolsTOC(toolsTOC: string): void { |
| 132 | const readmeContent = fs.readFileSync(README_PATH, 'utf8'); |
no test coverage detected