synthesisui 0.16.255 → 0.16.257

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/claude-md.js CHANGED
@@ -24,6 +24,7 @@ async function readInstalled(projectRoot) {
24
24
  name: lock.name,
25
25
  version: lock.version,
26
26
  adopted: lock.adopted === true,
27
+ ...(lock.reference ? { reference: lock.reference } : {}),
27
28
  });
28
29
  }
29
30
  catch {
@@ -310,6 +311,25 @@ async function renderRegion(projectRoot, installed) {
310
311
  // writes a line. An INSTALLED system speaks `--ds-*` and is scoped with
311
312
  // `data-ds`; an ADOPTED one is the project's own vocabulary, already wired,
312
313
  // with no `data-ds` anywhere to scope to.
314
+ /**
315
+ * QUANDO ESTE REPO CARREGA MAIS DE UM SISTEMA, o agente precisa saber qual
316
+ * manda - e é a única coisa que ele não consegue deduzir lendo os dois.
317
+ *
318
+ * O `loadSystem` sempre leu todos os sistemas instalados lado a lado, porque
319
+ * cada token é prefixado `--ds-` e é isso que o app rodando vê. O que faltava
320
+ * era a relação: um deles é a referência para onde os outros convergem, ou eles
321
+ * são independentes. Sem esta frase, um agente diante de dois vocabulários
322
+ * escolhe por proximidade no arquivo, que é o mesmo que escolher no par ou
323
+ * ímpar.
324
+ *
325
+ * "Independentes" NÃO é dito: a ausência é o caso comum, e uma linha em todo
326
+ * repo de um sistema só para negar uma relação que ninguém cogitou é ruído no
327
+ * arquivo mais lido do projeto.
328
+ */
329
+ const ref = installed.find((d) => d.reference)?.reference;
330
+ if (installed.length > 1 && ref) {
331
+ sections.push(`\n**${ref.name}** (\`${ref.slug}\`) is the reference system of this group. When two of the systems above name the same thing differently, its answer is the one to follow - the others are moving towards it.`);
332
+ }
313
333
  const onlyAdopted = installed.every((d) => d.adopted);
314
334
  const selfCheck = (await hasHook(projectRoot))
315
335
  ? SELF_CHECK_HOOKED
@@ -192,6 +192,18 @@ export async function add(slug, opts) {
192
192
  ...(scope ? { scope } : {}),
193
193
  ...(systems.length > 0 ? { scopes: systems } : {}),
194
194
  ...(usage.length > 0 ? { usage } : {}),
195
+ /**
196
+ * A RELAÇÃO ENTRE OS SISTEMAS DESTE REPO, vinda da plataforma.
197
+ *
198
+ * Preservada quando o registry não a manda: um servidor mais antigo não sabe
199
+ * do campo, e apagar a relação por causa disso faria a resposta oscilar entre
200
+ * dois `add` seguidos.
201
+ */
202
+ ...(payload.groupReference
203
+ ? { reference: payload.groupReference }
204
+ : prev?.reference
205
+ ? { reference: prev.reference }
206
+ : {}),
195
207
  };
196
208
  const landed = (() => {
197
209
  if (!prev?.fetchedAt)
@@ -97,12 +97,34 @@ opts = {}) {
97
97
  /** Sem sistema instalado não há alinho a cobrar - não é desalinho, é um repo sem DS. */
98
98
  if (locks.length === 0)
99
99
  return out;
100
- if (locks.length > 1)
101
- out.push({
102
- says: `${locks.length} design systems are installed here (${locks
103
- .map((l) => l.slug)
104
- .join(", ")}) - commands act on the first, so one of them is not being governed`,
105
- });
100
+ /**
101
+ * DOIS SISTEMAS DEIXA DE SER SUSPEITA QUANDO A RELAÇÃO ESTÁ DECLARADA.
102
+ *
103
+ * Este aviso nasceu para o caso real de um clone de outro projeto na mesma
104
+ * pasta, e ele continua certo ali. Mas um monorepo com uma biblioteca
105
+ * compartilhada e o vocabulário de um app tem DOIS sistemas de propósito, e
106
+ * dizer que "um deles não está sendo governado" é chamar de acidente uma
107
+ * decisão que alguém tomou na tela do grupo.
108
+ *
109
+ * Com a referência declarada, a frase muda de queixa para informação: os
110
+ * comandos seguem agindo sobre o primeiro, e agora dá para dizer QUAL deveria
111
+ * ser. Sem referência, o aviso é o de sempre.
112
+ */
113
+ const declared = locks.find((l) => l.reference)?.reference;
114
+ if (locks.length > 1) {
115
+ const names = locks.map((l) => l.slug).join(", ");
116
+ if (declared && locks.some((l) => l.slug === declared.slug)) {
117
+ if (locks[0].slug !== declared.slug)
118
+ out.push({
119
+ says: `${locks.length} design systems here (${names}), and this group's reference is \`${declared.slug}\` - but commands act on \`${locks[0].slug}\`, which is first alphabetically.`,
120
+ });
121
+ }
122
+ else {
123
+ out.push({
124
+ says: `${locks.length} design systems are installed here (${names}) - commands act on the first, so one of them is not being governed. If that is on purpose, name the reference on the group's screen.`,
125
+ });
126
+ }
127
+ }
106
128
  const lock = locks[0];
107
129
  const creds = await credentials(home);
108
130
  if (!creds)
@@ -2155,6 +2155,31 @@ function sayScopes(c) {
2155
2155
  console.log("");
2156
2156
  console.log(section("Two folders, one system"));
2157
2157
  console.log(body(`Measured ${scopes.length} scopes and fused them: ${scopes.map((x, i) => (i === 0 ? paint.strong(x) : x)).join(" · ")}. The first one is the authority - it wins a tie, and nothing from the others is dropped without a line.`));
2158
+ /**
2159
+ * A CONVERGÊNCIA VEM ANTES DOS CONFLITOS, porque ela decide se a lista de
2160
+ * conflitos é o assunto.
2161
+ *
2162
+ * Com 60% compartilhado, três divergências são o trabalho. Com 0%, elas são um
2163
+ * detalhe de dois vocabulários que não se encontram - e a conversa que precisa
2164
+ * acontecer é outra: isto é um sistema ou são dois? Medido no monorepo do dono,
2165
+ * `packages/ui` e `apps/web-dashboard` dão exatamente 0%.
2166
+ */
2167
+ const conv = c.scopeConvergence;
2168
+ if (conv) {
2169
+ console.log("");
2170
+ console.log(body(conv.shared === 0
2171
+ ? `${paint.strong("These scopes share no token names at all")} - ${conv.union} names between them, and not one is declared in more than one. They are not drifting apart; they are different vocabularies.`
2172
+ : `${paint.strong(`${conv.percent}% convergence`)} - of the ${conv.union} names between them, ${conv.shared} ${conv.shared === 1 ? "is" : "are"} declared in more than one scope and ${conv.agree} of those already resolve to the same value.`));
2173
+ /**
2174
+ * E A PERGUNTA, dita em voz alta em vez de assumida.
2175
+ *
2176
+ * A fusão presume que os escopos são um sistema só. Abaixo de um terço de
2177
+ * convergência essa premissa deixa de se sustentar sozinha, e quem decide não
2178
+ * é a esteira - é quem conhece os dois produtos.
2179
+ */
2180
+ if (conv.percent < 34)
2181
+ console.log(body(paint.faint("Worth answering before this becomes one system: are these two ONE vocabulary, or two that live in the same repo? Two is a legitimate answer - import each scope on its own, and name which of them is the reference on the group's screen.")));
2182
+ }
2158
2183
  if (conflicts.length === 0)
2159
2184
  return;
2160
2185
  console.log("");
@@ -100,7 +100,7 @@
100
100
  *
101
101
  * Quem instalou antes desta versão tem o stub que estanca: o `upgrade`/`connect` é o que alcança.
102
102
  */
103
- export const MATERIALISER_SINCE = "0.16.255";
103
+ export const MATERIALISER_SINCE = "0.16.256";
104
104
  /**
105
105
  * A ÚLTIMA VERSÃO EM QUE O QUE O HOOK RODA MUDOU.
106
106
  *
@@ -227,5 +227,37 @@ export function mergeCensus(list) {
227
227
  out.collisions = collisions;
228
228
  if (conflicts.length > 0)
229
229
  out.scopeConflicts = conflicts;
230
+ /**
231
+ * A CONVERGÊNCIA ENTRE OS ESCOPOS, calculada aqui porque é aqui que os
232
+ * vocabulários separados ainda existem - depois da fusão eles são um só.
233
+ *
234
+ * `shared` conta os nomes que mais de um escopo declara; `agree` são os que
235
+ * resolvem igual. Zero compartilhado não é "quase lá": é a informação de que
236
+ * não há design em comum, e que fundir produziria a média de dois sistemas que
237
+ * não se parecem.
238
+ */
239
+ {
240
+ const seen = new Map();
241
+ let shared = 0;
242
+ let agree = 0;
243
+ for (const c of list) {
244
+ for (const [name, value] of Object.entries(asRecord(c.declared))) {
245
+ const held = seen.get(name);
246
+ if (held === undefined) {
247
+ seen.set(name, value);
248
+ continue;
249
+ }
250
+ shared += 1;
251
+ if (held === value)
252
+ agree += 1;
253
+ }
254
+ }
255
+ out.scopeConvergence = {
256
+ shared,
257
+ agree,
258
+ union: seen.size,
259
+ percent: seen.size === 0 ? 0 : Math.round((agree / seen.size) * 100),
260
+ };
261
+ }
230
262
  return out;
231
263
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.255",
3
+ "version": "0.16.257",
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": {