@calibrate-ds/cli 0.1.87 → 0.1.89

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/README.md CHANGED
@@ -768,6 +768,6 @@ See [PTB.md](./PTB.md) for architecture, type definitions, the generator interfa
768
768
  ```bash
769
769
  pnpm install
770
770
  pnpm build
771
- pnpm test # 586 tests across core, generator, and CLI
771
+ pnpm test # 593 tests across core, generator, and CLI
772
772
  node apps/cli/dist/index.js --help
773
773
  ```
@@ -280,20 +280,25 @@ criteria, and recommended build order.
280
280
 
281
281
  TOKEN AUTHORITY — what to trust, what to verify:
282
282
  - PTB's --ptb-* cssVar names are authoritative for token identity. Always emit them.
283
- - If tokenConflicts is present in the response, PTB's resolved token hex diverges from
284
- the raw Figma fill. These are low-confidenceverify with Figma (get_variable_defs or
285
- get_screenshot) and use: var(--ptb-token, <figma-verified-hex>) as the CSS fallback.
286
- - PTB cannot verify exact visual appearance. Use Figma for colors/spacing when in doubt.
283
+ - If tokenConflicts is present, PTB's resolved token hex diverges from the raw scanned
284
+ fill. Each conflict includes rawValue the hex the design actually renders, captured
285
+ by PTB's own scan. Trust rawValue as the visual ground truth and emit:
286
+ var(--ptb-token, <rawValue>) as the CSS fallback.
287
+ - For exact visual appearance, read the scan thumbnail at thumbnailPath (and per-variant
288
+ thumbnails) — it is PTB's captured ground truth for colors, spacing, and arrangement.
287
289
 
288
- DIVISION OF LABOR WITH FIGMA MCP (composite workflow most accurate):
289
- PTB → token names, dependency graph, variant axes, state/content contracts (read contextFile)
290
- Figma exact hex values, spacing, visual arrangement (get_variable_defs, get_screenshot)
291
- Map: Figma hex get_token(hex) → --ptb-* cssVar name emit both together
290
+ EVERYTHING YOU NEED IS IN PTB (no external tools required):
291
+ token names, dependency graph, variant axes, state/content contracts read contextFile
292
+ exact rendered hex tokenConflicts[].rawValue (from the scan)
293
+ visual arrangement/spacingthe scan thumbnail at thumbnailPath
294
+ hex → token name → get_token(hex)
292
295
 
293
296
  TYPICAL WORKFLOW:
294
297
  1. Call start_work("<name>") — read blockedBy and tokenConflicts first
295
298
  2. For each blocker: call start_work("<dep>"), implement, call submit_work("<dep>")
296
- 3. Read contextFile for the full implementation brief
299
+ 3. Read contextFile for the full implementation brief (it contains promptText, the
300
+ render tree, and variantDiffs — these are intentionally NOT inlined in this
301
+ response because they exceed the tool-call size limit on large components)
297
302
  4. Implement the requested component
