synthesisui 0.16.308 → 0.16.310

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.
@@ -26,8 +26,12 @@ export async function gaps(opts) {
26
26
  return;
27
27
  }
28
28
  let ledger;
29
+ /** A régua única - ver `describeValueRuler`. Ausente num censo medido antes de 0.16.308. */
30
+ let values;
29
31
  try {
30
- ledger = JSON.parse(raw).ledger;
32
+ const census = JSON.parse(raw);
33
+ ledger = census.ledger;
34
+ values = census.values?.classes ?? undefined;
31
35
  }
32
36
  catch {
33
37
  console.log(body(`${path} is not readable JSON.`));
@@ -42,7 +46,7 @@ export async function gaps(opts) {
42
46
  console.log(body(`This measurement was written by a tool version that did not count style fragments yet, so the numbers do not exist rather than being zero. Run \`synthesisui import --dry\` again with ${opts.cli} to measure.`));
43
47
  return;
44
48
  }
45
- for (const line of describeTriage(triageLedger(ledger, opts.cli)))
49
+ for (const line of describeTriage(triageLedger(ledger, opts.cli), values))
46
50
  console.log(body(line));
47
51
  /**
48
52
  * E O QUE A CAMADA GLOBAL JÁ LEVOU - o desconto, sem o qual este comando repete a mentira que ele
@@ -1849,7 +1849,29 @@ export async function takeCensus(root, opts) {
1849
1849
  * AS LEIS DAS PÁGINAS, ditas onde a arquitetura já é dita - governam o sistema, não uma peça,
1850
1850
  * então `applies` é vazio e elas chegam a todo prompt. Ver `pageLaws`.
1851
1851
  */
1852
- const ledgerLines = describeLedger(ledger);
1852
+ /**
1853
+ * A CONTABILIDADE POR VALOR, contada AQUI porque o material é daqui: os tokens de classe que
1854
+ * vestem cada componente admitido (os nós do sketch e as camadas condicionais cruas), contra
1855
+ * os tokens que o CSS dele declara. Ver `Census.values` e `doctor/value-ledger.ts` - é a
1856
+ * reconciliação do item 11, e a soma fecha com `seen` por construção.
1857
+ *
1858
+ * ANTES do relatório do ledger de propósito: "quanto vocês entenderam?" tem UMA resposta (dono,
1859
+ * 26/08), e é esta régua - a mesma que a tela usa. A frase do ledger passa a liderar com ela.
1860
+ */
1861
+ const valueByComponent = {};
1862
+ for (const [lookName, look] of Object.entries(looks)) {
1863
+ const tokens = [];
1864
+ for (const node of look.sketch ?? []) {
1865
+ tokens.push(...(node.classes ?? "").split(/\s+/).filter(Boolean));
1866
+ }
1867
+ for (const layer of look.rawLayers ?? [])
1868
+ tokens.push(...layer.classes);
1869
+ if (tokens.length > 0) {
1870
+ valueByComponent[lookName] = accountClasses(tokens, declaredValues);
1871
+ }
1872
+ }
1873
+ const valuesTotal = sumAccounts(Object.values(valueByComponent));
1874
+ const ledgerLines = describeLedger(ledger, valuesTotal);
1853
1875
  if (ledgerLines.length > 0) {
1854
1876
  say("");
1855
1877
  say(section("Every style fragment, accounted for"));
@@ -2138,25 +2160,6 @@ export async function takeCensus(root, opts) {
2138
2160
  const target = c?.canonical ?? (c?.bucket === "exclusive" ? c.name : null);
2139
2161
  return target ? safePartName(target) : null;
2140
2162
  }, (pkg) => versions[pkg]);
2141
- /**
2142
- * A CONTABILIDADE POR VALOR, contada AQUI porque o material é daqui: os tokens de classe que
2143
- * vestem cada componente admitido (os nós do sketch e as camadas condicionais cruas), contra
2144
- * os tokens que o CSS dele declara. Ver `Census.values` e `doctor/value-ledger.ts` - é a
2145
- * reconciliação do item 11, e a soma fecha com `seen` por construção.
2146
- */
2147
- const valueByComponent = {};
2148
- for (const [lookName, look] of Object.entries(looks)) {
2149
- const tokens = [];
2150
- for (const node of look.sketch ?? []) {
2151
- tokens.push(...(node.classes ?? "").split(/\s+/).filter(Boolean));
2152
- }
2153
- for (const layer of look.rawLayers ?? [])
2154
- tokens.push(...layer.classes);
2155
- if (tokens.length > 0) {
2156
- valueByComponent[lookName] = accountClasses(tokens, declaredValues);
2157
- }
2158
- }
2159
- const valuesTotal = sumAccounts(Object.values(valueByComponent));
2160
2163
  return {
2161
2164
  census: 1,
2162
2165
  project: {
@@ -20,6 +20,7 @@
20
20
  * decisão de escrever é de quem lê - a esteira opinando sobre o nosso backlog no terminal do
21
21
  * cliente é ela falando de um assunto que não é dela (dono, 05/08).
22
22
  */
23
+ import { describeValueRuler } from "./style-ledger.js";
23
24
  /**
24
25
  * QUEM É DONO DE CADA FORMA, hoje.
25
26
  *
@@ -173,11 +174,23 @@ function isOlder(measured, current) {
173
174
  * do não interpretado ser o portão funcionando é a informação mais importante da tela, e ela vem
174
175
  * antes de qualquer lista de tarefa.
175
176
  */
176
- export function describeTriage(t) {
177
+ export function describeTriage(t,
178
+ /**
179
+ * A RÉGUA ÚNICA (ver `describeValueRuler`): quando o censo carrega o ledger de valores, o
180
+ * percentual que abre esta tela é o MESMO da tela do sistema e do fim do `import`. Era aqui
181
+ * que nascia a segunda resposta - "348 fragmentos, 36%" contra os 91% reais do codelevel
182
+ * (26/08) - e o agente do dono repassou a errada ao cliente.
183
+ */
184
+ values) {
177
185
  const unread = t.counted - t.interpreted;
178
- const lines = [
179
- `${t.counted} style fragments accounted for, ${t.interpreted} interpreted (${t.percent}%). The ${unread} below are sorted by what to do about them.`,
180
- ];
186
+ const lines = values
187
+ ? [
188
+ ...describeValueRuler(values),
189
+ `The ${unread} style fragments not interpreted are sorted below by what to do about them.`,
190
+ ]
191
+ : [
192
+ `${t.counted} style fragments accounted for, ${t.interpreted} interpreted (${t.percent}%). The ${unread} below are sorted by what to do about them.`,
193
+ ];
181
194
  if (t.stale) {
182
195
  lines.push("", `MEASURED BY CLI ${t.measuredBy}, TRIAGED BY ${t.triagedBy}. Re-run \`import\` before concluding anything from the numbers below - a gap here may already be closed, and the work already done.`);
183
196
  }
@@ -278,14 +278,27 @@ function blank() {
278
278
  * nomeia cada lacuna com o número do repo dela. Um percentual sem a contagem atrás é número de
279
279
  * marketing, e um zero sem motivo lê como falha nossa.
280
280
  */
281
- export function describeLedger(l) {
281
+ export function describeLedger(l,
282
+ /**
283
+ * A RÉGUA ÚNICA - o ledger de valores por declaração (ver `Census.values.classes`). Quando ela
284
+ * existe, "quanto vocês entenderam?" tem UMA resposta, e é esta: a mesma que a tela usa. O
285
+ * total de fragmentos continua dito - é a promessa de contabilidade -, mas sem um segundo
286
+ * percentual competindo (o agente do dono liderou com "36%" quando a leitura real era 91%,
287
+ * medido no codelevel em 26/08).
288
+ */
289
+ values) {
282
290
  const total = sum(l.counted);
283
291
  if (total === 0)
284
292
  return [];
285
293
  const read = sum(l.interpreted);
286
- const lines = [
287
- `${total} style fragments in your files, and every one is accounted for: ${read} interpreted (${Math.round((read / total) * 100)}%), ${total - read} listed below with the file and line where each lives.`,
288
- ];
294
+ const lines = values
295
+ ? [
296
+ ...describeValueRuler(values),
297
+ `And every one of the ${total} style fragments in your files is accounted for - the ${total - read} not interpreted are listed below with the file and line where each lives.`,
298
+ ]
299
+ : [
300
+ `${total} style fragments in your files, and every one is accounted for: ${read} interpreted (${Math.round((read / total) * 100)}%), ${total - read} listed below with the file and line where each lives.`,
301
+ ];
289
302
  /**
290
303
  * POR FORMA, ANTES DOS GRUPOS. O total responde "quanto"; esta tabela responde "de que jeito o
291
304
  * projeto escreve estilo", que é a pergunta que decide qual leitor vale construir. Sem ela, 56%
@@ -319,3 +332,16 @@ export function describeLedger(l) {
319
332
  function sum(counts) {
320
333
  return Object.values(counts).reduce((n, k) => n + k, 0);
321
334
  }
335
+ /**
336
+ * A frase da régua única, com todo denominador em palavras - `import` e `gaps` a imprimem
337
+ * IDÊNTICA, porque duas variações da mesma frase viram duas respostas na cabeça de quem lê.
338
+ * A conta é a da tela: decisões = vistas - estrutura; fechadas = interpretadas + respondidas.
339
+ */
340
+ export function describeValueRuler(values) {
341
+ const decisions = values.seen - values.structure;
342
+ const closed = values.interpreted + values.answered;
343
+ const percent = decisions > 0 ? Math.round((closed / decisions) * 100) : 0;
344
+ return [
345
+ `Of the ${values.seen} class declarations on your components, ${values.structure} are structure (layout plumbing, not design decisions). Of the ${decisions} design decisions, ${closed} are interpreted${values.answered > 0 ? ` (${values.answered} of them answered by you)` : ""} - ${percent}%.`,
346
+ ];
347
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.308",
3
+ "version": "0.16.310",
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": {