Seedmancer CLI Documentation
A CLI tool to manage and reset database test data. Export database snapshots as CSV, seed them back on demand, fetch from the cloud, and generate realistic data with AI.
Overview
Seedmancer helps developers reset databases to a known state instantly. It stores test data as plain CSV files versioned by name, making it easy to check in, share, and restore across machines and CI pipelines.
Fast Database Reset
Restore your database to any saved version in seconds.
Test Data Versioning
Save and manage multiple named test data versions locally and in the cloud.
AI-Powered Generation
Generate realistic seed data from a natural language prompt using OpenAI.
Cloud Sync
Fetch pre-built versions from Seedmancer cloud with a single command.
Installation
Download the pre-built binary for your platform from GitHub Releases.
Linux (arm64)
curl -L https://github.com/KazanKK/seedmancer/releases/download/v0.1.0/seedmancer_Linux_arm64 -o seedmancer
chmod +x seedmancer
mv seedmancer /usr/local/bin/seedmancerLinux (x86_64)
curl -L https://github.com/KazanKK/seedmancer/releases/download/v0.1.0/seedmancer_Linux_x86_64 -o seedmancer
chmod +x seedmancer
mv seedmancer /usr/local/bin/seedmancermacOS (arm64)
curl -L https://github.com/KazanKK/seedmancer/releases/download/v0.1.0/seedmancer_Darwin_arm64 -o seedmancer
chmod +x seedmancer
sudo mv seedmancer /usr/local/bin/seedmancerQuick Start
Get up and running in three commands.
Initialize project
seedmancer initCreates seedmancer.yaml and the storage directory in your project root.
Export database snapshot
seedmancer export \
--database-name mydb \
--version-name baseline \
--db-url "postgres://user:pass@localhost:5432/mydb"Saves schema.json and one CSV per table under .seedmancer/databases/mydb/baseline/.
Restore to that snapshot
seedmancer seed \
--database-name mydb \
--version-name baseline \
--db-url "postgres://user:pass@localhost:5432/mydb"Wipes existing data and reloads from the exported CSV files.
Configuration File
Seedmancer reads seedmancer.yaml from your project root. All flag values can be set here so you don't need to repeat them on every command.
storage_path: .seedmancer
database_name: mydb
database_url: postgres://user:pass@localhost:5432/mydb| Key | Description | Default |
|---|---|---|
| storage_path | Directory where exported data is stored | .seedmancer |
| database_name | Default database name used by export / seed / generate | — |
| database_url | PostgreSQL connection URL | — |
seedmancer init
Initialize a new Seedmancer project. Creates seedmancer.yaml and the storage directory. When run interactively in a terminal, prompts for each value. Existing values in seedmancer.yaml are used as defaults.
| Flag | Description | Required | Env / Default |
|---|---|---|---|
| --storage-path | Directory to store exported data files | No | (prompted) |
| --database-name | Default database name for export / seed commands | No | (prompted) |
| --database-url | Default PostgreSQL connection URL | No | (prompted) |
Example
seedmancer init
# Non-interactive (CI)
seedmancer init \
--storage-path .seedmancer \
--database-name mydb \
--database-url "postgres://user:pass@localhost:5432/mydb"seedmancer export
Export the current database schema and data to local CSV files. Creates schema.json (table definitions) and one .csv file per table inside the version directory.
| Flag | Description | Required | Env / Default |
|---|---|---|---|
| --database-name | Logical name for this database (used as directory name) | Yes | — |
| --version-name | Version label for this snapshot | No | unversioned |
| --db-url | PostgreSQL connection URL | No | SEEDMANCER_DATABASE_URL |
Example
seedmancer export \
--database-name mydb \
--version-name baseline \
--db-url "postgres://user:pass@localhost:5432/mydb"
# Output: .seedmancer/databases/mydb/baseline/
# schema.json
# users.csv
# orders.csv
# ...- You can directly edit the exported CSV files to adjust test data.
- Do not manually edit schema.json — it is read by the seed command to recreate the correct structure.
- --db-url falls back to database_url in seedmancer.yaml when omitted.
seedmancer seed
Restore the database to a previously exported version. Drops existing data in each table and reloads it from the saved CSV files in the version directory.
| Flag | Description | Required | Env / Default |
|---|---|---|---|
| --database-name | Name of the database (matches the export directory) | Yes | — |
| --version-name | Version to restore | Yes | — |
| --db-url | PostgreSQL connection URL | No | SEEDMANCER_DATABASE_URL |
Example
seedmancer seed \
--database-name mydb \
--version-name baseline \
--db-url "postgres://user:pass@localhost:5432/mydb"
# CI / Docker Compose (env var)
export SEEDMANCER_DATABASE_URL="postgres://user:pass@db:5432/mydb"
seedmancer seed --database-name mydb --version-name baseline- Only PostgreSQL is supported in this release.
- The seed command reads from .seedmancer/databases/<database-name>/<version-name>/.
seedmancer list
List all available databases and test data versions. By default shows both local (on disk) and remote (cloud) versions. Use --local or --remote to filter.
| Flag | Description | Required | Env / Default |
|---|---|---|---|
| --local | Show only local databases and versions | No | false |
| --remote | Show only remote (cloud) databases and versions | No | false |
| --token | Seedmancer API token (required for remote listing) | No | SEEDMANCER_API_TOKEN |
Example
# List both local and remote
seedmancer list --token <your-api-token>
# Local only
seedmancer list --local
# Remote only
export SEEDMANCER_API_TOKEN=<your-api-token>
seedmancer list --remoteseedmancer fetch
Download a database schema and test data version from the Seedmancer cloud API and extract it into your local storage directory. Replaces any existing local version with the same name.
| Flag | Description | Required | Env / Default |
|---|---|---|---|
| --database-name | Database name to fetch (must match the cloud database name) | Yes | — |
| --version | Version name to fetch | Yes | — |
| --token | Seedmancer API token | Yes | SEEDMANCER_API_TOKEN |
Example
seedmancer fetch \
--database-name mydb \
--version baseline \
--token <your-api-token>
# Using environment variable
export SEEDMANCER_API_TOKEN=<your-api-token>
seedmancer fetch --database-name mydb --version baseline- After fetching, run seedmancer seed to apply the downloaded version to your database.
- Fetched files are saved under .seedmancer/databases/<database-name>/<version>/.
seedmancer generate
Generate realistic seed data from a natural language prompt using OpenAI. Reads the live database schema, asks GPT-4o to produce a Go script, runs it, and saves the output as CSV files ready to be seeded.
| Flag | Description | Required | Env / Default |
|---|---|---|---|
| --prompt | Natural language description of the data to generate | Yes | — |
| --api-key | OpenAI API key (persisted to ~/.seedmancer/config.yaml for future use) | No | OPENAI_API_KEY |
| --db-url | PostgreSQL connection URL to read the schema from | No | SEEDMANCER_DATABASE_URL |
| --database-name | Logical database name (overrides database_name in seedmancer.yaml) | No | — |
| --version-name | Version label for the generated data | No | YYYYMMDDHHMMSS_<db> |
Example
seedmancer generate \
--prompt "50 users with realistic names and emails, 200 orders each with a random user" \
--api-key sk-... \
--db-url "postgres://user:pass@localhost:5432/mydb" \
--database-name mydb \
--version-name ai-generated
# Then seed it
seedmancer seed --database-name mydb --version-name ai-generated- Requires Go to be installed on the machine — the generated script is executed with go run.
- The OpenAI API key is persisted to ~/.seedmancer/config.yaml after the first use, so --api-key is only needed once.
- Only PostgreSQL is supported for schema export in this release.
- Generated data is deterministic: the script uses math/rand seeded with 42.
Environment Variables
All sensitive values can be provided as environment variables instead of flags. Environment variables take lower priority than explicit flags.
| Variable | Equivalent Flag | Used by |
|---|---|---|
| SEEDMANCER_DATABASE_URL | --db-url | export, seed, generate |
| SEEDMANCER_API_TOKEN | --token | list, fetch |
| OPENAI_API_KEY | --api-key | generate |
export SEEDMANCER_DATABASE_URL="postgres://user:pass@localhost:5432/mydb"
export SEEDMANCER_API_TOKEN="your-api-token"
export OPENAI_API_KEY="sk-..."
seedmancer export --database-name mydb --version-name v1
seedmancer seed --database-name mydb --version-name v1
seedmancer fetch --database-name mydb --version v1
seedmancer list --remote