Elffuss BraidHub

utopia-ia/elffuss-code public

Text files stay text for git: no literal NUL in md.js and arch.js

md.js (the Markdown sentinel) and arch.js (a map key separator) had a NUL
byte written literally inside a string. With one in it, git treats the whole
file as binary: `git diff` only says "Binary files differ" and `git grep -I`
skips the file, so nothing that changed in them showed up when reviewing or
sweeping a diff before publishing. Both are now written '\u0000', which is
the same string for JavaScript. md.js is a copy of the elffuss core; the same
change goes there.

goal.js also loses a local folder path in a comment.

tests/texto-plano.mjs walks the repository's text files and fails if any of
them holds a NUL byte. On the previous tree it names arch.js and md.js.
tests/md.mjs still passes.
Changesetdad4d49e20636fee2a6a68002909fa023bbd879a697104811baf6b3da7b1e110
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-11 17:35 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 17:35 +02:00
Parentsf97f74b2d94c

Browse the files at this changeset

4 files changed

added tests/texto-plano.mjs +38 −0
@@ -0,0 +1,38 @@
1+// Los ficheros de texto del repo son texto para git: ninguno lleva un byte NUL
2+// literal. Con uno dentro, git trata el fichero entero como binario: `git diff`
3+// solo dice «Binary files differ» y `git grep -I` se lo salta, así que nada de lo
4+// que cambia en él se ve al revisar ni al barrer el diff antes de publicar. Pasó
5+// con md.js y arch.js (un centinela '\0' escrito tal cual); dentro de una cadena
6+// se escribe '\u0000', que es lo mismo para JavaScript.
7+//
8+// node tests/texto-plano.mjs
9+import { readdirSync, readFileSync, statSync } from 'node:fs';
10+import { join, relative, extname } from 'node:path';
11+import { fileURLToPath } from 'node:url';
12+
13+const RAIZ = fileURLToPath(new URL('..', import.meta.url));
14+const TEXTO = new Set(['.js', '.mjs', '.cjs', '.css', '.html', '.json', '.md', '.py', '.sh', '.go', '.txt', '.svg', '.webmanifest', '.yml', '.yaml']);
15+const FUERA = new Set(['node_modules', '.git']);
16+
17+let fallos = 0, vistos = 0;
18+const ok = (n, c, e = '') => { console.log(`${c ? '✅' : '❌'} ${n}${e ? ' — ' + e : ''}`); if (!c) fallos++; };
19+
20+const conNul = [];
21+function recorre(dir) {
22+ for (const nombre of readdirSync(dir)) {
23+ if (FUERA.has(nombre)) continue;
24+ const ruta = join(dir, nombre);
25+ const st = statSync(ruta, { throwIfNoEntry: false });
26+ if (!st) continue;
27+ if (st.isDirectory()) { recorre(ruta); continue; }
28+ if (!TEXTO.has(extname(nombre).toLowerCase())) continue;
29+ vistos++;
30+ if (readFileSync(ruta).includes(0)) conNul.push(relative(RAIZ, ruta));
31+ }
32+}
33+recorre(RAIZ);
34+
35+ok(`se revisan los ficheros de texto del repo (${vistos})`, vistos > 50, `${vistos} ficheros`);
36+ok('ninguno lleva un byte NUL literal (git lo trataría como binario)', conNul.length === 0, conNul.join(', '));
37+console.log(fallos ? `\n❌ ${fallos} FALLO(S)` : '\n✅ TEXTO PLANO: git ve todos los ficheros de texto como texto');
38+process.exit(fallos ? 1 : 0);
modified web/js/arch.js +0 −0

Binary content is not shown. View the file.

modified web/js/goal.js +1 −1
@@ -1,5 +1,5 @@
11 // Modo Objetivo (🎯 Goal): mismo patrón planificador/ejecutor que clonagent
2-// (~/work2026/clonagent) — un PLANIFICADOR descompone el objetivo en una
2+// — un PLANIFICADOR descompone el objetivo en una
33 // lista de tareas con estado (pending/in-progress/done/failed/skipped), y un
44 // EJECUTOR las va ejecutando una a una hasta que no queda ninguna pendiente,
55 // marcando el resultado de cada una. Si una tarea falla, las siguientes se
modified web/js/md.js +0 −0

Binary content is not shown. View the file.