synthesisui 0.16.488 → 0.16.489

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
@@ -467,7 +467,8 @@ written now** - read the code before you edit it, never a remembered signature.`
467
467
  ? `
468
468
 
469
469
  **Their page blueprints are on:** call \`preferences\` with the page's kind before building one, unless
470
- they say not to (\`synthesisui preferences off\`); a correction to keep is \`remember_preference\`.`
470
+ they say not to (\`synthesisui preferences off\`), for one landing part with its \`section\`; a correction to keep
471
+ is \`remember_preference\`.`
471
472
  : "";
472
473
  /**
473
474
  * O TEMA É DELE - bateria ampliada, item 22 (29/09). Em c01, c02, c05, c17 e c23 o agente mexeu no tema do projeto
@@ -16,7 +16,7 @@ import { ruleLine } from "../doctrine.js";
16
16
  import { fromCensus } from "../memory/observation.js";
17
17
  import { handleRecall, handleRemember, MEMORY_TOOLS } from "../memory/tools.js";
18
18
  import { ourSpellingLines } from "../our-spelling.js";
19
- import { fetchPreferences, isKind, isLayer, PREFERENCE_KINDS, PREFERENCE_LAYERS, preferencesAnswer, readOff, readSelection, sendPiece, } from "../preferences.js";
19
+ import { fetchPreferences, isKind, isLayer, isSection, PREFERENCE_KINDS, PREFERENCE_LAYERS, preferencesAnswer, readOff, readSelection, SECTIONS, sendPiece, } from "../preferences.js";
20
20
  import { readInstalledConvention } from "../project-facts.js";
21
21
  import { repoStateOf } from "../repo-state.js";
22
22
  import { detectStack } from "../stack.js";
@@ -370,7 +370,7 @@ const TOOLS = [
370
370
  */
371
371
  {
372
372
  name: "preferences",
373
- description: "The person's OWN preference blueprint for a kind of page - how they like a landing, a blog article or a dashboard built (structure, behavior, view), kept in their account and shared by all their projects. Call this BEFORE building or reshaping a page of one of these kinds - their blueprints are on by default, so a plain \"make me a landing page\" gets them too. Skip it only when the request says to build without them; a project that turned them off answers so itself. The rules name roles and steps; you resolve them to this project's --ds-* variables.",
373
+ description: "The person's OWN preference blueprint for a kind of page - how they like a landing, a blog article or a dashboard built (structure, behavior, view), kept in their account and shared by all their projects. Call this BEFORE building or reshaping a page of one of these kinds - their blueprints are on by default, so a plain \"make me a landing page\" gets them too. Skip it only when the request says to build without them; a project that turned them off answers so itself. Building ONE part of a landing (a hero, the pricing or offer cards, testimonials, the closing call, the footer) - most of all when the person adds one part per message - call it again with that `section` for each part. Too vague to tell what kind of page is being built? Ask one short question first instead of guessing. The rules name roles and steps; you resolve them to this project's --ds-* variables.",
374
374
  inputSchema: {
375
375
  type: "object",
376
376
  properties: {
@@ -379,6 +379,11 @@ const TOOLS = [
379
379
  enum: [...PREFERENCE_KINDS],
380
380
  description: "Which kind of page is being built.",
381
381
  },
382
+ section: {
383
+ type: "string",
384
+ enum: [...SECTIONS],
385
+ description: "Only with kind landing, when ONE part is being built now: hero, pricing (offer or product cards with prices), testimonials, closing (the last call to action), footer. Omit for the whole page or a part outside this list.",
386
+ },
382
387
  },
383
388
  required: ["kind"],
384
389
  },
@@ -1939,7 +1944,10 @@ cli) {
1939
1944
  const token = await readToken();
1940
1945
  if (!token)
1941
1946
  return fromContract("Not signed in, so the person's preferences cannot be read. They have to run `synthesisui login` once in the terminal - it opens a browser, and I cannot complete it for them.");
1942
- const prefs = await fetchPreferences({ base: resolveRegistry(), token }, kind);
1947
+ const section = args.section;
1948
+ if (section !== undefined && (kind !== "landing" || !isSection(section)))
1949
+ return fromContract(`section goes with kind landing and is one of ${SECTIONS.join(", ")} - for any other part, call with the kind alone.`);
1950
+ const prefs = await fetchPreferences({ base: resolveRegistry(), token }, kind, section);
1943
1951
  if ("failed" in prefs)
1944
1952
  return fromContract(`Their preferences could not be read: ${prefs.failed}. Build with the system as usual and say so in one line.`);
1945
1953
  return preferencesAnswer(kind, prefs, await readSelection(root), await readOff(root));
@@ -319,7 +319,7 @@
319
319
  * linha das preferências da pessoa - `preferences` quando ela pede, `remember_preference` quando ela corrige. Uma pasta
320
320
  * escrita antes não diz ao agente que essas portas existem.
321
321
  */
322
- export const MATERIALISER_SINCE = "0.16.488";
322
+ export const MATERIALISER_SINCE = "0.16.489";
323
323
  /**
324
324
  * A ÚLTIMA VERSÃO EM QUE O QUE O HOOK RODA MUDOU.
325
325
  *
@@ -16,6 +16,18 @@ import { join } from "node:path";
16
16
  */
17
17
  export const PREFERENCE_KINDS = ["landing", "blog", "dashboard"];
18
18
  export const PREFERENCE_LAYERS = ["structure", "behavior", "view"];
19
+ /**
20
+ * AS PARTES DA LANDING - a jornada "o agente reconhece o que se constrói" (03/10). Quem pede por partes ("coloca a
21
+ * hero", "agora o rodapé") recebe, a cada parte, a estrutura daquela parte (apps/web lib/ds/section-structural.ts).
22
+ */
23
+ export const SECTIONS = [
24
+ "hero",
25
+ "pricing",
26
+ "testimonials",
27
+ "closing",
28
+ "footer",
29
+ ];
30
+ export const isSection = (s) => typeof s === "string" && SECTIONS.includes(s);
19
31
  export const isKind = (k) => typeof k === "string" && PREFERENCE_KINDS.includes(k);
20
32
  export const isLayer = (l) => typeof l === "string" && PREFERENCE_LAYERS.includes(l);
21
33
  /** Onde o projeto guarda quais blueprints dela ele usa - versionado, porque é decisão do projeto. */
@@ -83,8 +95,11 @@ export function chosen(all, selection) {
83
95
  const want = new Set(selection.map((s) => s.toLowerCase()));
84
96
  return all.filter((b) => want.has(b.name.toLowerCase()) || want.has(b.id.toLowerCase()));
85
97
  }
86
- export async function fetchPreferences(reach, kind) {
87
- const res = await fetch(`${reach.base}/api/preferences${kind ? `?kind=${kind}` : ""}`, { headers: { Authorization: `Bearer ${reach.token}` } }).catch(() => null);
98
+ export async function fetchPreferences(reach, kind, section) {
99
+ const q = kind ? `?kind=${kind}${section ? `&section=${section}` : ""}` : "";
100
+ const res = await fetch(`${reach.base}/api/preferences${q}`, {
101
+ headers: { Authorization: `Bearer ${reach.token}` },
102
+ }).catch(() => null);
88
103
  if (!res)
89
104
  return { failed: "the platform could not be reached" };
90
105
  if (!res.ok)
@@ -171,7 +186,18 @@ function craftOf(kind, prefs) {
171
186
  ...lines.map((l) => `- ${l}`),
172
187
  ];
173
188
  }
174
- /** A resposta da ferramenta `preferences` - lida SÓ quando o pedido diz para usar as preferências dela. */
189
+ /** A parte que se constrói agora vem PRIMEIRO: é dela que o turno trata. */
190
+ function sectionOf(prefs) {
191
+ const s = prefs.section;
192
+ if (!s || s.lines.length === 0)
193
+ return [];
194
+ return [
195
+ `THE PART BEING BUILT NOW - the ${s.name} of this landing, as this platform builds it:`,
196
+ ...s.lines.map((l) => `- ${l}`),
197
+ "",
198
+ ];
199
+ }
200
+ /** A resposta da ferramenta `preferences` - ligada por padrão (03/10), e a cada parte da landing com a `section`. */
175
201
  export function preferencesAnswer(kind, prefs, selection,
176
202
  /** O projeto desligou os blueprints (`synthesisui preferences off`). */
177
203
  off = false) {
@@ -184,9 +210,13 @@ off = false) {
184
210
  ? `The person has no ${kind} preference blueprint yet.`
185
211
  : `The person has ${mine.length} ${kind} blueprint(s) (${mine.map((b) => `"${b.name}"`).join(", ")}), but this project chose others in _synthesisui/preferences.json.`;
186
212
  // não ter preferência não é lacuna do sistema: é uma resposta verdadeira, e não entra na conta de lacunas
187
- return composed(`${why} Build the ${kind} with the system as usual, and tell them in one line that they can keep their ${kind} preferences under Memory -> Preference blueprints on the site.`, `preferences:${kind}:0`);
213
+ return composed([
214
+ ...sectionOf(prefs),
215
+ `${why} Build the ${kind} with the system as usual, and tell them in one line that they can keep their ${kind} preferences under Memory -> Preference blueprints on the site.`,
216
+ ].join("\n"), `preferences:${kind}:0${prefs.section ? `:${prefs.section.name}` : ""}`);
188
217
  }
189
218
  return composed([
219
+ ...sectionOf(prefs),
190
220
  `The person's preference blueprint${use.length > 1 ? "s" : ""} for a ${kind} - THEIR preferences, kept by them across projects:`,
191
221
  "",
192
222
  ...use.map(describeBlueprint),
@@ -196,5 +226,5 @@ off = false) {
196
226
  "- They win over generic page craft when the two disagree; this system's tokens and rules still win over them.",
197
227
  `- When you finish, tell them in ONE line which blueprint you applied${use.length > 1 ? " (if more than one fits, use the first and name it)" : ""}, and any rule you could not follow and why.`,
198
228
  ...craftOf(kind, prefs),
199
- ].join("\n"), `preferences:${kind}:${use.length}`);
229
+ ].join("\n"), `preferences:${kind}:${use.length}${prefs.section ? `:${prefs.section.name}` : ""}`);
200
230
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.488",
3
+ "version": "0.16.489",
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": {