@agentshouse/mdmodel 0.1.0-alpha.16 → 0.1.0-alpha.17

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 (123) hide show
  1. package/API.md +44 -33
  2. package/README.md +2 -4
  3. package/dist/definition.d.ts +7 -3
  4. package/dist/definition.d.ts.map +1 -1
  5. package/dist/definition.js +83 -38
  6. package/dist/definition.js.map +1 -1
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/paths.d.ts +0 -2
  12. package/dist/paths.d.ts.map +1 -1
  13. package/dist/paths.js +0 -7
  14. package/dist/paths.js.map +1 -1
  15. package/dist/project.d.ts.map +1 -1
  16. package/dist/project.js +3 -15
  17. package/dist/project.js.map +1 -1
  18. package/dist/types.d.ts +6 -5
  19. package/dist/types.d.ts.map +1 -1
  20. package/dist/types.js.map +1 -1
  21. package/dist/validate.d.ts +2 -3
  22. package/dist/validate.d.ts.map +1 -1
  23. package/dist/validate.js +42 -86
  24. package/dist/validate.js.map +1 -1
  25. package/dist/version.d.ts +1 -1
  26. package/dist/version.js +1 -1
  27. package/dist/version.js.map +1 -1
  28. package/dist/yaml.js +1 -1
  29. package/dist/yaml.js.map +1 -1
  30. package/fixtures/README.md +45 -44
  31. package/fixtures/cases/binary-any-reference/schema.yaml +4 -0
  32. package/fixtures/cases/binary-document-collision/schema.yaml +2 -0
  33. package/fixtures/cases/binary-link-outside-collection/schema.yaml +2 -0
  34. package/fixtures/cases/binary-prototype-reference/schema.yaml +4 -0
  35. package/fixtures/cases/binary-typed-reference/schema.yaml +5 -0
  36. package/fixtures/cases/bracketed-link-definition/schema.yaml +6 -0
  37. package/fixtures/cases/declared-binary-links/schema.yaml +2 -0
  38. package/fixtures/cases/duplicate-link-definition/schema.yaml +6 -0
  39. package/fixtures/cases/fenced-link-definition/schema.yaml +6 -0
  40. package/fixtures/cases/field-enum/schema.yaml +7 -0
  41. package/fixtures/cases/frontmatter-schema/expected.json +6 -0
  42. package/fixtures/cases/frontmatter-schema/schema.yaml +6 -0
  43. package/fixtures/cases/interrupted-link-definition/schema.yaml +2 -0
  44. package/fixtures/cases/long-fence-link-definition/schema.yaml +2 -0
  45. package/fixtures/cases/malformed-definition/expected.json +1 -2
  46. package/fixtures/cases/malformed-definition/schema.yaml +4 -0
  47. package/fixtures/cases/member-document/context.json +1 -0
  48. package/fixtures/cases/member-document/library/people/ana.md +5 -0
  49. package/fixtures/cases/member-document/schema.yaml +5 -0
  50. package/fixtures/cases/missing-binary-image/schema.yaml +2 -0
  51. package/fixtures/cases/missing-binary-link/schema.yaml +2 -0
  52. package/fixtures/cases/missing-required-field/schema.yaml +7 -0
  53. package/fixtures/cases/missing-section-item-kind/expected.json +1 -2
  54. package/fixtures/cases/missing-section-item-kind/schema.yaml +6 -0
  55. package/fixtures/cases/paragraph-link-definition/schema.yaml +2 -0
  56. package/fixtures/cases/prototype-field/schema.yaml +6 -0
  57. package/fixtures/cases/quoted-link-definition/schema.yaml +2 -0
  58. package/fixtures/cases/referenced-missing-file/schema.yaml +10 -0
  59. package/fixtures/cases/second-member-document/context.json +1 -0
  60. package/fixtures/cases/second-member-document/expected.json +6 -0
  61. package/fixtures/cases/second-member-document/schema.yaml +5 -0
  62. package/fixtures/cases/structured-section/schema.yaml +7 -0
  63. package/fixtures/cases/submission-keys/schema.yaml +4 -0
  64. package/fixtures/cases/truncated-link-definition/schema.yaml +2 -0
  65. package/fixtures/cases/types-folder-content/schema.yaml +4 -0
  66. package/fixtures/cases/undeclared-field/schema.yaml +6 -0
  67. package/fixtures/cases/unknown-type/expected.json +7 -0
  68. package/fixtures/cases/unknown-type/schema.yaml +4 -0
  69. package/fixtures/cases/unlisted-reference-type/context.json +1 -0
  70. package/fixtures/cases/unlisted-reference-type/expected.json +6 -0
  71. package/fixtures/cases/unlisted-reference-type/schema.yaml +4 -0
  72. package/fixtures/cases/unresolved-link/schema.yaml +6 -0
  73. package/fixtures/cases/valid-typed-document/schema.yaml +15 -0
  74. package/fixtures/cases/wide-item-fence-link/schema.yaml +2 -0
  75. package/fixtures/division.json +1 -21
  76. package/fixtures/projection.json +1 -24
  77. package/package.json +1 -1
  78. package/fixtures/cases/binary-any-reference/library/types/note.md +0 -5
  79. package/fixtures/cases/binary-document-collision/library/types/note.md +0 -3
  80. package/fixtures/cases/binary-link-outside-collection/library/types/note.md +0 -3
  81. package/fixtures/cases/binary-prototype-reference/library/types/note.md +0 -5
  82. package/fixtures/cases/binary-typed-reference/library/types/note.md +0 -5
  83. package/fixtures/cases/binary-typed-reference/library/types/person.md +0 -3
  84. package/fixtures/cases/bracketed-link-definition/library/types/task.md +0 -7
  85. package/fixtures/cases/declared-binary-links/library/types/note.md +0 -3
  86. package/fixtures/cases/duplicate-link-definition/library/types/task.md +0 -7
  87. package/fixtures/cases/external-invalid-model/definitions/schema/task.md +0 -5
  88. package/fixtures/cases/external-invalid-model/expected.json +0 -1
  89. package/fixtures/cases/external-invalid-model/library/note.md +0 -1
  90. package/fixtures/cases/external-unknown-type/definitions/schema/task.md +0 -5
  91. package/fixtures/cases/external-unknown-type/expected.json +0 -1
  92. package/fixtures/cases/external-valid/context.json +0 -1
  93. package/fixtures/cases/external-valid/definitions/types/task.md +0 -5
  94. package/fixtures/cases/fenced-link-definition/library/types/task.md +0 -7
  95. package/fixtures/cases/field-enum/library/types/task.md +0 -8
  96. package/fixtures/cases/interrupted-link-definition/library/types/note.md +0 -3
  97. package/fixtures/cases/long-fence-link-definition/library/types/note.md +0 -3
  98. package/fixtures/cases/malformed-definition/library/types/task.md +0 -5
  99. package/fixtures/cases/missing-binary-image/library/types/note.md +0 -3
  100. package/fixtures/cases/missing-binary-link/library/types/note.md +0 -3
  101. package/fixtures/cases/missing-required-field/library/types/task.md +0 -8
  102. package/fixtures/cases/missing-section-item-kind/library/types/task.md +0 -7
  103. package/fixtures/cases/paragraph-link-definition/library/types/note.md +0 -3
  104. package/fixtures/cases/prd-definition/library/types/task.md +0 -16
  105. package/fixtures/cases/prototype-field/library/types/task.md +0 -7
  106. package/fixtures/cases/quoted-link-definition/library/types/note.md +0 -3
  107. package/fixtures/cases/referenced-missing-file/library/types/person.md +0 -5
  108. package/fixtures/cases/referenced-missing-file/library/types/task.md +0 -8
  109. package/fixtures/cases/structured-section/library/types/task.md +0 -8
  110. package/fixtures/cases/submission-keys/library/types/note.md +0 -5
  111. package/fixtures/cases/truncated-link-definition/library/types/note.md +0 -3
  112. package/fixtures/cases/undeclared-field/library/types/task.md +0 -7
  113. package/fixtures/cases/unresolved-link/library/types/task.md +0 -7
  114. package/fixtures/cases/valid-typed-document/library/types/person.md +0 -5
  115. package/fixtures/cases/valid-typed-document/library/types/task.md +0 -13
  116. package/fixtures/cases/wide-item-fence-link/library/types/note.md +0 -3
  117. /package/fixtures/cases/{prd-definition → frontmatter-schema}/context.json +0 -0
  118. /package/fixtures/cases/{prd-definition → member-document}/expected.json +0 -0
  119. /package/fixtures/cases/{external-invalid-model → types-folder-content}/context.json +0 -0
  120. /package/fixtures/cases/{external-valid → types-folder-content}/expected.json +0 -0
  121. /package/fixtures/cases/{external-valid → types-folder-content}/library/types/task.md +0 -0
  122. /package/fixtures/cases/{external-unknown-type → unknown-type}/context.json +0 -0
  123. /package/fixtures/cases/{external-unknown-type → unknown-type}/library/item.md +0 -0
@@ -2,9 +2,9 @@
2
2
 
3
3
  Each directory under `cases/` is one text Library, one validation context,
4
4
  and one expected verdict. Consumers load the files under `library/` as
5
- path-to-content and the required `context.json` as `ValidationContext`. Cases
6
- with a `definitions/` directory load those files into a separate address-to-text
7
- map, call `verify(definitions)`, then compare its refusal or
5
+ path-to-content, an absent `library/` being the empty Library, and the
6
+ required `context.json` as `ValidationContext`. Cases with a `schema.yaml` call
7
+ `verify` with its text, then compare its refusal or
8
8
  `validate(library, context, verified.model)` against `expected.json`. Other
9
9
  cases compare `validate(library, context)` directly. Text-only cases carry
10
10
  `{ "binaryTargets": [] }`. Binary targets are membership declarations; the
@@ -23,15 +23,15 @@ fenced headings, newline/source preservation, and a moved-export link rewrite.
23
23
  ## Projection
24
24
 
25
25
  `projection.json` exercises the public `project` seam separately from the
26
- validation Libraries. It carries `definitions`, the MD Type definition sources
27
- keyed by a label, and `cases`. Each case carries `name`, the `file` the Document
28
- sits at, exact `source`, the `documentTargets` the collection holds as Markdown
29
- documents, the `definition` label or `null`, an optional `move`, and `expected`.
26
+ validation Libraries. It carries `schema`, one schema text, and `cases`. Each
27
+ case carries `name`, the `file` the Document sits at, exact `source`, the
28
+ `documentTargets` the collection holds as Markdown documents, the `definition`
29
+ type name or `null`, an optional `move`, and `expected`.
30
30
  A case carrying a `move` lists both the Path its target sits at and the Path the
