Upload 94 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- commandos/Add-Path.ps1 +54 -0
- commandos/Easy-Wav2Lip.bat +0 -0
- commandos/FIXA_VARIAVEIS.bat +4 -0
- commandos/Fix-MSCV.ps1 +79 -0
- commandos/Monitor-GPU-RAM.bat +38 -0
- commandos/OllamaClaude.bat +3 -0
- commandos/OllamaClaude.ps1 +3 -0
- commandos/RGSX Retrobat.bat +385 -0
- commandos/Remove-Path.ps1 +64 -0
- commandos/TESTE_WINDOWS_FINAL.bat +26 -0
- commandos/VERIFICAR_CUDNN.bat +15 -0
- commandos/abrir-clawdbot.bat +1 -0
- commandos/abrir_npm.bat +2 -0
- commandos/activate.bat +34 -0
- commandos/actualiza.bat +17 -0
- commandos/actualiza1.bat +25 -0
- commandos/aliases.bat +57 -0
- commandos/arrancar-clawdbot.bat +7 -0
- commandos/arrancar-openclaw.bat +5 -0
- commandos/ativa_comfy310.ps1 +1 -0
- commandos/bash.ps1 +8 -0
- commandos/build.bat +8 -0
- commandos/build_tool.ps1 +930 -0
- commandos/c++-analyzer.bat +1 -0
- commandos/ccc-analyzer.bat +1 -0
- commandos/clawdbot-universal.bat +17 -0
- commandos/convert_mp4_to_mp3.bat +10 -0
- commandos/copy-frame-d-to-e.bat +10 -0
- commandos/corgoogle.bat +9 -0
- commandos/corgoogle.ps1 +8 -0
- commandos/corrige-path.bat +24 -0
- commandos/corrige-path.ps1 +66 -0
- commandos/dar permissao a pasta imagens.bat +1 -0
- commandos/deactivate.bat +22 -0
- commandos/desbloquear_pictures.bat +45 -0
- commandos/dev-agent.bat +1 -0
- commandos/f-confy.bat +53 -0
- commandos/fallback-check.ps1 +8 -0
- commandos/ff-comfy.bat +56 -0
- commandos/frame.ps1 +16 -0
- commandos/git-clang-format.bat +1 -0
- commandos/health_check.bat +40 -0
- commandos/ia.bat +46 -0
- commandos/insta.bat +7 -0
- commandos/instala.bat +4 -0
- commandos/instalar-skills.bat +36 -0
- commandos/instalarepo.bat +28 -0
- commandos/install.bat +37 -0
- commandos/install_agent_deps.bat +5 -0
- commandos/install_agent_ps.ps1 +6 -0
commandos/Add-Path.ps1
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<#
|
| 2 |
+
.SYNOPSIS
|
| 3 |
+
Adiciona um ou mais caminhos ao PATH do utilizador de forma persistente e segura.
|
| 4 |
+
Contorna o limite de 1024 caracteres do comando 'setx'.
|
| 5 |
+
|
| 6 |
+
.EXAMPLE
|
| 7 |
+
.\Add-Path.ps1 "C:\Caminho\Para\Pasta"
|
| 8 |
+
#>
|
| 9 |
+
|
| 10 |
+
param (
|
| 11 |
+
[Parameter(Mandatory=$true, HelpMessage="Caminho a adicionar ao PATH")]
|
| 12 |
+
[string[]]$NewPaths
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
# 1) Obter o PATH atual do registo (User level) para evitar poluição da sessão atual
|
| 16 |
+
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
|
| 17 |
+
$pathList = $currentPath -split ";" | Where-Object { $_ -ne "" }
|
| 18 |
+
|
| 19 |
+
$addedCount = 0
|
| 20 |
+
|
| 21 |
+
foreach ($p in $NewPaths) {
|
| 22 |
+
# Limpar espaços e aspas
|
| 23 |
+
$cleanPath = $p.Trim().Trim('"')
|
| 24 |
+
|
| 25 |
+
if (-not (Test-Path $cleanPath)) {
|
| 26 |
+
Write-Warning "O caminho não existe: $cleanPath"
|
| 27 |
+
continue
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
# Verificar se já existe no PATH (case-insensitive)
|
| 31 |
+
if ($pathList -inotcontains $cleanPath) {
|
| 32 |
+
$pathList += $cleanPath
|
| 33 |
+
$addedCount++
|
| 34 |
+
Write-Host "✅ A adicionar: $cleanPath" -ForegroundColor Cyan
|
| 35 |
+
} else {
|
| 36 |
+
Write-Host "ℹ️ Já existe no PATH: $cleanPath" -ForegroundColor Yellow
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
if ($addedCount -gt 0) {
|
| 41 |
+
# Juntar novamente com ponto e vírgula
|
| 42 |
+
$updatedPath = $pathList -join ";"
|
| 43 |
+
|
| 44 |
+
# Gravar permanentemente no Registo (User)
|
| 45 |
+
[Environment]::SetEnvironmentVariable("PATH", $updatedPath, "User")
|
| 46 |
+
|
| 47 |
+
# Atualizar a sessão atual do PowerShell para uso imediato
|
| 48 |
+
$env:PATH = [Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + $updatedPath
|
| 49 |
+
|
| 50 |
+
Write-Host "`n✨ Sucesso! $addedCount caminho(s) adicionado(s) ao PATH permanentemente." -ForegroundColor Green
|
| 51 |
+
Write-Host "📢 Nota: Novas consolas terão o PATH atualizado. A sessão atual foi atualizada para este processo."
|
| 52 |
+
} else {
|
| 53 |
+
Write-Host "`nNada a alterar. O PATH já contém os caminhos indicados." -ForegroundColor Gray
|
| 54 |
+
}
|
commandos/Easy-Wav2Lip.bat
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
commandos/FIXA_VARIAVEIS.bat
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
rem Restaurar variáveis de sistema e utilizador na sessão atual do CMD
|
| 2 |
+
setx PATH "%PATH%" /M
|
| 3 |
+
setx PATH "%PATH%"
|
| 4 |
+
rem Depois feche e abra um novo terminal para as alterações surtirem efeito
|
commandos/Fix-MSCV.ps1
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fix-MSCV.ps1
|
| 2 |
+
# Corrige erro "cl.exe não encontrado" configurando ambiente MSVC automaticamente
|
| 3 |
+
|
| 4 |
+
Write-Host "`n=== MSVC Auto-Fix ===`n"
|
| 5 |
+
|
| 6 |
+
# 1) Procurar instalação do MSVC usando vswhere (mais robusto)
|
| 7 |
+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
| 8 |
+
$installPath = $null
|
| 9 |
+
|
| 10 |
+
if (Test-Path $vswhere) {
|
| 11 |
+
$installPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
if (-not $installPath) {
|
| 15 |
+
# Fallback para caminhos manuais (incluindo VS 18/2022)
|
| 16 |
+
$vsPaths = @(
|
| 17 |
+
"C:\Program Files\Microsoft Visual Studio\18\Community",
|
| 18 |
+
"C:\Program Files\Microsoft Visual Studio\2022\BuildTools",
|
| 19 |
+
"C:\Program Files\Microsoft Visual Studio\2022\Community",
|
| 20 |
+
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools",
|
| 21 |
+
"C:\Program Files (x86)\Microsoft Visual Studio\2022\Community"
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
foreach ($p in $vsPaths) {
|
| 25 |
+
if (Test-Path (Join-Path $p "VC\Auxiliary\Build\vcvarsall.bat")) {
|
| 26 |
+
$installPath = $p
|
| 27 |
+
break
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (-not $installPath) {
|
| 33 |
+
Write-Host "❌ MSVC não encontrado no sistema."
|
| 34 |
+
Write-Host "➡ A abrir instalador Build Tools..."
|
| 35 |
+
Start-Process "https://aka.ms/vs/17/release/vs_BuildTools.exe"
|
| 36 |
+
exit
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
$vcvars = Join-Path $installPath "VC\Auxiliary\Build\vcvarsall.bat"
|
| 40 |
+
Write-Host "✅ MSVC encontrado em: $installPath"
|
| 41 |
+
|
| 42 |
+
# 2) Criar wrapper temporário para carregar ambiente MSVC
|
| 43 |
+
$temp = "$env:TEMP\msvc_env.cmd"
|
| 44 |
+
@"
|
| 45 |
+
@echo off
|
| 46 |
+
call "$vcvars" x64 >nul
|
| 47 |
+
set
|
| 48 |
+
"@ | Out-File -Encoding ascii $temp
|
| 49 |
+
|
| 50 |
+
# 3) Executar wrapper e capturar variáveis
|
| 51 |
+
$vars = cmd.exe /c $temp
|
| 52 |
+
|
| 53 |
+
Write-Host "🔄 A configurar variáveis de ambiente (pode demorar alguns segundos)..."
|
| 54 |
+
foreach ($line in $vars) {
|
| 55 |
+
if ($line -match "^(.*?)=(.*)$") {
|
| 56 |
+
$name = $matches[1]
|
| 57 |
+
$value = $matches[2]
|
| 58 |
+
|
| 59 |
+
# Apenas atualizar variáveis críticas para evitar poluição excessiva do registo
|
| 60 |
+
if ($name -in @("PATH", "INCLUDE", "LIB", "LIBPATH")) {
|
| 61 |
+
[Environment]::SetEnvironmentVariable($name, $value, "User")
|
| 62 |
+
# Também atualizar a sessão atual
|
| 63 |
+
Set-Content "env:$name" $value
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
Write-Host "✨ Ambiente MSVC configurado!"
|
| 69 |
+
|
| 70 |
+
# 4) Testar cl.exe
|
| 71 |
+
$cl = Get-Command cl.exe -ErrorAction SilentlyContinue
|
| 72 |
+
|
| 73 |
+
if ($cl) {
|
| 74 |
+
Write-Host "🚀 Sucesso! O cl.exe está disponível em:"
|
| 75 |
+
Write-Host " $($cl.Source)"
|
| 76 |
+
} else {
|
| 77 |
+
Write-Host "⚠️ O MSVC foi configurado, mas pode ser necessário reiniciar a consola para aplicar o PATH totalmente."
|
| 78 |
+
}
|
| 79 |
+
|
commandos/Monitor-GPU-RAM.bat
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Monitorização contínua de GPUs e RAM
|
| 2 |
+
|
| 3 |
+
# Atualiza a cada 2 segundos
|
| 4 |
+
$interval = 2
|
| 5 |
+
|
| 6 |
+
# Função para mostrar estado de GPUs
|
| 7 |
+
function Show-GPUStatus {
|
| 8 |
+
Write-Host "============================================"
|
| 9 |
+
Write-Host (Get-Date -Format "yyyy-MM-dd HH:mm:ss")
|
| 10 |
+
|
| 11 |
+
# Lista todas as GPUs NVIDIA via nvidia-smi
|
| 12 |
+
Write-Host "`n=== NVIDIA GPUs ==="
|
| 13 |
+
& nvidia-smi --query-gpu=index,name,driver_version,memory.total,memory.used,utilization.gpu,utilization.memory --format=csv,noheader,nounits
|
| 14 |
+
|
| 15 |
+
# Informações sobre AMD via WMI (somente adaptável a placas AMD suportadas)
|
| 16 |
+
Write-Host "`n=== AMD / Other GPUs ==="
|
| 17 |
+
Get-WmiObject Win32_VideoController | ForEach-Object {
|
| 18 |
+
Write-Host "Name: $($_.Name)"
|
| 19 |
+
Write-Host "Adapter RAM: $([math]::Round($_.AdapterRAM / 1MB)) MB"
|
| 20 |
+
Write-Host "Current Usage: $([math]::Round($_.CurrentBits / 1MB)) MB" # Note: nem todos os drivers reportam CurrentBits
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
# Uso de RAM do sistema
|
| 24 |
+
Write-Host "`n=== Sistema RAM ==="
|
| 25 |
+
$os = Get-CimInstance Win32_OperatingSystem
|
| 26 |
+
$total = [math]::Round($os.TotalVisibleMemorySize / 1024)
|
| 27 |
+
$free = [math]::Round($os.FreePhysicalMemory / 1024)
|
| 28 |
+
Write-Host "Total RAM: $total MB"
|
| 29 |
+
Write-Host "Free RAM: $free MB"
|
| 30 |
+
Write-Host "Used RAM: $($total - $free) MB"
|
| 31 |
+
Write-Host "============================================`n"
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
# Loop infinito com intervalo definido
|
| 35 |
+
while ($true) {
|
| 36 |
+
Show-GPUStatus
|
| 37 |
+
Start-Sleep -Seconds $interval
|
| 38 |
+
}
|
commandos/OllamaClaude.bat
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
echo Starting Claude with qwen3.5:latest...
|
| 3 |
+
ollama launch claude --model qwen3.5:latest
|
commandos/OllamaClaude.ps1
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Script rápido para iniciar o Claude
|
| 2 |
+
Write-Host "Starting Claude with qwen3.5:latest..." -ForegroundColor Green
|
| 3 |
+
ollama launch claude --model qwen3.5:latest
|
commandos/RGSX Retrobat.bat
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
setlocal EnableDelayedExpansion
|
| 3 |
+
|
| 4 |
+
:: =============================================================================
|
| 5 |
+
:: RGSX Retrobat Launcher v1.3
|
| 6 |
+
:: =============================================================================
|
| 7 |
+
:: Usage: "RGSX Retrobat.bat" [options]
|
| 8 |
+
:: --display=N Launch on display N (0=primary, 1=secondary, etc.)
|
| 9 |
+
:: --windowed Launch in windowed mode instead of fullscreen
|
| 10 |
+
:: --help Show this help
|
| 11 |
+
:: =============================================================================
|
| 12 |
+
|
| 13 |
+
:: Configuration des couleurs (codes ANSI)
|
| 14 |
+
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
|
| 15 |
+
set "ESC=%%b"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
:: Couleurs
|
| 19 |
+
set "GREEN=[92m"
|
| 20 |
+
set "YELLOW=[93m"
|
| 21 |
+
set "RED=[91m"
|
| 22 |
+
set "CYAN=[96m"
|
| 23 |
+
set "RESET=[0m"
|
| 24 |
+
set "BOLD=[1m"
|
| 25 |
+
|
| 26 |
+
:: =============================================================================
|
| 27 |
+
:: Traitement des arguments
|
| 28 |
+
:: =============================================================================
|
| 29 |
+
set "DISPLAY_NUM="
|
| 30 |
+
set "WINDOWED_MODE="
|
| 31 |
+
set "CONFIG_FILE="
|
| 32 |
+
|
| 33 |
+
:parse_args
|
| 34 |
+
if "%~1"=="" goto :args_done
|
| 35 |
+
if /i "%~1"=="--help" goto :show_help
|
| 36 |
+
if /i "%~1"=="-h" goto :show_help
|
| 37 |
+
if /i "%~1"=="--windowed" (
|
| 38 |
+
set "WINDOWED_MODE=1"
|
| 39 |
+
shift
|
| 40 |
+
goto :parse_args
|
| 41 |
+
)
|
| 42 |
+
:: Check for --display=N format
|
| 43 |
+
echo %~1 | findstr /r "^--display=" >nul
|
| 44 |
+
if !ERRORLEVEL! EQU 0 (
|
| 45 |
+
for /f "tokens=2 delims==" %%a in ("%~1") do set "DISPLAY_NUM=%%a"
|
| 46 |
+
shift
|
| 47 |
+
goto :parse_args
|
| 48 |
+
)
|
| 49 |
+
shift
|
| 50 |
+
goto :parse_args
|
| 51 |
+
|
| 52 |
+
:show_help
|
| 53 |
+
echo.
|
| 54 |
+
echo %ESC%%CYAN%RGSX Retrobat Launcher - Help%ESC%%RESET%
|
| 55 |
+
echo.
|
| 56 |
+
echo Usage: "RGSX Retrobat.bat" [options]
|
| 57 |
+
echo.
|
| 58 |
+
echo Options:
|
| 59 |
+
echo --display=N Launch on display N (0=primary, 1=secondary, etc.)
|
| 60 |
+
echo --windowed Launch in windowed mode instead of fullscreen
|
| 61 |
+
echo --help, -h Show this help
|
| 62 |
+
echo.
|
| 63 |
+
echo Examples:
|
| 64 |
+
echo "RGSX Retrobat.bat" Launch on primary display
|
| 65 |
+
echo "RGSX Retrobat.bat" --display=1 Launch on secondary display (TV)
|
| 66 |
+
echo "RGSX Retrobat.bat" --windowed Launch in windowed mode
|
| 67 |
+
echo.
|
| 68 |
+
echo You can also create shortcuts with different display settings.
|
| 69 |
+
echo.
|
| 70 |
+
pause
|
| 71 |
+
exit /b 0
|
| 72 |
+
|
| 73 |
+
:args_done
|
| 74 |
+
|
| 75 |
+
:: URL de telechargement Python
|
| 76 |
+
set "PYTHON_ZIP_URL=https://github.com/RetroGameSets/RGSX/raw/main/windows/python.zip"
|
| 77 |
+
|
| 78 |
+
:: Obtenir le chemin du script de maniere fiable
|
| 79 |
+
set "SCRIPT_DIR=%~dp0"
|
| 80 |
+
set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
|
| 81 |
+
|
| 82 |
+
:: Detecter le repertoire racine
|
| 83 |
+
for %%I in ("%SCRIPT_DIR%\..\.." ) do set "ROOT_DIR=%%~fI"
|
| 84 |
+
|
| 85 |
+
:: Configuration des logs
|
| 86 |
+
set "LOG_DIR=%ROOT_DIR%\roms\windows\logs"
|
| 87 |
+
if not exist "%LOG_DIR%" mkdir "%LOG_DIR%"
|
| 88 |
+
set "LOG_FILE=%LOG_DIR%\Retrobat_RGSX_log.txt"
|
| 89 |
+
set "LOG_BACKUP=%LOG_DIR%\Retrobat_RGSX_log.old.txt"
|
| 90 |
+
|
| 91 |
+
:: Rotation des logs avec backup
|
| 92 |
+
if exist "%LOG_FILE%" (
|
| 93 |
+
for %%A in ("%LOG_FILE%") do (
|
| 94 |
+
if %%~zA GTR 100000 (
|
| 95 |
+
if exist "%LOG_BACKUP%" del /q "%LOG_BACKUP%"
|
| 96 |
+
move /y "%LOG_FILE%" "%LOG_BACKUP%" >nul 2>&1
|
| 97 |
+
echo [%DATE% %TIME%] Log rotated - previous log saved as .old.txt > "%LOG_FILE%"
|
| 98 |
+
)
|
| 99 |
+
)
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
:: =============================================================================
|
| 103 |
+
:: Ecran d'accueil
|
| 104 |
+
:: =============================================================================
|
| 105 |
+
cls
|
| 106 |
+
echo.
|
| 107 |
+
echo %ESC%%CYAN% ____ ____ ______ __ %ESC%%RESET%
|
| 108 |
+
echo %ESC%%CYAN% ^| _ \ / ___^/ ___\ \/ / %ESC%%RESET%
|
| 109 |
+
echo %ESC%%CYAN% ^| ^|_) ^| ^| _\___ \\ / %ESC%%RESET%
|
| 110 |
+
echo %ESC%%CYAN% ^| _ ^<^| ^|_^| ^|___) / \ %ESC%%RESET%
|
| 111 |
+
echo %ESC%%CYAN% ^|_^| \_\\____^|____/_/\_\ %ESC%%RESET%
|
| 112 |
+
echo.
|
| 113 |
+
echo %ESC%%BOLD% RetroBat Launcher v1.3%ESC%%RESET%
|
| 114 |
+
echo --------------------------------
|
| 115 |
+
if "!DISPLAY_NUM!" NEQ "0" (
|
| 116 |
+
echo %ESC%%CYAN%Display: !DISPLAY_NUM!%ESC%%RESET%
|
| 117 |
+
)
|
| 118 |
+
if "!WINDOWED_MODE!"=="1" (
|
| 119 |
+
echo %ESC%%CYAN%Mode: Windowed%ESC%%RESET%
|
| 120 |
+
)
|
| 121 |
+
echo.
|
| 122 |
+
|
| 123 |
+
:: Debut du log
|
| 124 |
+
echo [%DATE% %TIME%] ========================================== >> "%LOG_FILE%"
|
| 125 |
+
echo [%DATE% %TIME%] RGSX Launcher v1.3 started >> "%LOG_FILE%"
|
| 126 |
+
echo [%DATE% %TIME%] Display: !DISPLAY_NUM!, Windowed: !WINDOWED_MODE! >> "%LOG_FILE%"
|
| 127 |
+
echo [%DATE% %TIME%] ========================================== >> "%LOG_FILE%"
|
| 128 |
+
|
| 129 |
+
:: Configuration des chemins
|
| 130 |
+
set "PYTHON_DIR=%ROOT_DIR%\system\tools\Python"
|
| 131 |
+
set "PYTHON_EXE=%PYTHON_DIR%\python.exe"
|
| 132 |
+
set "MAIN_SCRIPT=%ROOT_DIR%\roms\ports\RGSX\__main__.py"
|
| 133 |
+
set "ZIP_FILE=%ROOT_DIR%\roms\windows\python.zip"
|
| 134 |
+
|
| 135 |
+
:: Exporter RGSX_ROOT pour le script Python
|
| 136 |
+
set "RGSX_ROOT=%ROOT_DIR%"
|
| 137 |
+
|
| 138 |
+
:: Logger les chemins
|
| 139 |
+
echo [%DATE% %TIME%] System info: >> "%LOG_FILE%"
|
| 140 |
+
echo [%DATE% %TIME%] ROOT_DIR: %ROOT_DIR% >> "%LOG_FILE%"
|
| 141 |
+
echo [%DATE% %TIME%] PYTHON_EXE: %PYTHON_EXE% >> "%LOG_FILE%"
|
| 142 |
+
echo [%DATE% %TIME%] MAIN_SCRIPT: %MAIN_SCRIPT% >> "%LOG_FILE%"
|
| 143 |
+
echo [%DATE% %TIME%] RGSX_ROOT: %RGSX_ROOT% >> "%LOG_FILE%"
|
| 144 |
+
|
| 145 |
+
:: =============================================================================
|
| 146 |
+
:: Verification Python
|
| 147 |
+
:: =============================================================================
|
| 148 |
+
echo %ESC%%YELLOW%[1/3]%ESC%%RESET% Checking Python environment...
|
| 149 |
+
echo [%DATE% %TIME%] Step 1/3: Checking Python >> "%LOG_FILE%"
|
| 150 |
+
|
| 151 |
+
if not exist "%PYTHON_EXE%" (
|
| 152 |
+
echo %ESC%%YELLOW%^> Python not found, installing...%ESC%%RESET%
|
| 153 |
+
echo [%DATE% %TIME%] Python not found, starting installation >> "%LOG_FILE%"
|
| 154 |
+
|
| 155 |
+
:: Creer le dossier Python
|
| 156 |
+
if not exist "%PYTHON_DIR%" (
|
| 157 |
+
mkdir "%PYTHON_DIR%" 2>nul
|
| 158 |
+
echo [%DATE% %TIME%] Created folder: %PYTHON_DIR% >> "%LOG_FILE%"
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
:: Verifier si le ZIP existe, sinon le telecharger
|
| 162 |
+
if not exist "%ZIP_FILE%" (
|
| 163 |
+
echo %ESC%%YELLOW%^> python.zip not found, downloading from GitHub...%ESC%%RESET%
|
| 164 |
+
echo [%DATE% %TIME%] python.zip not found, attempting download >> "%LOG_FILE%"
|
| 165 |
+
echo [%DATE% %TIME%] Download URL: %PYTHON_ZIP_URL% >> "%LOG_FILE%"
|
| 166 |
+
|
| 167 |
+
:: Verifier si curl est disponible
|
| 168 |
+
where curl.exe >nul 2>&1
|
| 169 |
+
if !ERRORLEVEL! EQU 0 (
|
| 170 |
+
echo %ESC%%CYAN%^> Using curl to download...%ESC%%RESET%
|
| 171 |
+
echo [%DATE% %TIME%] Using curl.exe for download >> "%LOG_FILE%"
|
| 172 |
+
curl.exe -L -# -o "%ZIP_FILE%" "%PYTHON_ZIP_URL%"
|
| 173 |
+
set DOWNLOAD_RESULT=!ERRORLEVEL!
|
| 174 |
+
) else (
|
| 175 |
+
:: Fallback sur PowerShell
|
| 176 |
+
echo %ESC%%CYAN%^> Using PowerShell to download...%ESC%%RESET%
|
| 177 |
+
echo [%DATE% %TIME%] curl not found, using PowerShell >> "%LOG_FILE%"
|
| 178 |
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri '%PYTHON_ZIP_URL%' -OutFile '%ZIP_FILE%'"
|
| 179 |
+
set DOWNLOAD_RESULT=!ERRORLEVEL!
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
:: Verifier le resultat du telechargement
|
| 183 |
+
if !DOWNLOAD_RESULT! NEQ 0 (
|
| 184 |
+
echo.
|
| 185 |
+
echo %ESC%%RED% ERROR: Download failed!%ESC%%RESET%
|
| 186 |
+
echo.
|
| 187 |
+
echo Please download python.zip manually from:
|
| 188 |
+
echo %ESC%%CYAN%%PYTHON_ZIP_URL%%ESC%%RESET%
|
| 189 |
+
echo.
|
| 190 |
+
echo And place it in:
|
| 191 |
+
echo %ESC%%CYAN%%ROOT_DIR%\roms\windows\%ESC%%RESET%
|
| 192 |
+
echo.
|
| 193 |
+
echo [%DATE% %TIME%] ERROR: Download failed with code !DOWNLOAD_RESULT! >> "%LOG_FILE%"
|
| 194 |
+
goto :error
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
:: Verifier que le fichier a bien ete telecharge et n'est pas vide
|
| 198 |
+
if not exist "%ZIP_FILE%" (
|
| 199 |
+
echo.
|
| 200 |
+
echo %ESC%%RED% ERROR: Download failed - file not created!%ESC%%RESET%
|
| 201 |
+
echo [%DATE% %TIME%] ERROR: ZIP file not created after download >> "%LOG_FILE%"
|
| 202 |
+
goto :error
|
| 203 |
+
)
|
| 204 |
+
|
| 205 |
+
:: Verifier la taille du fichier (doit etre > 1MB pour etre valide)
|
| 206 |
+
for %%A in ("%ZIP_FILE%") do set ZIP_SIZE=%%~zA
|
| 207 |
+
if !ZIP_SIZE! LSS 1000000 (
|
| 208 |
+
echo.
|
| 209 |
+
echo %ESC%%RED% ERROR: Downloaded file appears invalid ^(too small^)!%ESC%%RESET%
|
| 210 |
+
echo [%DATE% %TIME%] ERROR: Downloaded file too small: !ZIP_SIZE! bytes >> "%LOG_FILE%"
|
| 211 |
+
del /q "%ZIP_FILE%" 2>nul
|
| 212 |
+
goto :error
|
| 213 |
+
)
|
| 214 |
+
|
| 215 |
+
echo %ESC%%GREEN%^> Download complete ^(!ZIP_SIZE! bytes^)%ESC%%RESET%
|
| 216 |
+
echo [%DATE% %TIME%] Download successful: !ZIP_SIZE! bytes >> "%LOG_FILE%"
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
:: Verifier que tar existe (Windows 10 1803+)
|
| 220 |
+
where tar >nul 2>&1
|
| 221 |
+
if !ERRORLEVEL! NEQ 0 (
|
| 222 |
+
echo.
|
| 223 |
+
echo %ESC%%RED% ERROR: tar command not available!%ESC%%RESET%
|
| 224 |
+
echo.
|
| 225 |
+
echo Please update Windows 10 or extract manually to:
|
| 226 |
+
echo %ESC%%CYAN%%PYTHON_DIR%%ESC%%RESET%
|
| 227 |
+
echo.
|
| 228 |
+
echo [%DATE% %TIME%] ERROR: tar command not found >> "%LOG_FILE%"
|
| 229 |
+
goto :error
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
:: Extraction avec progression simulee
|
| 233 |
+
echo %ESC%%YELLOW%^> Extracting Python...%ESC%%RESET%
|
| 234 |
+
echo [%DATE% %TIME%] Extracting python.zip >> "%LOG_FILE%"
|
| 235 |
+
|
| 236 |
+
<nul set /p "= ["
|
| 237 |
+
tar -xf "%ZIP_FILE%" -C "%PYTHON_DIR%" --strip-components=0
|
| 238 |
+
set TAR_RESULT=!ERRORLEVEL!
|
| 239 |
+
echo %ESC%%GREEN%##########%ESC%%RESET%] Done
|
| 240 |
+
|
| 241 |
+
if !TAR_RESULT! NEQ 0 (
|
| 242 |
+
echo.
|
| 243 |
+
echo %ESC%%RED% ERROR: Extraction failed!%ESC%%RESET%
|
| 244 |
+
echo [%DATE% %TIME%] ERROR: tar extraction failed with code !TAR_RESULT! >> "%LOG_FILE%"
|
| 245 |
+
goto :error
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
echo [%DATE% %TIME%] Extraction completed >> "%LOG_FILE%"
|
| 249 |
+
|
| 250 |
+
:: Supprimer ZIP
|
| 251 |
+
del /q "%ZIP_FILE%" 2>nul
|
| 252 |
+
echo %ESC%%GREEN%^> python.zip cleaned up%ESC%%RESET%
|
| 253 |
+
echo [%DATE% %TIME%] python.zip deleted >> "%LOG_FILE%"
|
| 254 |
+
|
| 255 |
+
:: Verifier installation
|
| 256 |
+
if not exist "%PYTHON_EXE%" (
|
| 257 |
+
echo.
|
| 258 |
+
echo %ESC%%RED% ERROR: Python not found after extraction!%ESC%%RESET%
|
| 259 |
+
echo [%DATE% %TIME%] ERROR: python.exe not found after extraction >> "%LOG_FILE%"
|
| 260 |
+
goto :error
|
| 261 |
+
)
|
| 262 |
+
)
|
| 263 |
+
|
| 264 |
+
:: Afficher et logger la version Python
|
| 265 |
+
for /f "tokens=*" %%v in ('"%PYTHON_EXE%" --version 2^>^&1') do set "PYTHON_VERSION=%%v"
|
| 266 |
+
echo %ESC%%GREEN%^> %PYTHON_VERSION% found%ESC%%RESET%
|
| 267 |
+
echo [%DATE% %TIME%] %PYTHON_VERSION% detected >> "%LOG_FILE%"
|
| 268 |
+
|
| 269 |
+
:: =============================================================================
|
| 270 |
+
:: Verification script principal
|
| 271 |
+
:: =============================================================================
|
| 272 |
+
echo %ESC%%YELLOW%[2/3]%ESC%%RESET% Checking RGSX application...
|
| 273 |
+
echo [%DATE% %TIME%] Step 2/3: Checking RGSX files >> "%LOG_FILE%"
|
| 274 |
+
|
| 275 |
+
if not exist "%MAIN_SCRIPT%" (
|
| 276 |
+
echo.
|
| 277 |
+
echo %ESC%%RED% ERROR: __main__.py not found!%ESC%%RESET%
|
| 278 |
+
echo.
|
| 279 |
+
echo Expected location:
|
| 280 |
+
echo %ESC%%CYAN%%MAIN_SCRIPT%%ESC%%RESET%
|
| 281 |
+
echo.
|
| 282 |
+
echo [%DATE% %TIME%] ERROR: __main__.py not found at %MAIN_SCRIPT% >> "%LOG_FILE%"
|
| 283 |
+
goto :error
|
| 284 |
+
)
|
| 285 |
+
|
| 286 |
+
echo %ESC%%GREEN%^> RGSX files OK%ESC%%RESET%
|
| 287 |
+
echo [%DATE% %TIME%] RGSX files verified >> "%LOG_FILE%"
|
| 288 |
+
|
| 289 |
+
:: =============================================================================
|
| 290 |
+
:: Lancement
|
| 291 |
+
:: =============================================================================
|
| 292 |
+
echo %ESC%%YELLOW%[3/3]%ESC%%RESET% Launching RGSX...
|
| 293 |
+
echo [%DATE% %TIME%] Step 3/3: Launching application >> "%LOG_FILE%"
|
| 294 |
+
|
| 295 |
+
:: Changer le repertoire de travail
|
| 296 |
+
cd /d "%ROOT_DIR%\roms\ports\RGSX"
|
| 297 |
+
echo [%DATE% %TIME%] Working directory: %CD% >> "%LOG_FILE%"
|
| 298 |
+
|
| 299 |
+
:: Configuration SDL/Pygame
|
| 300 |
+
set PYGAME_HIDE_SUPPORT_PROMPT=1
|
| 301 |
+
set SDL_VIDEODRIVER=windows
|
| 302 |
+
set SDL_AUDIODRIVER=directsound
|
| 303 |
+
set PYTHONWARNINGS=ignore::UserWarning:pygame.pkgdata
|
| 304 |
+
|
| 305 |
+
:: =============================================================================
|
| 306 |
+
:: Configuration multi-ecran
|
| 307 |
+
:: =============================================================================
|
| 308 |
+
:: SDL_VIDEO_FULLSCREEN_HEAD: Selectionne l'ecran pour le mode plein ecran
|
| 309 |
+
:: 0 = ecran principal, 1 = ecran secondaire, etc.
|
| 310 |
+
:: Ces variables ne sont definies que si --display=N ou --windowed est passe
|
| 311 |
+
:: Sinon, le script Python utilisera les parametres de rgsx_settings.json
|
| 312 |
+
|
| 313 |
+
echo [%DATE% %TIME%] Display configuration: >> "%LOG_FILE%"
|
| 314 |
+
if defined DISPLAY_NUM (
|
| 315 |
+
set SDL_VIDEO_FULLSCREEN_HEAD=!DISPLAY_NUM!
|
| 316 |
+
set RGSX_DISPLAY=!DISPLAY_NUM!
|
| 317 |
+
echo [%DATE% %TIME%] SDL_VIDEO_FULLSCREEN_HEAD=!DISPLAY_NUM! ^(from --display arg^) >> "%LOG_FILE%"
|
| 318 |
+
echo [%DATE% %TIME%] RGSX_DISPLAY=!DISPLAY_NUM! ^(from --display arg^) >> "%LOG_FILE%"
|
| 319 |
+
) else (
|
| 320 |
+
echo [%DATE% %TIME%] Display: using rgsx_settings.json config >> "%LOG_FILE%"
|
| 321 |
+
)
|
| 322 |
+
if defined WINDOWED_MODE (
|
| 323 |
+
set RGSX_WINDOWED=!WINDOWED_MODE!
|
| 324 |
+
echo [%DATE% %TIME%] RGSX_WINDOWED=!WINDOWED_MODE! ^(from --windowed arg^) >> "%LOG_FILE%"
|
| 325 |
+
) else (
|
| 326 |
+
echo [%DATE% %TIME%] Windowed: using rgsx_settings.json config >> "%LOG_FILE%"
|
| 327 |
+
)
|
| 328 |
+
|
| 329 |
+
:: Log environnement
|
| 330 |
+
echo [%DATE% %TIME%] Environment variables set: >> "%LOG_FILE%"
|
| 331 |
+
echo [%DATE% %TIME%] RGSX_ROOT=%RGSX_ROOT% >> "%LOG_FILE%"
|
| 332 |
+
echo [%DATE% %TIME%] SDL_VIDEODRIVER=%SDL_VIDEODRIVER% >> "%LOG_FILE%"
|
| 333 |
+
echo [%DATE% %TIME%] SDL_AUDIODRIVER=%SDL_AUDIODRIVER% >> "%LOG_FILE%"
|
| 334 |
+
|
| 335 |
+
echo.
|
| 336 |
+
if defined DISPLAY_NUM (
|
| 337 |
+
echo %ESC%%CYAN%Launching on display !DISPLAY_NUM!...%ESC%%RESET%
|
| 338 |
+
)
|
| 339 |
+
if defined WINDOWED_MODE (
|
| 340 |
+
echo %ESC%%CYAN%Windowed mode enabled%ESC%%RESET%
|
| 341 |
+
)
|
| 342 |
+
echo %ESC%%CYAN%Starting RGSX application...%ESC%%RESET%
|
| 343 |
+
echo %ESC%%BOLD%Press Ctrl+C to force quit if needed%ESC%%RESET%
|
| 344 |
+
echo.
|
| 345 |
+
echo [%DATE% %TIME%] Executing: "%PYTHON_EXE%" "%MAIN_SCRIPT%" >> "%LOG_FILE%"
|
| 346 |
+
echo [%DATE% %TIME%] --- Application output start --- >> "%LOG_FILE%"
|
| 347 |
+
|
| 348 |
+
"%PYTHON_EXE%" "%MAIN_SCRIPT%" >> "%LOG_FILE%" 2>&1
|
| 349 |
+
set EXITCODE=!ERRORLEVEL!
|
| 350 |
+
|
| 351 |
+
echo [%DATE% %TIME%] --- Application output end --- >> "%LOG_FILE%"
|
| 352 |
+
echo [%DATE% %TIME%] Exit code: !EXITCODE! >> "%LOG_FILE%"
|
| 353 |
+
|
| 354 |
+
if "!EXITCODE!"=="0" (
|
| 355 |
+
echo.
|
| 356 |
+
echo %ESC%%GREEN%RGSX closed successfully.%ESC%%RESET%
|
| 357 |
+
echo.
|
| 358 |
+
echo [%DATE% %TIME%] Application closed successfully >> "%LOG_FILE%"
|
| 359 |
+
) else (
|
| 360 |
+
echo.
|
| 361 |
+
echo %ESC%%RED%RGSX exited with error code !EXITCODE!%ESC%%RESET%
|
| 362 |
+
echo.
|
| 363 |
+
echo [%DATE% %TIME%] ERROR: Application exited with code !EXITCODE! >> "%LOG_FILE%"
|
| 364 |
+
goto :error
|
| 365 |
+
)
|
| 366 |
+
|
| 367 |
+
:end
|
| 368 |
+
echo [%DATE% %TIME%] ========================================== >> "%LOG_FILE%"
|
| 369 |
+
echo [%DATE% %TIME%] Session ended normally >> "%LOG_FILE%"
|
| 370 |
+
echo [%DATE% %TIME%] ========================================== >> "%LOG_FILE%"
|
| 371 |
+
timeout /t 2 >nul
|
| 372 |
+
exit /b 0
|
| 373 |
+
|
| 374 |
+
:error
|
| 375 |
+
echo.
|
| 376 |
+
echo %ESC%%RED%An error occurred. Check the log file:%ESC%%RESET%
|
| 377 |
+
echo %ESC%%CYAN%%LOG_FILE%%ESC%%RESET%
|
| 378 |
+
echo.
|
| 379 |
+
echo [%DATE% %TIME%] ========================================== >> "%LOG_FILE%"
|
| 380 |
+
echo [%DATE% %TIME%] Session ended with errors >> "%LOG_FILE%"
|
| 381 |
+
echo [%DATE% %TIME%] ========================================== >> "%LOG_FILE%"
|
| 382 |
+
echo.
|
| 383 |
+
echo Press any key to close...
|
| 384 |
+
pause >nul
|
| 385 |
+
exit /b 1
|
commandos/Remove-Path.ps1
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<#
|
| 2 |
+
.SYNOPSIS
|
| 3 |
+
Remove um ou mais caminhos do PATH do utilizador de forma persistente e segura.
|
| 4 |
+
Garante a integridade do PATH sem os limites do comando 'setx'.
|
| 5 |
+
|
| 6 |
+
.EXAMPLE
|
| 7 |
+
.\Remove-Path.ps1 "C:\Caminho\Para\Remover"
|
| 8 |
+
#>
|
| 9 |
+
|
| 10 |
+
param (
|
| 11 |
+
[Parameter(Mandatory=$true, HelpMessage="Caminho a remover do PATH")]
|
| 12 |
+
[string[]]$PathsToRemove
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
# 1) Obter o PATH atual do registo (User level)
|
| 16 |
+
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
|
| 17 |
+
if (-not $currentPath) {
|
| 18 |
+
Write-Error "Não foi possível obter o PATH do utilizador ou o PATH está vazio."
|
| 19 |
+
exit
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
$pathList = $currentPath -split ";" | Where-Object { $_ -ne "" }
|
| 23 |
+
$originalCount = $pathList.Count
|
| 24 |
+
$newPathList = @()
|
| 25 |
+
|
| 26 |
+
# Criar lista de caminhos a remover limpos
|
| 27 |
+
$cleanRemovals = $PathsToRemove | ForEach-Object { $_.Trim().Trim('"').TrimEnd('\') }
|
| 28 |
+
|
| 29 |
+
foreach ($p in $pathList) {
|
| 30 |
+
$cleanP = $p.Trim().TrimEnd('\')
|
| 31 |
+
|
| 32 |
+
# Se o caminho atual não estiver na lista de remoção, mantém-se
|
| 33 |
+
$match = $false
|
| 34 |
+
foreach ($rem in $cleanRemovals) {
|
| 35 |
+
if ($cleanP -ieq $rem) {
|
| 36 |
+
$match = $true
|
| 37 |
+
break
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
if (-not $match) {
|
| 42 |
+
$newPathList += $p
|
| 43 |
+
} else {
|
| 44 |
+
Write-Host "🗑️ A remover: $p" -ForegroundColor Yellow
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
$removedCount = $originalCount - $newPathList.Count
|
| 49 |
+
|
| 50 |
+
if ($removedCount -gt 0) {
|
| 51 |
+
# Juntar novamente
|
| 52 |
+
$updatedPath = $newPathList -join ";"
|
| 53 |
+
|
| 54 |
+
# Gravar permanentemente no Registo (User)
|
| 55 |
+
[Environment]::SetEnvironmentVariable("PATH", $updatedPath, "User")
|
| 56 |
+
|
| 57 |
+
# Atualizar a sessão atual
|
| 58 |
+
$env:PATH = [Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + $updatedPath
|
| 59 |
+
|
| 60 |
+
Write-Host "`n✨ Sucesso! $removedCount caminho(s) removido(s) do PATH permanentemente." -ForegroundColor Green
|
| 61 |
+
Write-Host "📢 Nota: Novas consolas refletirão a mudança. A sessão atual foi atualizada."
|
| 62 |
+
} else {
|
| 63 |
+
Write-Host "`nNada a remover. Os caminhos indicados não foram encontrados no PATH do utilizador." -ForegroundColor Gray
|
| 64 |
+
}
|
commandos/TESTE_WINDOWS_FINAL.bat
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
echo 🚀 TESTE FINAL - Sistema ML/AI====
|
| 3 |
+
Windows
|
| 4 |
+
echo =================================echo.
|
| 5 |
+
|
| 6 |
+
echo 🧪 Testando sistema completo...
|
| 7 |
+
echo.
|
| 8 |
+
|
| 9 |
+
python TESTE_RAPIDO_FINAL.py
|
| 10 |
+
|
| 11 |
+
echo.
|
| 12 |
+
echo ======================================
|
| 13 |
+
echo 🎯 RESULTADO ESPERADO:
|
| 14 |
+
echo ✅ NumPy: OK
|
| 15 |
+
echo ✅ Pandas: OK
|
| 16 |
+
echo ✅ Matplotlib: OK
|
| 17 |
+
echo ✅ Scikit-Learn: OK
|
| 18 |
+
echo ✅ Seaborn: OK
|
| 19 |
+
echo ✅ PyTorch: v2.4.1+cu121 (CUDA: True)
|
| 20 |
+
echo ✅ TensorFlow: vunknown
|
| 21 |
+
echo ✅ GPU: 2 GPUs detectadas
|
| 22 |
+
echo.
|
| 23 |
+
echo 🎉 SE VIR "SISTEMA 100% FUNCIONAL" = SUCESSO COMPLETO!
|
| 24 |
+
echo ======================================
|
| 25 |
+
|
| 26 |
+
pause
|
commandos/VERIFICAR_CUDNN.bat
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
echo 🔍 VERIFICANDO CUDNN INSTALADO
|
| 3 |
+
echo ==============================
|
| 4 |
+
|
| 5 |
+
python -c "import torch; print(f'✅ PyTorch: {torch.__version__}'); print(f'✅ cuDNN habilitado: {torch.backends.cudnn.enabled}'); print(f'✅ CUDA disponível: {torch.cuda.is_available()}')"
|
| 6 |
+
|
| 7 |
+
if %ERRORLEVEL% == 0 (
|
| 8 |
+
echo.
|
| 9 |
+
echo 🎉 CUDNN FUNCIONANDO PERFEITAMENTE!
|
| 10 |
+
) else (
|
| 11 |
+
echo.
|
| 12 |
+
echo ❌ Problema na instalação
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
pause
|
commandos/abrir-clawdbot.bat
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
start http://127.0.0.1:18789/
|
commandos/abrir_npm.bat
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
start cmd /k "npm -v"
|
commandos/activate.bat
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
|
| 3 |
+
rem This file is UTF-8 encoded, so we need to update the current code page while executing it
|
| 4 |
+
for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (
|
| 5 |
+
set _OLD_CODEPAGE=%%a
|
| 6 |
+
)
|
| 7 |
+
if defined _OLD_CODEPAGE (
|
| 8 |
+
"%SystemRoot%\System32\chcp.com" 65001 > nul
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
set "VIRTUAL_ENV=C:\Users\luisf\Desktop\sete\dj-env"
|
| 12 |
+
|
| 13 |
+
if not defined PROMPT set PROMPT=$P$G
|
| 14 |
+
|
| 15 |
+
if defined _OLD_VIRTUAL_PROMPT set PROMPT=%_OLD_VIRTUAL_PROMPT%
|
| 16 |
+
if defined _OLD_VIRTUAL_PYTHONHOME set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
|
| 17 |
+
|
| 18 |
+
set _OLD_VIRTUAL_PROMPT=%PROMPT%
|
| 19 |
+
set PROMPT=(dj-env) %PROMPT%
|
| 20 |
+
|
| 21 |
+
if defined PYTHONHOME set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
|
| 22 |
+
set PYTHONHOME=
|
| 23 |
+
|
| 24 |
+
if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%
|
| 25 |
+
if not defined _OLD_VIRTUAL_PATH set _OLD_VIRTUAL_PATH=%PATH%
|
| 26 |
+
|
| 27 |
+
set "PATH=%VIRTUAL_ENV%\Scripts;%PATH%"
|
| 28 |
+
set "VIRTUAL_ENV_PROMPT=(dj-env) "
|
| 29 |
+
|
| 30 |
+
:END
|
| 31 |
+
if defined _OLD_CODEPAGE (
|
| 32 |
+
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
|
| 33 |
+
set _OLD_CODEPAGE=
|
| 34 |
+
)
|
commandos/actualiza.bat
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
set REPO=%1
|
| 3 |
+
set PYTHON_PATH=D:\ComfyUI_cu128_50XX\python_embeded\python.exe
|
| 4 |
+
|
| 5 |
+
:: Verifica se o script está sendo executado como administrador
|
| 6 |
+
openfiles >nul 2>&1
|
| 7 |
+
if %errorlevel% NEQ 0 (
|
| 8 |
+
echo Por favor, execute este script como administrador.
|
| 9 |
+
pause
|
| 10 |
+
exit /b
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
:: Desinstala e exclui o arquivo manualmente
|
| 14 |
+
%PYTHON_PATH% -m pip uninstall -y opencv-python
|
| 15 |
+
del /F /Q "C:\Users\luisf\AppData\Roaming\Python\Python312\site-packages\cv2\cv2.pyd"
|
| 16 |
+
%PYTHON_PATH% -m pip install --user --force-reinstall -r %REPO%
|
| 17 |
+
pause
|
commandos/actualiza1.bat
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
set REPO=%1
|
| 3 |
+
set PYTHON_PATH=D:\ComfyUI_cu128_50XX\python_embeded\python.exe
|
| 4 |
+
|
| 5 |
+
:: Verifica se o script está sendo executado como administrador
|
| 6 |
+
openfiles >nul 2>&1
|
| 7 |
+
if %errorlevel% NEQ 0 (
|
| 8 |
+
echo Por favor, execute este script como administrador.
|
| 9 |
+
pause
|
| 10 |
+
exit /b
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
:: Desinstalar pacotes conflitantes
|
| 14 |
+
%PYTHON_PATH% -m pip uninstall -y numpy pillow setuptools markupsafe urllib3 torch
|
| 15 |
+
|
| 16 |
+
:: Instalar versões compatíveis dos pacotes
|
| 17 |
+
%PYTHON_PATH% -m pip install numpy==1.26.4 Pillow==10.2.0 setuptools==75.2.0 markupsafe==2.0.1 urllib3==1.26.16 torch==1.11.0+cpu
|
| 18 |
+
|
| 19 |
+
:: Instalar dependências do repositório
|
| 20 |
+
%PYTHON_PATH% -m pip install --user --force-reinstall -r %REPO%
|
| 21 |
+
|
| 22 |
+
:: Verificar instalação das dependências
|
| 23 |
+
%PYTHON_PATH% -m pip check
|
| 24 |
+
|
| 25 |
+
pause
|
commandos/aliases.bat
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
;= @echo off
|
| 2 |
+
;= rem Call DOSKEY and use this file as the macrofile
|
| 3 |
+
;= %SystemRoot%\system32\doskey /listsize=1000 /macrofile=%0%
|
| 4 |
+
;= rem In batch mode, jump to the end of the file
|
| 5 |
+
;= goto :end
|
| 6 |
+
;= rem ******************************************************************
|
| 7 |
+
;= rem * Filename: aliases.bat
|
| 8 |
+
;= rem * Source: http://ben.versionzero.org/wiki/Doskey_Macros
|
| 9 |
+
;= rem * Version: 1.0
|
| 10 |
+
;= rem * Author: Ben Burnett <me@cs.wisc.edu>
|
| 11 |
+
;= rem * Purpose: Simple, but useful aliases; this can be done by
|
| 12 |
+
;= rem * other means--of course--but this is dead simple and
|
| 13 |
+
;= rem * works on EVERY Windows machine on the planet.
|
| 14 |
+
;= rem * History:
|
| 15 |
+
;= rem * 22/01/2002: File Created (Syncrude Canada).
|
| 16 |
+
;= rem * 01/05/2007: Updated author's address, added new macros, a
|
| 17 |
+
;= rem * history and some new helpful comments.
|
| 18 |
+
;= rem * 19/06/2007: Added Notepad, Explorer and Emacs macros.
|
| 19 |
+
;= rem * 20/06/2007: Fixed doskey macrofile= path problem: it is now not
|
| 20 |
+
;= rem * a relative path, so it can be called from anywhere.
|
| 21 |
+
;= rem ******************************************************************
|
| 22 |
+
|
| 23 |
+
;= Doskey aliases
|
| 24 |
+
h=doskey /history
|
| 25 |
+
|
| 26 |
+
;= File listing enhancements
|
| 27 |
+
:=ls=dir /x $*
|
| 28 |
+
l=dir /x $*
|
| 29 |
+
ll=dir /w $*
|
| 30 |
+
la=dir /x /a $*
|
| 31 |
+
|
| 32 |
+
;= Directory navigation
|
| 33 |
+
up=cd ..
|
| 34 |
+
pd=pushd
|
| 35 |
+
|
| 36 |
+
;= Copy and move macros
|
| 37 |
+
;=cp=copy
|
| 38 |
+
:=mv=move
|
| 39 |
+
|
| 40 |
+
;= Delete macros
|
| 41 |
+
;=rm=del /p $*
|
| 42 |
+
rmf=del /q $*
|
| 43 |
+
rmtmp=del /q *~ *# 2>nul
|
| 44 |
+
|
| 45 |
+
;= Fast access to Notepad
|
| 46 |
+
n=notepad $*
|
| 47 |
+
|
| 48 |
+
;= Fast access to Explorer
|
| 49 |
+
x=explorer .
|
| 50 |
+
|
| 51 |
+
;= :end
|
| 52 |
+
;= rem ******************************************************************
|
| 53 |
+
;= rem * EOF - Don't remove the following line. It clears out the ';'
|
| 54 |
+
;= rem * macro. We're using it because there is no support for comments
|
| 55 |
+
;= rem * in a DOSKEY macro file.
|
| 56 |
+
;= rem ******************************************************************
|
| 57 |
+
;=
|
commandos/arrancar-clawdbot.bat
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
title OpenClaw Launcher
|
| 3 |
+
|
| 4 |
+
echo A iniciar OpenClaw Gateway TUI...
|
| 5 |
+
start "" /D "C:\Users\luisf\clawd" cmd /k "openclaw gateway tui"
|
| 6 |
+
|
| 7 |
+
exit
|
commandos/arrancar-openclaw.bat
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
set NODE_OPTIONS=--stack-size=10000
|
| 3 |
+
echo A iniciar o OpenClaw Gateway com limite de pilha aumentado...
|
| 4 |
+
openclaw gateway start
|
| 5 |
+
pause
|
commandos/ativa_comfy310.ps1
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
conda activate comfy310
|
commandos/bash.ps1
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Caminho para o executável do Git Bash
|
| 2 |
+
$gitBash = "C:\Program Files\Git\bin\bash.exe"
|
| 3 |
+
|
| 4 |
+
# Diretório onde o comando foi executado
|
| 5 |
+
$cwd = (Get-Location).Path
|
| 6 |
+
|
| 7 |
+
# Abre o Git Bash nesse diretório
|
| 8 |
+
Start-Process -FilePath $gitBash -WorkingDirectory $cwd
|
commandos/build.bat
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
if exist MiSTer.card.o del MiSTer.card.o
|
| 3 |
+
vasmm68k_mot -quiet -Iinclude -Fhunk -phxass -opt-fconst -nowarn=62 MiSTer.card.asm
|
| 4 |
+
vc MiSTer.card.o -nostdlib -o MiSTer.card
|
| 5 |
+
echo Done.
|
| 6 |
+
|
| 7 |
+
rem pause 2 seconds
|
| 8 |
+
ping 127.0.0.1 -n 2 >nul
|
commandos/build_tool.ps1
ADDED
|
@@ -0,0 +1,930 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<#
|
| 2 |
+
.SYNOPSIS
|
| 3 |
+
build_tool - Compilador modular para múltiplas linguagens.
|
| 4 |
+
|
| 5 |
+
.DESCRIPTION
|
| 6 |
+
Detecta automaticamente o tipo de projeto e compila usando o comando
|
| 7 |
+
adequado. Suporta: Rust, Python, C, C++, Go, JavaScript/Node, TypeScript, Java.
|
| 8 |
+
#>
|
| 9 |
+
|
| 10 |
+
$BuildToolVersion = "1.0.0"
|
| 11 |
+
|
| 12 |
+
# ============================================================================
|
| 13 |
+
# FUNÇÕES AUXILIARES
|
| 14 |
+
# ============================================================================
|
| 15 |
+
|
| 16 |
+
Function Global:Detect-Language {
|
| 17 |
+
<#
|
| 18 |
+
.DESCRIPTION
|
| 19 |
+
Detecta automaticamente a linguagem do projeto analisando arquivos de configuração.
|
| 20 |
+
#>
|
| 21 |
+
Param(
|
| 22 |
+
[string]$Path
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
# Verificar arquivos de configuração comuns
|
| 26 |
+
$configFiles = @(
|
| 27 |
+
"Cargo.toml",
|
| 28 |
+
"package.json",
|
| 29 |
+
"pkg.json",
|
| 30 |
+
"setup.py",
|
| 31 |
+
"pyproject.toml",
|
| 32 |
+
"CMakeLists.txt",
|
| 33 |
+
"CMakeLists",
|
| 34 |
+
"Makefile",
|
| 35 |
+
"Gopkg.toml",
|
| 36 |
+
"go.mod",
|
| 37 |
+
"build.gradle",
|
| 38 |
+
"build.gradle.kts",
|
| 39 |
+
"pom.xml",
|
| 40 |
+
"build.pom.xml",
|
| 41 |
+
".csproj",
|
| 42 |
+
".vbproj",
|
| 43 |
+
".fsproj",
|
| 44 |
+
".psm1",
|
| 45 |
+
"Rakefile",
|
| 46 |
+
"Gemfile"
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
foreach ($cfg in $configFiles) {
|
| 50 |
+
$cfgPath = Join-Path $Path $cfg
|
| 51 |
+
if (Test-Path $cfgPath) {
|
| 52 |
+
# Determinar linguagem baseado no arquivo
|
| 53 |
+
switch ($cfg) {
|
| 54 |
+
"Cargo.toml" { return "Rust" }
|
| 55 |
+
"setup.py" { return "Python" }
|
| 56 |
+
"pyproject.toml" { return "Python" }
|
| 57 |
+
"Gopkg.toml" { return "Rust" }
|
| 58 |
+
"go.mod" { return "Go" }
|
| 59 |
+
"build.gradle" { return "Java" }
|
| 60 |
+
"build.gradle.kts" { return "Java" }
|
| 61 |
+
"pom.xml" { return "Java" }
|
| 62 |
+
"build.pom.xml" { return "Java" }
|
| 63 |
+
"build.gradle.kts" { return "Java" }
|
| 64 |
+
".vbproj" { return "VB.NET" }
|
| 65 |
+
".csproj" { return "C#" }
|
| 66 |
+
".fsproj" { return "F#" }
|
| 67 |
+
".psm1" { return "PowerShell" }
|
| 68 |
+
default { return "C" }
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
# Fallback: tentar detectar pelo conteúdo de arquivos fonte
|
| 74 |
+
$sourcePatterns = @{
|
| 75 |
+
"*.rs" = "Rust"
|
| 76 |
+
"*.py" = "Python"
|
| 77 |
+
"*.c" = "C"
|
| 78 |
+
"*.cpp" = "C++"
|
| 79 |
+
"*.h" = "C++"
|
| 80 |
+
"*.go" = "Go"
|
| 81 |
+
"*.java" = "Java"
|
| 82 |
+
"*.ts" = "TypeScript"
|
| 83 |
+
"*.tsx" = "TypeScript"
|
| 84 |
+
"*.js" = "JavaScript"
|
| 85 |
+
"*.cs" = "C#"
|
| 86 |
+
"*.vb" = "VB.NET"
|
| 87 |
+
"*.fs" = "F#"
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
foreach ($pair in $sourcePatterns.GetEnumerator()) {
|
| 91 |
+
$pattern = $pair.Key
|
| 92 |
+
$lang = $pair.Value
|
| 93 |
+
$files = Get-ChildItem -Path $Path -Include $pattern -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
|
| 94 |
+
if ($files) {
|
| 95 |
+
return $lang
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
return "Unknown"
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
Function Global:Get-Compiler {
|
| 103 |
+
<#
|
| 104 |
+
.DESCRIPTION
|
| 105 |
+
Retorna o comando e argumentos do compilador adequado para cada linguagem.
|
| 106 |
+
#>
|
| 107 |
+
Param(
|
| 108 |
+
[string]$Language,
|
| 109 |
+
[string]$SourceFile,
|
| 110 |
+
[string]$OutputFile
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
$compilers = @{
|
| 114 |
+
"Rust" = @{
|
| 115 |
+
Command = "cargo"
|
| 116 |
+
Args = "build"
|
| 117 |
+
Source = "Cargo.toml"
|
| 118 |
+
Output = "target/debug/"
|
| 119 |
+
Executable = "debug/<name>"
|
| 120 |
+
}
|
| 121 |
+
"Python" = @{
|
| 122 |
+
Command = "pip"
|
| 123 |
+
Args = "install -e ."
|
| 124 |
+
Source = "setup.py"
|
| 125 |
+
Output = "dist/"
|
| 126 |
+
Executable = "app.exe"
|
| 127 |
+
}
|
| 128 |
+
"JavaScript" = @{
|
| 129 |
+
Command = "npm"
|
| 130 |
+
Args = "run build"
|
| 131 |
+
Source = "package.json"
|
| 132 |
+
Output = "dist/"
|
| 133 |
+
Executable = "dist/<name>.js"
|
| 134 |
+
}
|
| 135 |
+
"TypeScript" = @{
|
| 136 |
+
Command = "npm"
|
| 137 |
+
Args = "run build"
|
| 138 |
+
Source = "package.json"
|
| 139 |
+
Output = "dist/"
|
| 140 |
+
Executable = "dist/<name>.js"
|
| 141 |
+
}
|
| 142 |
+
"C" = @{
|
| 143 |
+
Command = "gcc"
|
| 144 |
+
Args = "-o $OutputFile $SourceFile"
|
| 145 |
+
Output = "output.exe"
|
| 146 |
+
}
|
| 147 |
+
"C++" = @{
|
| 148 |
+
Command = "g++"
|
| 149 |
+
Args = "-o $OutputFile $SourceFile"
|
| 150 |
+
Output = "output.exe"
|
| 151 |
+
}
|
| 152 |
+
"Go" = @{
|
| 153 |
+
Command = "go"
|
| 154 |
+
Args = "build -o $OutputFile ./"
|
| 155 |
+
Output = "output.exe"
|
| 156 |
+
}
|
| 157 |
+
"Java" = @{
|
| 158 |
+
Command = "mvn"
|
| 159 |
+
Args = "package"
|
| 160 |
+
Source = "pom.xml"
|
| 161 |
+
Output = "target/"
|
| 162 |
+
Executable = "target/<artifact>-jar-dependencies.jar"
|
| 163 |
+
}
|
| 164 |
+
"VB.NET" = @{
|
| 165 |
+
Command = "dotnet"
|
| 166 |
+
Args = "build"
|
| 167 |
+
Source = ".vbproj"
|
| 168 |
+
Output = "bin/"
|
| 169 |
+
Executable = "bin/<name>.dll"
|
| 170 |
+
}
|
| 171 |
+
"C#" = @{
|
| 172 |
+
Command = "dotnet"
|
| 173 |
+
Args = "build"
|
| 174 |
+
Source = ".csproj"
|
| 175 |
+
Output = "bin/"
|
| 176 |
+
Executable = "bin/<name>.dll"
|
| 177 |
+
}
|
| 178 |
+
"F#" = @{
|
| 179 |
+
Command = "dotnet"
|
| 180 |
+
Args = "build"
|
| 181 |
+
Source = ".fsproj"
|
| 182 |
+
Output = "bin/"
|
| 183 |
+
Executable = "bin/<name>.dll"
|
| 184 |
+
}
|
| 185 |
+
"PowerShell" = @{
|
| 186 |
+
Command = "pwsh"
|
| 187 |
+
Args = "-NoProfile -ExecutionPolicy Bypass"
|
| 188 |
+
Source = "*.ps1"
|
| 189 |
+
Output = "bin/"
|
| 190 |
+
Executable = "bin/<name>.ps1"
|
| 191 |
+
}
|
| 192 |
+
"Ruby" = @{
|
| 193 |
+
Command = "bundle"
|
| 194 |
+
Args = "exec rake"
|
| 195 |
+
Source = "Rakefile"
|
| 196 |
+
Output = "bin/"
|
| 197 |
+
Executable = "bin/<name>"
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
if ($compilers.ContainsKey($Language)) {
|
| 202 |
+
$comp = $compilers[$Language]
|
| 203 |
+
return $comp
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
return @{ Command="unknown"; Args="" }
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
Function Global:Check-Compiler-Available {
|
| 210 |
+
<#
|
| 211 |
+
.DESCRIPTION
|
| 212 |
+
Verifica se um compilador/interpreter está disponível no sistema.
|
| 213 |
+
#>
|
| 214 |
+
Param(
|
| 215 |
+
[string]$Compiler
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
try {
|
| 219 |
+
$version = & $Compiler --version 2>&1
|
| 220 |
+
return $LASTEXITCODE -eq 0
|
| 221 |
+
} catch {
|
| 222 |
+
return $false
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
Function Global:Find-Compiler {
|
| 227 |
+
<#
|
| 228 |
+
.DESCRIPTION
|
| 229 |
+
Tenta encontrar o compilador em diferentes locais.
|
| 230 |
+
#>
|
| 231 |
+
Param(
|
| 232 |
+
[string]$Compiler
|
| 233 |
+
)
|
| 234 |
+
|
| 235 |
+
# Tentar sem caminho primeiro
|
| 236 |
+
if (Test-Path $Compiler) {
|
| 237 |
+
return $Compiler
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
# Tentar em PATH
|
| 241 |
+
try {
|
| 242 |
+
$compilerInPath = $null
|
| 243 |
+
if ($Compiler -eq "python" -or $Compiler -eq "python3") {
|
| 244 |
+
# Python pode estar em múltiplos locais
|
| 245 |
+
foreach ($pyPath in @("python", "python3", "C:\Python*Python.exe", "C:\Python*python.exe")) {
|
| 246 |
+
if (Test-Path $pyPath) { return $pyPath }
|
| 247 |
+
}
|
| 248 |
+
} elseif ($Compiler -eq "npm" -or $Compiler -eq "node") {
|
| 249 |
+
foreach ($nodePath in @("node", "C:\Program Files\nodejs\node.exe", "C:\npm\node.exe")) {
|
| 250 |
+
if (Test-Path $nodePath) { return $nodePath }
|
| 251 |
+
}
|
| 252 |
+
} elseif ($Compiler -eq "cargo" -or $Compiler -eq "rustc") {
|
| 253 |
+
foreach ($rustPath in @("cargo", "rustc", "C:\Program Files\rga\cargo.exe", "C:\Program Files\rga\rustc.exe", "$env:LOCALAPPDATA\Programs\rust", "C:\msys64\mingw64\bin", "C:\msys64\usr\bin")) {
|
| 254 |
+
if (Test-Path $rustPath) { return $rustPath }
|
| 255 |
+
}
|
| 256 |
+
} elseif ($Compiler -eq "gcc" -or $Compiler -eq "g++" -or $Compiler -eq "clang") {
|
| 257 |
+
foreach ($gccPath in @("gcc", "g++", "clang", "clang++", "C:\Program Files\LLVM\bin", "C:\MinGW\bin", "$env:PATH")) {
|
| 258 |
+
try {
|
| 259 |
+
if (Test-Path $gccPath) { return $gccPath }
|
| 260 |
+
} catch {}
|
| 261 |
+
}
|
| 262 |
+
} elseif ($Compiler -eq "go") {
|
| 263 |
+
foreach ($goPath in @("go", "C:\Program Files\go\go.exe", "$env:GOROOT\bin\go.exe")) {
|
| 264 |
+
if (Test-Path $goPath) { return $goPath }
|
| 265 |
+
}
|
| 266 |
+
} elseif ($Compiler -eq "mvn") {
|
| 267 |
+
foreach ($mvnPath in @("mvn", "C:\Program Files\Apache Maven\bin\mvn.cmd", "C:\Program Files\Apache Maven3\bin\mvn.cmd")) {
|
| 268 |
+
if (Test-Path $mvnPath) { return $mvnPath }
|
| 269 |
+
}
|
| 270 |
+
} elseif ($Compiler -eq "dotnet") {
|
| 271 |
+
if (Test-Path "dotnet") { return "dotnet" }
|
| 272 |
+
}
|
| 273 |
+
} catch {}
|
| 274 |
+
|
| 275 |
+
return $null
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
Function Global:Parse-Project-Config {
|
| 279 |
+
<#
|
| 280 |
+
.DESCRIPTION
|
| 281 |
+
Extrai informações de configuração de projeto.
|
| 282 |
+
#>
|
| 283 |
+
Param(
|
| 284 |
+
[string]$Path,
|
| 285 |
+
[string]$ConfigFile
|
| 286 |
+
)
|
| 287 |
+
|
| 288 |
+
$configPath = Join-Path $Path $ConfigFile
|
| 289 |
+
|
| 290 |
+
if (-not (Test-Path $configPath)) {
|
| 291 |
+
return $null
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
try {
|
| 295 |
+
# Tentar JSON primeiro
|
| 296 |
+
$config = Get-Content $configPath -ErrorAction SilentlyContinue | ConvertFrom-Json
|
| 297 |
+
|
| 298 |
+
return @{
|
| 299 |
+
Name = $config.name
|
| 300 |
+
Version = $config.version
|
| 301 |
+
Output = $config.output
|
| 302 |
+
MainFile = $config.main || $config.entry
|
| 303 |
+
Source = $config.source || $config.src
|
| 304 |
+
Dependencies = $config.dependencies
|
| 305 |
+
Scripts = $config.scripts
|
| 306 |
+
}
|
| 307 |
+
} catch {
|
| 308 |
+
# Tentar XML para projetos .NET
|
| 309 |
+
if ($configPath -like "*.xml") {
|
| 310 |
+
return @{
|
| 311 |
+
Name = $config.productname
|
| 312 |
+
Version = $config.version
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
return $null
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
Function Global:Format-Build-Result {
|
| 321 |
+
<#
|
| 322 |
+
.DESCRIPTION
|
| 323 |
+
Cria um objeto de resultado estruturado para build.
|
| 324 |
+
#>
|
| 325 |
+
Param(
|
| 326 |
+
[Parameter(Mandatory=$true)]
|
| 327 |
+
[string]$Status, # success, fail, partial
|
| 328 |
+
|
| 329 |
+
[Parameter(Mandatory=$true)]
|
| 330 |
+
[string]$Command,
|
| 331 |
+
|
| 332 |
+
[Parameter(Mandatory=$true)]
|
| 333 |
+
[double]$Duration,
|
| 334 |
+
|
| 335 |
+
[string]$OutputPath = $null,
|
| 336 |
+
|
| 337 |
+
[string]$Errors = $null,
|
| 338 |
+
|
| 339 |
+
[string]$Warnings = $null
|
| 340 |
+
)
|
| 341 |
+
|
| 342 |
+
$result = [PSCustomObject] @{
|
| 343 |
+
Status = $Status
|
| 344 |
+
Command = $Command
|
| 345 |
+
Duration = $Duration
|
| 346 |
+
OutputPath = $OutputPath
|
| 347 |
+
Errors = $Errors
|
| 348 |
+
Warnings = $Warnings
|
| 349 |
+
Timestamp = Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ"
|
| 350 |
+
Language = "unknown"
|
| 351 |
+
Mode = "compile"
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
return $result
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
# ============================================================================
|
| 358 |
+
# FUNÇÃO PRINCIPAL
|
| 359 |
+
# ============================================================================
|
| 360 |
+
|
| 361 |
+
Function Global:Build-Project {
|
| 362 |
+
<#
|
| 363 |
+
.SYNOPSIS
|
| 364 |
+
Compila um projeto detectando automaticamente a linguagem.
|
| 365 |
+
|
| 366 |
+
.DESCRIPTION
|
| 367 |
+
Detecta o tipo de projeto, verifica ferramentas necessárias,
|
| 368 |
+
executa compilação e retorna resultado estruturado.
|
| 369 |
+
|
| 370 |
+
.PARAMETER Path
|
| 371 |
+
Caminho para o diretório do projeto a compilar.
|
| 372 |
+
|
| 373 |
+
.PARAMETER Output
|
| 374 |
+
Caminho de saída do executável ou bundle gerado.
|
| 375 |
+
|
| 376 |
+
.PARAMETER Mode
|
| 377 |
+
Modo de operação:
|
| 378 |
+
- compile: compila padrão
|
| 379 |
+
- bundle: cria executável bundlado
|
| 380 |
+
- lint: executa análise estática
|
| 381 |
+
- clean: limpa diretórios de build
|
| 382 |
+
- test: executa testes
|
| 383 |
+
|
| 384 |
+
.PARAMETER Quiet
|
| 385 |
+
Modo silencioso - minimiza output durante o build.
|
| 386 |
+
|
| 387 |
+
.PARAMETER Verbose
|
| 388 |
+
Mostra mais detalhes durante o processo de compilação.
|
| 389 |
+
|
| 390 |
+
.EXAMPLE
|
| 391 |
+
Build-Project -Path "C:\myproject"
|
| 392 |
+
|
| 393 |
+
.EXAMPLE
|
| 394 |
+
Build-Project -Path "C:\rustproject" -Mode "bundle" -Output "dist\app.exe"
|
| 395 |
+
#>
|
| 396 |
+
[CmdletBinding()]
|
| 397 |
+
Param(
|
| 398 |
+
[Parameter(Mandatory=$true)]
|
| 399 |
+
[string]$Path,
|
| 400 |
+
|
| 401 |
+
[string]$Output,
|
| 402 |
+
|
| 403 |
+
[string]$Mode = "compile",
|
| 404 |
+
|
| 405 |
+
[switch]$Quiet,
|
| 406 |
+
|
| 407 |
+
[switch]$Verbose
|
| 408 |
+
)
|
| 409 |
+
|
| 410 |
+
$startTime = Get-Date
|
| 411 |
+
$results = [PSCustomObject]@{
|
| 412 |
+
Status = "fail"
|
| 413 |
+
Command = "unknown"
|
| 414 |
+
Duration = 0
|
| 415 |
+
OutputPath = $null
|
| 416 |
+
Errors = $null
|
| 417 |
+
Warnings = $null
|
| 418 |
+
Language = "unknown"
|
| 419 |
+
Mode = $Mode
|
| 420 |
+
Timestamp = (Get-Date).ToString('yyyy-MM-ddTHH:mm:ssZ')
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
begin {
|
| 424 |
+
if ($Verbose) {
|
| 425 |
+
Write-Host "`n=== BUILD TOOL $BuildToolVersion ===" -ForegroundColor Cyan
|
| 426 |
+
Write-Host "Project Path: $Path" -ForegroundColor Yellow
|
| 427 |
+
Write-Host "Mode: $Mode" -ForegroundColor Yellow
|
| 428 |
+
}
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
process {
|
| 432 |
+
# Validar caminho
|
| 433 |
+
if (-not (Test-Path $Path)) {
|
| 434 |
+
if ($Quiet) {
|
| 435 |
+
$results.Status = "fail"
|
| 436 |
+
$results.Errors = "Project path does not exist: $Path"
|
| 437 |
+
return $results
|
| 438 |
+
}
|
| 439 |
+
Write-Host "❌ Error: Project path does not exist: $Path" -ForegroundColor Red
|
| 440 |
+
return $results
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
# Detectar linguagem
|
| 444 |
+
$language = Detect-Language -Path $Path
|
| 445 |
+
$results.Language = $language
|
| 446 |
+
|
| 447 |
+
if ($language -eq "Unknown") {
|
| 448 |
+
if (-not $Quiet) {
|
| 449 |
+
Write-Host "❌ Error: Could not detect project language. Supported: Rust, Python, C, C++, Go, JavaScript, TypeScript, Java, Ruby, VB.NET, C#, F#, PowerShell" -ForegroundColor Red
|
| 450 |
+
}
|
| 451 |
+
$results.Errors = "Could not detect project language. Supported: Rust, Python, C, C++, Go, JavaScript, TypeScript, Java, Ruby, VB.NET, C#, F#, PowerShell"
|
| 452 |
+
return $results
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
if (-not $Quiet) {
|
| 456 |
+
Write-Host "✅ Detected project language: $language" -ForegroundColor Green
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
# Encontrar arquivo de configuração principal
|
| 460 |
+
$configFile = $null
|
| 461 |
+
$config = $null
|
| 462 |
+
|
| 463 |
+
switch ($language) {
|
| 464 |
+
"Rust" { $configFile = "Cargo.toml" }
|
| 465 |
+
"Python" { $configFile = "setup.py"; $altConfig = "pyproject.toml" }
|
| 466 |
+
"JavaScript" { $configFile = "package.json" }
|
| 467 |
+
"TypeScript" { $configFile = "package.json" }
|
| 468 |
+
"C" { $configFile = "Makefile" }
|
| 469 |
+
"C++" { $configFile = "CMakeLists.txt" }
|
| 470 |
+
"Go" { $configFile = "go.mod" }
|
| 471 |
+
"Java" { $configFile = "pom.xml"; $altConfig = "build.gradle" }
|
| 472 |
+
"Ruby" { $configFile = "Rakefile" }
|
| 473 |
+
"VB.NET" { $configFile = ".vbproj" }
|
| 474 |
+
"C#" { $configFile = ".csproj" }
|
| 475 |
+
"F#" { $configFile = ".fsproj" }
|
| 476 |
+
"PowerShell" { $configFile = "*.psm1" }
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
# Verificar arquivo de configuração
|
| 480 |
+
$fullConfigPath = Join-Path $Path $configFile
|
| 481 |
+
if (-not (Test-Path $fullConfigPath)) {
|
| 482 |
+
if (-not $Quiet) {
|
| 483 |
+
Write-Host "⚠️ Warning: Config file not found: $configFile" -ForegroundColor Yellow
|
| 484 |
+
}
|
| 485 |
+
} else {
|
| 486 |
+
$config = Parse-Project-Config -Path $Path -ConfigFile $configFile
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
# Modo clean
|
| 490 |
+
if ($Mode -eq "clean") {
|
| 491 |
+
if (-not $Quiet) {
|
| 492 |
+
Write-Host "🧹 Cleaning build artifacts..." -ForegroundColor Cyan
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
# Identificar diretórios de build
|
| 496 |
+
$buildDirs = @(
|
| 497 |
+
"target", # Rust, .NET
|
| 498 |
+
"build", # C/C++
|
| 499 |
+
"dist", # JavaScript
|
| 500 |
+
"bin", # .NET
|
| 501 |
+
"__pycache__", # Python
|
| 502 |
+
".pytest_cache", # Python tests
|
| 503 |
+
".tox", # Python
|
| 504 |
+
"node_modules" # NPM
|
| 505 |
+
)
|
| 506 |
+
|
| 507 |
+
foreach ($dir in $buildDirs) {
|
| 508 |
+
$dirPath = Join-Path $Path $dir
|
| 509 |
+
if (Test-Path $dirPath) {
|
| 510 |
+
if ($Quiet) {
|
| 511 |
+
$null = Remove-Item -Path $dirPath -Recurse -Force -ErrorAction SilentlyContinue
|
| 512 |
+
continue
|
| 513 |
+
}
|
| 514 |
+
Write-Host " Removing: $dirPath" -ForegroundColor Gray
|
| 515 |
+
$null = Remove-Item -Path $dirPath -Recurse -Force -ErrorAction SilentlyContinue
|
| 516 |
+
}
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
$results.Status = "success"
|
| 520 |
+
$results.Command = "clean"
|
| 521 |
+
$results.Duration = (Get-Date).Subtract($startTime).TotalSeconds
|
| 522 |
+
if ($Quiet) {
|
| 523 |
+
return $results
|
| 524 |
+
}
|
| 525 |
+
Write-Host "✅ Build artifacts cleaned." -ForegroundColor Green
|
| 526 |
+
return $results
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
# Modo lint
|
| 530 |
+
if ($Mode -eq "lint") {
|
| 531 |
+
if ($Quiet) {
|
| 532 |
+
$results.Status = "partial"
|
| 533 |
+
$results.Command = "lint"
|
| 534 |
+
$results.OutputPath = Join-Path $Path ".lint_report"
|
| 535 |
+
return $results
|
| 536 |
+
}
|
| 537 |
+
Write-Host "📝 Running linting checks..." -ForegroundColor Cyan
|
| 538 |
+
|
| 539 |
+
switch ($language) {
|
| 540 |
+
"JavaScript" {
|
| 541 |
+
if (Test-Path (Join-Path $Path "package.json")) {
|
| 542 |
+
try {
|
| 543 |
+
$null = Invoke-Expression "npm run lint 2>&1" 2>&1
|
| 544 |
+
$exitCode = $LASTEXITCODE
|
| 545 |
+
if ($exitCode -eq 0) {
|
| 546 |
+
$results.Status = "success"
|
| 547 |
+
} else {
|
| 548 |
+
$results.Status = "partial"
|
| 549 |
+
}
|
| 550 |
+
} catch {
|
| 551 |
+
$results.Status = "partial"
|
| 552 |
+
}
|
| 553 |
+
}
|
| 554 |
+
}
|
| 555 |
+
"Python" {
|
| 556 |
+
if (Test-Path (Join-Path $Path "setup.py")) {
|
| 557 |
+
try {
|
| 558 |
+
$null = Invoke-Expression "python -m py_compile ." 2>&1
|
| 559 |
+
$exitCode = $LASTEXITCODE
|
| 560 |
+
if ($exitCode -eq 0) {
|
| 561 |
+
$results.Status = "success"
|
| 562 |
+
} else {
|
| 563 |
+
$results.Status = "partial"
|
| 564 |
+
}
|
| 565 |
+
} catch {
|
| 566 |
+
$results.Status = "partial"
|
| 567 |
+
}
|
| 568 |
+
}
|
| 569 |
+
}
|
| 570 |
+
"Rust" {
|
| 571 |
+
try {
|
| 572 |
+
$null = Invoke-Expression "cargo check 2>&1" 2>&1
|
| 573 |
+
$exitCode = $LASTEXITCODE
|
| 574 |
+
if ($exitCode -eq 0) {
|
| 575 |
+
$results.Status = "success"
|
| 576 |
+
} else {
|
| 577 |
+
$results.Status = "partial"
|
| 578 |
+
}
|
| 579 |
+
} catch {
|
| 580 |
+
$results.Status = "partial"
|
| 581 |
+
}
|
| 582 |
+
}
|
| 583 |
+
"Go" {
|
| 584 |
+
try {
|
| 585 |
+
$null = Invoke-Expression "go vet ./... 2>&1" 2>&1
|
| 586 |
+
$exitCode = $LASTEXITCODE
|
| 587 |
+
if ($exitCode -eq 0) {
|
| 588 |
+
$results.Status = "success"
|
| 589 |
+
} else {
|
| 590 |
+
$results.Status = "partial"
|
| 591 |
+
}
|
| 592 |
+
} catch {
|
| 593 |
+
$results.Status = "partial"
|
| 594 |
+
}
|
| 595 |
+
}
|
| 596 |
+
"Java" {
|
| 597 |
+
try {
|
| 598 |
+
$null = Invoke-Expression "mvn checkstyle:check 2>&1" 2>&1
|
| 599 |
+
$exitCode = $LASTEXITCODE
|
| 600 |
+
if ($exitCode -eq 0) {
|
| 601 |
+
$results.Status = "success"
|
| 602 |
+
} else {
|
| 603 |
+
$results.Status = "partial"
|
| 604 |
+
}
|
| 605 |
+
} catch {
|
| 606 |
+
$results.Status = "partial"
|
| 607 |
+
}
|
| 608 |
+
}
|
| 609 |
+
"C" | "C++" {
|
| 610 |
+
try {
|
| 611 |
+
$null = Invoke-Expression "clang-format --diff . 2>&1" 2>&1
|
| 612 |
+
$exitCode = $LASTEXITCODE
|
| 613 |
+
if ($exitCode -eq 0) {
|
| 614 |
+
$results.Status = "success"
|
| 615 |
+
} else {
|
| 616 |
+
$results.Status = "partial"
|
| 617 |
+
}
|
| 618 |
+
} catch {
|
| 619 |
+
$results.Status = "partial"
|
| 620 |
+
}
|
| 621 |
+
}
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
$results.Command = "lint"
|
| 625 |
+
$results.Duration = (Get-Date).Subtract($startTime).TotalSeconds
|
| 626 |
+
if ($Quiet) {
|
| 627 |
+
return $results
|
| 628 |
+
}
|
| 629 |
+
Write-Host "✅ Linting complete. Status: $($results.Status)" -ForegroundColor Gray
|
| 630 |
+
return $results
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
# Modo test
|
| 634 |
+
if ($Mode -eq "test") {
|
| 635 |
+
if ($Quiet) {
|
| 636 |
+
$results.Status = "partial"
|
| 637 |
+
$results.Command = "test"
|
| 638 |
+
$results.OutputPath = Join-Path $Path ".test_results"
|
| 639 |
+
return $results
|
| 640 |
+
}
|
| 641 |
+
Write-Host "🧪 Running tests..." -ForegroundColor Cyan
|
| 642 |
+
|
| 643 |
+
switch ($language) {
|
| 644 |
+
"Rust" {
|
| 645 |
+
try {
|
| 646 |
+
$null = Invoke-Expression "cargo test --no-fail-fast 2>&1" 2>&1
|
| 647 |
+
$exitCode = $LASTEXITCODE
|
| 648 |
+
} catch { $exitCode = $LASTEXITCODE }
|
| 649 |
+
}
|
| 650 |
+
"Python" {
|
| 651 |
+
try {
|
| 652 |
+
$null = Invoke-Expression "python -m unittest discover -s . 2>&1" 2>&1
|
| 653 |
+
$exitCode = $LASTEXITCODE
|
| 654 |
+
} catch { $exitCode = $LASTEXITCODE }
|
| 655 |
+
}
|
| 656 |
+
"JavaScript" {
|
| 657 |
+
try {
|
| 658 |
+
$null = Invoke-Expression "npm run test 2>&1" 2>&1
|
| 659 |
+
$exitCode = $LASTEXITCODE
|
| 660 |
+
} catch { $exitCode = $LASTEXITCODE }
|
| 661 |
+
}
|
| 662 |
+
"Go" {
|
| 663 |
+
try {
|
| 664 |
+
$null = Invoke-Expression "go test ./... -v 2>&1" 2>&1
|
| 665 |
+
$exitCode = $LASTEXITCODE
|
| 666 |
+
} catch { $exitCode = $LASTEXITCODE }
|
| 667 |
+
}
|
| 668 |
+
"Java" {
|
| 669 |
+
try {
|
| 670 |
+
$null = Invoke-Expression "mvn test 2>&1" 2>&1
|
| 671 |
+
$exitCode = $LASTEXITCODE
|
| 672 |
+
} catch { $exitCode = $LASTEXITCODE }
|
| 673 |
+
}
|
| 674 |
+
"Ruby" {
|
| 675 |
+
try {
|
| 676 |
+
$null = Invoke-Expression "bundle exec rake test 2>&1" 2>&1
|
| 677 |
+
$exitCode = $LASTEXITCODE
|
| 678 |
+
} catch { $exitCode = $LASTEXITCODE }
|
| 679 |
+
}
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
if ($exitCode -eq 0) {
|
| 683 |
+
$results.Status = "success"
|
| 684 |
+
} else {
|
| 685 |
+
$results.Status = "partial"
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
$results.Command = "test"
|
| 689 |
+
$results.Duration = (Get-Date).Subtract($startTime).TotalSeconds
|
| 690 |
+
if ($Quiet) {
|
| 691 |
+
return $results
|
| 692 |
+
}
|
| 693 |
+
Write-Host "✅ Tests complete. Status: $($results.Status)" -ForegroundColor Gray
|
| 694 |
+
return $results
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
# Modo bundle
|
| 698 |
+
if ($Mode -eq "bundle") {
|
| 699 |
+
if (-not $Quiet) {
|
| 700 |
+
Write-Host "📦 Creating bundled executable..." -ForegroundColor Cyan
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
$compiler = Get-Compiler -Language $language -OutputFile $Output
|
| 704 |
+
|
| 705 |
+
# Verificar se bundler está disponível
|
| 706 |
+
$bundleAvailable = $false
|
| 707 |
+
switch ($language) {
|
| 708 |
+
"Rust" {
|
| 709 |
+
$bundleAvailable = Check-Compiler-Available -Compiler "cargo-bundle"
|
| 710 |
+
if ($bundleAvailable) {
|
| 711 |
+
try {
|
| 712 |
+
$null = Invoke-Expression "cargo binstall cargo-bundle --force 2>&1" 2>&1
|
| 713 |
+
} catch {}
|
| 714 |
+
$bundleAvailable = Check-Compiler-Available -Compiler "cargo-bundle"
|
| 715 |
+
}
|
| 716 |
+
}
|
| 717 |
+
"Python" {
|
| 718 |
+
$bundleAvailable = Check-Compiler-Available -Compiler "pyinstaller"
|
| 719 |
+
}
|
| 720 |
+
"JavaScript" {
|
| 721 |
+
$bundleAvailable = Check-Compiler-Available -Compiler "webpack-cli"
|
| 722 |
+
}
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
if ($bundleAvailable) {
|
| 726 |
+
if ($Quiet) {
|
| 727 |
+
$results.Status = "success"
|
| 728 |
+
$results.Command = "bundle"
|
| 729 |
+
return $results
|
| 730 |
+
}
|
| 731 |
+
Write-Host "✅ Bundler available: $(if ($bundleAvailable) { 'yes' } else { 'no' })" -ForegroundColor Gray
|
| 732 |
+
} else {
|
| 733 |
+
if ($Quiet) {
|
| 734 |
+
$results.Errors = "Bundler not available for $language"
|
| 735 |
+
return $results
|
| 736 |
+
}
|
| 737 |
+
Write-Host "⚠️ Warning: Bundler not available, falling back to compilation" -ForegroundColor Yellow
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
+
$results.Command = "bundle"
|
| 741 |
+
$results.Status = "partial"
|
| 742 |
+
$results.Duration = (Get-Date).Subtract($startTime).TotalSeconds
|
| 743 |
+
if ($Quiet) {
|
| 744 |
+
return $results
|
| 745 |
+
}
|
| 746 |
+
Write-Host "✅ Bundle mode attempted (fallback to compile if bundler unavailable)" -ForegroundColor Gray
|
| 747 |
+
return $results
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
# Modo compile padrão
|
| 751 |
+
Write-Host "🔨 Compiling project ($language)..." -ForegroundColor Cyan
|
| 752 |
+
|
| 753 |
+
$compiler = Get-Compiler -Language $language -OutputFile $Output
|
| 754 |
+
|
| 755 |
+
# Verificar se compilador está disponível
|
| 756 |
+
$compilerAvailable = $false
|
| 757 |
+
$compilerPath = Find-Compiler -Compiler $compiler.Command
|
| 758 |
+
|
| 759 |
+
if ($compilerPath) {
|
| 760 |
+
$compilerAvailable = $true
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
if (-not $compilerAvailable) {
|
| 764 |
+
if ($Quiet) {
|
| 765 |
+
$results.Errors = "Compiler not found: $($compiler.Command)"
|
| 766 |
+
return $results
|
| 767 |
+
}
|
| 768 |
+
Write-Host "❌ Error: Compiler not found: $($compiler.Command)" -ForegroundColor Red
|
| 769 |
+
Write-Host " Please install $($compiler.Command) to compile $language projects." -ForegroundColor Yellow
|
| 770 |
+
$results.Errors = "Compiler not found: $($compiler.Command). Please install $($compiler.Command) to compile $language projects."
|
| 771 |
+
return $results
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
if ($Quiet) {
|
| 775 |
+
$results.Status = "success"
|
| 776 |
+
$results.Command = "$(if ($compiler.Command -eq "cargo") { "cargo build" } elseif ($compiler.Command -eq "npm") { "npm run build" } elseif ($compiler.Command -eq "pip" -and $language -eq "Python" ) { "pip install -e . " } elseif ($compiler.Command -eq "gcc") { "gcc -o output.exe source.c" } elseif ($compiler.Command -eq "dotnet") { "dotnet build" } elseif ($compiler.Command -eq "go") { "go build" } elseif ($compiler.Command -eq "python") { "python setup.py build" } elseif ($compiler.Command -eq "mvn") { "mvn package" } elseif ($compiler.Command -eq "bundle") { "bundle exec rake" } else { $compiler.Command })"
|
| 777 |
+
return $results
|
| 778 |
+
}
|
| 779 |
+
|
| 780 |
+
# Executar compilação
|
| 781 |
+
$commandBase = $compiler.Command
|
| 782 |
+
|
| 783 |
+
# Construir comando base
|
| 784 |
+
switch ($language) {
|
| 785 |
+
"Rust" {
|
| 786 |
+
$cmd = "cargo build"
|
| 787 |
+
if ($Output) {
|
| 788 |
+
$cmd = "cargo build --release -o $Output"
|
| 789 |
+
}
|
| 790 |
+
}
|
| 791 |
+
"Python" {
|
| 792 |
+
$cmd = "pip install -e ."
|
| 793 |
+
if ($config -and $config.Scripts) {
|
| 794 |
+
if ($config.Scripts.build) {
|
| 795 |
+
$cmd = "npm run build"
|
| 796 |
+
} elseif ($config.Scripts.install -match "python") {
|
| 797 |
+
$cmd = "pip install -e ."
|
| 798 |
+
}
|
| 799 |
+
}
|
| 800 |
+
}
|
| 801 |
+
"JavaScript" {
|
| 802 |
+
if ($config -and $config.Scripts) {
|
| 803 |
+
if ($config.Scripts.build) {
|
| 804 |
+
$cmd = "npm run build"
|
| 805 |
+
} elseif ($config.Scripts.dev) {
|
| 806 |
+
$cmd = "npm run dev"
|
| 807 |
+
} else {
|
| 808 |
+
$cmd = "npm run build"
|
| 809 |
+
}
|
| 810 |
+
} else {
|
| 811 |
+
$cmd = "npm run build"
|
| 812 |
+
}
|
| 813 |
+
}
|
| 814 |
+
"TypeScript" {
|
| 815 |
+
if ($config -and $config.Scripts) {
|
| 816 |
+
if ($config.Scripts.build) {
|
| 817 |
+
$cmd = "npm run build"
|
| 818 |
+
} elseif ($config.Scripts.dev) {
|
| 819 |
+
$cmd = "npm run dev"
|
| 820 |
+
} else {
|
| 821 |
+
$cmd = "npm run build"
|
| 822 |
+
}
|
| 823 |
+
} else {
|
| 824 |
+
$cmd = "npm run build"
|
| 825 |
+
}
|
| 826 |
+
}
|
| 827 |
+
"C" {
|
| 828 |
+
if ($configFile -eq "CMakeLists.txt") {
|
| 829 |
+
$cmd = "cmake --build build --config Release"
|
| 830 |
+
} elseif ($configFile -eq "Makefile") {
|
| 831 |
+
$cmd = "make"
|
| 832 |
+
} else {
|
| 833 |
+
$cmd = "gcc -o $Output $SourceFile"
|
| 834 |
+
}
|
| 835 |
+
}
|
| 836 |
+
"C++" {
|
| 837 |
+
if ($configFile -eq "CMakeLists.txt") {
|
| 838 |
+
$cmd = "cmake --build build --config Release"
|
| 839 |
+
} elseif ($configFile -eq "Makefile") {
|
| 840 |
+
$cmd = "make"
|
| 841 |
+
} else {
|
| 842 |
+
$cmd = "g++ -o $Output $SourceFile"
|
| 843 |
+
}
|
| 844 |
+
}
|
| 845 |
+
"Go" {
|
| 846 |
+
$cmd = "go build -o $Output ."
|
| 847 |
+
}
|
| 848 |
+
"Java" {
|
| 849 |
+
$cmd = "mvn package"
|
| 850 |
+
}
|
| 851 |
+
"VB.NET" {
|
| 852 |
+
$cmd = "dotnet build"
|
| 853 |
+
if ($Output) {
|
| 854 |
+
$cmd += " -o $Output"
|
| 855 |
+
}
|
| 856 |
+
}
|
| 857 |
+
"C#" {
|
| 858 |
+
$cmd = "dotnet build"
|
| 859 |
+
if ($Output) {
|
| 860 |
+
$cmd += " -o $Output"
|
| 861 |
+
}
|
| 862 |
+
}
|
| 863 |
+
"F#" {
|
| 864 |
+
$cmd = "dotnet build"
|
| 865 |
+
if ($Output) {
|
| 866 |
+
$cmd += " -o $Output"
|
| 867 |
+
}
|
| 868 |
+
}
|
| 869 |
+
"Ruby" {
|
| 870 |
+
$cmd = "bundle exec rake"
|
| 871 |
+
}
|
| 872 |
+
default {
|
| 873 |
+
$cmd = "build"
|
| 874 |
+
}
|
| 875 |
+
}
|
| 876 |
+
|
| 877 |
+
$results.Command = $cmd
|
| 878 |
+
Write-Host "Command: $cmd" -ForegroundColor Gray
|
| 879 |
+
|
| 880 |
+
if ($Verbose) {
|
| 881 |
+
Write-Host "Executing: $cmd" -ForegroundColor Cyan
|
| 882 |
+
}
|
| 883 |
+
|
| 884 |
+
try {
|
| 885 |
+
if ($Quiet) {
|
| 886 |
+
$null = Invoke-Expression $cmd
|
| 887 |
+
} else {
|
| 888 |
+
Invoke-Expression $cmd
|
| 889 |
+
}
|
| 890 |
+
} catch {
|
| 891 |
+
if ($Quiet) {
|
| 892 |
+
$results.Errors = $_.Exception.Message
|
| 893 |
+
return $results
|
| 894 |
+
}
|
| 895 |
+
Write-Host "❌ Compilation error: $_" -ForegroundColor Red
|
| 896 |
+
}
|
| 897 |
+
|
| 898 |
+
# Verificar resultado
|
| 899 |
+
$exitCode = $LASTEXITCODE
|
| 900 |
+
if ($exitCode -eq 0) {
|
| 901 |
+
$results.Status = "success"
|
| 902 |
+
} elseif ($exitCode -eq 1) {
|
| 903 |
+
$results.Status = "partial"
|
| 904 |
+
} else {
|
| 905 |
+
$results.Status = "fail"
|
| 906 |
+
}
|
| 907 |
+
|
| 908 |
+
$results.Duration = (Get-Date).Subtract($startTime).TotalSeconds
|
| 909 |
+
$results.OutputPath = if ($Output) { $Output } else { "build/$($language).exe" }
|
| 910 |
+
if ($Quiet) {
|
| 911 |
+
return $results
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
+
Write-Host "✅ Build complete! Duration: $($results.Duration) seconds" -ForegroundColor Green
|
| 915 |
+
Write-Host "Output: $($results.OutputPath)" -ForegroundColor Gray
|
| 916 |
+
return $results
|
| 917 |
+
}
|
| 918 |
+
|
| 919 |
+
end {
|
| 920 |
+
if ($Verbose -and $results.Status -ne "fail") {
|
| 921 |
+
Write-Host "`n=== Build Summary ===" -ForegroundColor Cyan
|
| 922 |
+
Write-Host "Status: $($results.Status)" -ForegroundColor $(if ($results.Status -eq "success") { "Green" } elseif ($results.Status -eq "partial") { "Yellow" } else { "Red" })
|
| 923 |
+
Write-Host "Duration: $($results.Duration) seconds" -ForegroundColor Gray
|
| 924 |
+
Write-Host "Command: $($results.Command)" -ForegroundColor Gray
|
| 925 |
+
}
|
| 926 |
+
}
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
# Export all functions
|
| 930 |
+
Export-ModuleMember -Function Build-Project, Detect-Language, Get-Compiler, Check-Compiler-Available, Find-Compiler, Parse-Project-Config, Format-Build-Result
|
commandos/c++-analyzer.bat
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
perl -S c++-analyzer %*
|
commandos/ccc-analyzer.bat
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
perl -S ccc-analyzer %*
|
commandos/clawdbot-universal.bat
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
title Clawdbot Universal Launcher
|
| 3 |
+
echo Iniciando Clawdbot com modelo qwen2.5:14b...
|
| 4 |
+
|
| 5 |
+
:: Passo 1: Iniciar o modelo no Ollama (em background)
|
| 6 |
+
start "" /B cmd /c "ollama run qwen2.5:14b"
|
| 7 |
+
|
| 8 |
+
:: Pausa breve para garantir que o modelo arranca
|
| 9 |
+
timeout /t 3 >nul
|
| 10 |
+
|
| 11 |
+
:: Passo 2: Iniciar o Gateway via WSL (assumindo que estás em ~/clawdbot)
|
| 12 |
+
wsl -e bash -c "cd ~/clawdbot && npx tsx start-gateway.ts"
|
| 13 |
+
|
| 14 |
+
:: Passo 3: Abrir o Canvas no browser
|
| 15 |
+
start http://127.0.0.1:18789/__clawdbot__/canvas/
|
| 16 |
+
|
| 17 |
+
exit
|
commandos/convert_mp4_to_mp3.bat
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
echo Iniciando conversão MP4 → MP3...
|
| 3 |
+
echo Certifique-se de ter o FFmpeg instalado!
|
| 4 |
+
|
| 5 |
+
ffmpeg -i "musica1.mp4" -q:a 0 -map a "musica1.mp3"
|
| 6 |
+
ffmpeg -i "video_aula.mp4" -q:a 0 -map a "video_aula.mp3"
|
| 7 |
+
ffmpeg -i "podcast_final.mp4" -q:a 0 -map a "podcast_final.mp3"
|
| 8 |
+
|
| 9 |
+
echo ✅ Tudo convertido! Pressione qualquer tecla para sair...
|
| 10 |
+
pause
|
commandos/copy-frame-d-to-e.bat
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
|
| 3 |
+
set "source=D:\framepack_cu126_torch26"
|
| 4 |
+
set "destination=E:\framepack_cu126_torch26"
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
robocopy "%source%" "%destination%" /E /IS /IT /R:3 /W:5 /NFL /NDL
|
| 9 |
+
echo Existing files were overwritten where needed.
|
| 10 |
+
pause
|
commandos/corgoogle.bat
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
echo Fechando o Google Chrome...
|
| 3 |
+
taskkill /F /IM chrome.exe >nul 2>&1
|
| 4 |
+
|
| 5 |
+
echo Limpando a cache do Google Chrome...
|
| 6 |
+
del /q /s "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Cache\*"
|
| 7 |
+
|
| 8 |
+
echo Cache limpa com sucesso!
|
| 9 |
+
pause
|
commandos/corgoogle.ps1
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Write-Output "Fechando o Google Chrome..."
|
| 2 |
+
Stop-Process -Name "chrome" -Force -ErrorAction SilentlyContinue
|
| 3 |
+
|
| 4 |
+
Write-Output "Limpando a cache do Google Chrome..."
|
| 5 |
+
Remove-Item "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cache\*" -Recurse -Force -ErrorAction SilentlyContinue
|
| 6 |
+
|
| 7 |
+
Write-Output "Cache limpa com sucesso!"
|
| 8 |
+
Pause
|
commandos/corrige-path.bat
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
setlocal enabledelayedexpansion
|
| 3 |
+
|
| 4 |
+
:: Define the existing PATH as provided
|
| 5 |
+
set "EXISTING_PATH=C:\py\pyenv\pyenv-win\bin;C:\py\pyenv\pyenv-win\shims;C:\py\pyenv\pyenv-win\bin;C:\py\pyenv\pyenv-win\shims;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Users\luisf\AppData\Local\pnpm;C:\Users\luisf\AppData\Local\Programs\oh-my-posh\bin;C:\Windows\system32;C:\Users\luisf\;"
|
| 6 |
+
|
| 7 |
+
:: List of essential paths to add based on your directories (deduplicated and prioritized for tools/compilers)
|
| 8 |
+
:: These are inferred from common bin directories in your C:\ root folders
|
| 9 |
+
set "NEW_PATHS=C:\mingw64\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin;C:\cmake\bin;C:\ninja;C:\ffmpeg-2024-10-13-git-e347b4ff31-full_build\bin;C:\node-v22.18.0-win-x64;C:\clang+llvm-19.1.1-x86_64-pc-windows-msvc\bin;C:\w64devkit-2.3.0\bin;C:\vcpkg;C:\nvm4w;C:\npm;C:\WinFBE_Suite\toolchains\FreeBASIC-1.10.0-winlibs-gcc-9.3.0\bin;C:\WinFBE_Suite\toolchains\FreeBASIC-1.10.0-winlibs-gcc-9.3.0\bin\win64;C:\VisualFBEditor.1.3.6\bin;C:\cygwin64\bin;C:\curl-8.9.1_3-win64-mingw\bin;C:\winlibs-x86_64-posix-seh-gcc-14.2.0-mingw-w64msvcrt-12.0.0-r3\bin;C:\VulkanSDK\Bin;C:\TensorRT\bin;C:\openvino\bin;C:\SDL3-3.2.20-win32-x64;C:\SDL\bin;C:\msys64\bin;C:\msys641\bin;C:\Powershell7;C:\python313\Scripts;C:\python313;C:\python311\Scripts;C:\python311;C:\python310\Scripts;C:\python310;C:\python38\Scripts;C:\python38;C:\TURBOC3\BIN;C:\rubberband\bin;C:\sox;C:\sqlite;C:\ffmpeg\bin;C:\ffmpeg-7.0.2-full_build\bin"
|
| 10 |
+
|
| 11 |
+
:: Combine existing and new paths, avoiding duplicates
|
| 12 |
+
set "FULL_PATH=!EXISTING_PATH!"
|
| 13 |
+
for %%p in (%NEW_PATHS:;= %) do (
|
| 14 |
+
echo !FULL_PATH! | findstr /C:"%%p" >nul
|
| 15 |
+
if errorlevel 1 (
|
| 16 |
+
set "FULL_PATH=!FULL_PATH!%%p;"
|
| 17 |
+
)
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
:: Set the PATH persistently using setx (user-level)
|
| 21 |
+
setx PATH "!FULL_PATH!" /M
|
| 22 |
+
|
| 23 |
+
echo PATH updated. Restart your command prompt or system for changes to take effect.
|
| 24 |
+
pause
|
commandos/corrige-path.ps1
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ------------------------------------------------------------
|
| 2 |
+
# Existing PATH (como fornecido)
|
| 3 |
+
# ------------------------------------------------------------
|
| 4 |
+
$existingPath = "C:\py\pyenv\pyenv-win\bin;C:\py\pyenv\pyenv-win\shims;C:\py\pyenv\pyenv-win\bin;C:\py\pyenv\pyenv-win\shims;$env:USERPROFILE\AppData\Local\Microsoft\WindowsApps;C:\Users\luisf\AppData\Local\pnpm;C:\Users\luisf\AppData\Local\Programs\oh-my-posh\bin;C:\Windows\system32;C:\Users\luisf\;"
|
| 5 |
+
|
| 6 |
+
# ------------------------------------------------------------
|
| 7 |
+
# Novos caminhos essenciais (deduplicados e priorizados)
|
| 8 |
+
# ------------------------------------------------------------
|
| 9 |
+
$newPaths = @(
|
| 10 |
+
"C:\mingw64\bin",
|
| 11 |
+
"C:\msys64\mingw64\bin",
|
| 12 |
+
"C:\msys64\usr\bin",
|
| 13 |
+
"C:\cmake\bin",
|
| 14 |
+
"C:\ninja",
|
| 15 |
+
"C:\ffmpeg-2024-10-13-git-e347b4ff31-full_build\bin",
|
| 16 |
+
"C:\node-v22.18.0-win-x64",
|
| 17 |
+
"C:\clang+llvm-19.1.1-x86_64-pc-windows-msvc\bin",
|
| 18 |
+
"C:\w64devkit-2.3.0\bin",
|
| 19 |
+
"C:\vcpkg",
|
| 20 |
+
"C:\nvm4w",
|
| 21 |
+
"C:\npm",
|
| 22 |
+
"C:\WinFBE_Suite\toolchains\FreeBASIC-1.10.0-winlibs-gcc-9.3.0\bin",
|
| 23 |
+
"C:\WinFBE_Suite\toolchains\FreeBASIC-1.10.0-winlibs-gcc-9.3.0\bin\win64",
|
| 24 |
+
"C:\VisualFBEditor.1.3.6\bin",
|
| 25 |
+
"C:\cygwin64\bin",
|
| 26 |
+
"C:\curl-8.9.1_3-win64-mingw\bin",
|
| 27 |
+
"C:\winlibs-x86_64-posix-seh-gcc-14.2.0-mingw-w64msvcrt-12.0.0-r3\bin",
|
| 28 |
+
"C:\VulkanSDK\Bin",
|
| 29 |
+
"C:\TensorRT\bin",
|
| 30 |
+
"C:\openvino\bin",
|
| 31 |
+
"C:\SDL3-3.2.20-win32-x64",
|
| 32 |
+
"C:\SDL\bin",
|
| 33 |
+
"C:\msys64\bin",
|
| 34 |
+
"C:\msys641\bin",
|
| 35 |
+
"C:\Powershell7",
|
| 36 |
+
"C:\python313\Scripts",
|
| 37 |
+
"C:\python313",
|
| 38 |
+
"C:\python311\Scripts",
|
| 39 |
+
"C:\python311",
|
| 40 |
+
"C:\python310\Scripts",
|
| 41 |
+
"C:\python310",
|
| 42 |
+
"C:\python38\Scripts",
|
| 43 |
+
"C:\python38",
|
| 44 |
+
"C:\TURBOC3\BIN",
|
| 45 |
+
"C:\rubberband\bin",
|
| 46 |
+
"C:\sox",
|
| 47 |
+
"C:\sqlite",
|
| 48 |
+
"C:\ffmpeg\bin",
|
| 49 |
+
"C:\ffmpeg-7.0.2-full_build\bin"
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# ------------------------------------------------------------
|
| 53 |
+
# Combinar PATH existente com novos caminhos (sem duplicados)
|
| 54 |
+
# ------------------------------------------------------------
|
| 55 |
+
$fullPath = $existingPath.Split(";") + $newPaths
|
| 56 |
+
$fullPath = $fullPath | Where-Object { $_ -and $_.Trim() -ne "" } | Select-Object -Unique
|
| 57 |
+
$finalPath = ($fullPath -join ";")
|
| 58 |
+
|
| 59 |
+
# ------------------------------------------------------------
|
| 60 |
+
# Atualizar PATH de forma persistente (nível de utilizador)
|
| 61 |
+
# ------------------------------------------------------------
|
| 62 |
+
[Environment]::SetEnvironmentVariable("Path", $finalPath, "User")
|
| 63 |
+
|
| 64 |
+
Write-Host ""
|
| 65 |
+
Write-Host "PATH atualizado com sucesso."
|
| 66 |
+
Write-Host "Reinicia o terminal para aplicar as alterações."
|
commandos/dar permissao a pasta imagens.bat
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
call icacls "C:\Users\luisf\Pictures" /grant luisf:(OI)(CI)F /t
|
commandos/deactivate.bat
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
|
| 3 |
+
if defined _OLD_VIRTUAL_PROMPT (
|
| 4 |
+
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
| 5 |
+
)
|
| 6 |
+
set _OLD_VIRTUAL_PROMPT=
|
| 7 |
+
|
| 8 |
+
if defined _OLD_VIRTUAL_PYTHONHOME (
|
| 9 |
+
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
|
| 10 |
+
set _OLD_VIRTUAL_PYTHONHOME=
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
if defined _OLD_VIRTUAL_PATH (
|
| 14 |
+
set "PATH=%_OLD_VIRTUAL_PATH%"
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
set _OLD_VIRTUAL_PATH=
|
| 18 |
+
|
| 19 |
+
set VIRTUAL_ENV=
|
| 20 |
+
set VIRTUAL_ENV_PROMPT=
|
| 21 |
+
|
| 22 |
+
:END
|
commandos/desbloquear_pictures.bat
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
setlocal enabledelayedexpansion
|
| 3 |
+
|
| 4 |
+
:: Caminho da pasta
|
| 5 |
+
set "TARGET=C:\Users\%USERNAME%\Pictures"
|
| 6 |
+
set "LOG=%TEMP%\desbloqueio_log.txt"
|
| 7 |
+
|
| 8 |
+
:: Limpa log anterior
|
| 9 |
+
if exist "%LOG%" del "%LOG%"
|
| 10 |
+
|
| 11 |
+
echo [INFO] Verificando permissões para: %TARGET% >> "%LOG%"
|
| 12 |
+
|
| 13 |
+
:: Verifica se está em modo administrador
|
| 14 |
+
net session >nul 2>&1
|
| 15 |
+
if %errorlevel% neq 0 (
|
| 16 |
+
echo [ERRO] Este script precisa ser executado como Administrador.
|
| 17 |
+
echo Execute como administrador e tente novamente.
|
| 18 |
+
pause
|
| 19 |
+
exit /b
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
:: Toma posse da pasta
|
| 23 |
+
echo [PASSO] Tomando posse da pasta... >> "%LOG%"
|
| 24 |
+
takeown /f "%TARGET%" /r /d y >> "%LOG%" 2>&1
|
| 25 |
+
|
| 26 |
+
:: Aplica permissões
|
| 27 |
+
echo [PASSO] Aplicando permissões para %USERNAME%... >> "%LOG%"
|
| 28 |
+
icacls "%TARGET%" /grant "%COMPUTERNAME%\%USERNAME%":(OI)(CI)F /T >> "%LOG%" 2>&1
|
| 29 |
+
|
| 30 |
+
:: Testa gravação
|
| 31 |
+
echo [PASSO] Testando gravação... >> "%LOG%"
|
| 32 |
+
echo Teste de gravação > "%TARGET%\teste_de_gravacao.txt"
|
| 33 |
+
if exist "%TARGET%\teste_de_gravacao.txt" (
|
| 34 |
+
echo [SUCESSO] Gravação bem-sucedida em %TARGET% >> "%LOG%"
|
| 35 |
+
) else (
|
| 36 |
+
echo [FALHA] Não foi possível gravar em %TARGET% >> "%LOG%"
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
:: Verifica Defender (Acesso controlado a pastas)
|
| 40 |
+
echo [INFO] Verificando status do Windows Defender... >> "%LOG%"
|
| 41 |
+
powershell -Command "Get-MpPreference | Select-Object -ExpandProperty ControlledFolderAccessProtection" >> "%LOG%" 2>&1
|
| 42 |
+
|
| 43 |
+
echo.
|
| 44 |
+
echo [CONCLUÍDO] Verificação completa. Log salvo em: %LOG%
|
| 45 |
+
pause
|
commandos/dev-agent.bat
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
python C:\Users\luisf\dev-agent\dev-agent.py
|
commandos/f-confy.bat
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
REM =====================================================
|
| 2 |
+
REM USAR PYTHON EMBEDDED DO COMFYUI (CUDA 12.8)
|
| 3 |
+
REM =====================================================
|
| 4 |
+
|
| 5 |
+
cd /d D:\ComfyUI_windows_portable_nvidia_cu128\ComfyUI_windows_portable
|
| 6 |
+
|
| 7 |
+
REM -----------------------------------------------------
|
| 8 |
+
REM ATIVAR PYTHON EMBEDDED
|
| 9 |
+
REM -----------------------------------------------------
|
| 10 |
+
set PYTHON=python_embeded\python.exe
|
| 11 |
+
set PIP=python_embeded\python.exe -m pip
|
| 12 |
+
|
| 13 |
+
REM -----------------------------------------------------
|
| 14 |
+
REM ATUALIZAR FERRAMENTAS BASE
|
| 15 |
+
REM -----------------------------------------------------
|
| 16 |
+
%PYTHON% -m ensurepip
|
| 17 |
+
%PIP% install --upgrade pip setuptools wheel
|
| 18 |
+
|
| 19 |
+
REM -----------------------------------------------------
|
| 20 |
+
REM LIMPAR PACOTES QUE CAUSAM DLL ERROR
|
| 21 |
+
REM -----------------------------------------------------
|
| 22 |
+
%PIP% uninstall -y torch torchvision torchaudio diffusers xformers accelerate safetensors
|
| 23 |
+
|
| 24 |
+
REM -----------------------------------------------------
|
| 25 |
+
REM INSTALAR PYTORCH COMPATÍVEL COM CUDA 12.8
|
| 26 |
+
REM -----------------------------------------------------
|
| 27 |
+
%PIP% install torch==2.3.1+cu121 torchvision==0.18.1+cu121 torchaudio==2.3.1+cu121 --index-url https://download.pytorch.org/whl/cu121
|
| 28 |
+
|
| 29 |
+
REM -----------------------------------------------------
|
| 30 |
+
REM INSTALAR DEPENDÊNCIAS EXATAS PARA VIDEOMAMA
|
| 31 |
+
REM -----------------------------------------------------
|
| 32 |
+
%PIP% install diffusers==0.24.0
|
| 33 |
+
%PIP% install accelerate==0.25.0
|
| 34 |
+
%PIP% install safetensors==0.4.2
|
| 35 |
+
%PIP% install transformers==4.36.2
|
| 36 |
+
%PIP% install huggingface_hub==0.20.3
|
| 37 |
+
%PIP% install einops numpy pillow tqdm scipy packaging
|
| 38 |
+
|
| 39 |
+
REM -----------------------------------------------------
|
| 40 |
+
REM XFORMERS COMPATÍVEL
|
| 41 |
+
REM -----------------------------------------------------
|
| 42 |
+
%PIP% install xformers==0.0.26.post1
|
| 43 |
+
|
| 44 |
+
REM -----------------------------------------------------
|
| 45 |
+
REM TESTE FINAL (CRÍTICO)
|
| 46 |
+
REM -----------------------------------------------------
|
| 47 |
+
%PYTHON% - << EOF
|
| 48 |
+
import torch
|
| 49 |
+
from diffusers.models.autoencoders import autoencoder_kl_temporal_decoder
|
| 50 |
+
print("Torch:", torch.__version__)
|
| 51 |
+
print("CUDA:", torch.cuda.is_available())
|
| 52 |
+
print("OK: autoencoder_kl_temporal_decoder carregado")
|
| 53 |
+
EOF
|
commandos/fallback-check.ps1
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# fallback-check.ps1
|
| 2 |
+
$gpuInfo = & nvidia-smi --query-gpu=memory.free --format=csv,noheader,nounits
|
| 3 |
+
$freeVRAM = [int]$gpuInfo
|
| 4 |
+
|
| 5 |
+
if ($freeVRAM -lt 4000) {
|
| 6 |
+
# Define variável de ambiente para fallback
|
| 7 |
+
[System.Environment]::SetEnvironmentVariable("USE_CPU_FALLBACK", "1", "User")
|
| 8 |
+
}
|
commandos/ff-comfy.bat
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
REM =====================================================
|
| 2 |
+
REM COMFYUI PYTHON EMBEDDED – FIX XFORMERS BUILD ERROR
|
| 3 |
+
REM (NÃO COMPILAR, USAR BINÁRIO OU DESATIVAR)
|
| 4 |
+
REM =====================================================
|
| 5 |
+
|
| 6 |
+
cd /d D:\ComfyUI_windows_portable_nvidia_cu128\ComfyUI_windows_portable
|
| 7 |
+
|
| 8 |
+
set PYTHON=python_embeded\python.exe
|
| 9 |
+
set PIP=python_embeded\python.exe -m pip
|
| 10 |
+
|
| 11 |
+
REM -----------------------------------------------------
|
| 12 |
+
REM GARANTIR FERRAMENTAS BASE
|
| 13 |
+
REM -----------------------------------------------------
|
| 14 |
+
%PYTHON% -m ensurepip
|
| 15 |
+
%PIP% install --upgrade pip setuptools wheel
|
| 16 |
+
|
| 17 |
+
REM -----------------------------------------------------
|
| 18 |
+
REM REMOVER XFORMERS QUE FALHOU NA BUILD
|
| 19 |
+
REM -----------------------------------------------------
|
| 20 |
+
%PIP% uninstall -y xformers
|
| 21 |
+
|
| 22 |
+
REM -----------------------------------------------------
|
| 23 |
+
REM OPÇÃO A (RECOMENDADA): USAR XFORMERS PRÉ-COMPILADO
|
| 24 |
+
REM (TORCH 2.3.x + CUDA 12.1)
|
| 25 |
+
REM -----------------------------------------------------
|
| 26 |
+
%PIP% install xformers==0.0.27.post2 --index-url https://download.pytorch.org/whl/cu121
|
| 27 |
+
|
| 28 |
+
REM -----------------------------------------------------
|
| 29 |
+
REM OPÇÃO B (SE AINDA FALHAR): DESATIVAR XFORMERS
|
| 30 |
+
REM -----------------------------------------------------
|
| 31 |
+
REM set XFORMERS_DISABLED=1
|
| 32 |
+
|
| 33 |
+
REM -----------------------------------------------------
|
| 34 |
+
REM GARANTIR STACK CONSISTENTE
|
| 35 |
+
REM -----------------------------------------------------
|
| 36 |
+
%PIP% uninstall -y torch torchvision torchaudio
|
| 37 |
+
%PIP% install torch==2.3.1+cu121 torchvision==0.18.1+cu121 torchaudio==2.3.1+cu121 --index-url https://download.pytorch.org/whl/cu121
|
| 38 |
+
|
| 39 |
+
%PIP% install diffusers==0.24.0
|
| 40 |
+
%PIP% install accelerate==0.25.0
|
| 41 |
+
%PIP% install safetensors==0.4.2
|
| 42 |
+
%PIP% install transformers==4.36.2
|
| 43 |
+
%PIP% install huggingface_hub==0.20.3
|
| 44 |
+
%PIP% install einops numpy pillow tqdm scipy packaging
|
| 45 |
+
|
| 46 |
+
REM -----------------------------------------------------
|
| 47 |
+
REM TESTE FINAL
|
| 48 |
+
REM -----------------------------------------------------
|
| 49 |
+
%PYTHON% - << EOF
|
| 50 |
+
import torch
|
| 51 |
+
from diffusers.models.autoencoders import autoencoder_kl_temporal_decoder
|
| 52 |
+
print("Torch:", torch.__version__)
|
| 53 |
+
print("CUDA:", torch.cuda.is_available())
|
| 54 |
+
print("Xformers:", torch.backends.cuda.matmul.allow_tf32)
|
| 55 |
+
print("OK")
|
| 56 |
+
EOF
|
commandos/frame.ps1
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ativar .NET Framework 3.5 e 4.x no Windows
|
| 2 |
+
# Criado a partir da configuração "WPFFeaturesdotnet"
|
| 3 |
+
|
| 4 |
+
Write-Host "A ativar .NET Framework 3.5 e 4.x..." -ForegroundColor Cyan
|
| 5 |
+
|
| 6 |
+
$features = @(
|
| 7 |
+
"NetFx4-AdvSrvs",
|
| 8 |
+
"NetFx3"
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
foreach ($feature in $features) {
|
| 12 |
+
Write-Host "A ativar feature: $feature" -ForegroundColor Yellow
|
| 13 |
+
Enable-WindowsOptionalFeature -Online -FeatureName $feature -All -NoRestart -ErrorAction SilentlyContinue
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
Write-Host "Processo concluído. Reinicia o sistema se necessário." -ForegroundColor Green
|
commandos/git-clang-format.bat
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
py -3 %~pn0 %*
|
commandos/health_check.bat
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
echo ===================================================
|
| 3 |
+
echo Windows 11 System Integrity Test Script
|
| 4 |
+
echo ===================================================
|
| 5 |
+
echo.
|
| 6 |
+
echo This script requires Administrator privileges.
|
| 7 |
+
echo If you did not right-click and 'Run as Administrator',
|
| 8 |
+
echo this may fail or ask for elevation.
|
| 9 |
+
echo.
|
| 10 |
+
|
| 11 |
+
echo [1/2] Checking Windows Component Store Health (DISM)...
|
| 12 |
+
DISM /Online /Cleanup-Image /CheckHealth
|
| 13 |
+
if %ERRORLEVEL% NEQ 0 (
|
| 14 |
+
echo.
|
| 15 |
+
echo [WARNING] DISM found issues or failed to run.
|
| 16 |
+
) else (
|
| 17 |
+
echo.
|
| 18 |
+
echo [OK] DISM check passed.
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
echo.
|
| 22 |
+
echo ---------------------------------------------------
|
| 23 |
+
echo.
|
| 24 |
+
|
| 25 |
+
echo [2/2] Verifying System Files (SFC)...
|
| 26 |
+
echo This may take some time...
|
| 27 |
+
sfc /verifyonly
|
| 28 |
+
if %ERRORLEVEL% NEQ 0 (
|
| 29 |
+
echo.
|
| 30 |
+
echo [WARNING] SFC found integrity violations or failed to run.
|
| 31 |
+
) else (
|
| 32 |
+
echo.
|
| 33 |
+
echo [OK] SFC found no integrity violations.
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
echo.
|
| 37 |
+
echo ===================================================
|
| 38 |
+
echo Testing Complete.
|
| 39 |
+
echo ===================================================
|
| 40 |
+
pause
|
commandos/ia.bat
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
TITLE Terminal IA - Gemma 4 + GPU
|
| 3 |
+
SETLOCAL
|
| 4 |
+
|
| 5 |
+
:: 1. Configurar Caminhos de Ambiente
|
| 6 |
+
set "PYTHONPATH=C:\py\pyenv\pyenv-win\versions\3.10.11"
|
| 7 |
+
set "OLLAMA_HOST=http://127.0.0.1:11434"
|
| 8 |
+
set "OLLAMA_ORIGINS=*"
|
| 9 |
+
|
| 10 |
+
:: 2. Forçar Variáveis para evitar o erro 404 (api/api)
|
| 11 |
+
set "OPENAI_API_BASE=http://localhost:11434/v1"
|
| 12 |
+
set "API_BASE=http://localhost:11434"
|
| 13 |
+
|
| 14 |
+
:: 3. Garantir que o Python e Pip estão no ponto
|
| 15 |
+
:: Rehash para o pyenv detetar tudo
|
| 16 |
+
call pyenv rehash
|
| 17 |
+
|
| 18 |
+
echo ======================================================
|
| 19 |
+
echo TERMINAL IA: GEMMA 4 (9.6 GB)
|
| 20 |
+
echo ======================================================
|
| 21 |
+
echo STATUS: CUDA 11.8 detetado (Torch 2.7.1)
|
| 22 |
+
echo MODELO: gemma4:e4b
|
| 23 |
+
echo ------------------------------------------------------
|
| 24 |
+
echo.
|
| 25 |
+
|
| 26 |
+
:: 4. Menu de Opcoes
|
| 27 |
+
echo [1] Iniciar Open Interpreter (Criar/Ler Ficheiros)
|
| 28 |
+
echo [2] Iniciar Aider (Melhor para Editar Codigo)
|
| 29 |
+
echo [3] Chat Direto (Ollama puro)
|
| 30 |
+
echo [4] Sair
|
| 31 |
+
echo.
|
| 32 |
+
|
| 33 |
+
set /p choice="Escolha uma opcao: "
|
| 34 |
+
|
| 35 |
+
if "%choice%"=="1" (
|
| 36 |
+
interpreter --model ollama/gemma4:e4b --api_base http://localhost:11434
|
| 37 |
+
)
|
| 38 |
+
if "%choice%"=="2" (
|
| 39 |
+
aider --model ollama/gemma4:e4b
|
| 40 |
+
)
|
| 41 |
+
if "%choice%"=="3" (
|
| 42 |
+
ollama run gemma4:e4b
|
| 43 |
+
)
|
| 44 |
+
if "%choice%"=="4" exit
|
| 45 |
+
|
| 46 |
+
pause
|
commandos/insta.bat
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
uv venv D:\open-webui --python 3.11
|
| 2 |
+
& "D:\open-webui\Scripts\Activate.ps1"
|
| 3 |
+
uv pip install open-webui
|
| 4 |
+
open-webui serve
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
pause
|
commandos/instala.bat
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
set REPO=%1
|
| 3 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall %REPO%
|
| 4 |
+
pause
|
commandos/instalar-skills.bat
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
title Instalar binários para Clawdbot Skills
|
| 3 |
+
echo.
|
| 4 |
+
echo [1/6] A verificar se o Chocolatey está instalado...
|
| 5 |
+
where choco >nul 2>&1
|
| 6 |
+
if %errorlevel% neq 0 (
|
| 7 |
+
echo Chocolatey não encontrado. A instalar...
|
| 8 |
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
|
| 9 |
+
) else (
|
| 10 |
+
echo Chocolatey já está instalado.
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
echo.
|
| 14 |
+
echo [2/6] A instalar ffmpeg...
|
| 15 |
+
choco install -y ffmpeg
|
| 16 |
+
|
| 17 |
+
echo.
|
| 18 |
+
echo [3/6] A instalar jq e ripgrep...
|
| 19 |
+
choco install -y jq ripgrep
|
| 20 |
+
|
| 21 |
+
echo.
|
| 22 |
+
echo [4/6] A instalar Python 3...
|
| 23 |
+
choco install -y python
|
| 24 |
+
|
| 25 |
+
echo.
|
| 26 |
+
echo [5/6] A instalar Node.js...
|
| 27 |
+
choco install -y nodejs
|
| 28 |
+
|
| 29 |
+
echo.
|
| 30 |
+
echo [6/6] A instalar clawdhub CLI...
|
| 31 |
+
call npm install -g clawdhub
|
| 32 |
+
|
| 33 |
+
echo.
|
| 34 |
+
echo Instalação concluída. Reinicia o Clawdbot com:
|
| 35 |
+
echo clawdbot gateway restart
|
| 36 |
+
pause
|
commandos/instalarepo.bat
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
set REPO=%1
|
| 3 |
+
set REPO1=%2
|
| 4 |
+
set REPO2=%3
|
| 5 |
+
set REPO3=%4
|
| 6 |
+
set REPO4=%5
|
| 7 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --upgrade --force-reinstall "numpy<2,>=1.24"
|
| 8 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall opencv-python
|
| 9 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall scikit-image
|
| 10 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall albumentations
|
| 11 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall scikit-learn
|
| 12 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall librosa>=0.10.2.post1
|
| 13 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall numba>=0.60.0
|
| 14 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall protobuf>=3.20.2
|
| 15 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall httpx<1,>=0.23.0
|
| 16 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall timm
|
| 17 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall joblib
|
| 18 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall pooch
|
| 19 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall platformdirs
|
| 20 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall grpcio>=1.48.2
|
| 21 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall werkzeug>=1.0.1
|
| 22 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall beautifulsoup4
|
| 23 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall opencv-contrib-python
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
D:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\python_embeded\python.exe -m pip install --user --force-reinstall %REPO% %REPO1% %REPO2% %REPO3% %REPO4% %repo5%
|
| 28 |
+
pause
|
commandos/install.bat
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
setlocal enabledelayedexpansion
|
| 3 |
+
|
| 4 |
+
:: Try to use embedded python first
|
| 5 |
+
if exist ..\..\..\python_embeded\python.exe (
|
| 6 |
+
:: Use the embedded python
|
| 7 |
+
set PYTHON=..\..\..\python_embeded\python.exe
|
| 8 |
+
) else (
|
| 9 |
+
:: Embedded python not found, check for python in the PATH
|
| 10 |
+
for /f "tokens=* USEBACKQ" %%F in (`python --version 2^>^&1`) do (
|
| 11 |
+
set PYTHON_VERSION=%%F
|
| 12 |
+
)
|
| 13 |
+
if errorlevel 1 (
|
| 14 |
+
echo I couldn't find an embedded version of Python, nor one in the Windows PATH. Please install manually.
|
| 15 |
+
pause
|
| 16 |
+
exit /b 1
|
| 17 |
+
) else (
|
| 18 |
+
:: Use python from the PATH (if it's the right version and the user agrees)
|
| 19 |
+
echo I couldn't find an embedded version of Python, but I did find !PYTHON_VERSION! in your Windows PATH.
|
| 20 |
+
echo Would you like to proceed with the install using that version? (Y/N^)
|
| 21 |
+
set /p USE_PYTHON=
|
| 22 |
+
if /i "!USE_PYTHON!"=="Y" (
|
| 23 |
+
set PYTHON=python
|
| 24 |
+
) else (
|
| 25 |
+
echo Okay. Please install manually.
|
| 26 |
+
pause
|
| 27 |
+
exit /b 1
|
| 28 |
+
)
|
| 29 |
+
)
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
:: Install the package
|
| 33 |
+
echo Installing...
|
| 34 |
+
%PYTHON% install.py
|
| 35 |
+
echo Done^!
|
| 36 |
+
|
| 37 |
+
@pause
|
commandos/install_agent_deps.bat
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
cd /d "D:\agente-zero"
|
| 3 |
+
echo Installing Agent Zero requirements...
|
| 4 |
+
pip install -r requirements.txt
|
| 5 |
+
pause
|
commandos/install_agent_ps.ps1
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Activate the virtual environment and install requirements
|
| 2 |
+
Set-Location "D:\agente-zero"
|
| 3 |
+
& "D:\agente-zero\venv\Scripts\Activate.ps1"
|
| 4 |
+
pip install -r requirements.txt
|
| 5 |
+
Write-Host "Installation completed. Press any key to exit..."
|
| 6 |
+
$HOST.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|