@aestheticfunction/dspack-emit 0.3.1 → 0.4.0

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.
@@ -0,0 +1,153 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aestheticfunction.github.io/dspack-emit/schema/profile.v1.schema.json",
4
+ "title": "dspack-emit a2ui Profile v1",
5
+ "description": "JSON form of the a2ui target's mapping Profile. Mirrors the TypeScript Profile interface in src/transform/profiles.ts one to one; loadProfile() validates against this schema before the engine runs.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "patternProperties": { "^x-": {} },
9
+ "required": [
10
+ "profileVersion",
11
+ "catalogTitle",
12
+ "catalogDescription",
13
+ "catalogIdBase",
14
+ "instructions",
15
+ "primaryColorToken",
16
+ "components",
17
+ "synthesized",
18
+ "casualtyComponents",
19
+ "surfaceSynthesis"
20
+ ],
21
+ "properties": {
22
+ "profileVersion": { "const": "1" },
23
+ "catalogTitle": { "type": "string", "minLength": 1 },
24
+ "catalogDescription": { "type": "string", "minLength": 1 },
25
+ "catalogIdBase": { "type": "string", "format": "uri", "pattern": "^https://" },
26
+ "instructions": { "type": "string" },
27
+ "primaryColorToken": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": ["category", "name"],
31
+ "properties": {
32
+ "category": { "type": "string", "minLength": 1 },
33
+ "name": { "type": "string", "minLength": 1 }
34
+ }
35
+ },
36
+ "components": { "type": "array", "items": { "$ref": "#/$defs/componentPlan" } },
37
+ "synthesized": { "type": "array", "items": { "$ref": "#/$defs/componentPlan" } },
38
+ "casualtyComponents": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "patternProperties": { "^x-": {} },
44
+ "required": ["dspackId", "attempted", "class", "reason"],
45
+ "properties": {
46
+ "dspackId": { "$ref": "#/$defs/dspackId" },
47
+ "attempted": { "type": "string", "minLength": 1 },
48
+ "class": { "enum": ["maps-cleanly", "synthesis-defaults", "lossy", "cannot-represent"] },
49
+ "reason": { "type": "string", "minLength": 1 }
50
+ }
51
+ }
52
+ },
53
+ "intentionallyOmitted": { "type": "array", "items": { "$ref": "#/$defs/dspackId" } },
54
+ "surfaceSynthesis": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["textComponent", "textProp", "wrapComponent", "wrapChildrenProp"],
58
+ "properties": {
59
+ "textComponent": { "$ref": "#/$defs/a2uiName" },
60
+ "textProp": { "type": "string", "minLength": 1 },
61
+ "wrapComponent": { "$ref": "#/$defs/a2uiName" },
62
+ "wrapChildrenProp": { "type": "string", "minLength": 1 }
63
+ }
64
+ }
65
+ },
66
+ "$defs": {
67
+ "dspackId": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
68
+ "a2uiName": { "type": "string", "pattern": "^[A-Z][A-Za-z0-9]*$" },
69
+ "componentPlan": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "patternProperties": { "^x-": {} },
73
+ "required": ["a2ui", "commons", "structural", "required"],
74
+ "properties": {
75
+ "a2ui": { "$ref": "#/$defs/a2uiName" },
76
+ "dspackId": { "$ref": "#/$defs/dspackId" },
77
+ "description": { "type": "string" },
78
+ "commons": { "type": "array", "items": { "type": "string", "minLength": 1 } },
79
+ "structural": {
80
+ "type": "object",
81
+ "additionalProperties": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "required": ["schema", "description", "synthNote"],
85
+ "properties": {
86
+ "schema": {},
87
+ "description": { "type": "string", "minLength": 1 },
88
+ "synthNote": { "type": "string", "minLength": 1 }
89
+ }
90
+ }
91
+ },
92
+ "propMap": {
93
+ "type": "object",
94
+ "additionalProperties": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": ["a2ui", "kind"],
98
+ "properties": {
99
+ "a2ui": { "type": "string", "minLength": 1 },
100
+ "kind": { "enum": ["enum", "string", "boolean", "number"] },
101
+ "targetEnum": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
102
+ "valueMap": { "type": "object", "additionalProperties": { "type": "string" } },
103
+ "default": { "type": "string" },
104
+ "description": { "type": "string" }
105
+ }
106
+ }
107
+ },
108
+ "required": { "type": "array", "items": { "type": "string" } },
109
+ "surfacePlan": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "properties": {
113
+ "subText": { "type": "object", "additionalProperties": { "type": "string" } },
114
+ "subButtonText": { "type": "object", "additionalProperties": { "type": "string" } },
115
+ "actionProp": { "type": "string" },
116
+ "textChildProp": { "type": "string" },
117
+ "textProp": { "type": "string" },
118
+ "childProp": { "type": "string" },
119
+ "childrenProp": { "type": "string" },
120
+ "structuralPassthrough": { "type": "array", "items": { "type": "string" } },
121
+ "subTable": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "required": ["caption", "header", "headerCell", "body", "row", "cell", "targetCaption", "targetColumns", "targetRows", "drops"],
125
+ "properties": {
126
+ "caption": { "type": "string" },
127
+ "header": { "type": "string" },
128
+ "headerCell": { "type": "string" },
129
+ "body": { "type": "string" },
130
+ "row": { "type": "string" },
131
+ "cell": { "type": "string" },
132
+ "targetCaption": { "type": "string" },
133
+ "targetColumns": { "type": "string" },
134
+ "targetRows": { "type": "string" },
135
+ "drops": { "type": "object", "additionalProperties": { "type": "string" } }
136
+ }
137
+ },
138
+ "subFlatten": {
139
+ "type": "object",
140
+ "additionalProperties": false,
141
+ "required": ["transparent", "asText"],
142
+ "properties": {
143
+ "transparent": { "type": "array", "items": { "$ref": "#/$defs/dspackId" } },
144
+ "asText": { "type": "object", "additionalProperties": { "type": "string" } }
145
+ }
146
+ }
147
+ }
148
+ },
149
+ "subCoverage": { "type": "object", "additionalProperties": { "type": "string" } }
150
+ }
151
+ }
152
+ }
153
+ }
@@ -62,6 +62,15 @@ export interface ComponentPlan {
62
62
  required: string[];
63
63
  /** How the surface emitter projects a dspack-surface node onto this component. */
64
64
  surfacePlan?: SurfacePlanDirectives;
65
+ /**
66
+ * Explicit per-sub-component disposition for compound components: every
67
+ * contract sub id -> one line naming how the surface emitter treats it
68
+ * (which prop consumes it, "transparent grouping", or "dropped: <why>").
69
+ * The profile-parity suite fails any mapped compound whose sub-family is
70
+ * not fully classified here — a parent mapping alone never implies its
71
+ * subs are supported.
72
+ */
73
+ subCoverage?: Record<string, string>;
65
74
  }
