@meiti/healer 0.7.0 → 0.7.1
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/check.mjs +11 -3
- package/package.json +1 -1
package/check.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import path from 'node:path';
|
|
|
15
15
|
import { rutasDelProyecto, archivosDelProyecto, resumenOmitidos } from './mcp/proyecto.mjs';
|
|
16
16
|
|
|
17
17
|
const API = (process.env.HEALER_API_URL || 'https://healer-api.meiti.dev').replace(/\/$/, '');
|
|
18
|
-
const VERSION = '0.7.
|
|
18
|
+
const VERSION = '0.7.1';
|
|
19
19
|
const es = /^es/i.test(process.env.HEALER_LANG || Intl.DateTimeFormat().resolvedOptions().locale || '');
|
|
20
20
|
const tx = (en, esp) => (es ? esp : en);
|
|
21
21
|
|
|
@@ -188,9 +188,17 @@ export async function instalarHook(raiz, { bloquear = false, completo = false }
|
|
|
188
188
|
fs.mkdirSync(c.carpeta, { recursive: true });
|
|
189
189
|
const escribir = (nombre, bloque) => {
|
|
190
190
|
const ruta = path.join(c.carpeta, nombre);
|
|
191
|
-
let actual =
|
|
191
|
+
let actual = null;
|
|
192
192
|
try { actual = fs.readFileSync(ruta, 'utf8'); } catch { /* no había */ }
|
|
193
|
-
|
|
193
|
+
// Sin bloque que poner: si el archivo no existía no se crea, y si solo tenía el nuestro se borra (antes quedaba vacío).
|
|
194
|
+
if (!bloque) {
|
|
195
|
+
if (actual === null) return;
|
|
196
|
+
const limpio = sinBloque(actual);
|
|
197
|
+
if (!limpio.replace(/^#!.*$/m, '').trim()) { fs.rmSync(ruta, { force: true }); return; }
|
|
198
|
+
fs.writeFileSync(ruta, limpio);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
fs.writeFileSync(ruta, conBloque(actual ?? '', bloque));
|
|
194
202
|
try { fs.chmodSync(ruta, 0o755); } catch { /* Windows: git for Windows lo corre igual */ }
|
|
195
203
|
};
|
|
196
204
|
escribir('pre-commit', bloquePreCommit({ bloquear }));
|