@qijenchen/governance 0.1.0-beta.94

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 (40) hide show
  1. package/README.md +89 -0
  2. package/bin/attest.mjs +4 -0
  3. package/bin/check.mjs +4 -0
  4. package/bin/doctor.mjs +4 -0
  5. package/bin/generate.mjs +4 -0
  6. package/bin/governance.mjs +4 -0
  7. package/bin/hook.mjs +4 -0
  8. package/bin/upgrade.mjs +4 -0
  9. package/canonical/gates.json +42 -0
  10. package/canonical/manifest.json +476 -0
  11. package/canonical/plugin-aliases.json +25 -0
  12. package/canonical/provider-lifecycle.json +48 -0
  13. package/canonical/providers.json +455 -0
  14. package/canonical/roles.json +12 -0
  15. package/canonical/rules.json +81 -0
  16. package/canonical/schemas/attestation.schema.json +61 -0
  17. package/canonical/schemas/diagnostic.schema.json +37 -0
  18. package/canonical/schemas/gates.schema.json +27 -0
  19. package/canonical/schemas/lock.schema.json +189 -0
  20. package/canonical/schemas/manifest.schema.json +103 -0
  21. package/canonical/schemas/plugin-aliases.schema.json +59 -0
  22. package/canonical/schemas/provider-hook-coverage.schema.json +173 -0
  23. package/canonical/schemas/provider-lifecycle.schema.json +126 -0
  24. package/canonical/schemas/providers.schema.json +917 -0
  25. package/canonical/schemas/roles.schema.json +27 -0
  26. package/canonical/schemas/rules.schema.json +46 -0
  27. package/canonical/schemas/upgrade-plan.schema.json +31 -0
  28. package/package.json +42 -0
  29. package/src/authority-decision-evidence.mjs +413 -0
  30. package/src/canonical-order.mjs +8 -0
  31. package/src/carrier-projection.mjs +407 -0
  32. package/src/cli.mjs +114 -0
  33. package/src/closed-tool-execution.mjs +1001 -0
  34. package/src/common.mjs +278 -0
  35. package/src/contract.mjs +760 -0
  36. package/src/hook-api.mjs +107 -0
  37. package/src/index.mjs +14 -0
  38. package/src/provider-hook-normalization.mjs +1646 -0
  39. package/src/provider-review-binding.mjs +2377 -0
  40. package/src/snapshot.mjs +520 -0
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/governance-attestation.schema.json",
4
+ "title": "Governance attestation",
5
+ "type": "object",
6
+ "required": ["_provenance", "schemaVersion", "issuedAt", "subject", "role", "contractDigest", "snapshotDigest", "gitHead", "gitTree", "evidenceDigest", "claims"],
7
+ "properties": {
8
+ "_provenance": { "$ref": "#/$defs/provenance" },
9
+ "schemaVersion": { "const": 1 },
10
+ "issuedAt": { "type": "string", "format": "date-time" },
11
+ "subject": { "type": "string", "minLength": 1 },
12
+ "role": { "type": "string", "minLength": 1 },
13
+ "contractDigest": { "$ref": "#/$defs/digest" },
14
+ "snapshotDigest": { "$ref": "#/$defs/digest" },
15
+ "gitHead": { "$ref": "#/$defs/gitOidOrNull" },
16
+ "gitTree": { "$ref": "#/$defs/gitOidOrNull" },
17
+ "evidenceDigest": { "$ref": "#/$defs/digest" },
18
+ "claims": {
19
+ "type": "array",
20
+ "minItems": 3,
21
+ "maxItems": 4,
22
+ "items": {
23
+ "enum": [
24
+ "contract-doctor",
25
+ "hook-independent-check",
26
+ "provider-skill-parity",
27
+ "snapshot-integrity"
28
+ ]
29
+ },
30
+ "uniqueItems": true,
31
+ "allOf": [
32
+ { "contains": { "const": "contract-doctor" }, "minContains": 1, "maxContains": 1 },
33
+ { "contains": { "const": "provider-skill-parity" }, "minContains": 1, "maxContains": 1 },
34
+ { "contains": { "const": "snapshot-integrity" }, "minContains": 1, "maxContains": 1 }
35
+ ]
36
+ }
37
+ },
38
+ "$defs": {
39
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
40
+ "gitOidOrNull": {
41
+ "oneOf": [
42
+ { "type": "null" },
43
+ { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" }
44
+ ]
45
+ },
46
+ "provenance": {
47
+ "type": "object",
48
+ "required": ["generated", "generator", "generatorVersion", "manifestId", "contractDigest", "role"],
49
+ "properties": {
50
+ "generated": { "const": true },
51
+ "generator": { "const": "@qijenchen/governance" },
52
+ "generatorVersion": { "type": "string", "minLength": 1 },
53
+ "manifestId": { "type": "string", "minLength": 1 },
54
+ "contractDigest": { "$ref": "#/$defs/digest" },
55
+ "role": { "type": "string", "minLength": 1 }
56
+ },
57
+ "additionalProperties": false
58
+ }
59
+ },
60
+ "additionalProperties": false
61
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/governance-diagnostic.schema.json",
4
+ "title": "Governance diagnostic result",
5
+ "type": "object",
6
+ "required": ["schemaVersion", "command", "outcome", "diagnostics"],
7
+ "properties": {
8
+ "schemaVersion": { "const": 1 },
9
+ "command": { "type": "string", "minLength": 1 },
10
+ "outcome": { "enum": ["PASS", "FAIL", "PLAN", "APPLIED"] },
11
+ "diagnostics": {
12
+ "type": "array",
13
+ "items": {
14
+ "type": "object",
15
+ "required": ["ruleId", "severity", "evidence", "outcome", "message"],
16
+ "properties": {
17
+ "ruleId": { "type": "string", "pattern": "^GOV-[A-Z0-9-]+$" },
18
+ "severity": { "enum": ["critical", "major", "minor", "info"] },
19
+ "evidence": {
20
+ "type": "object",
21
+ "required": ["kind", "path"],
22
+ "properties": {
23
+ "kind": { "type": "string" },
24
+ "path": { "type": "string" }
25
+ },
26
+ "additionalProperties": true
27
+ },
28
+ "outcome": { "enum": ["PASS", "FAIL", "BLOCK", "ERROR", "PLAN", "APPLIED"] },
29
+ "message": { "type": "string" }
30
+ },
31
+ "additionalProperties": false
32
+ }
33
+ },
34
+ "data": {}
35
+ },
36
+ "additionalProperties": false
37
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/governance/gates-v1.json",
4
+ "title": "Governance hard-gate registry",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "gates"],
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "schemaVersion": { "const": 1 },
11
+ "gates": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "items": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": ["id", "command", "hard", "hookIndependent"],
18
+ "properties": {
19
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
20
+ "command": { "type": "string", "minLength": 1 },
21
+ "hard": { "type": "boolean" },
22
+ "hookIndependent": { "type": "boolean" }
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,189 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/governance-lock.schema.json",
4
+ "title": "Governance snapshot lock",
5
+ "type": "object",
6
+ "required": ["_provenance", "schemaVersion", "role", "outputDirectory", "contractDigest", "inputDigest", "snapshotDigest", "sources", "skillParity", "files"],
7
+ "properties": {
8
+ "_provenance": { "$ref": "#/$defs/provenance" },
9
+ "schemaVersion": { "const": 2 },
10
+ "role": { "type": "string" },
11
+ "outputDirectory": { "type": "string" },
12
+ "contractDigest": { "$ref": "#/$defs/digest" },
13
+ "inputDigest": { "$ref": "#/$defs/digest" },
14
+ "snapshotDigest": { "$ref": "#/$defs/digest" },
15
+ "sources": { "type": "array", "items": { "$ref": "#/$defs/source" } },
16
+ "skillParity": { "type": "array", "items": { "$ref": "#/$defs/skillParity" } },
17
+ "files": { "type": "array", "items": { "$ref": "#/$defs/file" } }
18
+ },
19
+ "$defs": {
20
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
21
+ "provenance": {
22
+ "type": "object",
23
+ "required": ["generated", "generator", "generatorVersion", "manifestId", "contractDigest", "role"],
24
+ "properties": {
25
+ "generated": { "const": true },
26
+ "generator": { "const": "@qijenchen/governance" },
27
+ "generatorVersion": { "type": "string" },
28
+ "manifestId": { "type": "string" },
29
+ "contractDigest": { "$ref": "#/$defs/digest" },
30
+ "role": { "type": "string" }
31
+ },
32
+ "additionalProperties": false
33
+ },
34
+ "source": {
35
+ "oneOf": [
36
+ {
37
+ "type": "object",
38
+ "required": ["id", "ownerRepo", "path", "type", "mode", "hash", "size"],
39
+ "properties": {
40
+ "id": { "type": "string", "minLength": 1 },
41
+ "ownerRepo": { "type": "string", "minLength": 1 },
42
+ "path": { "type": "string", "minLength": 1 },
43
+ "type": { "const": "file" },
44
+ "mode": { "type": "string", "pattern": "^[0-7]{4}$" },
45
+ "hash": { "$ref": "#/$defs/digest" },
46
+ "size": { "type": "integer", "minimum": 0 }
47
+ },
48
+ "additionalProperties": false
49
+ },
50
+ {
51
+ "type": "object",
52
+ "required": ["id", "ownerRepo", "path", "type", "mode", "hash", "size", "carrierProjection"],
53
+ "properties": {
54
+ "id": { "type": "string", "minLength": 1 },
55
+ "ownerRepo": { "type": "string", "minLength": 1 },
56
+ "path": { "type": "string", "minLength": 1 },
57
+ "type": { "const": "file" },
58
+ "mode": { "type": "string", "pattern": "^[0-7]{4}$" },
59
+ "hash": { "$ref": "#/$defs/digest" },
60
+ "size": { "type": "integer", "minimum": 0 },
61
+ "carrierProjection": { "$ref": "#/$defs/carrierProjection" }
62
+ },
63
+ "additionalProperties": false
64
+ },
65
+ {
66
+ "type": "object",
67
+ "required": ["id", "ownerRepo", "path", "excludes", "type", "mode", "hash", "files", "carrierProjections"],
68
+ "properties": {
69
+ "id": { "type": "string", "minLength": 1 },
70
+ "ownerRepo": { "type": "string", "minLength": 1 },
71
+ "path": { "type": "string", "minLength": 1 },
72
+ "excludes": {
73
+ "type": "array",
74
+ "items": { "type": "string", "minLength": 1 },
75
+ "uniqueItems": true
76
+ },
77
+ "type": { "const": "directory" },
78
+ "mode": { "type": "string", "pattern": "^[0-7]{4}$" },
79
+ "hash": { "$ref": "#/$defs/digest" },
80
+ "files": { "type": "integer", "minimum": 0 },
81
+ "carrierProjections": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object",
85
+ "required": ["path", "projection"],
86
+ "properties": {
87
+ "path": { "type": "string", "minLength": 1 },
88
+ "projection": { "$ref": "#/$defs/carrierProjection" }
89
+ },
90
+ "additionalProperties": false
91
+ }
92
+ }
93
+ },
94
+ "additionalProperties": false
95
+ }
96
+ ]
97
+ },
98
+ "carrierProjection": {
99
+ "enum": [
100
+ "external-activation-state-v1",
101
+ "provider-certification-state-v1",
102
+ "review-capability-certification-state-v1"
103
+ ]
104
+ },
105
+ "projection": {
106
+ "oneOf": [
107
+ { "type": "null" },
108
+ {
109
+ "type": "object",
110
+ "required": ["module", "export", "files"],
111
+ "properties": {
112
+ "module": { "type": "string", "minLength": 1 },
113
+ "export": { "type": "string", "minLength": 1 },
114
+ "files": {
115
+ "type": "array",
116
+ "minItems": 1,
117
+ "items": { "type": "string", "minLength": 1 },
118
+ "uniqueItems": true
119
+ }
120
+ },
121
+ "additionalProperties": false
122
+ }
123
+ ]
124
+ },
125
+ "sharedDigest": {
126
+ "type": "object",
127
+ "required": ["name", "sourceDigest", "expectedTargetDigest", "targetDigest"],
128
+ "properties": {
129
+ "name": { "type": "string", "minLength": 1 },
130
+ "sourceDigest": { "$ref": "#/$defs/digest" },
131
+ "expectedTargetDigest": { "$ref": "#/$defs/digest" },
132
+ "targetDigest": { "$ref": "#/$defs/digest" }
133
+ },
134
+ "additionalProperties": false
135
+ },
136
+ "skillParity": {
137
+ "type": "object",
138
+ "required": [
139
+ "id", "sourceProvider", "targetProvider", "sourceDirectory", "targetDirectory",
140
+ "compare", "projection", "sourceSkills", "targetSkills", "requiredTargetExtras",
141
+ "targetEntryFile", "sharedDigests"
142
+ ],
143
+ "properties": {
144
+ "id": { "type": "string", "minLength": 1 },
145
+ "sourceProvider": { "type": "string", "minLength": 1 },
146
+ "targetProvider": { "type": "string", "minLength": 1 },
147
+ "sourceDirectory": { "type": "string", "minLength": 1 },
148
+ "targetDirectory": { "type": "string", "minLength": 1 },
149
+ "compare": { "enum": ["names", "content", "content-and-mode"] },
150
+ "projection": { "$ref": "#/$defs/projection" },
151
+ "sourceSkills": {
152
+ "type": "array",
153
+ "items": { "type": "string", "minLength": 1 },
154
+ "uniqueItems": true
155
+ },
156
+ "targetSkills": {
157
+ "type": "array",
158
+ "items": { "type": "string", "minLength": 1 },
159
+ "uniqueItems": true
160
+ },
161
+ "requiredTargetExtras": {
162
+ "type": "array",
163
+ "items": { "type": "string", "minLength": 1 },
164
+ "uniqueItems": true
165
+ },
166
+ "targetEntryFile": { "type": "string", "minLength": 1 },
167
+ "sharedDigests": {
168
+ "type": "array",
169
+ "items": { "$ref": "#/$defs/sharedDigest" }
170
+ }
171
+ },
172
+ "additionalProperties": false
173
+ },
174
+ "file": {
175
+ "type": "object",
176
+ "required": ["path", "type", "mode", "hash"],
177
+ "properties": {
178
+ "path": { "type": "string" },
179
+ "type": { "enum": ["file", "symlink", "unsupported"] },
180
+ "mode": { "type": "string", "pattern": "^[0-7]{4}$" },
181
+ "hash": { "anyOf": [{ "$ref": "#/$defs/digest" }, { "type": "null" }] },
182
+ "size": { "type": "integer", "minimum": 0 },
183
+ "target": { "type": "string" }
184
+ },
185
+ "additionalProperties": false
186
+ }
187
+ },
188
+ "additionalProperties": false
189
+ }
@@ -0,0 +1,103 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/governance/manifest-v3.json",
4
+ "title": "Governance canonical manifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "id", "defaultRole", "outputDirectory", "lockFile", "registries", "artifactSchemas", "skillParityContracts", "sources"],
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "schemaVersion": { "const": 3 },
11
+ "id": { "type": "string", "minLength": 1 },
12
+ "defaultRole": { "type": "string", "minLength": 1 },
13
+ "outputDirectory": { "$ref": "#/$defs/repositoryPath" },
14
+ "lockFile": { "$ref": "#/$defs/repositoryPath" },
15
+ "registries": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["rules", "roles", "providers", "gates"],
19
+ "properties": {
20
+ "rules": { "$ref": "#/$defs/repositoryPath" },
21
+ "roles": { "$ref": "#/$defs/repositoryPath" },
22
+ "providers": { "$ref": "#/$defs/repositoryPath" },
23
+ "gates": { "$ref": "#/$defs/repositoryPath" }
24
+ }
25
+ },
26
+ "artifactSchemas": {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "required": ["diagnostic", "lock", "attestation", "upgradePlan"],
30
+ "properties": {
31
+ "diagnostic": { "$ref": "#/$defs/repositoryPath" },
32
+ "lock": { "$ref": "#/$defs/repositoryPath" },
33
+ "attestation": { "$ref": "#/$defs/repositoryPath" },
34
+ "upgradePlan": { "$ref": "#/$defs/repositoryPath" }
35
+ }
36
+ },
37
+ "skillParityContracts": {
38
+ "type": "array",
39
+ "minItems": 1,
40
+ "items": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": ["id", "sourceDirectory", "targetSelection", "compare", "required"],
44
+ "properties": {
45
+ "id": { "type": "string", "minLength": 1 },
46
+ "sourceDirectory": { "$ref": "#/$defs/repositoryPath" },
47
+ "targetSelection": { "const": "all-generated-skill-views" },
48
+ "compare": { "enum": ["names", "content", "content-and-mode"] },
49
+ "projection": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["module", "export", "files"],
53
+ "properties": {
54
+ "module": { "$ref": "#/$defs/repositoryPath" },
55
+ "export": { "type": "string", "minLength": 1 },
56
+ "files": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "uniqueItems": true }
57
+ }
58
+ },
59
+ "required": { "type": "boolean" }
60
+ }
61
+ }
62
+ },
63
+ "sources": {
64
+ "type": "array",
65
+ "minItems": 1,
66
+ "items": {
67
+ "type": "object",
68
+ "additionalProperties": false,
69
+ "required": ["id", "ownerRepo", "path", "required"],
70
+ "properties": {
71
+ "id": { "type": "string", "minLength": 1 },
72
+ "ownerRepo": { "type": "string", "minLength": 1 },
73
+ "path": { "$ref": "#/$defs/repositoryPath" },
74
+ "excludes": {
75
+ "type": "array",
76
+ "uniqueItems": true,
77
+ "items": {
78
+ "allOf": [
79
+ { "$ref": "#/$defs/repositoryPath" },
80
+ { "type": "string", "pattern": "/$" }
81
+ ]
82
+ }
83
+ },
84
+ "carrierProjection": {
85
+ "enum": [
86
+ "external-activation-state-v1",
87
+ "provider-certification-state-v1",
88
+ "review-capability-certification-state-v1"
89
+ ]
90
+ },
91
+ "required": { "type": "boolean" }
92
+ }
93
+ }
94
+ }
95
+ },
96
+ "$defs": {
97
+ "repositoryPath": {
98
+ "type": "string",
99
+ "minLength": 1,
100
+ "not": { "type": "string", "pattern": "^(?:/|[A-Za-z]:|.*(?:^|/)\\.\\.(?:/|$))" }
101
+ }
102
+ }
103
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/governance/plugin-aliases-v1.json",
4
+ "title": "Provider-derived plugin alias registry",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["$schema", "schemaVersion", "providerId", "aliases"],
8
+ "properties": {
9
+ "$schema": { "const": "./schemas/plugin-aliases.schema.json" },
10
+ "schemaVersion": { "const": 1 },
11
+ "providerId": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
12
+ "aliases": {
13
+ "type": "array",
14
+ "minItems": 1,
15
+ "uniqueItems": true,
16
+ "items": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["id", "alias", "source", "requiredEntries"],
20
+ "properties": {
21
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
22
+ "alias": { "$ref": "#/$defs/repositoryPath" },
23
+ "source": {
24
+ "oneOf": [
25
+ {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": ["kind", "key"],
29
+ "properties": {
30
+ "kind": { "const": "repositoryManagedTree" },
31
+ "key": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9]*$" }
32
+ }
33
+ },
34
+ {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": ["kind"],
38
+ "properties": { "kind": { "const": "skillView" } }
39
+ }
40
+ ]
41
+ },
42
+ "requiredEntries": {
43
+ "type": "array",
44
+ "minItems": 1,
45
+ "uniqueItems": true,
46
+ "items": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$" }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ },
52
+ "$defs": {
53
+ "repositoryPath": {
54
+ "type": "string",
55
+ "minLength": 1,
56
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*//)(?!.*\\\\)(?!.*\\/$)[A-Za-z0-9_.@/-]+$"
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,173 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://qijenchen.dev/schemas/provider-hook-coverage-v2.json",
4
+ "title": "Generated provider native-hook coverage evidence",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["$schema", "schemaVersion", "generated", "policy", "providers"],
8
+ "properties": {
9
+ "$schema": { "const": "../../../governance/canonical/schemas/provider-hook-coverage.schema.json" },
10
+ "schemaVersion": { "const": 2 },
11
+ "generated": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["generator", "canonicalHookRegistry", "providerRegistry", "inputSha256"],
15
+ "properties": {
16
+ "generator": { "const": "scripts/gen-codex-adapter.mjs" },
17
+ "canonicalHookRegistry": { "$ref": "#/$defs/repositoryPath" },
18
+ "providerRegistry": { "const": "packages/governance/canonical/providers.json" },
19
+ "inputSha256": {
20
+ "type": "object",
21
+ "additionalProperties": false,
22
+ "required": ["hookRegistrations", "providerRegistry", "coverageSchema"],
23
+ "properties": {
24
+ "hookRegistrations": { "$ref": "#/$defs/sha256" },
25
+ "providerRegistry": { "$ref": "#/$defs/sha256" },
26
+ "coverageSchema": { "$ref": "#/$defs/sha256" }
27
+ }
28
+ }
29
+ }
30
+ },
31
+ "policy": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["nativeProjectionIsFeedbackOnly", "nativeProjectionIsSecurityBoundary", "ciEquivalenceRequiresHookSpecificEvidence", "absenceOfProvenFallbackOutcome"],
35
+ "properties": {
36
+ "nativeProjectionIsFeedbackOnly": { "const": true },
37
+ "nativeProjectionIsSecurityBoundary": { "const": false },
38
+ "ciEquivalenceRequiresHookSpecificEvidence": { "const": true },
39
+ "absenceOfProvenFallbackOutcome": { "const": "not-certified" }
40
+ }
41
+ },
42
+ "providers": {
43
+ "type": "array",
44
+ "minItems": 1,
45
+ "items": { "$ref": "#/$defs/providerCoverage" }
46
+ }
47
+ },
48
+ "$defs": {
49
+ "repositoryPath": {
50
+ "type": "string",
51
+ "minLength": 1,
52
+ "not": { "pattern": "^(?:/|[A-Za-z]:|.*(?:^|/)\\.\\.(?:/|$))" }
53
+ },
54
+ "sha256": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
55
+ "stringArray": {
56
+ "type": "array",
57
+ "uniqueItems": true,
58
+ "items": { "type": "string", "minLength": 1 }
59
+ },
60
+ "hookBase": {
61
+ "type": "object",
62
+ "properties": {
63
+ "event": { "type": "string", "minLength": 1 },
64
+ "canonicalMatcher": { "type": "string" },
65
+ "hook": { "type": "string", "minLength": 1 },
66
+ "kind": { "const": "hook" },
67
+ "runtime": { "type": "string", "minLength": 1 },
68
+ "outputMode": { "enum": ["diagnostic", "blocking", "governance-context", "governance-decision", "governance-context-or-block"] },
69
+ "inputContract": { "enum": ["event-v1", "proposed-text-v1"] },
70
+ "transcriptRequirement": { "enum": ["none", "optional", "stable-required"] },
71
+ "requirements": { "$ref": "#/$defs/stringArray" }
72
+ }
73
+ },
74
+ "projectedHook": {
75
+ "allOf": [
76
+ { "$ref": "#/$defs/hookBase" },
77
+ {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "required": ["event", "nativeEvent", "canonicalMatcher", "hook", "kind", "runtime", "outputMode", "inputContract", "transcriptRequirement", "requirements", "projectedMatcher", "nativeCoverage", "certificationImpact"],
81
+ "properties": {
82
+ "event": { "type": "string", "minLength": 1 },
83
+ "nativeEvent": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_.:@/-]*$" },
84
+ "canonicalMatcher": { "type": "string" },
85
+ "hook": { "type": "string", "minLength": 1 },
86
+ "kind": { "const": "hook" },
87
+ "runtime": { "type": "string", "minLength": 1 },
88
+ "outputMode": { "enum": ["diagnostic", "blocking", "governance-context", "governance-decision", "governance-context-or-block"] },
89
+ "inputContract": { "enum": ["event-v1", "proposed-text-v1"] },
90
+ "transcriptRequirement": { "enum": ["none", "optional", "stable-required"] },
91
+ "requirements": { "$ref": "#/$defs/stringArray" },
92
+ "projectedMatcher": { "type": "string" },
93
+ "nativeCoverage": { "const": "projected" },
94
+ "certificationImpact": { "const": "runtime-certification-required" }
95
+ }
96
+ }
97
+ ]
98
+ },
99
+ "authoritativeFallback": {
100
+ "oneOf": [
101
+ {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "required": ["status"],
105
+ "properties": {
106
+ "status": { "const": "none" }
107
+ }
108
+ },
109
+ {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["status", "authority", "runner", "prepareArgv", "verifyArgv", "evidence", "detail"],
113
+ "properties": {
114
+ "status": { "const": "declared" },
115
+ "authority": { "$ref": "#/$defs/repositoryPath" },
116
+ "runner": { "const": "scripts/run-provider-hook.mjs" },
117
+ "prepareArgv": {
118
+ "const": ["--authority-decision", "prepare"]
119
+ },
120
+ "verifyArgv": {
121
+ "const": ["--authority-decision", "verify"]
122
+ },
123
+ "evidence": { "$ref": "#/$defs/repositoryPath" },
124
+ "detail": { "type": "string", "minLength": 1 }
125
+ }
126
+ }
127
+ ]
128
+ },
129
+ "excludedHook": {
130
+ "allOf": [
131
+ { "$ref": "#/$defs/hookBase" },
132
+ {
133
+ "type": "object",
134
+ "additionalProperties": false,
135
+ "required": ["event", "canonicalMatcher", "hook", "kind", "runtime", "outputMode", "inputContract", "transcriptRequirement", "requirements", "nativeCoverage", "reasonCode", "detail", "certificationImpact", "authoritativeFallback"],
136
+ "properties": {
137
+ "event": { "type": "string", "minLength": 1 },
138
+ "canonicalMatcher": { "type": "string" },
139
+ "hook": { "type": "string", "minLength": 1 },
140
+ "kind": { "const": "hook" },
141
+ "runtime": { "type": "string", "minLength": 1 },
142
+ "outputMode": { "enum": ["diagnostic", "blocking", "governance-context", "governance-decision", "governance-context-or-block"] },
143
+ "inputContract": { "enum": ["event-v1", "proposed-text-v1"] },
144
+ "transcriptRequirement": { "enum": ["none", "optional", "stable-required"] },
145
+ "requirements": { "$ref": "#/$defs/stringArray" },
146
+ "nativeCoverage": { "const": "gap" },
147
+ "reasonCode": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
148
+ "detail": { "type": "string", "minLength": 1 },
149
+ "certificationImpact": { "const": "not-certified" },
150
+ "authoritativeFallback": { "$ref": "#/$defs/authoritativeFallback" }
151
+ }
152
+ }
153
+ ]
154
+ },
155
+ "providerCoverage": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": ["provider", "nativeHooksDeclared", "hookEnforcement", "projectionStatus", "certificationClaim", "canonicalRegistrationCount", "projectedCount", "excludedCount", "projected", "excluded"],
159
+ "properties": {
160
+ "provider": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
161
+ "nativeHooksDeclared": { "type": "boolean" },
162
+ "hookEnforcement": { "enum": ["native-feedback-plus-ci", "ci-only"] },
163
+ "projectionStatus": { "enum": ["complete-projection", "partial-projection", "unavailable"] },
164
+ "certificationClaim": { "const": "projection-only-not-runtime-certified" },
165
+ "canonicalRegistrationCount": { "type": "integer", "minimum": 1 },
166
+ "projectedCount": { "type": "integer", "minimum": 0 },
167
+ "excludedCount": { "type": "integer", "minimum": 0 },
168
+ "projected": { "type": "array", "items": { "$ref": "#/$defs/projectedHook" } },
169
+ "excluded": { "type": "array", "items": { "$ref": "#/$defs/excludedHook" } }
170
+ }
171
+ }
172
+ }
173
+ }