synthesisui 0.16.178 → 0.16.179
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/dist/commands/add.js +35 -13
- package/package.json +1 -1
package/dist/commands/add.js
CHANGED
|
@@ -25,23 +25,45 @@ import { detectStack } from "../stack.js";
|
|
|
25
25
|
*
|
|
26
26
|
* Escrito uma vez e nunca reescrito: um arquivo que alguém ajustou é decisão dele.
|
|
27
27
|
*/
|
|
28
|
+
/**
|
|
29
|
+
* O que NÃO é do repositório: a medição e o registro local. Ambos são reescritos por inteiro a cada
|
|
30
|
+
* rodada e conflitariam em todo merge; o `.ledger-sent` descreve este clone e mais nada.
|
|
31
|
+
*/
|
|
32
|
+
const IGNORED = [
|
|
33
|
+
"census.json",
|
|
34
|
+
"ledger.jsonl",
|
|
35
|
+
".ledger-sent",
|
|
36
|
+
"not-expressed.md",
|
|
37
|
+
];
|
|
38
|
+
const IGNORE_HEADER = "# Managed by synthesisui. The identity and the CSS are committed so a fresh\n" +
|
|
39
|
+
"# clone is governed; the measurement and the local record are not, because\n" +
|
|
40
|
+
"# both are rewritten in full on every run and would conflict on every merge.\n";
|
|
28
41
|
async function writeGovernanceIgnore(projectRoot) {
|
|
29
42
|
const path = join(projectRoot, "_synthesisui", ".gitignore");
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
const existing = await readFile(path, "utf8").catch(() => null);
|
|
44
|
+
/**
|
|
45
|
+
* O ARQUIVO DIZ "Managed by synthesisui", E ELE PRECISA SER.
|
|
46
|
+
*
|
|
47
|
+
* Isto saía na primeira linha quando o arquivo já existia, então ele era escrito UMA vez e nunca
|
|
48
|
+
* mais. A consequência aparece na primeira vez que a gente acrescenta um registro local: em 07/08
|
|
49
|
+
* nasceu o `.ledger-sent`, e todo repositório que já tinha o `.gitignore` passaria a commitar um
|
|
50
|
+
* cursor que descreve a máquina de UMA pessoa. Um arquivo que se declara gerenciado e não é
|
|
51
|
+
* reconciliado é uma promessa quebrada com o time de alguém.
|
|
52
|
+
*
|
|
53
|
+
* ACRESCENTA, NUNCA REMOVE: uma linha que a pessoa escreveu ali é decisão dela, e some no dia em
|
|
54
|
+
* que a gente reescrevesse o arquivo inteiro. E só grava quando falta algo - um comando que sempre
|
|
55
|
+
* produz diff é um comando que o time para de rodar.
|
|
56
|
+
*/
|
|
57
|
+
if (existing == null) {
|
|
58
|
+
await writeFile(path, `${IGNORE_HEADER}${IGNORED.map((l) => `${l}\n`).join("")}`, "utf8");
|
|
32
59
|
return;
|
|
33
60
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"census.json\n" +
|
|
41
|
-
"ledger.jsonl\n" +
|
|
42
|
-
/** O cursor de envio descreve ESTE clone, não o repositório - ver `markSent`. */
|
|
43
|
-
".ledger-sent\n" +
|
|
44
|
-
"not-expressed.md\n", "utf8");
|
|
61
|
+
const lines = new Set(existing.split("\n").map((l) => l.trim()));
|
|
62
|
+
const missing = IGNORED.filter((l) => !lines.has(l));
|
|
63
|
+
if (missing.length === 0)
|
|
64
|
+
return;
|
|
65
|
+
const sep = existing.endsWith("\n") ? "" : "\n";
|
|
66
|
+
await writeFile(path, `${existing}${sep}${missing.map((l) => `${l}\n`).join("")}`, "utf8");
|
|
45
67
|
}
|
|
46
68
|
/**
|
|
47
69
|
* APAGA A PROSA QUE ESTA VERSÃO DEIXOU DE ESCREVER.
|
package/package.json
CHANGED