agent-mp 0.5.10 → 0.5.11
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 +25 -12
- package/package.json +1 -1
package/dist/core/engine.js
CHANGED
|
@@ -1133,9 +1133,10 @@ Si es un controller/router:
|
|
|
1133
1133
|
|
|
1134
1134
|
REGLAS:
|
|
1135
1135
|
- Devuelve UNICAMENTE los archivos separados por === path/file.md ===
|
|
1136
|
-
-
|
|
1136
|
+
- USA NOMBRES CORTOS: NO uses rutas absolutas
|
|
1137
1137
|
- El archivo principal SIEMPRE es === architecture.md ===
|
|
1138
|
-
- Para
|
|
1138
|
+
- Para componentes: === nombre-del-componente/architecture.md ===
|
|
1139
|
+
- Para modulos internos: === nombre-del-componente/modules/nombre-modulo.md ===
|
|
1139
1140
|
- Para componentes triviales (scripts, docs): solo mencionarlos en architecture.md principal
|
|
1140
1141
|
- Documenta TODOS los directorios al nivel de DIRECTORIO_TRABAJO (excluyendo .agent)
|
|
1141
1142
|
- Si hay documentacion existente, actualizala con los cambios detectados`;
|
|
@@ -1158,20 +1159,32 @@ REGLAS:
|
|
|
1158
1159
|
targetPath = mainArchPath;
|
|
1159
1160
|
}
|
|
1160
1161
|
else {
|
|
1161
|
-
//
|
|
1162
|
-
// fileName could be: "datamart-data-access-api/architecture.md"
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1162
|
+
// CRITICAL: Extract only the relative path components, strip any absolute path prefix
|
|
1163
|
+
// fileName could be: "datamart-data-access-api/architecture.md"
|
|
1164
|
+
// or "/home/user/project/datamart-data-access-api/architecture.md" (BAD — must ignore prefix)
|
|
1165
|
+
// We only want the components relative to contextDir
|
|
1166
|
+
// Remove any leading absolute path by extracting the last meaningful path segments
|
|
1167
|
+
const cleanName = fileName.replace(/^.*[\/\\]/, ''); // strip any prefix
|
|
1168
|
+
// Check if it's a component architecture file: "component/architecture.md" or "component/modules/mod.md"
|
|
1169
|
+
const pathParts = fileName.split(/[\/\\]/).filter(Boolean);
|
|
1170
|
+
// Keep only the last 2-3 parts (component name + file)
|
|
1171
|
+
// e.g. ["/home", "user", "proj", "datamart", "architecture.md"] → ["datamart", "architecture.md"]
|
|
1172
|
+
// e.g. ["datamart-data-access-api", "architecture.md"] → same
|
|
1173
|
+
// e.g. ["datamart-data-access-api", "modules", "config.md"] → same
|
|
1174
|
+
let relPath;
|
|
1175
|
+
if (pathParts.length >= 3 && pathParts[pathParts.length - 2] === 'modules') {
|
|
1176
|
+
// component/modules/file.md
|
|
1177
|
+
relPath = path.join(pathParts[pathParts.length - 3], 'modules', pathParts[pathParts.length - 1]);
|
|
1167
1178
|
}
|
|
1168
|
-
else if (
|
|
1169
|
-
|
|
1179
|
+
else if (pathParts.length >= 2) {
|
|
1180
|
+
// component/file.md
|
|
1181
|
+
relPath = path.join(pathParts[pathParts.length - 2], pathParts[pathParts.length - 1]);
|
|
1170
1182
|
}
|
|
1171
1183
|
else {
|
|
1172
|
-
//
|
|
1173
|
-
|
|
1184
|
+
// fallback
|
|
1185
|
+
relPath = path.join('modules', cleanName);
|
|
1174
1186
|
}
|
|
1187
|
+
targetPath = path.join(contextDir, relPath);
|
|
1175
1188
|
}
|
|
1176
1189
|
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
1177
1190
|
await writeFile(targetPath, content);
|