返回 CodeWhale
CLASSROOM_INSTALL.md
根目录 / docs / CLASSROOM_INSTALL.md
1 # Codewhale Classroom / Lab Install Checklist
2
3 A step-by-step checklist for IT admins deploying Codewhale on lab or classroom
4 machines running Windows.
5
6 > **Audience**: IT staff, teaching assistants, lab managers.
7 > **Prereq**: Each target machine runs Windows 10 (1809+) or Windows 11.
8
9 ---
10
11 ## Pre-install checklist (run once per machine)
12
13 | # | Task | Done? |
14 |---|------|-------|
15 | 1 | Confirm Windows version: `winver` → 10 build 17763+ or 11 | ☐ |
16 | 2 | Ensure the user account is a **standard user** (not a local admin). The installer does not require elevation. | ☐ |
17 | 3 | Verify outbound HTTPS (port 443) is open to `api.openai.com` (or whichever LLM provider the course uses). | ☐ |
18 | 4 | Obtain the installer: download `CodeWhaleSetup.exe` from a v0.8.50+ [release](https://github.com/Hmbown/CodeWhale/releases/latest) or from your department mirror. | ☐ |
19 | 5 | Verify SHA-256 hash against `codewhale-artifacts-sha256.txt` before deploying. | ☐ |
20 | 6 | Note that the public installer is currently unsigned and may trigger Windows SmartScreen unless your organization signs it before deployment. | ☐ |
21
22 ---
23
24 ## Installation
25
26 ### Option A — Silent install (recommended for imaging / SCCM / Intune)
27
28 ```powershell
29 # Run as the target user or via a per-user deployment tool
30 CodeWhaleSetup.exe /S
31 ```
32
33 The silent installer:
34 - Installs to `%LOCALAPPDATA%\Programs\CodeWhale\bin`
35 - Adds the bin directory to the **current user** PATH
36 - Installs `codewhale.bat` and a current-user Start Menu shortcut that prefers Windows Terminal
37 - Registers in Windows "Apps & Features" for uninstall
38
39 ### Option B — Interactive install
40
41 1. Double-click `CodeWhaleSetup.exe`.
42 2. Accept the license.
43 3. Choose the install directory (default is fine for most setups).
44 4. Click **Install**.
45
46 ### Option C — Manual fallback (no installer)
47
48 If the NSIS installer is blocked by group policy, install manually:
49
50 ```powershell
51 # 1. Create directory
52 $binDir = "$env:LOCALAPPDATA\Programs\CodeWhale\bin"
53 New-Item -ItemType Directory -Force -Path $binDir
54
55 # 2. Download binaries (adjust URL to your mirror or release tag)
56 $tag = (Invoke-RestMethod -Uri "https://api.github.com/repos/Hmbown/CodeWhale/releases/latest").tag_name
57 Invoke-WebRequest -Uri "https://github.com/Hmbown/CodeWhale/releases/download/$tag/codewhale-windows-x64.exe" -OutFile "$binDir\codewhale.exe"
58 Invoke-WebRequest -Uri "https://github.com/Hmbown/CodeWhale/releases/download/$tag/codew-windows-x64.exe" -OutFile "$binDir\codew.exe"
59
60 # 3. Add to user PATH (persistent)
61 $currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
62 $pathParts = @($currentPath -split ";" | Where-Object { $_ })
63 if ($pathParts -notcontains $binDir) {
64 $newPath = (@($pathParts) + $binDir) -join ";"
65 [Environment]::SetEnvironmentVariable("Path", $newPath, "User")
66 }
67
68 # 4. Refresh current session PATH
69 $env:Path = [Environment]::GetEnvironmentVariable("Path", "User") + ";" + [Environment]::GetEnvironmentVariable("Path", "Machine")
70 ```
71
72 ---
73
74 ## Post-install verification
75
76 Run these on **each machine** (or spot-check a sample):
77
78 | # | Command | Expected output | Done? |
79 |---|---------|-----------------|-------|
80 | 1 | `codewhale --version` | Prints version string | ☐ |
81 | 2 | `codewhale doctor` | Prints the offline structural report; live checks remain not probed | ☐ |
82 | 3 | `codew --version` | Prints the same version string | ☐ |
83
84 If `codewhale` is not found, the user may need to open a **new** terminal window for PATH changes to take effect.
85
86 ## Lab validation checklist
87
88 Run this once on a clean lab machine, and again on a machine that already has a
89 previous Codewhale install:
90
91 | # | Scenario | Expected result | Done? |
92 |---|----------|-----------------|-------|
93 | 1 | Install with no existing Codewhale PATH entry | Adds exactly `%LOCALAPPDATA%\Programs\CodeWhale\bin` | ☐ |
94 | 2 | Install twice | PATH is not duplicated | ☐ |
95 | 3 | Install with a neighboring PATH entry such as `C:\Tools\CodeWhale\bin-extra` | Neighboring entry is preserved | ☐ |
96 | 4 | Upgrade by installing a newer `CodeWhaleSetup.exe` over an older one | Apps & Features version and both `--version` outputs match the new build | ☐ |
97 | 5 | Silent uninstall with `Uninstall.exe /S` | Files, uninstall registry entry, and only the exact installer PATH entry are removed | ☐ |
98
99 ---
100
101 ## API key provisioning
102
103 Each student needs an API key. Options:
104
105 | Method | Pros | Cons |
106 |--------|------|------|
107 | **Per-student key** | Individual usage tracking | More key management |
108 | **Shared lab key** | Simple to deploy | Harder to audit; rate limits shared |
109
110 ### Deploying a shared key via environment variable
111
112 ```powershell
113 # Set for current user (persists across reboots)
114 [Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-...", "User")
115 ```
116
117 Or create a `config.toml` in `%APPDATA%\codewhale\`:
118
119 ```toml
120 [provider]
121 api_key = "sk-..."
122 base_url = "https://api.openai.com/v1"
123 ```
124
125 ### Deploying per-student keys with Intune / GPO
126
127 Use a Group Policy Preference or Intune PowerShell script to set the
128 `OPENAI_API_KEY` environment variable per user. The variable name depends on
129 your LLM provider — see [CONFIGURATION.md](CONFIGURATION.md).
130
131 ---
132
133 ## Uninstall
134
135 ### Silent uninstall
136
137 ```powershell
138 & "$env:LOCALAPPDATA\Programs\CodeWhale\Uninstall.exe" /S
139 ```
140
141 ### Manual uninstall (if installer was not used)
142
143 ```powershell
144 $binDir = "$env:LOCALAPPDATA\Programs\CodeWhale\bin"
145 Remove-Item -Recurse -Force (Split-Path $binDir)
146
147 # Remove from PATH
148 $currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
149 $newPath = ($currentPath -split ";" | Where-Object { $_ -and ($_ -ne $binDir) }) -join ";"
150 [Environment]::SetEnvironmentVariable("Path", $newPath, "User")
151 ```
152
153 ---
154
155 ## Troubleshooting
156
157 | Symptom | Fix |
158 |---------|-----|
159 | `codewhale` not found after install | Open a **new** terminal. If still missing, check PATH: `echo $env:Path` |
160 | Missing `codew` short command | Ensure both `codewhale.exe` and `codew.exe` are in the same directory |
161 | `TLS handshake` errors | Check proxy settings or use the CNB mirror (see [INSTALL.md](INSTALL.md)) |
162 | Antivirus quarantines binaries | Add the install directory to AV exclusions |
163 | `codewhale doctor` reports credential availability as `unknown`/`not_probed`/`unavailable` | This is the safe offline result. A declared environment, external-auth, OAuth, consent, or secret-store source is not proof of availability and does not certify Setup/Fleet readiness. `unavailable` means the route declared the legacy store sentinel but is not allowed to use that shared store. Use `codewhale doctor --probe-api` only on an approved connected machine when a live check is required. |
164
165 ---
166
167 ## Imaging / Golden Image Notes
168
169 If building a golden image (WIM/FFU):
170
171 1. Install Codewhale using Option A (silent) or Option C (manual).
172 2. Do **not** set API keys in the image — these are per-user/per-student.
173 3. The install directory (`%LOCALAPPDATA%\Programs\CodeWhale\bin`) is per-user,
174 so it will be present for the user who installed it. For other users on the
175 same machine, run the installer again or use Option C.
176 4. Alternatively, install to a shared location like `C:\Tools\CodeWhale\bin`
177 and add it to the **machine** PATH:
178 ```powershell
179 [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Tools\CodeWhale\bin", "Machine")
180 ```
181
182 ---
183
184 ## Quick Reference: All file paths
185
186 | Item | Default location |
187 |------|-----------------|
188 | Binaries | `%LOCALAPPDATA%\Programs\CodeWhale\bin\` |
189 | User config | `%APPDATA%\codewhale\config.toml` |
190 | Uninstaller | `%LOCALAPPDATA%\Programs\CodeWhale\Uninstall.exe` |
191 | PATH entry | `HKCU\Environment\Path` (current user) |
192
193 ---
194
195 *Last updated: 2026-06-02*
196
196 lines MARKDOWN