First Sync
Authentication
Section titled “Authentication”The module uses the gh CLI for all GitHub API calls. You need to authenticate once:
gh auth loginFollow the interactive prompts. You can verify your authentication status:
gh auth statusRunning your first sync
Section titled “Running your first sync”stars syncOn first run, this performs a full sync — fetching every starred repository from your account. The module:
- Detects this is the first sync (no
last_synced_atmetadata exists) - Requests pages of 100 stars each using
application/vnd.github.star+jsonforstarred_attimestamps - Normalizes each repo to the internal schema
- Stores everything in
$XDG_DATA_HOME/.stars/stars.db - Records the sync timestamp in the
sync_metadatatable
Understanding the output
Section titled “Understanding the output”Full sync from GitHub...Full sync complete: 1247 starsFor 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 dateFull vs. incremental sync
Section titled “Full vs. incremental sync”| Mode | When | What happens |
|---|---|---|
| Full | First run, --full flag, or auto-escalation | Fetches all stars, replaces database |
| Incremental | Subsequent 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_daysago (default: 7 days)
Syncing a specific user
Section titled “Syncing a specific user”You can sync stars for any public GitHub user:
stars sync github --user octocatCache control
Section titled “Cache control”By default, gh api caching is enabled with a 1-hour TTL. To bypass the cache:
stars sync --no-cacheCreating backups
Section titled “Creating backups”Create a backup before syncing:
stars sync --backupThis copies the current database to $XDG_DATA_HOME/.stars/backups/stars_YYYYMMDD_HHMMSS.db before any changes are made.