298
303
  5. Call submit_work("<name>") when done`, { name: z.string().describe("Component to start working on, e.g. 'SearchBar'") }, async ({ name }) => {
299
304
  let ctx;
@@ -411,12 +416,16 @@ TYPICAL WORKFLOW:
411
416
  layout: context.layout,
412
417
  size: context.size,
413
418
  docs: buildDocsPayload(context, codeName, ctx),
414
- promptText: promptPackage.promptText,
419
+ // NEW-8: promptText (often 100 KB+) is NOT inlined here — it blew the
420
+ // MCP tool-call token limit (94.7% of the payload) and failed the call
421
+ // outright on large component-sets. The full brief lives in contextFile
422
+ // (unchanged — it still contains promptText and every detail); read it
423
+ // from there. Only the compact instructions/summary travel in the payload.
415
424
  instructions: promptPackage.instructions,
416
425
  structureSummary: promptPackage.structureSummary,
417
426
  // Token conflicts: slots where PTB's resolved token hex differs from
418
- // the raw Figma fill. Always low-confidence verify against Figma
419
- // (get_screenshot / get_variable_defs) before trusting the token name.
427
+ // the raw scanned fill. Each carries rawValue (what the design renders,
428
+ // from PTB's scan) trust that and emit var(--ptb-token, <rawValue>).
420
429
  ...(context.tokenConflicts?.length
421
430
  ? { tokenConflicts: context.tokenConflicts }
422
431
  : {}),
@@ -565,13 +574,13 @@ Returns the design context (variants, tokens, slots, contracts, render tree) for
565
574
  component PLUS a dependency check: which child components this one uses and whether they are
566
575
  already implemented in ptb.lock.
567
576
 
568
- TOKEN AUTHORITY — what to trust, what to verify:
577
+ TOKEN AUTHORITY — what to trust:
569
578
  - PTB's --ptb-* cssVar names are authoritative. Always use them in emitted CSS.
570
- - If tokenConflicts is present, PTB's resolved token hex diverges from the raw Figma fill
571
- for those slots. Cross-check with Figma (get_variable_defs / get_screenshot) and emit the
572
- correct hex as a literal fallback: var(--ptb-token, <figma-hex>).
573
- - PTB does NOT know exact pixel positions, image assets, or precise spacing when tokens are
574
- unresolved ("unknown"). Use Figma for those facts.
579
+ - If tokenConflicts is present, PTB's resolved token hex diverges from the raw scanned fill
580
+ for those slots. Each conflict carries rawValue the hex the design actually renders,
581
+ from PTB's scan. Emit it as the literal fallback: var(--ptb-token, <rawValue>).
582
+ - For exact visual appearance colors, spacing, image assets, arrangement read the scan
583
+ thumbnail at thumbnailPath (and per-variant thumbnails). That is PTB's captured ground truth.
575
584
 
576
585
  WORKFLOW — follow this exactly:
577
586
  1. Check unbuiltDependencies. If any exist, call implement_component for each one in buildOrder first.
@@ -700,7 +709,9 @@ recursively when you call it for that dependency.`, { name: z.string().describe(
700
709
  layout: context.layout,
701
710
  size: context.size,
702
711
  docs: buildDocsPayload(context, codeName, ctx),
703
- promptText: promptPackage.promptText,
712
+ // NEW-8: promptText is NOT inlined (it exceeds the MCP tool-call token
713
+ // limit on large components). The full brief — including promptText — is
714
+ // in contextFile, which is unchanged; read it from there.
704
715
  instructions: promptPackage.instructions,
705
716
  structureSummary: promptPackage.structureSummary,
706
717
  ...(context.tokenConflicts?.length
@@ -51,16 +51,17 @@ WHAT PTB IS AUTHORITATIVE FOR (trust these without Figma):
51
51
  - Variant axes, state contract, interaction contract, slot contract
52
52
  - Lifecycle: designHash, stampedHash, workStatus (from ptb.lock)
53
53
 
54
- WHAT PTB CANNOT VERIFY (cross-check with Figma when available):
55
- - Exact visual appearance — PTB has no rendered reference
54
+ VISUAL GROUND TRUTH (all from PTB's own scan no external tools needed):
55
+ - Exact visual appearance — read the scan thumbnail at thumbnailPath (and per-variant
56
+ thumbnails). That is the captured reference for colors, spacing, positions, and assets.
56
57
  - tokenConflicts (if present): slots where PTB's resolved token hex diverges from the raw
57
- Figma fill. Always low-confidence. Use Figma get_variable_defs or get_screenshot to
58
- determine which value is correct, then use PTB's cssVar name with Figma's hex as fallback.
58
+ scanned fill. Each carries rawValue the hex the design actually renders. Emit PTB's
59
+ cssVar name with rawValue as the literal fallback: var(--ptb-token, <rawValue>).
59
60
 
60
- DIVISION OF LABOR WITH FIGMA MCP (composite workflow):
61
- PTB → token names, dependency graph, variant axes, state/content contracts
62
- Figma exact hex values, spacing px, badge positions, image assets (get_variable_defs, get_screenshot)
63
- Never deep-read the full render tree just to recover colors — that is Figma's job.`, {
61
+ EVERYTHING YOU NEED IS IN PTB:
62
+ token names, dependency graph, variant axes, state/content contracts → this response
63
+ exact rendered hex tokenConflicts[].rawValue visual arrangement thumbnailPath
64
+ hex token name get_token(hex)`, {
64
65
  name: z.string().describe("Component display name, e.g. 'Button' or 'Notification Item'"),
65
66
  detail: z.enum(["summary", "full"]).optional().default("summary").describe("'summary' (default): compact planning brief — variant axes, token bindings, dependencies, layout, state axis names, contextFile path. " +
66
67
  "'full': complete context with render tree and compressed variant patches."),
@@ -3,6 +3,19 @@ import * as path from "node:path";
3
3
  import { z } from "zod";
4
4
  import { resolveToken } from "@calibrate-ds/core";
5
5
  const UPGRADE_CHECKLIST = {
6
+ "0.1.89": [
7
+ "INDEPENDENCE release — PTB no longer recommends or depends on any external tool. Previously several MCP tool descriptions told the agent to 'cross-check with Figma MCP' (get_variable_defs / get_screenshot) for exact hex and visual truth.",
8
+ "That guidance was redundant: PTB already has that data from its own scan. tokenConflicts now direct the agent to rawValue — the hex the design actually renders, captured by the scan — with var(--ptb-token, <rawValue>) as the fallback; and the scan thumbnail at thumbnailPath is the visual ground truth for colors/spacing/arrangement.",
9
+ "Net effect: fewer round-trips, no dependency on a third-party MCP, and the agent gets a concrete value instead of being sent to another tool. No code behavior changed — only agent-facing guidance in start_work / get_component / get_token descriptions and two type comments.",
10
+ "Restart your IDE's MCP server to pick up the updated tool descriptions. No re-scan. 593 tests.",
11
+ ],
12
+ "0.1.88": [
13
+ "0.1.87 audit fixes (docs/PTB_0187_REPORT.md). Closes the last functional beta blocker plus the emitter-parity residuals. Six-plus releases, zero regressions.",
14
+ "FIX (NEW-8, open since .79 — was FAILING HARD): start_work's MCP response inlined promptText (100 KB+, 94.7% of the payload), so start_work on a large component-set EXCEEDED the tool-call token limit and the call failed outright. promptText is no longer inlined in the response. The contextFile on disk is UNCHANGED — it still contains promptText and every detail; read the full brief from there (the tool description says so). This unblocks the primary agent entry point.",
15
+ "FIX (E-19 parity): multi-mode themes (e.g. Light/Dark) reached the canonical tokens.css but NOT the per-collection css/<name>.css or the TS export <name>.ts. All three emitters now emit every mode — per-collection CSS gets [data-theme] blocks; the TS export carries a valuesByMode field per token.",
16
+ "FIX (E-9 parity): a malformed hex value (e.g. #GGGGGG) was dropped from CSS but still leaked into the TS export. It's now skipped by every emitter, including <name>.ts. A shared token-value guard + a cross-emitter parity test prevent this fix-one-emitter class from recurring.",
17
+ "Re-run 'ptb generate-tokens' (or let start_work regenerate) to pick up the emitter fixes. No re-scan needed for these. Restart your IDE's MCP server for the start_work payload change. 593 tests.",
18
+ ],
6
19
  "0.1.87": [
7
20
  "LICENSE CHANGE release — no code changes. Calibrate is now licensed under the Functional Source License (FSL-1.1-MIT), a source-available license, instead of Apache-2.0.",
8
21
  "What it means: you may still read, use, copy, modify, and redistribute the software freely for any purpose EXCEPT a Competing Use (offering it as a commercial product/service that substitutes for Calibrate). Each version additionally becomes MIT-licensed two years after its release.",
@@ -141,8 +141,9 @@ Accepts:
141
141
 
142
142
  Returns: collection, tokenName, cssVar (--ptb-* variable), resolvedValue, aliasChain (when present).
143
143
 
144
- PTB owns the token identity map — use hex lookup when Figma's get_variable_defs returns a
145
- raw color and you need the canonical --ptb-* name instead of guessing the convention.`, { query: z.string().describe("Token name, path, Figma variable name (surface/surface-info-light), or hex color (#E5F3FF)") }, async ({ query }) => {
144
+ PTB owns the token identity map — use hex lookup when you have a raw color (e.g. a
145
+ tokenConflicts rawValue from the scan) and need the canonical --ptb-* name instead of
146
+ guessing the convention.`, { query: z.string().describe("Token name, path, Figma variable name (surface/surface-info-light), or hex color (#E5F3FF)") }, async ({ query }) => {
146
147
  let ctx;
147
148
  try {
148
149
  ctx = await getContext();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calibrate-ds/cli",
3
- "version": "0.1.87",
3
+ "version": "0.1.89",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -44,10 +44,10 @@
44
44
  "commander": "^14.0.3",
45
45
  "openai": "^6.34.0",
46
46
  "zod": "^4.3.6",
47
- "@calibrate-ds/figma-client": "^0.1.87",
48
- "@calibrate-ds/generator-react": "^0.1.87",
49
- "@calibrate-ds/core": "^0.1.87",
50
- "@calibrate-ds/shared-types": "^0.1.87"
47
+ "@calibrate-ds/core": "^0.1.89",
48
+ "@calibrate-ds/figma-client": "^0.1.89",
49
+ "@calibrate-ds/generator-react": "^0.1.89",
50
+ "@calibrate-ds/shared-types": "^0.1.89"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^22.13.5",