synthesisui 0.16.210 → 0.16.212

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.
@@ -5,7 +5,7 @@ import { pinnedHookVersion } from "../agent-wiring.js";
5
5
  import { isOlderCli } from "../cli-version.js";
6
6
  import { readToken, resolveRegistry } from "../config.js";
7
7
  import { unsentEvents } from "../doctor/ledger.js";
8
- import { CHECKER_SINCE, MATERIALISER_SINCE, READER_SINCE, } from "../install-marks.js";
8
+ import { CHECKER_SINCE, installedBehind, MATERIALISER_SINCE, READER_SINCE, } from "../install-marks.js";
9
9
  import { measuredScope } from "../measured-scope.js";
10
10
  /**
11
11
  * QUAL CLI MEDIU O CENSO EM DISCO - e era o `reader`, um inteiro, até 11/08.
@@ -81,13 +81,7 @@ async function credentials(home) {
81
81
  * nada com `upgrade` - o comando usa o CLI que ela tem. Mandar rodar ali é gastar a atenção dela num
82
82
  * comando que não pode mudar nada, e o caminho de verdade é outro (`connect`).
83
83
  */
84
- function behind(installed, running, since) {
85
- if (!installed || !running)
86
- return null;
87
- if (!isOlderCli(installed, since))
88
- return null;
89
- return isOlderCli(running, since) ? null : installed;
90
- }
84
+ const behind = (installed, running, since) => installedBehind(installed, running, since, isOlderCli);
91
85
  export async function localMisalignments(root,
92
86
  /**
93
87
  * `home` é injetável porque a SESSÃO mora nele e não no repo - e uma verificação que lê o home da
@@ -363,6 +363,8 @@ export async function remeasure(args) {
363
363
  ?.declarations ?? 0,
364
364
  seen: sum(led?.counted),
365
365
  interpreted: sum(led?.interpreted),
366
+ /** O que não foi lido, por MOTIVO - ver `unread` em `SyncMark`. */
367
+ unread: Object.fromEntries((led?.unread ?? []).map((g) => [g.reason ?? "unknown", g.uses ?? 0])),
366
368
  /** O que cada componente LÊ - ver `readings` em `SyncMark`, e o defeito que ele conserta. */
367
369
  ...(args.cli ? { cli: args.cli } : {}),
368
370
  readings: fingerprintReadings(census.components),
@@ -1,9 +1,11 @@
1
1
  import { readdir, readFile, writeFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { pinnedHookVersion, wireAgent } from "../agent-wiring.js";
4
+ import { isOlderCli } from "../cli-version.js";
4
5
  import { generateComponentFiles } from "../component-codegen.js";
5
6
  import { readProjectConfig, resolveRegistry } from "../config.js";
6
7
  import { diffLocalDocuments, localChangelogMarkdown, } from "../document-diff.js";
8
+ import { installedBehind, MATERIALISER_SINCE } from "../install-marks.js";
7
9
  import { body, section, snippet } from "../output.js";
8
10
  import { reactMajorOf, readInstalledConvention } from "../project-facts.js";
9
11
  import { fetchChangelog, fetchComponent, fetchDesignSystem, RegistryError, } from "../registry.js";
@@ -112,8 +114,17 @@ async function staleInstall(root, slug, version, base, cli) {
112
114
  why.push("the css is compiled differently now");
113
115
  if (meta?.rulesStamp != null && meta.rulesStamp !== (lock.rules ?? null))
114
116
  why.push("the rules that govern it changed");
115
- if (cli && lock.cli && lock.cli !== cli)
116
- why.push(`these files were written by CLI ${lock.cli}`);
117
+ /**
118
+ * COMPARA `MATERIALISER_SINCE`, e não a string da versão - a mesma correção que o `align` recebeu.
119
+ *
120
+ * O dono rodou `upgrade` em 11/08 e leu *"these files were written by CLI 0.16.210 -
121
+ * re-materializing"* com a marca em 0.16.204: o comando reescrevia, e ANUNCIAVA reescrever,
122
+ * arquivos que sairiam byte a byte iguais. Consertar o alarme e deixar o comando é dizer duas
123
+ * coisas sobre um fato só.
124
+ */
125
+ const staleFiles = installedBehind(lock.cli, cli, MATERIALISER_SINCE, isOlderCli);
126
+ if (staleFiles)
127
+ why.push(`these files were written by CLI ${staleFiles}`);
117
128
  return why.length > 0 ? `${why.join(", ")} - re-materializing` : null;
118
129
  }
119
130
  /**
@@ -101,3 +101,28 @@ export const CHECKER_SINCE = "0.16.202";
101
101
  * Um censo medido antes disto carrega as duas leituras erradas.
102
102
  */
103
103
  export const READER_SINCE = "0.16.210";
104
+ /**
105
+ * O QUE ESTÁ INSTALADO AQUI FICOU PARA TRÁS - e as DUAS condições que fazem isso ser verdade.
106
+ *
107
+ * `installed` é a versão que escreveu a coisa; `running` é o CLI de hoje; `since` é a última versão
108
+ * em que aquilo mudou de verdade. Nenhuma das duas basta sozinha:
109
+ *
110
+ * o que está instalado é ANTERIOR à última mudança senão reescreve bytes idênticos
111
+ * o CLI de hoje já ALCANÇOU essa mudança senão escreve a mesma coisa velha
112
+ *
113
+ * Nasceu privado dentro do `align` e virou exportado quando o dono rodou `upgrade` em 11/08 e leu
114
+ * *"these files were written by CLI 0.16.210 - re-materializing"* com `MATERIALISER_SINCE` em
115
+ * 0.16.204: o comando ainda comparava a STRING da versão, então ele anunciava reescrever arquivos
116
+ * que sairiam byte a byte iguais. Consertar o alarme e deixar o comando é dizer duas coisas sobre
117
+ * um fato só.
118
+ *
119
+ * `isOlder` entra por parâmetro para este módulo continuar sem import nenhum - ele é lido pelo spec
120
+ * gêmeo da plataforma como TEXTO, e uma dependência aqui é uma dependência lá.
121
+ */
122
+ export function installedBehind(installed, running, since, isOlder) {
123
+ if (!installed || !running)
124
+ return null;
125
+ if (!isOlder(installed, since))
126
+ return null;
127
+ return isOlder(running, since) ? null : installed;
128
+ }
package/dist/last-sync.js CHANGED
@@ -66,6 +66,29 @@ export async function writeSyncMark(root, mark) {
66
66
  * parecer um salto enorme. E quando nada mudou ela DIZ que nada mudou: é a resposta mais útil que uma
67
67
  * re-medição pode dar, e é a que o relatório longo nunca conseguiu dar em seis execuções.
68
68
  */
69
+ /**
70
+ * OS MOTIVOS QUE MUDARAM DE TAMANHO, nomeados - ver `unread` em `SyncMark`.
71
+ *
72
+ * `undefined` de um lado é marca anterior a este campo, e ali silêncio é a resposta: comparar contra
73
+ * ausência produziria "tudo é novo" na primeira vez, para todo mundo.
74
+ */
75
+ function unreadDelta(now, before) {
76
+ if (!now.unread || !before.unread)
77
+ return null;
78
+ const keys = [
79
+ ...new Set([...Object.keys(before.unread), ...Object.keys(now.unread)]),
80
+ ].sort();
81
+ const moved = keys
82
+ .map((k) => ({
83
+ k,
84
+ from: before.unread?.[k] ?? 0,
85
+ to: now.unread?.[k] ?? 0,
86
+ }))
87
+ .filter((m) => m.from !== m.to);
88
+ if (moved.length === 0)
89
+ return null;
90
+ return moved.map((m) => `${m.k} ${m.from} → ${m.to}`).join(", ");
91
+ }
69
92
  export function describeDelta(now, before) {
70
93
  if (!before)
71
94
  return "first measurement recorded here - the next one compares against it";
@@ -89,6 +112,10 @@ export function describeDelta(now, before) {
89
112
  const read = readingDelta(now, before);
90
113
  if (read)
91
114
  parts.push(read);
115
+ /** E o que não foi lido, por motivo - ver `unread` em `SyncMark`. */
116
+ const reasons = unreadDelta(now, before);
117
+ if (reasons)
118
+ parts.push(reasons);
92
119
  const when = ago(before.at);
93
120
  /**
94
121
  * O INSTRUMENTO ANDOU, e isso vem junto do número em vez de depois dele. Ver `cli`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.210",
3
+ "version": "0.16.212",
4
4
  "description": "Bring SynthesisUI design systems into any project - tokens, typed components, whole pages and an agent-ready CLAUDE.md manifest.",
5
5
  "type": "module",
6
6
  "bin": {