(input: {
state: WslServersState | undefined
name: string
probingAddable: boolean
})
| 142 | } |
| 143 | |
| 144 | function addServerDistroStatus(input: { |
| 145 | state: WslServersState | undefined |
| 146 | name: string |
| 147 | probingAddable: boolean |
| 148 | }): DistroStatus | undefined { |
| 149 | const installed = input.state?.installed.find((item) => item.name === input.name) |
| 150 | if (installed?.version === 1) return { label: { key: "wsl.onboarding.distroStatus.unsupported" }, tone: "muted" } |
| 151 | const job = input.state?.job |
| 152 | const probe = input.state?.distroProbes[input.name] |
| 153 | if (!probe) { |
| 154 | if (input.probingAddable || (job?.kind === "probe-addable" && job.distros.includes(input.name))) { |
| 155 | return checkingStatus() |
| 156 | } |
| 157 | return |
| 158 | } |
| 159 | if (!probe.canExecute) { |
| 160 | if (!installed) { |
| 161 | return { label: { key: "wsl.onboarding.distroNotInstalled", params: { distro: input.name } }, tone: "warning" } |
| 162 | } |
| 163 | return { label: { key: "wsl.onboarding.openDistroOnce", params: { distro: input.name } }, tone: "warning" } |
| 164 | } |
| 165 | if (!probe.hasBash || !probe.hasCurl) { |
| 166 | return { label: { key: "wsl.onboarding.distroStatus.missingTools" }, tone: "warning" } |
| 167 | } |
| 168 | const check = input.state?.opencodeChecks[input.name] |
| 169 | if (!check) { |
| 170 | if (input.probingAddable || (job?.kind === "probe-addable" && job.distros.includes(input.name))) { |
| 171 | return checkingStatus() |
| 172 | } |
| 173 | return |
| 174 | } |
| 175 | if (check.matchesDesktop === false) return { label: { key: "wsl.onboarding.updateOpencode" }, tone: "warning" } |
| 176 | if (!check.resolvedPath) return { label: { key: "wsl.onboarding.distroStatus.opencodeMissing" }, tone: "warning" } |
| 177 | if (check.error) return { label: { key: "wsl.onboarding.installOpencode" }, tone: "warning" } |
| 178 | return { label: { key: "wsl.onboarding.distroStatus.ready" }, tone: "success" } |
| 179 | } |
| 180 | |
| 181 | function checkingStatus(): DistroStatus { |
| 182 | return { label: { key: "wsl.onboarding.distroStatus.checking" }, tone: "muted" } |
no test coverage detected