atproto_mlf/cli

Directory-tree converter: walk a source directory for .mlf and .json lexicon files, load each into a LexiconDoc (mlf via the parser with the whole tree as ref context, JSON via atproto_lexicon/decoding), and emit each per --to into a mirrored path under the output directory. One model, four directions: compile (mlf to json), convert (json to mlf), normalize (json to json) and fmt (mlf to mlf). The NSID comes from the path relative to the source directory; a JSON file whose id disagrees with its path is an error, as is the same NSID present as both .mlf and .json.

Types

pub type FileOutcome {
  Compiled(nsid: String, out_path: String)
  Failed(path: String, message: String)
}

Constructors

  • Compiled(nsid: String, out_path: String)
  • Failed(path: String, message: String)
pub type Target {
  ToJson
  ToMlf
}

Constructors

  • ToJson
  • ToMlf

Values

pub fn compile_tree(
  src_dir: String,
  out_dir: String,
  target: Target,
) -> List(FileOutcome)

Walk src_dir for .mlf and .json files and emit each as target under out_dir, mirroring the input tree. Never raises: every failure (parse, decode, print, id mismatch, NSID collision, unreadable source, unwritable output) is a Failed entry rather than an abort.

pub fn main() -> Nil
Search Document