siesa-agents 2.1.38 → 2.1.39
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/bin/install.js +28 -2
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const fs = require('fs-extra');
|
|
4
4
|
const path = require('path');
|
|
@@ -47,13 +47,36 @@ class SiesaBmadInstaller {
|
|
|
47
47
|
// Opción 1: directorio padre del bin (instalación normal)
|
|
48
48
|
let packageDir = path.dirname(__dirname);
|
|
49
49
|
|
|
50
|
+
// Debug: mostrar información de diagnóstico
|
|
51
|
+
const debug = process.env.SIESA_DEBUG === '1';
|
|
52
|
+
if (debug) {
|
|
53
|
+
console.log('\n🔍 DEBUG - Buscando directorio del paquete:');
|
|
54
|
+
console.log(` __dirname: ${__dirname}`);
|
|
55
|
+
console.log(` packageDir inicial: ${packageDir}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Verificar si _bmad existe en el directorio inicial
|
|
59
|
+
const bmadPath = path.join(packageDir, '_bmad');
|
|
60
|
+
if (debug) {
|
|
61
|
+
console.log(` Verificando _bmad en: ${bmadPath}`);
|
|
62
|
+
console.log(` ¿Existe _bmad?: ${fs.existsSync(bmadPath)}`);
|
|
63
|
+
|
|
64
|
+
// Listar contenido del directorio
|
|
65
|
+
try {
|
|
66
|
+
const contents = fs.readdirSync(packageDir);
|
|
67
|
+
console.log(` Contenido de packageDir: ${contents.join(', ')}`);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.log(` Error listando directorio: ${e.message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
50
73
|
// Opción 2: si estamos en npx, buscar en node_modules
|
|
51
74
|
if (!this.hasRequiredFolders(packageDir)) {
|
|
52
75
|
// Para npm 6.14+ y npx, intentar ubicaciones alternativas
|
|
53
76
|
const possiblePaths = [
|
|
54
77
|
path.join(__dirname, '..'), // bin -> paquete
|
|
55
78
|
path.resolve(__dirname, '..'), // alternativa con resolve
|
|
56
|
-
path.resolve(__dirname, '..', '..', 'siesa-
|
|
79
|
+
path.resolve(__dirname, '..', '..', 'siesa-agents'), // desde node_modules
|
|
57
80
|
// Intentar buscar basado en __dirname específicamente para npx
|
|
58
81
|
path.resolve(__dirname.replace(/\\bin$|\/bin$/, '')),
|
|
59
82
|
process.cwd(), // directorio actual como último recurso
|
|
@@ -62,6 +85,9 @@ class SiesaBmadInstaller {
|
|
|
62
85
|
for (const possiblePath of possiblePaths) {
|
|
63
86
|
if (this.hasRequiredFolders(possiblePath)) {
|
|
64
87
|
packageDir = possiblePath;
|
|
88
|
+
if (debug) {
|
|
89
|
+
console.log(` Encontrado en: ${possiblePath}`);
|
|
90
|
+
}
|
|
65
91
|
break;
|
|
66
92
|
}
|
|
67
93
|
}
|