@millstone/synapse-schemas 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.
Files changed (36) hide show
  1. package/README.md +71 -0
  2. package/body-grammars/adr.body-grammar.json +46 -0
  3. package/body-grammars/agreement.body-grammar.json +86 -0
  4. package/body-grammars/capability.body-grammar.json +73 -0
  5. package/body-grammars/meeting.body-grammar.json +93 -0
  6. package/body-grammars/policy.body-grammar.json +58 -0
  7. package/body-grammars/prd.body-grammar.json +220 -0
  8. package/body-grammars/process.body-grammar.json +107 -0
  9. package/body-grammars/reference.body-grammar.json +16 -0
  10. package/body-grammars/runbook.body-grammar.json +77 -0
  11. package/body-grammars/scorecard.body-grammar.json +68 -0
  12. package/body-grammars/sop.body-grammar.json +75 -0
  13. package/body-grammars/sow.body-grammar.json +189 -0
  14. package/body-grammars/standard.body-grammar.json +54 -0
  15. package/body-grammars/system.body-grammar.json +79 -0
  16. package/body-grammars/tdd.body-grammar.json +176 -0
  17. package/frontmatter/adr.schema.json +30 -0
  18. package/frontmatter/agreement.schema.json +191 -0
  19. package/frontmatter/base.schema.json +79 -0
  20. package/frontmatter/capability.schema.json +25 -0
  21. package/frontmatter/meeting.schema.json +52 -0
  22. package/frontmatter/policy.schema.json +25 -0
  23. package/frontmatter/prd.schema.json +37 -0
  24. package/frontmatter/process.schema.json +49 -0
  25. package/frontmatter/reference.schema.json +77 -0
  26. package/frontmatter/runbook.schema.json +19 -0
  27. package/frontmatter/scorecard.schema.json +176 -0
  28. package/frontmatter/sop.schema.json +42 -0
  29. package/frontmatter/sow.schema.json +35 -0
  30. package/frontmatter/standard.schema.json +31 -0
  31. package/frontmatter/system.schema.json +51 -0
  32. package/frontmatter/tdd.schema.json +25 -0
  33. package/index.js +9 -0
  34. package/package.json +34 -0
  35. package/plugins/marketplace.schema.json +126 -0
  36. package/plugins/plugin.schema.json +60 -0
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # @synapse/schemas
2
+
3
+ JSON Schema definitions for the Synapse documentation framework.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @synapse/schemas
9
+ ```
10
+
11
+ This package is also installed automatically as a dependency of `@synapse/cli`.
12
+
13
+ ## Usage
14
+
15
+ ### Helper functions
16
+
17
+ Import helper functions to locate schema directories on disk:
18
+
19
+ ```js
20
+ import {
21
+ getSchemaDir,
22
+ getFrontmatterSchemaDir,
23
+ getBodyGrammarDir,
24
+ getPluginSchemaDir
25
+ } from '@synapse/schemas';
26
+ ```
27
+
28
+ ### Direct imports
29
+
30
+ Import schema files directly using subpath exports:
31
+
32
+ ```js
33
+ import adrSchema from '@synapse/schemas/frontmatter/adr.schema.json' assert { type: 'json' };
34
+ import adrGrammar from '@synapse/schemas/body-grammars/adr.body-grammar.json' assert { type: 'json' };
35
+ ```
36
+
37
+ ## Schema Categories
38
+
39
+ ### frontmatter/
40
+
41
+ Document frontmatter validation schemas. Each schema defines the required and optional YAML frontmatter fields for a document type.
42
+
43
+ Available schemas: adr, agreement, base, capability, meeting, policy, prd, process, reference, runbook, scorecard, sop, sow, standard, system, tdd.
44
+
45
+ The `base.schema.json` defines common fields (id, title, type, status, owner, created, updated, tags, summary) shared by all document types via `$ref`.
46
+
47
+ ### body-grammars/
48
+
49
+ Document body structure grammar rules. Each grammar defines the required sections, their order, and content shape (paragraphs, lists, tables, milestones) for a document type's Markdown body.
50
+
51
+ Available grammars: adr, agreement, capability, meeting, policy, prd, process, reference, runbook, scorecard, sop, sow, standard, system, tdd.
52
+
53
+ ### plugins/
54
+
55
+ Plugin configuration schemas for the Synapse plugin system.
56
+
57
+ Available schemas: marketplace, plugin.
58
+
59
+ ## Schema Cascade Resolution
60
+
61
+ When used with `@synapse/cli`, schemas are resolved using a cascade:
62
+
63
+ 1. **Local override**: `{projectRoot}/schemas/frontmatter/{name}.schema.json`
64
+ 2. **This package**: Standard schemas bundled in `@synapse/schemas`
65
+ 3. **Error**: With a helpful message
66
+
67
+ This allows projects to override individual schemas for customization while using the standard set as a fallback.
68
+
69
+ ## License
70
+
71
+ MIT
@@ -0,0 +1,46 @@
1
+ {
2
+ "type": "adr",
3
+ "displayName": "Architecture Decision Record",
4
+ "sections": [
5
+ {
6
+ "id": "context",
7
+ "title": "Context",
8
+ "required": true,
9
+ "order": 1,
10
+ "shape": {
11
+ "type": "flow",
12
+ "allowedNodes": ["paragraph", "list", "heading", "thematicBreak"]
13
+ }
14
+ },
15
+ {
16
+ "id": "decision",
17
+ "title": "Decision",
18
+ "required": true,
19
+ "order": 2,
20
+ "shape": {
21
+ "type": "flow",
22
+ "allowedNodes": ["paragraph", "list", "heading", "code", "thematicBreak"]
23
+ }
24
+ },
25
+ {
26
+ "id": "consequences",
27
+ "title": "Consequences",
28
+ "required": true,
29
+ "order": 3,
30
+ "shape": {
31
+ "type": "flow",
32
+ "allowedNodes": ["paragraph", "list", "heading", "code", "table", "thematicBreak"]
33
+ }
34
+ },
35
+ {
36
+ "id": "alternatives-considered",
37
+ "title": "Alternatives Considered",
38
+ "required": false,
39
+ "order": 4,
40
+ "shape": {
41
+ "type": "flow",
42
+ "allowedNodes": ["paragraph", "list", "heading", "code", "table", "thematicBreak"]
43
+ }
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "type": "agreement",
3
+ "displayName": "Agreement",
4
+ "sections": [
5
+ {
6
+ "id": "parties",
7
+ "title": "Parties",
8
+ "required": true,
9
+ "order": 1,
10
+ "shape": {
11
+ "type": "flow",
12
+ "allowedNodes": ["paragraph", "list", "heading", "thematicBreak"]
13
+ }
14
+ },
15
+ {
16
+ "id": "services",
17
+ "title": "Services",
18
+ "required": true,
19
+ "order": 2,
20
+ "shape": {
21
+ "type": "flow",
22
+ "allowedNodes": ["paragraph", "list", "heading", "thematicBreak"]
23
+ }
24
+ },
25
+ {
26
+ "id": "compensation",
27
+ "title": "Compensation",
28
+ "required": true,
29
+ "order": 3,
30
+ "shape": {
31
+ "type": "flow",
32
+ "allowedNodes": ["paragraph", "list", "table", "heading", "thematicBreak"]
33
+ }
34
+ },
35
+ {
36
+ "id": "term-and-termination",
37
+ "title": "Term and Termination",
38
+ "required": true,
39
+ "order": 4,
40
+ "shape": {
41
+ "type": "flow",
42
+ "allowedNodes": ["paragraph", "list", "heading", "thematicBreak"]
43
+ }
44
+ },
45
+ {
46
+ "id": "independent-contractor",
47
+ "title": "Independent Contractor",
48
+ "required": true,
49
+ "order": 5,
50
+ "shape": {
51
+ "type": "flow",
52
+ "allowedNodes": ["paragraph", "heading", "thematicBreak"]
53
+ }
54
+ },
55
+ {
56
+ "id": "intellectual-property",
57
+ "title": "Intellectual Property",
58
+ "required": true,
59
+ "order": 6,
60
+ "shape": {
61
+ "type": "flow",
62
+ "allowedNodes": ["paragraph", "heading", "thematicBreak"]
63
+ }
64
+ },
65
+ {
66
+ "id": "confidentiality",
67
+ "title": "Confidentiality",
68
+ "required": true,
69
+ "order": 7,
70
+ "shape": {
71
+ "type": "flow",
72
+ "allowedNodes": ["paragraph", "heading", "thematicBreak"]
73
+ }
74
+ },
75
+ {
76
+ "id": "governing-law-and-venue",
77
+ "title": "Governing Law and Venue",
78
+ "required": true,
79
+ "order": 8,
80
+ "shape": {
81
+ "type": "flow",
82
+ "allowedNodes": ["paragraph", "heading", "thematicBreak"]
83
+ }
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "type": "capability",
3
+ "displayName": "Capability Document",
4
+ "sections": [
5
+ {
6
+ "id": "domain",
7
+ "title": "Domain",
8
+ "required": true,
9
+ "order": 1,
10
+ "shape": {
11
+ "type": "list",
12
+ "ordered": false,
13
+ "minItems": 1
14
+ }
15
+ },
16
+ {
17
+ "id": "maturity",
18
+ "title": "Maturity (0–5)",
19
+ "alternativeTitles": [
20
+ "Maturity (0-5)",
21
+ "Maturity"
22
+ ],
23
+ "required": true,
24
+ "order": 2,
25
+ "shape": {
26
+ "type": "flow",
27
+ "allowedNodes": [
28
+ "paragraph",
29
+ "list",
30
+ "heading",
31
+ "thematicBreak"
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "id": "metrics",
37
+ "title": "Metrics",
38
+ "required": true,
39
+ "order": 3,
40
+ "shape": {
41
+ "type": "list",
42
+ "ordered": false,
43
+ "minItems": 1
44
+ }
45
+ },
46
+ {
47
+ "id": "evidence-links",
48
+ "title": "Evidence Links",
49
+ "required": true,
50
+ "order": 4,
51
+ "shape": {
52
+ "type": "list",
53
+ "ordered": false,
54
+ "minItems": 1
55
+ }
56
+ },
57
+ {
58
+ "id": "notes",
59
+ "title": "Notes",
60
+ "required": true,
61
+ "order": 5,
62
+ "shape": {
63
+ "type": "flow",
64
+ "allowedNodes": [
65
+ "paragraph",
66
+ "list",
67
+ "heading",
68
+ "thematicBreak"
69
+ ]
70
+ }
71
+ }
72
+ ]
73
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "type": "meeting",
3
+ "displayName": "Meeting Notes",
4
+ "sections": [
5
+ {
6
+ "id": "meeting-details",
7
+ "title": "Meeting Details",
8
+ "required": true,
9
+ "order": 1,
10
+ "shape": {
11
+ "type": "flow",
12
+ "allowedNodes": [
13
+ "paragraph",
14
+ "list",
15
+ "heading",
16
+ "thematicBreak"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "id": "observations-by-domain",
22
+ "title": "Observations by Domain",
23
+ "required": true,
24
+ "order": 2,
25
+ "shape": {
26
+ "type": "list",
27
+ "ordered": false,
28
+ "minItems": 1
29
+ }
30
+ },
31
+ {
32
+ "id": "key-metrics-data-points",
33
+ "title": "Key Metrics & Data Points",
34
+ "alternativeTitles": [
35
+ "Key Metrics and Data Points"
36
+ ],
37
+ "required": true,
38
+ "order": 3,
39
+ "shape": {
40
+ "type": "list",
41
+ "ordered": false,
42
+ "minItems": 1
43
+ }
44
+ },
45
+ {
46
+ "id": "preliminary-scorecard-hooks",
47
+ "title": "Preliminary Scorecard Hooks",
48
+ "required": true,
49
+ "order": 4,
50
+ "shape": {
51
+ "type": "list",
52
+ "ordered": false,
53
+ "minItems": 1
54
+ }
55
+ },
56
+ {
57
+ "id": "risks-and-mitigations",
58
+ "title": "Risks and Mitigations",
59
+ "required": true,
60
+ "order": 5,
61
+ "shape": {
62
+ "type": "table",
63
+ "requiredHeaders": [
64
+ "Risk",
65
+ "Severity",
66
+ "Likelihood",
67
+ "Owner",
68
+ "Mitigation",
69
+ "Due Date"
70
+ ],
71
+ "minRows": 1
72
+ }
73
+ },
74
+ {
75
+ "id": "decisions-next-steps",
76
+ "title": "Decisions & Next Steps",
77
+ "alternativeTitles": [
78
+ "Decisions and Next Steps"
79
+ ],
80
+ "required": true,
81
+ "order": 6,
82
+ "shape": {
83
+ "type": "flow",
84
+ "allowedNodes": [
85
+ "paragraph",
86
+ "list",
87
+ "heading",
88
+ "thematicBreak"
89
+ ]
90
+ }
91
+ }
92
+ ]
93
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "type": "policy",
3
+ "displayName": "Policy Document",
4
+ "sections": [
5
+ {
6
+ "id": "scope",
7
+ "title": "Scope",
8
+ "required": true,
9
+ "order": 1,
10
+ "shape": {
11
+ "type": "flow",
12
+ "allowedNodes": [
13
+ "paragraph",
14
+ "list",
15
+ "heading",
16
+ "thematicBreak"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "id": "rationale",
22
+ "title": "Rationale",
23
+ "required": true,
24
+ "order": 2,
25
+ "shape": {
26
+ "type": "flow",
27
+ "allowedNodes": [
28
+ "paragraph",
29
+ "list",
30
+ "heading",
31
+ "thematicBreak"
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "id": "policy-statements",
37
+ "title": "Policy Statements",
38
+ "required": true,
39
+ "order": 3,
40
+ "shape": {
41
+ "type": "list",
42
+ "ordered": false,
43
+ "minItems": 1
44
+ }
45
+ },
46
+ {
47
+ "id": "related-standards",
48
+ "title": "Related Standards",
49
+ "required": true,
50
+ "order": 4,
51
+ "shape": {
52
+ "type": "list",
53
+ "ordered": false,
54
+ "minItems": 1
55
+ }
56
+ }
57
+ ]
58
+ }
@@ -0,0 +1,220 @@
1
+ {
2
+ "type": "prd",
3
+ "displayName": "Product Requirements Document",
4
+ "sections": [
5
+ {
6
+ "id": "summary",
7
+ "title": "Summary",
8
+ "required": true,
9
+ "order": 1,
10
+ "shape": {
11
+ "type": "flow",
12
+ "allowedNodes": [
13
+ "paragraph",
14
+ "list",
15
+ "code",
16
+ "heading",
17
+ "thematicBreak"
18
+ ]
19
+ }
20
+ },
21
+ {
22
+ "id": "goals",
23
+ "title": "Goals",
24
+ "alternativeTitles": [
25
+ "Objective"
26
+ ],
27
+ "required": true,
28
+ "order": 2,
29
+ "shape": {
30
+ "type": "flow",
31
+ "allowedNodes": [
32
+ "paragraph",
33
+ "list",
34
+ "heading",
35
+ "thematicBreak"
36
+ ]
37
+ }
38
+ },
39
+ {
40
+ "id": "in-scope",
41
+ "title": "In Scope",
42
+ "alternativeTitles": [
43
+ "In-scope (v1)",
44
+ "In Scope (v1)"
45
+ ],
46
+ "required": true,
47
+ "order": 3,
48
+ "shape": {
49
+ "type": "list",
50
+ "ordered": false,
51
+ "minItems": 1
52
+ }
53
+ },
54
+ {
55
+ "id": "out-of-scope",
56
+ "title": "Out of Scope",
57
+ "alternativeTitles": [
58
+ "Out of scope (v1)",
59
+ "Out of Scope (v1)"
60
+ ],
61
+ "required": true,
62
+ "order": 4,
63
+ "shape": {
64
+ "type": "list",
65
+ "ordered": false,
66
+ "minItems": 1
67
+ }
68
+ },
69
+ {
70
+ "id": "users-and-flows",
71
+ "title": "Users and Flows",
72
+ "required": true,
73
+ "order": 5,
74
+ "shape": {
75
+ "type": "flow",
76
+ "allowedNodes": [
77
+ "paragraph",
78
+ "list",
79
+ "heading",
80
+ "thematicBreak"
81
+ ]
82
+ }
83
+ },
84
+ {
85
+ "id": "requirements",
86
+ "title": "Requirements",
87
+ "alternativeTitles": [
88
+ "Functional Requirements"
89
+ ],
90
+ "required": true,
91
+ "order": 6,
92
+ "shape": {
93
+ "type": "flow",
94
+ "allowedNodes": [
95
+ "paragraph",
96
+ "list",
97
+ "heading",
98
+ "thematicBreak"
99
+ ]
100
+ }
101
+ },
102
+ {
103
+ "id": "kpis",
104
+ "title": "KPIs",
105
+ "alternativeTitles": [
106
+ "Success Criteria and KPIs"
107
+ ],
108
+ "required": true,
109
+ "order": 7,
110
+ "shape": {
111
+ "type": "flow",
112
+ "allowedNodes": [
113
+ "paragraph",
114
+ "list",
115
+ "heading",
116
+ "thematicBreak"
117
+ ]
118
+ }
119
+ },
120
+ {
121
+ "id": "information-architecture",
122
+ "title": "Information Architecture",
123
+ "required": true,
124
+ "order": 8,
125
+ "shape": {
126
+ "type": "flow",
127
+ "allowedNodes": [
128
+ "paragraph",
129
+ "list",
130
+ "code",
131
+ "blockquote",
132
+ "heading",
133
+ "thematicBreak"
134
+ ]
135
+ }
136
+ },
137
+ {
138
+ "id": "data-model",
139
+ "title": "Data Model",
140
+ "required": true,
141
+ "order": 9,
142
+ "shape": {
143
+ "type": "flow",
144
+ "allowedNodes": [
145
+ "paragraph",
146
+ "list",
147
+ "code",
148
+ "table",
149
+ "heading",
150
+ "thematicBreak"
151
+ ]
152
+ }
153
+ },
154
+ {
155
+ "id": "non-functional",
156
+ "title": "Non-Functional",
157
+ "alternativeTitles": [
158
+ "Non-functional Requirements"
159
+ ],
160
+ "required": true,
161
+ "order": 10,
162
+ "shape": {
163
+ "type": "flow",
164
+ "allowedNodes": [
165
+ "paragraph",
166
+ "list",
167
+ "heading",
168
+ "thematicBreak"
169
+ ]
170
+ }
171
+ },
172
+ {
173
+ "id": "constraints",
174
+ "title": "Constraints",
175
+ "required": true,
176
+ "order": 11,
177
+ "shape": {
178
+ "type": "flow",
179
+ "allowedNodes": [
180
+ "paragraph",
181
+ "list",
182
+ "heading",
183
+ "thematicBreak"
184
+ ]
185
+ }
186
+ },
187
+ {
188
+ "id": "risks",
189
+ "title": "Risks",
190
+ "alternativeTitles": [
191
+ "Risks and Mitigations"
192
+ ],
193
+ "required": true,
194
+ "order": 12,
195
+ "shape": {
196
+ "type": "flow",
197
+ "allowedNodes": [
198
+ "paragraph",
199
+ "list",
200
+ "heading",
201
+ "thematicBreak"
202
+ ]
203
+ }
204
+ },
205
+ {
206
+ "id": "milestones",
207
+ "title": "Milestones",
208
+ "required": true,
209
+ "order": 13,
210
+ "shape": {
211
+ "type": "milestoneList",
212
+ "requireH3": true,
213
+ "requiredSubsections": [
214
+ "Deliverables",
215
+ "Acceptance Criteria"
216
+ ]
217
+ }
218
+ }
219
+ ]
220
+ }