@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.
Files changed (77) hide show
  1. package/ARCHITECTURE.md +4 -4
  2. package/CHANGELOG.md +11 -11
  3. package/package.json +1 -1
  4. package/src/adoption/plan.js +2 -2
  5. package/src/agent-ops/query-builders.js +42 -33
  6. package/src/cli.js +174 -129
  7. package/src/generator/adapters.d.ts +1 -0
  8. package/src/generator/adapters.js +64 -39
  9. package/src/generator/check.js +19 -12
  10. package/src/generator/context/diff.js +9 -9
  11. package/src/generator/context/domain-coverage.js +11 -10
  12. package/src/generator/context/domain-page.js +6 -6
  13. package/src/generator/context/shared.js +37 -21
  14. package/src/generator/context/slice.js +70 -65
  15. package/src/generator/index.js +12 -12
  16. package/src/generator/output.js +21 -20
  17. package/src/generator/registry.js +71 -49
  18. package/src/generator/runtime/app-bundle.js +15 -15
  19. package/src/generator/runtime/compile-check.js +7 -7
  20. package/src/generator/runtime/deployment.js +9 -9
  21. package/src/generator/runtime/environment.js +39 -39
  22. package/src/generator/runtime/runtime-check.js +5 -5
  23. package/src/generator/runtime/shared.js +40 -38
  24. package/src/generator/runtime/smoke.js +5 -5
  25. package/src/generator/surfaces/databases/contract.js +1 -1
  26. package/src/generator/surfaces/databases/lifecycle-shared.js +6 -5
  27. package/src/generator/surfaces/databases/postgres/drizzle.js +3 -2
  28. package/src/generator/surfaces/databases/postgres/prisma.js +3 -2
  29. package/src/generator/surfaces/databases/shared.js +3 -2
  30. package/src/generator/surfaces/databases/snapshot.js +1 -1
  31. package/src/generator/surfaces/databases/sqlite/prisma.js +3 -2
  32. package/src/generator/surfaces/native/swiftui-app.js +3 -3
  33. package/src/generator/surfaces/native/swiftui-templates/Package.swift.txt +1 -1
  34. package/src/generator/surfaces/native/swiftui-templates/README.generated.md +3 -3
  35. package/src/generator/surfaces/native/swiftui-templates/runtime/DynamicScreens.swift +3 -3
  36. package/src/generator/surfaces/services/persistence-wiring.js +3 -2
  37. package/src/generator/surfaces/services/server-contract.js +4 -4
  38. package/src/generator/surfaces/shared.js +2 -2
  39. package/src/generator/surfaces/web/design-intent.js +1 -1
  40. package/src/generator/surfaces/web/index.js +7 -7
  41. package/src/generator/surfaces/web/{react-components.js → react-widgets.js} +53 -53
  42. package/src/generator/surfaces/web/react.js +36 -36
  43. package/src/generator/surfaces/web/{sveltekit-components.js → sveltekit-widgets.js} +53 -53
  44. package/src/generator/surfaces/web/sveltekit.js +34 -34
  45. package/src/generator/surfaces/web/{ui-web-contract.js → ui-surface-contract.js} +8 -8
  46. package/src/generator/surfaces/web/vanilla.js +6 -6
  47. package/src/generator/{component-conformance.js → widget-conformance.js} +129 -128
  48. package/src/generator/widgets.js +40 -0
  49. package/src/generator-policy.js +10 -12
  50. package/src/import/core/runner.js +34 -34
  51. package/src/import/core/shared.js +1 -1
  52. package/src/import/extractors/ui/android-compose.js +1 -1
  53. package/src/import/extractors/ui/blazor.js +1 -1
  54. package/src/import/extractors/ui/razor-pages.js +1 -1
  55. package/src/import/extractors/ui/react-router.js +4 -4
  56. package/src/import/extractors/ui/sveltekit.js +4 -4
  57. package/src/import/extractors/ui/swiftui.js +1 -1
  58. package/src/import/extractors/ui/uikit.js +1 -1
  59. package/src/new-project.js +19 -18
  60. package/src/project-config.js +104 -44
  61. package/src/proofs/contract-audit.js +1 -1
  62. package/src/proofs/ios-parity.js +1 -1
  63. package/src/proofs/issues-parity.js +1 -1
  64. package/src/realization/backend/build-backend-runtime-realization.js +2 -2
  65. package/src/realization/ui/build-ui-shared-realization.js +33 -33
  66. package/src/realization/ui/build-web-realization.js +23 -20
  67. package/src/reconcile/journeys.js +1 -1
  68. package/src/resolver/index.js +148 -65
  69. package/src/validator/index.js +509 -423
  70. package/src/validator/kinds.js +36 -36
  71. package/src/validator/per-kind/{component.js → widget.js} +47 -47
  72. package/src/{component-behavior.js → widget-behavior.js} +3 -3
  73. package/src/workflows.js +39 -38
  74. package/template-helpers/react.js +4 -4
  75. package/template-helpers/sveltekit.js +4 -4
  76. package/src/generator/components.js +0 -39
  77. /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
- relatedProjectionsForComponent,
17
+ relatedProjectionsForWidget,
20
18
  relatedProjectionsForDomain,
21
19
  relatedProjectionsForEntity,
22
20
  relatedRulesForDomain,
23
21
  relatedRulesForTarget,
24
- relatedShapesForComponent,
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 components = relatedComponentsForProjection(graph, projection);
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, ...components]);
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
- components,
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
- components: summarizeStatementsByIds(graph, components),
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, ...components], {
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 componentSlice(graph, componentId) {
250
- const component = componentById(graph, componentId);
251
- if (!component) {
252
- throw new Error(`No component found with id '${componentId}'`);
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 = componentDependencyIdsByKind(component);
255
- const shapes = relatedShapesForComponent(component);
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 = relatedProjectionsForComponent(graph, componentId);
259
- const componentDependencies = dependencyIds.component;
260
- const verificationScope = [componentId, ...shapes, ...entities, ...capabilities, ...projections, ...componentDependencies];
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: "component",
268
- id: componentId
267
+ kind: "widget",
268
+ id: widgetId
269
269
  },
270
- summary: summarizeById(graph, componentId),
270
+ summary: summarizeById(graph, widgetId),
271
271
  depends_on: {
272
272
  shapes,
273
273
  entities,
274
274
  capabilities,
275
- components: componentDependencies,
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
- components: summarizeStatementsByIds(graph, componentDependencies),
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: "Component changes affect every related projection verification should follow the component contract closure."
288
+ rationale: "Widget changes affect every related projection, so verification should follow the widget contract closure."
289
289
  }),
290
- ui_agent_packet: uiAgentPacketForComponent(graph, component, projections),
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: ["component_surface"]
294
+ reasons: ["widget_surface"]
295
295
  },
296
296
  ownership_boundary: defaultOwnershipBoundary()
297
297
  };
298
298
  }
299
299
 
