synthesisui 0.16.235 → 0.16.239

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.
@@ -1,325 +1,15 @@
1
1
  /**
2
- * A SKILL DA PRIMEIRA CORRIDA, como o CLI a distribui.
2
+ * O STUB DA SKILL - o corpo é SERVIDO, não embarcado (R1, dono 16/08).
3
3
  *
4
- * Mesmo motivo do `skill-import.ts`: o build é `tsc` e nada mais, então um `.md` precisaria de um
5
- * passo de cópia que pode silenciosamente não rodar. Um módulo TypeScript não pode falhar em ser
6
- * empacotado.
4
+ * O playbook inteiro morava aqui (15 KB) e, por consequência, no tarball
5
+ * público do npm e no repo de cada cliente em texto plano. Ele mudou para a
6
+ * plataforma (apps/web/src/lib/ds/playbooks.ts, gêmeo por spec do
7
+ * `.claude/skills/sui-init/SKILL.md`) e é servido pelo catalogue autenticado -
8
+ * a mesma doutrina de sempre: SERVED, NOT SHIPPED. O agente busca o sumário
9
+ * e depois SÓ o capítulo do passo em que está (a dieta de contexto).
7
10
  *
8
- * ESTA É A FONTE. A cópia em `.claude/skills/` é o que o nosso editor lê, e o spec assere que as duas
9
- * são idênticas - então divergência fica vermelha em vez de embarcar uma skill que descreve um fluxo
10
- * que o produto não tem.
11
- *
12
- * E ela é instalada pelo `connect` junto com a de import, de propósito: uma skill que exige reiniciar
13
- * o editor para aparecer é uma skill que ninguém usa na primeira corrida, que é a única em que ela
14
- * serve (dono, 05/08).
11
+ * O frontmatter fica INTEIRO no stub: é a description que faz a skill ser
12
+ * invocada, e ela não é segredo - a esteira é.
15
13
  */
16
- export const INIT_SKILL = `---
17
- name: sui-init
18
- description: The first run - wire the agent, choose what to import, and hand back a system that is already optimised. Use when somebody has just installed SynthesisUI and has no system yet ("/sui-init", "set me up", "começar", "importar meu projeto"). Asks everything up front, measures while asking, and ends in four lines.
19
- ---
20
-
21
- # The first run
22
-
23
- One conversation, and at the end they have a design system built out of their own code, with our
24
- optimisations applied and a way back to the untouched version.
25
-
26
- The purpose that decides every tie below: **read their repository and give it back as recipes with
27
- visual, semantic and functional parity, without supposing and without inventing anything.**
28
-
29
- \`CLAUDE.md\` rules. When the two disagree, this file is the one that is out of date.
30
-
31
- ---
32
-
33
- ## THE SHAPE OF THIS RUN, AND WHY IT IS THIS SHAPE
34
-
35
- Five questions, asked before anything that needs an answer. Then silence, then four lines.
36
-
37
- \`\`\`
38
- 1 environment which agent they work in - and what that agent can actually get
39
- 2 authorisation may we optimise after importing, and which parts
40
- 3 project WHICH folder becomes the system (the only unavoidable choice)
41
- 4 identity name, primary, theme - each already answered by the census
42
- 5 intent adopting the system, or migrating design INTO it
43
- (+ where absorbed values live, only if they are migrating)
44
- ---- nobody waits from here on ----
45
- init -> import -> freeze -> apply what they authorised -> four lines
46
- 6 offer the two lines that wire it up
47
- \`\`\`
48
-
49
- **Every question is asked before the work, and the work starts during the questions.** A person who
50
- answers five things in ninety seconds and then watches one bar has had a good four minutes; the same
51
- person interrupted twice mid-silence has had a bad twenty (dono, 01/08).
52
-
53
- **What runs in parallel, precisely.** The UNSCOPED census - \`npx synthesisui import --dry\` - needs no
54
- answer and discovers the candidate projects, so start it the moment question 1 is on screen. The
55
- SCOPED census needs question 3, and no amount of wishing makes it earlier. Do not promise more
56
- parallelism than that: a progress bar waiting on a person is worse than a question.
57
-
58
- ---
59
-
60
- ## 1. ENVIRONMENT
61
-
62
- Ask, because it changes what you install and it changes what you promise. Do not pretend the answers
63
- are equivalent - they are not, and a Design System Lead spots that in one minute.
64
-
65
- \`\`\`
66
- Which agent do you work in?
67
-
68
- Claude Code (recommended if you have it)
69
- rules + 11 tools + THE CHECK: after every file write, a hook measures what you
70
- wrote and hands the result back into the conversation. No other agent has this.
71
- Cursor
72
- rules (.cursor/rules) + the same 11 tools (.cursor/mcp.json). No post-write check -
73
- Cursor has no hook that feeds context back, so the rules are read, not enforced.
74
- Something else
75
- rules in AGENTS.md, which most agents read. Tell me which one and I will say
76
- honestly whether its tool format is one we know.
77
- \`\`\`
78
-
79
- **Never invent a config path.** If they name an agent whose format is not in that list, say so and
80
- write \`AGENTS.md\` only. Writing a file into the wrong place is worse than not writing it: it looks
81
- like support and delivers nothing.
82
-
83
- Then wire it, once, with the command that is already idempotent:
84
-
85
- \`\`\`
86
- npx synthesisui@latest connect
87
- \`\`\`
88
-
89
- ## 2. AUTHORISATION - ONE QUESTION, AND IT IS A SINGLE CHOICE
90
-
91
- Ask it HERE, before the import, because it is the only way the end can be four lines instead of a
92
- negotiation.
93
-
94
- **ASK IT AS A SINGLE CHOICE, NEVER A MULTI-SELECT.** The first real run of this skill made the reason
95
- obvious (dono, 05/08): a multi-select renders as three checkboxes plus a fourth, \`[ ] Type something\`,
96
- that the question tool always appends - and free text next to three closed deterministic transforms
97
- has nothing to act on. Whatever somebody types there matches no transform that exists, so the option
98
- is either ignored or it lies. Three named options and the escape stays meaningful.
99
-
100
- \`\`\`
101
- May I apply the deterministic fixes after importing? Nothing here is AI - it is arithmetic,
102
- and the version you have now stays frozen either way.
103
-
104
- All three (recommended)
105
- tokens & contrast - values that repeat become one named token, and text that fails
106
- contrast gets its INK changed, never its background
107
- spacing - lengths off your own scale converge onto the step you named
108
- typography - sizes and weights land on your own scale
109
- Let me pick
110
- then, and only then, ask which ones - there the multi-select is the right shape,
111
- because picking IS the question
112
- None
113
- the system arrives exactly as your code has it, and the fixes wait on a button
114
- \`\`\`
115
-
116
- Two things must be said in the same breath with the recommendation, because a default that edits is
117
- only defensible with both:
118
-
119
- - **The version they have now is frozen before anything is applied.** It becomes a published version,
120
- it never moves, and restoring it is one click. Say the NUMBER the route answers with, never "v1":
121
- a system publishes its baseline at birth, so an import writes into v2 and the freeze produces v3.
122
- - **Value, never form.** Your axes, options, parts and layers are declarations - we do not touch
123
- them. \`archetypeFidelity\` is excluded from this run on purpose: its fix once deleted the \`variant\`
124
- and \`size\` a real \`Input\` declared (dono, 02/08).
125
-
126
- If they decline all three: fine, and say what they are choosing - the system arrives exactly as
127
- their code has it, and the optimisations wait on a button.
128
-
129
- ## 3. PROJECT
130
-
131
- By now the unscoped census has finished, so this is a list and not a question in the dark. The CLI
132
- already ranks the candidates by how many tokens each declares - use its numbers, never your
133
- impression.
134
-
135
- \`\`\`
136
- Where should the system come from?
137
-
138
- packages/ui (recommended) 114 files · 47% of its values already named ·
139
- 92 tokens of their own · every app imports it
140
- the whole repo 2797 files · 36% · the average of one dark app and
141
- two light ones, which is a diagnosis and not a system
142
- apps/web-dashboard the heaviest consumer, if you want one app's vocabulary
143
- \`\`\`
144
-
145
- **Do not ask which styling they use.** We measure it, and better than they can answer it: the census
146
- counts every form with a percentage and an example. Show it instead, and name what we cannot read:
147
-
148
- \`\`\`
149
- Measured across 2797 files: 46% Tailwind classes, 31% CSS Modules, 12% sx props.
150
- I read all three. What I do not read yet: styled-jsx, 3% - and I will say so in the report.
151
- \`\`\`
152
-
153
- A wrong answer from them would override a right measurement from us. That is the whole reason this is
154
- a statement and not a question.
155
-
156
- ## 4. IDENTITY
157
-
158
- Name, primary, default theme, canvas. Every one of them is already answered by the census - ask them
159
- as separate selectable questions, recommendation first, evidence in one line. The full wording lives
160
- in the \`sui-import-ds\` skill; do not reinvent it here, and do not ask anything it does not.
161
-
162
- **Our kit is not a question.** A project with its own component library gets theirs alone.
163
-
164
- ---
165
-
166
- ## 5. INTENT
167
-
168
- The one question the census cannot answer, and the only one whose answer changes what a later command
169
- puts first.
170
-
171
- \`\`\`
172
- What are you doing with this system?
173
-
174
- Adopting it (recommended) make the code use the system. The doctor leads with the
175
- values your system already names - those have a one-line
176
- fix, and \`doctor --fix\` does them.
177
- Migrating into it you are moving design out of your apps and into the shared
178
- package. The doctor leads with the values your system does
179
- NOT name yet, by frequency - those are the tokens the
180
- library still has to absorb.
181
- \`\`\`
182
-
183
- Both lists exist in both modes. The answer decides the ORDER, and the order decides what somebody
184
- does first - measured on a real monorepo (dono, 06/08): with no intent declared, four of the five
185
- suggestions came out of a consumer app, led by a colour that does not belong to the system's palette
186
- at all. The same number is noise under one intent and the strongest candidate in the repo under the
187
- other.
188
-
189
- Pass the answer straight through:
190
-
191
- \`\`\`
192
- npx synthesisui@latest init --intent adopt (or --intent migrate)
193
- \`\`\`
194
-
195
- **One follow-up, and ONLY when they chose migrating.** Absorbing is what a migration does; asking an
196
- adopter where absorbed values would go is asking about a command they will not run this month.
197
-
198
- \`\`\`
199
- When your system absorbs a value, where should it live?
200
-
201
- In the system (recommended) it becomes a token of the design system, and the
202
- tokens.css it generates starts emitting it
203
- In your own CSS we hand you the block and you paste it into your
204
- vocabulary; the next import reads it back as a
205
- token you declared
206
- \`\`\`
207
-
208
- Then \`--absorb system\` or \`--absorb code\` on the same \`init\`. Both answers are real: the second exists
209
- because in some teams the canonical vocabulary IS their stylesheet, and in that case our part is to hand
210
- over the snippet - never to write in their file.
211
-
212
- **Run \`init\` even when nothing else needs it.** It writes \`_synthesisui/config.json\` - the committed
213
- file that holds \`target\`, \`pagesDir\`, \`componentsDir\`, \`styles\` and this intent - and until 06/08 this
214
- run never called it: a full first run left no config at all, so \`template\` and \`component\` fell back to
215
- defaults and the intent had nowhere to live (dono, 06/08).
216
-
217
- ---
218
-
219
- ## THE SILENT PART
220
-
221
- Now nobody is asked anything.
222
-
223
- **Steps 1 to 3 are NOT described here. Invoke the \`sui-import-ds\` skill and let it drive them.**
224
-
225
- That skill owns the import: the double measurement and why a library measured alone reports no laws,
226
- the \`--scope\` versus \`--usage\` split and the two mistakes it exists to prevent, the whole shape of the
227
- reading - anatomy, rules with \`kind\`/\`applies\`/\`fact\`, \`typeRoles\`, themes read from the switch rather
228
- than from the palette - the single batched \`validate_recipes\` call, and what to do with a 401. It is
229
- over a thousand lines of specifics, every one of them paid for by something that went wrong.
230
-
231
- Paraphrasing three of those lines here is how the two files start describing different pipelines, and
232
- the paraphrase always loses: an agent following a summary does a shallow import and nobody can see
233
- which document was wrong. So this skill asks the questions and hands the answers over:
234
-
235
- \`\`\`
236
- Invoke: sui-import-ds
237
- Already decided, do not ask again:
238
- source <the folder they picked in question 3>
239
- usage <the apps the CLI named, if any>
240
- name · primary · theme · canvas · architecture <what they answered in question 4>
241
- standards none, if they have a component library of their own
242
- Then come back here for step 4.
243
- \`\`\`
244
-
245
- Then, and only then, the part that belongs to this skill:
246
-
247
- \`\`\`
248
- 4 POST /api/registry/ds/<slug>/optimize freeze v1, apply what they authorised
249
- { "categories": ["tokens", "spacing", "typography"] }
250
- \`\`\`
251
-
252
- Step 4 is ONE call on purpose: it freezes the base and applies the fixes in the same request, so
253
- there is never a moment where an optimisation landed with no frozen version to go back to.
254
-
255
- To show the numbers BEFORE applying - useful when they hesitated on question 2 - the same route
256
- answers a probe and writes nothing:
257
-
258
- \`\`\`
259
- { "probe": true, "categories": ["tokens"] }
260
- \`\`\`
261
-
262
- If they authorised nothing, skip step 4 entirely. Do not call it with an empty list to be tidy: it
263
- answers 400, and a 400 in a first run reads as a broken product.
264
-
265
- ---
266
-
267
- ## 6. THE FOUR LINES
268
-
269
- This is the whole point of the run, and **it is not yours to compose.** Run this and print nothing
270
- else:
271
-
272
- \`\`\`
273
- npx synthesisui@latest summary <slug> --base <base> --draft <draft> --fixes <how many>
274
- \`\`\`
275
-
276
- It prints their component count, their own token count, where the system was read from, the two
277
- versions with the way back, and the one thing to do next. The numbers for \`--base\` and \`--draft\` come
278
- from the \`optimize\` RESPONSE - never invented here, because the platform is what numbers a version.
279
-
280
- **Why a command instead of four lines you write.** The last screen of this run has ended long, more
281
- than once - up to four hundred words, with three of its four paragraphs about the AGENT rather than
282
- about their system: notes from a previous session, a generator that had been deleted and rebuilt, a
283
- regression stripped by hand. Two of those notes were also out of date, which is worse than verbose: it
284
- warned somebody about defects that no longer existed (dono, 06/08).
285
-
286
- The pull to report your own work at the end of a long job beats a rule written sixty lines earlier. So
287
- the rule became a program. What you have in hand when the run ends - your notes, your retries, your
288
- repairs - has no way into a block that a command prints.
289
-
290
- **Anything you think belongs on that screen and is not in the command's output does not belong on that
291
- screen.** If it is a real finding, it is already in the report or in the causes screen; if it is about
292
- what you did, it is not theirs.
293
-
294
- ## 7. THE OFFER
295
-
296
- There is exactly one thing to offer, and it is not the fix: it is the two lines that wire the system
297
- up. Until a stylesheet imports the tokens and an element carries \`data-ds\`, none of the tokens reach
298
- the browser.
299
-
300
- \`summary\` already prints both. Say nothing more about them.
301
-
302
- **Never offer \`doctor --fix\` here.** It was offered for a while, with the number of values that have a
303
- token - and on an unwired project that swap points hundreds of literals at variables the browser
304
- cannot resolve, so the declarations are dropped and the page changes (dono, 06/08: 210 values, in a
305
- project where neither line was in place). The doctor itself now refuses in that state, and it is the
306
- right place for the offer: it can see the wiring, and this run cannot see what they do after it ends.
307
-
308
- ---
309
-
310
- ## WHAT THIS RUN NEVER DOES
311
-
312
- - **Never asks a question the census answers.** Styling, coverage, which files exist, how many
313
- components - those are measurements, and asking invites a wrong answer to beat a right one.
314
- - **Never installs a file for an agent they did not name.** \`.cursor/\` in a repo that has no Cursor
315
- is the first thing somebody deletes angrily.
316
- - **Never applies an optimisation without a frozen v1**, and never reports one without the way back.
317
- - **Never claims parity between agents.** The post-write check exists in one of them. Saying
318
- otherwise is the kind of sentence that ends a trial.
319
- - **Never ends long.** If the last screen needs scrolling, the run failed at the last step. The last
320
- screen is \`summary\`'s output and nothing else - see section 6 for why that stopped being a rule and
321
- became a command.
322
- - **Never offers a fix that the wiring blocks.** A swap to tokens that do not reach the browser
323
- changes the page, and it would be our command that changed it.
324
- `;
325
14
  export const INIT_SKILL_PATH = ".claude/skills/sui-init/SKILL.md";
15
+ export const INIT_SKILL = '---\nname: sui-init\ndescription: The first run - wire the agent, choose what to import, and hand back a system that is already optimised. Use when somebody has just installed SynthesisUI and has no system yet ("/sui-init", "set me up", "come\u00e7ar", "importar meu projeto"). Asks everything up front, measures while asking, and ends in four lines.\n---\n\n# The first run - 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": "init" } - you get the framing and a table of contents.\n2. Fetch ONLY the chapter for the step you are on:\n { "skill": "init", "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\nIf the tool answers that you are not signed in, run `npx synthesisui login`\nin the terminal and call it again. If the `synthesisui` MCP server is not\navailable at all, run `npx synthesisui connect`, restart the session, and\ninvoke this skill again.\n';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.235",
3
+ "version": "0.16.239",
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": {