返回 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**: For current Windows Terminal, use Windows 10 2004 (build 19041+) or Windows 11. Older x64 deployments follow the [Windows compatibility target and qualification record](ENVIRONMENTS.md#windows-support-and-release-qualification); the CLI target is 1607, with actual final-release startup/install acceptance still required.
8
9 ---
10
11 ## Pre-install checklist (run once per machine)
12
13 | # | Task | Done? |
14 |---|------|-------|
15 | 1 | Confirm OS, architecture and terminal against the [Windows support table](ENVIRONMENTS.md#windows-support-and-release-qualification). Current Windows Terminal requires build 19041+ or Windows 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 the latest [release](https://github.com/codewhale-hq/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 The NSIS installer contains x64 runtime binaries. For native ARM64 machines, use
27 the matching archive/npm route in [INSTALL.md](INSTALL.md#windows-nsis-installer).
28 Import qualification and ARM64 candidate checks do not replace a clean lab
29 installation or the final 1607 x64 release receipt.
30
31 ### Option A — Silent install (recommended for imaging / SCCM / Intune)
32
33 ```powershell
34 # Run as the target user or via a per-user deployment tool
35 CodeWhaleSetup.exe /S
36 ```
37
38 The silent installer:
39 - Installs to `%LOCALAPPDATA%\Programs\CodeWhale\bin`
40 - Adds the bin directory to the **current user** PATH
41 - Installs `codewhale.bat` and a current-user Start Menu shortcut that prefers Windows Terminal
42 - Registers in Windows "Apps & Features" for uninstall
43
44 ### Option B — Interactive install
45
46 1. Double-click `CodeWhaleSetup.exe`.
47 2. Accept the license.
48 3. Choose the install directory (default is fine for most setups).
49 4. Click **Install**.
50
51 ### Option C — Manual fallback (no installer)
52
53 If the NSIS installer is blocked by group policy, install manually:
54
55 ```powershell
56 # 1. Create directory
57 $binDir = "$env:LOCALAPPDATA\Programs\CodeWhale\bin"
58 New-Item -ItemType Directory -Force -Path $binDir
59
60 # 2. Download binaries (adjust URL to your mirror or release tag)
61 $tag = (Invoke-RestMethod -Uri "https://api.github.com/repos/codewhale-hq/CodeWhale/releases/latest").tag_name
62 Invoke-WebRequest -Uri "https://github.com/codewhale-hq/CodeWhale/releases/download/$tag/codewhale-windows-x64.exe" -OutFile "$binDir\codewhale.exe"
63 Invoke-WebRequest -Uri "https://github.com/codewhale-hq/CodeWhale/releases/download/$tag/codew-windows-x64.exe" -OutFile "$binDir\codew.exe"
64
65 # 3. Add to user PATH (persistent)
66 $currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
67 $pathParts = @($currentPath -split ";" | Where-Object { $_ })
68 if ($pathParts -notcontains $binDir) {
69 $newPath = (@($pathParts) + $binDir) -join ";"
70 [Environment]::SetEnvironmentVariable("Path", $newPath, "User")
71 }
72
73 # 4. Refresh current session PATH
74 $env:Path = [Environment]::GetEnvironmentVariable("Path", "User") + ";" + [Environment]::GetEnvironmentVariable("Path", "Machine")
75 ```
76
77 ---
78
79 ## Post-install verification
80
81 Run these on **each machine** (or spot-check a sample):
82
83 | # | Command | Expected output | Done? |
84 |---|---------|-----------------|-------|
85 | 1 | `codewhale --version` | Prints version string | ☐ |
86 | 2 | `codewhale doctor` | Prints the short offline verdict (what works, what needs attention, the next step); live checks remain not probed | ☐ |
87 | 3 | `codew --version` | Prints the same version string | ☐ |
88
89 If `codewhale` is not found, the user may need to open a **new** terminal window for PATH changes to take effect.
90
91 ## Lab validation checklist
92
93 Run this once on a clean lab machine, and again on a machine that already has a
94 previous Codewhale install:
95
96 | # | Scenario | Expected result | Done? |
97 |---|----------|-----------------|-------|
98 | 1 | Install with no existing Codewhale PATH entry | Adds exactly `%LOCALAPPDATA%\Programs\CodeWhale\bin` | ☐ |
99 | 2 | Install twice | PATH is not duplicated | ☐ |
100 | 3 | Install with a neighboring PATH entry such as `C:\Tools\CodeWhale\bin-extra` | Neighboring entry is preserved | ☐ |
101 | 4 | Upgrade by installing a newer `CodeWhaleSetup.exe` over an older one | Apps & Features version and both `--version` outputs match the new build | ☐ |
102 | 5 | Silent uninstall with `Uninstall.exe /S` | Files, uninstall registry entry, and only the exact installer PATH entry are removed | ☐ |
103
104 ---
105
106 ## API key provisioning
107
108 Each student needs an API key. Options:
109
110 | Method | Pros | Cons |
111 |--------|------|------|
112 | **Per-student key** | Individual usage tracking | More key management |
113 | **Shared lab key** | Simple to deploy | Harder to audit; rate limits shared |
114
115 ### Deploying a shared key via environment variable
116
117 ```powershell
118 # Set for current user (persists across reboots)
119 [Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-...", "User")
120 ```
121
122 Or create a `config.toml` in `%APPDATA%\codewhale\`:
123
124 ```toml
125 [provider]
126 api_key = "sk-..."
127 base_url = "https://api.openai.com/v1"
128 ```
129
130 ### Deploying per-student keys with Intune / GPO
131
132 Use a Group Policy Preference or Intune PowerShell script to set the
133 `OPENAI_API_KEY` environment variable per user. The variable name depends on
134 your LLM provider — see [CONFIGURATION.md](CONFIGURATION.md).
135
136 ---
137
138 ## Uninstall
139
140 ### Silent uninstall
141
142 ```powershell
143 & "$env:LOCALAPPDATA\Programs\CodeWhale\Uninstall.exe" /S
144 ```
145
146 ### Manual uninstall (if installer was not used)
147
148 ```powershell
149 $binDir = "$env:LOCALAPPDATA\Programs\CodeWhale\bin"
150 Remove-Item -Recurse -Force (Split-Path $binDir)
151
152 # Remove from PATH
153 $currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
154 $newPath = ($currentPath -split ";" | Where-Object { $_ -and ($_ -ne $binDir) }) -join ";"
155 [Environment]::SetEnvironmentVariable("Path", $newPath, "User")
156 ```
157
158 ---
159
160 ## Troubleshooting
161
162 | Symptom | Fix |
163 |---------|-----|
164 | `codewhale` not found after install | Open a **new** terminal. If still missing, check PATH: `echo $env:Path` |
165 | Missing `codew` short command | Ensure both `codewhale.exe` and `codew.exe` are in the same directory |
166 | `TLS handshake` errors | Check proxy settings or use the CNB mirror (see [INSTALL.md](INSTALL.md)) |
167 | Antivirus quarantines binaries | Add the install directory to AV exclusions |
168 | `codewhale doctor --full` 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. |
169
170 ---
171
172 ## Imaging / Golden Image Notes
173
174 If building a golden image (WIM/FFU):
175
176 1. Install Codewhale using Option A (silent) or Option C (manual).
177 2. Do **not** set API keys in the image — these are per-user/per-student.
178 3. The install directory (`%LOCALAPPDATA%\Programs\CodeWhale\bin`) is per-user,
179 so it will be present for the user who installed it. For other users on the
180 same machine, run the installer again or use Option C.
181 4. Alternatively, install to a shared location like `C:\Tools\CodeWhale\bin`
182 and add it to the **machine** PATH:
183 ```powershell
184 [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Tools\CodeWhale\bin", "Machine")
185 ```
186
187 ---
188
189 ## Quick Reference: All file paths
190
191 | Item | Default location |
192 |------|-----------------|
193 | Binaries | `%LOCALAPPDATA%\Programs\CodeWhale\bin\` |
194 | User config | `%APPDATA%\codewhale\config.toml` |
195 | Uninstaller | `%LOCALAPPDATA%\Programs\CodeWhale\Uninstall.exe` |
196 | PATH entry | `HKCU\Environment\Path` (current user) |
197
198 ---
199
200 *Last updated: 2026-06-02*
201
201 lines MARKDOWN