@nexural/schema 0.1.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.
@@ -0,0 +1,131 @@
1
+ {
2
+ "$ref": "#/definitions/warehouse-index",
3
+ "definitions": {
4
+ "warehouse-index": {
5
+ "type": "object",
6
+ "properties": {
7
+ "schema_version": {
8
+ "type": "number",
9
+ "const": 1
10
+ },
11
+ "warehouse": {
12
+ "type": "string",
13
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
14
+ },
15
+ "generated_at": {
16
+ "type": "string",
17
+ "format": "date-time"
18
+ },
19
+ "generator_version": {
20
+ "type": "string",
21
+ "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
22
+ },
23
+ "count": {
24
+ "type": "integer",
25
+ "minimum": 0
26
+ },
27
+ "entries": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "object",
31
+ "properties": {
32
+ "id": {
33
+ "anyOf": [
34
+ {
35
+ "type": "string",
36
+ "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
37
+ },
38
+ {
39
+ "type": "string",
40
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
41
+ }
42
+ ]
43
+ },
44
+ "path": {
45
+ "type": "string"
46
+ },
47
+ "title": {
48
+ "type": "string"
49
+ },
50
+ "tags": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "string",
54
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
55
+ }
56
+ },
57
+ "updated": {
58
+ "type": "string",
59
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
60
+ },
61
+ "last_reviewed": {
62
+ "type": "string",
63
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
64
+ },
65
+ "source_type": {
66
+ "type": "string",
67
+ "enum": [
68
+ "principle",
69
+ "playbook",
70
+ "framework",
71
+ "template",
72
+ "case-study",
73
+ "decision",
74
+ "reference",
75
+ "snippet",
76
+ "checklist",
77
+ "rubric",
78
+ "post-mortem"
79
+ ]
80
+ }
81
+ },
82
+ "required": [
83
+ "id",
84
+ "path",
85
+ "title",
86
+ "tags",
87
+ "updated",
88
+ "last_reviewed",
89
+ "source_type"
90
+ ],
91
+ "additionalProperties": false
92
+ }
93
+ },
94
+ "health": {
95
+ "type": "object",
96
+ "properties": {
97
+ "decayed_entries": {
98
+ "type": "integer",
99
+ "minimum": 0
100
+ },
101
+ "draft_entries": {
102
+ "type": "integer",
103
+ "minimum": 0
104
+ },
105
+ "scorecard": {
106
+ "type": "integer",
107
+ "minimum": 0,
108
+ "maximum": 100
109
+ }
110
+ },
111
+ "required": [
112
+ "decayed_entries",
113
+ "draft_entries"
114
+ ],
115
+ "additionalProperties": false
116
+ }
117
+ },
118
+ "required": [
119
+ "schema_version",
120
+ "warehouse",
121
+ "generated_at",
122
+ "generator_version",
123
+ "count",
124
+ "entries",
125
+ "health"
126
+ ],
127
+ "additionalProperties": false
128
+ }
129
+ },
130
+ "$schema": "http://json-schema.org/draft-07/schema#"
131
+ }
@@ -0,0 +1,260 @@
1
+ {
2
+ "$ref": "#/definitions/warehouse-meta",
3
+ "definitions": {
4
+ "warehouse-meta": {
5
+ "type": "object",
6
+ "properties": {
7
+ "schema_version": {
8
+ "type": "number",
9
+ "const": 1
10
+ },
11
+ "name": {
12
+ "type": "string",
13
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
14
+ },
15
+ "tier": {
16
+ "type": "string",
17
+ "enum": [
18
+ "public",
19
+ "internal",
20
+ "private-encrypted"
21
+ ]
22
+ },
23
+ "description": {
24
+ "type": "string",
25
+ "minLength": 20,
26
+ "maxLength": 500
27
+ },
28
+ "owner": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "created": {
33
+ "type": "string",
34
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
35
+ },
36
+ "last_reviewed": {
37
+ "type": "string",
38
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
39
+ },
40
+ "decay_rate_days": {
41
+ "type": "integer",
42
+ "exclusiveMinimum": 0,
43
+ "maximum": 3650
44
+ },
45
+ "status": {
46
+ "type": "string",
47
+ "enum": [
48
+ "active",
49
+ "seeded",
50
+ "archived",
51
+ "deprecated",
52
+ "merged"
53
+ ]
54
+ },
55
+ "merged_into": {
56
+ "type": "string",
57
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
58
+ },
59
+ "federation": {
60
+ "type": "string",
61
+ "enum": [
62
+ "factory",
63
+ "lifeops"
64
+ ]
65
+ },
66
+ "trust": {
67
+ "anyOf": [
68
+ {
69
+ "type": "object",
70
+ "properties": {
71
+ "encryption": {
72
+ "type": "string",
73
+ "const": "none"
74
+ }
75
+ },
76
+ "required": [
77
+ "encryption"
78
+ ],
79
+ "additionalProperties": false
80
+ },
81
+ {
82
+ "type": "object",
83
+ "properties": {
84
+ "encryption": {
85
+ "type": "string",
86
+ "const": "age+sops"
87
+ },
88
+ "key_source": {
89
+ "type": "string",
90
+ "enum": [
91
+ "yubikey-primary",
92
+ "yubikey-backup",
93
+ "1password-emergency"
94
+ ]
95
+ },
96
+ "recovery": {
97
+ "type": "string",
98
+ "minLength": 1
99
+ },
100
+ "filename_strategy": {
101
+ "type": "string",
102
+ "enum": [
103
+ "plaintext",
104
+ "ulid"
105
+ ]
106
+ }
107
+ },
108
+ "required": [
109
+ "encryption",
110
+ "key_source",
111
+ "recovery",
112
+ "filename_strategy"
113
+ ],
114
+ "additionalProperties": false
115
+ }
116
+ ]
117
+ },
118
+ "backup": {
119
+ "type": "object",
120
+ "properties": {
121
+ "destination": {
122
+ "type": "string",
123
+ "format": "uri"
124
+ },
125
+ "cadence": {
126
+ "type": "string",
127
+ "enum": [
128
+ "realtime",
129
+ "hourly",
130
+ "nightly",
131
+ "weekly"
132
+ ]
133
+ },
134
+ "retention_days": {
135
+ "type": "integer",
136
+ "exclusiveMinimum": 0
137
+ }
138
+ },
139
+ "required": [
140
+ "destination",
141
+ "cadence",
142
+ "retention_days"
143
+ ],
144
+ "additionalProperties": false
145
+ },
146
+ "mcp": {
147
+ "type": "object",
148
+ "properties": {
149
+ "tool_prefix": {
150
+ "type": "string",
151
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
152
+ },
153
+ "exposes": {
154
+ "type": "array",
155
+ "items": {
156
+ "type": "string",
157
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
158
+ },
159
+ "minItems": 1
160
+ }
161
+ },
162
+ "required": [
163
+ "tool_prefix",
164
+ "exposes"
165
+ ],
166
+ "additionalProperties": false
167
+ },
168
+ "cross_refs": {
169
+ "type": "object",
170
+ "properties": {
171
+ "consumes_from": {
172
+ "type": "array",
173
+ "items": {
174
+ "type": "string",
175
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
176
+ },
177
+ "default": []
178
+ },
179
+ "exposed_to": {
180
+ "type": "object",
181
+ "properties": {
182
+ "public": {
183
+ "type": "boolean"
184
+ },
185
+ "agents": {
186
+ "type": "boolean"
187
+ },
188
+ "human": {
189
+ "type": "boolean"
190
+ }
191
+ },
192
+ "required": [
193
+ "public",
194
+ "agents",
195
+ "human"
196
+ ],
197
+ "additionalProperties": false
198
+ }
199
+ },
200
+ "required": [
201
+ "exposed_to"
202
+ ],
203
+ "additionalProperties": false
204
+ },
205
+ "metrics": {
206
+ "type": "object",
207
+ "properties": {
208
+ "target_entries": {
209
+ "type": "integer",
210
+ "minimum": 0
211
+ },
212
+ "target_scorecard": {
213
+ "type": "integer",
214
+ "minimum": 0,
215
+ "maximum": 100
216
+ }
217
+ },
218
+ "additionalProperties": false
219
+ },
220
+ "links": {
221
+ "type": "object",
222
+ "properties": {
223
+ "repo": {
224
+ "type": "string",
225
+ "format": "uri",
226
+ "pattern": "^https:\\/\\/github\\.com\\/"
227
+ },
228
+ "docs": {
229
+ "type": "string",
230
+ "format": "uri"
231
+ }
232
+ },
233
+ "required": [
234
+ "repo"
235
+ ],
236
+ "additionalProperties": false
237
+ }
238
+ },
239
+ "required": [
240
+ "schema_version",
241
+ "name",
242
+ "tier",
243
+ "description",
244
+ "owner",
245
+ "created",
246
+ "last_reviewed",
247
+ "decay_rate_days",
248
+ "status",
249
+ "federation",
250
+ "trust",
251
+ "backup",
252
+ "mcp",
253
+ "cross_refs",
254
+ "links"
255
+ ],
256
+ "additionalProperties": false
257
+ }
258
+ },
259
+ "$schema": "http://json-schema.org/draft-07/schema#"
260
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@nexural/schema",
3
+ "version": "0.1.0",
4
+ "description": "Canonical Zod schemas for the Nexural Federation (meta, frontmatter, MCP envelope, telemetry, recipes, lockfile, cost envelope, model router, external MCP, revocation).",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./json-schema/*": "./dist/json-schema/*.json"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "CHANGELOG.md"
20
+ ],
21
+ "dependencies": {
22
+ "zod": "^3.24.1",
23
+ "zod-to-json-schema": "^3.24.1"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "provenance": true
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/JasonTeixeira/nexural-meta.git",
32
+ "directory": "packages/schema"
33
+ },
34
+ "homepage": "https://github.com/JasonTeixeira/nexural-meta/tree/main/packages/schema#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/JasonTeixeira/nexural-meta/issues"
37
+ },
38
+ "scripts": {
39
+ "build": "tsup && node scripts/export-json-schema.mjs",
40
+ "test": "vitest run",
41
+ "test:coverage": "vitest run --coverage",
42
+ "lint": "eslint src test",
43
+ "typecheck": "tsc --noEmit",
44
+ "clean": "rm -rf dist .turbo"
45
+ }
46
+ }