microsoft/hve-core

Public

mirrored from https://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
7226b4c1944c0773b20eeb1b3be5a4aebf11d4e9

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/linting/schemas/document-section.schema.json

164lines · modecode

1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "$id": "https://raw.githubusercontent.com/microsoft/hve-core/main/scripts/linting/schemas/document-section.schema.json",
4 "title": "Document-Section Item",
5 "description": "Validates per-item document-section YAML in content-generation Framework Skills. Mirrors the control-schema envelope (id, title, description, applicability, evidenceHints) and adds content-generation fields (template, inputs, selectWhen, attestation).",
6 "type": "object",
7 "required": ["id", "title", "template"],
8 "additionalProperties": false,
9 "properties": {
10 "id": {
11 "type": "string",
12 "minLength": 1,
13 "pattern": "^[a-z][a-z0-9-]*$",
14 "description": "Lower-kebab section identifier"
15 },
16 "title": {
17 "type": "string",
18 "minLength": 1,
19 "description": "Human-readable section title"
20 },
21 "description": {
22 "type": "string",
23 "description": "Optional section description"
24 },
25 "template": {
26 "type": "string",
27 "minLength": 1,
28 "description": "Markdown body for the section; may contain {{var}} references resolved against inputs and manifest globals"
29 },
30 "inputs": {
31 "type": "array",
32 "items": { "$ref": "#/$defs/input" },
33 "description": "Per-section variable declarations consumed by the template"
34 },
35 "applicability": {
36 "type": "object",
37 "additionalProperties": false,
38 "properties": {
39 "discriminator": {
40 "type": "string",
41 "minLength": 1,
42 "description": "Short label for the applicability axis"
43 },
44 "appliesWhen": {
45 "type": "array",
46 "minItems": 1,
47 "items": { "type": "string", "minLength": 1 },
48 "description": "Discriminator values under which this section applies"
49 },
50 "naWhen": {
51 "type": "array",
52 "minItems": 1,
53 "items": { "type": "string", "minLength": 1 },
54 "description": "Discriminator values under which this section is not applicable"
55 },
56 "naReason": {
57 "type": "string",
58 "minLength": 1,
59 "description": "Reason text recorded when this section is skipped under naWhen"
60 }
61 },
62 "description": "Optional applicability discriminator mirroring the control schema"
63 },
64 "evidenceHints": {
65 "type": "array",
66 "items": {
67 "type": "string",
68 "minLength": 1,
69 "pattern": "^[A-Za-z0-9_./*?{}\\[\\]\\-]+$"
70 },
71 "description": "File paths or globs that provide context for this section"
72 },
73 "selectWhen": {
74 "type": "object",
75 "additionalProperties": false,
76 "required": ["discriminator"],
77 "properties": {
78 "discriminator": {
79 "type": "string",
80 "minLength": 1,
81 "description": "Short label for the variant axis (e.g. prd_template_variant); resolved against host project context"
82 },
83 "values": {
84 "type": "array",
85 "minItems": 1,
86 "uniqueItems": true,
87 "items": { "type": "string", "minLength": 1 },
88 "description": "Discriminator values that include this section (positive selection)"
89 },
90 "notValues": {
91 "type": "array",
92 "minItems": 1,
93 "uniqueItems": true,
94 "items": { "type": "string", "minLength": 1 },
95 "description": "Discriminator values that exclude this section (negation symmetry with applicability.naWhen)"
96 }
97 },
98 "anyOf": [
99 { "required": ["values"] },
100 { "required": ["notValues"] }
101 ],
102 "description": "Positive-selection predicate distinct from applicability; an item is included when discriminator value matches values (and does not match notValues). Items without selectWhen are always included."
103 },
104 "attestation": {
105 "type": "object",
106 "description": "Optional per-item attestation contract declaring which artifacts produced for this item MUST carry an attestation signature. Hosts honor the manifest-level signing block to determine method and identity; this per-item block scopes coverage. The signing-attestation consistency lint warns when 'covers' references identifiers that resolve to neither a pipeline.stages[].produces[].id nor a known item id within the same bundle.",
107 "required": ["covers"],
108 "additionalProperties": false,
109 "properties": {
110 "required": {
111 "type": "boolean",
112 "default": false,
113 "description": "When true, hosts MUST attach an attestation for each id listed in 'covers' before declaring the item complete."
114 },
115 "covers": {
116 "type": "array",
117 "minItems": 1,
118 "uniqueItems": true,
119 "items": {
120 "type": "string",
121 "minLength": 1,
122 "pattern": "^[a-z0-9][a-z0-9.-]*$"
123 },
124 "description": "Identifiers covered by the attestation. Each entry SHOULD resolve to either a pipeline.stages[].produces[].id (preferred for binary outputs) or a sibling item id within the same bundle."
125 }
126 }
127 }
128 },
129 "$defs": {
130 "input": {
131 "type": "object",
132 "required": ["name"],
133 "additionalProperties": false,
134 "properties": {
135 "name": {
136 "type": "string",
137 "minLength": 1,
138 "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
139 "description": "Variable name referenced in {{var}} template tokens"
140 },
141 "description": {
142 "type": "string",
143 "description": "Human-readable description of the input variable"
144 },
145 "required": {
146 "type": "boolean",
147 "default": false,
148 "description": "Whether the host must collect a value before rendering"
149 },
150 "persistence": {
151 "type": "string",
152 "enum": ["none", "session", "project", "user"],
153 "default": "session",
154 "description": "Value retention scope. 'none' = re-prompt every render; 'session' = remember within a single host session (default); 'project' = persist in the consuming project (e.g. .copilot-tracking/); 'user' = persist in user-scope storage. The persistence-sanity lint warns when 'user' is paired with sensitive: true."
155 },
156 "sensitive": {
157 "type": "boolean",
158 "default": false,
159 "description": "Marks the input value as sensitive (PII, credentials, etc.). Hosts SHOULD redact in logs and SHOULD NOT persist beyond session scope. Drives the persistence-sanity lint."
160 }
161 }
162 }
163 }
164}