agent-mp 0.5.12 → 0.5.13
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 +34 -29
- package/package.json +1 -1
package/dist/core/engine.js
CHANGED
|
@@ -1264,26 +1264,35 @@ FORMATO DE SALIDA — OBLIGATORIO
|
|
|
1264
1264
|
================================================================
|
|
1265
1265
|
Devolve UNICAMENTE bloques de archivos separados por marcadores ===. Nada de explicaciones extra fuera de los bloques.
|
|
1266
1266
|
|
|
1267
|
-
|
|
1267
|
+
IMPORTANTE: TODAS las rutas son RELATIVAS al directorio del proyecto.
|
|
1268
|
+
Los archivos se escriben SIEMPRE dentro de .agent/context/
|
|
1269
|
+
|
|
1270
|
+
Ejemplos de marcadores:
|
|
1271
|
+
=== .agent/context/architecture.md ===
|
|
1272
|
+
=== .agent/context/datamart-data-access-api/architecture.md ===
|
|
1273
|
+
=== .agent/context/datamart-data-access-api/modules/auth.md ===
|
|
1274
|
+
=== .agent/context/nexus-core-api/architecture.md ===
|
|
1275
|
+
=== .agent/context/nexus-core-api/modules/users.md ===
|
|
1276
|
+
|
|
1277
|
+
=== .agent/context/architecture.md ===
|
|
1268
1278
|
[contenido completo del NIVEL 0]
|
|
1269
1279
|
|
|
1270
|
-
=== nombre-componente-1/architecture.md ===
|
|
1280
|
+
=== .agent/context/nombre-componente-1/architecture.md ===
|
|
1271
1281
|
[contenido completo del NIVEL 1 del componente 1]
|
|
1272
1282
|
|
|
1273
|
-
=== nombre-componente-1/modules/auth.md ===
|
|
1283
|
+
=== .agent/context/nombre-componente-1/modules/auth.md ===
|
|
1274
1284
|
[contenido completo del NIVEL 2 del modulo auth]
|
|
1275
1285
|
|
|
1276
|
-
=== nombre-componente-1/modules/leads.md ===
|
|
1286
|
+
=== .agent/context/nombre-componente-1/modules/leads.md ===
|
|
1277
1287
|
[contenido completo del NIVEL 2 del modulo leads]
|
|
1278
1288
|
|
|
1279
|
-
=== nombre-componente-2/architecture.md ===
|
|
1289
|
+
=== .agent/context/nombre-componente-2/architecture.md ===
|
|
1280
1290
|
...
|
|
1281
1291
|
|
|
1282
1292
|
REGLAS DE PATHS:
|
|
1283
|
-
- El archivo principal SIEMPRE es: === architecture.md ===
|
|
1284
|
-
- Por componente: === [nombre-componente]/architecture.md ===
|
|
1285
|
-
- Por modulo interno: === [nombre-componente]/modules/[nombre-modulo].md ===
|
|
1286
|
-
- USA SIEMPRE rutas RELATIVAS, jamas absolutas
|
|
1293
|
+
- El archivo principal SIEMPRE es: === .agent/context/architecture.md ===
|
|
1294
|
+
- Por componente: === .agent/context/[nombre-componente]/architecture.md ===
|
|
1295
|
+
- Por modulo interno: === .agent/context/[nombre-componente]/modules/[nombre-modulo].md ===
|
|
1287
1296
|
- Documenta TODOS los componentes no triviales del DIRECTORIO_TRABAJO
|
|
1288
1297
|
- Si existe documentacion previa, ACTUALIZALA preservando lo que sigue siendo valido y agregando lo nuevo`;
|
|
1289
1298
|
const res = await this.runWithFallback('explorer', prompt, 'Exploracion');
|
|
@@ -1300,37 +1309,33 @@ REGLAS DE PATHS:
|
|
|
1300
1309
|
content = content.replace(/^```markdown\s*/i, '').replace(/^```\s*$/gm, '').trim();
|
|
1301
1310
|
try {
|
|
1302
1311
|
let targetPath;
|
|
1303
|
-
|
|
1312
|
+
// Normalize: strip any .agent/context/ prefix from the marker
|
|
1313
|
+
let relPath = fileName.replace(/^\.agent\/context\//i, '');
|
|
1314
|
+
if (relPath === 'architecture.md' || relPath === 'ARCHITECTURE.md' || relPath === fileName) {
|
|
1304
1315
|
// Main architecture doc
|
|
1305
|
-
|
|
1316
|
+
if (relPath === 'architecture.md' || relPath === 'ARCHITECTURE.md') {
|
|
1317
|
+
targetPath = mainArchPath;
|
|
1318
|
+
}
|
|
1319
|
+
else {
|
|
1320
|
+
// Fallback for unrecognized paths: skip
|
|
1321
|
+
continue;
|
|
1322
|
+
}
|
|
1306
1323
|
}
|
|
1307
1324
|
else {
|
|
1308
|
-
//
|
|
1309
|
-
|
|
1310
|
-
// or "/home/user/project/datamart-data-access-api/architecture.md" (BAD — must ignore prefix)
|
|
1311
|
-
// We only want the components relative to contextDir
|
|
1312
|
-
// Remove any leading absolute path by extracting the last meaningful path segments
|
|
1313
|
-
const cleanName = fileName.replace(/^.*[\/\\]/, ''); // strip any prefix
|
|
1314
|
-
// Check if it's a component architecture file: "component/architecture.md" or "component/modules/mod.md"
|
|
1315
|
-
const pathParts = fileName.split(/[\/\\]/).filter(Boolean);
|
|
1316
|
-
// Keep only the last 2-3 parts (component name + file)
|
|
1317
|
-
// e.g. ["/home", "user", "proj", "datamart", "architecture.md"] → ["datamart", "architecture.md"]
|
|
1318
|
-
// e.g. ["datamart-data-access-api", "architecture.md"] → same
|
|
1319
|
-
// e.g. ["datamart-data-access-api", "modules", "config.md"] → same
|
|
1320
|
-
let relPath;
|
|
1325
|
+
// Component doc: component/architecture.md or component/modules/mod.md
|
|
1326
|
+
const pathParts = relPath.split(/[\/\\]/).filter(Boolean);
|
|
1321
1327
|
if (pathParts.length >= 3 && pathParts[pathParts.length - 2] === 'modules') {
|
|
1322
1328
|
// component/modules/file.md
|
|
1323
|
-
|
|
1329
|
+
targetPath = path.join(contextDir, pathParts[pathParts.length - 3], 'modules', pathParts[pathParts.length - 1]);
|
|
1324
1330
|
}
|
|
1325
1331
|
else if (pathParts.length >= 2) {
|
|
1326
1332
|
// component/file.md
|
|
1327
|
-
|
|
1333
|
+
targetPath = path.join(contextDir, pathParts[pathParts.length - 2], pathParts[pathParts.length - 1]);
|
|
1328
1334
|
}
|
|
1329
1335
|
else {
|
|
1330
|
-
//
|
|
1331
|
-
|
|
1336
|
+
// Fallback
|
|
1337
|
+
continue;
|
|
1332
1338
|
}
|
|
1333
|
-
targetPath = path.join(contextDir, relPath);
|
|
1334
1339
|
}
|
|
1335
1340
|
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
1336
1341
|
await writeFile(targetPath, content);
|