@agentshouse/mdmodel 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +220 -7
- package/dist/blocks.d.ts +11 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +63 -0
- package/dist/blocks.js.map +1 -0
- package/dist/definition.d.ts +8 -6
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +44 -38
- package/dist/definition.js.map +1 -1
- package/dist/divide.d.ts +3 -0
- package/dist/divide.d.ts.map +1 -0
- package/dist/divide.js +363 -0
- package/dist/divide.js.map +1 -0
- package/dist/document.d.ts +4 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +95 -4
- package/dist/document.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/links.d.ts +25 -1
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +289 -48
- package/dist/links.js.map +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +5 -0
- package/dist/paths.js.map +1 -1
- package/dist/profile.js.map +1 -1
- package/dist/project.d.ts +21 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +158 -0
- package/dist/project.js.map +1 -0
- package/dist/refuse.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +16 -38
- package/dist/schema.js.map +1 -1
- package/dist/sections.d.ts.map +1 -1
- package/dist/sections.js +14 -47
- package/dist/sections.js.map +1 -1
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validate.d.ts +2 -2
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +17 -8
- package/dist/validate.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/yaml.d.ts +1 -0
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +6 -4
- package/dist/yaml.js.map +1 -1
- package/fixtures/README.md +87 -27
- package/fixtures/cases/any-without-type/context.json +1 -0
- package/fixtures/cases/binary-any-reference/context.json +5 -0
- package/fixtures/cases/binary-any-reference/expected.json +7 -0
- package/fixtures/cases/binary-any-reference/library/notes/draft.md +6 -0
- package/fixtures/cases/binary-any-reference/library/types/note.md +5 -0
- package/fixtures/cases/binary-document-collision/context.json +5 -0
- package/fixtures/cases/binary-document-collision/expected.json +6 -0
- package/fixtures/cases/binary-document-collision/library/notes/draft.md +3 -0
- package/fixtures/cases/binary-document-collision/library/types/note.md +3 -0
- package/fixtures/cases/binary-link-outside-collection/context.json +6 -0
- package/fixtures/cases/binary-link-outside-collection/expected.json +6 -0
- package/fixtures/cases/binary-link-outside-collection/library/notes/draft.md +5 -0
- package/fixtures/cases/binary-link-outside-collection/library/types/note.md +3 -0
- package/fixtures/cases/binary-prototype-reference/context.json +1 -0
- package/fixtures/cases/binary-prototype-reference/expected.json +7 -0
- package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +6 -0
- package/fixtures/cases/binary-prototype-reference/library/types/note.md +5 -0
- package/fixtures/cases/binary-typed-reference/context.json +5 -0
- package/fixtures/cases/binary-typed-reference/expected.json +7 -0
- package/fixtures/cases/binary-typed-reference/library/notes/draft.md +6 -0
- package/fixtures/cases/binary-typed-reference/library/types/note.md +5 -0
- package/fixtures/cases/binary-typed-reference/library/types/person.md +3 -0
- package/fixtures/cases/bracketed-link-definition/context.json +1 -0
- package/fixtures/cases/bracketed-link-definition/expected.json +1 -0
- package/fixtures/cases/bracketed-link-definition/library/item.md +10 -0
- package/fixtures/cases/bracketed-link-definition/library/types/task.md +7 -0
- package/fixtures/cases/declared-binary-links/context.json +6 -0
- package/fixtures/cases/declared-binary-links/expected.json +1 -0
- package/fixtures/cases/declared-binary-links/library/notes/draft.md +7 -0
- package/fixtures/cases/declared-binary-links/library/types/note.md +3 -0
- package/fixtures/cases/duplicate-link-definition/context.json +1 -0
- package/fixtures/cases/duplicate-link-definition/expected.json +1 -0
- package/fixtures/cases/duplicate-link-definition/library/item.md +11 -0
- package/fixtures/cases/duplicate-link-definition/library/types/task.md +7 -0
- package/fixtures/cases/fenced-link-definition/context.json +1 -0
- package/fixtures/cases/fenced-link-definition/expected.json +1 -0
- package/fixtures/cases/fenced-link-definition/library/item.md +12 -0
- package/fixtures/cases/fenced-link-definition/library/types/task.md +7 -0
- package/fixtures/cases/field-enum/context.json +1 -0
- package/fixtures/cases/interrupted-link-definition/context.json +1 -0
- package/fixtures/cases/interrupted-link-definition/expected.json +1 -0
- package/fixtures/cases/interrupted-link-definition/library/notes/draft.md +8 -0
- package/fixtures/cases/interrupted-link-definition/library/types/note.md +3 -0
- package/fixtures/cases/long-fence-link-definition/context.json +1 -0
- package/fixtures/cases/long-fence-link-definition/expected.json +1 -0
- package/fixtures/cases/long-fence-link-definition/library/notes/draft.md +9 -0
- package/fixtures/cases/long-fence-link-definition/library/types/note.md +3 -0
- package/fixtures/cases/malformed-definition/context.json +1 -0
- package/fixtures/cases/missing-binary-image/context.json +6 -0
- package/fixtures/cases/missing-binary-image/expected.json +6 -0
- package/fixtures/cases/missing-binary-image/library/notes/draft.md +5 -0
- package/fixtures/cases/missing-binary-image/library/types/note.md +3 -0
- package/fixtures/cases/missing-binary-link/context.json +6 -0
- package/fixtures/cases/missing-binary-link/expected.json +6 -0
- package/fixtures/cases/missing-binary-link/library/notes/draft.md +5 -0
- package/fixtures/cases/missing-binary-link/library/types/note.md +3 -0
- package/fixtures/cases/missing-required-field/context.json +1 -0
- package/fixtures/cases/missing-section-item-kind/context.json +1 -0
- package/fixtures/cases/missing-section-item-kind/expected.json +7 -0
- package/fixtures/cases/missing-section-item-kind/library/types/task.md +7 -0
- package/fixtures/cases/paragraph-link-definition/context.json +5 -0
- package/fixtures/cases/paragraph-link-definition/expected.json +1 -0
- package/fixtures/cases/paragraph-link-definition/library/notes/draft.md +10 -0
- package/fixtures/cases/paragraph-link-definition/library/types/note.md +3 -0
- package/fixtures/cases/prd-definition/context.json +1 -0
- package/fixtures/cases/prd-definition/library/types/task.md +2 -1
- package/fixtures/cases/prototype-field/context.json +1 -0
- package/fixtures/cases/prototype-field/expected.json +7 -0
- package/fixtures/cases/prototype-field/library/item.md +9 -0
- package/fixtures/cases/prototype-field/library/types/task.md +7 -0
- package/fixtures/cases/quoted-link-definition/context.json +1 -0
- package/fixtures/cases/quoted-link-definition/expected.json +6 -0
- package/fixtures/cases/quoted-link-definition/library/notes/draft.md +7 -0
- package/fixtures/cases/quoted-link-definition/library/types/note.md +3 -0
- package/fixtures/cases/referenced-missing-file/context.json +1 -0
- package/fixtures/cases/structured-section/context.json +1 -0
- package/fixtures/cases/structured-section/library/types/task.md +1 -1
- package/fixtures/cases/truncated-link-definition/context.json +1 -0
- package/fixtures/cases/truncated-link-definition/expected.json +6 -0
- package/fixtures/cases/truncated-link-definition/library/notes/draft.md +7 -0
- package/fixtures/cases/truncated-link-definition/library/notes/other.md +5 -0
- package/fixtures/cases/truncated-link-definition/library/types/note.md +3 -0
- package/fixtures/cases/unclosed-frontmatter/context.json +1 -0
- package/fixtures/cases/undeclared-field/context.json +1 -0
- package/fixtures/cases/undeclared-field/expected.json +7 -0
- package/fixtures/cases/undeclared-field/library/item.md +9 -0
- package/fixtures/cases/undeclared-field/library/types/task.md +7 -0
- package/fixtures/cases/unresolved-link/context.json +1 -0
- package/fixtures/cases/valid-typed-document/context.json +1 -0
- package/fixtures/cases/valid-typed-document/library/tasks/one.md +1 -0
- package/fixtures/cases/valid-typed-document/library/types/task.md +2 -1
- package/fixtures/cases/wide-item-fence-link/context.json +1 -0
- package/fixtures/cases/wide-item-fence-link/expected.json +1 -0
- package/fixtures/cases/wide-item-fence-link/library/notes/draft.md +7 -0
- package/fixtures/cases/wide-item-fence-link/library/types/note.md +3 -0
- package/fixtures/division.json +415 -0
- package/fixtures/preamble.json +107 -0
- package/fixtures/projection.json +186 -0
- package/package.json +4 -5
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
{
|
|
2
|
+
"definitions": {
|
|
3
|
+
"task": "---\ntype: definition\nfields:\n name: { kind: text, required: true }\n aliases: { kind: list, of: text }\n title: { kind: string, required: true }\n status: { kind: enum, values: [open, done], required: true }\n owner: { kind: reference, to: person }\n due: { kind: date }\n estimate: { kind: number }\n labels: { kind: list, of: string }\nsections:\n Description: { kind: text, required: true }\n Acceptance: { kind: list, of: reference, to: person }\n Checklist: { kind: list, of: text }\n---\n",
|
|
4
|
+
"unreadable-task": "---\ntype: definition\nsections:\n Description: { kind: prose }\n---\n"
|
|
5
|
+
},
|
|
6
|
+
"cases": [
|
|
7
|
+
{
|
|
8
|
+
"name": "any body keeps labels and leaves every unsupplied destination authored",
|
|
9
|
+
"file": "notes/one.md",
|
|
10
|
+
"source": "---\ntitle: Note\n---\n\nRead [the plan](../plans/q3.md#goals \"Plan\") and .\nSee the [site](https://example.com/x.md) and this [anchor](#here).\nAn [unheld draft](../plans/draft.md) keeps the destination nobody supplied.\nEscaped \\[the plan\\](../plans/q3.md) stays, and so does `[the plan](../plans/q3.md)`.\n\n```sh\ncat [the plan](../plans/q3.md)\n```\n",
|
|
11
|
+
"documentTargets": [
|
|
12
|
+
"plans/q3.md",
|
|
13
|
+
"plans/2026-q3.md"
|
|
14
|
+
],
|
|
15
|
+
"definition": null,
|
|
16
|
+
"move": {
|
|
17
|
+
"href": "../plans/q3.md#goals",
|
|
18
|
+
"to": "../plans/2026-q3.md"
|
|
19
|
+
},
|
|
20
|
+
"expected": {
|
|
21
|
+
"ok": true,
|
|
22
|
+
"text": "\nRead the plan and .\nSee the [site](https://example.com/x.md) and this [anchor](#here).\nAn [unheld draft](../plans/draft.md) keeps the destination nobody supplied.\nEscaped \\[the plan\\](../plans/q3.md) stays, and so does `[the plan](../plans/q3.md)`.\n\n```sh\ncat [the plan](../plans/q3.md)\n```\n"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "any body without frontmatter projects from its first character",
|
|
27
|
+
"file": "notes/two.md",
|
|
28
|
+
"source": "# Title\n\nSee [the plan](plans/q3.md).\n",
|
|
29
|
+
"documentTargets": [
|
|
30
|
+
"notes/plans/q3.md",
|
|
31
|
+
"notes/plans/2026-q3.md"
|
|
32
|
+
],
|
|
33
|
+
"definition": null,
|
|
34
|
+
"move": {
|
|
35
|
+
"href": "plans/q3.md",
|
|
36
|
+
"to": "plans/2026-q3.md"
|
|
37
|
+
},
|
|
38
|
+
"expected": {
|
|
39
|
+
"ok": true,
|
|
40
|
+
"text": "# Title\n\nSee the plan.\n"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "a Document that declares the built-in any type projects its body like an undeclared one",
|
|
45
|
+
"file": "notes/three.md",
|
|
46
|
+
"source": "---\ntype: any\ntitle: Note\n---\n\n## Notes\n\nRead [the plan](../plans/q3.md#goals \"Plan\") and see the [site](https://example.com/x.md).\n",
|
|
47
|
+
"documentTargets": [
|
|
48
|
+
"plans/q3.md",
|
|
49
|
+
"plans/2026-q3.md"
|
|
50
|
+
],
|
|
51
|
+
"definition": null,
|
|
52
|
+
"move": {
|
|
53
|
+
"href": "../plans/q3.md#goals",
|
|
54
|
+
"to": "../plans/2026-q3.md"
|
|
55
|
+
},
|
|
56
|
+
"expected": {
|
|
57
|
+
"ok": true,
|
|
58
|
+
"text": "\n## Notes\n\nRead the plan and see the [site](https://example.com/x.md).\n"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "a typed Document projects its free-text field values as bare values and no other kind",
|
|
63
|
+
"file": "tasks/four.md",
|
|
64
|
+
"source": "---\ntype: task\nname: Ship the release\naliases: [\"Launch day\", Cutover]\ntitle: Ship it\nstatus: open\nowner: ../people/ana.md\ndue: 2026-09-30\nestimate: 3\nlabels: [core, urgent]\n---\n",
|
|
65
|
+
"documentTargets": [],
|
|
66
|
+
"definition": "task",
|
|
67
|
+
"move": null,
|
|
68
|
+
"expected": {
|
|
69
|
+
"ok": true,
|
|
70
|
+
"text": "Ship the release\n\nLaunch day\n\nCutover\n\n"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "a typed Document projects its preamble and every section its type does not declare as structure",
|
|
75
|
+
"file": "tasks/one.md",
|
|
76
|
+
"source": "---\ntype: task\nname: Shipping the release\ntitle: Ship it\nstatus: open\nowner: ../people/ana.md\n---\n\nPreamble prose that mentions [the plan](../plans/q3.md).\n\n## Description\n\nFollow [the plan][plan] and [the plan][plan] again, then [read it][].\n\n[plan]: ../plans/q3.md \"Plan\"\n[read it]: ../plans/q3.md\n\n## Acceptance\n\n- [the plan](../plans/q3.md) is linked\n\n## Checklist\n\n- [the plan](../plans/q3.md) is read\n\n## Notes\n\nUndeclared prose about [the plan](../plans/q3.md).\n",
|
|
77
|
+
"documentTargets": [
|
|
78
|
+
"plans/q3.md",
|
|
79
|
+
"plans/2026-q3.md"
|
|
80
|
+
],
|
|
81
|
+
"definition": "task",
|
|
82
|
+
"move": {
|
|
83
|
+
"href": "../plans/q3.md",
|
|
84
|
+
"to": "../plans/2026-q3.md"
|
|
85
|
+
},
|
|
86
|
+
"expected": {
|
|
87
|
+
"ok": true,
|
|
88
|
+
"text": "Shipping the release\n\n\nPreamble prose that mentions the plan.\n\n## Description\n\nFollow the plan and the plan again, then read it.\n\n\n## Checklist\n\n- the plan is read\n\n## Notes\n\nUndeclared prose about the plan.\n"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "a link definition in another section resolves its use and leaves the projection",
|
|
93
|
+
"file": "tasks/two.md",
|
|
94
|
+
"source": "---\ntype: task\ntitle: Ship it\nstatus: open\n---\n\n## Description\n\nFollow [the plan][plan].\n\n## Notes\n\n[plan]: ../plans/q3.md\n",
|
|
95
|
+
"documentTargets": [
|
|
96
|
+
"plans/q3.md",
|
|
97
|
+
"plans/2026-q3.md"
|
|
98
|
+
],
|
|
99
|
+
"definition": "task",
|
|
100
|
+
"move": {
|
|
101
|
+
"href": "../plans/q3.md",
|
|
102
|
+
"to": "../plans/2026-q3.md"
|
|
103
|
+
},
|
|
104
|
+
"expected": {
|
|
105
|
+
"ok": true,
|
|
106
|
+
"text": "\n## Description\n\nFollow the plan.\n\n## Notes\n\n"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "every occurrence of a declared free-text section is projected",
|
|
111
|
+
"file": "tasks/three.md",
|
|
112
|
+
"source": "---\ntype: task\ntitle: Ship it\nstatus: open\n---\n\n## Description\n\nFirst [plan](../plans/q3.md).\n\n## Description\n\nSecond note.\n",
|
|
113
|
+
"documentTargets": [
|
|
114
|
+
"plans/q3.md",
|
|
115
|
+
"plans/2026-q3.md"
|
|
116
|
+
],
|
|
117
|
+
"definition": "task",
|
|
118
|
+
"move": {
|
|
119
|
+
"href": "../plans/q3.md",
|
|
120
|
+
"to": "../plans/2026-q3.md"
|
|
121
|
+
},
|
|
122
|
+
"expected": {
|
|
123
|
+
"ok": true,
|
|
124
|
+
"text": "\n## Description\n\nFirst plan.\n\n## Description\n\nSecond note.\n"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "a declared type the caller does not supply is refused",
|
|
129
|
+
"file": "tasks/one.md",
|
|
130
|
+
"source": "---\ntype: task\nname: Shipping the release\ntitle: Ship it\nstatus: open\nowner: ../people/ana.md\n---\n\nPreamble prose that mentions [the plan](../plans/q3.md).\n\n## Description\n\nFollow [the plan][plan] and [the plan][plan] again, then [read it][].\n\n[plan]: ../plans/q3.md \"Plan\"\n[read it]: ../plans/q3.md\n\n## Acceptance\n\n- [the plan](../plans/q3.md) is linked\n\n## Checklist\n\n- [the plan](../plans/q3.md) is read\n\n## Notes\n\nUndeclared prose about [the plan](../plans/q3.md).\n",
|
|
131
|
+
"documentTargets": [
|
|
132
|
+
"plans/q3.md",
|
|
133
|
+
"plans/2026-q3.md"
|
|
134
|
+
],
|
|
135
|
+
"definition": null,
|
|
136
|
+
"move": null,
|
|
137
|
+
"expected": {
|
|
138
|
+
"ok": false,
|
|
139
|
+
"refusal": {
|
|
140
|
+
"file": "tasks/one.md",
|
|
141
|
+
"rule": "unknown-type",
|
|
142
|
+
"version": "<package-version>",
|
|
143
|
+
"location": "type"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "a definition the model cannot read is refused at that definition",
|
|
149
|
+
"file": "tasks/one.md",
|
|
150
|
+
"source": "---\ntype: task\nname: Shipping the release\ntitle: Ship it\nstatus: open\nowner: ../people/ana.md\n---\n\nPreamble prose that mentions [the plan](../plans/q3.md).\n\n## Description\n\nFollow [the plan][plan] and [the plan][plan] again, then [read it][].\n\n[plan]: ../plans/q3.md \"Plan\"\n[read it]: ../plans/q3.md\n\n## Acceptance\n\n- [the plan](../plans/q3.md) is linked\n\n## Checklist\n\n- [the plan](../plans/q3.md) is read\n\n## Notes\n\nUndeclared prose about [the plan](../plans/q3.md).\n",
|
|
151
|
+
"documentTargets": [
|
|
152
|
+
"plans/q3.md",
|
|
153
|
+
"plans/2026-q3.md"
|
|
154
|
+
],
|
|
155
|
+
"definition": "unreadable-task",
|
|
156
|
+
"move": null,
|
|
157
|
+
"expected": {
|
|
158
|
+
"ok": false,
|
|
159
|
+
"refusal": {
|
|
160
|
+
"file": "types/task.md",
|
|
161
|
+
"rule": "definition-section-kind",
|
|
162
|
+
"version": "<package-version>",
|
|
163
|
+
"location": "Description"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "an image at a supplied Markdown document target is projected like its link",
|
|
169
|
+
"file": "notes/four.md",
|
|
170
|
+
"source": "Read [the plan](../plans/q3.md) and .\nAlso [the plan][plan] and ![the chart][plan].\n\n[plan]: ../plans/q3.md\n",
|
|
171
|
+
"documentTargets": [
|
|
172
|
+
"plans/q3.md",
|
|
173
|
+
"plans/2026-q3.md"
|
|
174
|
+
],
|
|
175
|
+
"definition": null,
|
|
176
|
+
"move": {
|
|
177
|
+
"href": "../plans/q3.md",
|
|
178
|
+
"to": "../plans/2026-q3.md"
|
|
179
|
+
},
|
|
180
|
+
"expected": {
|
|
181
|
+
"ok": true,
|
|
182
|
+
"text": "Read the plan and the chart.\nAlso the plan and the chart.\n\n"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdmodel",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
4
|
"description": "MD Type language, parser, validator, structured change application, Markdown syntax profile, and conformance fixtures",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=24.
|
|
12
|
+
"node": ">=24.21.0"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
|
-
"
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
18
|
},
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"url": "https://github.com/agentshouse/mdmodel/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"
|
|
39
|
-
"ajv-formats": "3.0.1"
|
|
38
|
+
"@cfworker/json-schema": "4.1.1"
|
|
40
39
|
}
|
|
41
40
|
}
|