mirror of
https://github.com/KeymonSoft/Intmex_Multiventa.git
synced 2026-04-17 21:06:08 +00:00
VERSION 6.02.21
- Se agrego que cuando hagan clic en el nombre del cliente se actualicen automaticamente las coordenadas en web.
This commit is contained in:
@@ -1,28 +1,127 @@
|
||||
# SCRIPT: _juntaBas.ps1 - Versión Saneada y Optimizada para LLM
|
||||
$OutputFile="_CODIGO_COMPLETO_PARA_LLM.txt"
|
||||
# SCRIPT: _juntaBas_Master_FinalIA.ps1
|
||||
# FIX: Corregida sintaxis de comillas y concatenación de tags XML.
|
||||
# OBJETIVO: Fuente de verdad para IA con navegación ultra estructurada.
|
||||
|
||||
# Eliminar el archivo anterior si existe (IMPORTANTE)
|
||||
Remove-Item -Path $OutputFile -ErrorAction SilentlyContinue
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
$Dir = Get-Location
|
||||
$LT = [char]60; $GT = [char]62; $SL = [char]47
|
||||
$NL = [Environment]::NewLine
|
||||
|
||||
Write-Host "Iniciando fusion para LLM..."
|
||||
Write-Output '--- GENERANDO MASTER IA DEFINITIVO (FIX ESTRUCTURAL) ---'
|
||||
|
||||
# Itera sobre los archivos .bas, .b4a, .b4j
|
||||
Get-ChildItem -Path ".\*" -Include @("*.bas", "*.b4a", "*.b4j") | ForEach-Object {
|
||||
$currentFile = $_.Name
|
||||
Write-Host "Procesando: $currentFile"
|
||||
# 1. PARSEO DEL PROYECTO .B4A
|
||||
$b4a = Get-ChildItem -Path ".\*" -Include "*.b4a" -Recurse | Select-Object -First 1
|
||||
$Name = 'App'; $Ver = '0.0'; $ModulosValidos = @(); $Librerias = @()
|
||||
|
||||
# --- ENCABEZADO ESTRUCTURADO Y COMENTADO EN B4X (Agregado al archivo) ---
|
||||
Add-Content -Path $OutputFile -Value "`n'======================================================================================"
|
||||
Add-Content -Path $OutputFile -Value $"// ARCHIVO_INICIO: ${currentFile}"
|
||||
Add-Content -Path $OutputFile -Value "'======================================================================================`n"
|
||||
|
||||
# Vuelca el contenido del archivo
|
||||
Get-Content -Encoding UTF8 -Path $_.FullName -Raw | Add-Content -Path $OutputFile
|
||||
|
||||
# --- DELIMITADOR DE FIN DE ARCHIVO (Agregado al archivo) ---
|
||||
Add-Content -Path $OutputFile -Value "`n'======================================================================================"
|
||||
Add-Content -Path $OutputFile -Value $"// ARCHIVO_FIN: ${currentFile}"
|
||||
Add-Content -Path $OutputFile -Value "'======================================================================================`n"
|
||||
if ($b4a) {
|
||||
$lines = [System.IO.File]::ReadAllLines($b4a.FullName)
|
||||
foreach ($L in $lines) {
|
||||
if ($L -match '#ApplicationLabel:\s*(.*)') { $Name = $Matches[1].Trim() }
|
||||
if ($L -match '#VersionName:\s*(.*)') { $Ver = $Matches[1].Trim() }
|
||||
if ($L -match '^Module\d+=(.*)') {
|
||||
$m = [System.IO.Path]::GetFileName($Matches[1].Trim())
|
||||
if (-not $m.EndsWith(".bas") -and $m -ne "Main") { $m += ".bas" }
|
||||
$ModulosValidos += $m
|
||||
}
|
||||
if ($L -match '^Library\d+=(.*)') { $Librerias += $Matches[1].Trim() }
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`nProceso terminado. Se ha creado el archivo: $OutputFile"
|
||||
$OutName = "_" + $Name + "_" + $Ver + "_IA.md"
|
||||
$OutFile = Join-Path $Dir $OutName
|
||||
|
||||
# 2. HEADER CON TUS INSTRUCCIONES CRÍTICAS
|
||||
$CurrentDate = Get-Date -Format 'yyyy-MM-dd HH:mm'
|
||||
$Header = @"
|
||||
# PROYECTO: $Name
|
||||
- Version: $Ver
|
||||
- Fecha: $CurrentDate
|
||||
- Librerias Activas: $($Librerias -join ", ")
|
||||
|
||||
## INSTRUCCIONES CRITICAS (B4A / BASIC4ANDROID)
|
||||
0. **Integridad del Contexto:** Antes de procesar peticiones, cuenta si el numero de modulos listados en el indice coincide con los detallados en el cuerpo.
|
||||
1. **Source of Truth (Codigo):** Este archivo contiene el codigo fuente ACTUAL del proyecto.
|
||||
2. **Source of Truth (Librerias):** Basa tus sugerencias en la lista de 'Librerias Activas'.
|
||||
3. **Anti-Alucinacion:** Antes de sugerir, VERIFICA la 'Interfaz Pública' o el código fuente del módulo.
|
||||
4. **Existencia Estricta:** Si una variable/Sub no está en el texto, NO EXISTE.
|
||||
5. **Formato:** Usa bloques 'vb'.
|
||||
6. **Navegacion Estructural:** Usa los tags <module>, <interface> y <method> para localizar codigo.
|
||||
7. **Inferencia de Datos:** Deduce la BD solo de los strings SQL presentes.
|
||||
"@
|
||||
|
||||
Set-Content -Path $OutFile -Value $Header -Encoding UTF8
|
||||
|
||||
# 3. LISTAR ARCHIVOS
|
||||
$files = Get-ChildItem -Path $Dir -Include *.bas,*.b4a -Recurse | Where-Object {
|
||||
$_.FullName -notmatch 'Objects' -and ($_.Extension -eq '.b4a' -or $ModulosValidos -contains $_.Name)
|
||||
}
|
||||
|
||||
# 4. INDICE DE MODULOS
|
||||
Add-Content $OutFile ($NL + "## INDICE DE MODULOS" + $NL) -Encoding UTF8
|
||||
foreach ($f in $files) {
|
||||
$Ref = $f.Name.Replace('.', '').Replace(' ', '-').ToLower()
|
||||
Add-Content $OutFile ("- [" + $f.Name + "](#modulo-" + $Ref + ")") -Encoding UTF8
|
||||
}
|
||||
|
||||
# 5. CODIGO FUENTE ESTRUCTURADO
|
||||
Add-Content $OutFile ($NL + '## CODIGO FUENTE DETALLADO' + $NL) -Encoding UTF8
|
||||
|
||||
foreach ($f in $files) {
|
||||
Write-Host " -> $($f.Name)... " -NoNewline
|
||||
$txt = [System.IO.File]::ReadAllLines($f.FullName)
|
||||
|
||||
# Pre-escaneo para <interface>
|
||||
$Methods = @()
|
||||
foreach ($line in $txt) {
|
||||
if ($line.Trim() -match '^(?:Public\s+|Private\s+)?Sub\s+([\w\d_]+)') {
|
||||
$Methods += $Matches[1]
|
||||
}
|
||||
}
|
||||
|
||||
$Ref = $f.Name.Replace('.', '').Replace(' ', '-').ToLower()
|
||||
Add-Content $OutFile "$NL<module name='$($f.Name)' id='modulo-$Ref'>" -Encoding UTF8
|
||||
|
||||
Add-Content $OutFile " <interface>" -Encoding UTF8
|
||||
foreach($m in $Methods) {
|
||||
Add-Content $OutFile " <method_ref name='$m' />" -Encoding UTF8
|
||||
}
|
||||
Add-Content $OutFile " </interface>$NL" -Encoding UTF8
|
||||
|
||||
Add-Content $OutFile "```vb" -Encoding UTF8
|
||||
|
||||
$skip = ($f.Extension -eq '.b4a')
|
||||
|
||||
foreach ($l in $txt) {
|
||||
$trim = $l.Trim()
|
||||
|
||||
if ($skip) {
|
||||
if ($trim.StartsWith("#") -and -not $trim.StartsWith("#Region")) { Add-Content $OutFile $l -Encoding UTF8 }
|
||||
if ($l.Contains("@EndOfDesignText@")) { $skip = $false }
|
||||
continue
|
||||
}
|
||||
|
||||
# Inicio de Método
|
||||
if ($trim -match '^(?:Public\s+|Private\s+)?Sub\s+([\w\d_]+)') {
|
||||
Add-Content $OutFile "<method name='$($Matches[1])'>" -Encoding UTF8
|
||||
}
|
||||
|
||||
# Limpieza de comentarios y escritura de línea
|
||||
if ($trim.StartsWith("'")) {
|
||||
if (-not ($trim.StartsWith("'#") -or ($trim -match 'TODO:') -or ($trim -match 'FIX:'))) { continue }
|
||||
}
|
||||
|
||||
if (-not [string]::IsNullOrWhiteSpace($trim)) {
|
||||
Add-Content $OutFile $l -Encoding UTF8
|
||||
}
|
||||
|
||||
# Fin de Método
|
||||
if ($trim -eq "End Sub") {
|
||||
Add-Content $OutFile "</method>" -Encoding UTF8
|
||||
}
|
||||
}
|
||||
|
||||
Add-Content $OutFile "```$NL</module>" -Encoding UTF8
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Output ("--- FINALIZADO: " + $OutName + " ---")
|
||||
Reference in New Issue
Block a user