66
75
 
67
76
  /**
@@ -95,6 +104,38 @@ export interface SurfacePlanDirectives {
95
104
  childrenProp?: string;
96
105
  /** CSR props copied verbatim into same-named structural slots (e.g. Table columns/rows). */
97
106
  structuralPassthrough?: string[];
107
+ /**
108
+ * Named parent strategy "tableSubs": consume a tabular sub-component
109
+ * subtree into the synthesized caption/columns/rows shape. Domain-neutral
110
+ * by construction: cells flatten to their subtree TEXT in document order —
111
+ * nested component structure and props (whatever the component) are a
112
+ * documented loss, warned per cell, never re-interpreted into semantic
113
+ * fields. Sub ids listed in `drops` are skipped with a warning carrying
114
+ * the declared reason. structuralPassthrough-provided values win over
115
+ * consumed ones (the props path, where a contract expresses one).
116
+ */
117
+ subTable?: {
118
+ caption: string;
119
+ header: string;
120
+ headerCell: string;
121
+ body: string;
122
+ row: string;
123
+ cell: string;
124
+ targetCaption: string;
125
+ targetColumns: string;
126
+ targetRows: string;
127
+ drops: Record<string, string>;
128
+ };
129
+ /**
130
+ * Named parent strategy "subFlatten": grouping sub-components in
131
+ * `transparent` splice their children inline (structure dropped, order
132
+ * kept, warned); text-bearing sub-components in `asText` synthesize the
133
+ * profile's text primitive with the given variant.
134
+ */
135
+ subFlatten?: {
136
+ transparent: string[];
137
+ asText: Record<string, string>;
138
+ };
98
139
  }
