@topogram/cli 0.3.64 → 0.3.65

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 (245) hide show
  1. package/package.json +1 -1
  2. package/src/adoption/plan/index.js +703 -0
  3. package/src/adoption/plan.js +12 -703
  4. package/src/agent-ops/query-builders/auth.js +375 -0
  5. package/src/agent-ops/query-builders/change-risk/change-plan.js +123 -0
  6. package/src/agent-ops/query-builders/change-risk/import-plan.js +49 -0
  7. package/src/agent-ops/query-builders/change-risk/maintained.js +286 -0
  8. package/src/agent-ops/query-builders/change-risk/review-packets.js +123 -0
  9. package/src/agent-ops/query-builders/change-risk/risk.js +189 -0
  10. package/src/agent-ops/query-builders/change-risk.js +25 -0
  11. package/src/agent-ops/query-builders/common.js +149 -0
  12. package/src/agent-ops/query-builders/maintained-risk.js +539 -0
  13. package/src/agent-ops/query-builders/maintained-shared.js +120 -0
  14. package/src/agent-ops/query-builders/multi-agent.js +547 -0
  15. package/src/agent-ops/query-builders/projection-impacts.js +514 -0
  16. package/src/agent-ops/query-builders/work-packets.js +417 -0
  17. package/src/agent-ops/query-builders/workflow-context-shared.js +300 -0
  18. package/src/agent-ops/query-builders/workflow-context.js +398 -0
  19. package/src/agent-ops/query-builders/workflow-presets-core.js +676 -0
  20. package/src/agent-ops/query-builders/workflow-presets.js +341 -0
  21. package/src/agent-ops/query-builders.d.ts +26 -26
  22. package/src/agent-ops/query-builders.js +42 -5021
  23. package/src/catalog/constants.js +10 -0
  24. package/src/catalog/copy.js +60 -0
  25. package/src/catalog/diagnostics.js +15 -0
  26. package/src/catalog/entries.js +42 -0
  27. package/src/catalog/files.js +67 -0
  28. package/src/catalog/provenance.js +122 -0
  29. package/src/catalog/source.js +150 -0
  30. package/src/catalog/validation.js +252 -0
  31. package/src/catalog.d.ts +2 -0
  32. package/src/catalog.js +18 -746
  33. package/src/cli/commands/catalog/check.js +31 -0
  34. package/src/cli/commands/catalog/copy.js +59 -0
  35. package/src/cli/commands/catalog/doctor.js +248 -0
  36. package/src/cli/commands/catalog/help.js +21 -0
  37. package/src/cli/commands/catalog/list.js +52 -0
  38. package/src/cli/commands/catalog/runner.js +92 -0
  39. package/src/cli/commands/catalog/shared.js +17 -0
  40. package/src/cli/commands/catalog/show.js +134 -0
  41. package/src/cli/commands/catalog.js +30 -615
  42. package/src/cli/commands/generator-policy/package-info.js +162 -0
  43. package/src/cli/commands/generator-policy/payloads.js +372 -0
  44. package/src/cli/commands/generator-policy/printers.js +159 -0
  45. package/src/cli/commands/generator-policy/runner.js +81 -0
  46. package/src/cli/commands/generator-policy/shared.js +39 -0
  47. package/src/cli/commands/generator-policy.js +15 -783
  48. package/src/cli/commands/import/adopt.js +170 -0
  49. package/src/cli/commands/import/check.js +91 -0
  50. package/src/cli/commands/import/diff.js +84 -0
  51. package/src/cli/commands/import/help.js +47 -0
  52. package/src/cli/commands/import/paths.js +277 -0
  53. package/src/cli/commands/import/plan.js +284 -0
  54. package/src/cli/commands/import/refresh.js +470 -0
  55. package/src/cli/commands/import/status-history.js +196 -0
  56. package/src/cli/commands/import/workspace.js +230 -0
  57. package/src/cli/commands/import.js +33 -1732
  58. package/src/cli/commands/package/constants.js +17 -0
  59. package/src/cli/commands/package/doctor.js +240 -0
  60. package/src/cli/commands/package/help.js +27 -0
  61. package/src/cli/commands/package/lockfile.js +135 -0
  62. package/src/cli/commands/package/npm.js +97 -0
  63. package/src/cli/commands/package/reporting.js +35 -0
  64. package/src/cli/commands/package/runner.js +33 -0
  65. package/src/cli/commands/package/shared.js +9 -0
  66. package/src/cli/commands/package/update-cli.js +252 -0
  67. package/src/cli/commands/package/versions.js +35 -0
  68. package/src/cli/commands/package.js +29 -813
  69. package/src/cli/commands/query/change-plan.js +68 -0
  70. package/src/cli/commands/query/definitions.js +202 -0
  71. package/src/cli/commands/query/import-adopt.js +121 -0
  72. package/src/cli/commands/query/runner/artifacts.js +102 -0
  73. package/src/cli/commands/query/runner/boundaries.js +211 -0
  74. package/src/cli/commands/query/runner/change.js +182 -0
  75. package/src/cli/commands/query/runner/import-adopt.js +111 -0
  76. package/src/cli/commands/query/runner/index.js +31 -0
  77. package/src/cli/commands/query/runner/output.js +12 -0
  78. package/src/cli/commands/query/runner/workflow.js +241 -0
  79. package/src/cli/commands/query/runner.js +3 -0
  80. package/src/cli/commands/query/workflow-context.js +5 -0
  81. package/src/cli/commands/query/workspace.js +274 -0
  82. package/src/cli/commands/query.js +9 -1300
  83. package/src/cli/commands/template/baseline.js +100 -0
  84. package/src/cli/commands/template/check.js +466 -0
  85. package/src/cli/commands/template/constants.js +8 -0
  86. package/src/cli/commands/template/diagnostics.js +26 -0
  87. package/src/cli/commands/template/help.js +28 -0
  88. package/src/cli/commands/template/lifecycle.js +404 -0
  89. package/src/cli/commands/template/list-show.js +287 -0
  90. package/src/cli/commands/template/policy.js +422 -0
  91. package/src/cli/commands/template/shared.js +127 -0
  92. package/src/cli/commands/template/updates.js +352 -0
  93. package/src/cli/commands/template.js +41 -2143
  94. package/src/generator/api/contracts.js +497 -0
  95. package/src/generator/api/metadata.js +221 -0
  96. package/src/generator/api/openapi.js +559 -0
  97. package/src/generator/api/schema.js +124 -0
  98. package/src/generator/api/types.d.ts +98 -0
  99. package/src/generator/api.js +3 -1195
  100. package/src/generator/context/shared/domain-sdlc.js +282 -0
  101. package/src/generator/context/shared/maintained-boundary.js +665 -0
  102. package/src/generator/context/shared/metrics.js +85 -0
  103. package/src/generator/context/shared/primitives.js +64 -0
  104. package/src/generator/context/shared/relationships.js +453 -0
  105. package/src/generator/context/shared/summaries.js +263 -0
  106. package/src/generator/context/shared/types.d.ts +207 -0
  107. package/src/generator/context/shared.d.ts +42 -0
  108. package/src/generator/context/shared.js +80 -1390
  109. package/src/generator/context/slice/core.js +397 -0
  110. package/src/generator/context/slice/sdlc.js +417 -0
  111. package/src/generator/context/slice/ui-packets.js +183 -0
  112. package/src/generator/context/slice.js +2 -859
  113. package/src/generator/registry/index.js +507 -0
  114. package/src/generator/registry.js +18 -504
  115. package/src/generator/runtime/environment/index.js +666 -0
  116. package/src/generator/runtime/environment.js +4 -666
  117. package/src/generator/runtime/runtime-check/index.js +554 -0
  118. package/src/generator/runtime/runtime-check.js +4 -554
  119. package/src/generator/runtime/shared/index.js +572 -0
  120. package/src/generator/runtime/shared.js +19 -570
  121. package/src/generator/shared.d.ts +2 -0
  122. package/src/generator/surfaces/shared.d.ts +3 -0
  123. package/src/generator/widget-conformance/behavior-report.js +258 -0
  124. package/src/generator/widget-conformance/checks.js +371 -0
  125. package/src/generator/widget-conformance/projection-context.js +200 -0
  126. package/src/generator/widget-conformance/report.js +166 -0
  127. package/src/generator/widget-conformance/types.d.ts +121 -0
  128. package/src/generator/widget-conformance.js +3 -824
  129. package/src/import/core/context.d.ts +3 -0
  130. package/src/import/core/contracts.d.ts +1 -0
  131. package/src/import/core/registry.d.ts +4 -0
  132. package/src/import/core/runner/candidates.js +217 -0
  133. package/src/import/core/runner/options.js +22 -0
  134. package/src/import/core/runner/reports.js +50 -0
  135. package/src/import/core/runner/run.js +79 -0
  136. package/src/import/core/runner/tracks.js +150 -0
  137. package/src/import/core/runner/ui-drafts.js +337 -0
  138. package/src/import/core/runner.js +3 -698
  139. package/src/import/core/shared/api-routes.js +221 -0
  140. package/src/import/core/shared/candidates.js +97 -0
  141. package/src/import/core/shared/files.js +177 -0
  142. package/src/import/core/shared/next-app.js +389 -0
  143. package/src/import/core/shared/types.d.ts +51 -0
  144. package/src/import/core/shared/ui-routes.js +230 -0
  145. package/src/import/core/shared.js +60 -861
  146. package/src/new-project/constants.js +128 -0
  147. package/src/new-project/create.js +83 -0
  148. package/src/new-project/json.js +28 -0
  149. package/src/new-project/metadata.js +96 -0
  150. package/src/new-project/package-spec.js +161 -0
  151. package/src/new-project/project-files.js +348 -0
  152. package/src/new-project/template-policy.js +269 -0
  153. package/src/new-project/template-resolution.js +368 -0
  154. package/src/new-project/template-snapshots.js +430 -0
  155. package/src/new-project/template-updates.js +512 -0
  156. package/src/new-project/types.d.ts +83 -0
  157. package/src/new-project.js +6 -2277
  158. package/src/parser.d.ts +87 -1
  159. package/src/parser.js +118 -0
  160. package/src/policy/review-boundaries.d.ts +15 -0
  161. package/src/project-config/index.js +564 -0
  162. package/src/project-config.js +19 -561
  163. package/src/resolver/enrich/acceptance-criterion.js +2 -0
  164. package/src/resolver/enrich/bug.js +2 -0
  165. package/src/resolver/enrich/pitch.js +2 -0
  166. package/src/resolver/enrich/requirement.js +2 -0
  167. package/src/resolver/enrich/task.js +2 -0
  168. package/src/resolver/index.js +19 -2089
  169. package/src/resolver/normalize.js +384 -1
  170. package/src/resolver/plans.js +168 -0
  171. package/src/resolver/projections-api.js +494 -0
  172. package/src/resolver/projections-db.js +133 -0
  173. package/src/resolver/projections-ui.js +317 -0
  174. package/src/resolver/shapes.js +251 -0
  175. package/src/resolver/shared.js +278 -0
  176. package/src/resolver/widgets.js +132 -0
  177. package/src/template-trust/constants.js +62 -0
  178. package/src/template-trust/content.js +258 -0
  179. package/src/template-trust/diff.js +92 -0
  180. package/src/template-trust/policy.js +61 -0
  181. package/src/template-trust/record.js +90 -0
  182. package/src/template-trust/status.js +182 -0
  183. package/src/template-trust.js +24 -687
  184. package/src/text-helpers.d.ts +1 -0
  185. package/src/topogram-types.d.ts +69 -0
  186. package/src/validator/common.js +488 -0
  187. package/src/validator/data-model.js +237 -0
  188. package/src/validator/docs.js +167 -0
  189. package/src/validator/expressions.js +146 -1
  190. package/src/validator/index.d.ts +23 -0
  191. package/src/validator/index.js +32 -3585
  192. package/src/validator/kinds.d.ts +41 -0
  193. package/src/validator/kinds.js +2 -0
  194. package/src/validator/model-helpers.js +46 -0
  195. package/src/validator/per-kind/acceptance-criterion.js +5 -0
  196. package/src/validator/per-kind/bug.js +6 -0
  197. package/src/validator/per-kind/domain.js +15 -2
  198. package/src/validator/per-kind/pitch.js +7 -0
  199. package/src/validator/per-kind/requirement.js +5 -0
  200. package/src/validator/per-kind/task.js +7 -0
  201. package/src/validator/per-kind/widget.js +14 -0
  202. package/src/validator/projections/api-http-async.js +410 -0
  203. package/src/validator/projections/api-http-authz.js +88 -0
  204. package/src/validator/projections/api-http-core.js +205 -0
  205. package/src/validator/projections/api-http-policies.js +339 -0
  206. package/src/validator/projections/api-http-responses.js +233 -0
  207. package/src/validator/projections/api-http.js +44 -0
  208. package/src/validator/projections/db.js +353 -0
  209. package/src/validator/projections/generator-defaults.js +45 -0
  210. package/src/validator/projections/helpers.js +87 -0
  211. package/src/validator/projections/ui-helpers.js +214 -0
  212. package/src/validator/projections/ui-navigation.js +344 -0
  213. package/src/validator/projections/ui-structure.js +364 -0
  214. package/src/validator/projections/ui-widgets.js +493 -0
  215. package/src/validator/projections/ui.js +46 -0
  216. package/src/validator/registry.js +48 -1
  217. package/src/validator/utils.d.ts +20 -0
  218. package/src/validator/utils.js +115 -12
  219. package/src/widget-behavior.d.ts +1 -0
  220. package/src/workflows/import-app/api/collect.js +221 -0
  221. package/src/workflows/import-app/api/openapi.js +257 -0
  222. package/src/workflows/import-app/api/routes.js +327 -0
  223. package/src/workflows/import-app/api/sources.js +22 -0
  224. package/src/workflows/import-app/api.js +2 -797
  225. package/src/workflows/reconcile/adoption-plan/build.js +208 -0
  226. package/src/workflows/reconcile/adoption-plan/dependencies.js +75 -0
  227. package/src/workflows/reconcile/adoption-plan/outputs.js +143 -0
  228. package/src/workflows/reconcile/adoption-plan/paths.js +58 -0
  229. package/src/workflows/reconcile/adoption-plan/projection-patches.js +177 -0
  230. package/src/workflows/reconcile/adoption-plan/reasons.js +107 -0
  231. package/src/workflows/reconcile/adoption-plan.js +30 -740
  232. package/src/workflows/reconcile/auth/closures.js +115 -0
  233. package/src/workflows/reconcile/auth/formatters.js +142 -0
  234. package/src/workflows/reconcile/auth/inference.js +330 -0
  235. package/src/workflows/reconcile/auth/roles.js +122 -0
  236. package/src/workflows/reconcile/auth.js +35 -690
  237. package/src/workflows/reconcile/bundle-core/index.js +600 -0
  238. package/src/workflows/reconcile/bundle-core.js +12 -598
  239. package/src/workflows/reconcile/canonical-surface.js +1 -1
  240. package/src/workflows/reconcile/impacts/adoption-plan.js +192 -0
  241. package/src/workflows/reconcile/impacts/indexes.js +101 -0
  242. package/src/workflows/reconcile/impacts/patches.js +252 -0
  243. package/src/workflows/reconcile/impacts/reports.js +80 -0
  244. package/src/workflows/reconcile/impacts.js +14 -623
  245. package/src/workspace-docs.d.ts +29 -0
