返回 ppt-master
spec_lock.schema.json
根目录 / skills / ppt-master / templates / schemas / spec_lock.schema.json
1 {
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "$id": "ppt-master://schemas/spec-lock/v1",
4 "title": "PPT Master spec_lock.md",
5 "description": "Schema for the Markdown section-and-data-line model emitted by the spec-lock parser.",
6 "type": "object",
7 "required": [
8 "canvas",
9 "communication",
10 "mode",
11 "visual_style",
12 "colors",
13 "typography",
14 "icons",
15 "page_rhythm",
16 "pptx_structure",
17 "forbidden"
18 ],
19 "properties": {
20 "canvas": {"type": "object"},
21 "communication": {"type": "object"},
22 "mode": {"type": "object"},
23 "visual_style": {"type": "object"},
24 "colors": {
25 "type": "object",
26 "properties": {
27 "image_rendering": {"type": "string"},
28 "image_rendering_behavior": {"type": "string"},
29 "image_rendering_references": {"type": "string"}
30 }
31 },
32 "typography": {
33 "type": "object",
34 "properties": {
35 "font_family": {"type": "string", "minLength": 1},
36 "title_family": {"type": "string", "minLength": 1},
37 "body_family": {"type": "string", "minLength": 1},
38 "subtitle_family": {"type": "string", "minLength": 1},
39 "annotation_family": {"type": "string", "minLength": 1},
40 "footer_family": {"type": "string", "minLength": 1},
41 "footnote_family": {"type": "string", "minLength": 1},
42 "data_family": {"type": "string", "minLength": 1},
43 "emphasis_family": {"type": "string", "minLength": 1},
44 "quote_family": {"type": "string", "minLength": 1},
45 "code_family": {"type": "string", "minLength": 1},
46 "body": {"type": "number"},
47 "title": {"type": "number"}
48 }
49 },
50 "icons": {
51 "type": "object",
52 "properties": {
53 "library": {"type": "string"},
54 "inventory": {"type": "string"},
55 "stroke_width": {"enum": [1.5, 2, 3]}
56 }
57 },
58 "images": {"type": "object"},
59 "page_rhythm": {"type": "object"},
60 "pptx_structure": {"type": "object"},
61 "pptx_masters": {"type": "object"},
62 "pptx_layouts": {"type": "object"},
63 "page_pptx_layouts": {"type": "object"},
64 "page_layouts": {"type": "object"},
65 "page_visualizations": {"type": "object"},
66 "page_charts": {"type": "object"},
67 "forbidden": {"type": "string"}
68 },
69 "x-markdown": {
70 "version": 1,
71 "marker": "spec-lock/v1",
72 "parser": "heading-data-lines-v1",
73 "strict_lines": true,
74 "unresolved_patterns": ["(?i)\\[fill(?:[^\\]]*)\\]"],
75 "sections": [
76 {
77 "id": "canvas",
78 "pattern": "^canvas$",
79 "required": true,
80 "required_fields": ["viewBox", "format"],
81 "allowed_fields": ["viewBox", "format"]
82 },
83 {
84 "id": "communication",
85 "pattern": "^communication$",
86 "required": true,
87 "required_fields": [
88 "audience",
89 "objective",
90 "core_message"
91 ],
92 "allow_empty_fields": [
93 "audience",
94 "objective",
95 "core_message"
96 ],
97 "allowed_fields": [
98 "primary_language",
99 "audience",
100 "objective",
101 "core_message",
102 "consumption_mode"
103 ],
104 "field_patterns": {
105 "primary_language": "^(?!und(?:-|$))(?:(?:zh(?:-[a-z]{3}){0,3}(?:-[A-Z][a-z]{3}(?:-(?:[A-Z]{2}|[0-9]{3}))?|-(?:[A-Z]{2}|[0-9]{3})))|(?:(?!zh(?:-|$))(?:[a-z]{2,3}(?:-[a-z]{3}){0,3}|[a-z]{4}|[a-z]{5,8})(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}|[0-9]{3}))?))(?:-(?:[a-z0-9]{5,8}|[0-9][a-z0-9]{3}))*(?:-[0-9a-wy-z](?:-[a-z0-9]{2,8})+)*(?:-x(?:-[a-z0-9]{1,8})+)?$"
106 },
107 "field_enums": {
108 "consumption_mode": ["text", "balanced", "presentation"]
109 }
110 },
111 {
112 "id": "mode",
113 "pattern": "^mode$",
114 "required": true,
115 "required_fields": ["mode"],
116 "allowed_fields": ["mode", "mode_behavior", "mode_references"],
117 "field_patterns": {
118 "mode_references": "^[a-z0-9][a-z0-9-]*(?:\\s*,\\s*[a-z0-9][a-z0-9-]*)*$"
119 },
120 "field_enums": {
121 "mode": ["pyramid", "narrative", "instructional", "showcase", "briefing", "custom"]
122 }
123 },
124 {
125 "id": "visual_style",
126 "pattern": "^visual_style$",
127 "required": true,
128 "required_fields": ["visual_style"],
129 "allowed_fields": ["visual_style", "visual_style_behavior", "visual_style_references"],
130 "field_patterns": {
131 "visual_style_references": "^[a-z0-9][a-z0-9-]*(?:\\s*,\\s*[a-z0-9][a-z0-9-]*)*$"
132 }
133 },
134 {
135 "id": "colors",
136 "pattern": "^colors$",
137 "required": true,
138 "min_entries": 1,
139 "field_patterns": {
140 "image_rendering_references": "^[a-z0-9][a-z0-9-]*(?:\\s*,\\s*[a-z0-9][a-z0-9-]*)*$"
141 }
142 },
143 {
144 "id": "typography",
145 "pattern": "^typography$",
146 "required": true,
147 "required_fields": ["font_family", "body", "title"],
148 "entry_key_pattern": "^[a-z][a-z0-9_]*$",
149 "field_value_rules": [
150 {
151 "key_pattern": "^(?:font_family|[a-z][a-z0-9_]*_family)$",
152 "value_pattern": "^\\S(?:.*\\S)?$",
153 "requirement": "be a non-empty font-family stack"
154 },
155 {
156 "key_pattern": "^(?!font_family$)(?![a-z][a-z0-9_]*_family$)[a-z][a-z0-9_]*$",
157 "value_pattern": "^(?=.*[1-9])(?:[0-9]+(?:\\.[0-9]+)?|\\.[0-9]+)$",
158 "normalize": false,
159 "numeric": "positive_finite",
160 "requirement": "be a positive finite unitless px number"
161 }
162 ]
163 },
164 {
165 "id": "icons",
166 "pattern": "^icons$",
167 "required": true,
168 "required_fields": ["library", "inventory"],
169 "allowed_fields": ["library", "inventory", "stroke_width"],
170 "field_enums": {
171 "stroke_width": ["1.5", "2", "3"]
172 }
173 },
174 {"id": "images", "pattern": "^images$", "required": false},
175 {
176 "id": "page_rhythm",
177 "pattern": "^page_rhythm$",
178 "required": true,
179 "min_entries": 1,
180 "entry_key_pattern": "^P[0-9]{2,}$",
181 "value_enum": ["anchor", "dense", "breathing"]
182 },
183 {
184 "id": "pptx_structure",
185 "pattern": "^pptx_structure$",
186 "required": true,
187 "required_fields": ["mode"],
188 "allowed_fields": ["mode", "template_reuse_scope", "template_adherence"],
189 "field_enums": {
190 "mode": ["flat", "structured"],
191 "template_reuse_scope": ["style", "layout", "mirror"],
192 "template_adherence": ["adaptive", "strict"]
193 }
194 },
195 {
196 "id": "pptx_masters",
197 "pattern": "^pptx_masters$",
198 "required": false,
199 "min_entries": 1,
200 "entry_key_pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
201 "value_pattern": "^\\S(?:.*\\S)?$"
202 },
203 {
204 "id": "pptx_layouts",
205 "pattern": "^pptx_layouts$",
206 "required": false,
207 "min_entries": 1,
208 "entry_key_pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
209 "value_pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}\\s*\\|\\s*[^|]+\\s*\\|\\s*(?:template:[A-Za-z0-9._-]+|P[0-9]{2,})$"
210 },
211 {
212 "id": "page_pptx_layouts",
213 "pattern": "^page_pptx_layouts$",
214 "required": false,
215 "min_entries": 1,
216 "entry_key_pattern": "^P[0-9]{2,}$",
217 "value_pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
218 },
219 {
220 "id": "page_layouts",
221 "pattern": "^page_layouts$",
222 "required": false,
223 "min_entries": 1,
224 "entry_key_pattern": "^P[0-9]{2,}$",
225 "value_pattern": "^[A-Za-z0-9._-]+$"
226 },
227 {
228 "id": "page_visualizations",
229 "pattern": "^page_visualizations$",
230 "required": false,
231 "min_entries": 1,
232 "entry_key_pattern": "^P[0-9]{2,}$",
233 "value_pattern": "^(?:chart|table)/[a-z0-9]+(?:_[a-z0-9]+)*$"
234 },
235 {
236 "id": "page_charts",
237 "pattern": "^page_charts$",
238 "required": false,
239 "min_entries": 1,
240 "entry_key_pattern": "^P[0-9]{2,}$",
241 "value_pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
242 },
243 {"id": "forbidden", "pattern": "^forbidden$", "required": true, "min_body_chars": 1}
244 ],
245 "conditions": [
246 {
247 "id": "custom-mode",
248 "when": {"section": "mode", "field": "mode", "equals": "custom"},
249 "then": {"required_fields": [{"section": "mode", "fields": ["mode_behavior"]}]}
250 },
251 {
252 "id": "custom-visual-style",
253 "when": {"section": "visual_style", "field": "visual_style", "equals": "custom"},
254 "then": {
255 "required_fields": [{"section": "visual_style", "fields": ["visual_style_behavior"]}]
256 }
257 },
258 {
259 "id": "custom-image-rendering",
260 "when": {"section": "colors", "field": "image_rendering", "equals": "custom"},
261 "then": {
262 "required_fields": [{"section": "colors", "fields": ["image_rendering_behavior"]}]
263 }
264 },
265 {
266 "id": "stroke-icon-weight",
267 "when": {"section": "icons", "field": "library", "equals": "tabler-outline"},
268 "then": {"required_fields": [{"section": "icons", "fields": ["stroke_width"]}]}
269 },
270 {
271 "id": "structured-pptx",
272 "when": {"section": "pptx_structure", "field": "mode", "equals": "structured"},
273 "then": {
274 "required_sections": ["pptx_masters", "pptx_layouts", "page_pptx_layouts", "page_layouts"],
275 "required_fields": [
276 {"section": "pptx_structure", "fields": ["template_reuse_scope", "template_adherence"]}
277 ],
278 "field_values": [
279 {
280 "section": "pptx_structure",
281 "field": "template_reuse_scope",
282 "enum": ["layout", "mirror"]
283 }
284 ]
285 }
286 },
287 {
288 "id": "style-is-flat",
289 "when": {"section": "pptx_structure", "field": "template_reuse_scope", "equals": "style"},
290 "then": {
291 "field_values": [{"section": "pptx_structure", "field": "mode", "enum": ["flat"]}]
292 }
293 },
294 {
295 "id": "layout-is-structured",
296 "when": {"section": "pptx_structure", "field": "template_reuse_scope", "equals": "layout"},
297 "then": {
298 "field_values": [{"section": "pptx_structure", "field": "mode", "enum": ["structured"]}]
299 }
300 },
301 {
302 "id": "mirror-is-strict",
303 "when": {"section": "pptx_structure", "field": "template_reuse_scope", "equals": "mirror"},
304 "then": {
305 "required_fields": [
306 {"section": "pptx_structure", "fields": ["template_adherence"]}
307 ],
308 "field_values": [
309 {"section": "pptx_structure", "field": "mode", "enum": ["structured"]},
310 {"section": "pptx_structure", "field": "template_adherence", "enum": ["strict"]}
311 ]
312 }
313 },
314 {
315 "id": "flat-has-no-structured-mappings",
316 "when": {"section": "pptx_structure", "field": "mode", "equals": "flat"},
317 "then": {
318 "forbidden_sections": [
319 "pptx_masters",
320 "pptx_layouts",
321 "page_pptx_layouts",
322 "page_layouts"
323 ],
324 "field_values": [
325 {"section": "pptx_structure", "field": "template_reuse_scope", "enum": ["style"]},
326 {"section": "pptx_structure", "field": "template_adherence", "enum": []}
327 ]
328 }
329 }
330 ],
331 "references": [
332 {
333 "id": "layout-master",
334 "from_section": "pptx_layouts",
335 "value_component": {"separator": "|", "index": 0},
336 "target_section": "pptx_masters"
337 },
338 {
339 "id": "page-pptx-layout",
340 "from_section": "page_pptx_layouts",
341 "target_section": "pptx_layouts"
342 },
343 {
344 "id": "page-input-prototype",
345 "from_section": "page_layouts",
346 "asset_path_pattern": "templates/{value}.svg"
347 }
348 ]
349 }
350 }
351
351 lines JSON