archctx-contracts 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/fixtures/invalid/projection-result-applied-incomplete-coverage.json +3 -3
  2. package/fixtures/valid/archctx-capabilities.json +2 -2
  3. package/fixtures/valid/flow-selector-check.json +1 -1
  4. package/fixtures/valid/product-version-manifest.json +5 -11
  5. package/fixtures/valid/projection-manifest.json +1 -1
  6. package/fixtures/valid/projection-result.json +3 -3
  7. package/package.json +4 -1
  8. package/schemas/repo/refactor-decision.schema.json +283 -37
  9. package/schemas/runtime/archctx-capabilities.schema.json +144 -20
  10. package/schemas/runtime/architecture-debt-delta.schema.json +58 -19
  11. package/schemas/runtime/architecture-debt.schema.json +42 -42
  12. package/schemas/runtime/architecture-event.schema.json +1 -1
  13. package/schemas/runtime/architecture-history.schema.json +354 -0
  14. package/schemas/runtime/capability-dependencies.schema.json +266 -59
  15. package/schemas/runtime/cli-check.schema.json +197 -0
  16. package/schemas/runtime/cli-help.schema.json +28 -0
  17. package/schemas/runtime/dependency-constraint-evaluation.schema.json +67 -68
  18. package/schemas/runtime/docs-anchors.schema.json +250 -67
  19. package/schemas/runtime/doctor-code-facts.schema.json +49 -0
  20. package/schemas/runtime/evidence-binding.schema.json +1 -1
  21. package/schemas/runtime/flow-selector-check.schema.json +179 -46
  22. package/schemas/runtime/hook-debt-checkpoint.schema.json +12 -12
  23. package/schemas/runtime/index-seed.schema.json +56 -0
  24. package/schemas/runtime/path-context.schema.json +108 -0
  25. package/schemas/runtime/product-version-manifest.schema.json +142 -54
  26. package/schemas/runtime/projection-apply-readback.schema.json +2 -2
  27. package/schemas/runtime/projection-apply-recovery.schema.json +1 -1
  28. package/schemas/runtime/projection-result.schema.json +1 -1
  29. package/schemas/runtime/projection-slice.schema.json +34 -34
  30. package/schemas/runtime/recommendation-v3.schema.json +372 -1
  31. package/schemas/runtime/ref-impact-batch-request.schema.json +20 -7
  32. package/schemas/runtime/ref-impact-batch.schema.json +83 -13
  33. package/schemas/runtime/ref-impact.schema.json +68 -61
  34. package/schemas/runtime/refactor-scan-v2.schema.json +434 -0
  35. package/schemas/runtime/refactor-simulate.schema.json +505 -0
  36. package/schemas/runtime/refactor-verify-v2.schema.json +172 -0
  37. package/schemas/runtime/resolve-path.schema.json +69 -0
  38. package/schemas/runtime/runtime-recommendation-show.schema.json +531 -2
  39. package/schemas/runtime/runtime-refactor-scan.schema.json +498 -2
  40. package/schemas/runtime/runtime-verify.schema.json +274 -56
  41. package/schemas/runtime/state-machine-check.schema.json +357 -89
  42. package/schemas/runtime/structural-observation-payload.schema.json +372 -1
  43. package/schemas/runtime/sync-check.schema.json +65 -0
  44. package/src/architecture-debt.ts +125 -38
  45. package/src/architecture-history.ts +168 -42
  46. package/src/architecture.ts +100 -0
  47. package/src/cli-read.ts +228 -0
  48. package/src/docs-anchors.ts +105 -50
  49. package/src/explorer-occurrence-ports.ts +175 -0
  50. package/src/explorer-query-ports.ts +270 -0
  51. package/src/failure.ts +3 -0
  52. package/src/index-seed.ts +42 -0
  53. package/src/index.ts +5 -0
  54. package/src/ledger-records.ts +262 -0
  55. package/src/ledger.ts +27 -566
  56. package/src/ownership-dependencies.ts +115 -5
  57. package/src/ports.ts +12 -543
  58. package/src/product-version.ts +75 -56
  59. package/src/projection-apply-types.ts +216 -0
  60. package/src/projection-apply-validators.ts +355 -0
  61. package/src/projection-capabilities.ts +181 -0
  62. package/src/projection-constants.ts +317 -0
  63. package/src/projection-manifest-types.ts +298 -0
  64. package/src/projection-manifest.ts +12 -299
  65. package/src/projection-recovery-validators.ts +229 -0
  66. package/src/projection-request-validators.ts +326 -0
  67. package/src/projection-types.ts +365 -0
  68. package/src/projection-validation-helpers.ts +15 -0
  69. package/src/projection.ts +7 -1689
  70. package/src/ref-impact.ts +225 -33
  71. package/src/refactor-constants.ts +213 -0
  72. package/src/refactor-decision-validators.ts +350 -0
  73. package/src/refactor-evidence-types.ts +286 -0
  74. package/src/refactor-observation-validators.ts +359 -0
  75. package/src/refactor-resolution-validators.ts +229 -0
  76. package/src/refactor-snapshot-validators.ts +368 -0
  77. package/src/refactor-types.ts +270 -0
  78. package/src/refactor-v2.ts +389 -0
  79. package/src/refactor-validation-helpers.ts +195 -0
  80. package/src/refactor.ts +7 -1849
  81. package/src/review-guards.ts +3 -23
  82. package/src/runtime-verify.ts +87 -0
  83. package/src/schema-kit.ts +183 -0
  84. package/src/schema-registry.ts +73 -0
  85. package/src/schema.ts +0 -4
  86. package/src/state-machine-schemas.ts +192 -0
  87. package/src/state-machine-types.ts +188 -0
  88. package/src/state-machine.ts +9 -189
  89. package/fixtures/boundary/agent-job-expired.json +0 -33
  90. package/fixtures/invalid/adapter-fidelity-reverse-sync.json +0 -9
  91. package/fixtures/invalid/agent-job-direct-mutation.json +0 -32
  92. package/fixtures/invalid/cloud-egress-envelope-private-field.json +0 -12
  93. package/fixtures/invalid/investigation-report-direct-mutation.json +0 -38
  94. package/fixtures/invalid/investigation-report-missing-proposed-delta.json +0 -19
  95. package/fixtures/invalid/notification-event-code-field.json +0 -11
  96. package/fixtures/valid/adapter-fidelity.json +0 -9
  97. package/fixtures/valid/agent-job.json +0 -33
  98. package/fixtures/valid/architecture-candidate-delta-policy.json +0 -45
  99. package/fixtures/valid/architecture-candidate-delta.json +0 -188
  100. package/fixtures/valid/chatgpt-ga-tool.json +0 -9
  101. package/fixtures/valid/cloud-egress-envelope.json +0 -11
  102. package/fixtures/valid/entitlement.json +0 -12
  103. package/fixtures/valid/investigation-report.json +0 -38
  104. package/fixtures/valid/likec4-mapping.json +0 -14
  105. package/fixtures/valid/notification-event.json +0 -10
  106. package/fixtures/valid/notification-provider.json +0 -12
  107. package/fixtures/valid/structurizr-mapping.json +0 -15
  108. package/schemas/cloud/cloud-egress-envelope.schema.json +0 -19
  109. package/schemas/cloud/entitlement.schema.json +0 -24
  110. package/schemas/integrations/adapter-fidelity.schema.json +0 -21
  111. package/schemas/integrations/chatgpt-ga-tool.schema.json +0 -25
  112. package/schemas/integrations/likec4-mapping.schema.json +0 -32
  113. package/schemas/integrations/structurizr-mapping.schema.json +0 -33
  114. package/schemas/runtime/agent-job.schema.json +0 -63
  115. package/schemas/runtime/architecture-candidate-delta-policy.schema.json +0 -129
  116. package/schemas/runtime/architecture-candidate-delta.schema.json +0 -386
  117. package/schemas/runtime/investigation-report.schema.json +0 -119
  118. package/schemas/runtime/notification-event.schema.json +0 -18
  119. package/schemas/runtime/notification-provider.schema.json +0 -26
