Database Storage
File-Based Database
The CLI uses JSON files instead of SQLite for cross-platform compatibility:What Gets Tracked
The database stores:-
Achievement Records
- Achievement ID and name
- Target tier level
- Target operation count
- Completed operation count
- Current status (pending, in_progress, completed, failed)
- Created and updated timestamps
-
Operation Records
- Operation type (PR, commit, issue, discussion)
- Operation number (1, 2, 3, …)
- Status (pending, in_progress, completed, failed)
- GitHub resource IDs (PR number, branch name, commit SHA)
- Created and updated timestamps
The database is automatically initialized when you first run an achievement and saved after every operation completes.
Viewing Status
You can view the status of all achievements at any time:Progress Bar Details
The progress bar shows:- Filled portion: Completed operations
- Empty portion: Remaining operations
- Numbers:
completed/totaloperations
Resume Capability
One of the CLI’s most powerful features is its ability to resume interrupted runs.How Resume Works
Automatic State Management
Automatic State Management
The CLI tracks each operation’s state:
- Pending: Not yet started
- In Progress: Currently running
- Completed: Successfully finished
- Failed: Encountered an error
Stuck Operation Detection
Stuck Operation Detection
If the CLI exits unexpectedly, some operations may remain in the “in_progress” state. On the next run, these are automatically detected and reset to “pending” so they can be retried.From
src/db/database.ts:352:Operation Deduplication
Operation Deduplication
The CLI never re-runs completed operations. It queries the database for completed operation numbers and skips them:From
src/achievements/base.ts:116:Resuming After Interruption
To resume after interrupting execution:Run the same achievement again
Select Run Achievements and choose the same achievement and tier you were working on.
Understanding Operation States
The database tracks four states for each operation:Pending
Status: Operation not yet startedAction: Will be executed when the achievement runs
In Progress
Status: Operation currently runningAction: If the CLI exits, this will be reset to “pending” on next run
Duration: Temporary state, only while the operation is active
Completed
Status: Operation finished successfullyAction: Will be skipped on future runs
Data Stored:
- PR number (for PR-based achievements)
- Branch name
- Commit SHA
- Issue/discussion IDs
Failed
Status: Operation encountered an errorAction: Can be retried by running the achievement again
Data Stored: Error message (if available)
Database Operations
Per-User Isolation
Each GitHub account has its own database file:- Switch between accounts without losing progress
- Track achievements for multiple accounts simultaneously
- Keep progress separate and organized
src/db/database.ts:28:
Automatic Saving
The database is saved automatically:- After creating or updating an achievement record
- After creating or updating an operation record
- When closing the database (on CLI exit)
Database Structure
The JSON file contains:Troubleshooting Database Issues
Database Not Found
If you see “No achievements started yet” in the status view:- This is normal if you haven’t run any achievements yet
- Run an achievement first, then check status
Corrupted Database
If the database file becomes corrupted:Progress Not Saving
If progress doesn’t seem to be saved:- Check file permissions: Ensure the CLI can write to the project directory
- Check disk space: Ensure you have enough disk space
- Check for errors: Look for database errors in the CLI output
- Force save: The database is saved on clean exit (not Ctrl+C during operation)
src/db/database.ts:84: