synthesisui 0.16.196 → 0.16.198

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.
@@ -188,6 +188,43 @@ opts = {}) {
188
188
  * Melhor esforço: offline, sem sessão, ou registry fora do ar não produzem linha nenhuma. Uma
189
189
  * verificação de abertura não pode transformar um voo sem internet num aviso.
190
190
  */
191
+ /**
192
+ * O QUE DIZER QUANDO A PLATAFORMA ENDIREITOU ALGO - e como voltar ao que se estava fazendo.
193
+ *
194
+ * O pedido do dono, em 10/08: o agente checa se mudou alguma coisa, diz o comando, e devolve a linha
195
+ * que retoma a sessão de onde ela parou. A retomada não é conforto - sem ela, a pessoa roda o
196
+ * comando, perde o contexto do que estava fazendo, e o custo do conserto passa a ser a tarefa que ela
197
+ * estava no meio.
198
+ */
199
+ const REPAIR_SAID = {
200
+ spacing: "spacing values in your system were connected to the steps your own scale declares",
201
+ orphans: "recipes your measured scope no longer declares were removed",
202
+ roles: "colour roles were pointed at the ramps your repository declares",
203
+ reground: "the foundation was rebuilt from your census",
204
+ interpretation: "your census was re-read with a newer interpretation",
205
+ };
206
+ export function repairSaid(body, lock) {
207
+ if (!lock.slug)
208
+ return null;
209
+ if (!body.repairedAt)
210
+ return null;
211
+ /**
212
+ * SEM CARIMBO LOCAL, SILÊNCIO. Um repo instalado antes de `installedAt` existir não tem com o que
213
+ * comparar, e avisar sempre transformaria este aviso em ruído permanente - que é como um aviso
214
+ * deixa de ser lido.
215
+ */
216
+ if (!lock.fetchedAt)
217
+ return null;
218
+ if (Date.parse(body.repairedAt) <= Date.parse(lock.fetchedAt))
219
+ return null;
220
+ const what = body.repaired ? REPAIR_SAID[body.repaired] : undefined;
221
+ return {
222
+ says: `Something was put right in "${lock.slug}" on the platform after this repo installed it${what ? `: ${what}` : ""}. The files here still hold what was measured before that.`,
223
+ run: `npx synthesisui upgrade ${lock.slug}`,
224
+ /** E o caminho de volta para o que ela estava fazendo. */
225
+ then: "claude --continue --dangerously-skip-permissions",
226
+ };
227
+ }
191
228
  export async function versionBehind(root, opts = {}) {
192
229
  const locks = (await locksIn(root)).filter((l) => l.slug && !l.adopted);
193
230
  const lock = locks[0];
@@ -210,6 +247,24 @@ export async function versionBehind(root, opts = {}) {
210
247
  const body = (await res.json().catch(() => null));
211
248
  if (!body?.version)
212
249
  return null;
250
+ /**
251
+ * ALGO FOI ENDIREITADO NA PLATAFORMA DESDE QUE ESTE REPO INSTALOU.
252
+ *
253
+ * `version` responde "publicaram algo mais novo". O Apply do Studio não publica - ele escreve o
254
+ * rascunho -, então a versão fica parada e este comando ficava mudo sobre uma mudança real no
255
+ * design system dele (dono, 10/08). Quem descobre por acaso duas semanas depois é quem deixa de
256
+ * confiar no que a esteira diz.
257
+ *
258
+ * A frase é escrita AQUI, com o texto de hoje: só a data e a chave viajam pela rede. Uma frase que
259
+ * atravessa a rede congela na versão que a mandou.
260
+ *
261
+ * E ela vem ANTES do teste de versão de propósito: quando os dois são verdade, o reparo é a causa e
262
+ * a versão é a consequência - dizer a consequência primeiro manda a pessoa rodar o comando sem
263
+ * saber por quê.
264
+ */
265
+ const repaired = repairSaid(body, lock);
266
+ if (repaired)
267
+ return repaired;
213
268
  if (body.version > lock.version)
214
269
  return {
215
270
  says: `v${body.version} of "${lock.slug}" is published and this repo is on v${lock.version}. The CSS here and the rules your agent reads are both v${lock.version} - they move together, which is why this is worth saying rather than applying.`,
@@ -273,7 +328,8 @@ from = "session") {
273
328
  : from === "shell"
274
329
  ? "This repo is out of alignment with the design system that governs it:"
275
330
  : "Before this session starts, this environment is out of alignment with the design system that governs it:",
276
- ...items.map((m) => ` - ${m.says}${m.run ? `\n ${m.run}` : ""}`),
331
+ /** O `then` sai numa linha própria e rotulada: um segundo comando solto lê como parte do primeiro. */
332
+ ...items.map((m) => ` - ${m.says}${m.run ? `\n ${m.run}` : ""}${m.then ? `\n then, to pick up where you left off:\n ${m.then}` : ""}`),
277
333
  ].join("\n");
278
334
  }
279
335
  /**
@@ -352,7 +352,15 @@ export async function remeasure(args) {
352
352
  const mark = {
353
353
  at: new Date().toISOString(),
354
354
  components: out.written ?? 0,
355
- declarations: countDeclarations(census),
355
+ /**
356
+ * LIDO DO CENSO, e não recontado aqui - ver `coverage.declarations`.
357
+ *
358
+ * A primeira versão contava por conta própria e deu 165 onde o relatório diz 519: ela somava só o
359
+ * `base` de cada look, e a conta do produto soma `base`, `dark` e os estados. Dois números sobre
360
+ * um fato só é como uma tela passa a se contradizer, e a única defesa é não ter o segundo.
361
+ */
362
+ declarations: census.coverage
363
+ ?.declarations ?? 0,
356
364
  seen: sum(led?.counted),
357
365
  interpreted: sum(led?.interpreted),
358
366
  };
@@ -361,28 +369,6 @@ export async function remeasure(args) {
361
369
  if (!args.full)
362
370
  console.log(body(paint.faint("everything the reader saw: npx synthesisui sync --full")));
363
371
  }
364
- /** Quantas declarações de estilo as receitas carregam - o número que a tela mostra ao lado da nota. */
365
- function countDeclarations(census) {
366
- const looks = census.looks ?? {};
367
- let n = 0;
368
- const walk = (node) => {
369
- if (Array.isArray(node)) {
370
- for (const item of node)
371
- walk(item);
372
- return;
373
- }
374
- if (!node || typeof node !== "object")
375
- return;
376
- for (const value of Object.values(node))
377
- if (typeof value === "string")
378
- n += 1;
379
- else
380
- walk(value);
381
- };
382
- for (const look of Object.values(looks))
383
- walk(look.base);
384
- return n;
385
- }
386
372
  /**
387
373
  * Pergunta uma vez, e só num terminal de verdade.
388
374
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.196",
3
+ "version": "0.16.198",
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": {