archctx-contracts 0.17.1 → 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 (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 +283 -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 +197 -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 +250 -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 +108 -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 +434 -0
  28. package/schemas/runtime/refactor-simulate.schema.json +505 -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 +65 -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 +3 -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 +350 -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 +389 -0
  72. package/src/refactor-validation-helpers.ts +195 -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 +183 -0
  77. package/src/schema-registry.ts +73 -0
  78. package/src/schema.ts +0 -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
@@ -1,92 +1,168 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://archcontext.dev/schemas/runtime/product-version-manifest.schema.json",
4
- "type": "object",
4
+ "title": "ProductVersionManifest",
5
5
  "additionalProperties": false,
6
- "required": ["schemaVersion", "product", "packageManager", "engines", "surfaces", "schemas", "runtime"],
6
+ "type": "object",
7
+ "required": [
8
+ "schemaVersion",
9
+ "product",
10
+ "packageManager",
11
+ "engines",
12
+ "surfaces",
13
+ "schemas",
14
+ "runtime"
15
+ ],
7
16
  "properties": {
8
- "schemaVersion": { "const": "archcontext.product-version-manifest/v1" },
17
+ "schemaVersion": {
18
+ "const": "archcontext.product-version-manifest/v1"
19
+ },
9
20
  "product": {
10
- "type": "object",
11
21
  "additionalProperties": false,
12
- "required": ["name", "version", "distribution"],
22
+ "type": "object",
23
+ "required": [
24
+ "name",
25
+ "version",
26
+ "distribution"
27
+ ],
13
28
  "properties": {
14
- "name": { "const": "archctx" },
15
- "version": { "$ref": "#/$defs/semver" },
16
- "distribution": { "enum": ["one-package"] }
29
+ "name": {
30
+ "const": "archctx"
31
+ },
32
+ "version": {
33
+ "$ref": "#/$defs/semver"
34
+ },
35
+ "distribution": {
36
+ "enum": [
37
+ "one-package"
38
+ ]
39
+ }
17
40
  }
18
41
  },
19
- "packageManager": { "type": "string", "minLength": 1 },
42
+ "packageManager": {
43
+ "minLength": 1,
44
+ "type": "string"
45
+ },
20
46
  "engines": {
21
- "type": "object",
22
47
  "additionalProperties": false,
23
- "required": ["node"],
48
+ "type": "object",
49
+ "required": [
50
+ "node"
51
+ ],
24
52
  "properties": {
25
- "node": { "const": ">=22.22 <26" }
53
+ "node": {
54
+ "const": ">=22.22 <26"
55
+ }
26
56
  }
27
57
  },
28
58
  "surfaces": {
29
- "type": "object",
30
59
  "additionalProperties": false,
31
- "required": ["cli", "daemon", "mcp"],
60
+ "type": "object",
61
+ "required": [
62
+ "cli",
63
+ "daemon"
64
+ ],
32
65
  "properties": {
33
- "cli": { "$ref": "#/$defs/surface" },
66
+ "cli": {
67
+ "$ref": "#/$defs/surface"
68
+ },
34
69
  "daemon": {
35
- "type": "object",
36
70
  "additionalProperties": false,
37
- "required": ["packageName", "version", "entrypoint", "rpcSchemaVersion"],
38
- "properties": {
39
- "packageName": { "type": "string", "minLength": 1 },
40
- "version": { "$ref": "#/$defs/semver" },
41
- "entrypoint": { "type": "string", "minLength": 1 },
42
- "rpcSchemaVersion": { "const": "archcontext.runtime-rpc/v2" }
43
- }
44
- },
45
- "mcp": {
46
71
  "type": "object",
47
- "additionalProperties": false,
48
- "required": ["packageName", "version", "entrypoint", "transport"],
72
+ "required": [
73
+ "packageName",
74
+ "version",
75
+ "entrypoint",
76
+ "rpcSchemaVersion"
77
+ ],
49
78
  "properties": {
50
- "packageName": { "type": "string", "minLength": 1 },
51
- "version": { "$ref": "#/$defs/semver" },
52
- "entrypoint": { "type": "string", "minLength": 1 },
53
- "transport": { "enum": ["stdio"] }
79
+ "packageName": {
80
+ "minLength": 1,
81
+ "type": "string"
82
+ },
83
+ "version": {
84
+ "$ref": "#/$defs/semver"
85
+ },
86
+ "entrypoint": {
87
+ "minLength": 1,
88
+ "type": "string"
89
+ },
90
+ "rpcSchemaVersion": {
91
+ "const": "archcontext.runtime-rpc/v2"
92
+ }
54
93
  }
55
94
  }
56
95
  }
57
96
  },
58
97
  "schemas": {
59
- "type": "object",
60
98
  "additionalProperties": false,
61
- "required": ["schemaSetVersion", "contractsPackageVersion"],
99
+ "type": "object",
100
+ "required": [
101
+ "schemaSetVersion",
102
+ "contractsPackageVersion"
103
+ ],
62
104
  "properties": {
63
- "schemaSetVersion": { "type": "string", "minLength": 1 },
64
- "contractsPackageVersion": { "$ref": "#/$defs/semver" }
105
+ "schemaSetVersion": {
106
+ "minLength": 1,
107
+ "type": "string"
108
+ },
109
+ "contractsPackageVersion": {
110
+ "$ref": "#/$defs/semver"
111
+ }
65
112
  }
66
113
  },
67
114
  "runtime": {
68
- "type": "object",
69
115
  "additionalProperties": false,
70
- "required": ["localRpc", "sqliteMigrations", "codeGraph"],
116
+ "type": "object",
117
+ "required": [
118
+ "localRpc",
119
+ "sqliteMigrations",
120
+ "codeGraph"
121
+ ],
71
122
  "properties": {
72
123
  "localRpc": {
73
- "type": "object",
74
124
  "additionalProperties": false,
75
- "required": ["schemaVersion", "protocol"],
125
+ "type": "object",
126
+ "required": [
127
+ "schemaVersion",
128
+ "protocol"
129
+ ],
76
130
  "properties": {
77
- "schemaVersion": { "const": "archcontext.runtime-rpc/v2" },
78
- "protocol": { "enum": ["http-loopback"] }
131
+ "schemaVersion": {
132
+ "const": "archcontext.runtime-rpc/v2"
133
+ },
134
+ "protocol": {
135
+ "enum": [
136
+ "http-loopback"
137
+ ]
138
+ }
79
139
  }
80
140
  },
81
- "sqliteMigrations": { "type": "string", "minLength": 1 },
141
+ "sqliteMigrations": {
142
+ "minLength": 1,
143
+ "type": "string"
144
+ },
82
145
  "codeGraph": {
83
- "type": "object",
84
146
  "additionalProperties": false,
85
- "required": ["packageName", "requiredVersion", "adapter"],
147
+ "type": "object",
148
+ "required": [
149
+ "packageName",
150
+ "requiredVersion",
151
+ "adapter"
152
+ ],
86
153
  "properties": {
87
- "packageName": { "const": "@colbymchenry/codegraph" },
88
- "requiredVersion": { "type": "string", "minLength": 1 },
89
- "adapter": { "enum": ["codegraph-cli"] }
154
+ "packageName": {
155
+ "const": "@colbymchenry/codegraph"
156
+ },
157
+ "requiredVersion": {
158
+ "minLength": 1,
159
+ "type": "string"
160
+ },
161
+ "adapter": {
162
+ "enum": [
163
+ "codegraph-cli"
164
+ ]
165
+ }
90
166
  }
91
167
  }
92
168
  }
@@ -94,17 +170,29 @@
94
170
  },
95
171
  "$defs": {
96
172
  "semver": {
97
- "type": "string",
98
- "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
173
+ "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$",
174
+ "type": "string"
99
175
  },
100
176
  "surface": {
101
- "type": "object",
102
177
  "additionalProperties": false,
103
- "required": ["packageName", "version", "entrypoint"],
178
+ "type": "object",
179
+ "required": [
180
+ "packageName",
181
+ "version",
182
+ "entrypoint"
183
+ ],
104
184
  "properties": {
105
- "packageName": { "type": "string", "minLength": 1 },
106
- "version": { "$ref": "#/$defs/semver" },
107
- "entrypoint": { "type": "string", "minLength": 1 }
185
+ "packageName": {
186
+ "minLength": 1,
187
+ "type": "string"
188
+ },
189
+ "version": {
190
+ "$ref": "#/$defs/semver"
191
+ },
192
+ "entrypoint": {
193
+ "minLength": 1,
194
+ "type": "string"
195
+ }
108
196
  }
109
197
  }
110
198
  }
@@ -3,8 +3,29 @@
3
3
  "$id": "https://archcontext.dev/schemas/runtime/projection-slice.schema.json",
4
4
  "title": "ProjectionSliceV1",
5
5
  "description": "Read-only pull request projection of capability diagrams and entrypoint anchors from the same merge base and HEAD used to select changed paths.",
6
- "type": "object",
7
6
  "additionalProperties": false,
7
+ "if": {
8
+ "properties": {
9
+ "changed": {
10
+ "const": true
11
+ }
12
+ }
13
+ },
14
+ "then": {
15
+ "properties": {
16
+ "affectedCapabilities": {
17
+ "minItems": 1
18
+ }
19
+ }
20
+ },
21
+ "else": {
22
+ "properties": {
23
+ "affectedCapabilities": {
24
+ "maxItems": 0
25
+ }
26
+ }
27
+ },
28
+ "type": "object",
8
29
  "required": [
9
30
  "schemaVersion",
10
31
  "base",
@@ -33,12 +54,12 @@
33
54
  "$ref": "#/$defs/sha"
34
55
  },
35
56
  "changedPaths": {
36
- "type": "array",
37
57
  "uniqueItems": true,
58
+ "description": "Sorted union of paths changed between the merge base and HEAD and explicit changed path overrides.",
59
+ "type": "array",
38
60
  "items": {
39
61
  "$ref": "#/$defs/nonEmpty"
40
- },
41
- "description": "Sorted union of paths changed between the merge base and HEAD and explicit changed path overrides."
62
+ }
42
63
  },
43
64
  "changed": {
44
65
  "type": "boolean"
@@ -53,39 +74,18 @@
53
74
  "$ref": "#/$defs/nonEmpty"
54
75
  }
55
76
  },