99
140
 
100
141
  export interface StructuralSlot {
@@ -127,7 +168,7 @@ const CompId = { $ref: "#/$defs/ComponentId" };
127
168
  export const shadcnProfile: Profile = {
128
169
  catalogTitle: "shadcn/ui — A2UI catalog (compiled from dspack)",
129
170
  catalogDescription:
130
- "A2UI catalog compiled from the shadcn/ui dspack v0.2 contract. Component shapes, " +
171
+ "A2UI catalog compiled from the shadcn/ui dspack v0.4 contract. Component shapes, " +
131
172
  "variant enums, and the primary design token are projected onto the A2UI basic " +
132
173
  "component vocabulary. See MAPPING.md for per-field fidelity.",
133
174
  catalogIdBase: "https://rdombrowski.dev/catalogs/shadcn-ui",
@@ -196,11 +237,26 @@ export const shadcnProfile: Profile = {
196
237
  "The ID of the single child component. Wrap multiple elements in a Column and pass its ID.",
197
238
  synthNote:
198
239
  "A2UI Card takes exactly one child by ID; dspack Card composes via sub-components " +
199
- "(CardHeader/CardContent/CardFooter), which collapse to a single child slot.",
240
+ "(CardHeader/CardContent/CardFooter), which flatten (subFlatten strategy: grouping " +
241
+ "subs splice their children inline; title/description synthesize Text) and collapse " +
242
+ "to a single, possibly Column-wrapped, child slot.",
200
243
  },
201
244
  },
202
245
  required: ["child"],
203
- surfacePlan: { childProp: "child" },
246
+ surfacePlan: {
247
+ childProp: "child",
248
+ subFlatten: {
249
+ transparent: ["card-header", "card-content", "card-footer"],
250
+ asText: { "card-title": "h3", "card-description": "caption" },
251
+ },
252
+ },
253
+ subCoverage: {
254
+ "card-header": "transparent grouping: children splice inline, in order (subFlatten strategy)",
255
+ "card-title": "text -> synthesized Text (variant h3)",
256
+ "card-description": "text -> synthesized Text (variant caption)",
257
+ "card-content": "transparent grouping: children splice inline, in order",
258
+ "card-footer": "transparent grouping: children splice inline, in order",
259
+ },
204
260
  },
205
261
 
206
262
  {
@@ -268,8 +324,11 @@ export const shadcnProfile: Profile = {
268
324
 
269
325
  {
270
326
  // shadcn Table -> a synthesized presentational A2UI Table shape (caption/columns/rows).
271
- // The dspack sub-component composition (header/body/row/cell) cannot be represented and
272
- // is recorded as a casualty by the per-component composition handling.
327
+ // The contract's table is purely sub-component-composed (it has no props), so the
328
+ // surface emitter consumes the sub tree via the `subTable` strategy: caption text,
329
+ // header-cell texts as columns, body rows as cells-of-text. Nested component
330
+ // structure inside cells flattens to its text with a per-cell warning — the
331
+ // documented loss; nothing is re-interpreted into semantic fields.
273
332
  a2ui: "Table",
274
333
  dspackId: "table",
275
334
  commons: ["ComponentCommon"],
@@ -286,12 +345,37 @@ export const shadcnProfile: Profile = {
286
345
  },
287
346
  rows: {
288
347
  schema: { type: "array", items: { type: "object" } },
289
- description: "Row records, each { cells: string[], status?: { label, variant } }.",
348
+ description: "Row records, each { cells: string[] }.",
290
349
  synthNote: "Row data carried as a static array; A2UI has no tabular data model.",
291
350
  },
292
351
  },
293
352
  required: ["columns", "rows"],
294
- surfacePlan: { structuralPassthrough: ["caption", "columns", "rows"] },
353
+ surfacePlan: {
354
+ structuralPassthrough: ["caption", "columns", "rows"],
355
+ subTable: {
356
+ caption: "table-caption",
357
+ header: "table-header",
358
+ headerCell: "table-head",
359
+ body: "table-body",
360
+ row: "table-row",
361
+ cell: "table-cell",
362
+ targetCaption: "caption",
363
+ targetColumns: "columns",
364
+ targetRows: "rows",
365
+ drops: {
366
+ "table-footer": "summary rows have no slot in the synthesized caption/columns/rows shape",
367
+ },
368
+ },
369
+ },
370
+ subCoverage: {
371
+ "table-caption": "text -> the synthesized `caption` (subTable strategy)",
372
+ "table-header": "structural grouping; its rows' header-cell texts -> `columns` (subTable)",
373
+ "table-head": "text -> a `columns` label (in the header) or a plain row cell string (as a body row header)",
374
+ "table-body": "structural grouping; its rows -> `rows` (subTable)",
375
+ "table-row": "one `rows` record (header row feeds `columns` instead)",
376
+ "table-cell": "subtree text, document order, -> one `rows[].cells` string; nested component structure/props are a warned loss",
377
+ "table-footer": "dropped with warning: summary rows have no slot in the synthesized shape",
378
+ },
295
379
  },
296
380
 
297
381
  {
@@ -343,6 +427,16 @@ export const shadcnProfile: Profile = {
343
427
  subButtonText: { "alert-dialog-trigger": "triggerLabel" },
344
428
  actionProp: "action",
345
429
  },
430
+ subCoverage: {
431
+ "alert-dialog-trigger": "label-bearing text under it -> `triggerLabel` (subButtonText; audited lift when no label-bearer)",
432
+ "alert-dialog-content": "transparent grouping, traversed by the subtree text consumer",
433
+ "alert-dialog-header": "transparent grouping, traversed by the subtree text consumer",
434
+ "alert-dialog-title": "text -> `title` (subText)",
435
+ "alert-dialog-description": "text -> `description` (subText)",
436
+ "alert-dialog-footer": "transparent grouping, traversed by the subtree text consumer",
437
+ "alert-dialog-action": "text -> `confirmLabel` (subText); its action is the synthesized confirm event",
438
+ "alert-dialog-cancel": "text -> `cancelLabel` (subText)",
439
+ },
346
440
  },
347
441
  ],
