Compile, decompile, format, check, and explain a Yoke source from this repository.
yokec
yokec is the language tool. From this repository the binary is cargo run -p yokec. There is no install command.
Exit 0 is success. Exit 1 is a diagnostic. Exit 2 is a bad argument or a file that cannot be read.
yokec compile <file.yoke> [-o out.json]
yokec decompile <file.json> [-o out.yoke]
yokec fmt <file.yoke> [--check | --write]
yokec check <file.yoke> [--lint]
yokec explain <code>
yokec dump-listing <listing-id> [-o out.yoke] [--json out.json] [--assets <dir>]
yokec dump-recipe <slug> [-o out.yoke] [--json out.json]
yokec dump-all [<dir>] [--assets <dir>]
Prefix the command with cargo run -p yokec -- when you are running it from this repository. cargo run -p yokec -- compile app.yoke is the compile command.
compile
yokec compile <file.yoke> [-o out.json] compiles the source to the document JSON. With -o it writes that file. Without -o it prints the JSON.
decompile
yokec decompile <file.json> [-o out.yoke] prints the source of a compiled document. With -o it writes that file.
fmt
yokec fmt <file.yoke> [--check | --write] is the formatter, and it runs only when you name it. With no flag it prints the canonical source and leaves the file alone. --write replaces the file. --check exits 1 when the file is not already that source, and exits 0 when it is.
Compile and check do not format.
check
yokec check <file.yoke> [--lint] compiles the source and checks that the document is one the platform can install. A clean file prints <file>: ok. --lint also runs the ruleset and exits 1 when a finding is an error.
explain
yokec explain <code> prints the error page for that code. An unknown code exits 2 and lists the families.
dump-listing
yokec dump-listing <listing-id> [-o out.yoke] [--json out.json] [--assets <dir>] prints the source of a marketplace listing. The source is printed only when it compiles back to the same document. --json writes that document. --assets is the directory of listing assets. In this repository the default is backend/assets/marketplace.
dump-recipe
yokec dump-recipe <slug> [-o out.yoke] [--json out.json] does the same for a recipe: the source, and with --json the document, only when the source compiles back to that document.
dump-all
yokec dump-all [<dir>] [--assets <dir>] writes every listing and every recipe. Each one is a .yoke file and a .yoke.json file. Recipes are written under <dir>/verticals/. When you omit <dir>, the files go to backend/assets/yokes in this repository. --assets is the same directory dump-listing reads.