archctx-contracts 0.7.2 → 0.8.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 (58) hide show
  1. package/fixtures/invalid/hook-debt-checkpoint-failed-read.json +54 -0
  2. package/fixtures/invalid/native-context-invalid-model-summary.json +635 -0
  3. package/fixtures/invalid/native-context-missing-contract-bytes.json +636 -0
  4. package/fixtures/invalid/native-context-missing-input-bytes.json +636 -0
  5. package/fixtures/invalid/native-context-mixed-snapshot.json +637 -0
  6. package/fixtures/invalid/projection-result-applied-incomplete-coverage.json +78 -0
  7. package/fixtures/invalid/refactor-decision-open-status.json +38 -0
  8. package/fixtures/valid/archctx-capabilities.json +3 -3
  9. package/fixtures/valid/capability-dependencies.json +1 -1
  10. package/fixtures/valid/docs-anchors.json +2 -1
  11. package/fixtures/valid/flow-selector-check.json +1 -1
  12. package/fixtures/valid/hook-debt-checkpoint.json +54 -0
  13. package/fixtures/valid/native-context-export.json +636 -0
  14. package/fixtures/valid/product-version-manifest.json +8 -8
  15. package/fixtures/valid/projection-manifest.json +47 -169
  16. package/fixtures/valid/projection-result.json +5 -5
  17. package/fixtures/valid/refactor-decision.json +38 -0
  18. package/fixtures/valid/runtime-recommendation-show.json +1 -0
  19. package/fixtures/valid/runtime-refactor-scan.json +6 -0
  20. package/package.json +1 -1
  21. package/schemas/repo/refactor-decision.schema.json +218 -0
  22. package/schemas/runtime/archctx-capabilities.schema.json +2 -2
  23. package/schemas/runtime/architecture-debt.schema.json +222 -0
  24. package/schemas/runtime/capability-dependencies.schema.json +10 -6
  25. package/schemas/runtime/changeset.schema.json +24 -1
  26. package/schemas/runtime/docs-anchors.schema.json +4 -3
  27. package/schemas/runtime/hook-debt-checkpoint.schema.json +69 -0
  28. package/schemas/runtime/native-context-export.schema.json +823 -0
  29. package/schemas/runtime/native-model-issue.schema.json +18 -0
  30. package/schemas/runtime/practice-checkpoint.schema.json +1 -0
  31. package/schemas/runtime/product-version-manifest.schema.json +2 -2
  32. package/schemas/runtime/projection-apply-readback.schema.json +470 -7
  33. package/schemas/runtime/projection-apply-recovery.schema.json +2 -2
  34. package/schemas/runtime/projection-manifest.schema.json +81 -186
  35. package/schemas/runtime/projection-result.schema.json +132 -5
  36. package/schemas/runtime/projection-target.schema.json +4 -1
  37. package/schemas/runtime/recommendation-v3.schema.json +106 -0
  38. package/schemas/runtime/review-result.schema.json +1 -0
  39. package/schemas/runtime/runtime-recommendation-show.schema.json +234 -13
  40. package/schemas/runtime/runtime-refactor-scan.schema.json +171 -0
  41. package/schemas/runtime/structural-observation-payload.schema.json +106 -0
  42. package/src/architecture-debt.ts +115 -0
  43. package/src/changeset-recovery.ts +49 -0
  44. package/src/docs-anchors.ts +2 -1
  45. package/src/failure.ts +810 -0
  46. package/src/index.ts +6 -0
  47. package/src/ledger.ts +14 -3
  48. package/src/native-context.ts +279 -0
  49. package/src/ownership-dependencies.ts +39 -1
  50. package/src/ports.ts +4 -0
  51. package/src/practices.ts +2 -0
  52. package/src/product-version.ts +37 -4
  53. package/src/projection-manifest.ts +372 -130
  54. package/src/projection-recovery.ts +111 -0
  55. package/src/projection.ts +443 -11
  56. package/src/refactor.ts +525 -2
  57. package/src/schema.ts +8 -0
  58. package/src/validator.ts +8 -3
