agent-mp 0.5.18 → 0.5.20
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 +31 -34
- package/package.json +1 -1
package/dist/core/engine.js
CHANGED
|
@@ -238,11 +238,11 @@ async function walkForKeyFiles(root) {
|
|
|
238
238
|
'server.ts', 'server.js', 'server.py',
|
|
239
239
|
'application.ts', 'application.js', 'application.py',
|
|
240
240
|
]);
|
|
241
|
-
const ENTRY_REGEX = /Application\.
|
|
241
|
+
const ENTRY_REGEX = /Application\.[a-z]+$/i; // *Application.java, *Application.kt, etc.
|
|
242
242
|
const CTRL_REGEX = /(controller|router|routes|handler|endpoint|resource)/i;
|
|
243
243
|
const SCHEMA_REGEX = /(schema|\.entity|\.model|\.dto|models?\.|entities?\.)/i;
|
|
244
|
-
//
|
|
245
|
-
const
|
|
244
|
+
// Directories that conventionally hold data/domain classes (language-agnostic)
|
|
245
|
+
const DOMAIN_DIR_REGEX = /[\/\\](domain|entity|entities|model|models|dto|dtos|schema|schemas)[\/\\]/i;
|
|
246
246
|
async function walk(dir, depth) {
|
|
247
247
|
if (depth > 6)
|
|
248
248
|
return;
|
|
@@ -278,7 +278,7 @@ async function walkForKeyFiles(root) {
|
|
|
278
278
|
if (CTRL_REGEX.test(e.name) && result.controllers.length < 5) {
|
|
279
279
|
result.controllers.push(p);
|
|
280
280
|
}
|
|
281
|
-
const isSchema = SCHEMA_REGEX.test(e.name) ||
|
|
281
|
+
const isSchema = SCHEMA_REGEX.test(e.name) || DOMAIN_DIR_REGEX.test(p);
|
|
282
282
|
if (isSchema && result.schemas.length < 5) {
|
|
283
283
|
result.schemas.push(p);
|
|
284
284
|
}
|
|
@@ -1193,7 +1193,9 @@ INSTRUCCIONES:
|
|
|
1193
1193
|
// Ensure .agent/ structure exists
|
|
1194
1194
|
const agentDir = path.join(this.projectDir, '.agent');
|
|
1195
1195
|
const contextDir = path.join(agentDir, 'context');
|
|
1196
|
+
const docsDir = path.join(agentDir, 'docs');
|
|
1196
1197
|
await fs.mkdir(contextDir, { recursive: true });
|
|
1198
|
+
await fs.mkdir(docsDir, { recursive: true });
|
|
1197
1199
|
await fs.mkdir(path.join(agentDir, 'rules'), { recursive: true });
|
|
1198
1200
|
// NOTE: cleanup of stray files moved to AFTER successful parse, to avoid
|
|
1199
1201
|
// wiping previous docs when the explorer fails (e.g. tool-call hallucination).
|
|
@@ -1283,19 +1285,20 @@ El engine YA leyo por vos los archivos clave de cada componente y te los pasa ar
|
|
|
1283
1285
|
|
|
1284
1286
|
REGLA CRITICA PARA MODULOS (NIVEL 2):
|
|
1285
1287
|
- Los modulos SON LAS FEATURES DEL NEGOCIO, NO las capas tecnicas.
|
|
1286
|
-
- MAL: modulos llamados "web-api", "security", "data-access" — eso es hablar de capas, no de
|
|
1287
|
-
- BIEN: modulos llamados "clients", "sales", "products", "auth", "orders" — eso es hablar de features
|
|
1288
|
-
- Para identificar los modulos
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
|
1296
|
-
|
|
|
1297
|
-
|
|
|
1298
|
-
| src/
|
|
1288
|
+
- MAL: modulos llamados "web-api", "security", "data-access" — eso es hablar de capas, no de features
|
|
1289
|
+
- BIEN: modulos llamados "clients", "sales", "products", "auth", "orders" — eso es hablar de features reales
|
|
1290
|
+
- Para identificar los modulos, MIRA los CONTROLLER/ROUTER pre-leidos: el nombre del modulo = lo que maneja ese controller
|
|
1291
|
+
* ClientController o clients.controller → modulo "clients"
|
|
1292
|
+
* SaleController o sale.routes → modulo "sales"
|
|
1293
|
+
* AuthController o auth.handler → modulo "auth"
|
|
1294
|
+
- "Archivos clave" en cada modulo DEBE listar los archivos FUENTE REALES que leiste, NO solo el manifest.
|
|
1295
|
+
Ejemplo correcto:
|
|
1296
|
+
| Archivo (ruta relativa al componente) | Rol |
|
|
1297
|
+
| controller/ClientController.java | Endpoints REST /clients |
|
|
1298
|
+
| domain/Client.java | Entidad mapeada a tabla CLIENTS |
|
|
1299
|
+
| repository/ClientRepository.java | Acceso a base de datos |
|
|
1300
|
+
| src/clients/clients.controller.ts | Endpoints /clients |
|
|
1301
|
+
| src/clients/client.schema.ts | Modelo de datos Client |
|
|
1299
1302
|
|
|
1300
1303
|
NO inventes datos. Si un componente no tiene una de esas piezas en los archivos leidos, simplemente omiti esa seccion en su documentacion.
|
|
1301
1304
|
|
|
@@ -1516,35 +1519,29 @@ FORMATO DE SALIDA — OBLIGATORIO
|
|
|
1516
1519
|
Devolve UNICAMENTE bloques de archivos separados por marcadores ===. Nada de explicaciones extra fuera de los bloques.
|
|
1517
1520
|
|
|
1518
1521
|
IMPORTANTE: TODAS las rutas son RELATIVAS al directorio del proyecto.
|
|
1519
|
-
Los archivos se escriben SIEMPRE dentro de .agent/context/
|
|
1520
1522
|
|
|
1521
|
-
Ejemplos de marcadores:
|
|
1523
|
+
Ejemplos de marcadores validos:
|
|
1522
1524
|
=== .agent/context/architecture.md ===
|
|
1523
1525
|
=== .agent/context/datamart-data-access-api/architecture.md ===
|
|
1524
1526
|
=== .agent/context/datamart-data-access-api/modules/auth.md ===
|
|
1525
1527
|
=== .agent/context/nexus-core-api/architecture.md ===
|
|
1526
|
-
=== .agent/context/nexus-core-api/modules/
|
|
1528
|
+
=== .agent/context/nexus-core-api/modules/clients.md ===
|
|
1527
1529
|
|
|
1528
1530
|
=== .agent/context/architecture.md ===
|
|
1529
|
-
[contenido
|
|
1531
|
+
[contenido NIVEL 0]
|
|
1530
1532
|
|
|
1531
|
-
=== .agent/context/nombre-componente
|
|
1532
|
-
[contenido
|
|
1533
|
+
=== .agent/context/nombre-componente/architecture.md ===
|
|
1534
|
+
[contenido NIVEL 1]
|
|
1533
1535
|
|
|
1534
|
-
=== .agent/context/nombre-componente
|
|
1535
|
-
[contenido
|
|
1536
|
-
|
|
1537
|
-
=== .agent/context/nombre-componente-1/modules/leads.md ===
|
|
1538
|
-
[contenido completo del NIVEL 2 del modulo leads]
|
|
1539
|
-
|
|
1540
|
-
=== .agent/context/nombre-componente-2/architecture.md ===
|
|
1541
|
-
...
|
|
1536
|
+
=== .agent/context/nombre-componente/modules/auth.md ===
|
|
1537
|
+
[contenido NIVEL 2]
|
|
1542
1538
|
|
|
1543
1539
|
REGLAS DE PATHS:
|
|
1544
|
-
-
|
|
1540
|
+
- Arquitectura global: === .agent/context/architecture.md ===
|
|
1545
1541
|
- Por componente: === .agent/context/[nombre-componente]/architecture.md ===
|
|
1546
1542
|
- Por modulo interno: === .agent/context/[nombre-componente]/modules/[nombre-modulo].md ===
|
|
1547
1543
|
- Documenta TODOS los componentes no triviales del DIRECTORIO_TRABAJO
|
|
1544
|
+
- NO escribir nada bajo .agent/docs/ — esa carpeta es de uso manual
|
|
1548
1545
|
- Si existe documentacion previa, ACTUALIZALA preservando lo que sigue siendo valido y agregando lo nuevo`;
|
|
1549
1546
|
const res = await this.runWithFallback('explorer', prompt, 'Exploracion');
|
|
1550
1547
|
const text = extractCliText(res);
|
|
@@ -1574,8 +1571,8 @@ REGLAS DE PATHS:
|
|
|
1574
1571
|
content = content.replace(/^```markdown\s*/i, '').replace(/^```\s*$/gm, '').trim();
|
|
1575
1572
|
if (!content)
|
|
1576
1573
|
continue;
|
|
1577
|
-
//
|
|
1578
|
-
|
|
1574
|
+
// All explorer output goes under .agent/context/ — docs/ is manual-only
|
|
1575
|
+
const relPath = fileName.replace(/^\.agent\/context\//i, '').replace(/^\/+/, '');
|
|
1579
1576
|
let targetPath = null;
|
|
1580
1577
|
if (relPath === 'architecture.md' || relPath === 'ARCHITECTURE.md') {
|
|
1581
1578
|
targetPath = mainArchPath;
|