synthesisui 0.16.184 → 0.16.185

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.
@@ -8,7 +8,7 @@ import { emptyTally, internalSpecifiers, scanComponentsInto, tallyToInventory, }
8
8
  import { checkContracts } from "../doctor/contract-check.js";
9
9
  import { describeMissing, missingDependencies, summarizeMissing, } from "../doctor/dependencies.js";
10
10
  import { findFrozenBindings } from "../doctor/frozen.js";
11
- import { appendEvent, readEvents, summarize } from "../doctor/ledger.js";
11
+ import { appendEvent, readEvents, suggestionsFrom, summarize, } from "../doctor/ledger.js";
12
12
  import { bindingsFromDocument, countComponents, findOverrides, } from "../doctor/overrides.js";
13
13
  import { checkableName, readRequests, verifyAndCloseRequests, } from "../doctor/requests.js";
14
14
  import { diagnose, scanSource, siblingTokens, } from "../doctor/scan.js";
@@ -706,6 +706,9 @@ export async function doctor(opts) {
706
706
  ...(d.findings.some((f) => f.crossFamily)
707
707
  ? { crossFamily: d.findings.filter((f) => f.crossFamily).length }
708
708
  : {}),
709
+ ...(d.repeats.some((r) => r.token)
710
+ ? { matched: suggestionsFrom(d.repeats) }
711
+ : {}),
709
712
  }).catch(() => { });
710
713
  console.log("");
711
714
  if (opts.fix) {
@@ -796,6 +799,10 @@ export async function doctor(opts) {
796
799
  coverage: d.coverage,
797
800
  named: d.named,
798
801
  ...(crossFamily > 0 ? { crossFamily } : {}),
802
+ /** E os pares em si, para a plataforma reavaliar sem esperar outra medição - ver `matched`. */
803
+ ...(d.repeats.some((r) => r.token)
804
+ ? { matched: suggestionsFrom(d.repeats) }
805
+ : {}),
799
806
  });
800
807
  }
801
808
  if (hasSystem && fullRun) {
@@ -27,6 +27,32 @@ import { join } from "node:path";
27
27
  * same contract every log file that survives a decade has.
28
28
  */
29
29
  export const LEDGER_FILE = "ledger.jsonl";
30
+ /**
31
+ * TETO, porque isto viaja e cai num campo `jsonb`.
32
+ *
33
+ * 72 no repo do dono, e a lista já vem ordenada por frequência - então o corte pega a cauda, que é
34
+ * onde mora o valor escrito uma vez em um arquivo. Um repo que passe disso perde a cauda e mantém
35
+ * inteiro o que decide alguma coisa.
36
+ */
37
+ const MATCHED_CAP = 300;
38
+ /**
39
+ * Os pares a mandar, do agregado que o doctor já monta.
40
+ *
41
+ * Só o que casou com um token: uma sugestão que não existe não tem família para comparar, e as 714
42
+ * sem token do repo do dono são 90% do volume e 0% da informação. A forma é estrutural de propósito -
43
+ * `Diagnosis` mora em `scan.ts`, e importar de lá para cá fecharia um ciclo.
44
+ */
45
+ export function suggestionsFrom(repeats) {
46
+ return repeats
47
+ .filter((r) => Boolean(r.token))
48
+ .slice(0, MATCHED_CAP)
49
+ .map((r) => ({
50
+ literal: r.literal,
51
+ kind: r.kind,
52
+ token: r.token,
53
+ count: r.count,
54
+ }));
55
+ }
30
56
  const ledgerPath = (root) => join(root, "_synthesisui", LEDGER_FILE);
31
57
  /** Keep the file from growing forever: past ~1MB, keep the newest half. A
32
58
  * trend needs recent history, not an archive. */
@@ -53,6 +53,9 @@ export async function repoStateOf(projectRoot, slug, cli) {
53
53
  ...(typeof doctor?.crossFamily === "number"
54
54
  ? { crossFamily: doctor.crossFamily }
55
55
  : {}),
56
+ ...(doctor?.matched && doctor.matched.length > 0
57
+ ? { matched: doctor.matched }
58
+ : {}),
56
59
  ...(typeof lock?.fetchedAt === "string"
57
60
  ? { installedAt: lock.fetchedAt }
58
61
  : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.184",
3
+ "version": "0.16.185",
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": {