@@ -0,0 +1,222 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archctx.repoharness.com/schemas/runtime/architecture-debt.schema.json",
4
+ "title": "ArchitectureDebtReportV1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "scope",
10
+ "coverage",
11
+ "coverageReasonCodes",
12
+ "checks",
13
+ "items",
14
+ "actionsRequired",
15
+ "digest"
16
+ ],
17
+ "properties": {
18
+ "schemaVersion": {
19
+ "const": "archcontext.architecture-debt/v1"
20
+ },
21
+ "scope": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": [
25
+ "kind",
26
+ "changedPaths",
27
+ "capabilityIds"
28
+ ],
29
+ "properties": {
30
+ "kind": {
31
+ "enum": [
32
+ "repository",
33
+ "changed-paths"
34
+ ]
35
+ },
36
+ "changedPaths": {
37
+ "type": "array",
38
+ "uniqueItems": true,
39
+ "items": {
40
+ "type": "string",
41
+ "minLength": 1,
42
+ "maxLength": 1024
43
+ }
44
+ },
45
+ "capabilityIds": {
46
+ "type": "array",
47
+ "uniqueItems": true,
48
+ "items": {
49
+ "type": "string",
50
+ "minLength": 1,
51
+ "maxLength": 1024
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "coverage": {
57
+ "enum": [
58
+ "complete",
59
+ "partial",
60
+ "unknown"
61
+ ]
62
+ },
63
+ "coverageReasonCodes": {
64
+ "type": "array",
65
+ "uniqueItems": true,
66
+ "items": {
67
+ "type": "string",
68
+ "minLength": 1,
69
+ "maxLength": 1024
70
+ }
71
+ },
72
+ "checks": {
73
+ "type": "array",
74
+ "minItems": 5,
75
+ "maxItems": 5,
76
+ "items": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": [
80
+ "check",
81
+ "coverage",
82
+ "reasonCodes"
83
+ ],
84
+ "properties": {
85
+ "check": {
86
+ "enum": [
87
+ "ownership",
88
+ "anchors",
89
+ "dependencies",
90
+ "flows",
91
+ "practices"
92
+ ]
93
+ },
94
+ "coverage": {
95
+ "enum": [
96
+ "complete",
97
+ "partial",
98
+ "unknown"
99
+ ]
100
+ },
101
+ "reasonCodes": {
102
+ "type": "array",
103
+ "uniqueItems": true,
104
+ "items": {
105
+ "type": "string",
106
+ "minLength": 1,
107
+ "maxLength": 1024
108
+ }
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "items": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "object",
117
+ "additionalProperties": false,
118
+ "required": [
119
+ "id",
120
+ "kind",
121
+ "nodeIds",
122
+ "capabilityIds",
123
+ "paths",
124
+ "reasonCode",
125
+ "action",
126
+ "details"
127
+ ],
128
+ "properties": {
129
+ "id": {
130
+ "type": "string",
131
+ "pattern": "^debt\\.[a-f0-9]{64}$"
132
+ },
133
+ "kind": {
134
+ "enum": [
135
+ "unowned-path",
136
+ "ambiguous-owner",
137
+ "undeclared-dependency",
138
+ "flow-proof-failed",
139
+ "stale-anchor",
140
+ "practice-regression"
141
+ ]
142
+ },
143
+ "nodeIds": {
144
+ "type": "array",
145
+ "uniqueItems": true,
146
+ "items": {
147
+ "type": "string",
148
+ "minLength": 1,
149
+ "maxLength": 1024
150
+ }
151
+ },
152
+ "capabilityIds": {
153
+ "type": "array",
154
+ "uniqueItems": true,
155
+ "items": {
156
+ "type": "string",
157
+ "minLength": 1,
158
+ "maxLength": 1024
159
+ }
160
+ },
161
+ "paths": {
162
+ "type": "array",
163
+ "uniqueItems": true,
164
+ "items": {
165
+ "type": "string",
166
+ "minLength": 1,
167
+ "maxLength": 1024
168
+ }
169
+ },
170
+ "reasonCode": {
171
+ "type": "string",
172
+ "minLength": 1,
173
+ "maxLength": 1024
174
+ },
175
+ "action": {
176
+ "type": "string",
177
+ "minLength": 1,
178
+ "maxLength": 1024
179
+ },
180
+ "details": {
181
+ "type": "object",
182
+ "maxProperties": 12,
183
+ "additionalProperties": {
184
+ "oneOf": [
185
+ {
186
+ "type": "string",
187
+ "minLength": 1,
188
+ "maxLength": 1024
189
+ },
190
+ {
191
+ "type": "integer"
192
+ },
193
+ {
194
+ "type": "array",
195
+ "uniqueItems": true,
196
+ "items": {
197
+ "type": "string",
198
+ "minLength": 1,
199
+ "maxLength": 1024
200
+ }
201
+ }
202
+ ]
203
+ }
204
+ }
205
+ }
206
+ }
207
+ },
208
+ "actionsRequired": {
209
+ "type": "array",
210
+ "uniqueItems": true,
211
+ "items": {
212
+ "type": "string",
213
+ "minLength": 1,
214
+ "maxLength": 1024
215
+ }
216
+ },
217
+ "digest": {
218
+ "type": "string",
219
+ "pattern": "^sha256:[a-f0-9]{64}$"
220
+ }
221
+ }
222
+ }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://archcontext.dev/schemas/runtime/capability-dependencies.schema.json",
4
4
  "title": "CapabilityDependenciesV1",
5
- "description": "The data of `archctx deps`: a read-only capability x capability import matrix. Owners come from the parent-chain rule `refactor scan` uses, rolled up to the nearest capability. Call counts are not available in v1.",
5
+ "description": "The data of `archctx deps`: a read-only capability x capability import matrix. Owners come from the parent-chain rule `refactor scan` uses, rolled up to the nearest capability. Each cell says whether a model relation declares it. Call counts are not available in v1. Without code facts that attest to the measured tree, deps refuses with AC_CODE_FACTS_UNAVAILABLE instead of returning this data.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "required": ["schemaVersion", "ownershipRule", "filter", "capabilities", "matrix", "imports", "calls", "edges", "worktree", "privacy"],
@@ -24,13 +24,17 @@
24
24
  "items": {
25
25
  "type": "object",
26
26
  "additionalProperties": false,
27
- "required": ["from", "to", "imports", "calls"],
27
+ "required": ["from", "to", "imports", "calls", "declared", "relationIds"],
28
28
  "properties": {
29
29
  "from": { "type": "string", "minLength": 1 },
30
30
  "to": { "type": "string", "minLength": 1 },
31
31
  "imports": { "type": "integer", "minimum": 1 },
32
- "calls": { "type": "null" }
33
- }
32
+ "calls": { "type": "null" },
33
+ "declared": { "type": "boolean", "description": "A relation of a declaring kind (every kind but deployed-on) runs from a node that rolls up to `from` into a node that rolls up to `to`. A cell with from equal to to is always declared and lists no relation ids." },
34
+ "relationIds": { "type": "array", "uniqueItems": true, "description": "The declaring relation ids, sorted. Non-empty exactly when a cross-capability cell is declared.", "items": { "type": "string", "minLength": 1 } }
35
+ },
36
+ "if": { "properties": { "relationIds": { "minItems": 1 } } },
37
+ "then": { "properties": { "declared": { "const": true } } }
34
38
  }
35
39
  },
36
40
  "imports": {
@@ -38,11 +42,11 @@
38
42
  "additionalProperties": false,
39
43
  "required": ["coverage", "reasonCodes", "truncated", "importNodeCount", "importNodeLimit", "importNodeLimitExceeded", "edgeCount", "unresolvedCount", "unattributed"],
40
44
  "properties": {
41
- "coverage": { "enum": ["complete", "partial", "unknown"] },
45
+ "coverage": { "enum": ["complete", "partial"] },
42
46
  "reasonCodes": {
43
47
  "type": "array",
44
48
  "uniqueItems": true,
45
- "items": { "enum": ["code-facts-import-limit", "code-facts-stale", "code-facts-truncated", "code-facts-unavailable"] }
49
+ "items": { "enum": ["code-facts-import-limit", "code-facts-truncated"] }
46
50
  },
47
51
  "truncated": { "type": "boolean" },
48
52
  "importNodeCount": { "type": ["integer", "null"], "minimum": 0 },
@@ -93,7 +93,8 @@
93
93
  "write_policy",
94
94
  "write_waiver",
95
95
  "render_projection",
96
- "render_agent_context"
96
+ "render_agent_context",
97
+ "write_refactor_decision"
97
98
  ]
98
99
  },
99
100
  "entityId": {
@@ -150,6 +151,28 @@
150
151
  "const": true
151
152
  }
