···4455This is a developer tool for working with Lexicon schemas:
6677-- code generation for API clients, servers, and record schemas
87- publishing schemas to and synchronizing from the AT network
98- diffing, linting, and verifying schema evolution rules
1091111-This project is a work in progress (not much is implemented). This will
1212-probably become a stand-alone git repository, and the name is likely to change.
1010+This project is a work in progress (not much is implemented). This may get moved to a standalone git repository, or maybe get merged in to `goat`.
1111+1212+The name "glot" is a substring of "polyglot", which describes somebody who speaks many languages.
1313+1414+1515+## Quickstart
1616+1717+Get the Go toolchain set up, then install glot from source:
1818+1919+```
2020+go install tangled.sh/bnewbold.net/cobalt/cmd/glot
2121+```
2222+2323+The command comes with top-level and sub-command help pages.
2424+2525+In a project directory, download some existing schemas, which will get saved as JSON files in `./lexicons/`:
2626+2727+```
2828+glot pull com.atproto.repo.strongRef com.atproto.moderation. app.bsky.actor.profile
2929+ 🟢 com.atproto.repo.strongRef
3030+ 🟢 com.atproto.moderation.defs
3131+ 🟢 com.atproto.moderation.createReport
3232+ 🟢 app.bsky.actor.profile
3333+```
3434+3535+Create a new record schema and edit it:
3636+3737+```
3838+glot new record dev.project.thing
3939+4040+vim ./lexicons/dev/project/thing.json
4141+```
4242+4343+Lint all local lexicons:
4444+4545+```
4646+glot lint
4747+ 🟢 lexicons/app/bsky/actor/profile.json
4848+ 🟢 lexicons/com/atproto/moderation/createReport.json
4949+ 🟢 lexicons/com/atproto/moderation/defs.json
5050+ 🟢 lexicons/com/atproto/repo/strongRef.json
5151+ 🟡 lexicons/dev/project/thing.json
5252+ [missing-primary-description]: primary type missing a description
5353+```
5454+5555+Check for differences against the live network, both for local edits or remote changes:
5656+5757+```
5858+glot diff
5959+diff com.atproto.repo.strongRef
6060+--- local
6161++++ remote
6262+ {
6363+ "defs": {
6464+ "main": {
6565+ "properties": {
6666+ "cid": {
6767+ "format": "cid",
6868+ "type": "string"
6969+ },
7070+ "uri": {
7171+ "format": "at-uri",
7272+ "type": "string"
7373+ }
7474+ },
7575+ "required": [
7676+ "uri",
7777+ "cid"
7878+ ],
7979+ "type": "object"
8080+ }
8181+ },
8282+- "description": "Reference another record in the network by URI, plus a content hash.",
8383++ "description": "A URI with a content-hash fingerprint.",
8484+ "id": "com.atproto.repo.strongRef",
8585+ "lexicon": 1
8686+ }
8787+```
8888+8989+If you edited an existing schema, check schema evolution rules against the published version:
9090+9191+```
9292+glot compat
9393+ 🟡 app.bsky.actor.profile
9494+ [object-required]: required fields change (main)
9595+ 🟢 com.atproto.repo.strongRef
9696+```
9797+9898+Check DNS configuration before publishing to new Lexicon namespaces:
9999+100100+```
101101+glot check-dns
102102+Some lexicon NSIDs did not resolve via DNS:
103103+104104+ dev.project.*
105105+106106+To make these resolve, add DNS TXT entries like:
107107+108108+ _lexicon.project.dev TXT "did=did:web:lex.example.com"
109109+110110+(substituting your account DID for the example value)
111111+112112+Note that DNS management interfaces commonly require only the sub-domain parts of a name, not the full registered domain.
113113+```
114114+115115+When ready, publish new or updated Lexicons:
116116+117117+```
118118+export ATP_USERNAME="user.example.com"
119119+export ATP_PASSWORD="..."
120120+glot publish
121121+ 🟢 dev.project.thing
122122+```