archctx-contracts 0.6.3 → 0.7.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 (38) hide show
  1. package/fixtures/invalid/recommendation-v3-structural-before-evidence.json +59 -0
  2. package/fixtures/valid/archctx-capabilities.json +3 -3
  3. package/fixtures/valid/capability-dependencies.json +35 -0
  4. package/fixtures/valid/docs-anchors.json +105 -0
  5. package/fixtures/valid/flow-selector-check.json +50 -0
  6. package/fixtures/valid/product-version-manifest.json +6 -6
  7. package/fixtures/valid/projection-manifest.json +175 -0
  8. package/fixtures/valid/projection-result.json +5 -5
  9. package/fixtures/valid/recommendation-v3.json +69 -0
  10. package/fixtures/valid/runtime-recommendation-show.json +312 -0
  11. package/fixtures/valid/runtime-refactor-scan.json +543 -0
  12. package/package.json +1 -1
  13. package/schemas/runtime/archctx-capabilities.schema.json +7 -2
  14. package/schemas/runtime/architecture-refresh-signal.schema.json +27 -0
  15. package/schemas/runtime/capability-dependencies.schema.json +116 -0
  16. package/schemas/runtime/changeset.schema.json +42 -16
  17. package/schemas/runtime/docs-anchors.schema.json +143 -0
  18. package/schemas/runtime/flow-selector-check.schema.json +109 -0
  19. package/schemas/runtime/projection-apply-readback.schema.json +351 -10
  20. package/schemas/runtime/projection-apply-recovery.schema.json +24 -3
  21. package/schemas/runtime/projection-manifest.schema.json +491 -0
  22. package/schemas/runtime/projection-request.schema.json +11 -2
  23. package/schemas/runtime/projection-result.schema.json +108 -8
  24. package/schemas/runtime/recommendation-v3.schema.json +1167 -0
  25. package/schemas/runtime/runtime-recommendation-show.schema.json +2463 -0
  26. package/schemas/runtime/runtime-refactor-scan.schema.json +2508 -0
  27. package/schemas/runtime/structural-observation-payload.schema.json +579 -0
  28. package/src/architecture.ts +6 -3
  29. package/src/docs-anchors.ts +126 -0
  30. package/src/index.ts +3 -0
  31. package/src/ledger.ts +26 -10
  32. package/src/ownership-dependencies.ts +129 -0
  33. package/src/product-version.ts +2 -2
  34. package/src/projection-manifest.ts +346 -0
  35. package/src/projection.ts +406 -6
  36. package/src/refactor.ts +305 -1
  37. package/src/schema.ts +20 -4
  38. package/src/validator.ts +87 -15
@@ -0,0 +1,116 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archcontext.dev/schemas/runtime/capability-dependencies.schema.json",
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.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "ownershipRule", "filter", "capabilities", "matrix", "imports", "calls", "edges", "worktree", "privacy"],
9
+ "properties": {
10
+ "schemaVersion": { "const": "archcontext.capability-dependencies/v1" },
11
+ "ownershipRule": { "const": "parent-chain" },
12
+ "filter": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["from", "into"],
16
+ "properties": {
17
+ "from": { "type": ["string", "null"] },
18
+ "into": { "type": ["string", "null"] }
19
+ }
20
+ },
21
+ "capabilities": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
22
+ "matrix": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["from", "to", "imports", "calls"],
28
+ "properties": {
29
+ "from": { "type": "string", "minLength": 1 },
30
+ "to": { "type": "string", "minLength": 1 },
31
+ "imports": { "type": "integer", "minimum": 1 },
32
+ "calls": { "type": "null" }
33
+ }
34
+ }
35
+ },
36
+ "imports": {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "required": ["coverage", "reasonCodes", "truncated", "importNodeCount", "importNodeLimit", "importNodeLimitExceeded", "edgeCount", "unresolvedCount", "unattributed"],
40
+ "properties": {
41
+ "coverage": { "enum": ["complete", "partial", "unknown"] },
42
+ "reasonCodes": {
43
+ "type": "array",
44
+ "uniqueItems": true,
45
+ "items": { "enum": ["code-facts-import-limit", "code-facts-stale", "code-facts-truncated", "code-facts-unavailable"] }
46
+ },
47
+ "truncated": { "type": "boolean" },
48
+ "importNodeCount": { "type": ["integer", "null"], "minimum": 0 },
49
+ "importNodeLimit": { "type": "integer", "minimum": 1 },
50
+ "importNodeLimitExceeded": { "type": "boolean" },
51
+ "edgeCount": { "type": "integer", "minimum": 0 },
52
+ "unresolvedCount": { "type": "integer", "minimum": 0 },
53
+ "unattributed": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "required": ["unownedEndpoint", "contestedEndpoint", "noCapabilityEndpoint"],
57
+ "properties": {
58
+ "unownedEndpoint": { "type": "integer", "minimum": 0 },
59
+ "contestedEndpoint": { "type": "integer", "minimum": 0 },
60
+ "noCapabilityEndpoint": { "type": "integer", "minimum": 0 }
61
+ }
62
+ }
63
+ }
64
+ },
65
+ "calls": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "required": ["coverage", "reasonCodes"],
69
+ "properties": {
70
+ "coverage": { "const": "unknown" },
71
+ "reasonCodes": { "type": "array", "minItems": 1, "maxItems": 1, "items": { "const": "call-edges-not-exposed" } }
72
+ }
73
+ },
74
+ "edges": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["limit", "count", "omittedCount", "items"],
78
+ "properties": {
79
+ "limit": { "type": "integer", "minimum": 0 },
80
+ "count": { "type": "integer", "minimum": 0 },
81
+ "omittedCount": { "type": "integer", "minimum": 0 },
82
+ "items": {
83
+ "type": "array",
84
+ "items": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["fromPath", "toPath", "fromCapability", "toCapability"],
88
+ "properties": {
89
+ "fromPath": { "type": "string", "minLength": 1 },
90
+ "toPath": { "type": "string", "minLength": 1 },
91
+ "fromCapability": { "type": "string", "minLength": 1 },
92
+ "toCapability": { "type": "string", "minLength": 1 }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "worktree": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["headSha", "worktreeDigest"],
102
+ "properties": {
103
+ "headSha": { "type": "string", "pattern": "^[a-f0-9]{40}$" },
104
+ "worktreeDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
105
+ }
106
+ },
107
+ "privacy": {
108
+ "type": "object",
109
+ "additionalProperties": false,
110
+ "required": ["writes"],
111
+ "properties": {
112
+ "writes": { "const": "none" }
113
+ }
114
+ }
115
+ }
116
+ }
@@ -108,24 +108,50 @@
108
108
  "projectionFiles": {
109
109
  "type": "array",
110
110
  "items": {
111
- "type": "object",
112
- "additionalProperties": false,
113
- "required": [
114
- "path",
115
- "expectedHash",
116
- "body"
117
- ],
118
- "properties": {
119
- "path": {
120
- "type": "string"
121
- },
122
- "expectedHash": {
123
- "type": "string"
111
+ "oneOf": [
112
+ {
113
+ "type": "object",
114
+ "additionalProperties": false,
115
+ "required": [
116
+ "path",
117
+ "expectedHash",
118
+ "body"
119
+ ],
120
+ "properties": {
121
+ "path": {
122
+ "type": "string"
123
+ },
124
+ "expectedHash": {
125
+ "type": "string"
126
+ },
127
+ "body": {
128
+ "type": "string"
129
+ }
130
+ }
124
131
  },
125
- "body": {
126
- "type": "string"
132
+ {
133
+ "type": "object",
134
+ "additionalProperties": false,
135
+ "description": "Removes one projection-owned file; accepted only by render_projection with the exact current body hash.",
136
+ "required": [
137
+ "path",
138
+ "expectedHash",
139
+ "delete"
140
+ ],
141
+ "properties": {
142
+ "path": {
143
+ "type": "string"
144
+ },
145
+ "expectedHash": {
146
+ "type": "string",
147
+ "pattern": "^sha256:[a-f0-9]{64}$"
148
+ },
149
+ "delete": {
150
+ "const": true
151
+ }
152
+ }
127
153
  }
128
- }
154
+ ]
129
155
  }
130
156
  }
131
157
  }
@@ -0,0 +1,143 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archcontext.dev/schemas/runtime/docs-anchors.schema.json",
4
+ "title": "DocsAnchorsReportV1",
5
+ "description": "Read-only result of `archctx docs anchors`: stale citations in human-owned module document regions and node prose. A signal, not a gate.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "profile", "codeGraph", "summary", "nodes"],
9
+ "properties": {
10
+ "schemaVersion": { "const": "archcontext.docs-anchors/v1" },
11
+ "profile": { "enum": ["default", "repo-harness/v1"] },
12
+ "codeGraph": {
13
+ "oneOf": [
14
+ {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": ["availability"],
18
+ "properties": { "availability": { "const": "ready" } }
19
+ },
20
+ {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "required": ["availability", "reasonCode"],
24
+ "properties": {
25
+ "availability": { "const": "unavailable" },
26
+ "reasonCode": { "enum": ["index-missing", "index-open-failed"] }
27
+ }
28
+ }
29
+ ]
30
+ },
31
+ "summary": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["nodes", "documents", "citations", "findings", "unchecked", "byKind"],
35
+ "properties": {
36
+ "nodes": { "$ref": "#/$defs/count" },
37
+ "documents": { "$ref": "#/$defs/count" },
38
+ "citations": { "$ref": "#/$defs/count" },
39
+ "findings": { "$ref": "#/$defs/count" },
40
+ "unchecked": { "$ref": "#/$defs/count" },
41
+ "byKind": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["line-moved", "line-out-of-range", "missing-path", "missing-symbol"],
45
+ "properties": {
46
+ "line-moved": { "$ref": "#/$defs/count" },
47
+ "line-out-of-range": { "$ref": "#/$defs/count" },
48
+ "missing-path": { "$ref": "#/$defs/count" },
49
+ "missing-symbol": { "$ref": "#/$defs/count" }
50
+ }
51
+ }
52
+ }
53
+ },
54
+ "nodes": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": ["nodeId", "citationCount", "findings", "unchecked"],
60
+ "properties": {
61
+ "nodeId": { "type": "string", "minLength": 1 },
62
+ "documentPath": { "$ref": "#/$defs/repoPath" },
63
+ "citationCount": { "type": "integer", "minimum": 1 },
64
+ "findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } },
65
+ "unchecked": { "type": "array", "items": { "$ref": "#/$defs/unchecked" } }
66
+ }
67
+ }
68
+ }
69
+ },
70
+ "$defs": {
71
+ "count": { "type": "integer", "minimum": 0 },
72
+ "line": { "type": "integer", "minimum": 1 },
73
+ "repoPath": {
74
+ "type": "string",
75
+ "minLength": 1,
76
+ "not": { "anyOf": [{ "pattern": "^/" }, { "pattern": "\\\\" }, { "pattern": "(^|/)\\.\\.(/|$)" }] }
77
+ },
78
+ "origin": {
79
+ "oneOf": [
80
+ {
81
+ "type": "object",
82
+ "additionalProperties": false,
83
+ "required": ["kind", "path", "line"],
84
+ "properties": {
85
+ "kind": { "const": "document" },
86
+ "path": { "$ref": "#/$defs/repoPath" },
87
+ "line": { "$ref": "#/$defs/line" }
88
+ }
89
+ },
90
+ {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "required": ["kind"],
94
+ "properties": { "kind": { "const": "node-summary" } }
95
+ },
96
+ {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["kind", "index"],
100
+ "properties": {
101
+ "kind": { "const": "node-responsibility" },
102
+ "index": { "type": "integer", "minimum": 0 }
103
+ }
104
+ }
105
+ ]
106
+ },
107
+ "citation": {
108
+ "type": "object",
109
+ "additionalProperties": false,
110
+ "required": ["text"],
111
+ "properties": {
112
+ "text": { "type": "string", "minLength": 1 },
113
+ "path": { "type": "string", "minLength": 1 },
114
+ "resolvedPath": { "$ref": "#/$defs/repoPath" },
115
+ "line": { "$ref": "#/$defs/line" },
116
+ "endLine": { "$ref": "#/$defs/line" },
117
+ "symbol": { "type": "string", "minLength": 1 }
118
+ }
119
+ },
120
+ "finding": {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "required": ["kind", "origin", "citation"],
124
+ "properties": {
125
+ "kind": { "enum": ["line-moved", "line-out-of-range", "missing-path", "missing-symbol"] },
126
+ "origin": { "$ref": "#/$defs/origin" },
127
+ "citation": { "$ref": "#/$defs/citation" },
128
+ "lineCount": { "$ref": "#/$defs/count" },
129
+ "currentLines": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/line" } }
130
+ }
131
+ },
132
+ "unchecked": {
133
+ "type": "object",
134
+ "additionalProperties": false,
135
+ "required": ["reasonCode", "origin", "citation"],
136
+ "properties": {
137
+ "reasonCode": { "enum": ["codegraph-unavailable", "language-unsupported", "path-ambiguous"] },
138
+ "origin": { "$ref": "#/$defs/origin" },
139
+ "citation": { "$ref": "#/$defs/citation" }
140
+ }
141
+ }
142
+ }
143
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://archcontext.dev/schemas/runtime/flow-selector-check.schema.json",
4
+ "title": "ArchitectureFlowSelectorCheckV1",
5
+ "description": "The data of `archctx flows check`: the P2 flow proof of every capability that declares a flow, and the proof status of every declared entrypoint-to-sink selector, computed without rendering. Consumers detect it through the flow-selector-check-v1 capability.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "ok", "codeGraph", "summary", "selectors", "capabilities"],
9
+ "properties": {
10
+ "schemaVersion": { "const": "archcontext.flow-selector-check/v1" },
11
+ "ok": { "type": "boolean", "description": "True when no capability that declares a flow has an unprovable P2 proof." },
12
+ "codeGraph": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["availability", "version"],
16
+ "properties": {
17
+ "availability": { "enum": ["ready", "unavailable"] },
18
+ "version": { "type": "string", "minLength": 1 }
19
+ }
20
+ },
21
+ "summary": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": ["selectors", "proven", "unproven", "usedUnproven"],
25
+ "properties": {
26
+ "selectors": { "type": "integer", "minimum": 0 },
27
+ "proven": { "type": "integer", "minimum": 0 },
28
+ "unproven": { "type": "integer", "minimum": 0 },
29
+ "usedUnproven": { "type": "integer", "minimum": 0, "description": "Unproven selectors that a required-flow step names." }
30
+ }
31
+ },
32
+ "selectors": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["nodeId", "entrypointId", "sourcePath", "sourceSymbol", "sinkId", "sinkPath", "sinkSymbol", "status", "callSites", "referenceSites", "rejectedBuiltinCallSites", "flowSteps"],
38
+ "properties": {
39
+ "nodeId": { "type": "string", "minLength": 1 },
40
+ "entrypointId": { "type": "string", "minLength": 1 },
41
+ "sourcePath": { "type": "string", "minLength": 1 },
42
+ "sourceSymbol": { "type": "string", "minLength": 1 },
43
+ "sinkId": { "type": "string", "minLength": 1 },
44
+ "sinkPath": { "type": "string", "minLength": 1 },
45
+ "sinkSymbol": { "type": "string", "minLength": 1 },
46
+ "status": {
47
+ "enum": ["ambiguous-symbol", "evidence-missing", "evidence-truncated", "false-builtin-call", "no-direct-call", "only-references", "proven"],
48
+ "description": "Only proven binds a flow step."
49
+ },
50
+ "callSites": { "$ref": "#/$defs/sites" },
51
+ "referenceSites": { "$ref": "#/$defs/sites" },
52
+ "rejectedBuiltinCallSites": { "$ref": "#/$defs/sites" },
53
+ "flowSteps": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["flowId", "stepId"],
59
+ "properties": {
60
+ "flowId": { "type": "string", "minLength": 1 },
61
+ "stepId": { "type": "string", "minLength": 1 }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ },
68
+ "capabilities": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "object",
72
+ "additionalProperties": false,
73
+ "required": ["capabilityId", "p2Status", "diagnostics"],
74
+ "properties": {
75
+ "capabilityId": { "type": "string", "minLength": 1 },
76
+ "p2Status": { "enum": ["not-applicable", "proven", "unprovable"] },
77
+ "diagnostics": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "object",
81
+ "additionalProperties": false,
82
+ "required": ["code", "detail"],
83
+ "properties": {
84
+ "code": { "type": "string", "minLength": 1 },
85
+ "flowId": { "type": "string", "minLength": 1 },
86
+ "stepId": { "type": "string", "minLength": 1 },
87
+ "detail": { "type": "string" }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ },
95
+ "$defs": {
96
+ "sites": {
97
+ "type": "array",
98
+ "items": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["path"],
102
+ "properties": {
103
+ "path": { "type": "string", "minLength": 1 },
104
+ "line": { "type": "integer", "minimum": 1 }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }