Files
Kelloggs_v4/B4A/_juntaBas.ps1
Jose Alberto Guerra Ugalde eaa185bb6d VERSION 6.01.31
- Se corrigio que guarde los inventarios de loq ue trae la camionetay NO lo del almacen.
2026-02-04 13:38:09 -06:00

81 lines
5.6 KiB
PowerShell

# SCRIPT: _juntaBas.ps1 - Versión SYSTEM PROMPT CONDICIONAL + Ultimate (Corregido)
$OutputFile="_CODIGO_COMPLETO_PARA_LLM.txt"
Remove-Item -Path $OutputFile -ErrorAction SilentlyContinue
Write-Host "Generando Código Maestro con Protocolo Condicional..."
$files = Get-ChildItem -Path ".\*" -Include @("*.bas", "*.b4a", "*.j")
# --- 0. INYECCIÓN DE INSTRUCCIONES DE SISTEMA (CONDICIONALES) ---
# Se han reemplazado paréntesis conflictivos y comillas internas para evitar errores de PowerShell
Add-Content -Path $OutputFile -Value "''' ======================================================================================" -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' INSTRUCCIONES CRÍTICAS PARA EL ASISTENTE (PROTOCOLO B4A)" -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' 1. CONTEXTO: Este archivo contiene el código fuente ACTUAL del proyecto." -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' 2. ANTI-ALUCINACION: Antes de sugerir propiedades, VERIFICA si existen" -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' en las secciones [Variables Globales] o [Estructuras Types] del Manifiesto abajo." -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' 3. DOCUMENTACION EXTERNA (CONDICIONAL):" -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' - SI el usuario adjunta archivos de referencia (ej. _B4X_Library... o _B4A_Library...)," -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' PRIORIZA esos métodos sobre tu conocimiento general." -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' - SI NO se adjuntan referencias, apóyate en el código existente en Subs.bas." -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' 4. SCOPE: Respeta la visibilidad (Public/Private)." -Encoding UTF8
Add-Content -Path $OutputFile -Value "''' ======================================================================================`n" -Encoding UTF8
# --- 1. GENERACIÓN DEL MANIFIESTO (TABLA DE CONTENIDO) ---
Add-Content -Path $OutputFile -Value "'======================================================================================" -Encoding UTF8
Add-Content -Path $OutputFile -Value "' MANIFIESTO DEL PROYECTO - Generado el $(Get-Date -Format 'yyyy-MM-dd HH:mm')" -Encoding UTF8
Add-Content -Path $OutputFile -Value "' Total de archivos: $($files.Count)" -Encoding UTF8
Add-Content -Path $OutputFile -Value "'======================================================================================" -Encoding UTF8
foreach ($file in $files) {
$content = Get-Content $file.FullName
$ext = $file.Extension.ToLower()
$lines = $content.Count
# Extraer (Subs, Globales, Types, Libs)
$subs = $content | Where-Object { $_ -match "^\s*Sub\s+" } | ForEach-Object { $_.Trim() -replace "'.*$", "" }
$globals = $content | Where-Object { $_ -match "^\s*(Private|Public|Dim)\s+\w+\s+As" } | ForEach-Object { $_.Trim() -replace "'.*$", "" }
$types = $content | Where-Object { $_ -match "^\s*Type\s+\w+" } | ForEach-Object { $_.Trim() }
$libs = @()
if ($ext -eq ".b4a") {
$libs = $content | Where-Object { $_ -match "^Library\d+=" } | ForEach-Object { $_ -replace "^Library\d+=", "" }
}
# Escribir Manifiesto
Add-Content -Path $OutputFile -Value "' [ ] Archivo: $($file.Name) ($lines líneas)" -Encoding UTF8
if ($libs) {
Add-Content -Path $OutputFile -Value "' --- Librerías Activas ---" -Encoding UTF8
foreach ($l in $libs) { Add-Content -Path $OutputFile -Value "' [LIB] $l" -Encoding UTF8 }
}
if ($types) {
Add-Content -Path $OutputFile -Value "' --- Estructuras (Types) ---" -Encoding UTF8
foreach ($t in $types) { Add-Content -Path $OutputFile -Value "' {TYPE} $t" -Encoding UTF8 }
}
if ($globals) {
Add-Content -Path $OutputFile -Value "' --- Variables Globales ---" -Encoding UTF8
foreach ($g in $globals) { Add-Content -Path $OutputFile -Value "' . $g" -Encoding UTF8 }
}
if ($subs) {
Add-Content -Path $OutputFile -Value "' --- Subrutinas ---" -Encoding UTF8
foreach ($s in $subs) { Add-Content -Path $OutputFile -Value "' > $s" -Encoding UTF8 }
}
Add-Content -Path $OutputFile -Value "' ------------------------------------------------------------------------------------" -Encoding UTF8
}
Add-Content -Path $OutputFile -Value "' FINAL DEL MANIFIESTO`n" -Encoding UTF8
Add-Content -Path $OutputFile -Value "'======================================================================================`n" -Encoding UTF8
# --- 2. VUELCO DE CONTENIDO ---
$files | ForEach-Object {
$currentFile = $_.Name
Write-Host "Procesando: $currentFile"
Add-Content -Path $OutputFile -Value "'======================================================================================" -Encoding UTF8
Add-Content -Path $OutputFile -Value "// ARCHIVO_INICIO: ${currentFile}" -Encoding UTF8
Add-Content -Path $OutputFile -Value "'======================================================================================`n" -Encoding UTF8
Get-Content -Encoding UTF8 -Path $_.FullName -Raw | Add-Content -Path $OutputFile -Encoding UTF8
Add-Content -Path $OutputFile -Value "`n'======================================================================================" -Encoding UTF8
Add-Content -Path $OutputFile -Value "// ARCHIVO_FIN: ${currentFile}" -Encoding UTF8
Add-Content -Path $OutputFile -Value "'======================================================================================`n" -Encoding UTF8
}
Write-Host "¡Listo! Archivo $OutputFile con Instrucciones Condicionales generado (Sin Errores)."