Skip to content

First Sync

The module uses the gh CLI for all GitHub API calls. You need to authenticate once:

Terminal window
gh auth login

Follow the interactive prompts. You can verify your authentication status:

Terminal window
gh auth status
Terminal window
stars sync

On first run, this performs a full sync — fetching every starred repository from your account. The module:

  1. Detects this is the first sync (no last_synced_at metadata exists)
  2. Requests pages of 100 stars each using application/vnd.github.star+json for starred_at timestamps
  3. Normalizes each repo to the internal schema
  4. Stores everything in $XDG_DATA_HOME/.stars/stars.db
  5. Records the sync timestamp in the sync_metadata table
Full sync from GitHub...
Full sync complete: 1247 stars

For incremental syncs (subsequent runs):

Incremental sync from GitHub...
Synced 3 new/updated stars (1250 total)

Or if nothing has changed:

Incremental sync from GitHub...
Already up to date
ModeWhenWhat happens
FullFirst run, --full flag, or auto-escalationFetches all stars, replaces database
IncrementalSubsequent runs (default)Fetches only stars newer than last_synced_at, upserts into database

Auto-escalation to full sync happens when:

  • No previous sync exists
  • The last full sync was more than full_sync_interval_days ago (default: 7 days)

You can sync stars for any public GitHub user:

Terminal window
stars sync github --user octocat

By default, gh api caching is enabled with a 1-hour TTL. To bypass the cache:

Terminal window
stars sync --no-cache

Create a backup before syncing:

Terminal window
stars sync --backup

This copies the current database to $XDG_DATA_HOME/.stars/backups/stars_YYYYMMDD_HHMMSS.db before any changes are made.