agent-mp 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/engine.js +36 -15
- package/package.json +1 -1
package/dist/core/engine.js
CHANGED
|
@@ -988,33 +988,54 @@ INSTRUCCIONES:
|
|
|
988
988
|
existingArch = await readFile(archPath);
|
|
989
989
|
}
|
|
990
990
|
catch { /* new project */ }
|
|
991
|
+
// Build a quick filesystem snapshot to give the explorer context
|
|
992
|
+
let fsSnapshot = '';
|
|
993
|
+
try {
|
|
994
|
+
const { execSync } = await import('child_process');
|
|
995
|
+
// Use tree/find but exclude .agent, node_modules, .git, dist, __pycache__, .venv
|
|
996
|
+
fsSnapshot = execSync(`find "${this.projectDir}" -maxdepth 3 -not -path '*/.agent/*' -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/__pycache__/*' -not -path '*/.venv/*' -not -path '*/target/*' | head -200`, { encoding: 'utf-8', timeout: 10000 });
|
|
997
|
+
}
|
|
998
|
+
catch { /* ignore */ }
|
|
991
999
|
const effectiveTask = task || 'Explorar y documentar todas las aplicaciones y servicios del proyecto';
|
|
992
1000
|
const prompt = `TAREA DE EXPLORACION: ${effectiveTask}
|
|
993
1001
|
DIRECTORIO_TRABAJO: ${this.projectDir}
|
|
994
1002
|
PROYECTO: ${this.config.project}
|
|
995
1003
|
STACK: ${this.config.stack}
|
|
996
1004
|
|
|
1005
|
+
LISTADO DE ARCHIVOS DEL PROYECTO (excluyendo .agent, node_modules, .git, dist, __pycache__, .venv):
|
|
1006
|
+
${fsSnapshot}
|
|
1007
|
+
|
|
997
1008
|
${existingArch ? `DOCUMENTACION EXISTENTE (actualizar si hay cambios):\n${existingArch.slice(0, 3000)}\n` : 'DOCUMENTACION EXISTENTE: ninguna — crear desde cero.\n'}
|
|
998
1009
|
INSTRUCCIONES:
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1010
|
+
Analiza el listado de archivos y genera documentación completa.
|
|
1011
|
+
DEVUELVE SOLO el contenido del archivo architecture.md como texto markdown. No incluyas explicaciones adicionales.
|
|
1012
|
+
|
|
1013
|
+
El archivo DEBE contener:
|
|
1014
|
+
1. Tabla resumen: | Servicio/Modulo | Stack | Proposito | Entry Point | Archivos clave |
|
|
1015
|
+
2. Analisis de la estructura de directorios principal
|
|
1016
|
+
3. Por cada servicio/app: dependencias clave (de package.json, pyproject.toml, pom.xml, build.gradle, etc.), entry points, modulos principales
|
|
1017
|
+
4. Mapa de dependencias entre componentes
|
|
1018
|
+
5. Variables de entorno o configuraciones relevantes
|
|
1019
|
+
6. Comandos de desarrollo comunes (build, test, run)
|
|
1009
1020
|
|
|
1010
1021
|
REGLAS:
|
|
1011
|
-
-
|
|
1012
|
-
- NO
|
|
1013
|
-
- NO
|
|
1014
|
-
-
|
|
1015
|
-
- Si un directorio esta en node_modules, dist, .git: ignoralo`;
|
|
1022
|
+
- Devuelve UNICAMENTE el contenido markdown del archivo
|
|
1023
|
+
- NO incluyas texto de explicacion fuera del markdown
|
|
1024
|
+
- NO incluyas bloques de codigo
|
|
1025
|
+
- Documenta TODO el proyecto (todos los subdirectorios al nivel de DIRECTORIO_TRABAJO, excluyendo .agent)`;
|
|
1016
1026
|
const res = await this.runWithFallback('explorer', prompt, 'Exploracion');
|
|
1017
1027
|
const text = extractCliText(res);
|
|
1028
|
+
// The LLM returns the CONTENT of architecture.md as plain text.
|
|
1029
|
+
// We need to write it to the file ourselves.
|
|
1030
|
+
const cleanText = text
|
|
1031
|
+
.replace(/^```markdown\s*/i, '')
|
|
1032
|
+
.replace(/^```\s*$/gm, '')
|
|
1033
|
+
.replace(/```/g, '')
|
|
1034
|
+
.trim();
|
|
1035
|
+
if (cleanText) {
|
|
1036
|
+
await writeFile(archPath, cleanText);
|
|
1037
|
+
log.ok(`architecture.md written (${cleanText.length} chars)`);
|
|
1038
|
+
}
|
|
1018
1039
|
// Overwrite the single last-run report (no timestamp accumulation)
|
|
1019
1040
|
try {
|
|
1020
1041
|
await writeFile(path.join(contextDir, 'explorer-last.md'), `# Explorer Report\n\nTask: ${effectiveTask}\nDate: ${new Date().toISOString()}\n\n${text}\n`);
|