31
31
  move takes it to, because the collection holds that target either way.
32
32
 
33
- Parse the source, call `project(document, file, context)` with
34
- `{ documentTargets, definition }`, and compare against `expected`, replacing the
33
+ Verify the schema, parse the source, call `project(document, file, context)`
34
+ with `documentTargets` and the verified type `definition` names, and compare against `expected`, replacing the
35
35
  `<package-version>` token in a refusal the same way `cases/` does. Then check
36
36
  that the source is unchanged. Where `move` is present, apply
37
37
  `{ kind: 'link', href, to }`, confirm the serialized Document changed, and
@@ -41,7 +41,7 @@ moved Path rewrites destinations and leaves the projection alone.
41
41
  ## Division
42
42
 
43
43
  `division.json` exercises the public `divide` seam separately from the
44
- validation Libraries. It carries `definitions` and `cases` like `projection.json`,
44
+ validation Libraries. It carries `schema` and `cases` like `projection.json`,
45
45
  and each case adds the `budget` the division runs under. Parse the source, call
46
46
  `divide(document, file, context)` with `{ documentTargets, definition, budget }`,
47
47
  and compare against `expected`: either `{ "ok": true, "spans": [...] }`, where
@@ -79,50 +79,51 @@ Refusal:
79
79
  ```
80
80
 
81
81
  `location` is omitted when the rule is not about a field or section.
82
- `referrers` is present only for `referenced-missing-file`.
83
- Separate-model cases add `source: "model"` to a verification refusal or
84
- `source: "content"` to a validation refusal. A definition refusal's `file` is
85
- its supplied canonical address; a content refusal's `file` is its Library Path.
82
+ `referrers` is present only for `referenced-missing-file`. A schema refusal
83
+ carries no `file`; its `location`, when present, is the dotted path of the
84
+ schema part it concerns, such as `types.task.fields.title`, or `line <n>` for
85
+ `schema-yaml`.
86
86
  The `version` field in these fixtures is the token `<package-version>`;
87
87
  replace it with the package's semantic version before comparing.
88
88
 
89
89
  ## Rule ids
90
90
 
91
- | Rule | When |
92
- | ------------------------- | ------------------------------------------------------------------------ |
93
- | `binary-target-document` | A path is declared as both a text Document and a binary target |
94
- | `frontmatter-fence` | A present frontmatter fence does not parse as the accepted YAML subset |
95
- | `definition-type` | A `types/` file is not a definition, or its type name is empty |
96
- | `definition-shape` | A definition carries a key other than `type`, `fields`, and `sections` |
97
- | `definition-fields` | `fields` is not a mapping |
98
- | `definition-field` | A field spec is not an object of the accepted keys |
99
- | `definition-field-kind` | A field kind is not text, string, number, date, enum, reference, or list |
100
- | `definition-enum-values` | An enum field has no non-empty string `values` |
101
- | `definition-reference-to` | A reference field has no non-empty `to` type name |
102
- | `definition-list-of` | A list field or list section has no `of` that is one scalar kind |
103
- | `definition-sections` | `sections` is not a mapping |
104
- | `definition-section` | A section spec is not an object of the accepted keys |
105
- | `definition-section-kind` | A section kind is not `text` or `list` |
106
- | `definition-duplicate` | Two definition files share a type name |
107
- | `unknown-type` | A file declares a type absent from the governing definitions |
108
- | `required-field` | A required field is missing |
109
- | `required-section` | A required section heading is missing |
110
- | `field-kind` | A field value fails its kind, including date |
111
- | `field-enum` | A field value is not one of the declared enum values |
112
- | `undeclared-field` | A typed file carries a frontmatter field its type does not declare |
113
- | `unresolved-reference` | A reference does not resolve to a current file of the required type |
114
- | `unresolved-link` | A relative body link does not resolve to a current path |
115
- | `structured-section` | A declared structured-list section does not parse as a list |
116
- | `referenced-missing-file` | Remaining files still reference an absent path |
117
- | `unwritable-link` | No Markdown destination form can carry a new link destination |
118
- | `division-budget` | A division budget is not a whole number of at least 2 |
91
+ | Rule | When |
92
+ | ------------------------- | -------------------------------------------------------------------------------- |
93
+ | `binary-target-document` | A path is declared as both a text Document and a binary target |
94
+ | `frontmatter-fence` | A present frontmatter fence does not parse as the accepted YAML subset |
95
+ | `schema-yaml` | A schema text is not a mapping in the accepted YAML subset |
96
+ | `schema-shape` | A schema is not a mapping of exactly `types` to a mapping of non-empty names |
97
+ | `schema-member-document` | A second type is marked `member_document: true` |
98
+ | `definition-shape` | A type is not a mapping of `fields`, `sections`, and a boolean `member_document` |
99
+ | `definition-fields` | `fields` is not a mapping |
100
+ | `definition-field` | A field spec is not an object of the accepted keys |
101
+ | `definition-field-kind` | A field kind is not text, string, number, date, enum, reference, or list |
102
+ | `definition-enum-values` | An enum field has no non-empty string `values` |
103
+ | `definition-reference-to` | A reference has no `to` naming `any` or a type of the same schema |
104
+ | `definition-list-of` | A list field or list section has no `of` that is one scalar kind |
105
+ | `definition-sections` | `sections` is not a mapping |
106
+ | `definition-section` | A section spec is not an object of the accepted keys |
107
+ | `definition-section-kind` | A section kind is not `text` or `list` |
108
+ | `unknown-type` | A file declares a type absent from the governing schema |
109
+ | `required-field` | A required field is missing |
110
+ | `required-section` | A required section heading is missing |
111
+ | `field-kind` | A field value fails its kind, including date |
112
+ | `field-enum` | A field value is not one of the declared enum values |
113
+ | `undeclared-field` | A typed file carries a frontmatter field its type does not declare |
114
+ | `unresolved-reference` | A reference does not resolve to a current file of the required type |
115
+ | `unresolved-link` | A relative body link does not resolve to a current path |
116
+ | `structured-section` | A declared structured-list section does not parse as a list |
117
+ | `referenced-missing-file` | Remaining files still reference an absent path |
118
+ | `unwritable-link` | No Markdown destination form can carry a new link destination |
119
+ | `division-budget` | A division budget is not a whole number of at least 2 |
119
120
 
120
121
  `unwritable-link` is refused by `apply` and `division-budget` by `divide`, not
121
122
  by `validate`, so no case under `cases/` carries either.
122
123
 
123
124
  ## YAML subset
124
125
 
125
- Frontmatter is a mapping in a closed YAML subset: block and flow mappings,
126
+ Frontmatter and a schema text are each a mapping in a closed YAML subset: block and flow mappings,
126
127
  block and flow sequences, plain and quoted scalars, `true`, `false`, `null`,
127
128
  and decimal numbers. It does not take YAML 1.1 boolean or timestamp aliases,
128
- octal numbers, anchors, tags, or block scalars.
129
+ octal numbers, anchors, tags, or block scalars. A mapping carries each key once.
@@ -0,0 +1,4 @@
1
+ types:
2
+ note:
3
+ fields:
4
+ subject: { kind: reference, to: any, required: true }
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,4 @@
1
+ types:
2
+ note:
3
+ fields:
4
+ subject: { kind: reference, to: any, required: true }
@@ -0,0 +1,5 @@
1
+ types:
2
+ note:
3
+ fields:
4
+ subject: { kind: reference, to: person, required: true }
5
+ person: {}
@@ -0,0 +1,6 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Description: { kind: text, required: true }
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,6 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Description: { kind: text, required: true }
@@ -0,0 +1,6 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Description: { kind: text, required: true }
@@ -0,0 +1,7 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ status: { kind: enum, values: [open, in-progress, done], required: true }
6
+ sections:
7
+ Description: { kind: text, required: true }
@@ -0,0 +1,6 @@
1
+ {
2
+ "verdict": "refuse",
3
+ "location": "line 1",
4
+ "rule": "schema-yaml",
5
+ "version": "<package-version>"
6
+ }
@@ -0,0 +1,6 @@
1
+ ---
2
+ types:
3
+ task:
4
+ fields:
5
+ title: { kind: string }
6
+ ---
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "verdict": "refuse",
3
- "file": "types/task.md",
4
- "location": "title",
3
+ "location": "types.task.fields.title",
5
4
  "rule": "definition-field-kind",
6
5
  "version": "<package-version>"
7
6
  }
@@ -0,0 +1,4 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: widget }
@@ -0,0 +1 @@
1
+ { "binaryTargets": [] }
@@ -0,0 +1,5 @@
1
+ ---
2
+ type: contact
3
+ name: Ana
4
+ member: ana@example.com
5
+ ---
@@ -0,0 +1,5 @@
1
+ types:
2
+ contact:
3
+ member_document: true
4
+ fields:
5
+ name: { kind: string, required: true }
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,7 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ status: { kind: enum, values: [open, in-progress, done], required: true }
6
+ sections:
7
+ Description: { kind: text, required: true }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "verdict": "refuse",
3
- "file": "types/task.md",
4
- "location": "Acceptance",
3
+ "location": "types.task.sections.Acceptance",
5
4
  "rule": "definition-list-of",
6
5
  "version": "<package-version>"
7
6
  }
@@ -0,0 +1,6 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Acceptance: { kind: list }
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,6 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Description: { kind: text, required: true }
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,10 @@
1
+ types:
2
+ person:
3
+ fields:
4
+ name: { kind: string, required: true }
5
+ task:
6
+ fields:
7
+ title: { kind: string, required: true }
8
+ owner: { kind: reference, to: person, required: true }
9
+ sections:
10
+ Description: { kind: text, required: true }
@@ -0,0 +1 @@
1
+ { "binaryTargets": [] }
@@ -0,0 +1,6 @@
1
+ {
2
+ "verdict": "refuse",
3
+ "location": "types.person.member_document",
4
+ "rule": "schema-member-document",
5
+ "version": "<package-version>"
6
+ }
@@ -0,0 +1,5 @@
1
+ types:
2
+ contact:
3
+ member_document: true
4
+ person:
5
+ member_document: true
@@ -0,0 +1,7 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Description: { kind: text, required: true }
7
+ Acceptance: { kind: list, of: string }
@@ -0,0 +1,4 @@
1
+ types:
2
+ note:
3
+ fields:
4
+ title: { kind: string, required: true }
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -0,0 +1,4 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
@@ -0,0 +1,6 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Description: { kind: text, required: true }
@@ -0,0 +1,7 @@
1
+ {
2
+ "verdict": "refuse",
3
+ "file": "item.md",
4
+ "location": "type",
5
+ "rule": "unknown-type",
6
+ "version": "<package-version>"
7
+ }
@@ -0,0 +1,4 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string }
@@ -0,0 +1 @@
1
+ { "binaryTargets": [] }
@@ -0,0 +1,6 @@
1
+ {
2
+ "verdict": "refuse",
3
+ "location": "types.task.fields.owner",
4
+ "rule": "definition-reference-to",
5
+ "version": "<package-version>"
6
+ }
@@ -0,0 +1,4 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ owner: { kind: reference, to: person }
@@ -0,0 +1,6 @@
1
+ types:
2
+ task:
3
+ fields:
4
+ title: { kind: string, required: true }
5
+ sections:
6
+ Description: { kind: text, required: true }
@@ -0,0 +1,15 @@
1
+ types:
2
+ person:
3
+ fields:
4
+ name: { kind: string, required: true }
5
+ task:
6
+ fields:
7
+ name: { kind: text }
8
+ title: { kind: string, required: true }
9
+ status: { kind: enum, values: [open, in-progress, done], required: true }
10
+ due: { kind: date }
11
+ owner: { kind: reference, to: person }
12
+ labels: { kind: list, of: string }
13
+ sections:
14
+ Description: { kind: text, required: true }
15
+ Acceptance: { kind: list, of: string }
@@ -0,0 +1,2 @@
1
+ types:
2
+ note: {}
@@ -1,8 +1,5 @@
1
1
  {
2
- "definitions": {
3
- "task": "---\ntype: definition\nfields:\n name: { kind: text }\n status: { kind: enum, values: [open, done], required: true }\nsections:\n Description: { kind: text, required: true }\n Acceptance: { kind: list, of: reference, to: person }\n---\n",
4
- "unreadable-task": "---\ntype: definition\nsections:\n Description: { kind: prose }\n---\n"
5
- },
2
+ "schema": "types:\n task:\n fields:\n name: { kind: text }\n status: { kind: enum, values: [open, done], required: true }\n sections:\n Description: { kind: text, required: true }\n Acceptance: { kind: list, of: reference, to: person }\n person: {}\n",
6
3
  "cases": [
7
4
  {
8
5
  "name": "a Document whose whole input fits the budget is one Span carrying its projection",
@@ -302,23 +299,6 @@
302
299
  }
303
300
  }
304
301
  },
305
- {
306
- "name": "a definition the model cannot read is refused at that definition",
307
- "file": "tasks/one.md",
308
- "source": "---\ntype: task\nname: Ship the release\nstatus: open\n---\n\nPreamble prose.\n\n## Description\n\nBody of the description.\n\n## Acceptance\n\n- people/ana.md\n",
309
- "documentTargets": [],
310
- "definition": "unreadable-task",
311
- "budget": 4096,
312
- "expected": {
313
- "ok": false,
314
- "refusal": {
315
- "file": "types/task.md",
316
- "rule": "definition-section-kind",
317
- "version": "<package-version>",
318
- "location": "Description"
319
- }
320
- }
321
- },
322
302
  {
323
303
  "name": "a budget that cannot hold one whole character is refused before any division",
324
304
  "file": "notes/one.md",
@@ -1,8 +1,5 @@
1
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
- },
2
+ "schema": "types:\n task:\n fields:\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 }\n sections:\n Description: { kind: text, required: true }\n Acceptance: { kind: list, of: reference, to: person }\n Checklist: { kind: list, of: text }\n person: {}\n",
6
3
  "cases": [
7
4
  {
8
5
  "name": "any body keeps labels and leaves every unsupplied destination authored",
@@ -144,26 +141,6 @@
144
141
  }
145
142
  }
146
143
  },
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
144
  {
168
145
  "name": "an image at a supplied Markdown document target is projected like its link",
169
146
  "file": "notes/four.md",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdmodel",
3
- "version": "0.1.0-alpha.16",
3
+ "version": "0.1.0-alpha.17",
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",
@@ -1,5 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- subject: { kind: reference, to: any, required: true }
5
- ---
@@ -1,3 +0,0 @@
1
- ---
2
- type: definition
3
- ---
@@ -1,3 +0,0 @@
1
- ---
2
- type: definition
3
- ---
@@ -1,5 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- subject: { kind: reference, to: any, required: true }
5
- ---
@@ -1,5 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- subject: { kind: reference, to: person, required: true }
5
- ---
@@ -1,3 +0,0 @@
1
- ---
2
- type: definition
3
- ---
@@ -1,7 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- title: { kind: string, required: true }
5
- sections:
6
- Description: { kind: text, required: true }
7
- ---
@@ -1,3 +0,0 @@
1
- ---
2
- type: definition
3
- ---
@@ -1,7 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- title: { kind: string, required: true }
5
- sections:
6
- Description: { kind: text, required: true }
7
- ---
@@ -1,5 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- title: { kind: widget }
5
- ---
@@ -1 +0,0 @@
1
- {"verdict":"refuse","source":"model","file":"schema/task.md","location":"title","rule":"definition-field-kind","version":"<package-version>"}
@@ -1,5 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- title: { kind: string }
5
- ---
@@ -1 +0,0 @@
1
- {"verdict":"refuse","source":"content","file":"item.md","location":"type","rule":"unknown-type","version":"<package-version>"}
@@ -1 +0,0 @@
1
- {"binaryTargets":[]}
@@ -1,5 +0,0 @@
1
- ---
2
- type: definition
3
- fields:
4
- title: { kind: string, required: true }
5
- ---