Dagger Feels Like Magic

| dagger | programming | typescript |

I’ve been working on a Dagger module for interacting with the Bluesky API.

I wrote the first version in Python, using the atproto library. It worked well and was easy to use, but I noticed that none of my links, mentions, or hashtags were showing up. I ignored this for a while, but today decided to investigate this some more since the whole world seems to be showing up on Bluesky this week.

It turns out that there is a separate rich text API that you need to use in order to paste links, mentions, hashtags, and images. Mastodon, Twitter, and LinkedIn seem to figure it all out automatically but Bluesky is special.

I read the python docs on how to do this, and it made sense but in order to get this to work in the real world I would need to first write some sort of parser to identify the different types of elements and then pass them into this TextBuilder class to create the Bluesky post.

This felt like a lot of work and I am lazy. The good news is that the official Typescript SDK from the Bluesky team has a helper method called detectFacets that does all of this for you.

I’ve put a lot of work into this module and it includes some examples along with a test suite that runs all of my examples. The test suite was written in Python just like the original module was.

I was able to port the module over from Python to Typescript with a little effort. I started to port the test suite over to Typescript as well but then thought to myself “wait a minute, I don’t need to port this over”.

You see, the test module is just another Dagger module that calls my Bluesky module. Dagger modules can be written in any language and they can call modules written in any other language. Since the API for my Bluesky function did not change in my Python to Typescript port everything just worked.

Sometimes Dagger feels like magic.

Thank you for reading! Share your thoughts with me on bluesky, mastodon, or via email.

Check out some more stuff to read down below.

Most popular posts this month

Recent Favorite Blog Posts

This is a collection of the last 8 posts that I bookmarked.

Articles from blogs I follow around the net

Cheap mini PCs have gotten really good

For the past week, I've been working off the Minisforum UM870. A tiny mini PC with an 8-core/16-thread AMD 8745H CPU, which retails for $343 (or €379) as a bare-bone unit, and stays below $550, even after adding 48GB of RAM and 1TB of storage. I'…

via David Heinemeier Hansson May 18, 2025

Pluralistic: Plinkpump linkdump (17 May 2025)

Today's links Plinkpump linkdump: A blogging sabbath. Object permanence: 2005, 2010, 2015, 2020, 2024 Upcoming appearances: Where to find me. Recent appearances: Where I've been. Latest books: You keep readin' em, I'll keep writin' …

via Pluralistic: Daily links from Cory Doctorow May 17, 2025

Celebrating kindness

When I started working on the new version of blogroll.org, one thing I knew I wanted to do from the get-go was to highlight all the wonderful people who are supporting what I do here in the digital world. And the reason why I wanted to do …

via Manuel Moreale May 17, 2025

Generated by openring