@calibrate-ds/cli 0.1.24 → 0.1.26
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/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +4 -2
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +26 -26
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/document.d.ts.map +1 -1
- package/dist/commands/document.js +2 -1
- package/dist/commands/document.js.map +1 -1
- package/dist/commands/generate-components.d.ts.map +1 -1
- package/dist/commands/generate-components.js +11 -5
- package/dist/commands/generate-components.js.map +1 -1
- package/dist/commands/implement.d.ts.map +1 -1
- package/dist/commands/implement.js +2 -1
- package/dist/commands/implement.js.map +1 -1
- package/dist/commands/prompt.js +2 -1
- package/dist/commands/prompt.js.map +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +3 -13
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +3 -2
- package/dist/commands/verify.js.map +1 -1
- package/dist/mcp/tools/action-tools.d.ts.map +1 -1
- package/dist/mcp/tools/action-tools.js +182 -217
- package/dist/mcp/tools/action-tools.js.map +1 -1
- package/dist/mcp/tools/component-tools.d.ts.map +1 -1
- package/dist/mcp/tools/component-tools.js +84 -29
- package/dist/mcp/tools/component-tools.js.map +1 -1
- package/dist/mcp/tools/governance-tools.d.ts.map +1 -1
- package/dist/mcp/tools/governance-tools.js +70 -184
- package/dist/mcp/tools/governance-tools.js.map +1 -1
- package/dist/mcp/tools/info-tools.d.ts.map +1 -1
- package/dist/mcp/tools/info-tools.js +36 -166
- package/dist/mcp/tools/info-tools.js.map +1 -1
- package/dist/mcp/tools/token-tools.d.ts.map +1 -1
- package/dist/mcp/tools/token-tools.js +34 -55
- package/dist/mcp/tools/token-tools.js.map +1 -1
- package/dist/mcp/tools/verify-tool.d.ts.map +1 -1
- package/dist/mcp/tools/verify-tool.js +0 -37
- package/dist/mcp/tools/verify-tool.js.map +1 -1
- package/dist/utils/managed-components.d.ts +14 -0
- package/dist/utils/managed-components.d.ts.map +1 -0
- package/dist/utils/managed-components.js +23 -0
- package/dist/utils/managed-components.js.map +1 -0
- package/package.json +5 -5
|
@@ -1,132 +1,17 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
|
|
4
|
-
"0.1.24": {
|
|
5
|
-
summary: "R3 fully closed — resolveRelativeImportTarget now emits the index barrel (casing-safe) instead of the lowercase slug filename. All 7 R-tickets are now green.",
|
|
6
|
-
highlights: [
|
|
7
|
-
"fix: resolveRelativeImportTarget returns '…/index' instead of '…/<slug>' — composite dep imports now resolve to the folder barrel, eliminating TS2307/TS1149 casing errors (R3 final)",
|
|
8
|
-
],
|
|
9
|
-
},
|
|
10
|
-
"0.1.23": {
|
|
11
|
-
summary: "Version bump to resolve install issues with 0.1.22. No functional changes.",
|
|
12
|
-
highlights: [
|
|
13
|
-
"chore: bump all packages to 0.1.23 to resolve npm publish/install conflict with 0.1.22",
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
"0.1.22": {
|
|
17
|
-
summary: "token_impact now reads context/components/ (was context/) and normalises slash-style token names to dashes — R1b closes after three attempts. generateCompositeFile falls back to dependencyInstances when composite.children is empty — R3 closes after three attempts. All 7 R-tickets are now green.",
|
|
18
|
-
highlights: [
|
|
19
|
-
"fix: token_impact (MCP + CLI) reads .ptb/context/components/<slug>.json — 'context/' subdir was missing; ctxData was null for every component (R1b)",
|
|
20
|
-
"fix: token_impact query normalises '/' → '-' so Figma-style 'surface/surface-info-light' matches the dash-form cssVar (R1b)",
|
|
21
|
-
"fix: generateCompositeFile falls back to component.dependencyInstances when composite.children is [] — the normalizeComposites stub hardcodes children:[] so ChatHeader now emits import { BtnWeb } + import { Profile } (R3)",
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
"0.1.21": {
|
|
25
|
-
summary: "token_impact walks per-node resolvedBindings across all context files — finds tokens in nested nodes (R1b″). Dep-import supplemental pass runs unconditionally — ChatHeader now imports BtnWeb + Profile even when no layoutTree is present (R3″).",
|
|
26
|
-
highlights: [
|
|
27
|
-
"fix: token_impact and ptb query token-impact now walk .ptb/context/<slug>.json per-node resolvedBindings instead of shallow comp.tokenBindings — finds nested token usages like surface-info-light in a chip node (R1b″)",
|
|
28
|
-
"fix: dependencyInstances supplemental pass moved outside if(layoutTree) — import stubs are always emitted, fixing ChatHeader with no layoutTree still getting BtnWeb + Profile imports (R3″)",
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
"0.1.20": {
|
|
32
|
-
summary: "cssValue fallback to cssVar when alias chain points outside model.tokens (R1c). CLI token-impact command reads real binding fields (R1b′). CLI generate-components passes full snapshot to writeComponents — single-component regen no longer drops sibling barrel exports (R2′). generator-react package now correctly versioned alongside all other packages.",
|
|
33
|
-
highlights: [
|
|
34
|
-
"fix: resolveTokenBinding/resolveTokenBindingFromIndex fall back to cssVar when formatCSSValue returns empty — per-node resolvedBindings.cssValue no longer blank for cross-library alias chains (R1c)",
|
|
35
|
-
"fix: CLI ptb query token-impact reads b.boundToken.name / b.resolvedToken.name / b.boundToken.cssVariable — matches components that actually use a token (R1b′)",
|
|
36
|
-
"fix: CLI generate-components passes full snapshot to writeComponents — single-component regen no longer drops sibling barrel exports (R2′)",
|
|
37
|
-
"fix: generator-react package.json bumped alongside all other packages — resolves silent R2/R3 failures in consumer repos that published 0.1.19 without the updated generator",
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
"0.1.19": {
|
|
41
|
-
summary: "Token alias resolution in get_token and list_themes (R1a). token_impact now reads real binding fields (R1b). Single-component regen preserves full category barrel (R2). Dep import stubs emitted for all instances in layout tree (R3). stateAxis now correctly selects the interactive axis over dimensional axes (R4). childNodes removed from ComponentContext — payload drops ~66% (R6). Playwright resolved from host project node_modules in run_verify (R5).",
|
|
42
|
-
highlights: [
|
|
43
|
-
"fix: get_token and list_themes now call resolveTokenValue() — resolvedValue is a hex string, not '[object Object]' (R1a)",
|
|
44
|
-
"fix: token_impact reads b.boundToken.name / b.resolvedToken.name / b.boundToken.cssVariable — finds components that actually use a token (R1b)",
|
|
45
|
-
"fix: generate_components passes full snapshot to writeComponents — single-component regen no longer drops sibling barrel exports (R2)",
|
|
46
|
-
"fix: dep import stubs emitted unconditionally for all dependencyInstances — ChatHeader now imports BtnWeb and Profile (R3)",
|
|
47
|
-
"fix: resolveStateContract prefers pseudo-state axis (hover/pressed/rest) over dimensional axis (size) — stateAxis and stateDefaults now reflect interactive states (R4)",
|
|
48
|
-
"fix: childNodes removed from ComponentContext output — get_component(PropertyCard) context drops from 424K to ~140K; renderTree is the canonical source (R6)",
|
|
49
|
-
"fix: screenshotWithPlaywright resolves Playwright via createRequire from workspaceRoot — uses host project's playwright, not PTB's own node_modules (R5)",
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
"0.1.18": {
|
|
53
|
-
summary: "Token pipeline fixed end-to-end: MCP run_scan now enriches tokens, icons, bitmaps, and thumbnails identical to CLI scan. get_token_by_value, list_themes, and get_token return correct --ptb-* CSS var names. Content-stable designHash eliminates false-drift storms. Barrel regen is now additive (never drops hand-crafted exports, never sweeps _compare dirs into public API). Thumbnail pipeline SVG mislabeling fixed. get_component now surfaces thumbnailPath. Codegen emits import stubs for all known dep instances. what_uses returns code-level workStatus. variantAxes options backfilled from variantDiffs. stateDefaults keyed by primary-axis value. W7: form-control and unnamed-axis semantic guards in implementationHints. W8: spacing token names resolved from token collections (eliminates 161 'unknown' entries); render tree instance nodes carry ptbCodeName.",
|
|
54
|
-
highlights: [
|
|
55
|
-
"fix: MCP run_scan now calls resolveTokenSource, enrichIconsWithSvg, enrichBitmapAssets, enrichComponentThumbnails — identical enrichment pipeline to CLI scan; fixes tokens:[] in MCP-saved snapshots",
|
|
56
|
-
"fix: normalize-token-collections now stores aliasTargetId on VARIABLE_ALIAS tokens — consistent with plugin path; enables alias chain traversal from REST-path snapshots",
|
|
57
|
-
"fix: get_token_by_value, list_themes, get_token: cssVar constructed from getPTBTokenVariableName(collection, name) — no longer reads non-existent t.cssVar/t.resolvedValue/t.resolutionPath fields",
|
|
58
|
-
"fix: get_token_by_value alias chain now follows aliasTargetId references across all token collections",
|
|
59
|
-
"fix: designHash uses stable key-sorted JSON serialization — eliminates false-drift storm (17/17 components showing drift after re-scan)",
|
|
60
|
-
"fix: barrel regen skips _-prefixed dirs (e.g. _compare_*) at both root and category level — no more private dirs leaking into public API",
|
|
61
|
-
"fix: thumbnail enrichment always uses PNG export path — SVG content no longer mislabeled as .png",
|
|
62
|
-
"feat: get_component response includes thumbnailPath from ComponentDefinition",
|
|
63
|
-
"feat: codegen emits import stubs for all dependencyInstances not found in layout tree walk — agents no longer wire imports by hand",
|
|
64
|
-
"feat: what_uses returns workStatus + codeStatus (in-sync/stale/unbuilt) for each dependent — blast-radius analysis includes code layer",
|
|
65
|
-
"fix: variantAxes options backfilled from variantDiffs.variantSelection when Figma API omits variantOptions — axes always have full value lists",
|
|
66
|
-
"fix: stateContract.stateDefaults keyed by primary-axis value ('Default', 'Hover') not by concatenated all-axis string ('sm-Default')",
|
|
67
|
-
"feat: implementationHints.isFormControl + formControlNote emitted for form-control components — agents emit correct native inputs",
|
|
68
|
-
"feat: implementationHints.unnamedAxesWarning + unnamedAxes emitted when Figma auto-named axes (Property 1) would leak into public prop API",
|
|
69
|
-
"fix: layout spacing token names ('unknown') resolved directly from model.tokens by token ID — fixes 161 'unknown' spacing entries",
|
|
70
|
-
"feat: render tree instance nodes carry ptbCodeName — agents see component names, not raw Figma IDs",
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
"0.1.16": {
|
|
74
|
-
summary: "Spacing token fixes, correct CSS output, auto-stories in generate-components, render tree pruning, thumbnail-first verify, and structured diff output.",
|
|
75
|
-
highlights: [
|
|
76
|
-
"fix: spacing tokens (gap, padding) now emit correct px values in generated CSS — was silently dropping units when token value was stored as a string internally",
|
|
77
|
-
"fix: resolvedToken.name no longer shows 'unknown' for layout spacing bindings — names are backfilled from resolvedBindings after context build",
|
|
78
|
-
"fix: CSS border shorthand now emits valid `1px solid <color>` — was producing `border: #color` which is invalid CSS",
|
|
79
|
-
"feat: ptb generate-components now auto-generates .stories.tsx when generation.stories: true — previously only the scaffold/implement paths created stories files",
|
|
80
|
-
"feat: instance subtrees pruned from render tree — removes ~1MB of redundant JSON from component context payloads; no code-gen impact",
|
|
81
|
-
"feat: ptb verify uses scan-time thumbnail as design reference by default (no Figma token required at verify time); add --fresh-figma to force a live Figma API screenshot",
|
|
82
|
-
"fix: ptb diff / run_diff MCP: cross-collection token alias targets now show as CollectionName/token-name instead of raw VariableID:XX:YY strings",
|
|
83
|
-
"feat: run_diff MCP output enriched — multiline blocks flattened to discrete lines, changeCategories per component, affectedComponents per token collection, top-level summary string for one-liner AI answers",
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
"0.1.9": {
|
|
87
|
-
summary: "Write-action MCP tools, preferred values for instance-swap slots, and upgrade notices.",
|
|
88
|
-
highlights: [
|
|
89
|
-
"New MCP tool: run_scan — scan Figma and update snapshot without leaving the IDE",
|
|
90
|
-
"New MCP tool: generate_components — scaffold typed React shells from snapshot",
|
|
91
|
-
"New MCP tool: generate_tokens — regenerate CSS token files",
|
|
92
|
-
"New MCP tool: export_context — export .ptb/context/ files and update ptb.lock",
|
|
93
|
-
"New MCP tool: stamp_component — mark component as implemented",
|
|
94
|
-
"New MCP tool: assign_component — assign component to a developer",
|
|
95
|
-
"New MCP tool: get_component_slots — returns only instance-swap slots with preferredValues (valid icon names)",
|
|
96
|
-
"Scanner now captures Figma preferredValues for INSTANCE_SWAP properties (resolved to component names)",
|
|
97
|
-
"Post-upgrade notice: prints what's new when ptb version changes",
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
"0.1.8": {
|
|
101
|
-
summary: "Full MCP server (11 tools), Symbol Bridge, and --cwd fix.",
|
|
102
|
-
highlights: [
|
|
103
|
-
"MCP server: ptb mcp starts an MCP stdio server for AI IDEs",
|
|
104
|
-
"11 MCP tools: get_component, list_components, get_component_slots, find_component_by_figma_node, is_stale, what_uses, coverage_summary, token_impact, list_themes, get_token, get_verify_report",
|
|
105
|
-
"Symbol Bridge (ptb-bridge.json): maps Figma node IDs to exported component symbols",
|
|
106
|
-
"--cwd flag and PTB_WORKSPACE env var for MCP server CWD resolution",
|
|
107
|
-
"MCP roots auto-detect: uses MCP client workspace roots when available",
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
"0.1.7": {
|
|
111
|
-
summary: "Verify command and Storybook integration.",
|
|
112
|
-
highlights: [
|
|
113
|
-
"ptb verify component <name>: pixel-diffs Figma vs Storybook render",
|
|
114
|
-
"AI visual feedback via Claude Vision",
|
|
115
|
-
"Auto-detect Storybook on localhost:6006",
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
"0.1.6": {
|
|
119
|
-
summary: "AI layer, document command, and CI integration.",
|
|
120
|
-
highlights: [
|
|
121
|
-
"ptb implement component <name>: AI-writes component from design context",
|
|
122
|
-
"ptb document component <name>: generates MDX docs and Storybook stories",
|
|
123
|
-
"ptb document system: generates CLAUDE.md and components.md",
|
|
124
|
-
"ptb ci setup: generates GitHub Actions workflow for freshness checks",
|
|
125
|
-
"ptb ai setup/use/remove: multi-provider AI config (Claude, OpenAI)",
|
|
126
|
-
],
|
|
127
|
-
},
|
|
128
|
-
};
|
|
3
|
+
import { z } from "zod";
|
|
129
4
|
const UPGRADE_CHECKLIST = {
|
|
5
|
+
"0.1.26": [
|
|
6
|
+
"BREAKING (MCP tool names): run_scan, generate_components, generate_tokens, export_context, run_prune removed — use run({ stage: 'scan'|'generate'|'tokens'|'context'|'prune' }) instead",
|
|
7
|
+
"BREAKING (MCP tool names): get_token_by_value removed — use get_token({ query }) for all token lookups including hex reverse-lookup",
|
|
8
|
+
"BREAKING (MCP tool names): get_setup_checklist and get_upgrade_checklist removed — use get_checklist({ kind: 'setup' | 'upgrade' })",
|
|
9
|
+
"BREAKING (MCP tool names): is_stale removed — use get_status({ quick: true }) for fast design-drift checks (ptb.lock only, no source file reads)",
|
|
10
|
+
"BREAKING (MCP tool names): stamp_component removed — use submit_work({ name, transitionTo:'stamped', folder?, artifacts? }) instead. Bulk stamp via CLI: ptb stamp component .",
|
|
11
|
+
"BEHAVIOR CHANGE: get_component now defaults to summary mode — if your agent workflow relies on the full inline context, add detail:'full' to those calls or switch to implement_component which returns the full brief",
|
|
12
|
+
"No changes to ptb.config.json, ptb.lock, generated component files, or context files on disk",
|
|
13
|
+
"No re-scan or re-export required",
|
|
14
|
+
],
|
|
130
15
|
"0.1.19": [
|
|
131
16
|
"Re-run `ptb export context` (or export_context MCP tool) — refreshes context files without childNodes; context payloads drop ~66%",
|
|
132
17
|
"Re-run `ptb scan` to repopulate token alias chains if stateContract shows wrong axis after upgrade",
|
|
@@ -171,40 +56,29 @@ const UPGRADE_CHECKLIST = {
|
|
|
171
56
|
export const infoTools = {
|
|
172
57
|
name: "info",
|
|
173
58
|
register(server, getContext) {
|
|
174
|
-
server.tool("
|
|
175
|
-
const entries = Object.entries(CHANGELOG).map(([v, c]) => ({
|
|
176
|
-
version: v,
|
|
177
|
-
summary: c.summary,
|
|
178
|
-
highlights: c.highlights,
|
|
179
|
-
}));
|
|
180
|
-
return { content: [{ type: "text", text: JSON.stringify(entries, null, 2) }] };
|
|
181
|
-
});
|
|
182
|
-
server.tool("get_upgrade_checklist", "Get the upgrade checklist for a specific PTB version — what to do after updating.", async () => {
|
|
183
|
-
const entries = Object.entries(UPGRADE_CHECKLIST).map(([v, steps]) => ({
|
|
184
|
-
version: v,
|
|
185
|
-
steps,
|
|
186
|
-
}));
|
|
187
|
-
return { content: [{ type: "text", text: JSON.stringify(entries, null, 2) }] };
|
|
188
|
-
});
|
|
189
|
-
server.tool("get_setup_checklist", `Check the current PTB setup state and return a prioritized step-by-step guide.
|
|
59
|
+
server.tool("get_checklist", `Get a checklist for PTB setup or upgrade.
|
|
190
60
|
|
|
191
|
-
|
|
192
|
-
the exact tool
|
|
193
|
-
|
|
194
|
-
- Pause and ask the user only for steps that require manual action (like setting a file key or token)
|
|
195
|
-
- Once a manual step is confirmed done, continue with the next canAutoRun steps
|
|
61
|
+
kind: 'setup' — checks current workspace state and returns a prioritized step-by-step
|
|
62
|
+
guide with status (done/pending/blocked) and the exact MCP tool to call for each step.
|
|
63
|
+
Work through steps in order: call canAutoRun steps immediately, pause only for manual steps.
|
|
196
64
|
|
|
197
|
-
|
|
65
|
+
kind: 'upgrade' — returns per-version upgrade checklists (what to do after updating PTB).`, { kind: z.enum(["setup", "upgrade"]).describe("'setup': guided first-time setup checklist with live state detection. 'upgrade': post-update steps per PTB version.") }, async ({ kind }) => {
|
|
66
|
+
if (kind === "upgrade") {
|
|
67
|
+
const entries = Object.entries(UPGRADE_CHECKLIST).map(([v, steps]) => ({
|
|
68
|
+
version: v,
|
|
69
|
+
steps,
|
|
70
|
+
}));
|
|
71
|
+
return { content: [{ type: "text", text: JSON.stringify(entries, null, 2) }] };
|
|
72
|
+
}
|
|
73
|
+
// kind === "setup": check live workspace state and return prioritized steps
|
|
198
74
|
let workspaceRoot = process.cwd();
|
|
199
75
|
let config = null;
|
|
200
|
-
// Try to get workspaceRoot from context if snapshot already exists
|
|
201
76
|
try {
|
|
202
77
|
const ctx = await getContext();
|
|
203
78
|
workspaceRoot = ctx.workspaceRoot;
|
|
204
79
|
config = ctx.config;
|
|
205
80
|
}
|
|
206
81
|
catch {
|
|
207
|
-
// No snapshot yet — load config independently
|
|
208
82
|
try {
|
|
209
83
|
const raw = await fs.readFile(path.join(workspaceRoot, "ptb.config.json"), "utf-8");
|
|
210
84
|
config = JSON.parse(raw);
|
|
@@ -212,7 +86,6 @@ Call this after ptb init to drive the full guided setup without the user needing
|
|
|
212
86
|
catch { /* no config yet */ }
|
|
213
87
|
}
|
|
214
88
|
const steps = [];
|
|
215
|
-
// Step 1 — file key configured
|
|
216
89
|
const fileKey = config?.designTool?.fileKey;
|
|
217
90
|
const fileKeySet = !!fileKey && fileKey !== "YOUR_FIGMA_FILE_KEY";
|
|
218
91
|
steps.push({
|
|
@@ -224,7 +97,6 @@ Call this after ptb init to drive the full guided setup without the user needing
|
|
|
224
97
|
? null
|
|
225
98
|
: 'Open ptb.config.json and replace "YOUR_FIGMA_FILE_KEY" with your actual file key.\nFind it in the Figma URL: figma.com/design/<FILE_KEY>/...',
|
|
226
99
|
});
|
|
227
|
-
// Step 2 — access token set in MCP server environment
|
|
228
100
|
const tokenEnv = config?.designTool?.accessTokenEnv ?? "FIGMA_ACCESS_TOKEN";
|
|
229
101
|
const tokenSet = !!process.env[tokenEnv];
|
|
230
102
|
steps.push({
|
|
@@ -236,7 +108,6 @@ Call this after ptb init to drive the full guided setup without the user needing
|
|
|
236
108
|
? null
|
|
237
109
|
: `The MCP server needs the token in its own environment (not just your terminal).\n\nMac (dock-launched IDEs): run in terminal:\n launchctl setenv ${tokenEnv} your_token\nThen FULLY QUIT and relaunch your IDE — not just reload the window.\nIf you already ran launchctl setenv but still see this error, the MCP server started before the token was set. A full IDE quit-and-relaunch is required.\n\nAlternatively, launch your IDE from the terminal so it inherits your shell env:\n export ${tokenEnv}=your_token && cursor . (or code .)\n\nGet your token: Figma → Account Settings → Security → Generate New Token`,
|
|
238
110
|
});
|
|
239
|
-
// Step 3 — snapshot exists
|
|
240
111
|
const snapshotPath = path.join(workspaceRoot, ".ptb", "latest.json");
|
|
241
112
|
const hasSnapshot = await fs.access(snapshotPath).then(() => true).catch(() => false);
|
|
242
113
|
const canScan = fileKeySet && tokenSet;
|
|
@@ -246,16 +117,14 @@ Call this after ptb init to drive the full guided setup without the user needing
|
|
|
246
117
|
status: hasSnapshot ? "done" : canScan ? "pending" : "blocked",
|
|
247
118
|
blockedReason: !fileKeySet ? "Complete step 1 first" : !tokenSet ? "Complete step 2 first" : undefined,
|
|
248
119
|
canAutoRun: canScan,
|
|
249
|
-
mcpTool: "
|
|
250
|
-
|
|
120
|
+
mcpTool: "run",
|
|
121
|
+
mcpArgs: { stage: "scan" },
|
|
122
|
+
action: hasSnapshot ? null : "Call run({ stage: 'scan' })",
|
|
251
123
|
});
|
|
252
|
-
// Step 4 — context exported
|
|
253
|
-
// Files are written to .ptb/context/components/ (not the flat .ptb/context/ dir).
|
|
254
124
|
const contextDir = path.join(workspaceRoot, ".ptb", "context", "components");
|
|
255
125
|
let contextCount = 0;
|
|
256
126
|
try {
|
|
257
127
|
const files = await fs.readdir(contextDir);
|
|
258
|
-
// Exclude index.json which is always present after export
|
|
259
128
|
contextCount = files.filter((f) => f.endsWith(".json") && f !== "index.json").length;
|
|
260
129
|
}
|
|
261
130
|
catch { /* not yet */ }
|
|
@@ -266,10 +135,10 @@ Call this after ptb init to drive the full guided setup without the user needing
|
|
|
266
135
|
blockedReason: !hasSnapshot ? "Complete step 3 first" : undefined,
|
|
267
136
|
details: contextCount > 0 ? `${contextCount} context files in .ptb/context/components/` : null,
|
|
268
137
|
canAutoRun: hasSnapshot,
|
|
269
|
-
mcpTool: "
|
|
270
|
-
|
|
138
|
+
mcpTool: "run",
|
|
139
|
+
mcpArgs: { stage: "context" },
|
|
140
|
+
action: contextCount > 0 ? null : "Call run({ stage: 'context' })",
|
|
271
141
|
});
|
|
272
|
-
// Step 5 — tokens generated
|
|
273
142
|
const tokensDir = config?.output?.tokensDir
|
|
274
143
|
? path.join(workspaceRoot, config.output.tokensDir)
|
|
275
144
|
: path.join(workspaceRoot, "packages/ui/src/tokens");
|
|
@@ -286,10 +155,10 @@ Call this after ptb init to drive the full guided setup without the user needing
|
|
|
286
155
|
blockedReason: !hasSnapshot ? "Complete step 3 first" : undefined,
|
|
287
156
|
details: tokenFileCount > 0 ? `${tokenFileCount} token files generated` : null,
|
|
288
157
|
canAutoRun: hasSnapshot,
|
|
289
|
-
mcpTool: "
|
|
290
|
-
|
|
158
|
+
mcpTool: "run",
|
|
159
|
+
mcpArgs: { stage: "tokens" },
|
|
160
|
+
action: tokenFileCount > 0 ? null : "Call run({ stage: 'tokens' })",
|
|
291
161
|
});
|
|
292
|
-
// Step 6 — components generated
|
|
293
162
|
const manifestPath = path.join(workspaceRoot, ".ptb", "manifest.json");
|
|
294
163
|
let generatedCount = 0;
|
|
295
164
|
try {
|
|
@@ -304,8 +173,9 @@ Call this after ptb init to drive the full guided setup without the user needing
|
|
|
304
173
|
blockedReason: !hasSnapshot ? "Complete step 3 first" : undefined,
|
|
305
174
|
details: generatedCount > 0 ? `${generatedCount} component shells scaffolded` : null,
|
|
306
175
|
canAutoRun: hasSnapshot,
|
|
307
|
-
mcpTool: "
|
|
308
|
-
|
|
176
|
+
mcpTool: "run",
|
|
177
|
+
mcpArgs: { stage: "generate" },
|
|
178
|
+
action: generatedCount > 0 ? null : "Call run({ stage: 'generate' })",
|
|
309
179
|
});
|
|
310
180
|
const done = steps.filter((s) => s.status === "done").length;
|
|
311
181
|
const pending = steps.filter((s) => s.status === "pending");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-tools.js","sourceRoot":"","sources":["../../../src/mcp/tools/info-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"info-tools.js","sourceRoot":"","sources":["../../../src/mcp/tools/info-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,iBAAiB,GAA6B;IAChD,QAAQ,EAAE;QACN,yLAAyL;QACzL,qIAAqI;QACrI,qIAAqI;QACrI,kJAAkJ;QAClJ,gLAAgL;QAChL,wNAAwN;QACxN,8FAA8F;QAC9F,kCAAkC;KACrC;IACD,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CAAC;YAEzE,OAAO;gBACH,OAAO,EAAE,CAAC;wBACN,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACjB,OAAO,EAAE;gCACL,IAAI;gCACJ,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI;gCAC9B,KAAK,EAAE,KAAK,CAAC,MAAM;gCACnB,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAG,WAAmB,CAAC,IAAI,EAAE,IAAI,EAAG,WAAmB,CAAC,IAAI,EAAE,OAAO,EAAG,WAAmB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI;gCACjJ,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAG,UAAkB,CAAC,IAAI,EAAE,IAAI,EAAG,UAAkB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;6BACzG;4BACD,KAAK;yBACR,EAAE,IAAI,EAAE,CAAC,CAAC;qBACd,CAAC;aACL,CAAC;QACN,CAAC,CACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/token-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"token-tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/token-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAC;AA+C/D,eAAO,MAAM,UAAU,EAAE,YA4HxB,CAAC"}
|
|
@@ -11,6 +11,9 @@ function normaliseHex(raw) {
|
|
|
11
11
|
}
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
+
function normaliseName(raw) {
|
|
15
|
+
return raw.toLowerCase().replace(/[\s/.]+/g, "-").replace(/^-+|-+$/g, "");
|
|
16
|
+
}
|
|
14
17
|
function buildTokenById(collections) {
|
|
15
18
|
const map = new Map();
|
|
16
19
|
for (const col of collections) {
|
|
@@ -69,49 +72,17 @@ export const tokenTools = {
|
|
|
69
72
|
}));
|
|
70
73
|
return { content: [{ type: "text", text: JSON.stringify(summary, null, 2) }] };
|
|
71
74
|
});
|
|
72
|
-
server.tool("get_token",
|
|
73
|
-
let ctx;
|
|
74
|
-
try {
|
|
75
|
-
ctx = await getContext();
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
return { content: [{ type: "text", text: e.message }] };
|
|
79
|
-
}
|
|
80
|
-
const query = tokenPath.toLowerCase();
|
|
81
|
-
const matches = [];
|
|
82
|
-
const tokenById = buildTokenById((ctx.snapshot.tokens ?? []));
|
|
83
|
-
for (const col of (ctx.snapshot.tokens ?? [])) {
|
|
84
|
-
for (const token of col.tokens ?? []) {
|
|
85
|
-
const tokenName = token.name ?? "";
|
|
86
|
-
const cssVar = getPTBTokenVariableName(col.name, tokenName);
|
|
87
|
-
if (tokenName.toLowerCase().includes(query) || cssVar.toLowerCase().includes(query)) {
|
|
88
|
-
matches.push({
|
|
89
|
-
collection: col.name,
|
|
90
|
-
name: tokenName,
|
|
91
|
-
cssVar,
|
|
92
|
-
resolvedValue: resolveTokenValue(token, tokenById),
|
|
93
|
-
valueType: token.type ?? null,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (matches.length === 0) {
|
|
99
|
-
return { content: [{ type: "text", text: `No tokens found matching '${tokenPath}'.` }] };
|
|
100
|
-
}
|
|
101
|
-
return { content: [{ type: "text", text: JSON.stringify(matches, null, 2) }] };
|
|
102
|
-
});
|
|
103
|
-
server.tool("get_token_by_value", `Reverse-lookup: given a color hex value OR a Figma variable name, return the matching --ptb-* token(s) with their full 4-tier resolution chain.
|
|
104
|
-
|
|
105
|
-
PTB owns the token identity map — this tool makes that map queryable from the composite (Figma + PTB) workflow. When Figma's get_variable_defs returns a variable like "surface/surface-info-light = #E5F3FF", use this tool to find the canonical --ptb-* name instead of guessing the convention manually.
|
|
75
|
+
server.tool("get_token", `Look up a design token by name, path, or color hex value.
|
|
106
76
|
|
|
107
77
|
Accepts:
|
|
108
|
-
-
|
|
109
|
-
- Figma variable name:
|
|
110
|
-
-
|
|
78
|
+
- Name or partial path: 'brand.900', 'spacing.4', 'border-radius' (substring match)
|
|
79
|
+
- Figma variable name: 'surface/surface-info-light', 'Brand/900' (slash-separated)
|
|
80
|
+
- Hex color: '#E5F3FF' or 'e5f3ff' (# optional) — reverse-lookup by resolved value
|
|
81
|
+
|
|
82
|
+
Returns: collection, tokenName, cssVar (--ptb-* variable), resolvedValue, aliasChain (when present).
|
|
111
83
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}, async ({ value }) => {
|
|
84
|
+
PTB owns the token identity map — use hex lookup when Figma's get_variable_defs returns a
|
|
85
|
+
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 }) => {
|
|
115
86
|
let ctx;
|
|
116
87
|
try {
|
|
117
88
|
ctx = await getContext();
|
|
@@ -119,11 +90,9 @@ Returns: collection, tokenName, cssVar (--ptb-* variable), resolvedValue, aliasC
|
|
|
119
90
|
catch (e) {
|
|
120
91
|
return { content: [{ type: "text", text: e.message }] };
|
|
121
92
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const hexQuery = normaliseHex(value);
|
|
126
|
-
const nameQuery = normaliseName(value);
|
|
93
|
+
const hexQuery = normaliseHex(query);
|
|
94
|
+
const nameQueryLower = query.toLowerCase();
|
|
95
|
+
const nameQueryNorm = normaliseName(query);
|
|
127
96
|
const tokenById = buildTokenById((ctx.snapshot.tokens ?? []));
|
|
128
97
|
function buildAliasChain(token) {
|
|
129
98
|
const chain = [];
|
|
@@ -149,13 +118,23 @@ Returns: collection, tokenName, cssVar (--ptb-* variable), resolvedValue, aliasC
|
|
|
149
118
|
const tokenName = t.name ?? "";
|
|
150
119
|
const cssVar = getPTBTokenVariableName(col.name, tokenName);
|
|
151
120
|
const resolvedValue = resolveTokenValue(t, tokenById);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
121
|
+
let matched = false;
|
|
122
|
+
if (hexQuery !== null) {
|
|
123
|
+
// Hex lookup: match by resolved color value
|
|
124
|
+
matched = normaliseHex(resolvedValue) === hexQuery;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Name lookup: match by tokenName or cssVar using both
|
|
128
|
+
// normalization styles (dot-path lowercase and slash-to-dash)
|
|
129
|
+
const normToken = normaliseName(tokenName);
|
|
130
|
+
const normCssVar = normaliseName(cssVar);
|
|
131
|
+
matched =
|
|
132
|
+
tokenName.toLowerCase().includes(nameQueryLower) ||
|
|
133
|
+
cssVar.toLowerCase().includes(nameQueryLower) ||
|
|
134
|
+
normToken.includes(nameQueryNorm) ||
|
|
135
|
+
normCssVar.includes(nameQueryNorm);
|
|
136
|
+
}
|
|
137
|
+
if (matched) {
|
|
159
138
|
const key = `${col.name}::${tokenName}`;
|
|
160
139
|
if (seen.has(key))
|
|
161
140
|
continue;
|
|
@@ -173,9 +152,9 @@ Returns: collection, tokenName, cssVar (--ptb-* variable), resolvedValue, aliasC
|
|
|
173
152
|
}
|
|
174
153
|
}
|
|
175
154
|
if (matches.length === 0) {
|
|
176
|
-
const hint = hexQuery
|
|
177
|
-
? `No token found with resolved value ${hexQuery}. The token may
|
|
178
|
-
: `No
|
|
155
|
+
const hint = hexQuery !== null
|
|
156
|
+
? `No token found with resolved value ${hexQuery}. The token may use an alias chain — try a name fragment instead.`
|
|
157
|
+
: `No tokens found matching '${query}'. Try a shorter fragment or a hex value.`;
|
|
179
158
|
return { content: [{ type: "text", text: hint }] };
|
|
180
159
|
}
|
|
181
160
|
return { content: [{ type: "text", text: JSON.stringify(matches, null, 2) }] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-tools.js","sourceRoot":"","sources":["../../../src/mcp/tools/token-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,SAAS,YAAY,CAAC,GAAW;IAC7B,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC;IACD,IAAI,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,WAA8B;IAClD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkD,CAAC;IACtE,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC5B,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC/B,IAAK,CAAS,CAAC,EAAE;gBAAE,GAAG,CAAC,GAAG,CAAE,CAAS,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,IAAI,EA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tool.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/verify-tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAC;AAgB/D,eAAO,MAAM,UAAU,EAAE,YAqHxB,CAAC"}
|
|
@@ -117,43 +117,6 @@ Returns: pixel match score, AI assessment ("matches" / "minor-differences" / "si
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
server.tool("list_verify_reports", "List all components that have been visually verified, with their latest pixel match scores and assessment.", async () => {
|
|
121
|
-
let ctx;
|
|
122
|
-
try {
|
|
123
|
-
ctx = await getContext();
|
|
124
|
-
}
|
|
125
|
-
catch (e) {
|
|
126
|
-
return { content: [{ type: "text", text: e.message }] };
|
|
127
|
-
}
|
|
128
|
-
const verifyDir = path.join(ctx.metadataDir, "verify");
|
|
129
|
-
let slugDirs;
|
|
130
|
-
try {
|
|
131
|
-
slugDirs = await fs.readdir(verifyDir);
|
|
132
|
-
}
|
|
133
|
-
catch {
|
|
134
|
-
return { content: [{ type: "text", text: "No verify reports found. Run run_verify to generate one." }] };
|
|
135
|
-
}
|
|
136
|
-
const reports = [];
|
|
137
|
-
for (const slug of slugDirs) {
|
|
138
|
-
const reportPath = path.join(verifyDir, slug, "report.json");
|
|
139
|
-
try {
|
|
140
|
-
const raw = await fs.readFile(reportPath, "utf-8");
|
|
141
|
-
const report = JSON.parse(raw);
|
|
142
|
-
reports.push({
|
|
143
|
-
component: report.componentName,
|
|
144
|
-
slug,
|
|
145
|
-
checkedAt: report.checkedAt,
|
|
146
|
-
score: report.pixelMatch?.score ?? null,
|
|
147
|
-
assessment: report.aiFeedback?.overallAssessment ?? null,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
catch { /* skip malformed */ }
|
|
151
|
-
}
|
|
152
|
-
if (reports.length === 0) {
|
|
153
|
-
return { content: [{ type: "text", text: "No valid verify reports found." }] };
|
|
154
|
-
}
|
|
155
|
-
return { content: [{ type: "text", text: JSON.stringify(reports, null, 2) }] };
|
|
156
|
-
});
|
|
157
120
|
},
|
|
158
121
|
};
|
|
159
122
|
//# sourceMappingURL=verify-tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-tool.js","sourceRoot":"","sources":["../../../src/mcp/tools/verify-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,SAAS,MAAM,CAAC,IAAY;IACxB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,aAAa,CAAC,QAAa,EAAE,KAAa;IAC/C,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAC3B,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK,CACtF,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAiB;IACpC,IAAI,EAAE,QAAQ;IACd,QAAQ,CAAC,MAAM,EAAE,UAAU;QAEvB,MAAM,CAAC,IAAI,CACP,YAAY,EACZ;;;;;;;;;;;;;;;2LAe+K,EAC/K;YACI,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCA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,CAAC,CAAC;gBACnD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAiB,CAAC;gBAC/C,MAAM,OAAO,GAAG;oBACZ,SAAS,EAAE,MAAM,CAAC,aAAa;oBAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,eAAe,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,IAAI,IAAI;oBACjD,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,iBAAiB,IAAI,IAAI;oBACxD,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,IAAI,IAAI;oBAC3C,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,WAAW,IAAI,EAAE;oBACjD,WAAW,EAAE,MAAM,CAAC,WAAW;iBAClC,CAAC;gBACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YAC5F,CAAC;YAAC,MAAM,CAAC;gBACL,OAAO;oBACH,OAAO,EAAE,CAAC;4BACN,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,+BAA+B,IAAI,+CAA+C,IAAI,EAAE;yBACjG,CAAC;iBACL,CAAC;YACN,CAAC;QACL,CAAC,CACJ,CAAC;IAEN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentDefinition, DesignSystemModel, PTBConfig } from "@calibrate-ds/shared-types";
|
|
2
|
+
/**
|
|
3
|
+
* Returns snapshot.components filtered by config.scan.exclude (case-insensitive,
|
|
4
|
+
* Figma display names). Scan always captures every component — this gate only
|
|
5
|
+
* applies to file-writing operations so hand-managed components are never touched.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getManagedComponents(snapshot: DesignSystemModel, config: PTBConfig): ComponentDefinition[];
|
|
8
|
+
/**
|
|
9
|
+
* Returns a shallow snapshot copy whose .components array is filtered through
|
|
10
|
+
* config.scan.exclude. Pass this to generator.writeComponents() so the generator
|
|
11
|
+
* never iterates excluded components.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getManagedSnapshot(snapshot: DesignSystemModel, config: PTBConfig): DesignSystemModel;
|
|
14
|
+
//# sourceMappingURL=managed-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-components.d.ts","sourceRoot":"","sources":["../../src/utils/managed-components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEpG;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,SAAS,GAClB,mBAAmB,EAAE,CAMvB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,SAAS,GAClB,iBAAiB,CAInB"}
|