A human-friendly DSL for ATProto Lexicons
26
fork

Configure Feed

Select the types of activity you want to include in your feed.

Rust 76.5%
C 15.7%
JavaScript 2.1%
SCSS 1.7%
HTML 1.2%
C++ 1.0%
Just 0.3%
Scheme 0.2%
Shell 0.1%
Python 0.1%
TypeScript 0.1%
Other 1.2%
92 1 0

Clone this repository

https://tangled.org/stavola.xyz/mlf https://tangled.org/did:plc:tahmjtpwnkuhopngqe5q7jp2/mlf
git@tangled.org:stavola.xyz/mlf git@tangled.org:did:plc:tahmjtpwnkuhopngqe5q7jp2/mlf

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

Matt's Lexicon Format#

A human-friendly DSL for ATProto Lexicons

This is a work in progress, things are subject to break and change

What it looks like#

/// Blog-style post record for the Bluesky feed.
@const("revision", 3)
self {}

record post {
    text!: string constrained {
        maxLength: 3000,
        maxGraphemes: 300,
    },
    createdAt!: Datetime,
    reply: replyRef,
}

def type replyRef = {
    root!: com.atproto.repo.strongRef,
    parent!: com.atproto.repo.strongRef,
};

self {} represents the lexicon itself — docs on it map to the top-level description; @const / @reference annotations carry non-spec or vendor extension fields through to JSON.

Installation#

Right now you can only install mlf from source:

CLI Tool#

# Install with all code generators (default: TypeScript, Go, Rust)
cargo install --path mlf-cli --all-features

# Install with only specific generators
cargo install --path mlf-cli --no-default-features --features typescript,go

# Install with JSON generation only
cargo install --path mlf-cli --no-default-features

Language Server#

For editor integration with real-time diagnostics:

# Build the language server
cargo build --release -p mlf-lsp

# The binary will be at: target/release/mlf-lsp

Editor Setup#

VS Code: Create an extension configuration:

{
  "languageServer": {
    "module": "/path/to/mlf-lsp",
    "args": [],
    "filetypes": ["mlf"]
  }
}

Neovim: Add to your LSP config:

local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')

configs.mlf = {
  default_config = {
    cmd = { '/path/to/mlf-lsp' },
    filetypes = { 'mlf' },
    root_dir = lspconfig.util.root_pattern('mlf.toml', '.git'),
  },
}

lspconfig.mlf.setup{}

Helix: Add to languages.toml:

[[language]]
name = "mlf"
scope = "source.mlf"
file-types = ["mlf"]
language-servers = ["mlf-lsp"]

[language-server.mlf-lsp]
command = "/path/to/mlf-lsp"

See mlf-lsp/README.md for more details.

Documentation#

Visit the MLF website for comprehensive documentation, guides, and examples.

Architecture#

Please review ARCHITECTURE.md for an overview of how the project is structured.

License#

MIT