CLI (Node and Bun)
Use the CLI for local scripting, CI steps, and one-off batch generation.
When To Use This
- You want command-line generation from text specs.
- You want output to stdout or a file in scripts.
Node/npm CLI
Global install:
npm install -g @anywaydata/cli
Run without installing:
npx @anywaydata/cli --help
Common examples:
anywaydata --help
anywaydata generate -i input.txt -n 10 -f csv
anywaydata generate -i input.txt -n 10 -f json -o output.json
anywaydata generate -i input.txt -n 10 -f markdown -t
anywaydata amend --schema-file schema.txt --data-file input.csv --input-format csv -f json -o amended.json
Parameter guide for the examples:
generate: run the data generation command.-i, --inputfile: path to the schema/input text file.-n, --numberOfLines: number of rows to generate.-f, --format: output format (for examplecsv,json,markdown,sql).-o, --outputfile: optional output file path. If omitted, output is written to stdout.-t, --testMode: generate one row and print diagnostics for troubleshooting.--show-progress: explicitly control progress logs (for example--show-progress trueor--show-progress false).--stream: enable streaming generation when supported (csv,jsonl,dsv,json,xml).--stream-threshold: auto-enable streaming whenrowCount >= thresholdand--outputfileis set (default5000).--unsafe-faker-expressions: opt-in to expression-style faker arguments (unsafe for untrusted input).--help: show CLI usage and options.amend --schema-file --data-file --input-format: import input data and amend it with schema rules.
Schema Formatting
Schema text supports:
- Comments: lines starting with
#(after optional leading whitespace) are treated as comments. - Blank lines: allowed and ignored, useful for readability between column groups.
- Column definitions: each column name must be followed by its generation rule on the next logical content line.
Behavior Notes
--testModealways forces generation to a single row (rowCount = 1) and prints diagnostic/example output.- Progress output defaults to:
- on for stdout mode (no
--outputfile) - on for
--testMode - off for file output unless
--show-progress trueis provided
- on for stdout mode (no
- Streaming is currently implemented for
csv,jsonl,dsv,json, andxmlexports. Other formats use buffered generation. - JSON stream mode emits a valid JSON array payload.
- If a stream mode cannot honor some format options, generation continues and warnings are reported.
amendalways uses buffered generation; stream flags are ignored for this command.- Auto-streaming (
--stream-threshold) applies only when writing to a file. For stdout workflows, use--streamexplicitly. - For
amend, if-n/--numberOfLinesis omitted, all imported rows are amended. - For
amend, if-n/--numberOfLinesis smaller than imported rows, only the firstNrows are amended and full output is still returned.
Amend Examples
CSV input to tab-delimited output:
anywaydata amend \
--schema-file schema.txt \
--data-file input.csv \
--input-format csv \
-f dsv
Tab-delimited input to CSV output file:
anywaydata amend \
--schema-file schema.txt \
--data-file input.dsv \
--input-format dsv \
-f csv \
-o amended.csv
Amend only first two rows:
anywaydata amend \
--schema-file schema.txt \
--data-file input.csv \
--input-format csv \
-n 2 \
-f json
Example input.txt schema file:
# identity fields
Name
person.fullName
# contact details
Email
internet.email
# historical date
JoinedOn
date.past
This input format is the same schema format used in the Generating Data docs:
- Generating Data
- GitHub CLI examples: https://github.com/eviltester/grid-table-editor/tree/master/apps/cli/examples
Bun CLI
From the repo root of grid-table-editor, you can run the Bun CLI entrypoint in apps/cli.
bun run apps/cli/src/bun-entry.js --help
bun run apps/cli/src/bun-entry.js generate -i input.txt -n 10 -f csv
bun run apps/cli/src/bun-entry.js generate -i input.txt -n 100000 -f jsonl -o output.jsonl --stream
If your environment uses a Bun-built binary/workflow, follow the same argument pattern.
Safe Faker Expressions
Node and Bun CLIs are safe-by-default for faker arguments.
To allow expression-style faker arguments, opt in explicitly:
anywaydata generate -i input.txt -n 10 -f csv --unsafe-faker-expressions