MCPcopy
hub / github.com/fastify/fastify / validateAllLinks

Function validateAllLinks

scripts/validate-ecosystem-links.js:98–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96}
97
98async function validateAllLinks () {
99 console.log('Reading Ecosystem.md...\n')
100 const content = fs.readFileSync(ECOSYSTEM_FILE, 'utf8')
101 const links = extractGitHubLinks(content)
102
103 // Deduplicate by owner/repo
104 const seen = new Set()
105 const uniqueLinks = links.filter(link => {
106 const key = `${link.owner}/${link.repo}`.toLowerCase()
107 if (seen.has(key)) return false
108 seen.add(key)
109 return true
110 })
111
112 console.log(`Found ${uniqueLinks.length} unique GitHub links to check:\n`)
113
114 const results = []
115 let checked = 0
116
117 for (const link of uniqueLinks) {
118 checked++
119 process.stdout.write(`\r[${checked}/${uniqueLinks.length}] Checking: ${link.owner}/${link.repo}...`.padEnd(80))
120 const result = await checkGitHubRepo(link.owner, link.repo)
121 results.push({ ...link, ...result })
122
123 // Rate limiting - wait a bit between requests
124 await new Promise(resolve => setTimeout(resolve, 200))
125 }
126
127 console.log('\n\n========== VALIDATION RESULTS ==========\n')
128
129 const notFound = results.filter(r => !r.exists)
130 const found = results.filter(r => r.exists)
131
132 if (notFound.length > 0) {
133 console.log('INACCESSIBLE (should be removed):')
134 console.log('-'.repeat(50))
135 notFound.forEach(r => {
136 console.log(` [${r.status}] ${r.owner}/${r.repo}`)
137 console.log(` ${r.url}`)
138 })
139 console.log()
140 }
141
142 if (found.length > 0) {
143 console.log('ACCESSIBLE (kept):')
144 console.log('-'.repeat(50))
145 found.forEach(r => {
146 console.log(` [${r.status}] ${r.owner}/${r.repo}`)
147 })
148 console.log()
149 }
150
151 console.log('========== SUMMARY ==========')
152 console.log(`Total links checked: ${results.length}`)
153 console.log(`Inaccessible: ${notFound.length}`)
154 console.log(`Accessible: ${found.length}`)
155

Calls 4

extractGitHubLinksFunction · 0.85
checkGitHubRepoFunction · 0.85
addMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected