@topogram/cli 0.3.51 → 0.3.53
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/ARCHITECTURE.md +4 -4
- package/CHANGELOG.md +11 -11
- package/package.json +1 -1
- package/src/adoption/plan.js +2 -2
- package/src/agent-ops/query-builders.js +42 -33
- package/src/cli.js +174 -129
- package/src/generator/adapters.d.ts +1 -0
- package/src/generator/adapters.js +64 -39
- package/src/generator/check.js +19 -12
- package/src/generator/context/diff.js +9 -9
- package/src/generator/context/domain-coverage.js +11 -10
- package/src/generator/context/domain-page.js +6 -6
- package/src/generator/context/shared.js +37 -21
- package/src/generator/context/slice.js +70 -65
- package/src/generator/index.js +12 -12
- package/src/generator/output.js +21 -20
- package/src/generator/registry.js +71 -49
- package/src/generator/runtime/app-bundle.js +15 -15
- package/src/generator/runtime/compile-check.js +7 -7
- package/src/generator/runtime/deployment.js +9 -9
- package/src/generator/runtime/environment.js +39 -39
- package/src/generator/runtime/runtime-check.js +5 -5
- package/src/generator/runtime/shared.js +40 -38
- package/src/generator/runtime/smoke.js +5 -5
- package/src/generator/surfaces/databases/contract.js +1 -1
- package/src/generator/surfaces/databases/lifecycle-shared.js +6 -5
- package/src/generator/surfaces/databases/postgres/drizzle.js +3 -2
- package/src/generator/surfaces/databases/postgres/prisma.js +3 -2
- package/src/generator/surfaces/databases/shared.js +3 -2
- package/src/generator/surfaces/databases/snapshot.js +1 -1
- package/src/generator/surfaces/databases/sqlite/prisma.js +3 -2
- package/src/generator/surfaces/native/swiftui-app.js +3 -3
- package/src/generator/surfaces/native/swiftui-templates/Package.swift.txt +1 -1
- package/src/generator/surfaces/native/swiftui-templates/README.generated.md +3 -3
- package/src/generator/surfaces/native/swiftui-templates/runtime/DynamicScreens.swift +3 -3
- package/src/generator/surfaces/services/persistence-wiring.js +3 -2
- package/src/generator/surfaces/services/server-contract.js +4 -4
- package/src/generator/surfaces/shared.js +2 -2
- package/src/generator/surfaces/web/design-intent.js +1 -1
- package/src/generator/surfaces/web/index.js +7 -7
- package/src/generator/surfaces/web/{react-components.js → react-widgets.js} +53 -53
- package/src/generator/surfaces/web/react.js +36 -36
- package/src/generator/surfaces/web/{sveltekit-components.js → sveltekit-widgets.js} +53 -53
- package/src/generator/surfaces/web/sveltekit.js +34 -34
- package/src/generator/surfaces/web/{ui-web-contract.js → ui-surface-contract.js} +8 -8
- package/src/generator/surfaces/web/vanilla.js +6 -6
- package/src/generator/{component-conformance.js → widget-conformance.js} +129 -128
- package/src/generator/widgets.js +40 -0
- package/src/generator-policy.js +10 -12
- package/src/import/core/runner.js +34 -34
- package/src/import/core/shared.js +1 -1
- package/src/import/extractors/ui/android-compose.js +1 -1
- package/src/import/extractors/ui/blazor.js +1 -1
- package/src/import/extractors/ui/razor-pages.js +1 -1
- package/src/import/extractors/ui/react-router.js +4 -4
- package/src/import/extractors/ui/sveltekit.js +4 -4
- package/src/import/extractors/ui/swiftui.js +1 -1
- package/src/import/extractors/ui/uikit.js +1 -1
- package/src/new-project.js +19 -18
- package/src/project-config.js +104 -44
- package/src/proofs/contract-audit.js +1 -1
- package/src/proofs/ios-parity.js +1 -1
- package/src/proofs/issues-parity.js +1 -1
- package/src/realization/backend/build-backend-runtime-realization.js +2 -2
- package/src/realization/ui/build-ui-shared-realization.js +33 -33
- package/src/realization/ui/build-web-realization.js +23 -20
- package/src/reconcile/journeys.js +1 -1
- package/src/resolver/index.js +148 -65
- package/src/validator/index.js +509 -423
- package/src/validator/kinds.js +36 -36
- package/src/validator/per-kind/{component.js → widget.js} +47 -47
- package/src/{component-behavior.js → widget-behavior.js} +3 -3
- package/src/workflows.js +39 -38
- package/template-helpers/react.js +4 -4
- package/template-helpers/sveltekit.js +4 -4
- package/src/generator/components.js +0 -39
- /package/src/resolver/enrich/{component.js → widget.js} +0 -0
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
acceptanceCriterionById,
|
|
3
3
|
bugById,
|
|
4
4
|
buildDefaultWriteScope,
|
|
5
|
-
componentById,
|
|
6
5
|
documentById,
|
|
7
6
|
domainById,
|
|
8
7
|
ensureContextSelection,
|
|
@@ -13,17 +12,17 @@ import {
|
|
|
13
12
|
relatedCapabilitiesForEntity,
|
|
14
13
|
relatedCapabilitiesForProjection,
|
|
15
14
|
relatedEntitiesForDomain,
|
|
16
|
-
relatedComponentsForProjection,
|
|
17
15
|
relatedJourneysForCapability,
|
|
18
16
|
relatedProjectionsForCapability,
|
|
19
|
-
|
|
17
|
+
relatedProjectionsForWidget,
|
|
20
18
|
relatedProjectionsForDomain,
|
|
21
19
|
relatedProjectionsForEntity,
|
|
22
20
|
relatedRulesForDomain,
|
|
23
21
|
relatedRulesForTarget,
|
|
24
|
-
|
|
22
|
+
relatedShapesForWidget,
|
|
25
23
|
relatedShapesForEntity,
|
|
26
24
|
relatedShapesForProjection,
|
|
25
|
+
relatedWidgetsForProjection,
|
|
27
26
|
relatedVerificationsForDomain,
|
|
28
27
|
relatedWorkflowDocsForCapability,
|
|
29
28
|
relatedEntitiesForProjection,
|
|
@@ -41,7 +40,8 @@ import {
|
|
|
41
40
|
summarizeStatementsByIds,
|
|
42
41
|
summarizeTask,
|
|
43
42
|
taskById,
|
|
44
|
-
verificationIdsForTarget
|
|
43
|
+
verificationIdsForTarget,
|
|
44
|
+
widgetById
|
|
45
45
|
} from "./shared.js";
|
|
46
46
|
import {
|
|
47
47
|
defaultOwnershipBoundary,
|
|
@@ -163,9 +163,9 @@ function projectionSlice(graph, projectionId) {
|
|
|
163
163
|
const capabilities = relatedCapabilitiesForProjection(projection);
|
|
164
164
|
const entities = relatedEntitiesForProjection(projection);
|
|
165
165
|
const shapes = relatedShapesForProjection(projection);
|
|
166
|
-
const
|
|
166
|
+
const widgets = relatedWidgetsForProjection(graph, projection);
|
|
167
167
|
const rules = [...new Set(capabilities.flatMap((capabilityId) => relatedRulesForTarget(graph, capabilityId)))].sort();
|
|
168
|
-
const verifications = verificationIdsForTarget(graph, [projectionId, ...capabilities, ...entities, ...shapes, ...
|
|
168
|
+
const verifications = verificationIdsForTarget(graph, [projectionId, ...capabilities, ...entities, ...shapes, ...widgets]);
|
|
169
169
|
|
|
170
170
|
return {
|
|
171
171
|
type: "context_slice",
|
|
@@ -179,7 +179,7 @@ function projectionSlice(graph, projectionId) {
|
|
|
179
179
|
entities,
|
|
180
180
|
shapes,
|
|
181
181
|
capabilities,
|
|
182
|
-
|
|
182
|
+
widgets,
|
|
183
183
|
rules,
|
|
184
184
|
verifications
|
|
185
185
|
},
|
|
@@ -187,11 +187,11 @@ function projectionSlice(graph, projectionId) {
|
|
|
187
187
|
entities: summarizeStatementsByIds(graph, entities),
|
|
188
188
|
shapes: summarizeStatementsByIds(graph, shapes),
|
|
189
189
|
capabilities: summarizeStatementsByIds(graph, capabilities),
|
|
190
|
-
|
|
190
|
+
widgets: summarizeStatementsByIds(graph, widgets),
|
|
191
191
|
rules: summarizeStatementsByIds(graph, rules)
|
|
192
192
|
},
|
|
193
193
|
verification: summarizeStatementsByIds(graph, verifications),
|
|
194
|
-
verification_targets: recommendedVerificationTargets(graph, [projectionId, ...capabilities, ...entities, ...shapes, ...
|
|
194
|
+
verification_targets: recommendedVerificationTargets(graph, [projectionId, ...capabilities, ...entities, ...shapes, ...widgets], {
|
|
195
195
|
rationale: "Projection slices affect generated contract and runtime surfaces, so verification should follow the projection closure."
|
|
196
196
|
}),
|
|
197
197
|
ui_agent_packet: uiAgentPacketForProjection(graph, projection),
|
|
@@ -246,33 +246,33 @@ function entitySlice(graph, entityId) {
|
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
function
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
252
|
-
throw new Error(`No
|
|
249
|
+
function widgetSlice(graph, widgetId) {
|
|
250
|
+
const widget = widgetById(graph, widgetId);
|
|
251
|
+
if (!widget) {
|
|
252
|
+
throw new Error(`No widget found with id '${widgetId}'`);
|
|
253
253
|
}
|
|
254
|
-
const dependencyIds =
|
|
255
|
-
const shapes =
|
|
254
|
+
const dependencyIds = widgetDependencyIdsByKind(widget);
|
|
255
|
+
const shapes = relatedShapesForWidget(widget);
|
|
256
256
|
const entities = dependencyIds.entity;
|
|
257
257
|
const capabilities = dependencyIds.capability;
|
|
258
|
-
const projections =
|
|
259
|
-
const
|
|
260
|
-
const verificationScope = [
|
|
258
|
+
const projections = relatedProjectionsForWidget(graph, widgetId);
|
|
259
|
+
const widgetDependencies = dependencyIds.widget;
|
|
260
|
+
const verificationScope = [widgetId, ...shapes, ...entities, ...capabilities, ...projections, ...widgetDependencies];
|
|
261
261
|
const verifications = verificationIdsForTarget(graph, verificationScope);
|
|
262
262
|
|
|
263
263
|
return {
|
|
264
264
|
type: "context_slice",
|
|
265
265
|
version: 1,
|
|
266
266
|
focus: {
|
|
267
|
-
kind: "
|
|
268
|
-
id:
|
|
267
|
+
kind: "widget",
|
|
268
|
+
id: widgetId
|
|
269
269
|
},
|
|
270
|
-
summary: summarizeById(graph,
|
|
270
|
+
summary: summarizeById(graph, widgetId),
|
|
271
271
|
depends_on: {
|
|
272
272
|
shapes,
|
|
273
273
|
entities,
|
|
274
274
|
capabilities,
|
|
275
|
-
|
|
275
|
+
widgets: widgetDependencies,
|
|
276
276
|
projections,
|
|
277
277
|
verifications
|
|
278
278
|
},
|
|
@@ -280,34 +280,34 @@ function componentSlice(graph, componentId) {
|
|
|
280
280
|
shapes: summarizeStatementsByIds(graph, shapes),
|
|
281
281
|
entities: summarizeStatementsByIds(graph, entities),
|
|
282
282
|
capabilities: summarizeStatementsByIds(graph, capabilities),
|
|
283
|
-
|
|
283
|
+
widgets: summarizeStatementsByIds(graph, widgetDependencies),
|
|
284
284
|
projections: summarizeStatementsByIds(graph, projections)
|
|
285
285
|
},
|
|
286
286
|
verification: summarizeStatementsByIds(graph, verifications),
|
|
287
287
|
verification_targets: recommendedVerificationTargets(graph, verificationScope, {
|
|
288
|
-
rationale: "
|
|
288
|
+
rationale: "Widget changes affect every related projection, so verification should follow the widget contract closure."
|
|
289
289
|
}),
|
|
290
|
-
ui_agent_packet:
|
|
290
|
+
ui_agent_packet: uiAgentPacketForWidget(graph, widget, projections),
|
|
291
291
|
write_scope: buildDefaultWriteScope(),
|
|
292
292
|
review_boundary: {
|
|
293
293
|
automation_class: "review_required",
|
|
294
|
-
reasons: ["
|
|
294
|
+
reasons: ["widget_surface"]
|
|
295
295
|
},
|
|
296
296
|
ownership_boundary: defaultOwnershipBoundary()
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
function
|
|
300
|
+
function widgetDependencyIdsByKind(widget) {
|
|
301
301
|
const ids = {
|
|
302
302
|
shape: [],
|
|
303
303
|
entity: [],
|
|
304
304
|
capability: [],
|
|
305
305
|
projection: [],
|
|
306
|
-
|
|
306
|
+
widget: []
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
for (const dependency of
|
|
310
|
-
const kind =
|
|
309
|
+
for (const dependency of widget.dependencies || []) {
|
|
310
|
+
const kind = widgetDependencyKind(dependency);
|
|
311
311
|
if (kind && Object.hasOwn(ids, kind)) {
|
|
312
312
|
ids[kind].push(dependency.id);
|
|
313
313
|
}
|
|
@@ -318,9 +318,9 @@ function componentDependencyIdsByKind(component) {
|
|
|
318
318
|
);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
function
|
|
321
|
+
function widgetDependencyKind(dependency) {
|
|
322
322
|
if (dependency?.target?.kind) {
|
|
323
|
-
return dependency.target.kind;
|
|
323
|
+
return dependency.target.kind === "component" ? "widget" : dependency.target.kind;
|
|
324
324
|
}
|
|
325
325
|
const id = String(dependency?.id || "");
|
|
326
326
|
const prefix = id.split("_")[0];
|
|
@@ -330,14 +330,18 @@ function componentDependencyKind(dependency) {
|
|
|
330
330
|
if (prefix === "cap") {
|
|
331
331
|
return "capability";
|
|
332
332
|
}
|
|
333
|
+
if (prefix === "component") {
|
|
334
|
+
return "widget";
|
|
335
|
+
}
|
|
333
336
|
return prefix || null;
|
|
334
337
|
}
|
|
335
338
|
|
|
336
339
|
function uiAgentPacketForProjection(graph, projection) {
|
|
337
|
-
|
|
340
|
+
const projectionType = projection.type || projection.platform || null;
|
|
341
|
+
if (projectionType !== "ui_contract" && !String(projectionType || "").endsWith("_surface")) {
|
|
338
342
|
return null;
|
|
339
343
|
}
|
|
340
|
-
const sharedProjection =
|
|
344
|
+
const sharedProjection = projectionType === "ui_contract"
|
|
341
345
|
? projection
|
|
342
346
|
: sharedUiProjectionFor(graph, projection);
|
|
343
347
|
const ownerProjection = sharedProjection || projection;
|
|
@@ -345,8 +349,8 @@ function uiAgentPacketForProjection(graph, projection) {
|
|
|
345
349
|
type: "ui_agent_packet",
|
|
346
350
|
version: 1,
|
|
347
351
|
ownership: {
|
|
348
|
-
|
|
349
|
-
designIntent: "
|
|
352
|
+
widgetPlacement: "ui_contract",
|
|
353
|
+
designIntent: "ui_contract",
|
|
350
354
|
concreteSurfaceOwns: ["routes", "surface_hints"]
|
|
351
355
|
},
|
|
352
356
|
sharedProjection: sharedProjection
|
|
@@ -364,26 +368,27 @@ function uiAgentPacketForProjection(graph, projection) {
|
|
|
364
368
|
screenId: route.screenId,
|
|
365
369
|
path: route.path
|
|
366
370
|
})),
|
|
367
|
-
|
|
368
|
-
|
|
371
|
+
widgets: (ownerProjection.uiComponents || []).map((usage) => widgetUsagePacket(usage)),
|
|
372
|
+
designTokens: designIntentPacket(ownerProjection),
|
|
369
373
|
requiredGates: uiRequiredGates(projection.id)
|
|
370
374
|
};
|
|
371
375
|
}
|
|
372
376
|
|
|
373
|
-
function
|
|
377
|
+
function uiAgentPacketForWidget(graph, widget, projectionIds) {
|
|
374
378
|
const projectionSet = new Set(projectionIds);
|
|
375
379
|
const sourceUsages = [];
|
|
376
380
|
for (const projection of graph.byKind.projection || []) {
|
|
377
381
|
for (const usage of projection.uiComponents || []) {
|
|
378
|
-
if (usage.component?.id !==
|
|
382
|
+
if (usage.component?.id !== widget.id) continue;
|
|
383
|
+
const projectionType = projection.type || projection.platform || null;
|
|
379
384
|
sourceUsages.push({
|
|
380
385
|
projection: {
|
|
381
386
|
id: projection.id,
|
|
382
|
-
|
|
383
|
-
ownership:
|
|
387
|
+
type: projectionType,
|
|
388
|
+
ownership: projectionType === "ui_contract" ? "owner" : "concrete"
|
|
384
389
|
},
|
|
385
|
-
usage:
|
|
386
|
-
|
|
390
|
+
usage: widgetUsagePacket(usage),
|
|
391
|
+
designTokens: designIntentPacket(projection)
|
|
387
392
|
});
|
|
388
393
|
projectionSet.add(projection.id);
|
|
389
394
|
}
|
|
@@ -393,41 +398,41 @@ function uiAgentPacketForComponent(graph, component, projectionIds) {
|
|
|
393
398
|
type: "ui_agent_packet",
|
|
394
399
|
version: 1,
|
|
395
400
|
ownership: {
|
|
396
|
-
|
|
397
|
-
|
|
401
|
+
widgetContract: "widget",
|
|
402
|
+
widgetPlacement: "ui_contract",
|
|
398
403
|
concreteSurfacesInherit: true
|
|
399
404
|
},
|
|
400
|
-
|
|
401
|
-
id:
|
|
402
|
-
name:
|
|
403
|
-
category:
|
|
404
|
-
patterns:
|
|
405
|
-
regions:
|
|
406
|
-
behaviors:
|
|
405
|
+
widget: {
|
|
406
|
+
id: widget.id,
|
|
407
|
+
name: widget.name || widget.id,
|
|
408
|
+
category: widget.category || null,
|
|
409
|
+
patterns: widget.widgetContract?.patterns || widget.componentContract?.patterns || [],
|
|
410
|
+
regions: widget.widgetContract?.regions || widget.componentContract?.regions || [],
|
|
411
|
+
behaviors: widget.widgetContract?.behaviors || widget.componentContract?.behaviors || []
|
|
407
412
|
},
|
|
408
413
|
sourceUsages,
|
|
409
414
|
inheritedBy: [...projectionSet]
|
|
410
415
|
.filter((projectionId) => !sourceUsages.some((entry) => entry.projection.id === projectionId))
|
|
411
416
|
.sort(),
|
|
412
|
-
requiredGates: uiRequiredGates(null,
|
|
417
|
+
requiredGates: uiRequiredGates(null, widget.id)
|
|
413
418
|
};
|
|
414
419
|
}
|
|
415
420
|
|
|
416
421
|
function sharedUiProjectionFor(graph, projection) {
|
|
417
422
|
for (const reference of projection.realizes || []) {
|
|
418
423
|
const candidate = (graph.byKind.projection || []).find((entry) => entry.id === reference.id);
|
|
419
|
-
if (candidate?.platform === "
|
|
424
|
+
if ((candidate?.type || candidate?.platform) === "ui_contract") {
|
|
420
425
|
return candidate;
|
|
421
426
|
}
|
|
422
427
|
}
|
|
423
428
|
return null;
|
|
424
429
|
}
|
|
425
430
|
|
|
426
|
-
function
|
|
431
|
+
function widgetUsagePacket(usage) {
|
|
427
432
|
return {
|
|
428
433
|
screenId: usage.screenId || null,
|
|
429
434
|
region: usage.region || null,
|
|
430
|
-
|
|
435
|
+
widgetId: usage.component?.id || null,
|
|
431
436
|
dataBindings: (usage.dataBindings || []).map((binding) => ({
|
|
432
437
|
prop: binding.prop || null,
|
|
433
438
|
source: binding.source?.id || binding.source || null
|
|
@@ -448,15 +453,15 @@ function designIntentPacket(projection) {
|
|
|
448
453
|
}));
|
|
449
454
|
}
|
|
450
455
|
|
|
451
|
-
function uiRequiredGates(projectionId = null,
|
|
456
|
+
function uiRequiredGates(projectionId = null, widgetId = null) {
|
|
452
457
|
return [
|
|
453
458
|
{ command: "topogram check", reason: "Validate shared UI ownership, taxonomy, references, and topology." },
|
|
454
459
|
{
|
|
455
|
-
command: `topogram
|
|
456
|
-
reason: "Validate
|
|
460
|
+
command: `topogram widget check${projectionId ? ` --projection ${projectionId}` : ""}${widgetId ? ` --widget ${widgetId}` : ""}`,
|
|
461
|
+
reason: "Validate widget placement, props, events, regions, and patterns."
|
|
457
462
|
},
|
|
458
463
|
{
|
|
459
|
-
command: `topogram
|
|
464
|
+
command: `topogram widget behavior${projectionId ? ` --projection ${projectionId}` : ""}${widgetId ? ` --widget ${widgetId}` : ""}`,
|
|
460
465
|
reason: "Inspect behavior realizations and partial bindings before code changes."
|
|
461
466
|
}
|
|
462
467
|
];
|
|
@@ -520,7 +525,7 @@ function domainSlice(graph, domainId) {
|
|
|
520
525
|
[domainId, ...capabilities, ...entities, ...projections],
|
|
521
526
|
{
|
|
522
527
|
rationale:
|
|
523
|
-
"Domain slices should re-run verification covering the domain's capabilities, entities, and
|
|
528
|
+
"Domain slices should re-run verification covering the domain's capabilities, entities, and projection types."
|
|
524
529
|
}
|
|
525
530
|
);
|
|
526
531
|
|
|
@@ -803,7 +808,7 @@ export function generateContextSlice(graph, options = {}) {
|
|
|
803
808
|
capabilityId: options.capabilityId,
|
|
804
809
|
workflowId: options.workflowId,
|
|
805
810
|
projectionId: options.projectionId,
|
|
806
|
-
componentId: options.componentId,
|
|
811
|
+
componentId: options.widgetId || options.componentId,
|
|
807
812
|
entityId: options.entityId,
|
|
808
813
|
journeyId: options.journeyId,
|
|
809
814
|
surfaceId: options.surfaceId,
|
|
@@ -819,7 +824,7 @@ export function generateContextSlice(graph, options = {}) {
|
|
|
819
824
|
if (selection.kind === "capability") return capabilitySlice(graph, selection.id);
|
|
820
825
|
if (selection.kind === "workflow") return workflowSlice(graph, selection.id);
|
|
821
826
|
if (selection.kind === "projection") return projectionSlice(graph, selection.id);
|
|
822
|
-
if (selection.kind === "
|
|
827
|
+
if (selection.kind === "widget") return widgetSlice(graph, selection.id);
|
|
823
828
|
if (selection.kind === "entity") return entitySlice(graph, selection.id);
|
|
824
829
|
if (selection.kind === "journey") return journeySlice(graph, selection.id);
|
|
825
830
|
if (selection.kind === "domain") return domainSlice(graph, selection.id);
|
package/src/generator/index.js
CHANGED
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
generateOpenApi
|
|
12
12
|
} from "./api.js";
|
|
13
13
|
import { generateVerificationChecklist, generateVerificationPlan } from "./verification.js";
|
|
14
|
-
import {
|
|
14
|
+
import { generateUiWidgetContract } from "./widgets.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "./
|
|
16
|
+
generateWidgetBehaviorReport,
|
|
17
|
+
generateWidgetConformanceReport
|
|
18
|
+
} from "./widget-conformance.js";
|
|
19
19
|
import { generateDbTarget } from "./surfaces/databases/index.js";
|
|
20
20
|
import { generateAppTarget } from "./surfaces/index.js";
|
|
21
21
|
import { generateRuntimeTarget } from "./runtime/index.js";
|
|
@@ -73,14 +73,14 @@ export function generateWorkspace(workspaceAst, options = {}) {
|
|
|
73
73
|
if (target === "verification-checklist") {
|
|
74
74
|
return okResult(target, generateVerificationChecklist(graph, options));
|
|
75
75
|
}
|
|
76
|
-
if (target === "ui-
|
|
77
|
-
return okResult(target,
|
|
76
|
+
if (target === "ui-widget-contract") {
|
|
77
|
+
return okResult(target, generateUiWidgetContract(graph, options));
|
|
78
78
|
}
|
|
79
|
-
if (target === "
|
|
80
|
-
return okResult(target,
|
|
79
|
+
if (target === "widget-conformance-report") {
|
|
80
|
+
return okResult(target, generateWidgetConformanceReport(graph, options));
|
|
81
81
|
}
|
|
82
|
-
if (target === "
|
|
83
|
-
return okResult(target,
|
|
82
|
+
if (target === "widget-behavior-report") {
|
|
83
|
+
return okResult(target, generateWidgetBehaviorReport(graph, options));
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (
|
|
@@ -101,8 +101,8 @@ export function generateWorkspace(workspaceAst, options = {}) {
|
|
|
101
101
|
if (
|
|
102
102
|
target === "ui-contract-graph" ||
|
|
103
103
|
target === "ui-contract-debug" ||
|
|
104
|
-
target === "ui-
|
|
105
|
-
target === "ui-
|
|
104
|
+
target === "ui-surface-contract" ||
|
|
105
|
+
target === "ui-surface-debug" ||
|
|
106
106
|
target === "sveltekit-app" ||
|
|
107
107
|
target === "server-contract" ||
|
|
108
108
|
target === "persistence-scaffold" ||
|
package/src/generator/output.js
CHANGED
|
@@ -81,54 +81,55 @@ export function buildOutputFiles(result, options = {}) {
|
|
|
81
81
|
}));
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
if (result.target === "ui-
|
|
84
|
+
if (result.target === "ui-widget-contract") {
|
|
85
85
|
if (result.artifact == null) {
|
|
86
|
-
throw new Error("ui-
|
|
86
|
+
throw new Error("ui-widget-contract generator returned no artifact");
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const widgetId = options.widgetId || options.componentId;
|
|
89
|
+
if (widgetId) {
|
|
90
|
+
return [{ path: `${widgetId}.ui-widget-contract.json`, contents: result.artifact }];
|
|
90
91
|
}
|
|
91
|
-
return Object.keys(result.artifact).sort().map((
|
|
92
|
-
path: `${
|
|
93
|
-
contents: result.artifact[
|
|
92
|
+
return Object.keys(result.artifact).sort().map((id) => ({
|
|
93
|
+
path: `${id}.ui-widget-contract.json`,
|
|
94
|
+
contents: result.artifact[id]
|
|
94
95
|
}));
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
if (result.target === "
|
|
98
|
-
const suffix = [options.projectionId, options.componentId].filter(Boolean).join(".");
|
|
98
|
+
if (result.target === "widget-conformance-report") {
|
|
99
|
+
const suffix = [options.projectionId, options.widgetId || options.componentId].filter(Boolean).join(".");
|
|
99
100
|
return [{
|
|
100
101
|
path: suffix
|
|
101
|
-
? `${suffix}.
|
|
102
|
-
: "
|
|
102
|
+
? `${suffix}.widget-conformance-report.json`
|
|
103
|
+
: "widget-conformance-report.json",
|
|
103
104
|
contents: result.artifact
|
|
104
105
|
}];
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
if (result.target === "
|
|
108
|
-
const suffix = [options.projectionId, options.componentId].filter(Boolean).join(".");
|
|
108
|
+
if (result.target === "widget-behavior-report") {
|
|
109
|
+
const suffix = [options.projectionId, options.widgetId || options.componentId].filter(Boolean).join(".");
|
|
109
110
|
return [{
|
|
110
111
|
path: suffix
|
|
111
|
-
? `${suffix}.
|
|
112
|
-
: "
|
|
112
|
+
? `${suffix}.widget-behavior-report.json`
|
|
113
|
+
: "widget-behavior-report.json",
|
|
113
114
|
contents: result.artifact
|
|
114
115
|
}];
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
if (result.target === "ui-
|
|
118
|
+
if (result.target === "ui-surface-debug") {
|
|
118
119
|
return [
|
|
119
120
|
{
|
|
120
|
-
path: options.projectionId ? `${options.projectionId}.ui-
|
|
121
|
+
path: options.projectionId ? `${options.projectionId}.ui-surface-debug.md` : "ui-surface-debug.md",
|
|
121
122
|
contents: result.artifact
|
|
122
123
|
}
|
|
123
124
|
];
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
if (result.target === "ui-
|
|
127
|
+
if (result.target === "ui-surface-contract") {
|
|
127
128
|
if (options.projectionId) {
|
|
128
|
-
return [{ path: `${options.projectionId}.ui-
|
|
129
|
+
return [{ path: `${options.projectionId}.ui-surface-contract.json`, contents: result.artifact }];
|
|
129
130
|
}
|
|
130
131
|
return Object.keys(result.artifact).sort().map((projectionId) => ({
|
|
131
|
-
path: `${projectionId}.ui-
|
|
132
|
+
path: `${projectionId}.ui-surface-contract.json`,
|
|
132
133
|
contents: result.artifact[projectionId]
|
|
133
134
|
}));
|
|
134
135
|
}
|