Initial Setup Wizard
The setup wizard runs automatically when:- You launch the CLI for the first time
- No
.envfile exists - You select “Reconfigure” from the main menu
src/app/screens/SetupScreen.tsx.
Setup Flow
The setup wizard consists of these steps:1. GitHub Token
The wizard first requests your GitHub Personal Access Token:src/app/screens/SetupScreen.tsx:59-62):
- Must start with
ghp_orgithub_pat_ - Cannot be empty
src/app/screens/SetupScreen.tsx:68):
- Validates token with GitHub API
- Retrieves your username
- Shows error if invalid:
"Token validation failed. Check your token and try again."
2. Target Repository
After successful authentication:The wizard pre-fills
{username}/GitHub-Achievements-Manager but you can specify any repository in owner/repo format.
Repository Validation (src/app/screens/SetupScreen.tsx:94-118):
- Verifies
owner/repoformat - Checks repository access permissions
- Tests Discussions availability
- Shows error if inaccessible:
"Could not access repository. Check the name and your permissions."
3. Discussions Check
The wizard automatically checks if Discussions are enabled:4. Helper Account (Optional)
For repositories with Discussions enabled:Choosing “No” skips to configuration save.
5. Helper Token
If you opt in for helper account features:src/app/screens/SetupScreen.tsx:160-168):
- Must be a valid GitHub token format
- Cannot be the same account as main token
- Authenticated separately
"Helper account must be different from your main account""Token validation failed. Check your token and try again."
6. Collaborator Invitation
The wizard checks if the helper account has collaborator access (src/app/screens/SetupScreen.tsx:171-183):
7. Configuration Save
The wizard saves all settings to a.env file:
8. Star Prompt (Optional)
After successful setup:Configuration File
All settings are saved to a.env file in your working directory.
Generated .env Structure
ThecreateEnvFile() function (src/app/screens/SetupScreen.tsx:226-234) creates:
Configuration Parameters
| Parameter | Description | Default | Editable |
|---|---|---|---|
GITHUB_TOKEN | Personal Access Token for main account | Required | Yes (via wizard) |
GITHUB_USERNAME | Your GitHub username | Auto-detected | No |
TARGET_REPO | Repository for achievements (owner/repo) | {username}/GitHub-Achievements-Manager | Yes |
COAUTHOR_NAME | Co-author credit on commits | n0 | No (hardcoded) |
COAUTHOR_EMAIL | Co-author email | [email protected] | No (hardcoded) |
BRANCH_PREFIX | Prefix for achievement branches | achievement | No |
DELAY_MS | Delay between GitHub API calls | 1000 | No |
HELPER_TOKEN | Token for second account (optional) | None | Yes (via wizard) |
Advanced Configuration
TheAppConfig type (src/app/screens/SetupScreen.tsx:97-111) includes additional internal settings not exposed in .env:
Language Configuration
Language preference is stored separately from the.env file.
Language Selection Screen
On first run, before setup:src/app/screens/LanguageScreen.tsx:11-20):
- Displays all supported languages from
LANGUAGESconstant - Shows language flag emoji and native name
- Saves selection using
saveLanguage()function
The language choice is saved separately and persists across:
- Setup wizard runs
- Configuration changes
- Application restarts
Reconfiguration
You can reconfigure at any time by selecting Reconfigure from the main menu.Reconfiguration Process
- Clears cached configuration (
src/app/App.tsx:169) - Re-enters setup wizard
- Allows changing all settings:
- GitHub token
- Target repository
- Helper account
- Overwrites existing
.envfile
Configuration Validation
The CLI validates configuration on every launch (src/app/App.tsx:39-87):
Validation Checks
- Language exists - Shows language screen if not set
.envfile exists - Shows setup wizard if missing- Token is valid - Tests GitHub API authentication
- Repository is accessible - Verifies permissions
- Helper token works - If configured, validates second account
Validation Failures
If validation fails:Configuration Cache
The configuration is cached in memory after loading from.env. The cache is cleared when:
- Reconfiguration is selected
- Validation fails
.envfile is manually deleted