Skip to content

Commit 247bc0b

Browse files
committed
Sync native syntax structural schema
1 parent b842238 commit 247bc0b

2 files changed

Lines changed: 379 additions & 0 deletions

File tree

Lines changed: 373 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,373 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://agent-semantic-protocols.local/schemas/semantic-native-syntax-fact-index.v1.schema.json",
4+
"title": "Semantic Native Syntax Fact Index",
5+
"description": "Language-neutral parser-owned syntax facts used by semantic language providers before falling back to text search.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"required": [
9+
"schemaId",
10+
"schemaVersion",
11+
"protocolId",
12+
"protocolVersion",
13+
"languageId",
14+
"providerId",
15+
"projectRoot",
16+
"facts"
17+
],
18+
"properties": {
19+
"schemaId": {
20+
"const": "agent.semantic-protocols.semantic-native-syntax-fact-index"
21+
},
22+
"schemaVersion": {
23+
"const": "1"
24+
},
25+
"protocolId": {
26+
"const": "agent.semantic-protocols.semantic-language"
27+
},
28+
"protocolVersion": {
29+
"const": "1"
30+
},
31+
"languageId": {
32+
"type": "string",
33+
"pattern": "^[a-z][a-z0-9_-]*$"
34+
},
35+
"providerId": {
36+
"type": "string",
37+
"pattern": "^[a-z][a-z0-9_-]*$"
38+
},
39+
"projectRoot": {
40+
"type": "string",
41+
"minLength": 1
42+
},
43+
"packageName": {
44+
"type": "string",
45+
"minLength": 1
46+
},
47+
"scope": {
48+
"enum": [
49+
"workspace",
50+
"prime",
51+
"owner",
52+
"query",
53+
"changed",
54+
"custom"
55+
]
56+
},
57+
"query": {
58+
"type": "string",
59+
"minLength": 1
60+
},
61+
"queryIntent": {
62+
"$ref": "#/$defs/queryIntent"
63+
},
64+
"facts": {
65+
"type": "array",
66+
"items": {
67+
"$ref": "#/$defs/nativeSyntaxFact"
68+
}
69+
},
70+
"indexes": {
71+
"type": "array",
72+
"items": {
73+
"$ref": "#/$defs/indexDescriptor"
74+
}
75+
},
76+
"notes": {
77+
"type": "array",
78+
"items": {
79+
"$ref": "#/$defs/note"
80+
}
81+
}
82+
},
83+
"$defs": {
84+
"scalar": {
85+
"oneOf": [
86+
{
87+
"type": "string"
88+
},
89+
{
90+
"type": "number"
91+
},
92+
{
93+
"type": "boolean"
94+
},
95+
{
96+
"type": "array",
97+
"items": {
98+
"oneOf": [
99+
{
100+
"type": "string"
101+
},
102+
{
103+
"type": "number"
104+
},
105+
{
106+
"type": "boolean"
107+
}
108+
]
109+
}
110+
}
111+
]
112+
},
113+
"fields": {
114+
"type": "object",
115+
"additionalProperties": {
116+
"$ref": "#/$defs/scalar"
117+
}
118+
},
119+
"projectPath": {
120+
"$ref": "semantic-source-location.v1.schema.json#/$defs/projectPath"
121+
},
122+
"location": {
123+
"$ref": "semantic-source-location.v1.schema.json#/$defs/location"
124+
},
125+
"factKind": {
126+
"enum": [
127+
"module",
128+
"owner",
129+
"item",
130+
"function",
131+
"method",
132+
"class",
133+
"struct",
134+
"enum",
135+
"interface",
136+
"trait",
137+
"type",
138+
"import",
139+
"export",
140+
"reexport",
141+
"argument",
142+
"binding",
143+
"call",
144+
"constant",
145+
"doc",
146+
"heading",
147+
"property",
148+
"drawer",
149+
"table",
150+
"block",
151+
"link",
152+
"code-fence",
153+
"field",
154+
"include",
155+
"macro",
156+
"attribute",
157+
"decorator",
158+
"test",
159+
"public-api",
160+
"dependency-api",
161+
"config",
162+
"custom"
163+
]
164+
},
165+
"factSource": {
166+
"enum": [
167+
"native-parser",
168+
"type-checker",
169+
"manifest",
170+
"test-index",
171+
"provider-policy",
172+
"custom"
173+
]
174+
},
175+
"visibility": {
176+
"enum": [
177+
"public",
178+
"private",
179+
"protected",
180+
"internal",
181+
"crate",
182+
"super",
183+
"self",
184+
"package",
185+
"module",
186+
"restricted",
187+
"unknown"
188+
]
189+
},
190+
"queryIntent": {
191+
"type": "object",
192+
"additionalProperties": false,
193+
"required": [
194+
"kind",
195+
"term"
196+
],
197+
"properties": {
198+
"kind": {
199+
"type": "string",
200+
"pattern": "^[a-z][a-z0-9_-]*(\\.[a-z][a-z0-9_-]*)*$"
201+
},
202+
"term": {
203+
"type": "string",
204+
"minLength": 1
205+
},
206+
"languageKind": {
207+
"type": "string",
208+
"minLength": 1
209+
},
210+
"fields": {
211+
"$ref": "#/$defs/fields"
212+
}
213+
}
214+
},
215+
"relation": {
216+
"type": "object",
217+
"additionalProperties": false,
218+
"required": [
219+
"kind",
220+
"target"
221+
],
222+
"properties": {
223+
"kind": {
224+
"enum": [
225+
"contains",
226+
"imports",
227+
"exports",
228+
"reexports",
229+
"calls",
230+
"tests",
231+
"implements",
232+
"references",
233+
"related",
234+
"custom"
235+
]
236+
},
237+
"target": {
238+
"type": "string",
239+
"minLength": 1
240+
},
241+
"fields": {
242+
"$ref": "#/$defs/fields"
243+
}
244+
}
245+
},
246+
"nativeSyntaxFact": {
247+
"type": "object",
248+
"additionalProperties": false,
249+
"required": [
250+
"id",
251+
"kind",
252+
"source",
253+
"ownerPath"
254+
],
255+
"properties": {
256+
"id": {
257+
"type": "string",
258+
"minLength": 1
259+
},
260+
"kind": {
261+
"$ref": "#/$defs/factKind"
262+
},
263+
"source": {
264+
"$ref": "#/$defs/factSource"
265+
},
266+
"languageKind": {
267+
"type": "string",
268+
"minLength": 1
269+
},
270+
"name": {
271+
"type": "string",
272+
"minLength": 1
273+
},
274+
"qualifiedName": {
275+
"type": "string",
276+
"minLength": 1
277+
},
278+
"ownerPath": {
279+
"$ref": "#/$defs/projectPath"
280+
},
281+
"location": {
282+
"$ref": "#/$defs/location"
283+
},
284+
"visibility": {
285+
"$ref": "#/$defs/visibility"
286+
},
287+
"exported": {
288+
"type": "boolean"
289+
},
290+
"test": {
291+
"type": "boolean"
292+
},
293+
"queryKeys": {
294+
"type": "array",
295+
"uniqueItems": true,
296+
"items": {
297+
"type": "string",
298+
"minLength": 1
299+
}
300+
},
301+
"syntaxQueryRef": {
302+
"$ref": "semantic-tree-sitter-provenance.v1.schema.json#/$defs/syntaxQueryRef"
303+
},
304+
"syntaxMatchRefs": {
305+
"$ref": "semantic-tree-sitter-provenance.v1.schema.json#/$defs/syntaxMatchRefs"
306+
},
307+
"syntaxCaptureRefs": {
308+
"$ref": "semantic-tree-sitter-provenance.v1.schema.json#/$defs/syntaxCaptureRefs"
309+
},
310+
"syntaxAnchor": {
311+
"$ref": "semantic-tree-sitter-provenance.v1.schema.json#/$defs/syntaxAnchor"
312+
},
313+
"relations": {
314+
"type": "array",
315+
"items": {
316+
"$ref": "#/$defs/relation"
317+
}
318+
},
319+
"fields": {
320+
"$ref": "#/$defs/fields"
321+
}
322+
}
323+
},
324+
"indexDescriptor": {
325+
"type": "object",
326+
"additionalProperties": false,
327+
"required": [
328+
"name",
329+
"factKinds"
330+
],
331+
"properties": {
332+
"name": {
333+
"type": "string",
334+
"pattern": "^[a-z][a-z0-9_-]*$"
335+
},
336+
"factKinds": {
337+
"type": "array",
338+
"minItems": 1,
339+
"items": {
340+
"$ref": "#/$defs/factKind"
341+
}
342+
},
343+
"queryKeys": {
344+
"type": "array",
345+
"items": {
346+
"type": "string",
347+
"minLength": 1
348+
}
349+
},
350+
"fields": {
351+
"$ref": "#/$defs/fields"
352+
}
353+
}
354+
},
355+
"note": {
356+
"type": "object",
357+
"additionalProperties": false,
358+
"required": [
359+
"kind",
360+
"message"
361+
],
362+
"properties": {
363+
"kind": {
364+
"type": "string",
365+
"pattern": "^[a-z][a-z0-9_-]*$"
366+
},
367+
"message": {
368+
"type": "string"
369+
}
370+
}
371+
}
372+
}
373+
}

‎schemas/semantic-structural-index.v1.schema.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@
8686
"$ref": "#/$defs/symbol"
8787
}
8888
},
89+
"syntaxFacts": {
90+
"type": "array",
91+
"items": {
92+
"$ref": "semantic-native-syntax-fact-index.v1.schema.json#/$defs/nativeSyntaxFact"
93+
}
94+
},
8995
"dependencyUsages": {
9096
"type": "array",
9197
"items": {

0 commit comments

Comments
 (0)