On this page

Use Levni

Command line

The levni command draws scenes, searches and checks the library, and makes boards and posters. Everything is deterministic: the same input gives the same file.

Overview

After npm install @levni/levni, run commands with npx @levni/levni …. From a checkout, use node bin/levni.mjs …. Running levni with no command, or with help, prints the usage text. An unknown command prints it and exits with code 1.

CommandWhat it does
levni render <scene.json> <out>draw a scene, print the critic’s notes
levni sheet <out.png> [prop …]contact sheet of drawings
levni list [query]search the library
levni check [prop …]measure drawings without looking at them
levni add <file>import drawings written elsewhere
levni board <spec.json> <out.png>a brand board
levni poster <spec.json> <out-dir>branding posters (0.3.0)
levni mcprun the MCP server
levni ghost drafts | attachillustrate Ghost drafts
levni judge score | pickrate renders with a judge model

Errors print as levni: message and exit with code 1.

render

levni render <scene.json> <out.png|out.webp|out.svg> [--preview] [--format cover|og|square|story|youtube]

Draws a scene and prints the output path, then the layout critic’s notes (or critic: no layout problems found).

  • --preview also writes <out>.prev.jpg, 560 px wide.
  • --format recomposes a 1200 by 673 scene for another canvas by setting format and reflow on the scene. See Formats and reflow.
  • A .webp output is compressed under a size budget; .svg writes the vector source.
npx @levni/levni render scene.json cover.webp
npx @levni/levni render scene.json og.png --format og
npx @levni/levni render scene.json out.png --preview

sheet

levni sheet <out.png> [prop ...] [--recolor coral=blue,mustard=tone]

A contact sheet of drawings: every variant, on paper and on a blue panel, labelled name number. With no names it draws the whole library (a long sheet). --recolor applies a colour swap to every drawing, using the house colour names.

npx @levni/levni sheet look.png rocket lighthouse dove
npx @levni/levni sheet recolour.png rocket --recolor coral=blue

Prints how many variants it drew. The result looks like the sheet in Getting started.

list

levni list [query]

Lists drawings as name (variants) tags. With a query, only those whose name, old name or tags contain it (case-insensitive, English or Turkish). Ends with a count.

$ npx @levni/levni list lighthouse
building-lighthouse  (1)  building lighthouse
lighthouse  (3)  deniz feneri, fener, lighthouse, beacon, coast, kıyı, sea, deniz, istanbul
2 props

check

levni check [prop ...]

For agents that cannot see images. Validates drawings and measures each variant: how much of the 0 to 100 box it fills, its centre, its colours, and what to fix. With names it prints a line for each variant, plus note: lines where the name, tags or notes break the Folio guide; with none it checks the whole library and prints only problems, ending with all ok or N thing(s) to fix.

$ npx @levni/levni check rocket
rocket#0  size 83  centre (46,53)  colours tone-coral,paper,ink,tone,coral,mustard  ok
rocket#1  size 77  centre (51,44)  colours paper,ink,tone-coral,tone,coral,mustard  ok
all ok

add

levni add <file> [--dir <props folder>] [--sheet out.png]

Imports drawings written elsewhere. The file can hold one drawing, an array, or a chat answer with ```json blocks. Each drawing is validated and test-drawn. New drawings are written as <name>.json; a drawing that already exists gains its new variants; broken ones are skipped with the reason, and the command exits 1 if any were skipped. It also prints note lines for style hints that do not block a drawing: a tag that repeats the name, fewer than three tags, a number in the name that the drawing does not show, a note ending in a full stop.

note book-2: name "book-2" ends in a number the drawing does not show: name it for what makes it different (book-open, not book-2)
new  book-2: 1 variant(s)
  • --dir chooses the folder. The default is the library of the checkout you run it from.
  • --sheet draws the imported drawings so you can look at them.
npx @levni/levni add my-props.json --sheet check.png

The drawing format and the review rules are in the library guide; naming and tagging in names, tags and notes.

board

levni board <spec.json> <out.png>

Makes a brand board. The shortest spec is { "brand": { name, tagline, mark, inks } }, which gives nine tiles; or place scene, palette and type tiles yourself, with browser, card, tote and phone mockups. Prints the size and file weight. Full format: Brand boards.

npx @levni/levni board board.json board.png

poster

levni poster <spec.json> <out-dir>

Makes a series of 1200 by 1600 posters from one brand: poster-01-split.png to poster-08-launch.png and series.png. Needs Levni 0.3.0. Full format: Branding posters.

npx @levni/levni poster brand.json posters/

mcp

levni mcp

Runs Levni as an MCP server over stdio. You normally do not run it yourself; your client does. See MCP server for client setup and every tool.

ghost

levni ghost drafts [--dir <folder>] [--apply]
levni ghost attach <plan.json> [--apply]

The Ghost adapter: it finds drafts that have no images and attaches a cover and inline images. It is a dry run unless you pass --apply, only touches drafts, never publishes or sends a newsletter, and skips drafts that already have images. Needs GHOST_ADMIN_API_URL and GHOST_ADMIN_API_KEY in the environment (Ghost Admin, Settings, Integrations, a custom integration); without them it prints usage and exits 1.

  • drafts lists imageless drafts; with --apply it also pulls each one to ./levni-drafts/<name>/ as article.md and meta.json.
  • attach reads a plan file naming each draft, its cover scene and the inline images with the heading each goes after.

Details and the plan file format: docs/ghost.md.

judge

levni judge score <image> --brief "..." [--model <id>]
levni judge pick <image> <image> [...] --brief "..." [--model <id>]

Optional. Asks a judge model on OpenRouter to rate images from 0 to 3 for a brief and prints JSON. pick scores every image twice in shuffled order and averages; gaps under 0.15 count as ties. Needs your own OPENROUTER_API_KEY. Details: docs/judge.md.

Environment variables

VariableUsed byMeaning
LEVNI_RASTERrender, board, poster, sheet, mcprsvg hands the crayon finish back to the SVG renderer (slower, about 1 s a cover instead of 0.15 s). Leave unset.
LEVNI_PROPSallExtra folders of drawings, separated by :.
LEVNI_ICONSicon, asciiPath to Tabler Icons, if you did not install @tabler/icons.
GHOST_ADMIN_API_URL, GHOST_ADMIN_API_KEYghost, MCPYour Ghost Admin credentials. Never read from files.
OPENROUTER_API_KEYjudgeYour own OpenRouter key.

Found a mistake? These pages come from the docs folder and the CLI help; fix it there and open a pull request.

Free, for real

Make one now. Keep making them for free.

Try Levni in your browser, then add it to Claude or Codex: it draws on your machine, so the $20 plan you already have is enough. No image credits, no second bill.