@@ -0,0 +1,434 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archcontext.dev/schemas/runtime/refactor-scan-v2.schema.json",
4
+ "title": "RefactorScanV2",
5
+ "description": "v2 Stage 5 deterministic refactor radar output for `archctx scan --json` (#643).",
6
+ "additionalProperties": false,
7
+ "type": "object",
8
+ "required": [
9
+ "schemaVersion",
10
+ "scope",
11
+ "headSha",
12
+ "snapshotDigest",
13
+ "coverage",
14
+ "findings",
15
+ "suppressed"
16
+ ],
17
+ "properties": {
18
+ "schemaVersion": {
19
+ "const": "archcontext.refactor-scan/v2"
20
+ },
21
+ "scope": {
22
+ "oneOf": [
23
+ {
24
+ "additionalProperties": false,
25
+ "type": "object",
26
+ "required": [
27
+ "kind"
28
+ ],
29
+ "properties": {
30
+ "kind": {
31
+ "const": "repository"
32
+ }
33
+ }
34
+ },
35
+ {
36
+ "additionalProperties": false,
37
+ "type": "object",
38
+ "required": [
39
+ "kind",
40
+ "nodeId"
41
+ ],
42
+ "properties": {
43
+ "kind": {
44
+ "const": "node"
45
+ },
46
+ "nodeId": {
47
+ "minLength": 1,
48
+ "type": "string"
49
+ }
50
+ }
51
+ },
52
+ {
53
+ "additionalProperties": false,
54
+ "type": "object",
55
+ "required": [
56
+ "kind",
57
+ "paths"
58
+ ],
59
+ "properties": {
60
+ "kind": {
61
+ "const": "paths"
62
+ },
63
+ "paths": {
64
+ "uniqueItems": true,
65
+ "minItems": 1,
66
+ "type": "array",
67
+ "items": {
68
+ "type": "string",
69
+ "minLength": 1,
70
+ "not": {
71
+ "anyOf": [
72
+ {
73
+ "pattern": "^/"
74
+ },
75
+ {
76
+ "pattern": "\\\\"
77
+ },
78
+ {
79
+ "pattern": "(^|/)\\.\\.(/|$)"
80
+ }
81
+ ]
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ ]
88
+ },
89
+ "headSha": {
90
+ "pattern": "^[a-f0-9]{40}$",
91
+ "type": "string"
92
+ },
93
+ "snapshotDigest": {
94
+ "pattern": "^sha256:[a-f0-9]{64}$",
95
+ "type": "string"
96
+ },
97
+ "importNodeLimit": {
98
+ "minimum": 1,
99
+ "type": "integer"
100
+ },
101
+ "coverage": {
102
+ "additionalProperties": false,
103
+ "type": "object",
104
+ "required": [
105
+ "imports",
106
+ "gitHistory",
107
+ "reasonCodes"
108
+ ],
109
+ "properties": {
110
+ "imports": {
111
+ "type": "string",
112
+ "enum": [
113
+ "complete",
114
+ "partial",
115
+ "unavailable"
116
+ ]
117
+ },
118
+ "gitHistory": {
119
+ "type": "string",
120
+ "enum": [
121
+ "complete",
122
+ "shallow",
123
+ "unavailable"
124
+ ]
125
+ },
126
+ "reasonCodes": {
127
+ "uniqueItems": true,
128
+ "type": "array",
129
+ "items": {
130
+ "minLength": 1,
131
+ "maxLength": 1024,
132
+ "type": "string"
133
+ }
134
+ }
135
+ }
136
+ },
137
+ "findings": {
138
+ "type": "array",
139
+ "items": {
140
+ "additionalProperties": false,
141
+ "type": "object",
142
+ "required": [
143
+ "recommendationId",
144
+ "fingerprint",
145
+ "detector",
146
+ "severity",
147
+ "blocking",
148
+ "capabilityId",
149
+ "affectedNodeIds",
150
+ "affectedPaths",
151
+ "killList",
152
+ "metrics",
153
+ "evidence"
154
+ ],
155
+ "properties": {
156
+ "recommendationId": {
157
+ "pattern": "^recommendation\\.[a-f0-9]{16}$",
158
+ "type": "string"
159
+ },
160
+ "fingerprint": {
161
+ "pattern": "^sha256:[a-f0-9]{64}$",
162
+ "type": "string"
163
+ },
164
+ "detector": {
165
+ "type": "string",
166
+ "enum": [
167
+ "file-cycle",
168
+ "component-cycle",
169
+ "god-file",
170
+ "low-cohesion-god-file",
171
+ "entrypoint-bypass",
172
+ "undeclared-dependency",
173
+ "purity-violation",
174
+ "dead-public-export",
175
+ "unstable-dependency",
176
+ "shotgun-surgery-hotspot",
177
+ "co-change-coupling"
178
+ ]
179
+ },
180
+ "severity": {
181
+ "enum": [
182
+ "notice",
183
+ "warning",
184
+ "error",
185
+ "critical"
186
+ ]
187
+ },
188
+ "blocking": {
189
+ "type": "boolean"
190
+ },
191
+ "capabilityId": {
192
+ "minLength": 1,
193
+ "type": [
194
+ "string",
195
+ "null"
196
+ ]
197
+ },
198
+ "affectedNodeIds": {
199
+ "uniqueItems": true,
200
+ "type": "array",
201
+ "items": {
202
+ "minLength": 1,
203
+ "type": "string"
204
+ }
205
+ },
206
+ "affectedPaths": {
207
+ "uniqueItems": true,
208
+ "type": "array",
209
+ "items": {
210
+ "type": "string",
211
+ "minLength": 1,
212
+ "not": {
213
+ "anyOf": [
214
+ {
215
+ "pattern": "^/"
216
+ },
217
+ {
218
+ "pattern": "\\\\"
219
+ },
220
+ {
221
+ "pattern": "(^|/)\\.\\.(/|$)"
222
+ }
223
+ ]
224
+ }
225
+ }
226
+ },
227
+ "killList": {
228
+ "type": "array",
229
+ "items": {
230
+ "oneOf": [
231
+ {
232
+ "additionalProperties": false,
233
+ "type": "object",
234
+ "required": [
235
+ "kind",
236
+ "target",
237
+ "required"
238
+ ],
239
+ "properties": {
240
+ "kind": {
241
+ "const": "path"
242
+ },
243
+ "target": {
244
+ "type": "string",
245
+ "minLength": 1,
246
+ "not": {
247
+ "anyOf": [
248
+ {
249
+ "pattern": "^/"
250
+ },
251
+ {
252
+ "pattern": "\\\\"
253
+ },
254
+ {
255
+ "pattern": "(^|/)\\.\\.(/|$)"
256
+ }
257
+ ]
258
+ }
259
+ },
260
+ "required": {
261
+ "type": "boolean"
262
+ }
263
+ }
264
+ },
265
+ {
266
+ "additionalProperties": false,
267
+ "type": "object",
268
+ "required": [
269
+ "kind",
270
+ "target",
271
+ "required"
272
+ ],
273
+ "properties": {
274
+ "kind": {
275
+ "const": "relation"
276
+ },
277
+ "target": {
278
+ "minLength": 1,
279
+ "type": "string"
280
+ },
281
+ "required": {
282
+ "type": "boolean"
283
+ }
284
+ }
285
+ },
286
+ {
287
+ "additionalProperties": false,
288
+ "type": "object",
289
+ "required": [
290
+ "kind",
291
+ "target",
292
+ "required"
293
+ ],
294
+ "properties": {
295
+ "kind": {
296
+ "const": "symbol"
297
+ },
298
+ "target": {
299
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))[^#\\s\\\\\\u0000-\\u001f\\u007f]+#[^\\s\\u0000-\\u001f\\u007f]+$",
300
+ "type": "string"
301
+ },
302
+ "required": {
303
+ "type": "boolean"
304
+ }
305
+ }
306
+ }
307
+ ]
308
+ }
309
+ },
310
+ "metrics": {
311
+ "type": "object",
312
+ "additionalProperties": {
313
+ "anyOf": [
314
+ {
315
+ "type": "number"
316
+ },
317
+ {
318
+ "type": "null"
319
+ },
320
+ {
321
+ "type": "boolean"
322
+ }
323
+ ]
324
+ }
325
+ },
326
+ "evidence": {
327
+ "additionalProperties": false,
328
+ "type": "object",
329
+ "required": [
330
+ "summary"
331
+ ],
332
+ "properties": {
333
+ "summary": {
334
+ "minLength": 1,
335
+ "maxLength": 1024,
336
+ "type": "string"
337
+ },
338
+ "coChangeSupport": {
339
+ "minimum": 0,
340
+ "type": "integer"
341
+ },
342
+ "coChangeCoverageOk": {
343
+ "type": "boolean"
344
+ },
345
+ "thinDirectionEdgeCount": {
346
+ "minimum": 0,
347
+ "type": "integer"
348
+ },
349
+ "sccSize": {
350
+ "minimum": 0,
351
+ "type": "integer"
352
+ },
353
+ "instabilitySource": {
354
+ "minimum": 0,
355
+ "maximum": 1,
356
+ "type": "number"
357
+ },
358
+ "instabilityTarget": {
359
+ "minimum": 0,
360
+ "maximum": 1,
361
+ "type": "number"
362
+ },
363
+ "testCallerCoverage": {
364
+ "minimum": 0,
365
+ "maximum": 1,
366
+ "type": [
367
+ "number",
368
+ "null"
369
+ ]
370
+ },
371
+ "lcomScore": {
372
+ "minimum": 0,
373
+ "type": "number"
374
+ },
375
+ "splitClusterCount": {
376
+ "minimum": 0,
377
+ "type": "integer"
378
+ }
379
+ }
380
+ }
381
+ }
382
+ }
383
+ },
384
+ "suppressed": {
385
+ "type": "array",
386
+ "items": {
387
+ "additionalProperties": false,
388
+ "type": "object",
389
+ "required": [
390
+ "recommendationId",
391
+ "detector",
392
+ "decisionStatus",
393
+ "reason"
394
+ ],
395
+ "properties": {
396
+ "recommendationId": {
397
+ "pattern": "^recommendation\\.[a-f0-9]{16}$",
398
+ "type": "string"
399
+ },
400
+ "detector": {
401
+ "type": "string",
402
+ "enum": [
403
+ "file-cycle",
404
+ "component-cycle",
405
+ "god-file",
406
+ "low-cohesion-god-file",
407
+ "entrypoint-bypass",
408
+ "undeclared-dependency",
409
+ "purity-violation",
410
+ "dead-public-export",
411
+ "unstable-dependency",
412
+ "shotgun-surgery-hotspot",
413
+ "co-change-coupling"
414
+ ]
415
+ },
416
+ "decisionStatus": {
417
+ "type": "string",
418
+ "enum": [
419
+ "deferred",
420
+ "rejected",
421
+ "waived",
422
+ "resolved"
423
+ ]
424
+ },
425
+ "reason": {
426
+ "minLength": 1,
427
+ "maxLength": 1024,
428
+ "type": "string"
429
+ }
430
+ }
431
+ }
432
+ }
433
+ }
434
+ }