archctx-contracts 0.16.0 → 0.17.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.
- package/fixtures/valid/archctx-capabilities.json +2 -2
- package/fixtures/valid/architecture-debt-delta.json +68 -0
- package/fixtures/valid/product-version-manifest.json +5 -5
- package/fixtures/valid/projection-slice.json +28 -0
- package/fixtures/valid/ref-impact-batch-request.json +11 -0
- package/fixtures/valid/ref-impact-batch.json +78 -0
- package/fixtures/valid/runtime-refactor-scan.json +2 -0
- package/fixtures/valid/runtime-verify.json +169 -0
- package/package.json +1 -1
- package/schemas/repo/constraint.schema.json +10 -1
- package/schemas/repo/refactor-decision.schema.json +5 -0
- package/schemas/runtime/archctx-capabilities.schema.json +1 -1
- package/schemas/runtime/architecture-debt-delta.schema.json +47 -0
- package/schemas/runtime/dependency-constraint-evaluation.schema.json +1 -0
- package/schemas/runtime/projection-slice.schema.json +147 -0
- package/schemas/runtime/ref-impact-batch-request.schema.json +26 -0
- package/schemas/runtime/ref-impact-batch.schema.json +38 -0
- package/schemas/runtime/runtime-recommendation-show.schema.json +5 -0
- package/schemas/runtime/runtime-refactor-scan.schema.json +18 -0
- package/schemas/runtime/runtime-verify.schema.json +131 -0
- package/src/architecture-debt.ts +18 -0
- package/src/architecture.ts +6 -4
- package/src/failure.ts +11 -0
- package/src/index.ts +1 -0
- package/src/ports.ts +2 -0
- package/src/product-version.ts +1 -1
- package/src/projection.ts +30 -0
- package/src/ref-impact.ts +33 -0
- package/src/refactor.ts +23 -1
- package/src/runtime-verify.ts +28 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://archcontext.dev/schemas/runtime/projection-slice.schema.json",
|
|
4
|
+
"title": "ProjectionSliceV1",
|
|
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
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"schemaVersion",
|
|
10
|
+
"base",
|
|
11
|
+
"baseSha",
|
|
12
|
+
"mergeBase",
|
|
13
|
+
"headSha",
|
|
14
|
+
"changedPaths",
|
|
15
|
+
"changed",
|
|
16
|
+
"affectedCapabilities",
|
|
17
|
+
"markdown"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"schemaVersion": {
|
|
21
|
+
"const": "archcontext.projection-slice/v1"
|
|
22
|
+
},
|
|
23
|
+
"base": {
|
|
24
|
+
"$ref": "#/$defs/nonEmpty"
|
|
25
|
+
},
|
|
26
|
+
"baseSha": {
|
|
27
|
+
"$ref": "#/$defs/sha"
|
|
28
|
+
},
|
|
29
|
+
"mergeBase": {
|
|
30
|
+
"$ref": "#/$defs/sha"
|
|
31
|
+
},
|
|
32
|
+
"headSha": {
|
|
33
|
+
"$ref": "#/$defs/sha"
|
|
34
|
+
},
|
|
35
|
+
"changedPaths": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"uniqueItems": true,
|
|
38
|
+
"items": {
|
|
39
|
+
"$ref": "#/$defs/nonEmpty"
|
|
40
|
+
},
|
|
41
|
+
"description": "Sorted union of paths changed between the merge base and HEAD and explicit changed path overrides."
|
|
42
|
+
},
|
|
43
|
+
"changed": {
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
},
|
|
46
|
+
"affectedCapabilities": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"$ref": "#/$defs/capability"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"markdown": {
|
|
53
|
+
"$ref": "#/$defs/nonEmpty"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
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
|
+
"$defs": {
|
|
78
|
+
"sha": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
81
|
+
},
|
|
82
|
+
"nonEmpty": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"minLength": 1
|
|
85
|
+
},
|
|
86
|
+
"capability": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"required": [
|
|
90
|
+
"capabilityId",
|
|
91
|
+
"modulePath",
|
|
92
|
+
"diagramMermaid",
|
|
93
|
+
"entrypoints",
|
|
94
|
+
"markdown"
|
|
95
|
+
],
|
|
96
|
+
"properties": {
|
|
97
|
+
"capabilityId": {
|
|
98
|
+
"$ref": "#/$defs/nonEmpty"
|
|
99
|
+
},
|
|
100
|
+
"modulePath": {
|
|
101
|
+
"$ref": "#/$defs/nonEmpty"
|
|
102
|
+
},
|
|
103
|
+
"diagramMermaid": {
|
|
104
|
+
"type": [
|
|
105
|
+
"string",
|
|
106
|
+
"null"
|
|
107
|
+
],
|
|
108
|
+
"minLength": 1,
|
|
109
|
+
"description": "Unfenced Mermaid or null when the capability was removed or its P1 diagram is unprovable."
|
|
110
|
+
},
|
|
111
|
+
"entrypoints": {
|
|
112
|
+
"type": "array",
|
|
113
|
+
"items": {
|
|
114
|
+
"$ref": "#/$defs/entrypoint"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"markdown": {
|
|
118
|
+
"$ref": "#/$defs/nonEmpty"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"entrypoint": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"additionalProperties": false,
|
|
125
|
+
"required": [
|
|
126
|
+
"nodeId",
|
|
127
|
+
"entrypointId",
|
|
128
|
+
"path",
|
|
129
|
+
"symbol"
|
|
130
|
+
],
|
|
131
|
+
"properties": {
|
|
132
|
+
"nodeId": {
|
|
133
|
+
"$ref": "#/$defs/nonEmpty"
|
|
134
|
+
},
|
|
135
|
+
"entrypointId": {
|
|
136
|
+
"$ref": "#/$defs/nonEmpty"
|
|
137
|
+
},
|
|
138
|
+
"path": {
|
|
139
|
+
"$ref": "#/$defs/nonEmpty"
|
|
140
|
+
},
|
|
141
|
+
"symbol": {
|
|
142
|
+
"$ref": "#/$defs/nonEmpty"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://archcontext.dev/schemas/runtime/ref-impact-batch-request.schema.json",
|
|
4
|
+
"title": "RefImpactBatchRequestV1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "items"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": "archcontext.ref-impact-batch-request/v1" },
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"required": ["id", "paths"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"id": { "type": "string" },
|
|
18
|
+
"paths": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": { "type": "string", "pattern": "^(?!/)(?![\\s\\S]*(?:^|/)\\.\\.(?:/|(?![\\s\\S])))[^\\\\\u0000]+$" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://archcontext.dev/schemas/runtime/ref-impact-batch.schema.json",
|
|
4
|
+
"title": "RefImpactBatchV1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "items"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": "archcontext.ref-impact-batch/v1" },
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"description": "One impact or response-limit status per request item, in request order.",
|
|
13
|
+
"items": {
|
|
14
|
+
"oneOf": [
|
|
15
|
+
{
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": ["id", "impact"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"id": { "type": "string" },
|
|
21
|
+
"impact": { "$ref": "https://archctx.repoharness.com/schemas/runtime/ref-impact.schema.json" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": ["id", "status", "reasonCode"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"id": { "type": "string" },
|
|
30
|
+
"status": { "const": "unavailable" },
|
|
31
|
+
"reasonCode": { "const": "batch-response-bytes" }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1811,6 +1811,11 @@
|
|
|
1811
1811
|
"schemaVersion": {
|
|
1812
1812
|
"const": "archcontext.module-statistics/v1"
|
|
1813
1813
|
},
|
|
1814
|
+
"scope": {
|
|
1815
|
+
"$ref": "#/$defs/refactorScope",
|
|
1816
|
+
"not": { "properties": { "kind": { "const": "repository" } } },
|
|
1817
|
+
"description": "Present for statistics measured over the requested files and their direct import neighbors."
|
|
1818
|
+
},
|
|
1814
1819
|
"repository": {
|
|
1815
1820
|
"$ref": "#/$defs/repositoryIdentity"
|
|
1816
1821
|
},
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
"request",
|
|
14
14
|
"trackedFileCount",
|
|
15
15
|
"snapshot",
|
|
16
|
+
"snapshotDigest",
|
|
16
17
|
"assessment",
|
|
17
18
|
"proposedRecommendations",
|
|
19
|
+
"openRecommendations",
|
|
18
20
|
"evidenceItems",
|
|
19
21
|
"evidenceBindings",
|
|
20
22
|
"suppressed",
|
|
@@ -56,6 +58,10 @@
|
|
|
56
58
|
"snapshot": {
|
|
57
59
|
"$ref": "#/$defs/moduleStatisticsSnapshot"
|
|
58
60
|
},
|
|
61
|
+
"snapshotDigest": {
|
|
62
|
+
"$ref": "#/$defs/sha256",
|
|
63
|
+
"description": "Daemon-memory snapshot handle for recommendations accept, defer and reject. Pass this top-level digest to --snapshot-digest."
|
|
64
|
+
},
|
|
59
65
|
"assessment": {
|
|
60
66
|
"$ref": "#/$defs/refactorAssessment"
|
|
61
67
|
},
|
|
@@ -68,6 +74,13 @@
|
|
|
68
74
|
"$ref": "#/$defs/recommendationV3"
|
|
69
75
|
}
|
|
70
76
|
},
|
|
77
|
+
"openRecommendations": {
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": {
|
|
80
|
+
"$ref": "#/$defs/recommendationV3"
|
|
81
|
+
},
|
|
82
|
+
"description": "Current open refactor recommendations in the scan namespace and requested scope."
|
|
83
|
+
},
|
|
71
84
|
"evidenceItems": {
|
|
72
85
|
"type": "array",
|
|
73
86
|
"items": {
|
|
@@ -1840,6 +1853,11 @@
|
|
|
1840
1853
|
"schemaVersion": {
|
|
1841
1854
|
"const": "archcontext.module-statistics/v1"
|
|
1842
1855
|
},
|
|
1856
|
+
"scope": {
|
|
1857
|
+
"$ref": "#/$defs/refactorScope",
|
|
1858
|
+
"not": { "properties": { "kind": { "const": "repository" } } },
|
|
1859
|
+
"description": "Present for statistics measured over the requested files and their direct import neighbors."
|
|
1860
|
+
},
|
|
1843
1861
|
"repository": {
|
|
1844
1862
|
"$ref": "#/$defs/repositoryIdentity"
|
|
1845
1863
|
},
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://archcontext.dev/schemas/runtime/runtime-verify.schema.json",
|
|
4
|
+
"title": "RuntimeVerifyV1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "base", "baseSha", "headSha", "checks"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": { "const": "archcontext.runtime-verify/v1" },
|
|
10
|
+
"base": { "type": "string", "minLength": 1 },
|
|
11
|
+
"baseSha": { "$ref": "#/$defs/oid" },
|
|
12
|
+
"headSha": { "$ref": "#/$defs/oid" },
|
|
13
|
+
"checks": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"required": ["validate", "flows", "state-machines", "constraints", "docs", "projection", "debt"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"validate": {
|
|
19
|
+
"oneOf": [
|
|
20
|
+
{ "$ref": "#/$defs/failed" },
|
|
21
|
+
{ "allOf": [{ "$ref": "#/$defs/passed" }, { "properties": { "data": { "$ref": "#/$defs/validation" } } }] }
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"flows": {
|
|
25
|
+
"oneOf": [
|
|
26
|
+
{ "$ref": "#/$defs/failed" },
|
|
27
|
+
{ "allOf": [{ "$ref": "#/$defs/passed" }, { "properties": { "data": { "$ref": "flow-selector-check.schema.json" } } }] }
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"state-machines": {
|
|
31
|
+
"oneOf": [
|
|
32
|
+
{ "$ref": "#/$defs/failed" },
|
|
33
|
+
{ "allOf": [{ "$ref": "#/$defs/passed" }, { "properties": { "data": { "$ref": "state-machine-check.schema.json" } } }] }
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"constraints": {
|
|
37
|
+
"oneOf": [
|
|
38
|
+
{ "$ref": "#/$defs/failed" },
|
|
39
|
+
{ "allOf": [{ "$ref": "#/$defs/passed" }, { "properties": { "data": { "$ref": "dependency-constraint-evaluation.schema.json" } } }] }
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"docs": {
|
|
43
|
+
"oneOf": [
|
|
44
|
+
{ "$ref": "#/$defs/failed" },
|
|
45
|
+
{ "allOf": [{ "$ref": "#/$defs/passed" }, { "properties": { "data": { "$ref": "docs-anchors.schema.json" } } }] }
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"projection": {
|
|
49
|
+
"oneOf": [
|
|
50
|
+
{ "$ref": "#/$defs/failed" },
|
|
51
|
+
{ "allOf": [{ "$ref": "#/$defs/passed" }, { "properties": { "data": { "$ref": "projection-pr-verification.schema.json" } } }] }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"debt": {
|
|
55
|
+
"oneOf": [
|
|
56
|
+
{ "$ref": "#/$defs/failed" },
|
|
57
|
+
{ "allOf": [{ "$ref": "#/$defs/passed" }, { "properties": { "data": { "$ref": "https://archctx.repoharness.com/schemas/runtime/architecture-debt.schema.json" } } }] }
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"$defs": {
|
|
64
|
+
"oid": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" },
|
|
65
|
+
"strings": { "type": "array", "items": { "type": "string" } },
|
|
66
|
+
"passed": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"additionalProperties": false,
|
|
69
|
+
"required": ["ok", "data"],
|
|
70
|
+
"properties": { "ok": { "const": true }, "data": {} }
|
|
71
|
+
},
|
|
72
|
+
"failed": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"required": ["ok", "error"],
|
|
76
|
+
"properties": {
|
|
77
|
+
"ok": { "const": false },
|
|
78
|
+
"error": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"required": ["code", "message", "severity", "retryable", "action"],
|
|
82
|
+
"properties": {
|
|
83
|
+
"code": { "type": "string", "pattern": "^AC_[A-Z_]+$" },
|
|
84
|
+
"message": { "type": "string" },
|
|
85
|
+
"severity": { "enum": ["notice", "warning", "error", "critical"] },
|
|
86
|
+
"retryable": { "type": "boolean" },
|
|
87
|
+
"action": { "type": "string" },
|
|
88
|
+
"reasonCode": { "type": "string" },
|
|
89
|
+
"details": { "type": "object" }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"validation": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"additionalProperties": false,
|
|
97
|
+
"required": ["valid", "errors", "modelDigest"],
|
|
98
|
+
"properties": {
|
|
99
|
+
"valid": { "type": "boolean" },
|
|
100
|
+
"errors": { "$ref": "#/$defs/strings" },
|
|
101
|
+
"modelDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
102
|
+
"referenceErrors": { "$ref": "#/$defs/strings" },
|
|
103
|
+
"layerOrderErrors": { "$ref": "#/$defs/strings" },
|
|
104
|
+
"allowedTargetErrors": { "$ref": "#/$defs/strings" },
|
|
105
|
+
"warnings": { "$ref": "#/$defs/strings" },
|
|
106
|
+
"diagnostics": {
|
|
107
|
+
"type": "array",
|
|
108
|
+
"items": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"additionalProperties": false,
|
|
111
|
+
"required": ["path", "code", "error"],
|
|
112
|
+
"properties": {
|
|
113
|
+
"path": { "type": "string" },
|
|
114
|
+
"code": { "enum": ["missing-file", "schema-version-missing", "node-schema-invalid"] },
|
|
115
|
+
"error": { "type": "string" }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"nodeSchemaErrors": {
|
|
120
|
+
"type": "array",
|
|
121
|
+
"items": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"required": ["path", "error"],
|
|
125
|
+
"properties": { "path": { "type": "string" }, "error": { "type": "string" } }
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
package/src/architecture-debt.ts
CHANGED
|
@@ -40,6 +40,24 @@ export interface ArchitectureDebtReportV1 {
|
|
|
40
40
|
digest: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export const ARCHITECTURE_DEBT_DELTA_SCHEMA_VERSION = "archcontext.architecture-debt-delta/v1" as const;
|
|
44
|
+
|
|
45
|
+
export interface ArchitectureDebtDeltaReportV1 {
|
|
46
|
+
schemaVersion: typeof ARCHITECTURE_DEBT_DELTA_SCHEMA_VERSION;
|
|
47
|
+
/** The current working tree, anchored to its checked-out commit. */
|
|
48
|
+
head: { sha: string; debt: ArchitectureDebtReportV1 };
|
|
49
|
+
base: {
|
|
50
|
+
ref: string;
|
|
51
|
+
sha: string;
|
|
52
|
+
debtDigest: string;
|
|
53
|
+
coverage: ArchitectureDebtReportV1["coverage"];
|
|
54
|
+
coverageReasonCodes: string[];
|
|
55
|
+
};
|
|
56
|
+
/** Ordered by item ID. An absence requires complete coverage from the opposing check. */
|
|
57
|
+
introduced: ArchitectureDebtItemV1[];
|
|
58
|
+
resolvedIds: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
export interface ArchitectureDebtHookLogV1 {
|
|
44
62
|
schemaVersion: "archcontext.hook-log/v1";
|
|
45
63
|
event: string;
|
package/src/architecture.ts
CHANGED
|
@@ -74,14 +74,14 @@ export interface ArchitectureNotApplicableFlowV1 extends ArchitectureFlowBaseV1
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* A `forbid-dependency` constraint (`archcontext.constraint/v1`), narrowed to the fields the
|
|
77
|
-
* dependency gate evaluates. A file
|
|
78
|
-
*
|
|
77
|
+
* dependency gate evaluates. A scoped file cannot import into a forbidden target subtree
|
|
78
|
+
* unless every target file owner belongs to an explicitly allowed descendant subtree.
|
|
79
79
|
*/
|
|
80
80
|
export interface DependencyConstraintV1 {
|
|
81
81
|
id: string;
|
|
82
82
|
severity: "error" | "warning";
|
|
83
83
|
scope: { nodes: string[] };
|
|
84
|
-
rule: { type: "forbid-dependency"; targets: string[] } | { type: "layer-direction"; layers: string[] };
|
|
84
|
+
rule: { type: "forbid-dependency"; targets: string[]; allowedTargets?: string[] } | { type: "layer-direction"; layers: string[] };
|
|
85
85
|
rationale: string;
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -94,7 +94,8 @@ export type DependencyConstraintStatus = (typeof DEPENDENCY_CONSTRAINT_STATUSES)
|
|
|
94
94
|
* (`code-facts-import-limit`), the read came back shorter than the population the index reported
|
|
95
95
|
* (`code-facts-truncated`), a constrained file carries a repository-local import that resolved to
|
|
96
96
|
* no file, or the workspace package map could not be read, so no bare workspace specifier could
|
|
97
|
-
* be resolved.
|
|
97
|
+
* be resolved. `forbid-target-unowned` means an import subject to a `forbid-dependency` rule
|
|
98
|
+
* with `allowedTargets` resolved to a file without an owner.
|
|
98
99
|
*/
|
|
99
100
|
export const DEPENDENCY_CONSTRAINT_REASON_CODES = [
|
|
100
101
|
"code-facts-import-limit",
|
|
@@ -103,6 +104,7 @@ export const DEPENDENCY_CONSTRAINT_REASON_CODES = [
|
|
|
103
104
|
"code-facts-unavailable",
|
|
104
105
|
"unresolved-import",
|
|
105
106
|
"layer-endpoint-unclassified",
|
|
107
|
+
"forbid-target-unowned",
|
|
106
108
|
"workspace-resolution-failed"
|
|
107
109
|
] as const;
|
|
108
110
|
export type DependencyConstraintReasonCode = (typeof DEPENDENCY_CONSTRAINT_REASON_CODES)[number];
|
package/src/failure.ts
CHANGED
|
@@ -42,6 +42,8 @@ export const CODE_FACTS_ISSUE_MESSAGES = Object.freeze({
|
|
|
42
42
|
});
|
|
43
43
|
/** Each reason has a closed fact vocabulary. No source text or recovery binding is a summary fact. */
|
|
44
44
|
const policies: Record<string, Policy> = {
|
|
45
|
+
"debt-head-sparse-checkout": { code: "AC_PRECONDITION_FAILED", message: "Architecture debt delta requires a full head checkout. Materialize the skipped paths and retry." },
|
|
46
|
+
"debt-measurement-interrupted": { code: "AC_RUNTIME_UNAVAILABLE", message: "Architecture debt measurement was interrupted.", retryable: true },
|
|
45
47
|
"history-shallow-repository": { code: "AC_PRECONDITION_FAILED", message: "Architecture history requires a complete Git repository.", action: "unshallow-repository", facts: { historyReadReason: "optional:historyReadReason" } },
|
|
46
48
|
"code-facts-read-not-ready": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The existing CodeGraph index does not attest to the current source population.", facts: { issues: "codeFactsIssues" }, action: "codegraph-sync", retryable: false },
|
|
47
49
|
"daemon-root-missing": { code: "AC_RUNTIME_UNAVAILABLE", message: "The daemon start worktree no longer exists. Stop this daemon using its workspace state directory.", action: "stop-targeted-daemon", retryable: false, facts: {} },
|
|
@@ -56,6 +58,9 @@ const policies: Record<string, Policy> = {
|
|
|
56
58
|
"projection-manifest-upgrade-required": { code: "AC_PRECONDITION_FAILED", message: `The committed projection manifest requires supported re-baselining. First restore the original model if missing; the manifest digest cannot recover it. With the reviewed model available, follow ${ARCHITECTURE_DOCS_PROJECTION_MANIFEST_MIGRATION_GUIDE} before running ${ARCHITECTURE_DOCS_PROJECTION_MANIFEST_UPGRADE_COMMAND}.`, facts: { manifestPath: "optional:projectionManifestPath", foundSchemaVersion: "optional:projectionManifestSchemaVersion", supportedSchemaVersion: "optional:projectionManifestSchemaVersion", upgradeCommand: "optional:projectionManifestUpgradeCommand", migrationGuide: "optional:projectionManifestMigrationGuide" } },
|
|
57
59
|
"projection-writer-base-moved": { code: "AC_PRECONDITION_FAILED", message: "The remote base no longer points at the requested commit.", retryable: true, facts: { expectedBaseSha: "head", actualBaseSha: "head" } },
|
|
58
60
|
"projection-manifest-invalid": { code: "AC_PRECONDITION_FAILED", message: "The committed projection manifest violates its contract." },
|
|
61
|
+
"projection-slice-base-unresolved": { code: "AC_PRECONDITION_FAILED", message: "The base and HEAD must resolve to commits with a common ancestor." },
|
|
62
|
+
"projection-slice-worktree-dirty": { code: "AC_PRECONDITION_FAILED", message: "Projection slice requires a clean tracked worktree at HEAD." },
|
|
63
|
+
"projection-slice-model-entry-invalid": { code: "AC_PRECONDITION_FAILED", message: "Projection slice requires committed model inputs to be regular files with UTF-8 paths." },
|
|
59
64
|
"architecture-model-ignored": { code: "AC_PRECONDITION_FAILED", action: "commit-architecture-model", message: "Git ignore rules exclude architecture model paths, so the model cannot be committed and a manifest digest cannot rebuild it. Remove or narrow the rule, commit the model, then retry adoption. The diagnostic command prints each deciding rule.", facts: { pathCount: "uint", paths: "optional:diagnosticPaths", commands: "optional:diagnosticCommands", omittedPathCount: "uint" } },
|
|
60
65
|
"projection-footprint-uncovered": { code: "AC_PRECONDITION_FAILED", message: "Declared source footprints lack a projection target." },
|
|
61
66
|
"index-missing": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "Required code facts have no available index. Run codegraph init, or in a linked worktree run archctx sync after archctx sync in the primary checkout has published a base index." },
|
|
@@ -534,6 +539,12 @@ const nativeEnums: Readonly<Record<string, readonly string[]>> = {
|
|
|
534
539
|
"filesystem-path-alias",
|
|
535
540
|
"gitlink",
|
|
536
541
|
"head-or-tree",
|
|
542
|
+
"impact-batch-arguments-invalid",
|
|
543
|
+
"impact-batch-exclusive",
|
|
544
|
+
"impact-batch-file",
|
|
545
|
+
"impact-batch-file-too-large",
|
|
546
|
+
"impact-batch-json-invalid",
|
|
547
|
+
"impact-batch-request-invalid",
|
|
537
548
|
"input-digest",
|
|
538
549
|
"input-identity",
|
|
539
550
|
"invalid-metadata-size",
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./review-guards";
|
|
|
7
7
|
export * from "./ledger";
|
|
8
8
|
export * from "./native-context";
|
|
9
9
|
export * from "./ref-impact";
|
|
10
|
+
export * from "./runtime-verify";
|
|
10
11
|
export * from "./changeset-receipt";
|
|
11
12
|
export * from "./ownership-dependencies";
|
|
12
13
|
export * from "./ports";
|
package/src/ports.ts
CHANGED
|
@@ -187,6 +187,8 @@ export interface ModelValidationResult {
|
|
|
187
187
|
nodeSchemaErrors?: { path: string; error: string }[];
|
|
188
188
|
/** Errors specifically repairable by replacing manifest model.layers; after validation remains strict. */
|
|
189
189
|
layerOrderErrors?: string[];
|
|
190
|
+
/** Constraint declaration errors specific to `rule.allowedTargets`. */
|
|
191
|
+
allowedTargetErrors?: string[];
|
|
190
192
|
/** Problems that do not invalidate the model, such as an ignored legacy setting. Omitted when empty. */
|
|
191
193
|
warnings?: string[];
|
|
192
194
|
modelDigest: string;
|
package/src/product-version.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ARCHCONTEXT_PRODUCT_NAME = "archctx";
|
|
2
|
-
export const ARCHCONTEXT_PRODUCT_VERSION = "0.
|
|
2
|
+
export const ARCHCONTEXT_PRODUCT_VERSION = "0.17.0";
|
|
3
3
|
export const ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.4";
|
|
4
4
|
export const ARCHCONTEXT_NODE_RANGE = ">=22.22 <26";
|
|
5
5
|
export const LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v2";
|
package/src/projection.ts
CHANGED
|
@@ -109,6 +109,7 @@ export const ARCHCTX_FEATURES = [
|
|
|
109
109
|
"projection-prior-committed-applies-v1",
|
|
110
110
|
"projection-protocol-v2",
|
|
111
111
|
"projection-publish-v1",
|
|
112
|
+
"projection-slice-v1",
|
|
112
113
|
"projection-snapshot-v1",
|
|
113
114
|
"projection-verify-pr-v1",
|
|
114
115
|
"recommendation-scan-decision-v1",
|
|
@@ -203,6 +204,7 @@ export interface ArchitectureFlowSelectorCheckV1 {
|
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
/** `files[].preview.format`: a `create` carries the rendered body, an `update` or `delete` a unified diff. */
|
|
207
|
+
export const PROJECTION_SLICE_SCHEMA_VERSION = "archcontext.projection-slice/v1" as const;
|
|
206
208
|
export const PROJECTION_FILE_PREVIEW_FORMATS = ["body", "unified-diff"] as const;
|
|
207
209
|
/** Upper bound, in UTF-8 bytes, on one `files[].preview.content`. */
|
|
208
210
|
export const PROJECTION_FILE_PREVIEW_MAX_BYTES = 65_536;
|
|
@@ -342,6 +344,34 @@ export interface ArchitectureCapabilityChangeV1 {
|
|
|
342
344
|
* order; `byteLength` is the UTF-8 length of the complete content and `truncated` says whether
|
|
343
345
|
* `content` is shorter.
|
|
344
346
|
*/
|
|
347
|
+
export interface ProjectionSliceEntrypointV1 {
|
|
348
|
+
nodeId: string;
|
|
349
|
+
entrypointId: string;
|
|
350
|
+
path: string;
|
|
351
|
+
symbol: string;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface ProjectionSliceCapabilityV1 {
|
|
355
|
+
capabilityId: string;
|
|
356
|
+
modulePath: string;
|
|
357
|
+
/** Unfenced Mermaid. Null when the capability was removed or P1 cannot be rendered. */
|
|
358
|
+
diagramMermaid: string | null;
|
|
359
|
+
entrypoints: ProjectionSliceEntrypointV1[];
|
|
360
|
+
markdown: string;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface ProjectionSliceV1 {
|
|
364
|
+
schemaVersion: typeof PROJECTION_SLICE_SCHEMA_VERSION;
|
|
365
|
+
base: string;
|
|
366
|
+
baseSha: string;
|
|
367
|
+
mergeBase: string;
|
|
368
|
+
headSha: string;
|
|
369
|
+
changedPaths: string[];
|
|
370
|
+
changed: boolean;
|
|
371
|
+
affectedCapabilities: ProjectionSliceCapabilityV1[];
|
|
372
|
+
markdown: string;
|
|
373
|
+
}
|
|
374
|
+
|
|
345
375
|
export interface ProjectionFilePreviewV1 {
|
|
346
376
|
format: ProjectionFilePreviewFormat;
|
|
347
377
|
content: string;
|
package/src/ref-impact.ts
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
import type { NativeContextSnapshot } from "./native-context";
|
|
2
|
+
import { isRepoRelativePosixPath } from "./schema";
|
|
3
|
+
|
|
4
|
+
export const REF_IMPACT_BATCH_REQUEST_SCHEMA_VERSION = "archcontext.ref-impact-batch-request/v1" as const;
|
|
5
|
+
export const REF_IMPACT_BATCH_SCHEMA_VERSION = "archcontext.ref-impact-batch/v1" as const;
|
|
6
|
+
|
|
7
|
+
export interface RefImpactBatchRequestV1 {
|
|
8
|
+
schemaVersion: typeof REF_IMPACT_BATCH_REQUEST_SCHEMA_VERSION;
|
|
9
|
+
items: Array<{ id: string; paths: string[] }>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type RefImpactBatchItemV1 =
|
|
13
|
+
| { id: string; impact: RefImpactV1 }
|
|
14
|
+
| { id: string; status: "unavailable"; reasonCode: "batch-response-bytes" };
|
|
15
|
+
|
|
16
|
+
export interface RefImpactBatchV1 {
|
|
17
|
+
schemaVersion: typeof REF_IMPACT_BATCH_SCHEMA_VERSION;
|
|
18
|
+
items: RefImpactBatchItemV1[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function isRefImpactBatchRequest(value: unknown): value is RefImpactBatchRequestV1 {
|
|
22
|
+
if (!isRecord(value) || Object.keys(value).length !== 2 || value.schemaVersion !== REF_IMPACT_BATCH_REQUEST_SCHEMA_VERSION || !Array.isArray(value.items)) return false;
|
|
23
|
+
for (const item of value.items) {
|
|
24
|
+
if (!isRecord(item) || Object.keys(item).length !== 2 || typeof item.id !== "string" || !Array.isArray(item.paths)) return false;
|
|
25
|
+
for (const path of item.paths) {
|
|
26
|
+
if (typeof path !== "string" || !isRepoRelativePosixPath(path) || path.includes("\0")) return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
33
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
34
|
+
}
|
|
2
35
|
export const REF_IMPACT_SCHEMA_VERSION = "archcontext.ref-impact/v1" as const;
|
|
3
36
|
export const REF_IMPACT_LIMITS = Object.freeze({ changedPaths: 1000, nodes: 1000, relations: 5000, flowSteps: 2000, dependents: 5000, modelChanges: 5000, depth: 10, diffLines: 100_000, diffWork: 2_000_000, diffBytes: 8 * 1024 * 1024, responseBytes: 8 * 1024 * 1024, codeFactFiles: 10_000, codeFactBytes: 8 * 1024 * 1024 });
|
|
4
37
|
export interface RefImpactModelChange { kind: string; id: string; change: "added" | "removed" | "changed"; fields: string[] }
|