structured-context 0.9.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/README.md +348 -0
- package/dist/commands/diagram.d.ts +5 -0
- package/dist/commands/diagram.js +12 -0
- package/dist/commands/docs.d.ts +1 -0
- package/dist/commands/docs.js +67 -0
- package/dist/commands/dump.d.ts +2 -0
- package/dist/commands/dump.js +6 -0
- package/dist/commands/plugins.d.ts +1 -0
- package/dist/commands/plugins.js +23 -0
- package/dist/commands/render.d.ts +6 -0
- package/dist/commands/render.js +35 -0
- package/dist/commands/schemas.d.ts +6 -0
- package/dist/commands/schemas.js +268 -0
- package/dist/commands/show.d.ts +4 -0
- package/dist/commands/show.js +7 -0
- package/dist/commands/spaces.d.ts +1 -0
- package/dist/commands/spaces.js +36 -0
- package/dist/commands/template-sync.d.ts +3 -0
- package/dist/commands/template-sync.js +13 -0
- package/dist/commands/validate-file.d.ts +28 -0
- package/dist/commands/validate-file.js +133 -0
- package/dist/commands/validate.d.ts +16 -0
- package/dist/commands/validate.js +349 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.js +179 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +6 -0
- package/dist/filter/augment-nodes.d.ts +23 -0
- package/dist/filter/augment-nodes.js +95 -0
- package/dist/filter/expand-include.d.ts +62 -0
- package/dist/filter/expand-include.js +181 -0
- package/dist/filter/filter-nodes.d.ts +21 -0
- package/dist/filter/filter-nodes.js +73 -0
- package/dist/filter/parse-expression.d.ts +20 -0
- package/dist/filter/parse-expression.js +60 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +161 -0
- package/dist/integrations/miro/cache.d.ts +21 -0
- package/dist/integrations/miro/cache.js +55 -0
- package/dist/integrations/miro/client.d.ts +99 -0
- package/dist/integrations/miro/client.js +118 -0
- package/dist/integrations/miro/layout.d.ts +28 -0
- package/dist/integrations/miro/layout.js +72 -0
- package/dist/integrations/miro/styles.d.ts +11 -0
- package/dist/integrations/miro/styles.js +65 -0
- package/dist/integrations/miro/sync.d.ts +8 -0
- package/dist/integrations/miro/sync.js +347 -0
- package/dist/plugin-api.d.ts +12 -0
- package/dist/plugin-api.js +7 -0
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/loader.d.ts +21 -0
- package/dist/plugins/loader.js +104 -0
- package/dist/plugins/markdown/index.d.ts +48 -0
- package/dist/plugins/markdown/index.js +51 -0
- package/dist/plugins/markdown/parse-embedded.d.ts +90 -0
- package/dist/plugins/markdown/parse-embedded.js +663 -0
- package/dist/plugins/markdown/read-space.d.ts +7 -0
- package/dist/plugins/markdown/read-space.js +89 -0
- package/dist/plugins/markdown/render-bullets.d.ts +2 -0
- package/dist/plugins/markdown/render-bullets.js +42 -0
- package/dist/plugins/markdown/render-mermaid.d.ts +2 -0
- package/dist/plugins/markdown/render-mermaid.js +57 -0
- package/dist/plugins/markdown/template-sync.d.ts +16 -0
- package/dist/plugins/markdown/template-sync.js +294 -0
- package/dist/plugins/markdown/util.d.ts +19 -0
- package/dist/plugins/markdown/util.js +80 -0
- package/dist/plugins/util.d.ts +60 -0
- package/dist/plugins/util.js +7 -0
- package/dist/read/read-space.d.ts +2 -0
- package/dist/read/read-space.js +22 -0
- package/dist/read/resolve-graph-edges.d.ts +11 -0
- package/dist/read/resolve-graph-edges.js +201 -0
- package/dist/read/wikilink-utils.d.ts +16 -0
- package/dist/read/wikilink-utils.js +38 -0
- package/dist/render/registry.d.ts +13 -0
- package/dist/render/registry.js +22 -0
- package/dist/render/render.d.ts +4 -0
- package/dist/render/render.js +28 -0
- package/dist/schema/evaluate-rule.d.ts +30 -0
- package/dist/schema/evaluate-rule.js +82 -0
- package/dist/schema/metadata-contract.d.ts +538 -0
- package/dist/schema/metadata-contract.js +115 -0
- package/dist/schema/schema-refs.d.ts +22 -0
- package/dist/schema/schema-refs.js +168 -0
- package/dist/schema/schema.d.ts +27 -0
- package/dist/schema/schema.js +378 -0
- package/dist/schema/validate-graph.d.ts +24 -0
- package/dist/schema/validate-graph.js +141 -0
- package/dist/schema/validate-rules.d.ts +10 -0
- package/dist/schema/validate-rules.js +51 -0
- package/dist/schemas/_ost_strict.json +81 -0
- package/dist/schemas/_sctx_base.json +72 -0
- package/dist/schemas/general.json +261 -0
- package/dist/schemas/generated/_structured_context_schema_meta.json +191 -0
- package/dist/schemas/knowledge_wiki.json +206 -0
- package/dist/schemas/strict_ost.json +97 -0
- package/dist/space-graph.d.ts +28 -0
- package/dist/space-graph.js +82 -0
- package/dist/types.d.ts +145 -0
- package/dist/types.js +0 -0
- package/docs/concepts.md +391 -0
- package/docs/config.md +140 -0
- package/docs/rules.md +120 -0
- package/docs/schemas.md +340 -0
- package/package.json +69 -0
- package/schemas/_ost_strict.json +81 -0
- package/schemas/_sctx_base.json +72 -0
- package/schemas/general.json +261 -0
- package/schemas/generated/_structured_context_schema_meta.json +191 -0
- package/schemas/knowledge_wiki.json +206 -0
- package/schemas/strict_ost.json +97 -0
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
import type { FromSchema } from 'json-schema-to-ts';
|
|
2
|
+
export declare const SCHEMA_META_ID = "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json";
|
|
3
|
+
/** Schema objects wrapping each prop group for type derivation via FromSchema. */
|
|
4
|
+
declare const EDGE_SCHEMA: {
|
|
5
|
+
readonly type: "object";
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly field: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly minLength: 1;
|
|
10
|
+
};
|
|
11
|
+
readonly fieldOn: {
|
|
12
|
+
readonly enum: readonly ["child", "parent"];
|
|
13
|
+
};
|
|
14
|
+
readonly multiple: {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly additionalProperties: false;
|
|
19
|
+
};
|
|
20
|
+
declare const EMBEDDING_SCHEMA: {
|
|
21
|
+
readonly type: "object";
|
|
22
|
+
readonly properties: {
|
|
23
|
+
readonly templateFormat: {
|
|
24
|
+
readonly enum: readonly ["heading", "list", "table", "page"];
|
|
25
|
+
};
|
|
26
|
+
readonly matchers: {
|
|
27
|
+
readonly type: "array";
|
|
28
|
+
readonly items: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly minLength: 1;
|
|
31
|
+
};
|
|
32
|
+
readonly minItems: 1;
|
|
33
|
+
};
|
|
34
|
+
readonly embeddedTemplateFields: {
|
|
35
|
+
readonly type: "array";
|
|
36
|
+
readonly items: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly minLength: 1;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly additionalProperties: false;
|
|
43
|
+
};
|
|
44
|
+
declare const HIERARCHY_LEVEL_SCHEMA: {
|
|
45
|
+
readonly type: "object";
|
|
46
|
+
readonly properties: {
|
|
47
|
+
readonly selfRef: {
|
|
48
|
+
readonly type: "boolean";
|
|
49
|
+
};
|
|
50
|
+
readonly selfRefField: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly minLength: 1;
|
|
53
|
+
};
|
|
54
|
+
readonly templateFormat: {
|
|
55
|
+
readonly enum: readonly ["heading", "list", "table", "page"];
|
|
56
|
+
};
|
|
57
|
+
readonly matchers: {
|
|
58
|
+
readonly type: "array";
|
|
59
|
+
readonly items: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly minLength: 1;
|
|
62
|
+
};
|
|
63
|
+
readonly minItems: 1;
|
|
64
|
+
};
|
|
65
|
+
readonly embeddedTemplateFields: {
|
|
66
|
+
readonly type: "array";
|
|
67
|
+
readonly items: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly minLength: 1;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
readonly field: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
readonly minLength: 1;
|
|
75
|
+
};
|
|
76
|
+
readonly fieldOn: {
|
|
77
|
+
readonly enum: readonly ["child", "parent"];
|
|
78
|
+
};
|
|
79
|
+
readonly multiple: {
|
|
80
|
+
readonly type: "boolean";
|
|
81
|
+
};
|
|
82
|
+
readonly type: {
|
|
83
|
+
readonly type: "string";
|
|
84
|
+
readonly minLength: 1;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
readonly required: readonly ["type"];
|
|
88
|
+
readonly additionalProperties: false;
|
|
89
|
+
};
|
|
90
|
+
declare const RULE_SCHEMA: {
|
|
91
|
+
readonly type: "object";
|
|
92
|
+
readonly properties: {
|
|
93
|
+
readonly id: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
readonly minLength: 1;
|
|
96
|
+
};
|
|
97
|
+
readonly category: {
|
|
98
|
+
readonly enum: readonly ["validation", "coherence", "workflow", "best-practice"];
|
|
99
|
+
};
|
|
100
|
+
readonly description: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
readonly minLength: 1;
|
|
103
|
+
};
|
|
104
|
+
readonly check: {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
readonly minLength: 1;
|
|
107
|
+
};
|
|
108
|
+
readonly type: {
|
|
109
|
+
readonly type: "string";
|
|
110
|
+
readonly minLength: 1;
|
|
111
|
+
};
|
|
112
|
+
readonly scope: {
|
|
113
|
+
readonly enum: readonly ["global"];
|
|
114
|
+
};
|
|
115
|
+
readonly override: {
|
|
116
|
+
readonly type: "boolean";
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
readonly required: readonly ["id", "category", "description", "check"];
|
|
120
|
+
readonly additionalProperties: false;
|
|
121
|
+
};
|
|
122
|
+
declare const RULE_REF_SCHEMA: {
|
|
123
|
+
readonly type: "object";
|
|
124
|
+
readonly properties: {
|
|
125
|
+
readonly $ref: {
|
|
126
|
+
readonly type: "string";
|
|
127
|
+
readonly minLength: 1;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
readonly required: readonly ["$ref"];
|
|
131
|
+
readonly additionalProperties: false;
|
|
132
|
+
};
|
|
133
|
+
declare const RELATIONSHIP_SCHEMA: {
|
|
134
|
+
readonly type: "object";
|
|
135
|
+
readonly properties: {
|
|
136
|
+
readonly templateFormat: {
|
|
137
|
+
readonly enum: readonly ["heading", "list", "table", "page"];
|
|
138
|
+
};
|
|
139
|
+
readonly matchers: {
|
|
140
|
+
readonly type: "array";
|
|
141
|
+
readonly items: {
|
|
142
|
+
readonly type: "string";
|
|
143
|
+
readonly minLength: 1;
|
|
144
|
+
};
|
|
145
|
+
readonly minItems: 1;
|
|
146
|
+
};
|
|
147
|
+
readonly embeddedTemplateFields: {
|
|
148
|
+
readonly type: "array";
|
|
149
|
+
readonly items: {
|
|
150
|
+
readonly type: "string";
|
|
151
|
+
readonly minLength: 1;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
readonly field: {
|
|
155
|
+
readonly type: "string";
|
|
156
|
+
readonly minLength: 1;
|
|
157
|
+
};
|
|
158
|
+
readonly fieldOn: {
|
|
159
|
+
readonly enum: readonly ["child", "parent"];
|
|
160
|
+
};
|
|
161
|
+
readonly multiple: {
|
|
162
|
+
readonly type: "boolean";
|
|
163
|
+
};
|
|
164
|
+
readonly parent: {
|
|
165
|
+
readonly type: "string";
|
|
166
|
+
readonly minLength: 1;
|
|
167
|
+
};
|
|
168
|
+
readonly type: {
|
|
169
|
+
readonly type: "string";
|
|
170
|
+
readonly minLength: 1;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
readonly required: readonly ["parent", "type"];
|
|
174
|
+
readonly additionalProperties: false;
|
|
175
|
+
};
|
|
176
|
+
export declare const METADATA_SCHEMA: {
|
|
177
|
+
readonly type: "object";
|
|
178
|
+
readonly properties: {
|
|
179
|
+
readonly hierarchy: {
|
|
180
|
+
readonly type: "object";
|
|
181
|
+
readonly properties: {
|
|
182
|
+
readonly levels: {
|
|
183
|
+
readonly type: "array";
|
|
184
|
+
readonly minItems: 1;
|
|
185
|
+
readonly items: {
|
|
186
|
+
readonly oneOf: readonly [{
|
|
187
|
+
readonly type: "string";
|
|
188
|
+
readonly minLength: 1;
|
|
189
|
+
}, {
|
|
190
|
+
readonly type: "object";
|
|
191
|
+
readonly properties: {
|
|
192
|
+
readonly selfRef: {
|
|
193
|
+
readonly type: "boolean";
|
|
194
|
+
};
|
|
195
|
+
readonly selfRefField: {
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
readonly minLength: 1;
|
|
198
|
+
};
|
|
199
|
+
readonly templateFormat: {
|
|
200
|
+
readonly enum: readonly ["heading", "list", "table", "page"];
|
|
201
|
+
};
|
|
202
|
+
readonly matchers: {
|
|
203
|
+
readonly type: "array";
|
|
204
|
+
readonly items: {
|
|
205
|
+
readonly type: "string";
|
|
206
|
+
readonly minLength: 1;
|
|
207
|
+
};
|
|
208
|
+
readonly minItems: 1;
|
|
209
|
+
};
|
|
210
|
+
readonly embeddedTemplateFields: {
|
|
211
|
+
readonly type: "array";
|
|
212
|
+
readonly items: {
|
|
213
|
+
readonly type: "string";
|
|
214
|
+
readonly minLength: 1;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
readonly field: {
|
|
218
|
+
readonly type: "string";
|
|
219
|
+
readonly minLength: 1;
|
|
220
|
+
};
|
|
221
|
+
readonly fieldOn: {
|
|
222
|
+
readonly enum: readonly ["child", "parent"];
|
|
223
|
+
};
|
|
224
|
+
readonly multiple: {
|
|
225
|
+
readonly type: "boolean";
|
|
226
|
+
};
|
|
227
|
+
readonly type: {
|
|
228
|
+
readonly type: "string";
|
|
229
|
+
readonly minLength: 1;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
readonly required: readonly ["type"];
|
|
233
|
+
readonly additionalProperties: false;
|
|
234
|
+
}];
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
readonly allowSkipLevels: {
|
|
238
|
+
readonly type: "boolean";
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
readonly required: readonly ["levels"];
|
|
242
|
+
readonly additionalProperties: false;
|
|
243
|
+
};
|
|
244
|
+
readonly relationships: {
|
|
245
|
+
readonly type: "array";
|
|
246
|
+
readonly items: {
|
|
247
|
+
readonly type: "object";
|
|
248
|
+
readonly properties: {
|
|
249
|
+
readonly templateFormat: {
|
|
250
|
+
readonly enum: readonly ["heading", "list", "table", "page"];
|
|
251
|
+
};
|
|
252
|
+
readonly matchers: {
|
|
253
|
+
readonly type: "array";
|
|
254
|
+
readonly items: {
|
|
255
|
+
readonly type: "string";
|
|
256
|
+
readonly minLength: 1;
|
|
257
|
+
};
|
|
258
|
+
readonly minItems: 1;
|
|
259
|
+
};
|
|
260
|
+
readonly embeddedTemplateFields: {
|
|
261
|
+
readonly type: "array";
|
|
262
|
+
readonly items: {
|
|
263
|
+
readonly type: "string";
|
|
264
|
+
readonly minLength: 1;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
readonly field: {
|
|
268
|
+
readonly type: "string";
|
|
269
|
+
readonly minLength: 1;
|
|
270
|
+
};
|
|
271
|
+
readonly fieldOn: {
|
|
272
|
+
readonly enum: readonly ["child", "parent"];
|
|
273
|
+
};
|
|
274
|
+
readonly multiple: {
|
|
275
|
+
readonly type: "boolean";
|
|
276
|
+
};
|
|
277
|
+
readonly parent: {
|
|
278
|
+
readonly type: "string";
|
|
279
|
+
readonly minLength: 1;
|
|
280
|
+
};
|
|
281
|
+
readonly type: {
|
|
282
|
+
readonly type: "string";
|
|
283
|
+
readonly minLength: 1;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
readonly required: readonly ["parent", "type"];
|
|
287
|
+
readonly additionalProperties: false;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
readonly aliases: {
|
|
291
|
+
readonly type: "object";
|
|
292
|
+
readonly additionalProperties: {
|
|
293
|
+
readonly type: "string";
|
|
294
|
+
readonly minLength: 1;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
readonly rules: {
|
|
298
|
+
readonly type: "array";
|
|
299
|
+
readonly items: {
|
|
300
|
+
readonly oneOf: readonly [{
|
|
301
|
+
readonly type: "object";
|
|
302
|
+
readonly properties: {
|
|
303
|
+
readonly id: {
|
|
304
|
+
readonly type: "string";
|
|
305
|
+
readonly minLength: 1;
|
|
306
|
+
};
|
|
307
|
+
readonly category: {
|
|
308
|
+
readonly enum: readonly ["validation", "coherence", "workflow", "best-practice"];
|
|
309
|
+
};
|
|
310
|
+
readonly description: {
|
|
311
|
+
readonly type: "string";
|
|
312
|
+
readonly minLength: 1;
|
|
313
|
+
};
|
|
314
|
+
readonly check: {
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
readonly minLength: 1;
|
|
317
|
+
};
|
|
318
|
+
readonly type: {
|
|
319
|
+
readonly type: "string";
|
|
320
|
+
readonly minLength: 1;
|
|
321
|
+
};
|
|
322
|
+
readonly scope: {
|
|
323
|
+
readonly enum: readonly ["global"];
|
|
324
|
+
};
|
|
325
|
+
readonly override: {
|
|
326
|
+
readonly type: "boolean";
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
readonly required: readonly ["id", "category", "description", "check"];
|
|
330
|
+
readonly additionalProperties: false;
|
|
331
|
+
}, {
|
|
332
|
+
readonly type: "object";
|
|
333
|
+
readonly properties: {
|
|
334
|
+
readonly $ref: {
|
|
335
|
+
readonly type: "string";
|
|
336
|
+
readonly minLength: 1;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
readonly required: readonly ["$ref"];
|
|
340
|
+
readonly additionalProperties: false;
|
|
341
|
+
}];
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
readonly additionalProperties: false;
|
|
346
|
+
};
|
|
347
|
+
export declare const DIALECT_META_SCHEMA: {
|
|
348
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
349
|
+
readonly $id: "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json";
|
|
350
|
+
readonly title: "structured-context schema dialect";
|
|
351
|
+
readonly description: "Extends JSON Schema Draft-07 with top-level $metadata for hierarchy and rule metadata.";
|
|
352
|
+
readonly type: "object";
|
|
353
|
+
readonly allOf: readonly [{
|
|
354
|
+
readonly $ref: "http://json-schema.org/draft-07/schema#";
|
|
355
|
+
}];
|
|
356
|
+
readonly properties: {
|
|
357
|
+
readonly $metadata: {
|
|
358
|
+
readonly type: "object";
|
|
359
|
+
readonly properties: {
|
|
360
|
+
readonly hierarchy: {
|
|
361
|
+
readonly type: "object";
|
|
362
|
+
readonly properties: {
|
|
363
|
+
readonly levels: {
|
|
364
|
+
readonly type: "array";
|
|
365
|
+
readonly minItems: 1;
|
|
366
|
+
readonly items: {
|
|
367
|
+
readonly oneOf: readonly [{
|
|
368
|
+
readonly type: "string";
|
|
369
|
+
readonly minLength: 1;
|
|
370
|
+
}, {
|
|
371
|
+
readonly type: "object";
|
|
372
|
+
readonly properties: {
|
|
373
|
+
readonly selfRef: {
|
|
374
|
+
readonly type: "boolean";
|
|
375
|
+
};
|
|
376
|
+
readonly selfRefField: {
|
|
377
|
+
readonly type: "string";
|
|
378
|
+
readonly minLength: 1;
|
|
379
|
+
};
|
|
380
|
+
readonly templateFormat: {
|
|
381
|
+
readonly enum: readonly ["heading", "list", "table", "page"];
|
|
382
|
+
};
|
|
383
|
+
readonly matchers: {
|
|
384
|
+
readonly type: "array";
|
|
385
|
+
readonly items: {
|
|
386
|
+
readonly type: "string";
|
|
387
|
+
readonly minLength: 1;
|
|
388
|
+
};
|
|
389
|
+
readonly minItems: 1;
|
|
390
|
+
};
|
|
391
|
+
readonly embeddedTemplateFields: {
|
|
392
|
+
readonly type: "array";
|
|
393
|
+
readonly items: {
|
|
394
|
+
readonly type: "string";
|
|
395
|
+
readonly minLength: 1;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
readonly field: {
|
|
399
|
+
readonly type: "string";
|
|
400
|
+
readonly minLength: 1;
|
|
401
|
+
};
|
|
402
|
+
readonly fieldOn: {
|
|
403
|
+
readonly enum: readonly ["child", "parent"];
|
|
404
|
+
};
|
|
405
|
+
readonly multiple: {
|
|
406
|
+
readonly type: "boolean";
|
|
407
|
+
};
|
|
408
|
+
readonly type: {
|
|
409
|
+
readonly type: "string";
|
|
410
|
+
readonly minLength: 1;
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
readonly required: readonly ["type"];
|
|
414
|
+
readonly additionalProperties: false;
|
|
415
|
+
}];
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
readonly allowSkipLevels: {
|
|
419
|
+
readonly type: "boolean";
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
readonly required: readonly ["levels"];
|
|
423
|
+
readonly additionalProperties: false;
|
|
424
|
+
};
|
|
425
|
+
readonly relationships: {
|
|
426
|
+
readonly type: "array";
|
|
427
|
+
readonly items: {
|
|
428
|
+
readonly type: "object";
|
|
429
|
+
readonly properties: {
|
|
430
|
+
readonly templateFormat: {
|
|
431
|
+
readonly enum: readonly ["heading", "list", "table", "page"];
|
|
432
|
+
};
|
|
433
|
+
readonly matchers: {
|
|
434
|
+
readonly type: "array";
|
|
435
|
+
readonly items: {
|
|
436
|
+
readonly type: "string";
|
|
437
|
+
readonly minLength: 1;
|
|
438
|
+
};
|
|
439
|
+
readonly minItems: 1;
|
|
440
|
+
};
|
|
441
|
+
readonly embeddedTemplateFields: {
|
|
442
|
+
readonly type: "array";
|
|
443
|
+
readonly items: {
|
|
444
|
+
readonly type: "string";
|
|
445
|
+
readonly minLength: 1;
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
readonly field: {
|
|
449
|
+
readonly type: "string";
|
|
450
|
+
readonly minLength: 1;
|
|
451
|
+
};
|
|
452
|
+
readonly fieldOn: {
|
|
453
|
+
readonly enum: readonly ["child", "parent"];
|
|
454
|
+
};
|
|
455
|
+
readonly multiple: {
|
|
456
|
+
readonly type: "boolean";
|
|
457
|
+
};
|
|
458
|
+
readonly parent: {
|
|
459
|
+
readonly type: "string";
|
|
460
|
+
readonly minLength: 1;
|
|
461
|
+
};
|
|
462
|
+
readonly type: {
|
|
463
|
+
readonly type: "string";
|
|
464
|
+
readonly minLength: 1;
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
readonly required: readonly ["parent", "type"];
|
|
468
|
+
readonly additionalProperties: false;
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
readonly aliases: {
|
|
472
|
+
readonly type: "object";
|
|
473
|
+
readonly additionalProperties: {
|
|
474
|
+
readonly type: "string";
|
|
475
|
+
readonly minLength: 1;
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
readonly rules: {
|
|
479
|
+
readonly type: "array";
|
|
480
|
+
readonly items: {
|
|
481
|
+
readonly oneOf: readonly [{
|
|
482
|
+
readonly type: "object";
|
|
483
|
+
readonly properties: {
|
|
484
|
+
readonly id: {
|
|
485
|
+
readonly type: "string";
|
|
486
|
+
readonly minLength: 1;
|
|
487
|
+
};
|
|
488
|
+
readonly category: {
|
|
489
|
+
readonly enum: readonly ["validation", "coherence", "workflow", "best-practice"];
|
|
490
|
+
};
|
|
491
|
+
readonly description: {
|
|
492
|
+
readonly type: "string";
|
|
493
|
+
readonly minLength: 1;
|
|
494
|
+
};
|
|
495
|
+
readonly check: {
|
|
496
|
+
readonly type: "string";
|
|
497
|
+
readonly minLength: 1;
|
|
498
|
+
};
|
|
499
|
+
readonly type: {
|
|
500
|
+
readonly type: "string";
|
|
501
|
+
readonly minLength: 1;
|
|
502
|
+
};
|
|
503
|
+
readonly scope: {
|
|
504
|
+
readonly enum: readonly ["global"];
|
|
505
|
+
};
|
|
506
|
+
readonly override: {
|
|
507
|
+
readonly type: "boolean";
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
readonly required: readonly ["id", "category", "description", "check"];
|
|
511
|
+
readonly additionalProperties: false;
|
|
512
|
+
}, {
|
|
513
|
+
readonly type: "object";
|
|
514
|
+
readonly properties: {
|
|
515
|
+
readonly $ref: {
|
|
516
|
+
readonly type: "string";
|
|
517
|
+
readonly minLength: 1;
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
readonly required: readonly ["$ref"];
|
|
521
|
+
readonly additionalProperties: false;
|
|
522
|
+
}];
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
readonly additionalProperties: false;
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
export type MetadataContract = FromSchema<typeof METADATA_SCHEMA>;
|
|
531
|
+
export type MetadataContractHierarchyLevel = FromSchema<typeof HIERARCHY_LEVEL_SCHEMA>;
|
|
532
|
+
export type MetadataContractRelationship = FromSchema<typeof RELATIONSHIP_SCHEMA>;
|
|
533
|
+
export type SharedEdgeFields = FromSchema<typeof EDGE_SCHEMA>;
|
|
534
|
+
export type SharedEmbeddingFields = FromSchema<typeof EMBEDDING_SCHEMA>;
|
|
535
|
+
export type Rule = FromSchema<typeof RULE_SCHEMA>;
|
|
536
|
+
export type RuleRef = FromSchema<typeof RULE_REF_SCHEMA>;
|
|
537
|
+
export type RuleEntry = Rule | RuleRef;
|
|
538
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export const SCHEMA_META_ID = 'https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json';
|
|
2
|
+
/** Graph edge routing fields shared by hierarchy levels and relationships. */
|
|
3
|
+
const EDGE_PROPS = {
|
|
4
|
+
field: { type: 'string', minLength: 1 },
|
|
5
|
+
fieldOn: { enum: ['child', 'parent'] },
|
|
6
|
+
multiple: { type: 'boolean' },
|
|
7
|
+
};
|
|
8
|
+
/** Embedding/template hint fields shared by hierarchy levels and relationships. */
|
|
9
|
+
const EMBEDDING_PROPS = {
|
|
10
|
+
templateFormat: { enum: ['heading', 'list', 'table', 'page'] },
|
|
11
|
+
matchers: { type: 'array', items: { type: 'string', minLength: 1 }, minItems: 1 },
|
|
12
|
+
embeddedTemplateFields: { type: 'array', items: { type: 'string', minLength: 1 } },
|
|
13
|
+
};
|
|
14
|
+
/** Schema objects wrapping each prop group for type derivation via FromSchema. */
|
|
15
|
+
const EDGE_SCHEMA = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: EDGE_PROPS,
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
};
|
|
20
|
+
const EMBEDDING_SCHEMA = {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: EMBEDDING_PROPS,
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
};
|
|
25
|
+
const HIERARCHY_LEVEL_SCHEMA = {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
type: { type: 'string', minLength: 1 },
|
|
29
|
+
...EDGE_PROPS,
|
|
30
|
+
...EMBEDDING_PROPS,
|
|
31
|
+
selfRef: { type: 'boolean' },
|
|
32
|
+
selfRefField: { type: 'string', minLength: 1 },
|
|
33
|
+
},
|
|
34
|
+
required: ['type'],
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
};
|
|
37
|
+
const RULE_SCHEMA = {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
id: { type: 'string', minLength: 1 },
|
|
41
|
+
category: { enum: ['validation', 'coherence', 'workflow', 'best-practice'] },
|
|
42
|
+
description: { type: 'string', minLength: 1 },
|
|
43
|
+
check: { type: 'string', minLength: 1 },
|
|
44
|
+
type: { type: 'string', minLength: 1 },
|
|
45
|
+
scope: { enum: ['global'] },
|
|
46
|
+
override: { type: 'boolean' },
|
|
47
|
+
},
|
|
48
|
+
required: ['id', 'category', 'description', 'check'],
|
|
49
|
+
additionalProperties: false,
|
|
50
|
+
};
|
|
51
|
+
const RULE_REF_SCHEMA = {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
$ref: { type: 'string', minLength: 1 },
|
|
55
|
+
},
|
|
56
|
+
required: ['$ref'],
|
|
57
|
+
additionalProperties: false,
|
|
58
|
+
};
|
|
59
|
+
const RELATIONSHIP_SCHEMA = {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
parent: { type: 'string', minLength: 1 },
|
|
63
|
+
type: { type: 'string', minLength: 1 },
|
|
64
|
+
...EDGE_PROPS,
|
|
65
|
+
...EMBEDDING_PROPS,
|
|
66
|
+
},
|
|
67
|
+
required: ['parent', 'type'],
|
|
68
|
+
additionalProperties: false,
|
|
69
|
+
};
|
|
70
|
+
export const METADATA_SCHEMA = {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
hierarchy: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
levels: {
|
|
77
|
+
type: 'array',
|
|
78
|
+
minItems: 1,
|
|
79
|
+
items: {
|
|
80
|
+
oneOf: [{ type: 'string', minLength: 1 }, HIERARCHY_LEVEL_SCHEMA],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
allowSkipLevels: { type: 'boolean' },
|
|
84
|
+
},
|
|
85
|
+
required: ['levels'],
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
},
|
|
88
|
+
relationships: {
|
|
89
|
+
type: 'array',
|
|
90
|
+
items: RELATIONSHIP_SCHEMA,
|
|
91
|
+
},
|
|
92
|
+
aliases: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
additionalProperties: { type: 'string', minLength: 1 },
|
|
95
|
+
},
|
|
96
|
+
rules: {
|
|
97
|
+
type: 'array',
|
|
98
|
+
items: {
|
|
99
|
+
oneOf: [RULE_SCHEMA, RULE_REF_SCHEMA],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
additionalProperties: false,
|
|
104
|
+
};
|
|
105
|
+
export const DIALECT_META_SCHEMA = {
|
|
106
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
107
|
+
$id: SCHEMA_META_ID,
|
|
108
|
+
title: 'structured-context schema dialect',
|
|
109
|
+
description: 'Extends JSON Schema Draft-07 with top-level $metadata for hierarchy and rule metadata.',
|
|
110
|
+
type: 'object',
|
|
111
|
+
allOf: [{ $ref: 'http://json-schema.org/draft-07/schema#' }],
|
|
112
|
+
properties: {
|
|
113
|
+
$metadata: METADATA_SCHEMA,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AnySchemaObject } from 'ajv';
|
|
2
|
+
export { decodeJsonPointerToken, isObject, resolveJsonPointer, resolveRefTarget };
|
|
3
|
+
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
4
|
+
declare function decodeJsonPointerToken(token: string): string;
|
|
5
|
+
declare function resolveJsonPointer(root: AnySchemaObject, pointer: string, fullRef: string): AnySchemaObject;
|
|
6
|
+
declare function resolveRefTarget(ref: string, currentRootSchema: AnySchemaObject, schemaRefRegistry: Map<string, AnySchemaObject>): {
|
|
7
|
+
schema: AnySchemaObject;
|
|
8
|
+
rootSchema: AnySchemaObject;
|
|
9
|
+
refKey: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Resolve a schema definition, following cross-file and internal refs transitively.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveRef(propDef: AnySchemaObject | undefined, schema: AnySchemaObject, schemaRefRegistry: Map<string, AnySchemaObject>): AnySchemaObject | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Merge properties and required fields from allOf entries recursively across refs.
|
|
17
|
+
* allOf entries are flattened depth-first; direct properties on later fragments override earlier ones.
|
|
18
|
+
*/
|
|
19
|
+
export declare function mergeVariantProperties(variant: AnySchemaObject, schema: AnySchemaObject, schemaRefRegistry: Map<string, AnySchemaObject>): {
|
|
20
|
+
properties: Record<string, AnySchemaObject>;
|
|
21
|
+
required: string[];
|
|
22
|
+
};
|