348
442
 
@@ -0,0 +1,229 @@
1
+ /**
2
+ * scaffoldProfile: a mechanical 1:1 draft Profile from a dspack contract.
3
+ *
4
+ * Seeded from the json-render CatalogModel (the judgment-free 1:1 IR): every
5
+ * top-level contract component becomes a ComponentPlan with verbatim prop
6
+ * projections; compound sub-components get subFlatten directives derived from
7
+ * their *declared* `acceptsChildren` (text → asText, otherwise transparent).
8
+ *
9
+ * The scaffold invents no judgment: no valueMaps, no casualties, no lossy
10
+ * projections. Everything a human must review is returned as `notes` — the
11
+ * scaffold's analog of dspack-export's `awaitingAuthorship`. The result is a
12
+ * valid v1 profile document (loadProfile accepts it) whose transform passes
13
+ * gates A1/A2 with full coverage; whether each mapping is *right* is the
14
+ * author's call.
15
+ */
16
+ import type { DspackDoc, DspackProp } from "../types.js";
17
+ import { buildCatalogModel, type CatalogComponent } from "../targets/json-render/model.js";
18
+
19
+ export interface ScaffoldOptions {
20
+ /** Required: the project's catalog identity root (https URI). */
21
+ catalogIdBase: string;
22
+ catalogTitle?: string;
23
+ catalogDescription?: string;
24
+ instructions?: string;
25
+ /** Which token supplies theme.primaryColor; auto-detects color.primary when omitted. */
26
+ primaryColorToken?: { category: string; name: string };
27
+ }
28
+
29
+ export interface ScaffoldNote {
30
+ /** What the note is about: a component id, "<id>.<prop>", or a profile field. */
31
+ target: string;
32
+ note: string;
33
+ }
34
+
35
+ export interface ScaffoldResult {
36
+ /** A v1 profile *document* (includes profileVersion; loadProfile accepts it). */
37
+ profile: Record<string, unknown>;
38
+ /** Everything that needs human judgment before the profile is trustworthy. */
39
+ notes: ScaffoldNote[];
40
+ }
41
+
42
+ const DYN_STRING = { $ref: "#/$defs/DynamicString" };
43
+ const CHILD_LIST = { $ref: "#/$defs/ChildList" };
44
+ const COMP_ID = { $ref: "#/$defs/ComponentId" };
45
+
46
+ const TEXT_PLAN = {
47
+ a2ui: "Text",
48
+ commons: ["ComponentCommon"],
49
+ description: "Displays text content. Synthesized A2UI content primitive (not in the contract).",
50
+ structural: {
51
+ text: {
52
+ schema: DYN_STRING,
53
+ description: "The text content to display.",
54
+ synthNote: "A2UI content primitive required to render labels/titles in a surface.",
55
+ },
56
+ },
57
+ propMap: {
58
+ variant: {
59
+ a2ui: "variant",
60
+ kind: "enum",
61
+ targetEnum: ["h1", "h2", "h3", "h4", "h5", "caption", "body"],
62
+ default: "body",
63
+ description: "A hint for the base text style.",
64
+ },
65
+ },
66
+ required: ["text"],
67
+ };
68
+
69
+ const COLUMN_PLAN = {
70
+ a2ui: "Column",
71
+ commons: ["ComponentCommon"],
72
+ description:
73
+ "Arranges children vertically. Synthesized A2UI structural primitive (the contract has no layout component).",
74
+ structural: {
75
+ children: {
76
+ schema: CHILD_LIST,
77
+ description: "Child component IDs (or a template).",
78
+ synthNote: "A2UI structural primitive required to compose multiple children.",
79
+ },
80
+ },
81
+ required: ["children"],
82
+ };
83
+
84
+ interface SubDecl {
85
+ id: string;
86
+ acceptsChildren?: string;
87
+ }
88
+
89
+ function subsOf(doc: DspackDoc, id: string): SubDecl[] {
90
+ const composition = (doc.components?.[id]?.composition ?? {}) as { subComponents?: unknown[] };
91
+ const out: SubDecl[] = [];
92
+ for (const raw of composition.subComponents ?? []) {
93
+ if (typeof raw === "string") out.push({ id: raw });
94
+ else if (raw && typeof raw === "object" && typeof (raw as SubDecl).id === "string") out.push(raw as SubDecl);
95
+ }
96
+ return out;
97
+ }
98
+
99
+ export function scaffoldProfile(doc: DspackDoc, options: ScaffoldOptions): ScaffoldResult {
100
+ const notes: ScaffoldNote[] = [];
101
+ const model = buildCatalogModel(doc, {});
102
+ const byId = new Map<string, CatalogComponent>(model.components.map((c) => [c.dspackId, c]));
103
+ const topLevelIds = Object.keys(doc.components ?? {});
104
+ const name = (id: string) => byId.get(id)?.name ?? id;
105
+
106
+ const usedNames = new Set(topLevelIds.map((id) => name(id)));
107
+
108
+ const components = topLevelIds.map((id) => {
109
+ const entry = byId.get(id)!;
110
+ const contractProps = (doc.components?.[id]?.props ?? {}) as Record<string, DspackProp>;
111
+
112
+ const propMap: Record<string, unknown> = {};
113
+ for (const prop of entry.props) {
114
+ if (prop.synthesized) continue; // the model's universal text prop belongs to json-render, not here
115
+ const plan: Record<string, unknown> = { a2ui: prop.name, kind: prop.kind };
116
+ if (prop.kind === "enum") plan.targetEnum = prop.values;
117
+ const dflt = contractProps[prop.name]?.default;
118
+ if (typeof dflt === "string") plan.default = dflt;
119
+ if (prop.description) plan.description = prop.description;
120
+ propMap[prop.name] = plan;
121
+ }
122
+ for (const excluded of entry.excludedProps) {
123
+ notes.push({
124
+ target: `${id}.${excluded.name}`,
125
+ note: `prop not scaffolded (${excluded.reason}); map it via a structural slot, or declare the component a casualty if it cannot be represented.`,
126
+ });
127
+ }
128
+
129
+ const required = Object.entries(contractProps)
130
+ .filter(([, p]) => p.required === true)
131
+ .map(([propName]) => propName)
132
+ .filter((propName) => propName in propMap);
133
+
134
+ const plan: Record<string, unknown> = {
135
+ a2ui: entry.name,
136
+ dspackId: id,
137
+ commons: ["ComponentCommon"],
138
+ structural: {},
139
+ required,
140
+ };
141
+ if (Object.keys(propMap).length > 0) plan.propMap = propMap;
142
+ else
143
+ notes.push({
144
+ target: id,
145
+ note: "no declarative props were scaffolded; the contract likely needs prop enrichment before this mapping is useful.",
146
+ });
147
+
148
+ const subs = subsOf(doc, id);
149
+ if (subs.length > 0) {
150
+ const transparent = subs.filter((s) => s.acceptsChildren !== "text").map((s) => s.id);
151
+ const asText = Object.fromEntries(subs.filter((s) => s.acceptsChildren === "text").map((s) => [s.id, "body"]));
152
+ plan.structural = {
153
+ child: {
154
+ schema: COMP_ID,
155
+ description: "The ID of the single child component. Wrap multiple elements in a Column and pass its ID.",
156
+ synthNote:
157
+ "Scaffolded: the compound's sub-components flatten (subFlatten) and collapse to a single, possibly Column-wrapped, child slot.",
158
+ },
159
+ };
160
+ (plan.required as string[]).push("child");
161
+ plan.surfacePlan = { childProp: "child", subFlatten: { transparent, asText } };
162
+ plan.subCoverage = Object.fromEntries(
163
+ subs.map((s) => [
164
+ s.id,
165
+ s.acceptsChildren === "text"
166
+ ? "text -> synthesized Text (variant body) [scaffolded from acceptsChildren: text — review]"
167
+ : "transparent grouping: children splice inline, in order [scaffolded — review]",
168
+ ]),
169
+ );
170
+ notes.push({
171
+ target: id,
172
+ note: `compound scaffolded from declared acceptsChildren (${subs.length} sub-components: ${transparent.length} transparent, ${Object.keys(asText).length} asText); review each subCoverage line and pick text variants.`,
173
+ });
174
+ }
175
+
176
+ return plan;
177
+ });
178
+
179
+ const synthesized: Record<string, unknown>[] = [];
180
+ for (const primitive of [TEXT_PLAN, COLUMN_PLAN]) {
181
+ if (usedNames.has(primitive.a2ui)) {
182
+ notes.push({
183
+ target: primitive.a2ui,
184
+ note: `contract already has a component named '${primitive.a2ui}'; the synthesized primitive was skipped — verify surfaceSynthesis points at a component with the expected '${primitive.a2ui === "Text" ? "text" : "children"}' prop.`,
185
+ });
186
+ } else {
187
+ synthesized.push(structuredClone(primitive) as Record<string, unknown>);
188
+ }
189
+ }
190
+
191
+ let primaryColorToken = options.primaryColorToken;
192
+ if (!primaryColorToken) {
193
+ const hasColorPrimary = Boolean((doc.tokens as Record<string, { values?: Record<string, unknown> }> | undefined)?.color?.values?.primary);
194
+ primaryColorToken = { category: "color", name: "primary" };
195
+ notes.push({
196
+ target: "primaryColorToken",
197
+ note: hasColorPrimary
198
+ ? "auto-detected color.primary; verify it is the intended theme primary."
199
+ : "defaulted to color.primary, which this contract does not define — theme.primaryColor will emit null with a warning until you point this at a real token.",
200
+ });
201
+ }
202
+
203
+ const profile: Record<string, unknown> = {
204
+ profileVersion: "1",
205
+ catalogTitle: options.catalogTitle ?? `${doc.name} — A2UI catalog (compiled from dspack)`,
206
+ catalogDescription:
207
+ options.catalogDescription ??
208
+ `A2UI catalog compiled from the ${doc.name} dspack contract by scaffoldProfile. Mechanical 1:1 draft: review the scaffold notes before trusting any mapping.`,
209
+ catalogIdBase: options.catalogIdBase,
210
+ instructions: options.instructions ?? "For layout, use the Column component to organize other components.",
211
+ primaryColorToken,
212
+ components,
213
+ synthesized,
214
+ casualtyComponents: [],
215
+ surfaceSynthesis: {
216
+ textComponent: "Text",
217
+ textProp: "text",
218
+ wrapComponent: "Column",
219
+ wrapChildrenProp: "children",
220
+ },
221
+ };
222
+
223
+ notes.push({
224
+ target: "casualtyComponents",
225
+ note: "scaffolds never declare casualties; components that cannot be represented must be moved here by the author, with a reason.",
226
+ });
227
+
228
+ return { profile, notes };
229
+ }