how to manage your AT Lexicons with lpm

if you're writing an AT application you probably have a lexicons folder in your repo with all of your Lexicons in JSON.

it might look something like this

this is fine and it works but it's a bit annoying to keep them up to date or even to find them in the first place.

luckily Tom Sherman made a little utility called lpm that does this for you. it's prerelease software so maybe don't depend on it in "production" yet but i tried it and it seemed pretty solid.

here's how it works

you install it (with Node or Deno ) and then you can do

lpm add app.bsky.actor.defs
lpm add "com.atproto.repo.*"

(or npm run lpm add ... for Node users)

it will do two things:

1. resolve and download these external lexicons (and all of their dependencies) into your lexicons/ folder

2. add lexicons.json with this list. for example, the above expanded to these (note transitive deps aren't listed here):

{
"lexicons": [
"app.bsky.actor.defs",
"com.atproto.repo.uploadBlob",
"com.atproto.repo.strongRef",
"com.atproto.repo.putRecord",
"com.atproto.repo.listRecords",
"com.atproto.repo.listMissingBlobs",
"com.atproto.repo.importRepo",
"com.atproto.repo.getRecord",
"com.atproto.repo.describeRepo",
"com.atproto.repo.deleteRecord",
"com.atproto.repo.defs",
"com.atproto.repo.createRecord",
"com.atproto.repo.applyWrites"
]
}

now whenever i want to fetch them based on this file, i can do lpm fetch them again.

i think this is cool for three reasons:

1. copy pasting json is kinda silly and it makes sense to have a package manager for that

2. this relies on Lexicon Resolution which hopefully will lead more of the community to publish their lexicons via DNS so they can be resolved with other tooling, like resolve-lexicon and equivalents

3. other tools might start using lexicons.json as source of truth for "which external lexicons are you depending on?" which might be handy! for example i might rely on this convention in Typelex where i need to know which lexicons are being vendored in

lpm is in an early phase right now but i think it's cool and i want more people to check it out. thank you for reading