300
- function componentDependencyIdsByKind(component) {
300
+ function widgetDependencyIdsByKind(widget) {
301
301
  const ids = {
302
302
  shape: [],
303
303
  entity: [],
304
304
  capability: [],
305
305
  projection: [],
306
- component: []
306
+ widget: []
307
307
  };
308
308
 
309
- for (const dependency of component.dependencies || []) {
310
- const kind = componentDependencyKind(dependency);
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 componentDependencyKind(dependency) {
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
- if (!String(projection.platform || "").startsWith("ui_")) {
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 = projection.platform === "ui_shared"
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
- componentPlacement: "ui_shared",
349
- designIntent: "ui_shared",
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
- components: (ownerProjection.uiComponents || []).map((usage) => componentUsagePacket(usage)),
368
- design: designIntentPacket(ownerProjection),
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 uiAgentPacketForComponent(graph, component, projectionIds) {
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 !== component.id) continue;
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
- platform: projection.platform,
383
- ownership: projection.platform === "ui_shared" ? "owner" : "concrete"
387
+ type: projectionType,
388
+ ownership: projectionType === "ui_contract" ? "owner" : "concrete"
384
389
  },
385
- usage: componentUsagePacket(usage),
386
- design: designIntentPacket(projection)
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
- componentContract: "component",
397
- componentPlacement: "ui_shared",
401
+ widgetContract: "widget",
402
+ widgetPlacement: "ui_contract",
398
403
  concreteSurfacesInherit: true
399
404
  },
400
- component: {
401
- id: component.id,
402
- name: component.name || component.id,
403
- category: component.category || null,
404
- patterns: component.componentContract?.patterns || [],
405
- regions: component.componentContract?.regions || [],
406
- behaviors: component.componentContract?.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, component.id)
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 === "ui_shared") {
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 componentUsagePacket(usage) {
431
+ function widgetUsagePacket(usage) {
427
432
  return {
428
433
  screenId: usage.screenId || null,
429
434
  region: usage.region || null,
430
- componentId: usage.component?.id || null,
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, componentId = 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 component check${projectionId ? ` --projection ${projectionId}` : ""}${componentId ? ` --component ${componentId}` : ""}`,
456
- reason: "Validate component placement, props, events, regions, and patterns."
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 component behavior${projectionId ? ` --projection ${projectionId}` : ""}${componentId ? ` --component ${componentId}` : ""}`,
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 platform projections."
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 === "component") return componentSlice(graph, selection.id);
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);
@@ -11,11 +11,11 @@ import {
11
11
  generateOpenApi
12
12
  } from "./api.js";
13
13
  import { generateVerificationChecklist, generateVerificationPlan } from "./verification.js";
14
- import { generateUiComponentContract } from "./components.js";
14
+ import { generateUiWidgetContract } from "./widgets.js";
15
15
  import {
16
- generateComponentBehaviorReport,
17
- generateComponentConformanceReport
18
- } from "./component-conformance.js";
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-component-contract") {
77
- return okResult(target, generateUiComponentContract(graph, options));
76
+ if (target === "ui-widget-contract") {
77
+ return okResult(target, generateUiWidgetContract(graph, options));
78
78
  }
79
- if (target === "component-conformance-report") {
80
- return okResult(target, generateComponentConformanceReport(graph, options));
79
+ if (target === "widget-conformance-report") {
80
+ return okResult(target, generateWidgetConformanceReport(graph, options));
81
81
  }
82
- if (target === "component-behavior-report") {
83
- return okResult(target, generateComponentBehaviorReport(graph, options));
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-web-contract" ||
105
- target === "ui-web-debug" ||
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" ||
@@ -81,54 +81,55 @@ export function buildOutputFiles(result, options = {}) {
81
81
  }));
82
82
  }
83
83
 
84
- if (result.target === "ui-component-contract") {
84
+ if (result.target === "ui-widget-contract") {
85
85
  if (result.artifact == null) {
86
- throw new Error("ui-component-contract generator returned no artifact");
86
+ throw new Error("ui-widget-contract generator returned no artifact");
87
87
  }
88
- if (options.componentId) {
89
- return [{ path: `${options.componentId}.ui-component-contract.json`, contents: result.artifact }];
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((componentId) => ({
92
- path: `${componentId}.ui-component-contract.json`,
93
- contents: result.artifact[componentId]
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 === "component-conformance-report") {
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}.component-conformance-report.json`
102
- : "component-conformance-report.json",
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 === "component-behavior-report") {
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}.component-behavior-report.json`
112
- : "component-behavior-report.json",
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-web-debug") {
118
+ if (result.target === "ui-surface-debug") {
118
119
  return [
119
120
  {
120
- path: options.projectionId ? `${options.projectionId}.ui-web-debug.md` : "ui-web-debug.md",
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-web-contract") {
127
+ if (result.target === "ui-surface-contract") {
127
128
  if (options.projectionId) {
128
- return [{ path: `${options.projectionId}.ui-web-contract.json`, contents: result.artifact }];
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-web-contract.json`,
132
+ path: `${projectionId}.ui-surface-contract.json`,
132
133
  contents: result.artifact[projectionId]
133
134
  }));
134
135
  }