# AimKit : installe la commande aimkit et l'extension Chrome (dossier %USERPROFILE%\AimKit\extension). # irm https://daromsart.xyz/outils/aimkit/install.ps1 | iex # Il faut Node.js 20.11 ou plus récent, avec npm. Rien ne tourne en administrateur. Relancer = mettre à jour. # Version et empreinte inscrites par scripts/release.mjs ; AIMKIT_BASE remplace l'adresse (tests en local). # Tout est dans un bloc et les erreurs passent par throw : avec irm | iex, un exit fermerait la fenêtre. & { $ErrorActionPreference = 'Stop' $Version = '0.2.0' $Sha256 = '37c12ac2469e2885392d4de4cb1f8ab23ba2f5db2de8fbac0f8df7cd603f8a57' $Base = if ($env:AIMKIT_BASE) { $env:AIMKIT_BASE } else { 'https://daromsart.xyz/outils/aimkit' } if (-not (Get-Command node -ErrorAction SilentlyContinue)) { throw 'AimKit : Node.js est introuvable. Installe Node.js 20.11 ou plus récent (https://nodejs.org), puis relance cette commande.' } # npm.cmd plutôt que npm : npm.ps1 peut être bloqué par la stratégie d'exécution de PowerShell if (-not (Get-Command npm.cmd -ErrorAction SilentlyContinue)) { throw 'AimKit : npm est introuvable (il est fourni avec Node.js : https://nodejs.org).' } $nodeVersion = [version]((& node -v).Trim().TrimStart('v')) if ($nodeVersion -lt [version]'20.11.0') { throw "AimKit : Node.js $nodeVersion est trop ancien : il faut la version 20.11 ou plus récente (https://nodejs.org)." } $tmp = Join-Path ([IO.Path]::GetTempPath()) ('aimkit-' + [guid]::NewGuid()) New-Item -ItemType Directory -Path $tmp | Out-Null try { $tgz = Join-Path $tmp "aimkit-$Version.tgz" Write-Host "AimKit $Version : téléchargement…" Invoke-WebRequest -Uri "$Base/v/aimkit-$Version.tgz" -OutFile $tgz -UseBasicParsing $sum = (Get-FileHash -Path $tgz -Algorithm SHA256).Hash.ToLowerInvariant() if ($sum -ne $Sha256) { throw "AimKit : le paquet téléchargé n'a pas l'empreinte attendue : installation annulée, rien n'a été modifié." } Write-Host 'Installation de la commande aimkit (npm install -g)…' & npm.cmd install -g --no-fund --no-audit $tgz if ($LASTEXITCODE -ne 0) { throw 'AimKit : npm install -g a échoué (journal ci-dessus).' } $prefix = (& npm.cmd prefix -g).Trim() Write-Host '' & (Join-Path $prefix 'aimkit.cmd') setup if ($LASTEXITCODE -ne 0) { throw 'AimKit : aimkit setup a échoué (message ci-dessus).' } if (-not (Get-Command aimkit -ErrorAction SilentlyContinue)) { Write-Host '' Write-Host "Attention : la commande aimkit n'est pas dans ton PATH. Ajoute ce dossier au PATH de ton compte, puis rouvre le terminal :" Write-Host " $prefix" } } finally { Remove-Item -Recurse -Force -Path $tmp -ErrorAction SilentlyContinue } }