feat: dynamically load testimonials from README using cog

This commit is contained in:
Paul Gauthier (aider) 2025-03-28 15:48:39 -10:00
parent 424b43b3d3
commit 04b3ada7f7
2 changed files with 175 additions and 103 deletions

View file

@ -238,109 +238,115 @@ aider --model o3-mini --api-key openai=&lt;key&gt;</code></pre>
</section> </section>
<script> <script>
// All testimonials from the README // Testimonials dynamically loaded from README
const testimonials = [ <!--[[[cog
{ from scripts.badges import get_testimonials_js
text: "The best free open source AI coding assistant.", text = get_testimonials_js()
author: "IndyDevDan", cog.out(text)
link: "https://youtu.be/YALpX8oOn78" ]]]-->
}, const testimonials = [
{ {
text: "The best AI coding assistant so far.", text: "The best free open source AI coding assistant.",
author: "Matthew Berman", author: "IndyDevDan",
link: "https://www.youtube.com/watch?v=df8afeb1FY8" link: "https://youtu.be/YALpX8oOn78"
}, },
{ {
text: "Aider ... has easily quadrupled my coding productivity.", text: "The best AI coding assistant so far.",
author: "SOLAR_FIELDS", author: "Matthew Berman",
link: "https://news.ycombinator.com/item?id=36212100" link: "https://www.youtube.com/watch?v=df8afeb1FY8"
}, },
{ {
text: "It's a cool workflow... Aider's ergonomics are perfect for me.", text: "Aider ... has easily quadrupled my coding productivity.",
author: "qup", author: "SOLAR_FIELDS",
link: "https://news.ycombinator.com/item?id=38185326" link: "https://news.ycombinator.com/item?id=36212100"
}, },
{ {
text: "It's really like having your senior developer live right in your Git repo - truly amazing!", text: "It's a cool workflow... Aider's ergonomics are perfect for me.",
author: "rappster", author: "qup",
link: "https://github.com/Aider-AI/aider/issues/124" link: "https://news.ycombinator.com/item?id=38185326"
}, },
{ {
text: "What an amazing tool. It's incredible.", text: "It's really like having your senior developer live right in your Git repo - truly amazing!",
author: "valyagolev", author: "rappster",
link: "https://github.com/Aider-AI/aider/issues/6#issue-1722897858" link: "https://github.com/Aider-AI/aider/issues/124"
}, },
{ {
text: "Aider is such an astounding thing!", text: "What an amazing tool. It's incredible.",
author: "cgrothaus", author: "valyagolev",
link: "https://github.com/Aider-AI/aider/issues/82#issuecomment-1631876700" link: "https://github.com/Aider-AI/aider/issues/6#issue-1722897858"
}, },
{ {
text: "It was WAY faster than I would be getting off the ground and making the first few working versions.", text: "Aider is such an astounding thing!",
author: "Daniel Feldman", author: "cgrothaus",
link: "https://twitter.com/d_feldman/status/1662295077387923456" link: "https://github.com/Aider-AI/aider/issues/82#issuecomment-1631876700"
}, },
{ {
text: "THANK YOU for Aider! It really feels like a glimpse into the future of coding.", text: "It was WAY faster than I would be getting off the ground and making the first few working versions.",
author: "derwiki", author: "Daniel Feldman",
link: "https://news.ycombinator.com/item?id=38205643" link: "https://twitter.com/d_feldman/status/1662295077387923456"
}, },
{ {
text: "It's just amazing. It is freeing me to do things I felt were out my comfort zone before.", text: "THANK YOU for Aider! It really feels like a glimpse into the future of coding.",
author: "Dougie", author: "derwiki",
link: "https://discord.com/channels/1131200896827654144/1174002618058678323/1174084556257775656" link: "https://news.ycombinator.com/item?id=38205643"
}, },
{ {
text: "This project is stellar.", text: "It's just amazing. It is freeing me to do things I felt were out my comfort zone before.",
author: "funkytaco", author: "Dougie",
link: "https://github.com/Aider-AI/aider/issues/112#issuecomment-1637429008" link: "https://discord.com/channels/1131200896827654144/1174002618058678323/1174084556257775656"
}, },
{ {
text: "Amazing project, definitely the best AI coding assistant I've used.", text: "This project is stellar.",
author: "joshuavial", author: "funkytaco",
link: "https://github.com/Aider-AI/aider/issues/84" link: "https://github.com/Aider-AI/aider/issues/112#issuecomment-1637429008"
}, },
{ {
text: "I absolutely love using Aider ... It makes software development feel so much lighter as an experience.", text: "Amazing project, definitely the best AI coding assistant I've used.",
author: "principalideal0", author: "joshuavial",
link: "https://discord.com/channels/1131200896827654144/1133421607499595858/1229689636012691468" link: "https://github.com/Aider-AI/aider/issues/84"
}, },
{ {
text: "I have been recovering from multiple shoulder surgeries ... and have used aider extensively. It has allowed me to continue productivity.", text: "I absolutely love using Aider ... It makes software development feel so much lighter as an experience.",
author: "codeninja", author: "principalideal0",
link: "https://www.reddit.com/r/OpenAI/s/nmNwkHy1zG" link: "https://discord.com/channels/1131200896827654144/1133421607499595858/1229689636012691468"
}, },
{ {
text: "I am an aider addict. I'm getting so much more work done, but in less time.", text: "I have been recovering from multiple shoulder surgeries ... and have used aider extensively. It has allowed me to continue productivity.",
author: "dandandan", author: "codeninja",
link: "https://discord.com/channels/1131200896827654144/1131200896827654149/1135913253483069470" link: "https://www.reddit.com/r/OpenAI/s/nmNwkHy1zG"
}, },
{ {
text: "After wasting $100 on tokens trying to find something better, I'm back to Aider. It blows everything else out of the water hands down, there's no competition whatsoever.", text: "I am an aider addict. I'm getting so much more work done, but in less time.",
author: "SystemSculpt", author: "dandandan",
link: "https://discord.com/channels/1131200896827654144/1131200896827654149/1178736602797846548" link: "https://discord.com/channels/1131200896827654144/1131200896827654149/1135913253483069470"
}, },
{ {
text: "Aider is amazing, coupled with Sonnet 3.5 it's quite mind blowing.", text: "After wasting $100 on tokens trying to find something better, I'm back to Aider. It blows everything else out of the water hands down, there's no competition whatsoever.",
author: "Josh Dingus", author: "SystemSculpt",
link: "https://discord.com/channels/1131200896827654144/1133060684540813372/1262374225298198548" link: "https://discord.com/channels/1131200896827654144/1131200896827654149/1178736602797846548"
}, },
{ {
text: "Hands down, this is the best AI coding assistant tool so far.", text: "Aider is amazing, coupled with Sonnet 3.5 it's quite mind blowing.",
author: "IndyDevDan", author: "Josh Dingus",
link: "https://www.youtube.com/watch?v=MPYFPvxfGZs" link: "https://discord.com/channels/1131200896827654144/1133060684540813372/1262374225298198548"
}, },
{ {
text: "[Aider] changed my daily coding workflows. It's mind-blowing how a single Python application can change your life.", text: "Hands down, this is the best AI coding assistant tool so far.",
author: "maledorak", author: "IndyDevDan",
link: "https://discord.com/channels/1131200896827654144/1131200896827654149/1258453375620747264" link: "https://www.youtube.com/watch?v=MPYFPvxfGZs"
}, },
{ {
text: "Best agent for actual dev work in existing codebases.", text: "[Aider] changed my daily coding workflows. It's mind-blowing how a single Python application can change your life.",
author: "Nick Dobos", author: "maledorak",
link: "https://twitter.com/NickADobos/status/1690408967963652097?s=20" link: "https://discord.com/channels/1131200896827654144/1131200896827654149/1258453375620747264"
} },
]; {
text: "Best agent for actual dev work in existing codebases.",
author: "Nick Dobos",
link: "https://twitter.com/NickADobos/status/1690408967963652097?s=20"
}
];
<!--[[[end]]]-->
// Function to shuffle array // Function to shuffle array
function shuffleArray(array) { function shuffleArray(array) {

View file

@ -410,6 +410,72 @@ def get_badges_html():
return html return html
def get_testimonials_js():
"""
Extract testimonials from README.md and format them as JavaScript array
"""
# Path to README.md, relative to this script
readme_path = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
"README.md"
)
testimonials = []
in_testimonials_section = False
try:
with open(readme_path, "r", encoding="utf-8") as f:
for line in f:
# Check if we're entering the testimonials section
if line.strip() == "## Kind Words From Users":
in_testimonials_section = True
continue
# If we've hit another section after testimonials, stop
if in_testimonials_section and line.startswith("##"):
break
# Process testimonial lines
if in_testimonials_section and line.strip().startswith("- *\""):
# Extract the quote text: between *" and "*
quote_match = line.split("*\"")[1].split("\"*")[0].strip()
# Extract the author: between "— [" and "]"
author_match = line.split("— [")[1].split("]")[0].strip()
# Extract the link: between "(" and ")"
link_match = line.split("](")[1].split(")")[0].strip()
testimonials.append({
"text": quote_match,
"author": author_match,
"link": link_match
})
# Format as JavaScript array
if not testimonials:
return "const testimonials = [];"
js_array = "const testimonials = [\n"
for i, t in enumerate(testimonials):
js_array += f" {{\n"
js_array += f" text: \"{t['text']}\",\n"
js_array += f" author: \"{t['author']}\",\n"
js_array += f" link: \"{t['link']}\"\n"
js_array += " }"
if i < len(testimonials) - 1:
js_array += ","
js_array += "\n"
js_array += "];"
return js_array
except Exception as e:
print(f"Error reading testimonials from README: {e}", file=sys.stderr)
# Return empty array as fallback
return "const testimonials = [];"
def main(): def main():
# Load environment variables from .env file # Load environment variables from .env file
load_dotenv() load_dotenv()