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.
Files changed (2) hide show
  1. package/dist/core/engine.js +25 -12
  2. package/package.json +1 -1
@@ -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
- - NO incluyas texto explicativo fuera de los archivos
1136
+ - USA NOMBRES CORTOS: NO uses rutas absolutas
1137
1137
  - El archivo principal SIEMPRE es === architecture.md ===
1138
- - Para cada componente con modulos internos: === [nombre]/architecture.md === + === [nombre]/modules/[modulo].md ===
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
- // Component doc: [component]/architecture.md or [component]/modules/[mod].md
1162
- // fileName could be: "datamart-data-access-api/architecture.md" or "datamart-data-access-api/modules/config.md"
1163
- const compMatch = fileName.match(/^(.+?)\/architecture\.md$/i);
1164
- const modMatch = fileName.match(/^(.+?)\/modules\/(.+\.md)$/i);
1165
- if (compMatch) {
1166
- targetPath = path.join(contextDir, compMatch[1], 'architecture.md');
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 (modMatch) {
1169
- targetPath = path.join(contextDir, modMatch[1], 'modules', modMatch[2]);
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
- // Fallback: treat as modules file in legacy modules/ dir
1173
- targetPath = path.join(contextDir, 'modules', fileName.replace(/.*\//, ''));
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-mp",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "Deterministic multi-agent CLI orchestrator — plan, code, review",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",