archctx-contracts 0.17.1 → 0.18.1

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 (112) hide show
  1. package/fixtures/valid/archctx-capabilities.json +2 -2
  2. package/fixtures/valid/product-version-manifest.json +4 -10
  3. package/package.json +4 -1
  4. package/schemas/repo/refactor-decision.schema.json +307 -37
  5. package/schemas/runtime/archctx-capabilities.schema.json +144 -20
  6. package/schemas/runtime/architecture-debt-delta.schema.json +58 -19
  7. package/schemas/runtime/architecture-debt.schema.json +42 -42
  8. package/schemas/runtime/architecture-event.schema.json +1 -1
  9. package/schemas/runtime/architecture-history.schema.json +354 -0
  10. package/schemas/runtime/capability-dependencies.schema.json +266 -59
  11. package/schemas/runtime/cli-check.schema.json +209 -0
  12. package/schemas/runtime/cli-help.schema.json +28 -0
  13. package/schemas/runtime/dependency-constraint-evaluation.schema.json +67 -68
  14. package/schemas/runtime/docs-anchors.schema.json +262 -67
  15. package/schemas/runtime/doctor-code-facts.schema.json +49 -0
  16. package/schemas/runtime/evidence-binding.schema.json +1 -1
  17. package/schemas/runtime/flow-selector-check.schema.json +179 -46
  18. package/schemas/runtime/hook-debt-checkpoint.schema.json +12 -12
  19. package/schemas/runtime/index-seed.schema.json +56 -0
  20. package/schemas/runtime/path-context.schema.json +120 -0
  21. package/schemas/runtime/product-version-manifest.schema.json +142 -54
  22. package/schemas/runtime/projection-slice.schema.json +34 -34
  23. package/schemas/runtime/recommendation-v3.schema.json +372 -1
  24. package/schemas/runtime/ref-impact-batch-request.schema.json +20 -7
  25. package/schemas/runtime/ref-impact-batch.schema.json +83 -13
  26. package/schemas/runtime/ref-impact.schema.json +68 -61
  27. package/schemas/runtime/refactor-scan-v2.schema.json +1392 -0
  28. package/schemas/runtime/refactor-simulate.schema.json +553 -0
  29. package/schemas/runtime/refactor-verify-v2.schema.json +172 -0
  30. package/schemas/runtime/resolve-path.schema.json +69 -0
  31. package/schemas/runtime/runtime-recommendation-show.schema.json +531 -2
  32. package/schemas/runtime/runtime-refactor-scan.schema.json +498 -2
  33. package/schemas/runtime/runtime-verify.schema.json +274 -56
  34. package/schemas/runtime/state-machine-check.schema.json +357 -89
  35. package/schemas/runtime/structural-observation-payload.schema.json +372 -1
  36. package/schemas/runtime/sync-check.schema.json +77 -0
  37. package/src/architecture-debt.ts +125 -38
  38. package/src/architecture-history.ts +168 -42
  39. package/src/architecture.ts +100 -0
  40. package/src/cli-read.ts +228 -0
  41. package/src/docs-anchors.ts +105 -50
  42. package/src/explorer-occurrence-ports.ts +175 -0
  43. package/src/explorer-query-ports.ts +270 -0
  44. package/src/failure.ts +4 -0
  45. package/src/index-seed.ts +42 -0
  46. package/src/index.ts +5 -0
  47. package/src/ledger-records.ts +262 -0
  48. package/src/ledger.ts +27 -566
  49. package/src/ownership-dependencies.ts +115 -5
  50. package/src/ports.ts +6 -541
  51. package/src/product-version.ts +74 -55
  52. package/src/projection-apply-types.ts +216 -0
  53. package/src/projection-apply-validators.ts +355 -0
  54. package/src/projection-capabilities.ts +181 -0
  55. package/src/projection-constants.ts +317 -0
  56. package/src/projection-manifest-types.ts +298 -0
  57. package/src/projection-manifest.ts +12 -299
  58. package/src/projection-recovery-validators.ts +229 -0
  59. package/src/projection-request-validators.ts +326 -0
  60. package/src/projection-types.ts +365 -0
  61. package/src/projection-validation-helpers.ts +15 -0
  62. package/src/projection.ts +7 -1689
  63. package/src/ref-impact.ts +225 -33
  64. package/src/refactor-constants.ts +213 -0
  65. package/src/refactor-decision-validators.ts +351 -0
  66. package/src/refactor-evidence-types.ts +286 -0
  67. package/src/refactor-observation-validators.ts +359 -0
  68. package/src/refactor-resolution-validators.ts +229 -0
  69. package/src/refactor-snapshot-validators.ts +368 -0
  70. package/src/refactor-types.ts +270 -0
  71. package/src/refactor-v2.ts +554 -0
  72. package/src/refactor-validation-helpers.ts +199 -0
  73. package/src/refactor.ts +7 -1849
  74. package/src/review-guards.ts +3 -23
  75. package/src/runtime-verify.ts +87 -0
  76. package/src/schema-kit.ts +187 -0
  77. package/src/schema-registry.ts +73 -0
  78. package/src/schema.ts +15 -4
  79. package/src/state-machine-schemas.ts +192 -0
  80. package/src/state-machine-types.ts +188 -0
  81. package/src/state-machine.ts +9 -189
  82. package/fixtures/boundary/agent-job-expired.json +0 -33
  83. package/fixtures/invalid/adapter-fidelity-reverse-sync.json +0 -9
  84. package/fixtures/invalid/agent-job-direct-mutation.json +0 -32
  85. package/fixtures/invalid/cloud-egress-envelope-private-field.json +0 -12
  86. package/fixtures/invalid/investigation-report-direct-mutation.json +0 -38
  87. package/fixtures/invalid/investigation-report-missing-proposed-delta.json +0 -19
  88. package/fixtures/invalid/notification-event-code-field.json +0 -11
  89. package/fixtures/valid/adapter-fidelity.json +0 -9
  90. package/fixtures/valid/agent-job.json +0 -33
  91. package/fixtures/valid/architecture-candidate-delta-policy.json +0 -45
  92. package/fixtures/valid/architecture-candidate-delta.json +0 -188
  93. package/fixtures/valid/chatgpt-ga-tool.json +0 -9
  94. package/fixtures/valid/cloud-egress-envelope.json +0 -11
  95. package/fixtures/valid/entitlement.json +0 -12
  96. package/fixtures/valid/investigation-report.json +0 -38
  97. package/fixtures/valid/likec4-mapping.json +0 -14
  98. package/fixtures/valid/notification-event.json +0 -10
  99. package/fixtures/valid/notification-provider.json +0 -12
  100. package/fixtures/valid/structurizr-mapping.json +0 -15
  101. package/schemas/cloud/cloud-egress-envelope.schema.json +0 -19
  102. package/schemas/cloud/entitlement.schema.json +0 -24
  103. package/schemas/integrations/adapter-fidelity.schema.json +0 -21
  104. package/schemas/integrations/chatgpt-ga-tool.schema.json +0 -25
  105. package/schemas/integrations/likec4-mapping.schema.json +0 -32
  106. package/schemas/integrations/structurizr-mapping.schema.json +0 -33
  107. package/schemas/runtime/agent-job.schema.json +0 -63
  108. package/schemas/runtime/architecture-candidate-delta-policy.schema.json +0 -129
  109. package/schemas/runtime/architecture-candidate-delta.schema.json +0 -386
  110. package/schemas/runtime/investigation-report.schema.json +0 -119
  111. package/schemas/runtime/notification-event.schema.json +0 -18
  112. package/schemas/runtime/notification-provider.schema.json +0 -26
