Skip to content

Commit 6351f1f

Browse files
authored
Merge pull request #26 from VectorInstitute/add_cli_docs
Add docs for the onboarding CLI tool
2 parents 08c0cbd + ed80690 commit 6351f1f

File tree

2 files changed

+193
-0
lines changed

2 files changed

+193
-0
lines changed

docs/cli.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# CLI Reference
2+
3+
The `aieng-platform-onboard` package provides a command-line tool for bootcamp participant onboarding, authentication, and environment setup.
4+
5+
## Installation
6+
7+
```bash
8+
pip install aieng-platform-onboard
9+
```
10+
11+
## Commands
12+
13+
### `onboard`
14+
15+
Main command for onboarding bootcamp participants with team-specific API keys.
16+
17+
#### Usage
18+
19+
```bash
20+
onboard [OPTIONS]
21+
```
22+
23+
#### Participant Onboarding
24+
25+
Standard onboarding flow for bootcamp participants:
26+
27+
```bash
28+
onboard \
29+
--bootcamp-name fall-2025 \
30+
--gcp-project coderd \
31+
--test-script tests/integration/test_api_keys.py \
32+
--output-dir .
33+
```
34+
35+
#### Admin Status Report
36+
37+
View onboarding status for all participants (requires admin credentials):
38+
39+
```bash
40+
onboard --admin-status-report --gcp-project coderd
41+
```
42+
43+
## Options
44+
45+
### Required (for participant onboarding)
46+
47+
| Option | Description | Example |
48+
|--------|-------------|---------|
49+
| `--bootcamp-name` | Name of the bootcamp | `--bootcamp-name fall-2025` |
50+
| `--test-script` | Path to integration test script | `--test-script tests/integration/test_api_keys.py` |
51+
52+
### Optional
53+
54+
| Option | Description | Default |
55+
|--------|-------------|---------|
56+
| `--gcp-project` | GCP project ID | `coderd` |
57+
| `--output-dir` | Directory for .env file | `.` (current directory) |
58+
| `--firebase-api-key` | Firebase Web API key for token exchange | (from `FIREBASE_WEB_API_KEY` env var) |
59+
| `--skip-test` | Skip integration tests | `False` |
60+
| `--force` | Force re-onboarding even if already onboarded | `False` |
61+
| `--admin-status-report` | Display onboarding status for all participants (admin only) | `False` |
62+
| `--version` | Show version number and exit | - |
63+
64+
## Onboarding Process
65+
66+
The participant onboarding flow consists of 9 steps:
67+
68+
1. **Identify Participant** - Detects GitHub username from environment
69+
2. **Fetch Authentication Token** - Retrieves fresh token from service
70+
3. **Connect to Firestore** - Initializes secure Firestore connection
71+
4. **Fetch Your Profile** - Reads participant data and team assignment
72+
5. **Fetch Team API Keys** - Retrieves team-specific API keys
73+
6. **Fetch Global Configuration** - Fetches shared configuration keys
74+
7. **Create Environment File** - Generates .env file with all keys
75+
8. **Run Integration Test** - Validates API keys (optional)
76+
9. **Mark as Onboarded** - Updates participant status in Firestore
77+
78+
## Environment Variables
79+
80+
The following environment variables are used:
81+
82+
| Variable | Description | Required |
83+
|----------|-------------|----------|
84+
| `GITHUB_USER` | GitHub username for authentication | Yes |
85+
| `FIREBASE_WEB_API_KEY` | Firebase Web API key (can be passed via `--firebase-api-key`) | Yes |
86+
| `GOOGLE_APPLICATION_CREDENTIALS` | Path to GCP service account key (admin only) | For `--admin-status-report` |
87+
88+
## Exit Codes
89+
90+
| Code | Description |
91+
|------|-------------|
92+
| `0` | Success |
93+
| `1` | Failure (authentication, connection, or configuration error) |
94+
95+
## Examples
96+
97+
### Basic Onboarding
98+
99+
```bash
100+
export GITHUB_USER=myusername
101+
onboard \
102+
--bootcamp-name fall-2025 \
103+
--test-script tests/integration/test_api_keys.py
104+
```
105+
106+
### Skip Integration Tests
107+
108+
```bash
109+
onboard \
110+
--bootcamp-name fall-2025 \
111+
--test-script tests/integration/test_api_keys.py \
112+
--skip-test
113+
```
114+
115+
### Force Re-onboarding
116+
117+
```bash
118+
onboard \
119+
--bootcamp-name fall-2025 \
120+
--test-script tests/integration/test_api_keys.py \
121+
--force
122+
```
123+
124+
### Custom Output Directory
125+
126+
```bash
127+
onboard \
128+
--bootcamp-name fall-2025 \
129+
--test-script tests/integration/test_api_keys.py \
130+
--output-dir ~/my-bootcamp
131+
```
132+
133+
### Admin Status Report
134+
135+
```bash
136+
# Requires admin credentials (service account or gcloud auth)
137+
gcloud auth application-default login
138+
onboard --admin-status-report --gcp-project coderd
139+
```
140+
141+
## Generated Files
142+
143+
### .env File
144+
145+
The onboarding process creates a `.env` file containing:
146+
147+
- Team-specific API keys (OpenAI/Gemini, Langfuse)
148+
- Global shared configuration
149+
- Bootcamp-specific settings
150+
151+
**Location:** Specified by `--output-dir` (default: current directory)
152+
153+
**Usage:**
154+
```bash
155+
source .env
156+
```
157+
158+
## Troubleshooting
159+
160+
### Authentication Failures
161+
162+
- Ensure `GITHUB_USER` environment variable is set
163+
- Verify you're added to the participant list (contact admin)
164+
- Check token service is deployed and accessible
165+
166+
### Connection Failures
167+
168+
- Verify GCP project ID is correct
169+
- Check Firebase Web API key is valid
170+
- Ensure Firestore security rules allow participant access
171+
172+
### Integration Test Failures
173+
174+
- Check that .env file was created successfully
175+
- Verify API keys are valid (contact admin if needed)
176+
- Use `--skip-test` to bypass tests if keys need manual verification
177+
178+
### Admin Command Failures
179+
180+
- Ensure you're authenticated with proper GCP permissions:
181+
```bash
182+
gcloud auth application-default login
183+
```
184+
- Or set `GOOGLE_APPLICATION_CREDENTIALS` to service account key path
185+
- Verify you have Firestore read access for the project
186+
187+
## Support
188+
189+
For issues or questions:
190+
- Contact your bootcamp administrator
191+
- Check existing .env file: `cat .env`
192+
- Re-run with `--force` to regenerate configuration

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ markdown_extensions:
2727
nav:
2828
- Home: index.md
2929
- User Guide: user_guide.md
30+
- CLI: cli.md
3031
plugins:
3132
- search
3233
- mkdocstrings:

0 commit comments

Comments
 (0)