SparseTree provides several command-line tools for managing genealogy data.
For FamilySearch commands, you need an access token:
- Log into FamilySearch
- Open browser dev tools (F12)
- Go to Network tab and find any API request
- Copy the Authorization header value (without "Bearer" prefix)
- Tokens last 24+ hours
FS_ACCESS_TOKEN=YOUR_TOKEN npx tsx scripts/index.ts PERSON_ID [options]Options:
| Option | Description |
|---|---|
--max=N |
Limit to N generations |
--ignore=ID1,ID2 |
Skip specific person IDs |
--cache=all|complete|none |
Cache behavior (default: all) |
--oldest=YEAR |
Only include people born after YEAR (supports BC notation) |
--tsv=true |
Also generate TSV file during indexing |
Examples:
# Download 10 generations from a person
FS_ACCESS_TOKEN=$TOKEN npx tsx scripts/index.ts KWZJ-VKB --max=10
# Skip problematic IDs
FS_ACCESS_TOKEN=$TOKEN npx tsx scripts/index.ts KWZJ-VKB --ignore=XXXX-123,YYYY-456
# Only include post-1500 ancestors
FS_ACCESS_TOKEN=$TOKEN npx tsx scripts/index.ts KWZJ-VKB --oldest=1500npx tsx scripts/find.ts ROOT_ID ANCESTOR_ID [options]Options:
| Option | Description |
|---|---|
--method=s |
Shortest path (default) |
--method=l |
Longest path (useful for detecting cycles) |
--method=r |
Random path |
Examples:
# Find shortest path between two people
npx tsx scripts/find.ts KWZJ-VKB 9CNK-KN3
# Detect cyclic loops with longest path
npx tsx scripts/find.ts KWZJ-VKB 9CNK-KN3 --method=lnpx tsx scripts/print.ts DB_ID [--bio]Print all persons sorted by birth date. Use --bio to include biographical text.
npx tsx scripts/purge.ts ID1,ID2,...Remove specific person files from the cache. Use this before re-downloading updated records from FamilySearch.
npx tsx scripts/prune.tsRemove person files that are not part of SQLite database. Useful for cleaning up after changing --max or --ignore settings.
npx tsx scripts/rebuild.ts DB_ID # Rebuild specific database
npx tsx scripts/rebuild.ts --all # Rebuild all databasesRe-extract person data from cached JSON files using the latest schema. Useful after code updates that add new fields.
npx tsx scripts/migrate.ts [options]Options:
| Option | Description |
|---|---|
--dry-run |
Preview changes without applying |
--status |
Check migration status |
--rollback=N |
Rollback last N migrations |
npx tsx scripts/migrate-to-sqlite.ts [options]One-time migration of JSON data to SQLite database.
Options:
| Option | Description |
|---|---|
--dry-run |
Preview without making changes |
--verbose |
Show detailed progress |
npx tsx scripts/migrate-photos-to-blobs.ts [options]Move photos from data/photos/ to content-addressed blob storage.
Options:
| Option | Description |
|---|---|
--dry-run |
Preview without making changes |
--keep-originals |
Don't delete original files |
./update.sh [options]One-command updates: pulls latest code, installs dependencies, builds, runs migrations, and restarts PM2.
Options:
| Option | Description |
|---|---|
--dry-run |
Preview what would happen |
--no-restart |
Don't restart PM2 |
--branch=NAME |
Pull from specific branch |