loom format

loom format formats looms the way your editor's format command does. It puts each prose paragraph on one line, so your editor can wrap it at any width, and it lays out each code section with that language's formatter.

What it changes

Prose keeps its words and loses only the line breaks inside a paragraph. Lists, code fences, tables, headings and a line that ends in two spaces keep their lines.

Code goes through its language's formatter: Prettier for TypeScript, with your project's own Prettier settings. Each section's code is formatted on its own, from its own first column, so lines keep to the project's width, a hundred columns unless .loom/config.yaml sets another or your Prettier settings name their own. An anchor is one of those lines, so it takes the indentation the code it brings in needs, and the section it names keeps one shape however many anchors use it.

A section that can't be read by itself, such as the members of an object, is formatted where its one anchor places it. If several anchors use it, it stays as you wrote it. Formatting never breaks code: a tangled file that no longer reads after formatting gets its sections back as they were.

Checking

--check changes nothing. It lists the looms that would change, and fails when any would, so CI can keep a project formatted.