# 0.8.6 g3 / r5 下载安装命令 从官网复制适合本机的完整代码块。命令下载完整平台包、校验大小和 SHA-256、解压并检查版本;成功后当前终端可输入 `koder`。无需管理员权限,Node 已随平台包附带。Windows 包要求 x64 PowerShell;Mac 自动选择 Apple Silicon / Intel,最低 macOS 13.5。 更新时先保存自己的配置、记忆和项目。此通用命令不扫描或删除其他安装;本机只保留一个版本时,须先核实旧安装归属并按 INSTALL.md 执行替换。不同目录的配置不能直接合并。新终端的 `koder` 激活方法会在成功安装后显示。 Copy the entire block for your OS. It verifies the full archive before extraction, checks startup, removes the downloaded installer archive after success, and activates `koder` in this terminal. Existing installations are not automatically removed. Native Windows and Intel Mac acceptance remains pending staff testing; see PUBLIC-VALIDATION.md. ## Windows x64 PowerShell ```powershell # Paste this complete block into Windows x64 PowerShell. # The koder alias belongs to this PowerShell session; existing installations are retained. & { function Assert-KoderStartup { param($Entry) $PSNativeCommandUseErrorActionPreference = $false if (-not (Test-Path -LiteralPath $Entry -PathType Leaf)) { throw 'Startup entry is missing.' } $ErrorActionPreference = 'Continue' $global:LASTEXITCODE = $null & $Entry --version if ($null -eq $global:LASTEXITCODE -or $global:LASTEXITCODE -ne 0) { throw 'Startup check failed; the koder alias was not changed.' } } function Save-KoderArchive { param($Uri,$OutFile,[long]$ExpectedBytes,$ExpectedSha) $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' if (Test-Path -LiteralPath $OutFile) { throw 'Download destination already exists.' } $previousProtocol = [Net.ServicePointManager]::SecurityProtocol try { [Net.ServicePointManager]::SecurityProtocol = $previousProtocol -bor [Net.SecurityProtocolType]::Tls12 for ($attempt = 1; $attempt -le 3; $attempt++) { try { Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $OutFile -TimeoutSec 1800 break } catch { if (Test-Path -LiteralPath $OutFile) { Remove-Item -LiteralPath $OutFile -Force } if ($attempt -eq 3) { throw } Write-Host ('Download interrupted; retrying (' + $attempt + '/2).') Start-Sleep -Seconds (2 * $attempt) } } if ((Get-Item -LiteralPath $OutFile).Length -ne $ExpectedBytes -or (Get-FileHash -Algorithm SHA256 -LiteralPath $OutFile).Hash -ne $ExpectedSha) { Remove-Item -LiteralPath $OutFile -Force throw 'Download verification failed. The archive was not extracted.' } } finally { [Net.ServicePointManager]::SecurityProtocol = $previousProtocol } } $ErrorActionPreference = 'Stop' $PSNativeCommandUseErrorActionPreference = $false if ([Environment]::OSVersion.Platform -ne [PlatformID]::Win32NT -or $env:PROCESSOR_ARCHITECTURE -ne 'AMD64') { throw 'Use Windows x64 PowerShell for this package.' } $koderUrl = 'https://kodermodule.com/packages/cli/cli-0.8.6-original-g3/65de496bc9b65f56/koder-cli-original-0.8.6-g3-windows-x64-node24-r5.zip' $koderSha = '65de496bc9b65f567adbc264e0808411a4eb282f7789dbd7d8bc210fc00afd10' $koderTarget = Join-Path $HOME ('Koder086-' + [Guid]::NewGuid().ToString('N').Substring(0,8)) if ($koderTarget.Length -gt 70) { throw 'The installation path is too long for legacy Windows extraction. Download the ZIP and extract it into a shorter owned local directory.' } $null = New-Item -ItemType Directory -Path $koderTarget -ErrorAction Stop $koderArchive = Join-Path $koderTarget 'package.zip' Write-Host ('Downloading to ' + $koderTarget) Save-KoderArchive -Uri $koderUrl -OutFile $koderArchive -ExpectedBytes 554808370 -ExpectedSha $koderSha Write-Host 'Verified. Extracting the complete package; this can take several minutes.' try { Expand-Archive -LiteralPath $koderArchive -DestinationPath $koderTarget } catch { throw ('Extraction failed in ' + $koderTarget + ': ' + $_.Exception.Message) } $koderEntry = Join-Path $koderTarget 'koder-0.8.6-windows-x64\koder.cmd' Assert-KoderStartup -Entry $koderEntry Remove-Item -LiteralPath $koderArchive -Force Set-Alias -Name koder -Value $koderEntry -Scope Global -ErrorAction Stop Write-Host 'Installed. Start with: koder' Write-Host ('Directory: ' + (Split-Path -Parent $koderEntry)) Write-Host 'In a new terminal, cd to that directory and paste: Set-Alias koder (Join-Path $PWD "koder.cmd")' } ``` ## macOS Apple Silicon / Intel ```sh # Paste this complete block into macOS Terminal (zsh or bash). # Activates koder in this terminal only; no profile, global PATH or old install changes. function koder086_install() { local koder_url koder_sha koder_bytes koder_folder koder_target koder_file koder_os koder_major koder_minor [ "$(uname -s)" = Darwin ] || { printf '%s\n' 'This command is for macOS.'; return 1; } koder_os=$(sw_vers -productVersion) || return 1 koder_major=${koder_os%%.*}; koder_minor=${koder_os#*.}; koder_minor=${koder_minor%%.*} if [ "$koder_major" -lt 13 ] || { [ "$koder_major" -eq 13 ] && [ "$koder_minor" -lt 5 ]; }; then printf '%s\n' 'This package requires macOS 13.5 or newer.'; return 1 fi case "$(uname -m)" in arm64) koder_folder='koder-0.8.6-macos-arm64' koder_url='https://kodermodule.com/packages/cli/cli-0.8.6-original-g3/39f7532e155711fe/koder-cli-original-0.8.6-g3-macos-arm64-node24-r5.tar.gz' koder_sha='39f7532e155711fe42331e194f0515a85b03d0c24b861a7c79bed4e7eabf6e77' koder_bytes='547411143' ;; x86_64) koder_folder='koder-0.8.6-macos-x64' koder_url='https://kodermodule.com/packages/cli/cli-0.8.6-original-g3/e94ad0ca0f048c59/koder-cli-original-0.8.6-g3-macos-x64-node24-r5.tar.gz' koder_sha='e94ad0ca0f048c59e35b80ba573e59f45422dc165605f2a65e62636daf93c61a' koder_bytes='548693925' ;; *) printf '%s\n' 'Unsupported Mac architecture.'; return 1 ;; esac koder_target=$(mktemp -d "${KODER086_INSTALL_PARENT:-$HOME}/Koder086.XXXXXXXX") || return 1 koder_file="$koder_target/package.tar.gz" printf 'Downloading to %s\n' "$koder_target" curl --fail --location --proto '=https' --proto-redir '=https' --tlsv1.2 \ --connect-timeout 20 --max-time 1800 --retry 2 --output "$koder_file" "$koder_url" || { rm -f "$koder_file"; printf '%s\n' 'Download failed. Please retry with a stable connection.'; return 1; } [ "$(wc -c < "$koder_file" | tr -d '[:space:]')" = "$koder_bytes" ] && \ [ "$(shasum -a 256 "$koder_file" | cut -d ' ' -f 1)" = "$koder_sha" ] || { rm -f "$koder_file"; printf '%s\n' 'Download verification failed. The archive was not extracted.'; return 1; } printf '%s\n' 'Verified. Extracting the complete package; this can take several minutes.' tar -xpf "$koder_file" -C "$koder_target" || { printf 'Extraction failed in %s\n' "$koder_target"; return 1; } "$koder_target/$koder_folder/koder" --version || { printf 'Startup check failed in %s\n' "$koder_target"; return 1; } rm -f "$koder_file" || return 1 KODER086_ENTRY="$koder_target/$koder_folder/koder" # Selection is confined to this shell. Other terminals retain their existing command. unalias koder 2>/dev/null || true function koder() { "$KODER086_ENTRY" "$@"; } printf '\nInstalled. Start with: koder\nDirectory: %s\n' "$koder_target/$koder_folder" printf '%s\n' 'In a new terminal, cd to that directory and paste:' printf '%s\n' 'KODER086_ENTRY="$PWD/koder"; unalias koder 2>/dev/null; function koder() { "$KODER086_ENTRY" "$@"; }' } koder086_install ```