@agentshouse/mdmodel 0.1.0-cc9fa0498a7f7 → 0.1.0-cd90851746292
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/API.md +231 -225
- package/README.md +16 -19
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +35 -20
- package/dist/condition.d.ts +41 -11
- package/dist/condition.d.ts.map +1 -1
- package/dist/condition.js +223 -87
- package/dist/definition.d.ts +17 -1
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +319 -43
- package/dist/divide.d.ts.map +1 -1
- package/dist/divide.js +27 -17
- package/dist/document.d.ts +6 -3
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +326 -176
- package/dist/index.d.ts +13 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/links.d.ts +3 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +108 -51
- package/dist/paths.d.ts +10 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +118 -12
- package/dist/pattern.d.ts +10 -0
- package/dist/pattern.d.ts.map +1 -0
- package/dist/pattern.js +355 -0
- package/dist/project.d.ts +1 -0
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +38 -15
- package/dist/references.d.ts +2 -2
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +6 -1
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +55 -4
- package/dist/types.d.ts +50 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +30 -2
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +317 -114
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +66 -21
- package/fixtures/README.md +10 -5
- package/fixtures/cases/conditional-section/context.json +1 -0
- package/fixtures/cases/conditional-section/expected.json +6 -0
- package/fixtures/cases/conditional-section/library/questions/hosting.md +9 -0
- package/fixtures/cases/conditional-section/library/questions/payments.md +12 -0
- package/fixtures/cases/conditional-section/schema.yaml +14 -0
- package/fixtures/cases/cross-room-link/context.json +1 -0
- package/fixtures/cases/cross-room-link/expected.json +1 -0
- package/fixtures/cases/cross-room-link/library/clients/acme.md +6 -0
- package/fixtures/cases/cross-room-link/schema.yaml +3 -0
- package/fixtures/cases/cross-room-reference/context.json +1 -0
- package/fixtures/cases/cross-room-reference/expected.json +1 -0
- package/fixtures/cases/cross-room-reference/library/clients/acme.md +9 -0
- package/fixtures/cases/cross-room-reference/schema.yaml +9 -0
- package/fixtures/division.json +26 -26
- package/package.json +10 -3
package/dist/yaml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAnC,YAAqB,MAAM,EAAE,MAAM,EAGlC;CACF;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,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I,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3E;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GACd;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAqB9F;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAgBjE;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEzD"}
|
package/dist/yaml.js
CHANGED
|
@@ -6,6 +6,18 @@ export class YamlError extends Error {
|
|
|
6
6
|
this.name = 'YamlError';
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
const YAML_DEPTH_MAX = 64;
|
|
10
|
+
function nested(c, parse) {
|
|
11
|
+
if (c.depth >= YAML_DEPTH_MAX)
|
|
12
|
+
throw new YamlError(c.i);
|
|
13
|
+
c.depth += 1;
|
|
14
|
+
try {
|
|
15
|
+
return parse();
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
c.depth -= 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
9
21
|
function peek(c) {
|
|
10
22
|
return c.i < c.end ? c.text[c.i] : '';
|
|
11
23
|
}
|
|
@@ -70,7 +82,10 @@ function indentAt(c) {
|
|
|
70
82
|
}
|
|
71
83
|
return n;
|
|
72
84
|
}
|
|
85
|
+
const UNHELD_TEXT = /[\0\ud800-\udfff]/u;
|
|
73
86
|
function scalar(value, start, end) {
|
|
87
|
+
if (typeof value === 'string' && UNHELD_TEXT.test(value))
|
|
88
|
+
throw new YamlError(start);
|
|
74
89
|
return { kind: 'scalar', value, start, end };
|
|
75
90
|
}
|
|
76
91
|
export function interpretPlain(text) {
|
|
@@ -84,6 +99,30 @@ export function interpretPlain(text) {
|
|
|
84
99
|
return Number(text);
|
|
85
100
|
return text;
|
|
86
101
|
}
|
|
102
|
+
const ESCAPES = {
|
|
103
|
+
b: '\b',
|
|
104
|
+
f: '\f',
|
|
105
|
+
n: '\n',
|
|
106
|
+
r: '\r',
|
|
107
|
+
t: '\t',
|
|
108
|
+
'"': '"',
|
|
109
|
+
'/': '/',
|
|
110
|
+
'\\': '\\',
|
|
111
|
+
};
|
|
112
|
+
function parseEscape(c) {
|
|
113
|
+
c.i += 1;
|
|
114
|
+
const escaped = peek(c);
|
|
115
|
+
const held = ESCAPES[escaped];
|
|
116
|
+
if (held !== undefined) {
|
|
117
|
+
c.i += 1;
|
|
118
|
+
return held;
|
|
119
|
+
}
|
|
120
|
+
const hex = c.text.slice(c.i + 1, c.i + 5);
|
|
121
|
+
if (escaped !== 'u' || c.i + 5 > c.end || !/^[0-9A-Fa-f]{4}$/.test(hex))
|
|
122
|
+
throw new YamlError(c.i);
|
|
123
|
+
c.i += 5;
|
|
124
|
+
return String.fromCharCode(Number.parseInt(hex, 16));
|
|
125
|
+
}
|
|
87
126
|
function parseQuoted(c) {
|
|
88
127
|
const quote = peek(c);
|
|
89
128
|
const start = c.i;
|
|
@@ -91,31 +130,19 @@ function parseQuoted(c) {
|
|
|
91
130
|
let out = '';
|
|
92
131
|
while (c.i < c.end) {
|
|
93
132
|
const ch = peek(c);
|
|
133
|
+
if (quote === "'" && ch === "'" && c.i + 1 < c.end && c.text[c.i + 1] === "'") {
|
|
134
|
+
out += "'";
|
|
135
|
+
c.i += 2;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
94
138
|
if (ch === quote) {
|
|
95
139
|
c.i += 1;
|
|
96
140
|
return scalar(out, start, c.i);
|
|
97
141
|
}
|
|
98
142
|
if (ch === '\n' || ch === '\r')
|
|
99
143
|
throw new YamlError(c.i);
|
|
100
|
-
if (quote === "'" && ch === "'" && c.text[c.i + 1] === "'") {
|
|
101
|
-
out += "'";
|
|
102
|
-
c.i += 2;
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
144
|
if (quote === '"' && ch === '\\') {
|
|
106
|
-
|
|
107
|
-
const escaped = peek(c);
|
|
108
|
-
if (escaped === 'n')
|
|
109
|
-
out += '\n';
|
|
110
|
-
else if (escaped === 't')
|
|
111
|
-
out += '\t';
|
|
112
|
-
else if (escaped === '"')
|
|
113
|
-
out += '"';
|
|
114
|
-
else if (escaped === '\\')
|
|
115
|
-
out += '\\';
|
|
116
|
-
else
|
|
117
|
-
throw new YamlError(c.i);
|
|
118
|
-
c.i += 1;
|
|
145
|
+
out += parseEscape(c);
|
|
119
146
|
continue;
|
|
120
147
|
}
|
|
121
148
|
out += ch;
|
|
@@ -190,6 +217,9 @@ function parseFlowValue(c) {
|
|
|
190
217
|
return parseScalar(c, true);
|
|
191
218
|
}
|
|
192
219
|
function parseFlowMap(c) {
|
|
220
|
+
return nested(c, () => flowMap(c));
|
|
221
|
+
}
|
|
222
|
+
function flowMap(c) {
|
|
193
223
|
const start = c.i;
|
|
194
224
|
if (peek(c) !== '{')
|
|
195
225
|
throw new YamlError(c.i);
|
|
@@ -228,6 +258,9 @@ function parseFlowMap(c) {
|
|
|
228
258
|
throw new YamlError(c.i);
|
|
229
259
|
}
|
|
230
260
|
function parseFlowSeq(c) {
|
|
261
|
+
return nested(c, () => flowSeq(c));
|
|
262
|
+
}
|
|
263
|
+
function flowSeq(c) {
|
|
231
264
|
const start = c.i;
|
|
232
265
|
if (peek(c) !== '[')
|
|
233
266
|
throw new YamlError(c.i);
|
|
@@ -324,6 +357,9 @@ function parseSeqItem(c, indent) {
|
|
|
324
357
|
return parseValue(c, indent);
|
|
325
358
|
}
|
|
326
359
|
function parseBlockSeq(c, indent) {
|
|
360
|
+
return nested(c, () => blockSeq(c, indent));
|
|
361
|
+
}
|
|
362
|
+
function blockSeq(c, indent) {
|
|
327
363
|
const start = c.i;
|
|
328
364
|
const items = [];
|
|
329
365
|
let end = start;
|
|
@@ -343,6 +379,9 @@ function parseBlockSeq(c, indent) {
|
|
|
343
379
|
return { kind: 'seq', items, start, end };
|
|
344
380
|
}
|
|
345
381
|
function parseBlockMap(c, indent, inline = false) {
|
|
382
|
+
return nested(c, () => blockMap(c, indent, inline));
|
|
383
|
+
}
|
|
384
|
+
function blockMap(c, indent, inline) {
|
|
346
385
|
const start = c.i;
|
|
347
386
|
const entries = [];
|
|
348
387
|
const seen = new Set();
|
|
@@ -375,7 +414,7 @@ function parseBlockMap(c, indent, inline = false) {
|
|
|
375
414
|
return { kind: 'map', entries, start, end };
|
|
376
415
|
}
|
|
377
416
|
export function parseYamlMapping(text, start, end) {
|
|
378
|
-
const c = { text, i: start, end };
|
|
417
|
+
const c = { text, i: start, end, depth: 0 };
|
|
379
418
|
skipBlankAndComments(c);
|
|
380
419
|
if (c.i >= end)
|
|
381
420
|
return { kind: 'map', entries: [], start, end };
|
|
@@ -427,17 +466,23 @@ function listed(value) {
|
|
|
427
466
|
return keys.length === value.length && keys.every((key, index) => key === String(index));
|
|
428
467
|
}
|
|
429
468
|
function heldWithin(value, within) {
|
|
430
|
-
if (
|
|
469
|
+
if (typeof value === 'string')
|
|
470
|
+
return !UNHELD_TEXT.test(value);
|
|
471
|
+
if (value === null || typeof value === 'boolean')
|
|
431
472
|
return true;
|
|
432
473
|
if (typeof value === 'number')
|
|
433
474
|
return Number.isFinite(value);
|
|
434
475
|
if (typeof value !== 'object' || within.includes(value))
|
|
435
476
|
return false;
|
|
477
|
+
if (within.length + 1 >= YAML_DEPTH_MAX)
|
|
478
|
+
return false;
|
|
436
479
|
const path = [...within, value];
|
|
437
480
|
const held = (item) => heldWithin(item, path);
|
|
438
481
|
if (Array.isArray(value))
|
|
439
482
|
return listed(value) && value.every(held);
|
|
440
|
-
return plain(value) &&
|
|
483
|
+
return (plain(value) &&
|
|
484
|
+
Object.keys(value).every((key) => !UNHELD_TEXT.test(key)) &&
|
|
485
|
+
Object.values(value).every(held));
|
|
441
486
|
}
|
|
442
487
|
export function frontmatterValue(value) {
|
|
443
488
|
return heldWithin(value, []);
|
package/fixtures/README.md
CHANGED
|
@@ -51,8 +51,8 @@ change to a value that is not prose leaves the projection alone.
|
|
|
51
51
|
|
|
52
52
|
`division.json` exercises the public `divide` seam separately from the
|
|
53
53
|
validation Libraries. It carries `schema` and `cases` like `projection.json`,
|
|
54
|
-
and each case adds the `
|
|
55
|
-
`divide(document, file, context)` with `{ documentTargets, definition,
|
|
54
|
+
and each case adds the `bound` the division runs under. Parse the source, call
|
|
55
|
+
`divide(document, file, context)` with `{ documentTargets, definition, bound }`,
|
|
56
56
|
and compare against `expected`: either `{ "ok": true, "spans": [...] }`, where
|
|
57
57
|
each span carries the exact `text` to embed and the exact `source` the returned
|
|
58
58
|
`start` and `end` address in that case's source, or `{ "ok": false, "refusal": ... }`. Then
|
|
@@ -107,6 +107,7 @@ schema text. The model's own rules:
|
|
|
107
107
|
| `frontmatter-fence` | A present frontmatter fence does not parse as the accepted YAML subset |
|
|
108
108
|
| `schema-yaml` | A schema text is not a mapping in the accepted YAML subset |
|
|
109
109
|
| `schema-type-name` | A type name is empty, starts with `$`, or is `any` or `attachment` |
|
|
110
|
+
| `provided-type` | A schema names a type its caller provides with a key but its two role keywords |
|
|
110
111
|
| `schema` | A type or subschema is neither a mapping nor a boolean |
|
|
111
112
|
| `schema-keyword` | A schema carries a key that is no JSON Schema 2020-12 keyword the model admits |
|
|
112
113
|
| `$defs` | `$defs` is not a mapping |
|
|
@@ -117,14 +118,18 @@ schema text. The model's own rules:
|
|
|
117
118
|
| `unknown-type` | A file declares a type absent from the governing schema |
|
|
118
119
|
| `undeclared-field` | A closed object carries a key it does not declare |
|
|
119
120
|
| `required-section` | A required section heading is missing |
|
|
121
|
+
| `conditional-section` | A section its type's `if` branch requires is absent or holds no text |
|
|
120
122
|
| `unresolved-reference` | A reference at any depth or a section item reaches no member it admits |
|
|
121
123
|
| `unresolved-link` | A body link is an absolute path or leaves the collection |
|
|
122
124
|
| `structured-section` | A declared list section is not a list of values of its item schema |
|
|
123
125
|
| `referenced-missing-file` | Remaining files still reference an absent path |
|
|
124
126
|
| `unwritable-link` | No Markdown destination form can carry a new link destination |
|
|
125
|
-
| `division-
|
|
127
|
+
| `division-bound` | A division bound is not a whole number of at least 2 |
|
|
126
128
|
|
|
127
|
-
`
|
|
129
|
+
A `then` or `else` of an `if` on a type, in its `allOf` or in such a branch may hold
|
|
130
|
+
`sections`, naming sections the type declares as the type declares them, else `sections`.
|
|
131
|
+
|
|
132
|
+
`unwritable-link` is refused by `apply` and `division-bound` by `divide`, not
|
|
128
133
|
by `validate`, so no case under `cases/` carries either.
|
|
129
134
|
|
|
130
135
|
A reference that admits `attachment` reaches any path in the same Library, so
|
|
@@ -136,6 +141,6 @@ Library is accepted too, so `unresolved-link` never names it and
|
|
|
136
141
|
## YAML subset
|
|
137
142
|
|
|
138
143
|
Frontmatter and a schema text are each a mapping in a closed YAML subset: block and flow mappings,
|
|
139
|
-
block and flow sequences, a block sequence item that opens a mapping, plain and quoted scalars, `true`, `false`, `null`,
|
|
144
|
+
block and flow sequences, a block sequence item that opens a mapping, plain and quoted scalars (a single-quoted scalar doubles its apostrophe, a double-quoted one takes JSON's escapes), `true`, `false`, `null`,
|
|
140
145
|
and decimal numbers. It does not take YAML 1.1 boolean or timestamp aliases,
|
|
141
146
|
octal numbers, anchors, tags, or block scalars. A mapping carries each key once.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "binaryTargets": [] }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
question:
|
|
2
|
+
properties:
|
|
3
|
+
title: { type: string }
|
|
4
|
+
status: { enum: [open, answered, withdrawn] }
|
|
5
|
+
required: [title, status]
|
|
6
|
+
sections:
|
|
7
|
+
Question: { kind: text, required: true }
|
|
8
|
+
Answer: { kind: text }
|
|
9
|
+
if:
|
|
10
|
+
properties:
|
|
11
|
+
status: { enum: [answered, withdrawn] }
|
|
12
|
+
then:
|
|
13
|
+
sections:
|
|
14
|
+
Answer: { kind: text, required: true }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "binaryTargets": [] }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "verdict": "accept" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "binaryTargets": [] }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "verdict": "accept" }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
client:
|
|
2
|
+
properties:
|
|
3
|
+
name: { type: string }
|
|
4
|
+
finance: { type: string, reference: invoice, cross_room: true }
|
|
5
|
+
sections:
|
|
6
|
+
Invoices: { kind: list, items: { type: string, reference: invoice, cross_room: true } }
|
|
7
|
+
invoice:
|
|
8
|
+
properties:
|
|
9
|
+
name: { type: string }
|
package/fixtures/division.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"schema": "task:\n type: object\n properties:\n name: { type: string }\n status: { enum: [open, done] }\n required: [status]\n sections:\n Description: { kind: text, required: true }\n Acceptance: { kind: list, items: { type: string, reference: person } }\nperson: {}\n",
|
|
3
3
|
"cases": [
|
|
4
4
|
{
|
|
5
|
-
"name": "a Document whose whole input fits the
|
|
5
|
+
"name": "a Document whose whole input fits the bound is one Span carrying its projection",
|
|
6
6
|
"file": "tasks/one.md",
|
|
7
7
|
"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",
|
|
8
8
|
"documentTargets": [],
|
|
9
9
|
"definition": "task",
|
|
10
|
-
"
|
|
10
|
+
"bound": 4096,
|
|
11
11
|
"expected": {
|
|
12
12
|
"ok": true,
|
|
13
13
|
"spans": [
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
"name": "an input over the
|
|
22
|
+
"name": "an input over the bound descends to whole heading nodes and packs adjacent siblings",
|
|
23
23
|
"file": "tasks/one.md",
|
|
24
24
|
"source": "---\ntype: task\nname: Ship the release\nstatus: open\n---\n\nPreamble prose.\n\n## Description\n\nBody of the description.\n\n## Notes\n\nNotes prose.\n\n## Acceptance\n\n- people/ana.md\n",
|
|
25
25
|
"documentTargets": [],
|
|
26
26
|
"definition": "task",
|
|
27
|
-
"
|
|
27
|
+
"bound": 45,
|
|
28
28
|
"expected": {
|
|
29
29
|
"ok": true,
|
|
30
30
|
"spans": [
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
"name": "a heading node over the
|
|
47
|
+
"name": "a heading node over the bound divides into adjacent blocks carrying its own heading",
|
|
48
48
|
"file": "tasks/one.md",
|
|
49
49
|
"source": "---\ntype: task\nname: Task\nstatus: open\n---\n\n## Overview\n\nFirst paragraph of the overview.\n\nSecond paragraph of the overview.\n\n## Notes\n\nShort note.\n",
|
|
50
50
|
"documentTargets": [],
|
|
51
51
|
"definition": "task",
|
|
52
|
-
"
|
|
52
|
+
"bound": 50,
|
|
53
53
|
"expected": {
|
|
54
54
|
"ok": true,
|
|
55
55
|
"spans": [
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"source": "---\ntype: task\nname: Task\nstatus: open\n---\n\n## Overview\n\nFirst paragraph of the overview.\n\nSecond paragraph of the overview.\n\n## Notes\n\nShort note.\n",
|
|
79
79
|
"documentTargets": [],
|
|
80
80
|
"definition": "task",
|
|
81
|
-
"
|
|
81
|
+
"bound": 75,
|
|
82
82
|
"expected": {
|
|
83
83
|
"ok": true,
|
|
84
84
|
"spans": [
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"source": "---\ntype: task\nname: Task\nstatus: open\n---\n\n## Overview\n\nIntro line.\n\n### Detail\n\nDetail paragraph one.\n\nDetail paragraph two.\n",
|
|
108
108
|
"documentTargets": [],
|
|
109
109
|
"definition": "task",
|
|
110
|
-
"
|
|
110
|
+
"bound": 40,
|
|
111
111
|
"expected": {
|
|
112
112
|
"ok": true,
|
|
113
113
|
"spans": [
|
|
@@ -131,12 +131,12 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
|
-
"name": "a block over the
|
|
134
|
+
"name": "a block over the bound divides into sentences that repeat their predecessor",
|
|
135
135
|
"file": "tasks/one.md",
|
|
136
136
|
"source": "---\ntype: task\nname: Task\nstatus: open\n---\n\n## Overview\n\nOne. Two. Three. Four.\n",
|
|
137
137
|
"documentTargets": [],
|
|
138
138
|
"definition": "task",
|
|
139
|
-
"
|
|
139
|
+
"bound": 30,
|
|
140
140
|
"expected": {
|
|
141
141
|
"ok": true,
|
|
142
142
|
"spans": [
|
|
@@ -156,12 +156,12 @@
|
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
"name": "a single sentence over the
|
|
159
|
+
"name": "a single sentence over the bound divides at a bound cut inside it",
|
|
160
160
|
"file": "tasks/one.md",
|
|
161
161
|
"source": "---\ntype: task\nname: Task\nstatus: open\n---\n\n## Overview\n\naaaa bbbb cccc dddd eeee\n",
|
|
162
162
|
"documentTargets": [],
|
|
163
163
|
"definition": "task",
|
|
164
|
-
"
|
|
164
|
+
"bound": 20,
|
|
165
165
|
"expected": {
|
|
166
166
|
"ok": true,
|
|
167
167
|
"spans": [
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"source": "# Title\n\nIntro paragraph about the whole thing.\n\n## Alpha\n\nAlpha one. Alpha two.\n\n### Deep\n\nDeep prose here.\n\n## Beta\n\nBeta prose.\n",
|
|
199
199
|
"documentTargets": [],
|
|
200
200
|
"definition": null,
|
|
201
|
-
"
|
|
201
|
+
"bound": 60,
|
|
202
202
|
"expected": {
|
|
203
203
|
"ok": true,
|
|
204
204
|
"spans": [
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
"source": "---\ntype: any\ntitle: Note\n---\n\n## Notes\n\nRead it.\n",
|
|
228
228
|
"documentTargets": [],
|
|
229
229
|
"definition": null,
|
|
230
|
-
"
|
|
230
|
+
"bound": 4096,
|
|
231
231
|
"expected": {
|
|
232
232
|
"ok": true,
|
|
233
233
|
"spans": [
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
"plans/q3.md"
|
|
247
247
|
],
|
|
248
248
|
"definition": "task",
|
|
249
|
-
"
|
|
249
|
+
"bound": 50,
|
|
250
250
|
"expected": {
|
|
251
251
|
"ok": true,
|
|
252
252
|
"spans": [
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
"source": "---\ntype: task\nname: Task\nstatus: open\n---\n\nPreamble prose.\n\n## Acceptance\n\n- people/ana.md\n\n## Notes\n\nShort note.\n",
|
|
272
272
|
"documentTargets": [],
|
|
273
273
|
"definition": "task",
|
|
274
|
-
"
|
|
274
|
+
"bound": 4096,
|
|
275
275
|
"expected": {
|
|
276
276
|
"ok": true,
|
|
277
277
|
"spans": [
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"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",
|
|
289
289
|
"documentTargets": [],
|
|
290
290
|
"definition": null,
|
|
291
|
-
"
|
|
291
|
+
"bound": 4096,
|
|
292
292
|
"expected": {
|
|
293
293
|
"ok": false,
|
|
294
294
|
"refusal": {
|
|
@@ -299,17 +299,17 @@
|
|
|
299
299
|
}
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
|
-
"name": "a
|
|
302
|
+
"name": "a bound that cannot hold one whole character is refused before any division",
|
|
303
303
|
"file": "notes/one.md",
|
|
304
304
|
"source": "## Notes\n\nShort note.\n",
|
|
305
305
|
"documentTargets": [],
|
|
306
306
|
"definition": null,
|
|
307
|
-
"
|
|
307
|
+
"bound": 1,
|
|
308
308
|
"expected": {
|
|
309
309
|
"ok": false,
|
|
310
310
|
"refusal": {
|
|
311
311
|
"file": "notes/one.md",
|
|
312
|
-
"rule": "division-
|
|
312
|
+
"rule": "division-bound"
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
},
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
"source": "---\ntype: task\nname: \"Ship: the release\"\nstatus: open\n---\n\nBody prose.\n",
|
|
320
320
|
"documentTargets": [],
|
|
321
321
|
"definition": "task",
|
|
322
|
-
"
|
|
322
|
+
"bound": 4096,
|
|
323
323
|
"expected": {
|
|
324
324
|
"ok": true,
|
|
325
325
|
"spans": [
|
|
@@ -331,12 +331,12 @@
|
|
|
331
331
|
}
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
|
-
"name": "sentence division reads every terminator and closer and drops a carry the
|
|
334
|
+
"name": "sentence division reads every terminator and closer and drops a carry the bound cannot hold",
|
|
335
335
|
"file": "notes/three.md",
|
|
336
336
|
"source": "## Ask\n\nReady? Go! He said \"no.\" Then (silence.) Done.\n",
|
|
337
337
|
"documentTargets": [],
|
|
338
338
|
"definition": null,
|
|
339
|
-
"
|
|
339
|
+
"bound": 30,
|
|
340
340
|
"expected": {
|
|
341
341
|
"ok": true,
|
|
342
342
|
"spans": [
|
|
@@ -361,7 +361,7 @@
|
|
|
361
361
|
"source": "## Part\n\n### Alpha\n\nAlpha prose that is long enough to matter.\n\n### Beta\n\nBeta prose.\n",
|
|
362
362
|
"documentTargets": [],
|
|
363
363
|
"definition": null,
|
|
364
|
-
"
|
|
364
|
+
"bound": 70,
|
|
365
365
|
"expected": {
|
|
366
366
|
"ok": true,
|
|
367
367
|
"spans": [
|
|
@@ -377,12 +377,12 @@
|
|
|
377
377
|
}
|
|
378
378
|
},
|
|
379
379
|
{
|
|
380
|
-
"name": "a heading the
|
|
380
|
+
"name": "a heading the bound cannot hold beside any text is not repeated",
|
|
381
381
|
"file": "notes/five.md",
|
|
382
382
|
"source": "## An overview of the release\n\nFirst paragraph here.\n\nSecond paragraph here.\n",
|
|
383
383
|
"documentTargets": [],
|
|
384
384
|
"definition": null,
|
|
385
|
-
"
|
|
385
|
+
"bound": 25,
|
|
386
386
|
"expected": {
|
|
387
387
|
"ok": true,
|
|
388
388
|
"spans": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdmodel",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-cd90851746292",
|
|
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,7 +9,7 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=24.
|
|
12
|
+
"node": ">=24.22.1"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
@@ -26,6 +26,13 @@
|
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cfworker/json-schema": "4.1.1"
|
|
29
|
+
"@cfworker/json-schema": "4.1.1",
|
|
30
|
+
"decode-named-character-reference": "1.3.0",
|
|
31
|
+
"micromark-util-decode-numeric-character-reference": "2.0.2"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/agentshouse/core.git",
|
|
36
|
+
"directory": "mdmodel/packages/mdmodel"
|
|
30
37
|
}
|
|
31
38
|
}
|