synthesisui 0.16.367 → 0.16.368

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.
@@ -10,7 +10,6 @@ import { readRequests } from "../doctor/requests.js";
10
10
  import { declaredReference } from "../group-role.js";
11
11
  import { CHECKER_SINCE, installedBehind, MATERIALISER_SINCE, READER_SINCE, } from "../install-marks.js";
12
12
  import { fmt, say } from "../lang.js";
13
- import { mcpAwaitingApproval } from "../mcp-approval.js";
14
13
  import { measuredScope } from "../measured-scope.js";
15
14
  import { body, bodyWrapped, paint, section, snippet } from "../output.js";
16
15
  import { SKILLS } from "../skills.js";
@@ -97,33 +96,6 @@ export async function localMisalignments(root,
97
96
  opts = {}) {
98
97
  const { cli, home = homedir() } = opts;
99
98
  const out = [];
100
- /**
101
- * O PORTÃO QUE MATOU UM IMPORT INTEIRO, dito na sessão em que ele está fechado.
102
- *
103
- * Medido em 03/09: o agente mediu 262 arquivos, leu 78 componentes, descreveu a paleta dele - e
104
- * parou, porque o playbook do import é servido pelo MCP e a aprovação estava pendente. Isto vem
105
- * ANTES de qualquer outro desalinho porque é o único que impede a jornada principal de começar:
106
- * um repo sem sistema não está desalinhado, e um repo cujas ferramentas ninguém aprovou não pode
107
- * nem medir de volta.
108
- *
109
- * `/mcp` e não um comando de terminal: quem aprova é o agente, e um `npx` aqui mandaria a pessoa
110
- * ao lugar errado. Ver `mcp-approval.ts` para de onde o estado é lido, e para o silêncio quando
111
- * não há como saber.
112
- */
113
- if ((await mcpAwaitingApproval(root, home).catch(() => null)) === true)
114
- out.push({
115
- says: "The system's tools are declared here and still waiting for your approval - until you give it, I cannot reach the import playbook, only measure your files.",
116
- run: "/mcp",
117
- /**
118
- * O VALOR NÃO TRAZ O PRÓPRIO RÓTULO - quem rotula é quem desenha.
119
- *
120
- * Ele dizia `then say: import my design system`, e o render põe "then, to pick up where you
121
- * left off:" acima: a tela saía com dois rótulos e dois "then" para UM passo. É o defeito que
122
- * o #1314 consertou, reintroduzido por um valor que carregava a moldura dentro.
123
- */
124
- then: "import my design system",
125
- where: "agent",
126
- });
127
99
  const locks = (await locksIn(root)).filter((l) => l.slug && !l.adopted);
128
100
  /** Sem sistema instalado não há alinho a cobrar - não é desalinho, é um repo sem DS. */
129
101
  if (locks.length === 0)
@@ -543,7 +515,7 @@ from = "session") {
543
515
  : from === "shell"
544
516
  ? "This repo is out of alignment with the design system that governs it:"
545
517
  : "Before this session starts, this environment is out of alignment with the design system that governs it:",
546
- ...grouped(items, from),
518
+ ...grouped(items),
547
519
  ].join("\n");
548
520
  }
549
521
  /**
@@ -562,13 +534,7 @@ from = "session") {
562
534
  *
563
535
  * A ordem é a da primeira aparição: o primeiro achado decide onde o grupo dele fica.
564
536
  */