@@ -1,860 +1,3 @@
1
- import {
2
- acceptanceCriterionById,
3
- bugById,
4
- buildDefaultWriteScope,
5
- documentById,
6
- domainById,
7
- ensureContextSelection,
8
- getJourneyDoc,
9
- getStatement,
10
- getWorkflowDoc,
11
- pitchById,
12
- relatedCapabilitiesForEntity,
13
- relatedCapabilitiesForProjection,
14
- relatedEntitiesForDomain,
15
- relatedJourneysForCapability,
16
- relatedProjectionsForCapability,
17
- relatedProjectionsForWidget,
18
- relatedProjectionsForDomain,
19
- relatedProjectionsForEntity,
20
- relatedRulesForDomain,
21
- relatedRulesForTarget,
22
- relatedShapesForWidget,
23
- relatedShapesForEntity,
24
- relatedShapesForProjection,
25
- relatedWidgetsForProjection,
26
- relatedVerificationsForDomain,
27
- relatedWorkflowDocsForCapability,
28
- relatedEntitiesForProjection,
29
- recommendedVerificationTargets,
30
- requirementById,
31
- summarizeAcceptanceCriterion,
32
- summarizeBug,
33
- summarizeById,
34
- summarizeDocsByIds,
35
- summarizeDocument,
36
- summarizeDomain,
37
- summarizePitch,
38
- summarizeProjection,
39
- summarizeRequirement,
40
- summarizeStatementsByIds,
41
- summarizeTask,
42
- taskById,
43
- verificationIdsForTarget,
44
- widgetById
45
- } from "./shared.js";
46
- import {
47
- defaultOwnershipBoundary,
48
- reviewBoundaryForAcceptanceCriterion,
49
- reviewBoundaryForBug,
50
- reviewBoundaryForCapability,
51
- reviewBoundaryForDocument,
52
- reviewBoundaryForDomain,
53
- reviewBoundaryForEntity,
54
- reviewBoundaryForJourneyDoc,
55
- reviewBoundaryForPitch,
56
- reviewBoundaryForRequirement,
57
- reviewBoundaryForTask,
58
- reviewBoundaryForWorkflowDoc
59
- } from "../../policy/review-boundaries.js";
1
+ // @ts-check
60
2
 
