atproto_sdl/cli

Directory-tree converter: walk a source directory for .sdl and .json files and convert each to the other format, mirroring the input tree (com/example/thread.sdl <-> <out>/com/example/thread.json). NSID derives from the file path, as in atproto_mlf. --to json/ --to sdl restricts the run to one input format; with neither, both directions run over a mixed tree. Two source files resolving to the same NSID, or a .json file whose own id doesn’t match its path-derived NSID, are reported rather than silently resolved.

main is a thin argv wrapper around convert_tree, which stays independent of argv/stdout so it is directly testable.

Types

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

Constructors

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

Constructors

  • ToJson
  • ToSdl

Values

pub fn convert_tree(
  src_dir: String,
  out_dir: String,
  target: option.Option(Target),
) -> List(FileOutcome)

Walk src_dir for .sdl/.json files (subject to target) and convert each into the other format under out_dir, mirroring the input tree. Never raises: every failure (parse error, unreadable source, unwritable output, NSID collision, id/path mismatch) is reported as a Failed entry in the returned list rather than aborting the whole run.

pub fn main() -> Nil
Search Document