@agentshouse/mdmodel 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +57 -0
- package/dist/definition.d.ts +36 -0
- package/dist/definition.d.ts.map +1 -0
- package/dist/definition.js +165 -0
- package/dist/definition.js.map +1 -0
- package/dist/document.d.ts +5 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +154 -0
- package/dist/document.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/links.d.ts +2 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +142 -0
- package/dist/links.js.map +1 -0
- package/dist/paths.d.ts +14 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +54 -0
- package/dist/paths.js.map +1 -0
- package/dist/profile.d.ts +6 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +7 -0
- package/dist/profile.js.map +1 -0
- package/dist/refuse.d.ts +6 -0
- package/dist/refuse.d.ts.map +1 -0
- package/dist/refuse.js +16 -0
- package/dist/refuse.js.map +1 -0
- package/dist/schema.d.ts +6 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +70 -0
- package/dist/schema.js.map +1 -0
- package/dist/sections.d.ts +10 -0
- package/dist/sections.d.ts.map +1 -0
- package/dist/sections.js +79 -0
- package/dist/sections.js.map +1 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +3 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +174 -0
- package/dist/validate.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/yaml.d.ts +49 -0
- package/dist/yaml.d.ts.map +1 -0
- package/dist/yaml.js +427 -0
- package/dist/yaml.js.map +1 -0
- package/fixtures/README.md +65 -0
- package/fixtures/cases/any-without-type/expected.json +1 -0
- package/fixtures/cases/any-without-type/library/note.md +3 -0
- package/fixtures/cases/field-enum/expected.json +7 -0
- package/fixtures/cases/field-enum/library/item.md +9 -0
- package/fixtures/cases/field-enum/library/types/task.md +8 -0
- package/fixtures/cases/malformed-definition/expected.json +7 -0
- package/fixtures/cases/malformed-definition/library/types/task.md +5 -0
- package/fixtures/cases/missing-required-field/expected.json +7 -0
- package/fixtures/cases/missing-required-field/library/item.md +8 -0
- package/fixtures/cases/missing-required-field/library/types/task.md +8 -0
- package/fixtures/cases/prd-definition/expected.json +1 -0
- package/fixtures/cases/prd-definition/library/types/task.md +15 -0
- package/fixtures/cases/referenced-missing-file/expected.json +7 -0
- package/fixtures/cases/referenced-missing-file/library/a.md +9 -0
- package/fixtures/cases/referenced-missing-file/library/b.md +9 -0
- package/fixtures/cases/referenced-missing-file/library/types/person.md +5 -0
- package/fixtures/cases/referenced-missing-file/library/types/task.md +8 -0
- package/fixtures/cases/structured-section/expected.json +7 -0
- package/fixtures/cases/structured-section/library/item.md +12 -0
- package/fixtures/cases/structured-section/library/types/task.md +8 -0
- package/fixtures/cases/unclosed-frontmatter/expected.json +6 -0
- package/fixtures/cases/unclosed-frontmatter/library/note.md +3 -0
- package/fixtures/cases/unresolved-link/expected.json +6 -0
- package/fixtures/cases/unresolved-link/library/item.md +8 -0
- package/fixtures/cases/unresolved-link/library/types/task.md +7 -0
- package/fixtures/cases/valid-typed-document/expected.json +1 -0
- package/fixtures/cases/valid-typed-document/library/people/ada.md +4 -0
- package/fixtures/cases/valid-typed-document/library/tasks/one.md +17 -0
- package/fixtures/cases/valid-typed-document/library/types/person.md +5 -0
- package/fixtures/cases/valid-typed-document/library/types/task.md +12 -0
- package/markdown-syntax-profile.md +9 -0
- package/package.json +41 -0
package/dist/links.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
function atLineStart(text, index) {
|
|
2
|
+
if (index === 0) return true;
|
|
3
|
+
const prev = text[index - 1];
|
|
4
|
+
return prev === '\n' || prev === '\r';
|
|
5
|
+
}
|
|
6
|
+
function skipFence(text, index) {
|
|
7
|
+
let i = index;
|
|
8
|
+
while(i < text.length && (text[i] === ' ' || text[i] === '\t'))i += 1;
|
|
9
|
+
const marker = text.startsWith('```', i) ? '```' : text.startsWith('~~~', i) ? '~~~' : null;
|
|
10
|
+
if (marker === null) return index + 1;
|
|
11
|
+
i += marker.length;
|
|
12
|
+
const close = text.indexOf(marker, i);
|
|
13
|
+
if (close === -1) return text.length;
|
|
14
|
+
return close + marker.length;
|
|
15
|
+
}
|
|
16
|
+
function skipInlineCode(text, index) {
|
|
17
|
+
let ticks = 0;
|
|
18
|
+
while(text[index + ticks] === '`')ticks += 1;
|
|
19
|
+
const close = text.indexOf('`'.repeat(ticks), index + ticks);
|
|
20
|
+
if (close === -1) return text.length;
|
|
21
|
+
return close + ticks;
|
|
22
|
+
}
|
|
23
|
+
function skipLinkSpace(text, start) {
|
|
24
|
+
let i = start;
|
|
25
|
+
while(text[i] === ' ' || text[i] === '\t')i += 1;
|
|
26
|
+
return i;
|
|
27
|
+
}
|
|
28
|
+
function skipTitle(text, start) {
|
|
29
|
+
const open = text[start];
|
|
30
|
+
if (open !== '"' && open !== "'" && open !== '(') return start;
|
|
31
|
+
const close = open === '(' ? ')' : open;
|
|
32
|
+
let i = start + 1;
|
|
33
|
+
while(i < text.length){
|
|
34
|
+
const ch = text[i];
|
|
35
|
+
if (ch === close) return i + 1;
|
|
36
|
+
if (ch === '\n' || ch === '\r') return null;
|
|
37
|
+
i += 1;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function destination(text, start) {
|
|
42
|
+
let i = skipLinkSpace(text, start + 1);
|
|
43
|
+
let href;
|
|
44
|
+
if (text[i] === '<') {
|
|
45
|
+
const close = text.indexOf('>', i + 1);
|
|
46
|
+
if (close === -1) return null;
|
|
47
|
+
href = text.slice(i + 1, close);
|
|
48
|
+
i = close + 1;
|
|
49
|
+
} else {
|
|
50
|
+
const from = i;
|
|
51
|
+
let depth = 0;
|
|
52
|
+
while(i < text.length){
|
|
53
|
+
const ch = text[i];
|
|
54
|
+
if (ch === ' ' || ch === '\t' || ch === '\n' || ch === '\r') break;
|
|
55
|
+
if (ch === '(') depth += 1;
|
|
56
|
+
else if (ch === ')') {
|
|
57
|
+
if (depth === 0) break;
|
|
58
|
+
depth -= 1;
|
|
59
|
+
}
|
|
60
|
+
i += 1;
|
|
61
|
+
}
|
|
62
|
+
href = text.slice(from, i);
|
|
63
|
+
}
|
|
64
|
+
i = skipLinkSpace(text, i);
|
|
65
|
+
const afterTitle = skipTitle(text, i);
|
|
66
|
+
if (afterTitle === null) return null;
|
|
67
|
+
i = skipLinkSpace(text, afterTitle);
|
|
68
|
+
if (text[i] !== ')') return null;
|
|
69
|
+
return {
|
|
70
|
+
href,
|
|
71
|
+
end: i + 1
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function takeLink(text, index, hrefs, defs) {
|
|
75
|
+
let i = index + 1;
|
|
76
|
+
let depth = 1;
|
|
77
|
+
while(i < text.length && depth > 0){
|
|
78
|
+
const ch = text[i];
|
|
79
|
+
if (ch === '[') depth += 1;
|
|
80
|
+
else if (ch === ']') depth -= 1;
|
|
81
|
+
else if (ch === '\n' || ch === '\r') return index + 1;
|
|
82
|
+
i += 1;
|
|
83
|
+
}
|
|
84
|
+
if (depth !== 0) return index + 1;
|
|
85
|
+
const label = text.slice(index + 1, i - 1);
|
|
86
|
+
if (text[i] === '(') {
|
|
87
|
+
const dest = destination(text, i);
|
|
88
|
+
if (dest === null) return index + 1;
|
|
89
|
+
hrefs.push(dest.href);
|
|
90
|
+
return dest.end;
|
|
91
|
+
}
|
|
92
|
+
if (text[i] === '[') {
|
|
93
|
+
const close = text.indexOf(']', i + 1);
|
|
94
|
+
if (close === -1) return index + 1;
|
|
95
|
+
const id = (text.slice(i + 1, close) || label).trim().toLowerCase();
|
|
96
|
+
const href = defs.get(id);
|
|
97
|
+
if (href !== undefined) hrefs.push(href);
|
|
98
|
+
return close + 1;
|
|
99
|
+
}
|
|
100
|
+
return i;
|
|
101
|
+
}
|
|
102
|
+
function collectDefinitions(text) {
|
|
103
|
+
const defs = new Map();
|
|
104
|
+
const pattern = /^ {0,3}\[([^\]]+)\]:[ \t]+<?([^\s>]+)>?/gm;
|
|
105
|
+
for (const match of text.matchAll(pattern)){
|
|
106
|
+
const id = match[1]?.trim().toLowerCase();
|
|
107
|
+
const href = match[2];
|
|
108
|
+
if (id !== undefined && href !== undefined) defs.set(id, href);
|
|
109
|
+
}
|
|
110
|
+
return defs;
|
|
111
|
+
}
|
|
112
|
+
export function extractRelativeHrefs(body) {
|
|
113
|
+
const defs = collectDefinitions(body);
|
|
114
|
+
const hrefs = [];
|
|
115
|
+
let i = 0;
|
|
116
|
+
while(i < body.length){
|
|
117
|
+
if (atLineStart(body, i) || i > 0 && (body[i - 1] === '\n' || body[i - 1] === '\r')) {
|
|
118
|
+
let j = i;
|
|
119
|
+
while(body[j] === ' ' && j - i < 3)j += 1;
|
|
120
|
+
if (body.startsWith('```', j) || body.startsWith('~~~', j)) {
|
|
121
|
+
i = skipFence(body, i);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (body[i] === '`') {
|
|
126
|
+
i = skipInlineCode(body, i);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (body[i] === '!' && body[i + 1] === '[') {
|
|
130
|
+
i = takeLink(body, i + 1, hrefs, defs);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (body[i] === '[') {
|
|
134
|
+
i = takeLink(body, i, hrefs, defs);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
i += 1;
|
|
138
|
+
}
|
|
139
|
+
return hrefs;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/executor/code/agents.house/mdmodel/packages/mdmodel/src/links.ts"],"sourcesContent":["function atLineStart(text: string, index: number): boolean {\n if (index === 0) return true;\n const prev = text[index - 1];\n return prev === '\\n' || prev === '\\r';\n}\n\nfunction skipFence(text: string, index: number): number {\n let i = index;\n while (i < text.length && (text[i] === ' ' || text[i] === '\\t')) i += 1;\n const marker = text.startsWith('```', i) ? '```' : text.startsWith('~~~', i) ? '~~~' : null;\n if (marker === null) return index + 1;\n i += marker.length;\n const close = text.indexOf(marker, i);\n if (close === -1) return text.length;\n return close + marker.length;\n}\n\nfunction skipInlineCode(text: string, index: number): number {\n let ticks = 0;\n while (text[index + ticks] === '`') ticks += 1;\n const close = text.indexOf('`'.repeat(ticks), index + ticks);\n if (close === -1) return text.length;\n return close + ticks;\n}\n\nfunction skipLinkSpace(text: string, start: number): number {\n let i = start;\n while (text[i] === ' ' || text[i] === '\\t') i += 1;\n return i;\n}\n\nfunction skipTitle(text: string, start: number): number | null {\n const open = text[start];\n if (open !== '\"' && open !== \"'\" && open !== '(') return start;\n const close = open === '(' ? ')' : open;\n let i = start + 1;\n while (i < text.length) {\n const ch = text[i]!;\n if (ch === close) return i + 1;\n if (ch === '\\n' || ch === '\\r') return null;\n i += 1;\n }\n return null;\n}\n\nfunction destination(text: string, start: number): { href: string; end: number } | null {\n let i = skipLinkSpace(text, start + 1);\n let href: string;\n if (text[i] === '<') {\n const close = text.indexOf('>', i + 1);\n if (close === -1) return null;\n href = text.slice(i + 1, close);\n i = close + 1;\n } else {\n const from = i;\n let depth = 0;\n while (i < text.length) {\n const ch = text[i]!;\n if (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r') break;\n if (ch === '(') depth += 1;\n else if (ch === ')') {\n if (depth === 0) break;\n depth -= 1;\n }\n i += 1;\n }\n href = text.slice(from, i);\n }\n i = skipLinkSpace(text, i);\n const afterTitle = skipTitle(text, i);\n if (afterTitle === null) return null;\n i = skipLinkSpace(text, afterTitle);\n if (text[i] !== ')') return null;\n return { href, end: i + 1 };\n}\n\nfunction takeLink(text: string, index: number, hrefs: string[], defs: Map<string, string>): number {\n let i = index + 1;\n let depth = 1;\n while (i < text.length && depth > 0) {\n const ch = text[i]!;\n if (ch === '[') depth += 1;\n else if (ch === ']') depth -= 1;\n else if (ch === '\\n' || ch === '\\r') return index + 1;\n i += 1;\n }\n if (depth !== 0) return index + 1;\n const label = text.slice(index + 1, i - 1);\n if (text[i] === '(') {\n const dest = destination(text, i);\n if (dest === null) return index + 1;\n hrefs.push(dest.href);\n return dest.end;\n }\n if (text[i] === '[') {\n const close = text.indexOf(']', i + 1);\n if (close === -1) return index + 1;\n const id = (text.slice(i + 1, close) || label).trim().toLowerCase();\n const href = defs.get(id);\n if (href !== undefined) hrefs.push(href);\n return close + 1;\n }\n return i;\n}\n\nfunction collectDefinitions(text: string): Map<string, string> {\n const defs = new Map<string, string>();\n const pattern = /^ {0,3}\\[([^\\]]+)\\]:[ \\t]+<?([^\\s>]+)>?/gm;\n for (const match of text.matchAll(pattern)) {\n const id = match[1]?.trim().toLowerCase();\n const href = match[2];\n if (id !== undefined && href !== undefined) defs.set(id, href);\n }\n return defs;\n}\n\nexport function extractRelativeHrefs(body: string): string[] {\n const defs = collectDefinitions(body);\n const hrefs: string[] = [];\n let i = 0;\n while (i < body.length) {\n if (atLineStart(body, i) || (i > 0 && (body[i - 1] === '\\n' || body[i - 1] === '\\r'))) {\n let j = i;\n while (body[j] === ' ' && j - i < 3) j += 1;\n if (body.startsWith('```', j) || body.startsWith('~~~', j)) {\n i = skipFence(body, i);\n continue;\n }\n }\n if (body[i] === '`') {\n i = skipInlineCode(body, i);\n continue;\n }\n if (body[i] === '!' && body[i + 1] === '[') {\n i = takeLink(body, i + 1, hrefs, defs);\n continue;\n }\n if (body[i] === '[') {\n i = takeLink(body, i, hrefs, defs);\n continue;\n }\n i += 1;\n }\n return hrefs;\n}\n"],"names":["atLineStart","text","index","prev","skipFence","i","length","marker","startsWith","close","indexOf","skipInlineCode","ticks","repeat","skipLinkSpace","start","skipTitle","open","ch","destination","href","slice","from","depth","afterTitle","end","takeLink","hrefs","defs","label","dest","push","id","trim","toLowerCase","get","undefined","collectDefinitions","Map","pattern","match","matchAll","set","extractRelativeHrefs","body","j"],"mappings":"AAAA,SAASA,YAAYC,IAAY,EAAEC,KAAa;IAC9C,IAAIA,UAAU,GAAG,OAAO;IACxB,MAAMC,OAAOF,IAAI,CAACC,QAAQ,EAAE;IAC5B,OAAOC,SAAS,QAAQA,SAAS;AACnC;AAEA,SAASC,UAAUH,IAAY,EAAEC,KAAa;IAC5C,IAAIG,IAAIH;IACR,MAAOG,IAAIJ,KAAKK,MAAM,IAAKL,CAAAA,IAAI,CAACI,EAAE,KAAK,OAAOJ,IAAI,CAACI,EAAE,KAAK,IAAG,EAAIA,KAAK;IACtE,MAAME,SAASN,KAAKO,UAAU,CAAC,OAAOH,KAAK,QAAQJ,KAAKO,UAAU,CAAC,OAAOH,KAAK,QAAQ;IACvF,IAAIE,WAAW,MAAM,OAAOL,QAAQ;IACpCG,KAAKE,OAAOD,MAAM;IAClB,MAAMG,QAAQR,KAAKS,OAAO,CAACH,QAAQF;IACnC,IAAII,UAAU,CAAC,GAAG,OAAOR,KAAKK,MAAM;IACpC,OAAOG,QAAQF,OAAOD,MAAM;AAC9B;AAEA,SAASK,eAAeV,IAAY,EAAEC,KAAa;IACjD,IAAIU,QAAQ;IACZ,MAAOX,IAAI,CAACC,QAAQU,MAAM,KAAK,IAAKA,SAAS;IAC7C,MAAMH,QAAQR,KAAKS,OAAO,CAAC,IAAIG,MAAM,CAACD,QAAQV,QAAQU;IACtD,IAAIH,UAAU,CAAC,GAAG,OAAOR,KAAKK,MAAM;IACpC,OAAOG,QAAQG;AACjB;AAEA,SAASE,cAAcb,IAAY,EAAEc,KAAa;IAChD,IAAIV,IAAIU;IACR,MAAOd,IA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|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function dirname(path: string): string;
|
|
2
|
+
export declare function join(base: string, relative: string): string;
|
|
3
|
+
export declare function normalize(path: string): string | null;
|
|
4
|
+
export declare function isTypesPath(path: string): boolean;
|
|
5
|
+
export declare function typeNameFromPath(path: string): string;
|
|
6
|
+
export declare function classifyHref(from: string, href: string): {
|
|
7
|
+
kind: 'skip';
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'path';
|
|
10
|
+
path: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'invalid';
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAUzE"}
|
package/dist/paths.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export function dirname(path) {
|
|
2
|
+
const index = path.lastIndexOf('/');
|
|
3
|
+
return index === -1 ? '' : path.slice(0, index);
|
|
4
|
+
}
|
|
5
|
+
export function join(base, relative) {
|
|
6
|
+
if (base === '') return relative;
|
|
7
|
+
return `${base}/${relative}`;
|
|
8
|
+
}
|
|
9
|
+
export function normalize(path) {
|
|
10
|
+
const parts = [];
|
|
11
|
+
for (const part of path.split('/')){
|
|
12
|
+
if (part === '' || part === '.') continue;
|
|
13
|
+
if (part === '..') {
|
|
14
|
+
if (parts.length === 0) return null;
|
|
15
|
+
parts.pop();
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
parts.push(part);
|
|
19
|
+
}
|
|
20
|
+
return parts.join('/');
|
|
21
|
+
}
|
|
22
|
+
export function isTypesPath(path) {
|
|
23
|
+
return path === 'types' || path.startsWith('types/');
|
|
24
|
+
}
|
|
25
|
+
export function typeNameFromPath(path) {
|
|
26
|
+
const base = path.slice(path.lastIndexOf('/') + 1);
|
|
27
|
+
return base.endsWith('.md') ? base.slice(0, -3) : base;
|
|
28
|
+
}
|
|
29
|
+
export function classifyHref(from, href) {
|
|
30
|
+
const trimmed = href.trim();
|
|
31
|
+
if (trimmed === '' || trimmed.startsWith('#')) return {
|
|
32
|
+
kind: 'skip'
|
|
33
|
+
};
|
|
34
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) return {
|
|
35
|
+
kind: 'skip'
|
|
36
|
+
};
|
|
37
|
+
if (trimmed.startsWith('/')) return {
|
|
38
|
+
kind: 'invalid'
|
|
39
|
+
};
|
|
40
|
+
const bare = trimmed.replace(/[?#].*$/, '');
|
|
41
|
+
if (bare === '') return {
|
|
42
|
+
kind: 'skip'
|
|
43
|
+
};
|
|
44
|
+
const resolved = normalize(join(dirname(from), bare));
|
|
45
|
+
if (resolved === null || resolved === '') return {
|
|
46
|
+
kind: 'invalid'
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
kind: 'path',
|
|
50
|
+
path: resolved
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/executor/code/agents.house/mdmodel/packages/mdmodel/src/paths.ts"],"sourcesContent":["export function dirname(path: string): string {\n const index = path.lastIndexOf('/');\n return index === -1 ? '' : path.slice(0, index);\n}\n\nexport function join(base: string, relative: string): string {\n if (base === '') return relative;\n return `${base}/${relative}`;\n}\n\nexport function normalize(path: string): string | null {\n const parts: string[] = [];\n for (const part of path.split('/')) {\n if (part === '' || part === '.') continue;\n if (part === '..') {\n if (parts.length === 0) return null;\n parts.pop();\n continue;\n }\n parts.push(part);\n }\n return parts.join('/');\n}\n\nexport function isTypesPath(path: string): boolean {\n return path === 'types' || path.startsWith('types/');\n}\n\nexport function typeNameFromPath(path: string): string {\n const base = path.slice(path.lastIndexOf('/') + 1);\n return base.endsWith('.md') ? base.slice(0, -3) : base;\n}\n\nexport function classifyHref(\n from: string,\n href: string,\n): { kind: 'skip' } | { kind: 'path'; path: string } | { kind: 'invalid' } {\n const trimmed = href.trim();\n if (trimmed === '' || trimmed.startsWith('#')) return { kind: 'skip' };\n if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) return { kind: 'skip' };\n if (trimmed.startsWith('/')) return { kind: 'invalid' };\n const bare = trimmed.replace(/[?#].*$/, '');\n if (bare === '') return { kind: 'skip' };\n const resolved = normalize(join(dirname(from), bare));\n if (resolved === null || resolved === '') return { kind: 'invalid' };\n return { kind: 'path', path: resolved };\n}\n"],"names":["dirname","path","index","lastIndexOf","slice","join","base","relative","normalize","parts","part","split","length","pop","push","isTypesPath","startsWith","typeNameFromPath","endsWith","classifyHref","from","href","trimmed","trim","kind","test","bare","replace","resolved"],"mappings":"AAAA,OAAO,SAASA,QAAQC,IAAY;IAClC,MAAMC,QAAQD,KAAKE,WAAW,CAAC;IAC/B,OAAOD,UAAU,CAAC,IAAI,KAAKD,KAAKG,KAAK,CAAC,GAAGF;AAC3C;AAEA,OAAO,SAASG,KAAKC,IAAY,EA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ACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;aAClC,IAAI,EAAE,0BAA0B;aAChC,IAAI,EAAE,MAAM;aACZ,GAAG,EAAE,gCAAgC;CAC7B,CAAC"}
|
package/dist/profile.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/executor/code/agents.house/mdmodel/packages/mdmodel/src/profile.ts"],"sourcesContent":["export const MARKDOWN_SYNTAX_PROFILE = {\n name: 'GitHub Flavored Markdown',\n spec: '0.29',\n url: 'https://github.github.com/gfm/',\n} as const;\n"],"names":["MARKDOWN_SYNTAX_PROFILE","name","spec","url"],"mappings":"AAAA,OAAO,MAAMA,0BAA0B;IACrCC,MAAM;IACNC,MAAM;IACNC,KAAK;AACP,EAAW"}
|
package/dist/refuse.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3D,OAAO,CAQT"}
|
package/dist/refuse.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VERSION } from './version.js';
|
|
2
|
+
export function refusal(file, rule, extra) {
|
|
3
|
+
return {
|
|
4
|
+
file,
|
|
5
|
+
rule,
|
|
6
|
+
version: VERSION,
|
|
7
|
+
...extra?.location === undefined ? {} : {
|
|
8
|
+
location: extra.location
|
|
9
|
+
},
|
|
10
|
+
...extra?.referrers === undefined ? {} : {
|
|
11
|
+
referrers: extra.referrers
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=refuse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/executor/code/agents.house/mdmodel/packages/mdmodel/src/refuse.ts"],"sourcesContent":["import type { Refusal } from './types.js';\nimport { VERSION } from './version.js';\n\nexport function refusal(\n file: string,\n rule: string,\n extra?: { location?: string; referrers?: readonly string[] },\n): Refusal {\n return {\n file,\n rule,\n version: VERSION,\n ...(extra?.location === undefined ? {} : { location: extra.location }),\n ...(extra?.referrers === undefined ? {} : { referrers: extra.referrers }),\n };\n}\n"],"names":["VERSION","refusal","file","rule","extra","version","location","undefined","referrers"],"mappings":"AACA,SAASA,OAAO,QAAQ,eAAe;AAEvC,OAAO,SAASC,QACdC,IAAY,EACZC,IAAY,EACZC,KAA4D;IAE5D,OAAO;QACLF;QACAC;QACAE,SAASL;QACT,GAAII,OAAOE,aAAaC,YAAY,CAAC,IAAI;YAAED,UAAUF,MAAME,QAAQ;QAAC,CAAC;QACrE,GAAIF,OAAOI,cAAcD,YAAY,CAAC,IAAI;YAAEC,WAAWJ,MAAMI,SAAS;QAAC,CAAC;IAC1E;AACF"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FieldSpec } from './definition.js';
|
|
2
|
+
export declare function validateFields(fields: Readonly<Record<string, FieldSpec>>, values: Readonly<Record<string, unknown>>): {
|
|
3
|
+
field: string;
|
|
4
|
+
rule: 'required-field' | 'field-enum' | 'field-kind';
|
|
5
|
+
} | undefined;
|
|
6
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAgC7D,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAC3C,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,GAAG,YAAY,CAAA;CAAE,GAAG,SAAS,CAgBrF"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Ajv } from 'ajv';
|
|
2
|
+
import formatsPlugin from 'ajv-formats';
|
|
3
|
+
const addFormats = formatsPlugin;
|
|
4
|
+
const ajv = new Ajv({
|
|
5
|
+
allErrors: true,
|
|
6
|
+
strict: false,
|
|
7
|
+
validateFormats: true
|
|
8
|
+
});
|
|
9
|
+
addFormats(ajv, [
|
|
10
|
+
'date'
|
|
11
|
+
]);
|
|
12
|
+
function scalarSchema(spec) {
|
|
13
|
+
if (spec.kind === 'string' || spec.kind === 'reference') return {
|
|
14
|
+
type: 'string'
|
|
15
|
+
};
|
|
16
|
+
if (spec.kind === 'number') return {
|
|
17
|
+
type: 'number'
|
|
18
|
+
};
|
|
19
|
+
if (spec.kind === 'date') return {
|
|
20
|
+
type: 'string',
|
|
21
|
+
format: 'date'
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: [
|
|
26
|
+
...spec.values
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function fieldSchema(spec) {
|
|
31
|
+
if (spec.kind === 'list') return {
|
|
32
|
+
type: 'array',
|
|
33
|
+
items: scalarSchema(spec.of)
|
|
34
|
+
};
|
|
35
|
+
return scalarSchema(spec);
|
|
36
|
+
}
|
|
37
|
+
function ruleFor(error) {
|
|
38
|
+
if (error.keyword === 'required') return 'required-field';
|
|
39
|
+
if (error.keyword === 'enum') return 'field-enum';
|
|
40
|
+
return 'field-kind';
|
|
41
|
+
}
|
|
42
|
+
function locationFor(error) {
|
|
43
|
+
if (error.keyword === 'required' && typeof error.params.missingProperty === 'string') {
|
|
44
|
+
return error.params.missingProperty;
|
|
45
|
+
}
|
|
46
|
+
const path = error.instancePath.replace(/^\//, '').split('/');
|
|
47
|
+
return path[0] ?? '';
|
|
48
|
+
}
|
|
49
|
+
export function validateFields(fields, values) {
|
|
50
|
+
const properties = {};
|
|
51
|
+
const required = [];
|
|
52
|
+
for (const [name, spec] of Object.entries(fields)){
|
|
53
|
+
properties[name] = fieldSchema(spec);
|
|
54
|
+
if (spec.required) required.push(name);
|
|
55
|
+
}
|
|
56
|
+
const validate = ajv.compile({
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties,
|
|
59
|
+
required,
|
|
60
|
+
additionalProperties: true
|
|
61
|
+
});
|
|
62
|
+
if (validate(values)) return undefined;
|
|
63
|
+
const error = validate.errors[0];
|
|
64
|
+
return {
|
|
65
|
+
field: locationFor(error),
|
|
66
|
+
rule: ruleFor(error)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/executor/code/agents.house/mdmodel/packages/mdmodel/src/schema.ts"],"sourcesContent":["import { Ajv, type ErrorObject } from 'ajv';\nimport formatsPlugin from 'ajv-formats';\nimport type { FieldSpec, ScalarSpec } from './definition.js';\n\nconst addFormats = formatsPlugin as unknown as (validator: Ajv, names?: string[]) => Ajv;\nconst ajv = new Ajv({ allErrors: true, strict: false, validateFormats: true });\naddFormats(ajv, ['date']);\n\nfunction scalarSchema(spec: ScalarSpec): Record<string, unknown> {\n if (spec.kind === 'string' || spec.kind === 'reference') return { type: 'string' };\n if (spec.kind === 'number') return { type: 'number' };\n if (spec.kind === 'date') return { type: 'string', format: 'date' };\n return { type: 'string', enum: [...spec.values] };\n}\n\nfunction fieldSchema(spec: FieldSpec): Record<string, unknown> {\n if (spec.kind === 'list') return { type: 'array', items: scalarSchema(spec.of) };\n return scalarSchema(spec);\n}\n\nfunction ruleFor(error: ErrorObject): 'required-field' | 'field-enum' | 'field-kind' {\n if (error.keyword === 'required') return 'required-field';\n if (error.keyword === 'enum') return 'field-enum';\n return 'field-kind';\n}\n\nfunction locationFor(error: ErrorObject): string {\n if (error.keyword === 'required' && typeof error.params.missingProperty === 'string') {\n return error.params.missingProperty;\n }\n const path = error.instancePath.replace(/^\\//, '').split('/');\n return path[0] ?? '';\n}\n\nexport function validateFields(\n fields: Readonly<Record<string, FieldSpec>>,\n values: Readonly<Record<string, unknown>>,\n): { field: string; rule: 'required-field' | 'field-enum' | 'field-kind' } | undefined {\n const properties: Record<string, Record<string, unknown>> = {};\n const required: string[] = [];\n for (const [name, spec] of Object.entries(fields)) {\n properties[name] = fieldSchema(spec);\n if (spec.required) required.push(name);\n }\n const validate = ajv.compile({\n type: 'object',\n properties,\n required,\n additionalProperties: true,\n });\n if (validate(values)) return undefined;\n const error = validate.errors![0]!;\n return { field: locationFor(error), rule: ruleFor(error) };\n}\n"],"names":["Ajv","formatsPlugin","addFormats","ajv","allErrors","strict","validateFormats","scalarSchema","spec","kind","type","format","enum","values","fieldSchema","items","of","ruleFor","error","keyword","locationFor","params","missingProperty","path","instancePath","replace","split","validateFields","fields","properties","required","name","Object","entries","push","validate","compile","additionalProperties","undefined","errors","field","rule"],"mappings":"AAAA,SAASA,GAAG,QAA0B,MAAM;AAC5C,OAAOC,mBAAmB,cAAc;AAGxC,MAAMC,aAAaD;AACnB,MAAME,MAAM,IAAIH,IAAI;IAAEI,WAAW;IAAMC,QAAQ;IAAOC,iBAAiB;AAAK;AAC5EJ,WAAWC,KAAK;IAAC;CAAO;AAExB,SAASI,aAAaC,IAAgB;IACpC,IAAIA,KAAKC,IAAI,KAAK,YAAYD,KAAKC,IAAI,KAAK,aAAa,OAAO;QAAEC,MAAM;IAAS;IACjF,IAAIF,KAAKC,IAAI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OAAOpB,YAAYF;QAAQuB,MAAMxB,QAAQC;IAAO;AAC3D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SectionSpan = {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly headingStart: number;
|
|
4
|
+
readonly bodyStart: number;
|
|
5
|
+
readonly bodyEnd: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function headingSpans(content: string, bodyStart: number): SectionSpan[];
|
|
8
|
+
export declare function sectionsRecord(spans: readonly SectionSpan[], content: string): Record<string, string>;
|
|
9
|
+
export declare function parseListSection(body: string): boolean;
|
|
10
|
+
//# sourceMappingURL=sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../src/sections.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAqBF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,CAwB9E;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAiBtD"}
|
package/dist/sections.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const H2 = /^##(?!#)[ \t]+(.+?)[ \t]*#*[ \t]*$/;
|
|
2
|
+
const ITEM = /^([ \t]*)([-*+]|\d+[.)])[ \t]+/;
|
|
3
|
+
function lineRange(content, from) {
|
|
4
|
+
const nl = content.indexOf('\n', from);
|
|
5
|
+
const end = nl === -1 ? content.length : nl;
|
|
6
|
+
let line = content.slice(from, end);
|
|
7
|
+
if (line.endsWith('\r')) line = line.slice(0, -1);
|
|
8
|
+
return {
|
|
9
|
+
line,
|
|
10
|
+
start: from,
|
|
11
|
+
next: nl === -1 ? content.length : nl + 1
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function fenceMarker(line) {
|
|
15
|
+
let i = 0;
|
|
16
|
+
while(i < 3 && (line[i] === ' ' || line[i] === '\t'))i += 1;
|
|
17
|
+
if (line.startsWith('```', i)) return '```';
|
|
18
|
+
if (line.startsWith('~~~', i)) return '~~~';
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
export function headingSpans(content, bodyStart) {
|
|
22
|
+
const found = [];
|
|
23
|
+
let i = bodyStart;
|
|
24
|
+
let fence = null;
|
|
25
|
+
while(i < content.length){
|
|
26
|
+
const { line, start, next } = lineRange(content, i);
|
|
27
|
+
const marker = fenceMarker(line);
|
|
28
|
+
if (fence !== null) {
|
|
29
|
+
if (marker === fence) fence = null;
|
|
30
|
+
} else if (marker !== null) {
|
|
31
|
+
fence = marker;
|
|
32
|
+
} else {
|
|
33
|
+
const match = H2.exec(line);
|
|
34
|
+
if (match !== null && match[1] !== undefined) {
|
|
35
|
+
const name = match[1].trim();
|
|
36
|
+
if (found.length > 0) found[found.length - 1] = {
|
|
37
|
+
...found[found.length - 1],
|
|
38
|
+
bodyEnd: start
|
|
39
|
+
};
|
|
40
|
+
found.push({
|
|
41
|
+
name,
|
|
42
|
+
headingStart: start,
|
|
43
|
+
bodyStart: next,
|
|
44
|
+
bodyEnd: content.length
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (next === i) break;
|
|
49
|
+
i = next;
|
|
50
|
+
}
|
|
51
|
+
return found;
|
|
52
|
+
}
|
|
53
|
+
export function sectionsRecord(spans, content) {
|
|
54
|
+
const record = {};
|
|
55
|
+
for (const span of spans){
|
|
56
|
+
if (record[span.name] === undefined) record[span.name] = content.slice(span.bodyStart, span.bodyEnd);
|
|
57
|
+
}
|
|
58
|
+
return record;
|
|
59
|
+
}
|
|
60
|
+
export function parseListSection(body) {
|
|
61
|
+
const lines = body.split(/\r?\n/);
|
|
62
|
+
while(lines.length > 0 && lines[0].trim() === '')lines.shift();
|
|
63
|
+
while(lines.length > 0 && lines[lines.length - 1].trim() === '')lines.pop();
|
|
64
|
+
if (lines.length === 0) return true;
|
|
65
|
+
const first = ITEM.exec(lines[0]);
|
|
66
|
+
if (first === null || first[1] === undefined) return false;
|
|
67
|
+
const indent = first[1].length;
|
|
68
|
+
for (const line of lines){
|
|
69
|
+
if (line.trim() === '') continue;
|
|
70
|
+
const match = ITEM.exec(line);
|
|
71
|
+
if (match !== null && match[1]?.length === indent) continue;
|
|
72
|
+
const leading = /^\s*/.exec(line)?.[0].length ?? 0;
|
|
73
|
+
if (leading > indent) continue;
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/executor/code/agents.house/mdmodel/packages/mdmodel/src/sections.ts"],"sourcesContent":["export type SectionSpan = {\n readonly name: string;\n readonly headingStart: number;\n readonly bodyStart: number;\n readonly bodyEnd: number;\n};\n\nconst H2 = /^##(?!#)[ \\t]+(.+?)[ \\t]*#*[ \\t]*$/;\nconst ITEM = /^([ \\t]*)([-*+]|\\d+[.)])[ \\t]+/;\n\nfunction lineRange(content: string, from: number): { line: string; next: number; start: number } {\n const nl = content.indexOf('\\n', from);\n const end = nl === -1 ? content.length : nl;\n let line = content.slice(from, end);\n if (line.endsWith('\\r')) line = line.slice(0, -1);\n return { line, start: from, next: nl === -1 ? content.length : nl + 1 };\n}\n\nfunction fenceMarker(line: string): '```' | '~~~' | null {\n let i = 0;\n while (i < 3 && (line[i] === ' ' || line[i] === '\\t')) i += 1;\n if (line.startsWith('```', i)) return '```';\n if (line.startsWith('~~~', i)) return '~~~';\n return null;\n}\n\nexport function headingSpans(content: string, bodyStart: number): SectionSpan[] {\n const found: SectionSpan[] = [];\n let i = bodyStart;\n let fence: '```' | '~~~' | null = null;\n while (i < content.length) {\n const { line, start, next } = lineRange(content, i);\n const marker = fenceMarker(line);\n if (fence !== null) {\n if (marker === fence) fence = null;\n } else if (marker !== null) {\n fence = marker;\n } else {\n const match = H2.exec(line);\n if (match !== null && match[1] !== undefined) {\n const name = match[1].trim();\n if (found.length > 0)\n found[found.length - 1] = { ...found[found.length - 1]!, bodyEnd: start };\n found.push({ name, headingStart: start, bodyStart: next, bodyEnd: content.length });\n }\n }\n if (next === i) break;\n i = next;\n }\n return found;\n}\n\nexport function sectionsRecord(\n spans: readonly SectionSpan[],\n content: string,\n): Record<string, string> {\n const record: Record<string, string> = {};\n for (const span of spans) {\n if (record[span.name] === undefined)\n record[span.name] = content.slice(span.bodyStart, span.bodyEnd);\n }\n return record;\n}\n\nexport function parseListSection(body: string): boolean {\n const lines = body.split(/\\r?\\n/);\n while (lines.length > 0 && lines[0]!.trim() === '') lines.shift();\n while (lines.length > 0 && lines[lines.length - 1]!.trim() === '') lines.pop();\n if (lines.length === 0) return true;\n const first = ITEM.exec(lines[0]!);\n if (first === null || first[1] === undefined) return false;\n const indent = first[1].length;\n for (const line of lines) {\n if (line.trim() === '') continue;\n const match = ITEM.exec(line);\n if (match !== null && match[1]?.length === indent) continue;\n const leading = /^\\s*/.exec(line)?.[0].length ?? 0;\n if (leading > indent) continue;\n return false;\n }\n return true;\n}\n"],"names":["H2","ITEM","lineRange","content","from","nl","indexOf","end","length","line","slice","endsWith","start","next","fenceMarker","i","startsWith","headingSpans","bodyStart","found","fence","marker","match","exec","undefined","name","trim","bodyEnd","push","headingStart","sectionsRecord","spans","record","span","parseListSection","body","lines","split","shift","pop","first","indent","leading"],"mappings":"AAOA,MAAMA,KAAK;AACX,MAAMC,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AAU,QAAQA,KAAK,CAAC,EAAE,EAAEd,WAAWiC,QAAQ;QACnD,MAAMC,UAAU,OAAOnB,IAAI,CAACd,OAAO,CAAC,EAAE,CAACD,UAAU;QACjD,IAAIkC,UAAUD,QAAQ;QACtB,OAAO;IACT;IACA,OAAO;AACT"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type Library = Readonly<Record<string, string>>;
|
|
2
|
+
export type Document = {
|
|
3
|
+
readonly content: string;
|
|
4
|
+
readonly type: string | undefined;
|
|
5
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
6
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
7
|
+
};
|
|
8
|
+
export type Refusal = {
|
|
9
|
+
readonly file: string;
|
|
10
|
+
readonly rule: string;
|
|
11
|
+
readonly version: string;
|
|
12
|
+
readonly location?: string;
|
|
13
|
+
readonly referrers?: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
export type Validation = {
|
|
16
|
+
readonly verdict: 'accept';
|
|
17
|
+
} | ({
|
|
18
|
+
readonly verdict: 'refuse';
|
|
19
|
+
} & Refusal);
|
|
20
|
+
export type ParseResult = {
|
|
21
|
+
readonly ok: true;
|
|
22
|
+
readonly document: Document;
|
|
23
|
+
} | {
|
|
24
|
+
readonly ok: false;
|
|
25
|
+
readonly refusal: Refusal;
|
|
26
|
+
};
|
|
27
|
+
export type Change = {
|
|
28
|
+
readonly kind: 'field';
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly value: unknown;
|
|
31
|
+
readonly prior: unknown;
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'section';
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly value: string;
|
|
36
|
+
readonly prior: string;
|
|
37
|
+
};
|
|
38
|
+
export type ApplyResult = {
|
|
39
|
+
readonly outcome: 'applied';
|
|
40
|
+
readonly document: Document;
|
|
41
|
+
} | {
|
|
42
|
+
readonly outcome: 'stale';
|
|
43
|
+
readonly document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;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtD,MAAM,MAAM,MAAM,GACd;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEN,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAC5D;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/executor/code/agents.house/mdmodel/packages/mdmodel/src/types.ts"],"sourcesContent":["export type Library = Readonly<Record<string, string>>;\n\nexport type Document = {\n readonly content: string;\n readonly type: string | undefined;\n readonly fields: Readonly<Record<string, unknown>>;\n readonly sections: Readonly<Record<string, string>>;\n};\n\nexport type Refusal = {\n readonly file: string;\n readonly rule: string;\n readonly version: string;\n readonly location?: string;\n readonly referrers?: readonly string[];\n};\n\nexport type Validation =\n | { readonly verdict: 'accept' }\n | ({ readonly verdict: 'refuse' } & Refusal);\n\nexport type ParseResult =\n | { readonly ok: true; readonly document: Document }\n | { readonly ok: false; readonly refusal: Refusal };\n\nexport type Change =\n | {\n readonly kind: 'field';\n readonly name: string;\n readonly value: unknown;\n readonly prior: unknown;\n }\n | {\n readonly kind: 'section';\n readonly name: string;\n readonly value: string;\n readonly prior: string;\n };\n\nexport type ApplyResult =\n | { readonly outcome: 'applied'; readonly document: Document }\n | { readonly outcome: 'stale'; readonly document: Document }\n | { readonly outcome: 'refuse'; readonly refusal: Refusal };\n"],"names":[],"mappings":"AAuCA,WAG8D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAY,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAuChE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CA6GrD"}
|