61
- function capabilitySlice(graph, capabilityId) {
62
- const capability = getStatement(graph, "capability", capabilityId);
63
- const shapes = [...new Set([...(capability.input || []).map((item) => item.id), ...(capability.output || []).map((item) => item.id)])].sort();
64
- const entities = [...new Set([
65
- ...(capability.reads || []).map((item) => item.id),
66
- ...(capability.creates || []).map((item) => item.id),
67
- ...(capability.updates || []).map((item) => item.id),
68
- ...(capability.deletes || []).map((item) => item.id)
69
- ])].sort();
70
- const rules = relatedRulesForTarget(graph, capabilityId);
71
- const workflows = relatedWorkflowDocsForCapability(graph, capabilityId).map((doc) => doc.id).sort();
72
- const projections = relatedProjectionsForCapability(graph, capabilityId);
73
- const journeys = relatedJourneysForCapability(graph, capabilityId).map((doc) => doc.id).sort();
74
- const verifications = verificationIdsForTarget(graph, [capabilityId, ...projections, ...shapes, ...entities]);
75
-
76
- return {
77
- type: "context_slice",
78
- version: 1,
79
- focus: {
80
- kind: "capability",
81
- id: capabilityId
82
- },
83
- summary: summarizeById(graph, capabilityId),
84
- depends_on: {
85
- shapes,
86
- entities,
87
- rules,
88
- workflows,
89
- projections,
90
- journeys,
91
- verifications
92
- },
93
- related: {
94
- shapes: summarizeStatementsByIds(graph, shapes),
95
- entities: summarizeStatementsByIds(graph, entities),
96
- rules: summarizeStatementsByIds(graph, rules),
97
- workflows: summarizeDocsByIds(graph, workflows),
98
- journeys: summarizeDocsByIds(graph, journeys),
99
- projections: summarizeStatementsByIds(graph, projections)
100
- },
101
- verification: summarizeStatementsByIds(graph, verifications),
102
- verification_targets: recommendedVerificationTargets(graph, [capabilityId, ...projections, ...shapes, ...entities], {
103
- rationale: "Capability slice should point agents at the smallest verification set covering affected API/UI/DB surfaces."
104
- }),
105
- write_scope: buildDefaultWriteScope(),
106
- review_boundary: reviewBoundaryForCapability(capability),
107
- ownership_boundary: defaultOwnershipBoundary()
108
- };
109
- }
110
-
111
- function workflowSlice(graph, workflowId) {
112
- const workflow = getWorkflowDoc(graph, workflowId);
113
- const capabilities = [...(workflow.relatedCapabilities || [])].sort();
114
- const entities = [...new Set(capabilities.flatMap((capabilityId) => {
115
- const capability = getStatement(graph, "capability", capabilityId);
116
- return [
117
- ...(capability.reads || []).map((item) => item.id),
118
- ...(capability.creates || []).map((item) => item.id),
119
- ...(capability.updates || []).map((item) => item.id),
120
- ...(capability.deletes || []).map((item) => item.id)
121
- ];
122
- }))].sort();
123
- const rules = [...new Set(capabilities.flatMap((capabilityId) => relatedRulesForTarget(graph, capabilityId)))].sort();
124
- const journeys = (graph.docs || [])
125
- .filter((doc) => doc.kind === "journey" && (doc.relatedWorkflows || []).includes(workflowId))
126
- .map((doc) => doc.id)
127
- .sort();
128
- const verifications = verificationIdsForTarget(graph, [...capabilities, ...entities, workflowId]);
129
-
130
- return {
131
- type: "context_slice",
132
- version: 1,
133
- focus: {
134
- kind: "workflow",
135
- id: workflowId
136
- },
137
- summary: summarizeById(graph, workflowId),
138
- depends_on: {
139
- capabilities,
140
- entities,
141
- rules,
142
- journeys,
143
- verifications
144
- },
145
- related: {
146
- capabilities: summarizeStatementsByIds(graph, capabilities),
147
- entities: summarizeStatementsByIds(graph, entities),
148
- rules: summarizeStatementsByIds(graph, rules),
149
- journeys: summarizeDocsByIds(graph, journeys)
150
- },
151
- verification: summarizeStatementsByIds(graph, verifications),
152
- verification_targets: recommendedVerificationTargets(graph, [...capabilities, ...entities, workflowId], {
153
- rationale: "Workflow changes should re-run workflow-linked verification and human review on semantic behavior."
154
- }),
155
- write_scope: buildDefaultWriteScope(),
156
- review_boundary: reviewBoundaryForWorkflowDoc(workflow),
157
- ownership_boundary: defaultOwnershipBoundary()
158
- };
159
- }
160
-
161
- function projectionSlice(graph, projectionId) {
162
- const projection = getStatement(graph, "projection", projectionId);
163
- const capabilities = relatedCapabilitiesForProjection(projection);
164
- const entities = relatedEntitiesForProjection(projection);
165
- const shapes = relatedShapesForProjection(projection);
166
- const widgets = relatedWidgetsForProjection(graph, projection);
167
- const rules = [...new Set(capabilities.flatMap((capabilityId) => relatedRulesForTarget(graph, capabilityId)))].sort();
168
- const verifications = verificationIdsForTarget(graph, [projectionId, ...capabilities, ...entities, ...shapes, ...widgets]);
169
-
170
- return {
171
- type: "context_slice",
172
- version: 1,
173
- focus: {
174
- kind: "projection",
175
- id: projectionId
176
- },
177
- summary: summarizeProjection(projection),
178
- depends_on: {
179
- entities,
180
- shapes,
181
- capabilities,
182
- widgets,
183
- rules,
184
- verifications
185
- },
186
- related: {
187
- entities: summarizeStatementsByIds(graph, entities),
188
- shapes: summarizeStatementsByIds(graph, shapes),
189
- capabilities: summarizeStatementsByIds(graph, capabilities),
190
- widgets: summarizeStatementsByIds(graph, widgets),
191
- rules: summarizeStatementsByIds(graph, rules)
192
- },
193
- verification: summarizeStatementsByIds(graph, verifications),
194
- verification_targets: recommendedVerificationTargets(graph, [projectionId, ...capabilities, ...entities, ...shapes, ...widgets], {
195
- rationale: "Projection slices affect generated contract and runtime surfaces, so verification should follow the projection closure."
196
- }),
197
- ui_agent_packet: uiAgentPacketForProjection(graph, projection),
198
- write_scope: buildDefaultWriteScope(),
199
- review_boundary: projection.reviewBoundary || {
200
- automation_class: "review_required",
201
- reasons: ["projection_surface"]
202
- },
203
- ownership_boundary: defaultOwnershipBoundary()
204
- };
205
- }
206
-
207
- function entitySlice(graph, entityId) {
208
- const entity = getStatement(graph, "entity", entityId);
209
- const shapes = relatedShapesForEntity(graph, entityId);
210
- const capabilities = relatedCapabilitiesForEntity(graph, entityId);
211
- const rules = [...new Set([
212
- ...relatedRulesForTarget(graph, entityId),
213
- ...capabilities.flatMap((capabilityId) => relatedRulesForTarget(graph, capabilityId))
214
- ])].sort();
215
- const projections = relatedProjectionsForEntity(graph, entityId);
216
- const verifications = verificationIdsForTarget(graph, [entityId, ...shapes, ...capabilities, ...projections]);
217
-
218
- return {
219
- type: "context_slice",
220
- version: 1,
221
- focus: {
222
- kind: "entity",
223
- id: entityId
224
- },
225
- summary: summarizeById(graph, entityId),
226
- depends_on: {
227
- shapes,
228
- capabilities,
229
- rules,
230
- projections,
231
- verifications
232
- },
233
- related: {
234
- shapes: summarizeStatementsByIds(graph, shapes),
235
- capabilities: summarizeStatementsByIds(graph, capabilities),
236
- rules: summarizeStatementsByIds(graph, rules),
237
- projections: summarizeStatementsByIds(graph, projections)
238
- },
239
- verification: summarizeStatementsByIds(graph, verifications),
240
- verification_targets: recommendedVerificationTargets(graph, [entityId, ...shapes, ...capabilities, ...projections], {
241
- rationale: "Entity changes usually affect schema, projection, and capability semantics together."
242
- }),
243
- write_scope: buildDefaultWriteScope(),
244
- review_boundary: reviewBoundaryForEntity(entity),
245
- ownership_boundary: defaultOwnershipBoundary()
246
- };
247
- }
248
-
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
- }
254
- const dependencyIds = widgetDependencyIdsByKind(widget);
255
- const shapes = relatedShapesForWidget(widget);
256
- const entities = dependencyIds.entity;
257
- const capabilities = dependencyIds.capability;
258
- const projections = relatedProjectionsForWidget(graph, widgetId);
259
- const widgetDependencies = dependencyIds.widget;
260
- const verificationScope = [widgetId, ...shapes, ...entities, ...capabilities, ...projections, ...widgetDependencies];
261
- const verifications = verificationIdsForTarget(graph, verificationScope);
262
-
263
- return {
264
- type: "context_slice",
265
- version: 1,
266
- focus: {
267
- kind: "widget",
268
- id: widgetId
269
- },
270
- summary: summarizeById(graph, widgetId),
271
- depends_on: {
272
- shapes,
273
- entities,
274
- capabilities,
275
- widgets: widgetDependencies,
276
- projections,
277
- verifications
278
- },
279
- related: {
280
- shapes: summarizeStatementsByIds(graph, shapes),
281
- entities: summarizeStatementsByIds(graph, entities),
282
- capabilities: summarizeStatementsByIds(graph, capabilities),
283
- widgets: summarizeStatementsByIds(graph, widgetDependencies),
284
- projections: summarizeStatementsByIds(graph, projections)
285
- },
286
- verification: summarizeStatementsByIds(graph, verifications),
287
- verification_targets: recommendedVerificationTargets(graph, verificationScope, {
288
- rationale: "Widget changes affect every related projection, so verification should follow the widget contract closure."
289
- }),
290
- ui_agent_packet: uiAgentPacketForWidget(graph, widget, projections),
291
- write_scope: buildDefaultWriteScope(),
292
- review_boundary: {
293
- automation_class: "review_required",
294
- reasons: ["widget_surface"]
295
- },
296
- ownership_boundary: defaultOwnershipBoundary()
297
- };
298
- }
299
-
300
- function widgetDependencyIdsByKind(widget) {
301
- const ids = {
302
- shape: [],
303
- entity: [],
304
- capability: [],
305
- projection: [],
306
- widget: []
307
- };
308
-
309
- for (const dependency of widget.dependencies || []) {
310
- const kind = widgetDependencyKind(dependency);
311
- if (kind && Object.hasOwn(ids, kind)) {
312
- ids[kind].push(dependency.id);
313
- }
314
- }
315
-
316
- return Object.fromEntries(
317
- Object.entries(ids).map(([kind, values]) => [kind, [...new Set(values.filter(Boolean))].sort()])
318
- );
319
- }
320
-
321
- function widgetDependencyKind(dependency) {
322
- if (dependency?.target?.kind) {
323
- return dependency.target.kind === "component" ? "widget" : dependency.target.kind;
324
- }
325
- const id = String(dependency?.id || "");
326
- const prefix = id.split("_")[0];
327
- if (prefix === "proj") {
328
- return "projection";
329
- }
330
- if (prefix === "cap") {
331
- return "capability";
332
- }
333
- if (prefix === "component") {
334
- return "widget";
335
- }
336
- return prefix || null;
337
- }
338
-
339
- function uiAgentPacketForProjection(graph, projection) {
340
- const projectionType = projection.type || projection.type || null;
341
- if (projectionType !== "ui_contract" && !String(projectionType || "").endsWith("_surface")) {
342
- return null;
343
- }
344
- const sharedProjection = projectionType === "ui_contract"
345
- ? projection
346
- : sharedUiProjectionFor(graph, projection);
347
- const ownerProjection = sharedProjection || projection;
348
- return {
349
- type: "ui_agent_packet",
350
- version: 1,
351
- ownership: {
352
- widgetPlacement: "ui_contract",
353
- designIntent: "ui_contract",
354
- concreteSurfaceOwns: ["routes", "surface_hints"]
355
- },
356
- sharedProjection: sharedProjection
357
- ? {
358
- id: sharedProjection.id,
359
- name: sharedProjection.name || sharedProjection.id
360
- }
361
- : null,
362
- screens: (ownerProjection.uiScreens || []).map((screen) => ({
363
- id: screen.id,
364
- kind: screen.kind,
365
- title: screen.title || screen.id
366
- })),
367
- routes: (projection.uiRoutes || []).map((route) => ({
368
- screenId: route.screenId,
369
- path: route.path
370
- })),
371
- widgets: (ownerProjection.widgetBindings || []).map((usage) => widgetUsagePacket(usage, ownerProjection)),
372
- designTokens: designIntentPacket(ownerProjection),
373
- requiredGates: uiRequiredGates(projection.id)
374
- };
375
- }
376
-
377
- function uiAgentPacketForWidget(graph, widget, projectionIds) {
378
- const projectionSet = new Set(projectionIds);
379
- const sourceUsages = [];
380
- for (const projection of graph.byKind.projection || []) {
381
- for (const usage of projection.widgetBindings || []) {
382
- if (usage.widget?.id !== widget.id) continue;
383
- const projectionType = projection.type || projection.type || null;
384
- sourceUsages.push({
385
- projection: {
386
- id: projection.id,
387
- type: projectionType,
388
- ownership: projectionType === "ui_contract" ? "owner" : "concrete"
389
- },
390
- usage: widgetUsagePacket(usage, projection),
391
- designTokens: designIntentPacket(projection)
392
- });
393
- projectionSet.add(projection.id);
394
- }
395
- }
396
-
397
- return {
398
- type: "ui_agent_packet",
399
- version: 1,
400
- ownership: {
401
- widgetContract: "widget",
402
- widgetPlacement: "ui_contract",
403
- concreteSurfacesInherit: true
404
- },
405
- widget: {
406
- id: widget.id,
407
- name: widget.name || widget.id,
408
- category: widget.category || null,
409
- patterns: widget.widgetContract?.patterns || [],
410
- regions: widget.widgetContract?.regions || [],
411
- behaviors: widget.widgetContract?.behaviors || []
412
- },
413
- sourceUsages,
414
- inheritedBy: [...projectionSet]
415
- .filter((projectionId) => !sourceUsages.some((entry) => entry.projection.id === projectionId))
416
- .sort(),
417
- requiredGates: uiRequiredGates(null, widget.id)
418
- };
419
- }
420
-
421
- function sharedUiProjectionFor(graph, projection) {
422
- for (const reference of projection.realizes || []) {
423
- const candidate = (graph.byKind.projection || []).find((entry) => entry.id === reference.id);
424
- if ((candidate?.type || candidate?.type) === "ui_contract") {
425
- return candidate;
426
- }
427
- }
428
- return null;
429
- }
430
-
431
- function widgetUsagePacket(usage, projection = null) {
432
- const screen = (projection?.uiScreens || []).find((entry) => entry.id === usage.screenId) || null;
433
- const region = (projection?.uiScreenRegions || []).find((entry) =>
434
- entry.screenId === usage.screenId && entry.region === usage.region
435
- ) || null;
436
- return {
437
- screenId: usage.screenId || null,
438
- screen: screen
439
- ? {
440
- id: screen.id,
441
- kind: screen.kind || null,
442
- title: screen.title || screen.id
443
- }
444
- : null,
445
- region: usage.region || null,
446
- regionContract: region
447
- ? {
448
- name: region.region || null,
449
- pattern: region.pattern || null,
450
- placement: region.placement || null,
451
- title: region.title || null,
452
- state: region.state || null,
453
- variant: region.variant || null
454
- }
455
- : null,
456
- widgetId: usage.widget?.id || null,
457
- dataBindings: (usage.dataBindings || []).map((binding) => ({
458
- prop: binding.prop || null,
459
- source: binding.source?.id || binding.source || null
460
- })),
461
- eventBindings: (usage.eventBindings || []).map((binding) => ({
462
- event: binding.event || null,
463
- action: binding.action || null,
464
- target: binding.target?.id || binding.target || null
465
- }))
466
- };
467
- }
468
-
469
- function designIntentPacket(projection) {
470
- return (projection.uiDesign || []).map((entry) => ({
471
- key: entry.key,
472
- role: entry.role,
473
- value: entry.value
474
- }));
475
- }
476
-
477
- function uiRequiredGates(projectionId = null, widgetId = null) {
478
- return [
479
- { command: "topogram check", reason: "Validate shared UI ownership, taxonomy, references, and topology." },
480
- {
481
- command: `topogram widget check${projectionId ? ` --projection ${projectionId}` : ""}${widgetId ? ` --widget ${widgetId}` : ""}`,
482
- reason: "Validate widget placement, props, events, regions, and patterns."
483
- },
484
- {
485
- command: `topogram widget behavior${projectionId ? ` --projection ${projectionId}` : ""}${widgetId ? ` --widget ${widgetId}` : ""}`,
486
- reason: "Inspect behavior realizations and partial bindings before code changes."
487
- }
488
- ];
489
- }
490
-
491
- function journeySlice(graph, journeyId) {
492
- const journey = getJourneyDoc(graph, journeyId);
493
- const capabilities = [...(journey.relatedCapabilities || [])].sort();
494
- const workflows = [...(journey.relatedWorkflows || [])].sort();
495
- const projections = [...(journey.relatedProjections || [])].sort();
496
- const verifications = verificationIdsForTarget(graph, [...capabilities, ...workflows, ...projections, journeyId]);
497
-
498
- return {
499
- type: "context_slice",
500
- version: 1,
501
- focus: {
502
- kind: "journey",
503
- id: journeyId
504
- },
505
- summary: summarizeById(graph, journeyId),
506
- depends_on: {
507
- capabilities,
508
- workflows,
509
- projections,
510
- verifications
511
- },
512
- related: {
513
- capabilities: summarizeStatementsByIds(graph, capabilities),
514
- workflows: summarizeDocsByIds(graph, workflows),
515
- projections: summarizeStatementsByIds(graph, projections)
516
- },
517
- verification: summarizeStatementsByIds(graph, verifications),
518
- verification_targets: recommendedVerificationTargets(graph, [...capabilities, ...workflows, ...projections, journeyId], {
519
- rationale: "Journey slices should target workflow-facing verification rather than a full workspace rerun."
520
- }),
521
- write_scope: buildDefaultWriteScope(),
522
- review_boundary: reviewBoundaryForJourneyDoc(journey),
523
- ownership_boundary: defaultOwnershipBoundary()
524
- };
525
- }
526
-
527
- function domainSlice(graph, domainId) {
528
- const domain = domainById(graph, domainId);
529
- if (!domain) {
530
- throw new Error(`No domain found with id '${domainId}'`);
531
- }
532
- const capabilities = [...(domain.members?.capabilities || [])].sort();
533
- const entities = relatedEntitiesForDomain(graph, domainId);
534
- const rules = relatedRulesForDomain(graph, domainId);
535
- const verifications = relatedVerificationsForDomain(graph, domainId);
536
- const orchestrations = [...(domain.members?.orchestrations || [])].sort();
537
- const operations = [...(domain.members?.operations || [])].sort();
538
- const decisions = [...(domain.members?.decisions || [])].sort();
539
- const projections = relatedProjectionsForDomain(graph, domainId);
540
-
541
- // Verification targets cover the union of capability/entity/projection IDs in
542
- // the domain so a domain-scoped change re-runs the right verification set
543
- // without pulling in the whole workspace.
544
- const verificationTargets = recommendedVerificationTargets(
545
- graph,
546
- [domainId, ...capabilities, ...entities, ...projections],
547
- {
548
- rationale:
549
- "Domain slices should re-run verification covering the domain's capabilities, entities, and projection types."
550
- }
551
- );
552
-
553
- return {
554
- type: "context_slice",
555
- version: 1,
556
- focus: {
557
- kind: "domain",
558
- id: domainId
559
- },
560
- summary: summarizeDomain(domain),
561
- depends_on: {
562
- capabilities,
563
- entities,
564
- rules,
565
- verifications,
566
- orchestrations,
567
- operations,
568
- decisions,
569
- projections
570
- },
571
- related: {
572
- capabilities: summarizeStatementsByIds(graph, capabilities),
573
- entities: summarizeStatementsByIds(graph, entities),
574
- rules: summarizeStatementsByIds(graph, rules),
575
- orchestrations: summarizeStatementsByIds(graph, orchestrations),
576
- operations: summarizeStatementsByIds(graph, operations),
577
- decisions: summarizeStatementsByIds(graph, decisions),
578
- projections: summarizeStatementsByIds(graph, projections)
579
- },
580
- verification: summarizeStatementsByIds(graph, verifications),
581
- verification_targets: verificationTargets,
582
- write_scope: buildDefaultWriteScope(),
583
- review_boundary: reviewBoundaryForDomain(),
584
- ownership_boundary: defaultOwnershipBoundary()
585
- };
586
- }
587
-
588
- // Phase 2 — SDLC slices.
589
- //
590
- // SDLC slices follow the same shape as feature slices: focus + summary +
591
- // depends_on + related + verification + write_scope + review_boundary. They
592
- // give an agent a single payload covering an artifact's chain (pitch →
593
- // requirement → AC → task → bug → verification → document) without
594
- // re-walking the graph.
595
-
596
- function pitchSlice(graph, pitchId) {
597
- const pitch = pitchById(graph, pitchId);
598
- if (!pitch) throw new Error(`No pitch found with id '${pitchId}'`);
599
-
600
- const requirements = (pitch.requirements || []).slice().sort();
601
- const decisions = [
602
- ...(pitch.decisions || []).map((d) => (typeof d === "string" ? d : d?.id)).filter(Boolean),
603
- ...(pitch.decisionsFromPitch || [])
604
- ];
605
- const decisionIds = [...new Set(decisions)].sort();
606
- const affects = (pitch.affects || []).map((a) => (typeof a === "string" ? a : a?.id)).filter(Boolean).sort();
607
- const verifications = verificationIdsForTarget(graph, [pitchId, ...affects]);
608
-
609
- return {
610
- type: "context_slice",
611
- version: 1,
612
- focus: { kind: "pitch", id: pitchId },
613
- summary: summarizePitch(pitch),
614
- depends_on: {
615
- requirements,
616
- decisions: decisionIds,
617
- affects,
618
- verifications
619
- },
620
- related: {
621
- requirements: summarizeStatementsByIds(graph, requirements),
622
- decisions: summarizeStatementsByIds(graph, decisionIds),
623
- affects: summarizeStatementsByIds(graph, affects)
624
- },
625
- verification: summarizeStatementsByIds(graph, verifications),
626
- verification_targets: recommendedVerificationTargets(graph, [pitchId, ...affects], {
627
- rationale: "Pitch slice covers verification touching any of its affected surfaces."
628
- }),
629
- write_scope: buildDefaultWriteScope(),
630
- review_boundary: reviewBoundaryForPitch(),
631
- ownership_boundary: defaultOwnershipBoundary()
632
- };
633
- }
634
-
635
- function requirementSlice(graph, requirementId) {
636
- const req = requirementById(graph, requirementId);
637
- if (!req) throw new Error(`No requirement found with id '${requirementId}'`);
638
-
639
- const acceptance = (req.acceptanceCriteria || []).slice().sort();
640
- const tasks = (req.tasks || []).slice().sort();
641
- const documents = (req.documents || []).slice().sort();
642
- const rules = (req.rules || []).slice().sort();
643
- const introducesRules = (req.introducesRules || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
644
- const respectsRules = (req.respectsRules || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
645
- const affects = (req.affects || []).map((a) => (typeof a === "string" ? a : a?.id)).filter(Boolean).sort();
646
- const verifications = verificationIdsForTarget(graph, [requirementId, ...affects, ...acceptance]);
647
-
648
- return {
649
- type: "context_slice",
650
- version: 1,
651
- focus: { kind: "requirement", id: requirementId },
652
- summary: summarizeRequirement(req),
653
- depends_on: {
654
- pitch: req.pitch?.id || null,
655
- acceptance_criteria: acceptance,
656
- tasks,
657
- documents,
658
- rules,
659
- introduces_rules: introducesRules,
660
- respects_rules: respectsRules,
661
- affects,
662
- verifications
663
- },
664
- related: {
665
- acceptance_criteria: summarizeStatementsByIds(graph, acceptance),
666
- tasks: summarizeStatementsByIds(graph, tasks),
667
- rules: summarizeStatementsByIds(graph, [...rules, ...introducesRules, ...respectsRules]),
668
- affects: summarizeStatementsByIds(graph, affects),
669
- documents: summarizeDocsByIds(graph, documents)
670
- },
671
- verification: summarizeStatementsByIds(graph, verifications),
672
- verification_targets: recommendedVerificationTargets(graph, [requirementId, ...affects, ...acceptance], {
673
- rationale: "Requirement slice covers verification tied to its acceptance criteria and affected surfaces."
674
- }),
675
- write_scope: buildDefaultWriteScope(),
676
- review_boundary: reviewBoundaryForRequirement(),
677
- ownership_boundary: defaultOwnershipBoundary()
678
- };
679
- }
680
-
681
- function acceptanceCriterionSlice(graph, acId) {
682
- const ac = acceptanceCriterionById(graph, acId);
683
- if (!ac) throw new Error(`No acceptance_criterion found with id '${acId}'`);
684
-
685
- const tasks = (ac.tasks || []).slice().sort();
686
- const verifications = (ac.verifications || []).slice().sort();
687
- const requirementId = ac.requirement?.id || null;
688
-
689
- return {
690
- type: "context_slice",
691
- version: 1,
692
- focus: { kind: "acceptance_criterion", id: acId },
693
- summary: summarizeAcceptanceCriterion(ac),
694
- depends_on: {
695
- requirement: requirementId,
696
- tasks,
697
- verifications
698
- },
699
- related: {
700
- tasks: summarizeStatementsByIds(graph, tasks),
701
- requirement: requirementId ? summarizeStatementsByIds(graph, [requirementId]) : []
702
- },
703
- verification: summarizeStatementsByIds(graph, verifications),
704
- verification_targets: recommendedVerificationTargets(graph, [acId, ...(requirementId ? [requirementId] : [])], {
705
- rationale: "AC slice points at verification proving this acceptance criterion."
706
- }),
707
- write_scope: buildDefaultWriteScope(),
708
- review_boundary: reviewBoundaryForAcceptanceCriterion(),
709
- ownership_boundary: defaultOwnershipBoundary()
710
- };
711
- }
712
-
713
- function taskSlice(graph, taskId) {
714
- const task = taskById(graph, taskId);
715
- if (!task) throw new Error(`No task found with id '${taskId}'`);
716
-
717
- const satisfies = (task.satisfies || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
718
- const acRefs = (task.acceptanceRefs || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
719
- const blockedBy = (task.blockedBy || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
720
- const blocks = (task.blocks || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
721
- const affects = (task.affects || []).map((a) => (typeof a === "string" ? a : a?.id)).filter(Boolean).sort();
722
- const verifications = verificationIdsForTarget(graph, [taskId, ...affects, ...acRefs]);
723
-
724
- return {
725
- type: "context_slice",
726
- version: 1,
727
- focus: { kind: "task", id: taskId },
728
- summary: summarizeTask(task),
729
- depends_on: {
730
- satisfies,
731
- acceptance_refs: acRefs,
732
- blocked_by: blockedBy,
733
- blocks,
734
- affects,
735
- verifications
736
- },
737
- related: {
738
- satisfies: summarizeStatementsByIds(graph, satisfies),
739
- acceptance_refs: summarizeStatementsByIds(graph, acRefs),
740
- blocked_by: summarizeStatementsByIds(graph, blockedBy),
741
- affects: summarizeStatementsByIds(graph, affects)
742
- },
743
- verification: summarizeStatementsByIds(graph, verifications),
744
- verification_targets: recommendedVerificationTargets(graph, [taskId, ...affects, ...acRefs], {
745
- rationale: "Task slice points at verification covering the surfaces this task touches."
746
- }),
747
- write_scope: buildDefaultWriteScope(),
748
- review_boundary: reviewBoundaryForTask(),
749
- ownership_boundary: defaultOwnershipBoundary()
750
- };
751
- }
752
-
753
- function bugSlice(graph, bugId) {
754
- const bug = bugById(graph, bugId);
755
- if (!bug) throw new Error(`No bug found with id '${bugId}'`);
756
-
757
- const violates = (bug.violates || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
758
- const surfacesRule = (bug.surfacesRule || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
759
- const fixedIn = (bug.fixedIn || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
760
- const fixedInVerification = (bug.fixedInVerification || []).map((r) => (typeof r === "string" ? r : r?.id)).filter(Boolean).sort();
761
- const verifiedBy = (bug.verifiedBy || []).slice().sort();
762
- const affects = (bug.affects || []).map((a) => (typeof a === "string" ? a : a?.id)).filter(Boolean).sort();
763
- const verifications = [...new Set([...fixedInVerification, ...verifiedBy, ...verificationIdsForTarget(graph, [bugId, ...affects])])].sort();
764
-
765
- return {
766
- type: "context_slice",
767
- version: 1,
768
- focus: { kind: "bug", id: bugId },
769
- summary: summarizeBug(bug),
770
- depends_on: {
771
- violates,
772
- surfaces_rule: surfacesRule,
773
- fixed_in: fixedIn,
774
- fixed_in_verification: fixedInVerification,
775
- affects,
776
- verifications
777
- },
778
- related: {
779
- violates: summarizeStatementsByIds(graph, violates),
780
- affects: summarizeStatementsByIds(graph, affects),
781
- fixed_in: summarizeStatementsByIds(graph, fixedIn)
782
- },
783
- verification: summarizeStatementsByIds(graph, verifications),
784
- verification_targets: recommendedVerificationTargets(graph, [bugId, ...affects, ...violates], {
785
- rationale: "Bug slice points at verification proving the regression is closed."
786
- }),
787
- write_scope: buildDefaultWriteScope(),
788
- review_boundary: reviewBoundaryForBug(),
789
- ownership_boundary: defaultOwnershipBoundary()
790
- };
791
- }
792
-
793
- function documentSlice(graph, documentId) {
794
- const doc = documentById(graph, documentId);
795
- if (!doc) throw new Error(`No document found with id '${documentId}'`);
796
-
797
- const relatedEntities = (doc.relatedEntities || []).slice().sort();
798
- const relatedCapabilities = (doc.relatedCapabilities || []).slice().sort();
799
- const relatedProjections = (doc.relatedProjections || []).slice().sort();
800
- const relatedRules = (doc.relatedRules || []).slice().sort();
801
-
802
- return {
803
- type: "context_slice",
804
- version: 1,
805
- focus: { kind: "document", id: documentId },
806
- summary: summarizeDocument(doc),
807
- depends_on: {
808
- related_entities: relatedEntities,
809
- related_capabilities: relatedCapabilities,
810
- related_projections: relatedProjections,
811
- related_rules: relatedRules
812
- },
813
- related: {
814
- entities: summarizeStatementsByIds(graph, relatedEntities),
815
- capabilities: summarizeStatementsByIds(graph, relatedCapabilities),
816
- projections: summarizeStatementsByIds(graph, relatedProjections),
817
- rules: summarizeStatementsByIds(graph, relatedRules)
818
- },
819
- verification: [],
820
- verification_targets: [],
821
- write_scope: buildDefaultWriteScope(),
822
- review_boundary: reviewBoundaryForDocument(doc),
823
- ownership_boundary: defaultOwnershipBoundary()
824
- };
825
- }
826
-
827
- export function generateContextSlice(graph, options = {}) {
828
- const selection = ensureContextSelection({
829
- capabilityId: options.capabilityId,
830
- workflowId: options.workflowId,
831
- projectionId: options.projectionId,
832
- componentId: options.widgetId || options.componentId,
833
- entityId: options.entityId,
834
- journeyId: options.journeyId,
835
- surfaceId: options.surfaceId,
836
- domainId: options.domainId,
837
- pitchId: options.pitchId,
838
- requirementId: options.requirementId,
839
- acceptanceId: options.acceptanceId,
840
- taskId: options.taskId,
841
- bugId: options.bugId,
842
- documentId: options.documentId
843
- });
844
-
845
- if (selection.kind === "capability") return capabilitySlice(graph, selection.id);
846
- if (selection.kind === "workflow") return workflowSlice(graph, selection.id);
847
- if (selection.kind === "projection") return projectionSlice(graph, selection.id);
848
- if (selection.kind === "widget") return widgetSlice(graph, selection.id);
849
- if (selection.kind === "entity") return entitySlice(graph, selection.id);
850
- if (selection.kind === "journey") return journeySlice(graph, selection.id);
851
- if (selection.kind === "domain") return domainSlice(graph, selection.id);
852
- if (selection.kind === "pitch") return pitchSlice(graph, selection.id);
853
- if (selection.kind === "requirement") return requirementSlice(graph, selection.id);
854
- if (selection.kind === "acceptance_criterion") return acceptanceCriterionSlice(graph, selection.id);
855
- if (selection.kind === "task") return taskSlice(graph, selection.id);
856
- if (selection.kind === "bug") return bugSlice(graph, selection.id);
857
- if (selection.kind === "document") return documentSlice(graph, selection.id);
858
-
859
- throw new Error(`Unsupported context slice kind '${selection.kind}'`);
860
- }
3
+ export { generateContextSlice } from "./slice/core.js";