structured-context 0.9.2 → 0.10.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 +8 -4
- package/dist/api.d.ts +15 -0
- package/dist/api.js +9 -0
- package/dist/commands/dump.js +1 -1
- package/dist/commands/validate-file.d.ts +5 -24
- package/dist/commands/validate-file.js +10 -104
- package/dist/commands/validate.d.ts +1 -12
- package/dist/commands/validate.js +6 -157
- package/dist/config.js +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins/markdown/index.d.ts +42 -32
- package/dist/plugins/markdown/index.js +9 -8
- package/dist/plugins/markdown/parse-embedded.d.ts +1 -1
- package/dist/plugins/markdown/read-space.js +3 -3
- package/dist/plugins/markdown/template-sync.d.ts +1 -1
- package/dist/plugins/markdown/template-sync.js +2 -2
- package/dist/schema/schema.js +45 -8
- package/dist/schemas/_knowledge_wiki.json +246 -0
- package/dist/schemas/_strategy_general.json +262 -0
- package/dist/schemas/knowledge_wiki.json +7 -237
- package/dist/schemas/strategy_general.json +12 -254
- package/dist/types.d.ts +20 -2
- package/dist/validate.d.ts +50 -0
- package/dist/validate.js +291 -0
- package/docs/schemas.md +6 -3
- package/package.json +11 -5
- package/schemas/_knowledge_wiki.json +246 -0
- package/schemas/_strategy_general.json +262 -0
- package/schemas/knowledge_wiki.json +7 -237
- package/schemas/strategy_general.json +12 -254
- package/dist/plugin-api.d.ts +0 -12
- package/dist/plugin-api.js +0 -7
|
@@ -3,243 +3,13 @@
|
|
|
3
3
|
"$id": "sctx://knowledge_wiki",
|
|
4
4
|
"title": "Knowledge Wiki",
|
|
5
5
|
"description": "Lightweight schema for LLM-maintained knowledge wikis. Supports source pages, concept pages, syntheses, and notes. Designed for compounding knowledge bases where the LLM creates and maintains wiki pages from raw sources.\n\nFlat entity model — no hierarchy, no required parent links. Wikilinks between any pages are valid for arbitrary cross-referencing. The schema validates structure and provenance; it does not constrain meaning.\n\nBased on the pattern described in Karpathy's LLM Wiki (2026).",
|
|
6
|
-
"$
|
|
7
|
-
"aliases": {
|
|
8
|
-
"source_summary": "source",
|
|
9
|
-
"study": "source",
|
|
10
|
-
"article": "source",
|
|
11
|
-
"paper": "source",
|
|
12
|
-
"research": "source",
|
|
13
|
-
"comparison": "synthesis",
|
|
14
|
-
"query": "synthesis"
|
|
15
|
-
},
|
|
16
|
-
"relationships": [
|
|
17
|
-
{
|
|
18
|
-
"parent": "source",
|
|
19
|
-
"type": "source",
|
|
20
|
-
"field": "sources",
|
|
21
|
-
"fieldOn": "child",
|
|
22
|
-
"multiple": true
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"parent": "source",
|
|
26
|
-
"type": "synthesis",
|
|
27
|
-
"field": "sources",
|
|
28
|
-
"fieldOn": "child",
|
|
29
|
-
"multiple": true
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"parent": "source",
|
|
33
|
-
"type": "entity",
|
|
34
|
-
"field": "sources",
|
|
35
|
-
"fieldOn": "child",
|
|
36
|
-
"multiple": true
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"parent": "concept",
|
|
40
|
-
"type": "synthesis",
|
|
41
|
-
"field": "concepts",
|
|
42
|
-
"fieldOn": "child",
|
|
43
|
-
"multiple": true
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
"rules": [
|
|
47
|
-
{
|
|
48
|
-
"id": "synthesis-references-sources",
|
|
49
|
-
"category": "coherence",
|
|
50
|
-
"description": "Syntheses should reference at least one contributing source in their sources array",
|
|
51
|
-
"type": "synthesis",
|
|
52
|
-
"check": "$exists(current.sources) and $count(current.sources) >= 1"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"id": "concept-has-summary",
|
|
56
|
-
"category": "best-practice",
|
|
57
|
-
"description": "Concept pages should have a short summary for index discoverability",
|
|
58
|
-
"type": "concept",
|
|
59
|
-
"check": "$exists(current.summary) and $length(current.summary) > 0"
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
},
|
|
6
|
+
"allOf": [{ "$ref": "sctx://_knowledge_wiki" }],
|
|
63
7
|
"oneOf": [
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"summary": {
|
|
71
|
-
"$ref": "sctx://_sctx_base#/$defs/summary"
|
|
72
|
-
},
|
|
73
|
-
"url": {
|
|
74
|
-
"type": "string",
|
|
75
|
-
"description": "URL of the original source"
|
|
76
|
-
},
|
|
77
|
-
"local_copy": {
|
|
78
|
-
"$ref": "sctx://_sctx_base#/$defs/wikilink",
|
|
79
|
-
"description": "Wikilink to a local copy of the source (e.g. a saved PDF or clipped note)"
|
|
80
|
-
},
|
|
81
|
-
"author": {
|
|
82
|
-
"type": "string",
|
|
83
|
-
"description": "Author or creator of the source"
|
|
84
|
-
},
|
|
85
|
-
"book": {
|
|
86
|
-
"type": "string",
|
|
87
|
-
"description": "Book title and author if the source is a book"
|
|
88
|
-
},
|
|
89
|
-
"published_date": {
|
|
90
|
-
"type": "string",
|
|
91
|
-
"format": "date",
|
|
92
|
-
"description": "Original publication date"
|
|
93
|
-
},
|
|
94
|
-
"source_type": {
|
|
95
|
-
"type": "string",
|
|
96
|
-
"description": "Kind of source material. Free-form — common values include article, paper, book, video, podcast, thread, substack, tweet, website. Not enum-constrained to allow evolving vocabulary."
|
|
97
|
-
},
|
|
98
|
-
"sources": {
|
|
99
|
-
"type": "array",
|
|
100
|
-
"items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
|
|
101
|
-
"description": "Wikilinks to other source pages that this one references or extends"
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"required": ["type", "url"],
|
|
105
|
-
"additionalProperties": true,
|
|
106
|
-
"examples": [
|
|
107
|
-
{
|
|
108
|
-
"type": "source",
|
|
109
|
-
"author": "Joe Bloggs",
|
|
110
|
-
"url": "https://example.com/design-of-yesterday-things",
|
|
111
|
-
"source_type": "book",
|
|
112
|
-
"tags": ["design", "ux", "psychology"]
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"type": "object",
|
|
118
|
-
"description": "A concept or entity page — defines and frames a specific idea, mechanism, or domain term. May draw from multiple sources. The building blocks of the wiki's knowledge graph.",
|
|
119
|
-
"allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
|
|
120
|
-
"properties": {
|
|
121
|
-
"type": { "const": "concept" },
|
|
122
|
-
"summary": {
|
|
123
|
-
"$ref": "sctx://_sctx_base#/$defs/summary"
|
|
124
|
-
},
|
|
125
|
-
"sources": {
|
|
126
|
-
"type": "array",
|
|
127
|
-
"items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
|
|
128
|
-
"description": "Wikilinks to source pages that contributed to this concept"
|
|
129
|
-
},
|
|
130
|
-
"related": {
|
|
131
|
-
"type": "array",
|
|
132
|
-
"items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
|
|
133
|
-
"description": "Wikilinks to related concept or synthesis pages"
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
"required": ["type"],
|
|
137
|
-
"additionalProperties": true,
|
|
138
|
-
"examples": [
|
|
139
|
-
{
|
|
140
|
-
"type": "concept",
|
|
141
|
-
"summary": "A property of an object that signals how it can be used, first described by Gibson and popularised in design by Norman",
|
|
142
|
-
"tags": ["design", "ux"]
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"type": "object",
|
|
148
|
-
"description": "A concrete entity — a person, organisation, product, model, or other named thing. The building blocks of the wiki's knowledge graph alongside concepts. Entities are distinct from concepts: a concept frames an idea or mechanism; an entity is a specific, identifiable thing in the world.",
|
|
149
|
-
"allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
|
|
150
|
-
"properties": {
|
|
151
|
-
"type": { "const": "entity" },
|
|
152
|
-
"summary": {
|
|
153
|
-
"$ref": "sctx://_sctx_base#/$defs/summary"
|
|
154
|
-
},
|
|
155
|
-
"sources": {
|
|
156
|
-
"type": "array",
|
|
157
|
-
"items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
|
|
158
|
-
"description": "Wikilinks to source pages that contributed to this entity page"
|
|
159
|
-
},
|
|
160
|
-
"related": {
|
|
161
|
-
"type": "array",
|
|
162
|
-
"items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
|
|
163
|
-
"description": "Wikilinks to related entity, concept, or synthesis pages"
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"required": ["type"],
|
|
167
|
-
"additionalProperties": true,
|
|
168
|
-
"examples": [
|
|
169
|
-
{
|
|
170
|
-
"type": "entity",
|
|
171
|
-
"summary": "AI safety research lab founded by Dario Amodei and Daniela Amodei",
|
|
172
|
-
"tags": ["company", "ai", "safety"]
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
"type": "object",
|
|
178
|
-
"description": "A synthesis page — connects multiple concepts and sources into a coherent model, framework, or thesis. The highest-value pages in a knowledge wiki. Must reference contributing sources.",
|
|
179
|
-
"allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
|
|
180
|
-
"properties": {
|
|
181
|
-
"type": { "const": "synthesis" },
|
|
182
|
-
"summary": {
|
|
183
|
-
"$ref": "sctx://_sctx_base#/$defs/summary"
|
|
184
|
-
},
|
|
185
|
-
"sources": {
|
|
186
|
-
"type": "array",
|
|
187
|
-
"items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
|
|
188
|
-
"description": "Wikilinks to source pages this synthesis draws from"
|
|
189
|
-
},
|
|
190
|
-
"concepts": {
|
|
191
|
-
"type": "array",
|
|
192
|
-
"items": { "$ref": "sctx://_sctx_base#/$defs/wikilink" },
|
|
193
|
-
"description": "Wikilinks to concept pages this synthesis connects"
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
"required": ["type"],
|
|
197
|
-
"additionalProperties": true,
|
|
198
|
-
"examples": [
|
|
199
|
-
{
|
|
200
|
-
"type": "synthesis",
|
|
201
|
-
"summary": "How Norman's affordance model and feedback principles combine to explain intuitive vs confusing interfaces",
|
|
202
|
-
"sources": ["[[The Design of Everyday Things - Don Norman]]"],
|
|
203
|
-
"concepts": ["[[Affordance]]", "[[Feedback loop]]"]
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"type": "object",
|
|
209
|
-
"description": "Personal notes, journal entries, appointments, experiential records. Your own data about your journey — not sourced from external material.",
|
|
210
|
-
"allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
|
|
211
|
-
"properties": {
|
|
212
|
-
"type": { "const": "note" },
|
|
213
|
-
"date": {
|
|
214
|
-
"type": "string",
|
|
215
|
-
"format": "date",
|
|
216
|
-
"description": "Date this entry was created or relates to"
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
"required": ["type"],
|
|
220
|
-
"additionalProperties": true,
|
|
221
|
-
"examples": [
|
|
222
|
-
{
|
|
223
|
-
"type": "note",
|
|
224
|
-
"date": "2024-03-15",
|
|
225
|
-
"tags": ["reading-log"]
|
|
226
|
-
}
|
|
227
|
-
]
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"type": "object",
|
|
231
|
-
"description": "The wiki index — a catalog of all pages with links, summaries, and metadata. Updated by the agent on ingest. Used as the primary navigation entry point.",
|
|
232
|
-
"allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
|
|
233
|
-
"properties": {
|
|
234
|
-
"type": { "const": "index" }
|
|
235
|
-
},
|
|
236
|
-
"required": ["type"],
|
|
237
|
-
"additionalProperties": true,
|
|
238
|
-
"examples": [
|
|
239
|
-
{
|
|
240
|
-
"type": "index"
|
|
241
|
-
}
|
|
242
|
-
]
|
|
243
|
-
}
|
|
8
|
+
{ "$ref": "sctx://_knowledge_wiki#/$defs/source" },
|
|
9
|
+
{ "$ref": "sctx://_knowledge_wiki#/$defs/concept" },
|
|
10
|
+
{ "$ref": "sctx://_knowledge_wiki#/$defs/entity" },
|
|
11
|
+
{ "$ref": "sctx://_knowledge_wiki#/$defs/synthesis" },
|
|
12
|
+
{ "$ref": "sctx://_knowledge_wiki#/$defs/note" },
|
|
13
|
+
{ "$ref": "sctx://_knowledge_wiki#/$defs/index" }
|
|
244
14
|
]
|
|
245
15
|
}
|
|
@@ -2,260 +2,18 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/mindsocket/structured-context/main/schemas/generated/_structured_context_schema_meta.json",
|
|
3
3
|
"$id": "sctx://strategy_general",
|
|
4
4
|
"title": "Strategy and opportunity ladder",
|
|
5
|
-
"description": "Validates frontmatter for space node files",
|
|
6
|
-
"$
|
|
7
|
-
"hierarchy": {
|
|
8
|
-
"levels": [
|
|
9
|
-
"vision",
|
|
10
|
-
"mission",
|
|
11
|
-
{ "type": "goal", "selfRef": true, "matchers": ["Goals"] },
|
|
12
|
-
{ "type": "opportunity", "selfRef": true, "matchers": ["Opportunities"] },
|
|
13
|
-
{
|
|
14
|
-
"type": "solution",
|
|
15
|
-
"selfRef": true,
|
|
16
|
-
"matchers": ["Solutions", "Potential solutions", "Solutions considered", "Possible solutions"]
|
|
17
|
-
},
|
|
18
|
-
"experiment"
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
"aliases": {
|
|
22
|
-
"outcome": "goal",
|
|
23
|
-
"assumption_test": "experiment",
|
|
24
|
-
"test": "experiment"
|
|
25
|
-
},
|
|
26
|
-
"relationships": [
|
|
27
|
-
{
|
|
28
|
-
"parent": "opportunity",
|
|
29
|
-
"type": "problem_statement",
|
|
30
|
-
"templateFormat": "heading",
|
|
31
|
-
"matchers": ["Problem statement", "What problem are we solving?"],
|
|
32
|
-
"multiple": false
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"parent": "opportunity",
|
|
36
|
-
"type": "assumption",
|
|
37
|
-
"templateFormat": "table",
|
|
38
|
-
"matchers": ["Assumptions", "^Assumptions?$"],
|
|
39
|
-
"embeddedTemplateFields": ["assumption", "status", "confidence"],
|
|
40
|
-
"multiple": true
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
},
|
|
5
|
+
"description": "Validates frontmatter for space node files. Composes strategy_general entities from the bundled partial. Override the hierarchy in $metadata to customize the level structure.",
|
|
6
|
+
"allOf": [{ "$ref": "sctx://_strategy_general" }],
|
|
44
7
|
"oneOf": [
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"type": "object",
|
|
56
|
-
"allOf": [{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" }],
|
|
57
|
-
"properties": {
|
|
58
|
-
"type": { "enum": ["ost_on_a_page", "space_on_a_page"] }
|
|
59
|
-
},
|
|
60
|
-
"required": ["type"],
|
|
61
|
-
"additionalProperties": true
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"type": "object",
|
|
65
|
-
"allOf": [
|
|
66
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
67
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
68
|
-
],
|
|
69
|
-
"properties": {
|
|
70
|
-
"type": { "const": "vision" }
|
|
71
|
-
},
|
|
72
|
-
"required": ["type"],
|
|
73
|
-
"not": { "required": ["parent"] },
|
|
74
|
-
"additionalProperties": true,
|
|
75
|
-
"examples": [
|
|
76
|
-
{
|
|
77
|
-
"type": "vision",
|
|
78
|
-
"status": "active"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"type": "object",
|
|
84
|
-
"allOf": [
|
|
85
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
86
|
-
{ "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
|
|
87
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
88
|
-
],
|
|
89
|
-
"properties": {
|
|
90
|
-
"type": { "const": "mission" }
|
|
91
|
-
},
|
|
92
|
-
"required": ["type"],
|
|
93
|
-
"additionalProperties": true,
|
|
94
|
-
"examples": [
|
|
95
|
-
{
|
|
96
|
-
"type": "mission",
|
|
97
|
-
"status": "active",
|
|
98
|
-
"parent": "[[Personal Vision]]"
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"type": "object",
|
|
104
|
-
"allOf": [
|
|
105
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
106
|
-
{ "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
|
|
107
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
108
|
-
],
|
|
109
|
-
"properties": {
|
|
110
|
-
"type": { "enum": ["goal", "outcome"] },
|
|
111
|
-
"priority": { "$ref": "sctx://_sctx_base#/$defs/priority" }
|
|
112
|
-
},
|
|
113
|
-
"required": ["type"],
|
|
114
|
-
"additionalProperties": true,
|
|
115
|
-
"examples": [
|
|
116
|
-
{
|
|
117
|
-
"type": "goal",
|
|
118
|
-
"status": "active",
|
|
119
|
-
"parent": "[[My Mission (2026)]]",
|
|
120
|
-
"priority": "p2"
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"type": "object",
|
|
126
|
-
"allOf": [
|
|
127
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
128
|
-
{ "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
|
|
129
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
130
|
-
],
|
|
131
|
-
"properties": {
|
|
132
|
-
"type": { "const": "opportunity" },
|
|
133
|
-
"priority": { "$ref": "sctx://_sctx_base#/$defs/priority" },
|
|
134
|
-
"impact": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
|
|
135
|
-
"feasibility": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
|
|
136
|
-
"resources": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
|
|
137
|
-
"timeline": {
|
|
138
|
-
"type": "string",
|
|
139
|
-
"description": "Timeline estimate (e.g., S-M, M-L)"
|
|
140
|
-
},
|
|
141
|
-
"next_steps": {
|
|
142
|
-
"type": "string",
|
|
143
|
-
"description": "Next steps for this opportunity"
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
"required": ["type"],
|
|
147
|
-
"additionalProperties": true,
|
|
148
|
-
"examples": [
|
|
149
|
-
{
|
|
150
|
-
"type": "opportunity",
|
|
151
|
-
"status": "identified",
|
|
152
|
-
"parent": "[[Career Growth]]",
|
|
153
|
-
"priority": "p2"
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"type": "object",
|
|
159
|
-
"allOf": [
|
|
160
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
161
|
-
{ "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
|
|
162
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
163
|
-
],
|
|
164
|
-
"properties": {
|
|
165
|
-
"type": { "const": "solution" },
|
|
166
|
-
"priority": { "$ref": "sctx://_sctx_base#/$defs/priority" },
|
|
167
|
-
"impact": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
|
|
168
|
-
"feasibility": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
|
|
169
|
-
"resources": { "$ref": "sctx://_sctx_base#/$defs/assessment" },
|
|
170
|
-
"timeline": {
|
|
171
|
-
"type": "string",
|
|
172
|
-
"description": "Timeline estimate (e.g., S-M, M-L)"
|
|
173
|
-
},
|
|
174
|
-
"next_steps": {
|
|
175
|
-
"type": "string",
|
|
176
|
-
"description": "Next steps for this solution"
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
"required": ["type"],
|
|
180
|
-
"additionalProperties": true,
|
|
181
|
-
"examples": [
|
|
182
|
-
{
|
|
183
|
-
"type": "solution",
|
|
184
|
-
"status": "identified",
|
|
185
|
-
"parent": "[[Some Opportunity]]",
|
|
186
|
-
"priority": "p3"
|
|
187
|
-
}
|
|
188
|
-
]
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"type": "object",
|
|
192
|
-
"allOf": [
|
|
193
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
194
|
-
{ "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
|
|
195
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
196
|
-
],
|
|
197
|
-
"properties": {
|
|
198
|
-
"type": { "enum": ["experiment", "assumption_test", "test"] }
|
|
199
|
-
},
|
|
200
|
-
"required": ["type"],
|
|
201
|
-
"additionalProperties": true,
|
|
202
|
-
"examples": [
|
|
203
|
-
{
|
|
204
|
-
"type": "experiment",
|
|
205
|
-
"status": "exploring",
|
|
206
|
-
"parent": "[[Build a Side Project]]"
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"type": "test",
|
|
210
|
-
"status": "active",
|
|
211
|
-
"parent": "[[Mobile App Solution]]"
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
"type": "object",
|
|
217
|
-
"allOf": [
|
|
218
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
219
|
-
{ "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
|
|
220
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
221
|
-
],
|
|
222
|
-
"properties": {
|
|
223
|
-
"type": { "const": "assumption" },
|
|
224
|
-
"confidence": {
|
|
225
|
-
"type": "string",
|
|
226
|
-
"enum": ["low", "medium", "high"],
|
|
227
|
-
"description": "Confidence level in this assumption"
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
"required": ["type"],
|
|
231
|
-
"additionalProperties": true,
|
|
232
|
-
"examples": [
|
|
233
|
-
{
|
|
234
|
-
"type": "assumption",
|
|
235
|
-
"status": "identified",
|
|
236
|
-
"parent": "[[Some Opportunity]]",
|
|
237
|
-
"confidence": "medium"
|
|
238
|
-
}
|
|
239
|
-
]
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"type": "object",
|
|
243
|
-
"allOf": [
|
|
244
|
-
{ "$ref": "sctx://_sctx_base#/$defs/baseNodeProps" },
|
|
245
|
-
{ "$ref": "sctx://_sctx_base#/$defs/parentNodeProps" },
|
|
246
|
-
{ "$ref": "sctx://_sctx_base#/$defs/ostEntityProps" }
|
|
247
|
-
],
|
|
248
|
-
"properties": {
|
|
249
|
-
"type": { "const": "problem_statement" }
|
|
250
|
-
},
|
|
251
|
-
"required": ["type"],
|
|
252
|
-
"additionalProperties": true,
|
|
253
|
-
"examples": [
|
|
254
|
-
{
|
|
255
|
-
"type": "problem_statement",
|
|
256
|
-
"status": "identified"
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
}
|
|
8
|
+
{ "$ref": "sctx://_strategy_general#/$defs/dashboard" },
|
|
9
|
+
{ "$ref": "sctx://_strategy_general#/$defs/ost_on_a_page" },
|
|
10
|
+
{ "$ref": "sctx://_strategy_general#/$defs/vision" },
|
|
11
|
+
{ "$ref": "sctx://_strategy_general#/$defs/mission" },
|
|
12
|
+
{ "$ref": "sctx://_strategy_general#/$defs/goal" },
|
|
13
|
+
{ "$ref": "sctx://_strategy_general#/$defs/opportunity" },
|
|
14
|
+
{ "$ref": "sctx://_strategy_general#/$defs/solution" },
|
|
15
|
+
{ "$ref": "sctx://_strategy_general#/$defs/experiment" },
|
|
16
|
+
{ "$ref": "sctx://_strategy_general#/$defs/assumption" },
|
|
17
|
+
{ "$ref": "sctx://_strategy_general#/$defs/problem_statement" }
|
|
260
18
|
]
|
|
261
19
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -91,10 +91,10 @@ export type ParseIssue = {
|
|
|
91
91
|
file: string;
|
|
92
92
|
/** error: prevented the file from producing nodes; warning: file was silently excluded. */
|
|
93
93
|
severity: 'error' | 'warning';
|
|
94
|
-
/**
|
|
94
|
+
/** no-type: no type field;
|
|
95
95
|
* parse: parse failure (syntax issue or unexpected content);
|
|
96
96
|
* plugins may choose to provide additional types. */
|
|
97
|
-
type: '
|
|
97
|
+
type: 'no-type' | 'parse' | string;
|
|
98
98
|
/** Human-readable detail. */
|
|
99
99
|
message?: string;
|
|
100
100
|
};
|
|
@@ -155,3 +155,21 @@ export type SpaceContext = {
|
|
|
155
155
|
/** Directory of the config file that defines this space. Used for resolving relative paths in plugin configs. */
|
|
156
156
|
configDir: string;
|
|
157
157
|
};
|
|
158
|
+
export interface FileValidationResult {
|
|
159
|
+
file: string;
|
|
160
|
+
label: string;
|
|
161
|
+
space: string;
|
|
162
|
+
/** Errors keyed by composite id (e.g. `schema:/status:enum:active`, `rule:my-rule-id`). */
|
|
163
|
+
errors: Record<string, {
|
|
164
|
+
kind: string;
|
|
165
|
+
message: string;
|
|
166
|
+
}>;
|
|
167
|
+
errorCount: number;
|
|
168
|
+
inSpace: true;
|
|
169
|
+
}
|
|
170
|
+
export interface FileNotInSpaceResult {
|
|
171
|
+
file: string;
|
|
172
|
+
inSpace: false;
|
|
173
|
+
message: string;
|
|
174
|
+
}
|
|
175
|
+
export type ValidateFileOutput = FileValidationResult | FileNotInSpaceResult;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
2
|
+
import type { Config } from './config';
|
|
3
|
+
import { extractEntityInfo } from './schema/schema';
|
|
4
|
+
import type { GraphViolation, ParseIssue, RuleViolation, SchemaWithMetadata, SpaceContext, SpaceNode, ValidateFileOutput } from './types';
|
|
5
|
+
export interface FormattedError {
|
|
6
|
+
message: string;
|
|
7
|
+
dedupeKey: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
validCount: number;
|
|
11
|
+
nodeErrorCount: number;
|
|
12
|
+
nodeErrors: Array<{
|
|
13
|
+
file: string;
|
|
14
|
+
errors: ErrorObject[];
|
|
15
|
+
nodeData: Record<string, unknown>;
|
|
16
|
+
}>;
|
|
17
|
+
refErrors: Array<{
|
|
18
|
+
file: string;
|
|
19
|
+
parent: string;
|
|
20
|
+
error: string;
|
|
21
|
+
}>;
|
|
22
|
+
duplicateErrors: Array<{
|
|
23
|
+
title: string;
|
|
24
|
+
files: string[];
|
|
25
|
+
}>;
|
|
26
|
+
ruleViolations: RuleViolation[];
|
|
27
|
+
hierarchyViolations: GraphViolation[];
|
|
28
|
+
orphans: SpaceNode[];
|
|
29
|
+
parseIssues: ParseIssue[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Format AJV errors for better readability.
|
|
33
|
+
* Groups related errors and extracts helpful context like allowed values.
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatErrors(errors: ErrorObject[], schema: SchemaWithMetadata, schemaRefRegistry: Parameters<typeof extractEntityInfo>[1], nodeData: Record<string, unknown>): FormattedError[];
|
|
36
|
+
/**
|
|
37
|
+
* Run full validation on a space and return a structured result.
|
|
38
|
+
* Does not output to console or call process.exit.
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateSpace(context: SpaceContext): Promise<ValidationResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Validate a single file within its space.
|
|
43
|
+
*
|
|
44
|
+
* Reads the full space (required for graph correctness) but filters all reported
|
|
45
|
+
* errors to only those attributable to the target file.
|
|
46
|
+
*
|
|
47
|
+
* Returns a result object — does not output to console or call process.exit.
|
|
48
|
+
* If the file is not in any configured space, returns a result with `inSpace: false`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateFile(filePath: string, config: Config): Promise<ValidateFileOutput>;
|