56
- "if": {
57
- "properties": {
58
- "changed": {
59
- "const": true
60
- }
61
- }
62
- },
63
- "then": {
64
- "properties": {
65
- "affectedCapabilities": {
66
- "minItems": 1
67
- }
68
- }
69
- },
70
- "else": {
71
- "properties": {
72
- "affectedCapabilities": {
73
- "maxItems": 0
74
- }
75
- }
76
- },
77
77
  "$defs": {
78
78
  "sha": {
79
- "type": "string",
80
- "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
79
+ "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$",
80
+ "type": "string"
81
81
  },
82
82
  "nonEmpty": {
83
- "type": "string",
84
- "minLength": 1
83
+ "minLength": 1,
84
+ "type": "string"
85
85
  },
86
86
  "capability": {
87
- "type": "object",
88
87
  "additionalProperties": false,
88
+ "type": "object",
89
89
  "required": [
90
90
  "capabilityId",
91
91
  "modulePath",
@@ -101,12 +101,12 @@
101
101
  "$ref": "#/$defs/nonEmpty"
102
102
  },
103
103
  "diagramMermaid": {
104
+ "minLength": 1,
105
+ "description": "Unfenced Mermaid or null when the capability was removed or its P1 diagram is unprovable.",
104
106
  "type": [
105
107
  "string",
106
108
  "null"
107
- ],
108
- "minLength": 1,
109
- "description": "Unfenced Mermaid or null when the capability was removed or its P1 diagram is unprovable."
109
+ ]
110
110
  },
111
111
  "entrypoints": {
112
112
  "type": "array",
@@ -120,8 +120,8 @@
120
120
  }
121
121
  },
122
122
  "entrypoint": {
123
- "type": "object",
124
123
  "additionalProperties": false,
124
+ "type": "object",
125
125
  "required": [
126
126
  "nodeId",
127
127
  "entrypointId",