gufi-cli 0.1.10 → 0.1.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/CLAUDE.md +12 -11
- package/dist/commands/companies.js +31 -3
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -1569,27 +1569,28 @@ npm install -g gufi-cli
|
|
|
1569
1569
|
gufi login
|
|
1570
1570
|
```
|
|
1571
1571
|
|
|
1572
|
-
### 💜 Autenticación Persistente
|
|
1572
|
+
### 💜 Autenticación Persistente (Auto-Login)
|
|
1573
1573
|
|
|
1574
|
-
El CLI guarda las credenciales en `~/.gufi/config.json`
|
|
1574
|
+
El CLI guarda las credenciales en `~/.gufi/config.json` y hace **auto-login automático** cuando es necesario:
|
|
1575
1575
|
|
|
1576
1576
|
```json
|
|
1577
1577
|
{
|
|
1578
1578
|
"apiUrl": "https://gogufi.com",
|
|
1579
|
-
"token": "eyJ...",
|
|
1580
|
-
"refreshToken": "eyJ...",
|
|
1581
1579
|
"email": "user@example.com",
|
|
1582
|
-
"password": "secreto"
|
|
1580
|
+
"password": "secreto",
|
|
1581
|
+
"token": "eyJ...",
|
|
1582
|
+
"refreshToken": "eyJ..."
|
|
1583
1583
|
}
|
|
1584
1584
|
```
|
|
1585
1585
|
|
|
1586
|
-
**Flujo
|
|
1587
|
-
1.
|
|
1588
|
-
2.
|
|
1589
|
-
3.
|
|
1590
|
-
|
|
1586
|
+
**Flujo automático:**
|
|
1587
|
+
1. `gufi login` → pide email/password → los guarda permanentemente
|
|
1588
|
+
2. Cualquier comando → si token expiró → auto-login con credenciales guardadas
|
|
1589
|
+
3. `gufi logout` → borra TODO (token + credenciales)
|
|
1590
|
+
|
|
1591
|
+
**Resultado:** Una vez haces `gufi login`, el CLI funciona para siempre sin volver a pedir credenciales. Si el token expira, hace auto-login automáticamente.
|
|
1591
1592
|
|
|
1592
|
-
**
|
|
1593
|
+
**Nota:** Si haces login en el navegador web, el refreshToken del CLI se invalida, pero el CLI hace auto-login automáticamente con las credenciales guardadas.
|
|
1593
1594
|
|
|
1594
1595
|
### Gestión de Companies y Módulos
|
|
1595
1596
|
|
|
@@ -375,12 +375,40 @@ export async function moduleUpdateCommand(moduleId, jsonFile, options) {
|
|
|
375
375
|
process.exit(1);
|
|
376
376
|
}
|
|
377
377
|
console.log(chalk.green(" ✓ JSON válido"));
|
|
378
|
+
// 💜 Step 1: Dry-run para ver qué cambios se harán
|
|
379
|
+
console.log(chalk.gray(" Verificando cambios (dry-run)..."));
|
|
380
|
+
const preview = await apiRequest(`/api/company/modules/${moduleId}`, {
|
|
381
|
+
method: "PUT",
|
|
382
|
+
headers,
|
|
383
|
+
body: JSON.stringify({ json: newJson, confirm: false }),
|
|
384
|
+
});
|
|
385
|
+
// Mostrar preview de cambios
|
|
386
|
+
const hasChanges = preview.tablesCreated?.length || preview.columnsAdded?.length ||
|
|
387
|
+
preview.columnsRemoved?.length || preview.tablesRemoved?.length;
|
|
388
|
+
if (hasChanges) {
|
|
389
|
+
console.log(chalk.cyan("\n 📋 Cambios detectados:"));
|
|
390
|
+
if (preview.tablesCreated?.length) {
|
|
391
|
+
console.log(chalk.green(` + Tablas a crear: ${preview.tablesCreated.join(", ")}`));
|
|
392
|
+
}
|
|
393
|
+
if (preview.columnsAdded?.length) {
|
|
394
|
+
console.log(chalk.green(` + Columnas a añadir: ${preview.columnsAdded.join(", ")}`));
|
|
395
|
+
}
|
|
396
|
+
if (preview.columnsRemoved?.length) {
|
|
397
|
+
console.log(chalk.yellow(` - Columnas a eliminar: ${preview.columnsRemoved.join(", ")}`));
|
|
398
|
+
}
|
|
399
|
+
if (preview.tablesRemoved?.length) {
|
|
400
|
+
console.log(chalk.red(` - Tablas a eliminar: ${preview.tablesRemoved.join(", ")}`));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
console.log(chalk.gray(" Sin cambios estructurales detectados."));
|
|
405
|
+
}
|
|
378
406
|
if (options?.dryRun) {
|
|
379
|
-
console.log(chalk.gray("\n [DRY RUN]
|
|
407
|
+
console.log(chalk.gray("\n [DRY RUN] Vista previa completada. Usa sin --dry-run para aplicar.\n"));
|
|
380
408
|
return;
|
|
381
409
|
}
|
|
382
|
-
//
|
|
383
|
-
console.log(chalk.gray(" Aplicando cambios..."));
|
|
410
|
+
// 💜 Step 2: Aplicar cambios (confirm: true)
|
|
411
|
+
console.log(chalk.gray("\n Aplicando cambios..."));
|
|
384
412
|
const result = await apiRequest(`/api/company/modules/${moduleId}`, {
|
|
385
413
|
method: "PUT",
|
|
386
414
|
headers,
|