565
- function grouped(items,
566
- /**
567
- * QUEM ESTÁ LENDO decide duas coisas aqui: se um remédio do agente precisa dizer onde mora, e se
568
- * a linha ganha cor. Numa sessão a pessoa JÁ está no agente, e o rótulo seria a tela falando de
569
- * si mesma.
570
- */
571
- from = "session") {
537
+ function grouped(items) {
572
538
  const order = [];
573
539
  const byRun = new Map();
574
540
  for (const m of items) {
@@ -585,7 +551,7 @@ from = "session") {
585
551
  const group = byRun.get(key) ?? [];
586
552
  for (const m of group)
587
553
  out.push(` - ${m.says}`);
588
- const { run, then, where } = group[0];
554
+ const { run, then } = group[0];
589
555
  /**
590
556
  * A HIERARQUIA, e ela faltava inteira - *"o texto está sem hierarquia de cor, está muito ruim"*
591
557
  * (dono, na 0.16.365). Este bloco saía cru enquanto a ação recomendada, quinze linhas acima,
@@ -595,16 +561,8 @@ from = "session") {
595
561
  * `paint` se apaga sozinho sem TTY, então o `SessionStart` - que entrega texto a um modelo -
596
562
  * continua recebendo o mesmo texto de sempre, sem um único código de escape.
597
563
  */
598
- if (run) {
599
- /**
600
- * UM REMÉDIO DO AGENTE DIZ ONDE MORA, na superfície onde ele não é digitável. `/mcp` no
601
- * prompt do zsh é um comando que não existe; com o rótulo, a linha continua colável no lugar
602
- * certo em vez de mandar a pessoa ao lugar errado.
603
- */
604
- if (where === "agent" && from !== "session")
605
- out.push(paint.dim(` ${say("inside your agent session:")}`));
564
+ if (run)
606
565
  out.push(paint.blue(` ${run}`));
607
- }
608
566
  /** O `then` sai numa linha própria e rotulada: um segundo comando solto lê como parte do primeiro. */
609
567
  if (then)
610
568
  out.push(`${paint.dim(` ${say("then, to pick up where you left off:")}`)}\n${paint.blue(` ${then}`)}`);
@@ -668,14 +626,10 @@ opts = {}) {
668
626
  * repositório inteiro, e isto roda em TODA abertura de sessão. Um aviso que custa um walk completo
669
627
  * a cada sessão é um aviso que alguém desliga.
670
628
  */
671
- export async function nextStepFor(root,
672
- /** `home` porque a decisão sobre as ferramentas mora nele - ver `mcpAwaitingApproval`. */
673
- opts = {}) {
629
+ export async function nextStepFor(root) {
674
630
  const locks = (await locksIn(root)).filter((l) => l.slug && !l.adopted);
675
631
  if (locks.length > 0)
676
632
  return null;
677
- /** `true` só quando declarado e sem decisão; `null` (não sei) e `false` calam do mesmo jeito. */
678
- const awaiting = (await mcpAwaitingApproval(root, opts.home ?? homedir()).catch(() => null)) === true;
679
633
  const measured = await readFile(join(root, "_synthesisui", "census.json"), "utf8").then(() => true, () => false);
680
634
  /**
681
635
  * MEDIDO E SEM SISTEMA INSTALADO SÃO DUAS HISTÓRIAS, e a frase antiga contava a errada.
@@ -692,17 +646,14 @@ opts = {}) {
692
646
  * `list --mine` primeiro porque o slug nasce no servidor: ele não está em nenhum arquivo daqui, e
693
647
  * chutá-lo seria pior que pedir para olhar.
694
648
  */
695
- const awaits = awaiting ? { toolsAwaiting: true } : {};
696
649
  return measured
697
650
  ? {
698
- ...awaits,
699
651
  sentence: "This repo has been measured and has no system installed here. If you already imported, the system is in your account: `synthesisui list --mine`, then `synthesisui add <slug>`.",
700
652
  headline: "Your system is already in your account. Bring it in here:",
701
653
  run: ["synthesisui list --mine", "synthesisui add <slug>"],
702
654
  why: "Re-measuring would cost minutes and change nothing the platform already knows.",
703
655
  }
704
656
  : {
705
- ...awaits,
706
657
  sentence: 'This repo has no design system contract yet. Ask me: "import my design system."',
707
658
  headline: "Open a new agent session in this repo",
708
659
  open: await agentOpenCommands(root).catch(() => []),
@@ -767,15 +718,17 @@ export function renderNextStep(next, freshSession) {
767
718
  : "This run moved {what}, and a new session is what reads them.", { what: said })).map(paint.dim));
768
719
  }
769
720
  /**
770
- * A LINHA DA APROVAÇÃO, UMA VEZ, PELO FATO OU PELO QUE ACABOU DE MOVER.
721
+ * A LINHA DAS FERRAMENTAS SÓ NA RODADA QUE ACABOU DE DECLARÁ-LAS - e o segundo caso foi REMOVIDO.
722
+ *
723
+ * Havia aqui um `next.toolsAwaiting`, lido do `~/.claude.json`, para dizer que a aprovação estava
724
+ * pendente. Ele saiu em 04/09 porque afirmava um estado que nada observa - a medição inteira está
725
+ * na mensagem do PR e na lição do estado: as duas listas daquele arquivo estão vazias em SETE de
726
+ * sete projetos do dono, inclusive onde o MCP serve o playbook sem problema.
771
727
  *
772
- * Ela estava dentro do `if (freshSession)` e dependia de o MCP ter mudado NESTA rodada. O caso do
773
- * dono é o contrário e é o mais comum a partir da segunda vez: a fiação já estava lá ("nothing to
774
- * change - this environment is already current") e a aprovação continuava pendente. `next.toolsAwaiting`
775
- * é o fato lido do estado; `freshSession.mcp` continua valendo para a rodada que acabou de
776
- * declarar as ferramentas, quando ainda não há decisão nenhuma para ler.
728
+ * `freshSession.mcp` continua e é honesto por construção: ele não infere estado nenhum, ele diz
729
+ * que ESTA rodada acabou de declarar o servidor - um fato sobre o que o comando fez.
777
730
  */
778
- if (next.toolsAwaiting || freshSession?.mcp)
731
+ if (freshSession?.mcp)
779
732
  lines.push(...bodyWrapped(say("The project's tools ask for approval once - say yes.")).map(paint.dim));
780
733
  return lines.join("\n");
781
734
  }
@@ -791,25 +744,22 @@ export function renderNextStep(next, freshSession) {
791
744
  */
792
745
  export async function reportWhatIsLeft(root, opts = {}) {
793
746
  const items = await misalignments(root, opts).catch(() => []);
794
- const next = await nextStepFor(root, {
795
- ...(opts.home ? { home: opts.home } : {}),
796
- }).catch(() => null);
747
+ const next = await nextStepFor(root).catch(() => null);
797
748
  /**
798
- * A AÇÃO RECOMENDADA GANHA DO QUE SÓ SE RESOLVE DENTRO DELA - e a falta desta regra é a
799
- * regressão que o dono leu na 0.16.365.
749
+ * A AÇÃO RECOMENDADA GANHA DA LISTA - e a falta desta regra foi a regressão que o dono leu na
750
+ * 0.16.365.
800
751
  *
801
752
  * Isto era um OU EXCLUSIVO: um desalinho qualquer e o bloco "Do this next" não saía. O aviso da
802
- * aprovação pendente nasceu em 03/09 e é verdadeiro justamente no repo que acabou de rodar
803
- * `connect` - foi ele que declarou as ferramentas. E num repo sem sistema instalado aquele é o
804
- * ÚNICO desalinho possível: todos os outros vêm depois de um `.lock`, e o remoto devolve `null`
805
- * sem lock. Então a instrução de abrir o agente não desapareceu às vezes; ela desapareceu SEMPRE,
806
- * no único momento em que ela é a coisa que a pessoa procura na tela.
807
- *
808
- * A separação não esconde nada: o que se resolve no terminal continua saindo, embaixo da ação. O
809
- * que se resolve dentro do agente vira a segunda metade da ação, que é o que ele é - a aprovação
810
- * acontece na sessão que o passo 1 manda abrir.
753
+ * aprovação pendente, que nasceu em 03/09, era verdadeiro justamente no repo que acabou de rodar
754
+ * `connect` - foi ele que declarou as ferramentas -, e num repo sem sistema aquele era o ÚNICO
755
+ * desalinho possível. Então a instrução de abrir o agente não desaparecia às vezes: desaparecia
756
+ * SEMPRE, no único momento em que ela é a coisa que a pessoa procura na tela.
757
+ *
758
+ * AQUELE AVISO SAIU EM 04/09 - ele afirmava um estado que nada observa -, e a ordem FICA. Ela é o
759
+ * desenho certo independentemente dele: uma lista de manutenção nunca deve substituir a única
760
+ * ação que a tela está pedindo. O que sobra para o terminal continua saindo, embaixo da ação.
811
761
  */
812
- const onTheTerminal = items.filter((m) => m.where !== "agent");
762
+ const onTheTerminal = items;
813
763
  if (next) {
814
764
  console.log(renderNextStep(next, opts.freshSession));
815
765
  if (onTheTerminal.length > 0) {
@@ -75,5 +75,37 @@ export async function mcpAwaitingApproval(root, home) {
75
75
  /** Formato diferente do que a gente conhece: silêncio, nunca um palpite. */
76
76
  if (!Array.isArray(enabled) || !Array.isArray(disabled))
77
77
  return null;
78
- return !enabled.includes(SERVER) && !disabled.includes(SERVER);
78
+ /** Recusado explicitamente é um estado REAL, e é o único que este arquivo registra com certeza. */
79
+ if (disabled.includes(SERVER))
80
+ return true;
81
+ if (enabled.includes(SERVER))
82
+ return false;
83
+ /**
84
+ * AUSENTE DAS DUAS LISTAS É "NÃO SEI", E TRATÁ-LO COMO "PENDENTE" FOI O DEFEITO.
85
+ *
86
+ * A premissa desta função era: *"um servidor declarado que não está em nenhuma das duas listas
87
+ * está PENDENTE - medido, as duas listas vazias para aquele projeto"*. A medição existiu e estava
88
+ * certa sobre aquele projeto; a INFERÊNCIA não, porque ninguém mediu a outra metade.
89
+ *
90
+ * REMEDIDO em 04/09, na máquina do dono, nos SETE projetos que declaram este servidor: as duas
91
+ * listas estão vazias em TODOS - incluindo o `codelevel-monorepo`, onde o import inteiro rodou no
92
+ * dia anterior com o MCP servindo o playbook. Estado byte a byte idêntico entre "funciona" e
93
+ * "está pendente": a leitura não distinguia nada, era uma constante disfarçada de sinal.
94
+ *
95
+ * E procurei o registro em todas as casas antes de concluir - `~/.claude.json`,
96
+ * `.claude/settings.json`, `.claude/settings.local.json`, `.mcp.json` e `~/.claude/`. A aprovação
97
+ * de um servidor do `.mcp.json` não é gravada em nenhuma delas. `hasTrustDialogAccepted` é o
98
+ * diálogo do PROJETO, e `mcp-needs-auth-cache.json` é dos servidores do claude.ai.
99
+ *
100
+ * O CUSTO DE AFIRMAR SEM SABER, e ele não foi teórico: esta linha chega ao contexto do agente em
101
+ * toda abertura de sessão (`align` no `SessionStart`). Em 04/09 o dono pediu *"import my design
102
+ * system"*, o agente leu o aviso, acreditou nele e RECUSOU a jornada principal - mandou rodar
103
+ * `/mcp` num projeto cujas ferramentas estavam disponíveis. O defeito que o aviso existia para
104
+ * evitar era o agente parar sem saber por quê; o aviso passou a ser a causa dele.
105
+ *
106
+ * Então volta a valer a regra que o cabeçalho deste módulo sempre declarou - *"cala quando não
107
+ * sabe"* -, e quem observa se as ferramentas chegaram é o AGENTE, que sabe quais tem. A instrução
108
+ * mora no playbook, endereçada a ele.
109
+ */
110
+ return null;
79
111
  }
@@ -12,4 +12,4 @@
12
12
  * invocada, e ela não é segredo - a esteira é.
13
13
  */
14
14
  export const IMPORT_SKILL_PATH = ".claude/skills/sui-import-ds/SKILL.md";
15
- export const IMPORT_SKILL = '---\nname: sui-import-ds\ndescription: Turn a codebase the user ALREADY has into a SynthesisUI design system. Use when someone points at an existing repo, app or component library and asks to import it, adopt it, bring it in, or "make a design system from this" (e.g. "/sui-import-ds", "importa o meu packages/ui", "turn this app into a design system"). Drives the full pipeline - measurement \u2192 your reading of the app \u2192 import \u2192 upgrade proposal - and answers the questions arithmetic cannot.\n---\n\n# Import Design System - served live\n\nThis playbook is served from the platform, not shipped in this file - it is\nalways current, and your context only carries the step you are on.\n\n1. Call the `playbook` tool on the `synthesisui` MCP server with\n { "skill": "import" } - you get the framing and a table of contents.\n2. Fetch ONLY the chapter for the step you are on:\n { "skill": "import", "section": "<id from the toc>" }. Never fetch more\n than the current step needs.\n3. Follow it exactly. When the step is done, fetch the next chapter.\n\n## If something is missing, they skipped a step - do not stall them\n\nThe supported order is `login`, then `connect`, then open this session. When\nit was followed, neither case below happens.\n\nNOT SIGNED IN. Do not stop and wait. Measure first, so they see their own\nrepo before being asked for anything:\n\n1. Run `npx synthesisui@latest import --dry` - it is local, free, needs no\n account, and writes `_synthesisui/census.json`.\n2. Read that file and tell them what is in THEIR repo, in THEIR names: how\n many declarations, how many components, how much already runs on tokens.\n3. Then: "to turn this into a system on your account, run\n `npx synthesisui@latest login` and tell me when it is done."\n\nNO `synthesisui` MCP SERVER AT ALL. Tell them to run\n`npx synthesisui@latest connect` and then START A NEW SESSION - tools are read\nwhen a session opens, so this one cannot pick it up. Say it plainly and stop\nthere; carrying on in a session that cannot reach the playbook is guessing.\n';
15
+ export const IMPORT_SKILL = '---\nname: sui-import-ds\ndescription: Turn a codebase the user ALREADY has into a SynthesisUI design system. Use when someone points at an existing repo, app or component library and asks to import it, adopt it, bring it in, or "make a design system from this" (e.g. "/sui-import-ds", "importa o meu packages/ui", "turn this app into a design system"). Drives the full pipeline - measurement \u2192 your reading of the app \u2192 import \u2192 upgrade proposal - and answers the questions arithmetic cannot.\n---\n\n# Import Design System - served live\n\nThis playbook is served from the platform, not shipped in this file - it is\nalways current, and your context only carries the step you are on.\n\n1. Call the `playbook` tool on the `synthesisui` MCP server with\n { "skill": "import" } - you get the framing and a table of contents.\n2. Fetch ONLY the chapter for the step you are on:\n { "skill": "import", "section": "<id from the toc>" }. Never fetch more\n than the current step needs.\n3. Follow it exactly. When the step is done, fetch the next chapter.\n\n## If something is missing, they skipped a step - do not stall them\n\nThe supported order is `login`, then `connect`, then open this session. When\nit was followed, neither case below happens.\n\nNOT SIGNED IN. Do not stop and wait. Measure first, so they see their own\nrepo before being asked for anything:\n\n1. Run `npx synthesisui@latest import --dry` - it is local, free, needs no\n account, and writes `_synthesisui/census.json`.\n2. Read that file and tell them what is in THEIR repo, in THEIR names: how\n many declarations, how many components, how much already runs on tokens.\n3. Then: "to turn this into a system on your account, run\n `npx synthesisui@latest login` and tell me when it is done."\n\nTOOLS DECLARED, TOOLS NOT THERE. If `.mcp.json` names `synthesisui` and you\ncannot see its tools, the approval is pending - and only YOU can see that, so\nnobody can tell it to you. Measure anyway before you ask: `npx\nsynthesisui@latest import --dry` is local and needs no tool. Show them what is\nin their repo, THEN ask for `/mcp`. Arriving empty-handed helps nobody.\n\nNO `synthesisui` MCP SERVER AT ALL. Tell them to run\n`npx synthesisui@latest connect` and then START A NEW SESSION - tools are read\nwhen a session opens, so this one cannot pick it up. Say it plainly and stop\nthere; carrying on in a session that cannot reach the playbook is guessing.\n';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.367",
3
+ "version": "0.16.368",
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": {