mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Add script to update a Contributors section in the README
This commit is contained in:
parent
fbdf758ff5
commit
1e6327b028
3 changed files with 234 additions and 1 deletions
24
README.md
24
README.md
|
|
@ -170,6 +170,30 @@ We love community contributions! Here’s how to get involved:
|
|||
|
||||
---
|
||||
|
||||
<!-- START CONTRIBUTORS SECTION - AUTO-GENERATED, DO NOT EDIT MANUALLY -->
|
||||
|
||||
## Contributors
|
||||
|
||||
Thanks to all our contributors who have helped make Roo Code better!
|
||||
|
||||
| <a href="https://github.com/mrubens"><img src="https://avatars.githubusercontent.com/u/2600?v=4" width="120" height="120" alt="mrubens" style="border-radius:50%"/><br /><sub><b>mrubens</b></sub></a> | <a href="https://github.com/saoudrizwan"><img src="https://avatars.githubusercontent.com/u/7799382?v=4" width="120" height="120" alt="saoudrizwan" style="border-radius:50%"/><br /><sub><b>saoudrizwan</b></sub></a> | <a href="https://github.com/cte"><img src="https://avatars.githubusercontent.com/u/16332?v=4" width="120" height="120" alt="cte" style="border-radius:50%"/><br /><sub><b>cte</b></sub></a> | <a href="https://github.com/samhvw8"><img src="https://avatars.githubusercontent.com/u/12538214?v=4" width="120" height="120" alt="samhvw8" style="border-radius:50%"/><br /><sub><b>samhvw8</b></sub></a> | <a href="https://github.com/daniel-lxs"><img src="https://avatars.githubusercontent.com/u/57051444?v=4" width="120" height="120" alt="daniel-lxs" style="border-radius:50%"/><br /><sub><b>daniel-lxs</b></sub></a> | <a href="https://github.com/a8trejo"><img src="https://avatars.githubusercontent.com/u/62401433?v=4" width="120" height="120" alt="a8trejo" style="border-radius:50%"/><br /><sub><b>a8trejo</b></sub></a> |
|
||||
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
||||
| <a href="https://github.com/ColemanRoo"><img src="https://avatars.githubusercontent.com/u/117104599?v=4" width="120" height="120" alt="ColemanRoo" style="border-radius:50%"/><br /><sub><b>ColemanRoo</b></sub></a> | <a href="https://github.com/stea9499"><img src="https://avatars.githubusercontent.com/u/4163795?v=4" width="120" height="120" alt="stea9499" style="border-radius:50%"/><br /><sub><b>stea9499</b></sub></a> | <a href="https://github.com/joemanley201"><img src="https://avatars.githubusercontent.com/u/8299960?v=4" width="120" height="120" alt="joemanley201" style="border-radius:50%"/><br /><sub><b>joemanley201</b></sub></a> | <a href="https://github.com/System233"><img src="https://avatars.githubusercontent.com/u/20336040?v=4" width="120" height="120" alt="System233" style="border-radius:50%"/><br /><sub><b>System233</b></sub></a> | <a href="https://github.com/jquanton"><img src="https://avatars.githubusercontent.com/u/88576563?v=4" width="120" height="120" alt="jquanton" style="border-radius:50%"/><br /><sub><b>jquanton</b></sub></a> | <a href="https://github.com/nissa-seru"><img src="https://avatars.githubusercontent.com/u/119150866?v=4" width="120" height="120" alt="nissa-seru" style="border-radius:50%"/><br /><sub><b>nissa-seru</b></sub></a> |
|
||||
| <a href="https://github.com/hannesrudolph"><img src="https://avatars.githubusercontent.com/u/49103247?v=4" width="120" height="120" alt="hannesrudolph" style="border-radius:50%"/><br /><sub><b>hannesrudolph</b></sub></a> | <a href="https://github.com/MuriloFP"><img src="https://avatars.githubusercontent.com/u/50873657?v=4" width="120" height="120" alt="MuriloFP" style="border-radius:50%"/><br /><sub><b>MuriloFP</b></sub></a> | <a href="https://github.com/NyxJae"><img src="https://avatars.githubusercontent.com/u/52313587?v=4" width="120" height="120" alt="NyxJae" style="border-radius:50%"/><br /><sub><b>NyxJae</b></sub></a> | <a href="https://github.com/punkpeye"><img src="https://avatars.githubusercontent.com/u/108313943?v=4" width="120" height="120" alt="punkpeye" style="border-radius:50%"/><br /><sub><b>punkpeye</b></sub></a> | <a href="https://github.com/d-oit"><img src="https://avatars.githubusercontent.com/u/6849456?v=4" width="120" height="120" alt="d-oit" style="border-radius:50%"/><br /><sub><b>d-oit</b></sub></a> | <a href="https://github.com/monotykamary"><img src="https://avatars.githubusercontent.com/u/1130103?v=4" width="120" height="120" alt="monotykamary" style="border-radius:50%"/><br /><sub><b>monotykamary</b></sub></a> |
|
||||
| <a href="https://github.com/lloydchang"><img src="https://avatars.githubusercontent.com/u/1329685?v=4" width="120" height="120" alt="lloydchang" style="border-radius:50%"/><br /><sub><b>lloydchang</b></sub></a> | <a href="https://github.com/vigneshsubbiah16"><img src="https://avatars.githubusercontent.com/u/51325334?v=4" width="120" height="120" alt="vigneshsubbiah16" style="border-radius:50%"/><br /><sub><b>vigneshsubbiah16</b></sub></a> | <a href="https://github.com/Szpadel"><img src="https://avatars.githubusercontent.com/u/1857251?v=4" width="120" height="120" alt="Szpadel" style="border-radius:50%"/><br /><sub><b>Szpadel</b></sub></a> | <a href="https://github.com/lupuletic"><img src="https://avatars.githubusercontent.com/u/105351510?v=4" width="120" height="120" alt="lupuletic" style="border-radius:50%"/><br /><sub><b>lupuletic</b></sub></a> | <a href="https://github.com/cannuri"><img src="https://avatars.githubusercontent.com/u/91494156?v=4" width="120" height="120" alt="cannuri" style="border-radius:50%"/><br /><sub><b>cannuri</b></sub></a> | <a href="https://github.com/Smartsheet-JB-Brown"><img src="https://avatars.githubusercontent.com/u/171734120?v=4" width="120" height="120" alt="Smartsheet-JB-Brown" style="border-radius:50%"/><br /><sub><b>Smartsheet-JB-Brown</b></sub></a> |
|
||||
| <a href="https://github.com/Premshay"><img src="https://avatars.githubusercontent.com/u/28099628?v=4" width="120" height="120" alt="Premshay" style="border-radius:50%"/><br /><sub><b>Premshay</b></sub></a> | <a href="https://github.com/psv2522"><img src="https://avatars.githubusercontent.com/u/87223770?v=4" width="120" height="120" alt="psv2522" style="border-radius:50%"/><br /><sub><b>psv2522</b></sub></a> | <a href="https://github.com/olweraltuve"><img src="https://avatars.githubusercontent.com/u/39308405?v=4" width="120" height="120" alt="olweraltuve" style="border-radius:50%"/><br /><sub><b>olweraltuve</b></sub></a> | <a href="https://github.com/RaySinner"><img src="https://avatars.githubusercontent.com/u/118297374?v=4" width="120" height="120" alt="RaySinner" style="border-radius:50%"/><br /><sub><b>RaySinner</b></sub></a> | <a href="https://github.com/qdaxb"><img src="https://avatars.githubusercontent.com/u/4157870?v=4" width="120" height="120" alt="qdaxb" style="border-radius:50%"/><br /><sub><b>qdaxb</b></sub></a> | <a href="https://github.com/afshawnlotfi"><img src="https://avatars.githubusercontent.com/u/6283745?v=4" width="120" height="120" alt="afshawnlotfi" style="border-radius:50%"/><br /><sub><b>afshawnlotfi</b></sub></a> |
|
||||
| <a href="https://github.com/emshvac"><img src="https://avatars.githubusercontent.com/u/121588911?v=4" width="120" height="120" alt="emshvac" style="border-radius:50%"/><br /><sub><b>emshvac</b></sub></a> | <a href="https://github.com/Lunchb0ne"><img src="https://avatars.githubusercontent.com/u/22198661?v=4" width="120" height="120" alt="Lunchb0ne" style="border-radius:50%"/><br /><sub><b>Lunchb0ne</b></sub></a> | <a href="https://github.com/sammcj"><img src="https://avatars.githubusercontent.com/u/862951?v=4" width="120" height="120" alt="sammcj" style="border-radius:50%"/><br /><sub><b>sammcj</b></sub></a> | <a href="https://github.com/dtrugman"><img src="https://avatars.githubusercontent.com/u/2451669?v=4" width="120" height="120" alt="dtrugman" style="border-radius:50%"/><br /><sub><b>dtrugman</b></sub></a> | <a href="https://github.com/aitoroses"><img src="https://avatars.githubusercontent.com/u/1699368?v=4" width="120" height="120" alt="aitoroses" style="border-radius:50%"/><br /><sub><b>aitoroses</b></sub></a> | <a href="https://github.com/yt3trees"><img src="https://avatars.githubusercontent.com/u/57471763?v=4" width="120" height="120" alt="yt3trees" style="border-radius:50%"/><br /><sub><b>yt3trees</b></sub></a> |
|
||||
| <a href="https://github.com/yongjer"><img src="https://avatars.githubusercontent.com/u/54315206?v=4" width="120" height="120" alt="yongjer" style="border-radius:50%"/><br /><sub><b>yongjer</b></sub></a> | <a href="https://github.com/vincentsong"><img src="https://avatars.githubusercontent.com/u/2343574?v=4" width="120" height="120" alt="vincentsong" style="border-radius:50%"/><br /><sub><b>vincentsong</b></sub></a> | <a href="https://github.com/pugazhendhi-m"><img src="https://avatars.githubusercontent.com/u/132246623?v=4" width="120" height="120" alt="pugazhendhi-m" style="border-radius:50%"/><br /><sub><b>pugazhendhi-m</b></sub></a> | <a href="https://github.com/eonghk"><img src="https://avatars.githubusercontent.com/u/139964?v=4" width="120" height="120" alt="eonghk" style="border-radius:50%"/><br /><sub><b>eonghk</b></sub></a> | <a href="https://github.com/philfung"><img src="https://avatars.githubusercontent.com/u/1054593?v=4" width="120" height="120" alt="philfung" style="border-radius:50%"/><br /><sub><b>philfung</b></sub></a> | <a href="https://github.com/pdecat"><img src="https://avatars.githubusercontent.com/u/318490?v=4" width="120" height="120" alt="pdecat" style="border-radius:50%"/><br /><sub><b>pdecat</b></sub></a> |
|
||||
| <a href="https://github.com/napter"><img src="https://avatars.githubusercontent.com/u/6260841?v=4" width="120" height="120" alt="napter" style="border-radius:50%"/><br /><sub><b>napter</b></sub></a> | <a href="https://github.com/mdp"><img src="https://avatars.githubusercontent.com/u/2868?v=4" width="120" height="120" alt="mdp" style="border-radius:50%"/><br /><sub><b>mdp</b></sub></a> | <a href="https://github.com/jcbdev"><img src="https://avatars.githubusercontent.com/u/17152092?v=4" width="120" height="120" alt="jcbdev" style="border-radius:50%"/><br /><sub><b>jcbdev</b></sub></a> | <a href="https://github.com/anton-otee"><img src="https://avatars.githubusercontent.com/u/149477749?v=4" width="120" height="120" alt="anton-otee" style="border-radius:50%"/><br /><sub><b>anton-otee</b></sub></a> | <a href="https://github.com/AMHesch"><img src="https://avatars.githubusercontent.com/u/4777192?v=4" width="120" height="120" alt="AMHesch" style="border-radius:50%"/><br /><sub><b>AMHesch</b></sub></a> | <a href="https://github.com/bannzai"><img src="https://avatars.githubusercontent.com/u/10897361?v=4" width="120" height="120" alt="bannzai" style="border-radius:50%"/><br /><sub><b>bannzai</b></sub></a> |
|
||||
| <a href="https://github.com/dairui1"><img src="https://avatars.githubusercontent.com/u/183250644?v=4" width="120" height="120" alt="dairui1" style="border-radius:50%"/><br /><sub><b>dairui1</b></sub></a> | <a href="https://github.com/dqroid"><img src="https://avatars.githubusercontent.com/u/192424994?v=4" width="120" height="120" alt="dqroid" style="border-radius:50%"/><br /><sub><b>dqroid</b></sub></a> | <a href="https://github.com/kinandan"><img src="https://avatars.githubusercontent.com/u/186135699?v=4" width="120" height="120" alt="kinandan" style="border-radius:50%"/><br /><sub><b>kinandan</b></sub></a> | <a href="https://github.com/kohii"><img src="https://avatars.githubusercontent.com/u/6891780?v=4" width="120" height="120" alt="kohii" style="border-radius:50%"/><br /><sub><b>kohii</b></sub></a> | <a href="https://github.com/lightrabbit"><img src="https://avatars.githubusercontent.com/u/1521765?v=4" width="120" height="120" alt="lightrabbit" style="border-radius:50%"/><br /><sub><b>lightrabbit</b></sub></a> | <a href="https://github.com/olup"><img src="https://avatars.githubusercontent.com/u/13785588?v=4" width="120" height="120" alt="olup" style="border-radius:50%"/><br /><sub><b>olup</b></sub></a> |
|
||||
| <a href="https://github.com/moqimoqidea"><img src="https://avatars.githubusercontent.com/u/39821951?v=4" width="120" height="120" alt="moqimoqidea" style="border-radius:50%"/><br /><sub><b>moqimoqidea</b></sub></a> | <a href="https://github.com/mosleyit"><img src="https://avatars.githubusercontent.com/u/189396442?v=4" width="120" height="120" alt="mosleyit" style="border-radius:50%"/><br /><sub><b>mosleyit</b></sub></a> | <a href="https://github.com/oprstchn"><img src="https://avatars.githubusercontent.com/u/16177972?v=4" width="120" height="120" alt="oprstchn" style="border-radius:50%"/><br /><sub><b>oprstchn</b></sub></a> | <a href="https://github.com/philipnext"><img src="https://avatars.githubusercontent.com/u/81944499?v=4" width="120" height="120" alt="philipnext" style="border-radius:50%"/><br /><sub><b>philipnext</b></sub></a> | <a href="https://github.com/refactorthis"><img src="https://avatars.githubusercontent.com/u/3012240?v=4" width="120" height="120" alt="refactorthis" style="border-radius:50%"/><br /><sub><b>refactorthis</b></sub></a> | <a href="https://github.com/samir-nimbly"><img src="https://avatars.githubusercontent.com/u/112695483?v=4" width="120" height="120" alt="samir-nimbly" style="border-radius:50%"/><br /><sub><b>samir-nimbly</b></sub></a> |
|
||||
| <a href="https://github.com/shaybc"><img src="https://avatars.githubusercontent.com/u/8535905?v=4" width="120" height="120" alt="shaybc" style="border-radius:50%"/><br /><sub><b>shaybc</b></sub></a> | <a href="https://github.com/shohei-ihaya"><img src="https://avatars.githubusercontent.com/u/25131938?v=4" width="120" height="120" alt="shohei-ihaya" style="border-radius:50%"/><br /><sub><b>shohei-ihaya</b></sub></a> | <a href="https://github.com/student20880"><img src="https://avatars.githubusercontent.com/u/74263488?v=4" width="120" height="120" alt="student20880" style="border-radius:50%"/><br /><sub><b>student20880</b></sub></a> | <a href="https://github.com/PretzelVector"><img src="https://avatars.githubusercontent.com/u/95664360?v=4" width="120" height="120" alt="PretzelVector" style="border-radius:50%"/><br /><sub><b>PretzelVector</b></sub></a> | <a href="https://github.com/adamwlarson"><img src="https://avatars.githubusercontent.com/u/1392315?v=4" width="120" height="120" alt="adamwlarson" style="border-radius:50%"/><br /><sub><b>adamwlarson</b></sub></a> | <a href="https://github.com/alarno"><img src="https://avatars.githubusercontent.com/u/4355547?v=4" width="120" height="120" alt="alarno" style="border-radius:50%"/><br /><sub><b>alarno</b></sub></a> |
|
||||
| <a href="https://github.com/andreastempsch"><img src="https://avatars.githubusercontent.com/u/117991125?v=4" width="120" height="120" alt="andreastempsch" style="border-radius:50%"/><br /><sub><b>andreastempsch</b></sub></a> | <a href="https://github.com/Atlogit"><img src="https://avatars.githubusercontent.com/u/86947554?v=4" width="120" height="120" alt="Atlogit" style="border-radius:50%"/><br /><sub><b>Atlogit</b></sub></a> | <a href="https://github.com/dleen"><img src="https://avatars.githubusercontent.com/u/1297964?v=4" width="120" height="120" alt="dleen" style="border-radius:50%"/><br /><sub><b>dleen</b></sub></a> | <a href="https://github.com/dbasclpy"><img src="https://avatars.githubusercontent.com/u/139889137?v=4" width="120" height="120" alt="dbasclpy" style="border-radius:50%"/><br /><sub><b>dbasclpy</b></sub></a> | <a href="https://github.com/celestial-vault"><img src="https://avatars.githubusercontent.com/u/58194240?v=4" width="120" height="120" alt="celestial-vault" style="border-radius:50%"/><br /><sub><b>celestial-vault</b></sub></a> | <a href="https://github.com/DeXtroTip"><img src="https://avatars.githubusercontent.com/u/21011087?v=4" width="120" height="120" alt="DeXtroTip" style="border-radius:50%"/><br /><sub><b>DeXtroTip</b></sub></a> |
|
||||
| <a href="https://github.com/hesara"><img src="https://avatars.githubusercontent.com/u/1335918?v=4" width="120" height="120" alt="hesara" style="border-radius:50%"/><br /><sub><b>hesara</b></sub></a> | <a href="https://github.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="120" height="120" alt="eltociear" style="border-radius:50%"/><br /><sub><b>eltociear</b></sub></a> | <a href="https://github.com/libertyteeth"><img src="https://avatars.githubusercontent.com/u/32841567?v=4" width="120" height="120" alt="libertyteeth" style="border-radius:50%"/><br /><sub><b>libertyteeth</b></sub></a> | <a href="https://github.com/mamertofabian"><img src="https://avatars.githubusercontent.com/u/7698436?v=4" width="120" height="120" alt="mamertofabian" style="border-radius:50%"/><br /><sub><b>mamertofabian</b></sub></a> | <a href="https://github.com/marvijo-code"><img src="https://avatars.githubusercontent.com/u/82562019?v=4" width="120" height="120" alt="marvijo-code" style="border-radius:50%"/><br /><sub><b>marvijo-code</b></sub></a> | <a href="https://github.com/Sarke"><img src="https://avatars.githubusercontent.com/u/2719310?v=4" width="120" height="120" alt="Sarke" style="border-radius:50%"/><br /><sub><b>Sarke</b></sub></a> |
|
||||
| <a href="https://github.com/tgfjt"><img src="https://avatars.githubusercontent.com/u/2628239?v=4" width="120" height="120" alt="tgfjt" style="border-radius:50%"/><br /><sub><b>tgfjt</b></sub></a> | <a href="https://github.com/vladstudio"><img src="https://avatars.githubusercontent.com/u/914320?v=4" width="120" height="120" alt="vladstudio" style="border-radius:50%"/><br /><sub><b>vladstudio</b></sub></a> | <a href="https://github.com/ashktn"><img src="https://avatars.githubusercontent.com/u/6723913?v=4" width="120" height="120" alt="ashktn" style="border-radius:50%"/><br /><sub><b>ashktn</b></sub></a> | | | |
|
||||
|
||||
<!-- END CONTRIBUTORS SECTION -->
|
||||
|
||||
## License
|
||||
|
||||
[Apache 2.0 © 2025 Roo Veterinary, Inc.](./LICENSE)
|
||||
|
|
|
|||
|
|
@ -307,7 +307,8 @@
|
|||
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
|
||||
"watch-tests": "tsc -p . -w --outDir out",
|
||||
"changeset": "changeset",
|
||||
"knip": "knip --include files"
|
||||
"knip": "knip --include files",
|
||||
"update-contributors": "node scripts/update-contributors.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anthropic-ai/bedrock-sdk": "^0.10.2",
|
||||
|
|
|
|||
208
scripts/update-contributors.js
Executable file
208
scripts/update-contributors.js
Executable file
|
|
@ -0,0 +1,208 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* This script fetches contributor data from GitHub and updates the README.md file
|
||||
* with a contributors section showing avatars and usernames.
|
||||
*/
|
||||
|
||||
const https = require("https")
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
|
||||
// GitHub API URL for fetching contributors
|
||||
const GITHUB_API_URL = "https://api.github.com/repos/RooVetGit/Roo-Code/contributors?per_page=100"
|
||||
const README_PATH = path.join(__dirname, "..", "README.md")
|
||||
|
||||
// Sentinel markers for contributors section
|
||||
const START_MARKER = "<!-- START CONTRIBUTORS SECTION - AUTO-GENERATED, DO NOT EDIT MANUALLY -->"
|
||||
const END_MARKER = "<!-- END CONTRIBUTORS SECTION -->"
|
||||
|
||||
// HTTP options for GitHub API request
|
||||
const options = {
|
||||
headers: {
|
||||
"User-Agent": "Roo-Code-Contributors-Script",
|
||||
},
|
||||
}
|
||||
|
||||
// Add GitHub token for authentication if available
|
||||
if (process.env.GITHUB_TOKEN) {
|
||||
options.headers.Authorization = `token ${process.env.GITHUB_TOKEN}`
|
||||
console.log("Using GitHub token from environment variable")
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches contributors data from GitHub API
|
||||
* @returns {Promise<Array>} Array of contributor objects
|
||||
*/
|
||||
function fetchContributors() {
|
||||
return new Promise((resolve, reject) => {
|
||||
https
|
||||
.get(GITHUB_API_URL, options, (res) => {
|
||||
if (res.statusCode !== 200) {
|
||||
reject(new Error(`GitHub API request failed with status code: ${res.statusCode}`))
|
||||
return
|
||||
}
|
||||
|
||||
let data = ""
|
||||
res.on("data", (chunk) => {
|
||||
data += chunk
|
||||
})
|
||||
|
||||
res.on("end", () => {
|
||||
try {
|
||||
const contributors = JSON.parse(data)
|
||||
resolve(contributors)
|
||||
} catch (error) {
|
||||
reject(new Error(`Failed to parse GitHub API response: ${error.message}`))
|
||||
}
|
||||
})
|
||||
})
|
||||
.on("error", (error) => {
|
||||
reject(new Error(`GitHub API request failed: ${error.message}`))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the README.md file
|
||||
* @returns {Promise<string>} README content
|
||||
*/
|
||||
function readReadme() {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(README_PATH, "utf8", (err, data) => {
|
||||
if (err) {
|
||||
reject(new Error(`Failed to read README.md: ${err.message}`))
|
||||
return
|
||||
}
|
||||
resolve(data)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates HTML for the contributors section
|
||||
* @param {Array} contributors Array of contributor objects from GitHub API
|
||||
* @returns {string} HTML for contributors section
|
||||
*/
|
||||
function formatContributorsSection(contributors) {
|
||||
// Filter out GitHub Actions bot
|
||||
const filteredContributors = contributors.filter((c) => !c.login.includes("[bot]") && !c.login.includes("R00-B0T"))
|
||||
|
||||
// Start building with Markdown table format
|
||||
let markdown = `${START_MARKER}
|
||||
## Contributors
|
||||
|
||||
Thanks to all our contributors who have helped make Roo Code better!
|
||||
|
||||
`
|
||||
// Number of columns in the table
|
||||
const COLUMNS = 6
|
||||
|
||||
// Create contributor cell HTML
|
||||
const createCell = (contributor) => {
|
||||
return `<a href="${contributor.html_url}"><img src="${contributor.avatar_url}" width="120" height="120" alt="${contributor.login}" style="border-radius:50%"/><br /><sub><b>${contributor.login}</b></sub></a>`
|
||||
}
|
||||
|
||||
if (filteredContributors.length > 0) {
|
||||
// Table header is the first row of contributors
|
||||
const headerCells = filteredContributors.slice(0, COLUMNS).map(createCell)
|
||||
|
||||
// Fill any empty cells in header row
|
||||
while (headerCells.length < COLUMNS) {
|
||||
headerCells.push(" ")
|
||||
}
|
||||
|
||||
// Add header row
|
||||
markdown += `|${headerCells.join("|")}|\n`
|
||||
|
||||
// Add alignment row
|
||||
markdown += "|"
|
||||
for (let i = 0; i < COLUMNS; i++) {
|
||||
markdown += ":---:|"
|
||||
}
|
||||
markdown += "\n"
|
||||
|
||||
// Add remaining contributor rows starting with the second batch
|
||||
for (let i = COLUMNS; i < filteredContributors.length; i += COLUMNS) {
|
||||
const rowContributors = filteredContributors.slice(i, i + COLUMNS)
|
||||
|
||||
// Create cells for each contributor in this row
|
||||
const cells = rowContributors.map(createCell)
|
||||
|
||||
// Fill any empty cells to maintain table structure
|
||||
while (cells.length < COLUMNS) {
|
||||
cells.push(" ")
|
||||
}
|
||||
|
||||
// Add row to the table
|
||||
markdown += `|${cells.join("|")}|\n`
|
||||
}
|
||||
}
|
||||
|
||||
markdown += `${END_MARKER}`
|
||||
return markdown
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the README.md file with contributors section
|
||||
* @param {string} readmeContent Original README content
|
||||
* @param {string} contributorsSection HTML for contributors section
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function updateReadme(readmeContent, contributorsSection) {
|
||||
// Find existing contributors section markers
|
||||
const startPos = readmeContent.indexOf(START_MARKER)
|
||||
const endPos = readmeContent.indexOf(END_MARKER)
|
||||
|
||||
if (startPos === -1 || endPos === -1) {
|
||||
console.warn("Warning: Could not find contributors section markers in README.md")
|
||||
console.warn("Skipping update - please add markers to enable automatic updates.")
|
||||
return
|
||||
}
|
||||
|
||||
// Replace existing section, trimming whitespace at section boundaries
|
||||
const beforeSection = readmeContent.substring(0, startPos).trimEnd()
|
||||
const afterSection = readmeContent.substring(endPos + END_MARKER.length).trimStart()
|
||||
// Ensure single newline separators between sections
|
||||
const updatedContent = beforeSection + "\n\n" + contributorsSection.trim() + "\n\n" + afterSection
|
||||
|
||||
return writeReadme(updatedContent)
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes updated content to README.md
|
||||
* @param {string} content Updated README content
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function writeReadme(content) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.writeFile(README_PATH, content, "utf8", (err) => {
|
||||
if (err) {
|
||||
reject(new Error(`Failed to write updated README.md: ${err.message}`))
|
||||
return
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function that orchestrates the update process
|
||||
*/
|
||||
async function main() {
|
||||
try {
|
||||
const contributors = await fetchContributors()
|
||||
|
||||
const readmeContent = await readReadme()
|
||||
|
||||
const contributorsSection = formatContributorsSection(contributors)
|
||||
|
||||
await updateReadme(readmeContent, contributorsSection)
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error.message}`)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Run the script
|
||||
main()
|
||||
Loading…
Add table
Reference in a new issue