WorkLensDocs
    Studio
    guide

    Generate

    worklens generate — recipe → data. Read from the CLI’s own header, with every option it accepts.

    Last updated 2026-09-13 · Generated from packages/sdk-node/bin/worklens.js · Markdown

    Summary

    worklens generate <recipe.wl.json> [opts] turns a recipe into data, locally. With no options it writes CSV to stdout with the recipe’s row counts; --format picks json, sql or nested, -o writes a file, --seed pins the bytes, --scenario picks a named condition and --slice pulls a referential subset. The same recipe and seed give the same bytes on every machine.

    recipe.wl.json
    worklens generate--seed · --format
    Datacsv · json · sql · nested

    Usage

    node packages/sdk-node/bin/worklens.js generate <recipe.wl.json> [opts]

    Options

    • --seed N — deterministic seed
    • --format F — csv | json | sql | nested (default csv)
    • -o FILE — write to FILE (else stdout)
    • --rows N — DEFAULT rows, used only for entities that declare no rows of their own (default 100). A recipe stating its own counts keeps them.
    • --scenario S — named scenario (e.g. nulls, boundary)
    • --pack FILE — load a pack before generating; repeatable. Packs are process-local, so CI must pass them on every run — commit the pack next to the recipe and repeat the flag.
    • --root E — root entity for nested/slice (default first entity)
    • --slice N — extract a referential slice of N root rows

    Examples

    # CSV to stdout, recipe row counts
    node packages/sdk-node/bin/worklens.js generate examples/homepage-demo.wl.json
    
    # JSON file, pinned seed
    node packages/sdk-node/bin/worklens.js generate examples/homepage-demo.wl.json --seed 42 --format json -o data.json
    
    # a referential slice of 20 root rows
    node packages/sdk-node/bin/worklens.js generate examples/whole-company.wl.json --root Customer --slice 20 --format nested
    Not on npm yet
    The package is not published, so npx worklens does not work today. Run the script from a checkout of the repository as node packages/sdk-node/bin/worklens.js; when it is published, the commands are the same with worklens in place of the path.

    Common questions

    Why does --rows not change my row counts?

    --rows is a default, used only for entities that declare no rows of their own. A recipe that states its counts keeps them. Change the recipe if you want different counts for those tables.

    How do I get a small, consistent subset?

    --slice N with --root E pulls N rows of the root entity and every row they reference, so the subset is referentially whole. Useful for a fixture that must stay small.