@@ -0,0 +1,553 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archcontext.dev/schemas/runtime/refactor-simulate.schema.json",
4
+ "title": "RefactorSimulateV1",
5
+ "description": "Read-only move/cut impact simulation preview (#638, #643 Phase 2).",
6
+ "additionalProperties": false,
7
+ "type": "object",
8
+ "required": [
9
+ "schemaVersion",
10
+ "beforeSnapshotDigest",
11
+ "modelDigest",
12
+ "codeFactsCoverage",
13
+ "moves",
14
+ "targetSubject",
15
+ "measurementStatus",
16
+ "unmeasuredReasons",
17
+ "metricsDelta",
18
+ "newlyIntroducedCycles",
19
+ "resolvedCycles",
20
+ "newlyIntroducedViolations",
21
+ "cutCandidates",
22
+ "simulationDigest",
23
+ "privacy"
24
+ ],
25
+ "properties": {
26
+ "schemaVersion": {
27
+ "const": "archcontext.runtime-refactor-simulate/v1"
28
+ },
29
+ "beforeSnapshotDigest": {
30
+ "pattern": "^sha256:[a-f0-9]{64}$",
31
+ "type": "string"
32
+ },
33
+ "modelDigest": {
34
+ "pattern": "^sha256:[a-f0-9]{64}$",
35
+ "type": "string"
36
+ },
37
+ "codeFactsCoverage": {
38
+ "type": "string",
39
+ "enum": [
40
+ "complete",
41
+ "partial",
42
+ "unknown"
43
+ ]
44
+ },
45
+ "moves": {
46
+ "type": "array",
47
+ "items": {
48
+ "additionalProperties": false,
49
+ "type": "object",
50
+ "required": [
51
+ "path",
52
+ "toNodeId"
53
+ ],
54
+ "properties": {
55
+ "path": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "not": {
59
+ "anyOf": [
60
+ {
61
+ "pattern": "^/"
62
+ },
63
+ {
64
+ "pattern": "/$"
65
+ },
66
+ {
67
+ "pattern": "//"
68
+ },
69
+ {
70
+ "pattern": "\\\\"
71
+ },
72
+ {
73
+ "pattern": "^[A-Za-z]:"
74
+ },
75
+ {
76
+ "pattern": "[\\u0000-\\u001f\\u007f]"
77
+ },
78
+ {
79
+ "pattern": "(^|/)\\.\\.?(/|$)"
80
+ }
81
+ ]
82
+ }
83
+ },
84
+ "toNodeId": {
85
+ "minLength": 1,
86
+ "type": "string"
87
+ },
88
+ "symbols": {
89
+ "uniqueItems": true,
90
+ "minItems": 1,
91
+ "type": "array",
92
+ "items": {
93
+ "minLength": 1,
94
+ "type": "string"
95
+ }
96
+ }
97
+ }
98
+ }
99
+ },
100
+ "targetSubject": {
101
+ "anyOf": [
102
+ {
103
+ "minLength": 1,
104
+ "type": "string"
105
+ },
106
+ {
107
+ "type": "null"
108
+ }
109
+ ]
110
+ },
111
+ "measurementStatus": {
112
+ "type": "string",
113
+ "enum": [
114
+ "measured",
115
+ "unmeasured"
116
+ ]
117
+ },
118
+ "unmeasuredReasons": {
119
+ "uniqueItems": true,
120
+ "type": "array",
121
+ "items": {
122
+ "minLength": 1,
123
+ "maxLength": 1024,
124
+ "type": "string"
125
+ }
126
+ },
127
+ "metricsDelta": {
128
+ "additionalProperties": false,
129
+ "type": "object",
130
+ "required": [
131
+ "before",
132
+ "after",
133
+ "delta"
134
+ ],
135
+ "properties": {
136
+ "before": {
137
+ "additionalProperties": false,
138
+ "type": "object",
139
+ "required": [
140
+ "pairThinDirectionEdgeCount",
141
+ "crossModuleEdgeCount",
142
+ "crossModuleCycleCount",
143
+ "residualCycleCount",
144
+ "directionViolationCount"
145
+ ],
146
+ "properties": {
147
+ "pairThinDirectionEdgeCount": {
148
+ "minimum": 0,
149
+ "type": "integer"
150
+ },
151
+ "crossModuleEdgeCount": {
152
+ "minimum": 0,
153
+ "type": "integer"
154
+ },
155
+ "crossModuleCycleCount": {
156
+ "minimum": 0,
157
+ "type": "integer"
158
+ },
159
+ "residualCycleCount": {
160
+ "minimum": 0,
161
+ "type": "integer"
162
+ },
163
+ "directionViolationCount": {
164
+ "minimum": 0,
165
+ "type": "integer"
166
+ }
167
+ }
168
+ },
169
+ "after": {
170
+ "anyOf": [
171
+ {
172
+ "additionalProperties": false,
173
+ "type": "object",
174
+ "required": [
175
+ "pairThinDirectionEdgeCount",
176
+ "crossModuleEdgeCount",
177
+ "crossModuleCycleCount",
178
+ "residualCycleCount",
179
+ "directionViolationCount"
180
+ ],
181
+ "properties": {
182
+ "pairThinDirectionEdgeCount": {
183
+ "minimum": 0,
184
+ "type": "integer"
185
+ },
186
+ "crossModuleEdgeCount": {
187
+ "minimum": 0,
188
+ "type": "integer"
189
+ },
190
+ "crossModuleCycleCount": {
191
+ "minimum": 0,
192
+ "type": "integer"
193
+ },
194
+ "residualCycleCount": {
195
+ "minimum": 0,
196
+ "type": "integer"
197
+ },
198
+ "directionViolationCount": {
199
+ "minimum": 0,
200
+ "type": "integer"
201
+ }
202
+ }
203
+ },
204
+ {
205
+ "type": "null"
206
+ }
207
+ ]
208
+ },
209
+ "delta": {
210
+ "anyOf": [
211
+ {
212
+ "additionalProperties": false,
213
+ "type": "object",
214
+ "required": [
215
+ "pairThinDirectionEdgeCount",
216
+ "crossModuleEdgeCount",
217
+ "crossModuleCycleCount",
218
+ "residualCycleCount",
219
+ "directionViolationCount"
220
+ ],
221
+ "properties": {
222
+ "pairThinDirectionEdgeCount": {
223
+ "type": "integer"
224
+ },
225
+ "crossModuleEdgeCount": {
226
+ "type": "integer"
227
+ },
228
+ "crossModuleCycleCount": {
229
+ "type": "integer"
230
+ },
231
+ "residualCycleCount": {
232
+ "type": "integer"
233
+ },
234
+ "directionViolationCount": {
235
+ "type": "integer"
236
+ }
237
+ }
238
+ },
239
+ {
240
+ "type": "null"
241
+ }
242
+ ]
243
+ }
244
+ }
245
+ },
246
+ "newlyIntroducedCycles": {
247
+ "type": "array",
248
+ "items": {
249
+ "minLength": 1,
250
+ "type": "string"
251
+ }
252
+ },
253
+ "resolvedCycles": {
254
+ "type": "array",
255
+ "items": {
256
+ "minLength": 1,
257
+ "type": "string"
258
+ }
259
+ },
260
+ "newlyIntroducedViolations": {
261
+ "type": "array",
262
+ "items": {
263
+ "additionalProperties": false,
264
+ "type": "object",
265
+ "required": [
266
+ "constraintId",
267
+ "fromPath",
268
+ "toPath",
269
+ "fromNode",
270
+ "toNode",
271
+ "severity"
272
+ ],
273
+ "properties": {
274
+ "constraintId": {
275
+ "minLength": 1,
276
+ "type": "string"
277
+ },
278
+ "fromPath": {
279
+ "type": "string",
280
+ "minLength": 1,
281
+ "not": {
282
+ "anyOf": [
283
+ {
284
+ "pattern": "^/"
285
+ },
286
+ {
287
+ "pattern": "/$"
288
+ },
289
+ {
290
+ "pattern": "//"
291
+ },
292
+ {
293
+ "pattern": "\\\\"
294
+ },
295
+ {
296
+ "pattern": "^[A-Za-z]:"
297
+ },
298
+ {
299
+ "pattern": "[\\u0000-\\u001f\\u007f]"
300
+ },
301
+ {
302
+ "pattern": "(^|/)\\.\\.?(/|$)"
303
+ }
304
+ ]
305
+ }
306
+ },
307
+ "toPath": {
308
+ "type": "string",
309
+ "minLength": 1,
310
+ "not": {
311
+ "anyOf": [
312
+ {
313
+ "pattern": "^/"
314
+ },
315
+ {
316
+ "pattern": "/$"
317
+ },
318
+ {
319
+ "pattern": "//"
320
+ },
321
+ {
322
+ "pattern": "\\\\"
323
+ },
324
+ {
325
+ "pattern": "^[A-Za-z]:"
326
+ },
327
+ {
328
+ "pattern": "[\\u0000-\\u001f\\u007f]"
329
+ },
330
+ {
331
+ "pattern": "(^|/)\\.\\.?(/|$)"
332
+ }
333
+ ]
334
+ }
335
+ },
336
+ "fromNode": {
337
+ "minLength": 1,
338
+ "type": "string"
339
+ },
340
+ "toNode": {
341
+ "minLength": 1,
342
+ "type": "string"
343
+ },
344
+ "severity": {
345
+ "enum": [
346
+ "notice",
347
+ "warning",
348
+ "error",
349
+ "critical"
350
+ ]
351
+ },
352
+ "fromLayer": {
353
+ "minLength": 1,
354
+ "type": "string"
355
+ },
356
+ "toLayer": {
357
+ "minLength": 1,
358
+ "type": "string"
359
+ }
360
+ }
361
+ }
362
+ },
363
+ "cutCandidates": {
364
+ "type": "array",
365
+ "items": {
366
+ "additionalProperties": false,
367
+ "type": "object",
368
+ "required": [
369
+ "strategy",
370
+ "measured",
371
+ "measurementStatus",
372
+ "summary",
373
+ "moves",
374
+ "thinDirectionEdgeDelta",
375
+ "crossModuleCycleDelta",
376
+ "directionViolationDelta",
377
+ "newlyIntroducedViolationCount",
378
+ "breaksPair",
379
+ "caveats"
380
+ ],
381
+ "properties": {
382
+ "strategy": {
383
+ "type": "string",
384
+ "enum": [
385
+ "move-source-file",
386
+ "move-target-file",
387
+ "extract-shared-leaf",
388
+ "invert-interface"
389
+ ]
390
+ },
391
+ "measured": {
392
+ "type": "boolean"
393
+ },
394
+ "measurementStatus": {
395
+ "type": "string",
396
+ "enum": [
397
+ "measured",
398
+ "unmeasured"
399
+ ]
400
+ },
401
+ "summary": {
402
+ "minLength": 1,
403
+ "maxLength": 1024,
404
+ "type": "string"
405
+ },
406
+ "moves": {
407
+ "type": "array",
408
+ "items": {
409
+ "additionalProperties": false,
410
+ "type": "object",
411
+ "required": [
412
+ "path",
413
+ "toNodeId"
414
+ ],
415
+ "properties": {
416
+ "path": {
417
+ "type": "string",
418
+ "minLength": 1,
419
+ "not": {
420
+ "anyOf": [
421
+ {
422
+ "pattern": "^/"
423
+ },
424
+ {
425
+ "pattern": "/$"
426
+ },
427
+ {
428
+ "pattern": "//"
429
+ },
430
+ {
431
+ "pattern": "\\\\"
432
+ },
433
+ {
434
+ "pattern": "^[A-Za-z]:"
435
+ },
436
+ {
437
+ "pattern": "[\\u0000-\\u001f\\u007f]"
438
+ },
439
+ {
440
+ "pattern": "(^|/)\\.\\.?(/|$)"
441
+ }
442
+ ]
443
+ }
444
+ },
445
+ "toNodeId": {
446
+ "minLength": 1,
447
+ "type": "string"
448
+ },
449
+ "symbols": {
450
+ "uniqueItems": true,
451
+ "minItems": 1,
452
+ "type": "array",
453
+ "items": {
454
+ "minLength": 1,
455
+ "type": "string"
456
+ }
457
+ }
458
+ }
459
+ }
460
+ },
461
+ "thinDirectionEdgeDelta": {
462
+ "anyOf": [
463
+ {
464
+ "type": "integer"
465
+ },
466
+ {
467
+ "type": "null"
468
+ }
469
+ ]
470
+ },
471
+ "crossModuleCycleDelta": {
472
+ "anyOf": [
473
+ {
474
+ "type": "integer"
475
+ },
476
+ {
477
+ "type": "null"
478
+ }
479
+ ]
480
+ },
481
+ "directionViolationDelta": {
482
+ "anyOf": [
483
+ {
484
+ "type": "integer"
485
+ },
486
+ {
487
+ "type": "null"
488
+ }
489
+ ]
490
+ },
491
+ "newlyIntroducedViolationCount": {
492
+ "anyOf": [
493
+ {
494
+ "minimum": 0,
495
+ "type": "integer"
496
+ },
497
+ {
498
+ "type": "null"
499
+ }
500
+ ]
501
+ },
502
+ "breaksPair": {
503
+ "anyOf": [
504
+ {
505
+ "type": "boolean"
506
+ },
507
+ {
508
+ "type": "null"
509
+ }
510
+ ]
511
+ },
512
+ "caveats": {
513
+ "uniqueItems": true,
514
+ "type": "array",
515
+ "items": {
516
+ "minLength": 1,
517
+ "maxLength": 1024,
518
+ "type": "string"
519
+ }
520
+ }
521
+ }
522
+ }
523
+ },
524
+ "simulationDigest": {
525
+ "pattern": "^sha256:[a-f0-9]{64}$",
526
+ "type": "string"
527
+ },
528
+ "privacy": {
529
+ "additionalProperties": false,
530
+ "type": "object",
531
+ "required": [
532
+ "writes",
533
+ "rawSourcePersisted",
534
+ "rawDiffPersisted",
535
+ "promptPersisted"
536
+ ],
537
+ "properties": {
538
+ "writes": {
539
+ "const": "none"
540
+ },
541
+ "rawSourcePersisted": {
542
+ "const": false
543
+ },
544
+ "rawDiffPersisted": {
545
+ "const": false
546
+ },
547
+ "promptPersisted": {
548
+ "const": false
549
+ }
550
+ }
551
+ }
552
+ }
553
+ }