152
153
  }
154
+ },
155
+ {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "description": "Binds one projection-owned file the write set carries forward unchanged; accepted only by render_projection with the exact body hash the render read. Nothing is written; the apply fails unless the file still has that hash immediately before the commit.",
159
+ "required": [
160
+ "path",
161
+ "expectedHash",
162
+ "guard"
163
+ ],
164
+ "properties": {
165
+ "path": {
166
+ "type": "string"
167
+ },
168
+ "expectedHash": {
169
+ "type": "string",
170
+ "pattern": "^sha256:[a-f0-9]{64}$"
171
+ },
172
+ "guard": {
173
+ "const": true
174
+ }
175
+ }
153
176
  }
154
177
  ]
155
178
  }
@@ -41,12 +41,13 @@
41
41
  "byKind": {
42
42
  "type": "object",
43
43
  "additionalProperties": false,
44
- "required": ["line-moved", "line-out-of-range", "missing-path", "missing-symbol"],
44
+ "required": ["line-moved", "line-out-of-range", "missing-path", "missing-symbol", "unknown-selector"],
45
45
  "properties": {
46
46
  "line-moved": { "$ref": "#/$defs/count" },
47
47
  "line-out-of-range": { "$ref": "#/$defs/count" },
48
48
  "missing-path": { "$ref": "#/$defs/count" },
49
- "missing-symbol": { "$ref": "#/$defs/count" }
49
+ "missing-symbol": { "$ref": "#/$defs/count" },
50
+ "unknown-selector": { "$ref": "#/$defs/count" }
50
51
  }
51
52
  }
52
53
  }
@@ -122,7 +123,7 @@
122
123
  "additionalProperties": false,
123
124
  "required": ["kind", "origin", "citation"],
124
125
  "properties": {
125
- "kind": { "enum": ["line-moved", "line-out-of-range", "missing-path", "missing-symbol"] },
126
+ "kind": { "enum": ["line-moved", "line-out-of-range", "missing-path", "missing-symbol", "unknown-selector"] },
126
127
  "origin": { "$ref": "#/$defs/origin" },
127
128
  "citation": { "$ref": "#/$defs/citation" },
128
129
  "lineCount": { "$ref": "#/$defs/count" },
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archctx.repoharness.com/schemas/runtime/hook-debt-checkpoint.schema.json",
4
+ "title": "ArchitectureDebtHookCheckpointV1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "debt",
10
+ "hookLog"
11
+ ],
12
+ "properties": {
13
+ "schemaVersion": {
14
+ "const": "archcontext.hook-debt-checkpoint/v1"
15
+ },
16
+ "debt": {
17
+ "$ref": "architecture-debt.schema.json"
18
+ },
19
+ "hookLog": {
20
+ "type": "object",
21
+ "additionalProperties": false,
22
+ "required": [
23
+ "schemaVersion",
24
+ "event",
25
+ "elapsedMs",
26
+ "pathCount",
27
+ "changedPathDigest",
28
+ "reasonCode",
29
+ "failOpen",
30
+ "egress",
31
+ "network"
32
+ ],
33
+ "properties": {
34
+ "schemaVersion": {
35
+ "const": "archcontext.hook-log/v1"
36
+ },
37
+ "event": {
38
+ "type": "string",
39
+ "minLength": 1
40
+ },
41
+ "elapsedMs": {
42
+ "type": "number",
43
+ "minimum": 0
44
+ },
45
+ "pathCount": {
46
+ "type": "integer",
47
+ "minimum": 0
48
+ },
49
+ "changedPathDigest": {
50
+ "type": "string",
51
+ "pattern": "^sha256:[0-9a-f]{64}$"
52
+ },
53
+ "reasonCode": {
54
+ "type": "string",
55
+ "minLength": 1
56
+ },
57
+ "failOpen": {
58
+ "const": false
59
+ },
60
+ "egress": {
61
+ "const": "none"
62
+ },
63
+ "network": {
64
+ "const": "forbidden"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }