@mmmnt/feat-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/parse.d.ts +10 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +667 -0
- package/dist/parse.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Moment
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/parse.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CapturedResponse {
|
|
2
|
+
status: "OK" | "ERR";
|
|
3
|
+
body: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
export interface ParseInput {
|
|
6
|
+
spec: string;
|
|
7
|
+
config: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function parse(input: ParseInput): Promise<CapturedResponse>;
|
|
10
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AACD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AA2mBD,wBAAsB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA0BxE"}
|
package/dist/parse.js
ADDED
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
// SPEC-CORE-001 "Parse a .feat file to BuiltSpec IR" — @mmmnt/feat-core.
|
|
2
|
+
// Hand-rolled deterministic recursive-descent parser (amendment 2026-07-16; Langium → M6 LSP).
|
|
3
|
+
// The corpus at corpus/ is ground truth: every exemplar parses to its .ir.json exactly.
|
|
4
|
+
// The response body is the IR WITHOUT loc (ADR-0013 companion ruling).
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
class ParseFailure extends Error {
|
|
8
|
+
code;
|
|
9
|
+
line;
|
|
10
|
+
hint;
|
|
11
|
+
constructor(code, message, line, hint) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.line = line;
|
|
15
|
+
this.hint = hint;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function scan(source) {
|
|
19
|
+
const raw = source.split(/\r?\n/);
|
|
20
|
+
const stmts = [];
|
|
21
|
+
let buf = "";
|
|
22
|
+
let bufIndent = 0;
|
|
23
|
+
let bufLine = 0;
|
|
24
|
+
let depth = 0;
|
|
25
|
+
const scanDepth = (s) => {
|
|
26
|
+
let d = 0;
|
|
27
|
+
let inStr = false;
|
|
28
|
+
for (let i = 0; i < s.length; i++) {
|
|
29
|
+
const c = s[i];
|
|
30
|
+
if (inStr) {
|
|
31
|
+
if (c === "\\")
|
|
32
|
+
i++;
|
|
33
|
+
else if (c === '"')
|
|
34
|
+
inStr = false;
|
|
35
|
+
}
|
|
36
|
+
else if (c === '"')
|
|
37
|
+
inStr = true;
|
|
38
|
+
else if (c === "{" || c === "[")
|
|
39
|
+
d++;
|
|
40
|
+
else if (c === "}" || c === "]")
|
|
41
|
+
d--;
|
|
42
|
+
}
|
|
43
|
+
return d;
|
|
44
|
+
};
|
|
45
|
+
for (let i = 0; i < raw.length; i++) {
|
|
46
|
+
const line = raw[i];
|
|
47
|
+
const trimmed = line.trim();
|
|
48
|
+
if (depth === 0) {
|
|
49
|
+
if (trimmed === "" || trimmed.startsWith("#"))
|
|
50
|
+
continue;
|
|
51
|
+
buf = trimmed;
|
|
52
|
+
bufIndent = line.length - line.trimStart().length;
|
|
53
|
+
bufLine = i + 1;
|
|
54
|
+
depth = scanDepth(trimmed);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
buf += "\n" + trimmed;
|
|
58
|
+
depth += scanDepth(trimmed);
|
|
59
|
+
}
|
|
60
|
+
if (depth <= 0) {
|
|
61
|
+
stmts.push({ text: buf, indent: bufIndent, line: bufLine });
|
|
62
|
+
buf = "";
|
|
63
|
+
depth = 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (buf !== "")
|
|
67
|
+
stmts.push({ text: buf, indent: bufIndent, line: bufLine });
|
|
68
|
+
return stmts;
|
|
69
|
+
}
|
|
70
|
+
// ── Inline literal values (payloads, seed values, example cells) ─────────────
|
|
71
|
+
// Lenient object syntax: unquoted keys, JSON values, <placeholder> tokens.
|
|
72
|
+
class ValueCursor {
|
|
73
|
+
src;
|
|
74
|
+
pos = 0;
|
|
75
|
+
constructor(src) {
|
|
76
|
+
this.src = src;
|
|
77
|
+
}
|
|
78
|
+
peek() {
|
|
79
|
+
return this.src[this.pos] ?? "";
|
|
80
|
+
}
|
|
81
|
+
skipWs() {
|
|
82
|
+
while (/[\s,]/.test(this.peek()))
|
|
83
|
+
this.pos++;
|
|
84
|
+
}
|
|
85
|
+
fail(what) {
|
|
86
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Malformed ${what} near '${this.src.slice(this.pos, this.pos + 24)}'`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function parseLiteralValue(c) {
|
|
90
|
+
c.skipWs();
|
|
91
|
+
const ch = c.peek();
|
|
92
|
+
if (ch === "{")
|
|
93
|
+
return parseLiteralObject(c);
|
|
94
|
+
if (ch === "[") {
|
|
95
|
+
c.pos++;
|
|
96
|
+
const arr = [];
|
|
97
|
+
c.skipWs();
|
|
98
|
+
while (c.peek() !== "]") {
|
|
99
|
+
arr.push(parseLiteralValue(c));
|
|
100
|
+
c.skipWs();
|
|
101
|
+
}
|
|
102
|
+
c.pos++;
|
|
103
|
+
return arr;
|
|
104
|
+
}
|
|
105
|
+
if (ch === '"')
|
|
106
|
+
return parseString(c);
|
|
107
|
+
if (ch === "<") {
|
|
108
|
+
const m = /^<([A-Za-z_][A-Za-z0-9_-]*)>/.exec(c.src.slice(c.pos));
|
|
109
|
+
if (!m)
|
|
110
|
+
c.fail("placeholder");
|
|
111
|
+
c.pos += m[0].length;
|
|
112
|
+
return { $placeholder: m[1] };
|
|
113
|
+
}
|
|
114
|
+
const m = /^(-?\d+(?:\.\d+)?|true|false|null)/.exec(c.src.slice(c.pos));
|
|
115
|
+
if (!m)
|
|
116
|
+
c.fail("value");
|
|
117
|
+
c.pos += m[0].length;
|
|
118
|
+
if (m[0] === "true")
|
|
119
|
+
return true;
|
|
120
|
+
if (m[0] === "false")
|
|
121
|
+
return false;
|
|
122
|
+
if (m[0] === "null")
|
|
123
|
+
return null;
|
|
124
|
+
return Number(m[0]);
|
|
125
|
+
}
|
|
126
|
+
function parseString(c) {
|
|
127
|
+
if (c.peek() !== '"')
|
|
128
|
+
c.fail("string");
|
|
129
|
+
c.pos++;
|
|
130
|
+
let out = "";
|
|
131
|
+
while (c.peek() !== '"') {
|
|
132
|
+
if (c.peek() === "")
|
|
133
|
+
c.fail("string (unterminated)");
|
|
134
|
+
if (c.peek() === "\\") {
|
|
135
|
+
c.pos++;
|
|
136
|
+
out += JSON.parse(`"\\${c.peek()}"`);
|
|
137
|
+
}
|
|
138
|
+
else
|
|
139
|
+
out += c.peek();
|
|
140
|
+
c.pos++;
|
|
141
|
+
}
|
|
142
|
+
c.pos++;
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
function parseKey(c) {
|
|
146
|
+
c.skipWs();
|
|
147
|
+
const m = /^[A-Za-z_$][A-Za-z0-9_$-]*/.exec(c.src.slice(c.pos));
|
|
148
|
+
if (!m)
|
|
149
|
+
c.fail("key");
|
|
150
|
+
c.pos += m[0].length;
|
|
151
|
+
c.skipWs();
|
|
152
|
+
if (c.peek() !== ":")
|
|
153
|
+
c.fail("key (expected ':')");
|
|
154
|
+
c.pos++;
|
|
155
|
+
return m[0];
|
|
156
|
+
}
|
|
157
|
+
function parseLiteralObject(c) {
|
|
158
|
+
c.skipWs();
|
|
159
|
+
if (c.peek() !== "{")
|
|
160
|
+
c.fail("object");
|
|
161
|
+
c.pos++;
|
|
162
|
+
const out = {};
|
|
163
|
+
c.skipWs();
|
|
164
|
+
while (c.peek() !== "}") {
|
|
165
|
+
if (c.peek() === "")
|
|
166
|
+
c.fail("object (unterminated)");
|
|
167
|
+
const key = parseKey(c);
|
|
168
|
+
out[key] = parseLiteralValue(c);
|
|
169
|
+
c.skipWs();
|
|
170
|
+
}
|
|
171
|
+
c.pos++;
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
function parseInlinePayload(src) {
|
|
175
|
+
const c = new ValueCursor(src.trim());
|
|
176
|
+
const obj = parseLiteralObject(c);
|
|
177
|
+
c.skipWs();
|
|
178
|
+
if (c.pos < c.src.length)
|
|
179
|
+
c.fail("payload (trailing content)");
|
|
180
|
+
return obj;
|
|
181
|
+
}
|
|
182
|
+
function parseMatcher(c) {
|
|
183
|
+
c.skipWs();
|
|
184
|
+
const rest = () => c.src.slice(c.pos);
|
|
185
|
+
if (c.peek() === "{")
|
|
186
|
+
return { matcher: "nested", fields: parseValueBlock(c) };
|
|
187
|
+
let m;
|
|
188
|
+
if ((m = /^@when\.([A-Za-z0-9_.\-]+)/.exec(rest()))) {
|
|
189
|
+
c.pos += m[0].length;
|
|
190
|
+
return { matcher: "whenRef", path: m[1] };
|
|
191
|
+
}
|
|
192
|
+
if ((m = /^@deliver(?:\[(\d+)\])?\.([A-Za-z0-9_.\-]+)/.exec(rest()))) {
|
|
193
|
+
c.pos += m[0].length;
|
|
194
|
+
const out = { matcher: "deliverRef", path: m[2] };
|
|
195
|
+
if (m[1] !== undefined)
|
|
196
|
+
out.index = Number(m[1]);
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
if ((m = /^any\b(?:[ \t]+(uuid|timestamp|string|number|boolean))?/.exec(rest()))) {
|
|
200
|
+
c.pos += m[0].length;
|
|
201
|
+
const out = { matcher: "any" };
|
|
202
|
+
if (m[1])
|
|
203
|
+
out.ofType = m[1];
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
if ((m = /^matching[ \t]+/.exec(rest()))) {
|
|
207
|
+
c.pos += m[0].length;
|
|
208
|
+
if (c.peek() === "<") {
|
|
209
|
+
const p = parseLiteralValue(c);
|
|
210
|
+
return { matcher: "regex", pattern: { $placeholder: p.$placeholder } };
|
|
211
|
+
}
|
|
212
|
+
return { matcher: "regex", pattern: parseString(c) };
|
|
213
|
+
}
|
|
214
|
+
if (/^absent\b/.test(rest())) {
|
|
215
|
+
c.pos += 6;
|
|
216
|
+
return { matcher: "absent" };
|
|
217
|
+
}
|
|
218
|
+
if (c.peek() === "<") {
|
|
219
|
+
const p = parseLiteralValue(c);
|
|
220
|
+
return { matcher: "placeholder", name: p.$placeholder };
|
|
221
|
+
}
|
|
222
|
+
const value = parseLiteralValue(c);
|
|
223
|
+
return { matcher: "literal", value };
|
|
224
|
+
}
|
|
225
|
+
function parseValueBlock(c) {
|
|
226
|
+
c.skipWs();
|
|
227
|
+
if (c.peek() !== "{")
|
|
228
|
+
c.fail("value block");
|
|
229
|
+
c.pos++;
|
|
230
|
+
const out = {};
|
|
231
|
+
c.skipWs();
|
|
232
|
+
while (c.peek() !== "}") {
|
|
233
|
+
if (c.peek() === "")
|
|
234
|
+
c.fail("value block (unterminated)");
|
|
235
|
+
const key = parseKey(c);
|
|
236
|
+
const matcher = parseMatcher(c);
|
|
237
|
+
// nested blocks come back as {matcher: nested, fields}; keep nested form
|
|
238
|
+
out[key] = matcher;
|
|
239
|
+
c.skipWs();
|
|
240
|
+
}
|
|
241
|
+
c.pos++;
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
function parseRecordList(src, mode) {
|
|
245
|
+
const c = new ValueCursor(src.trim());
|
|
246
|
+
c.skipWs();
|
|
247
|
+
if (c.peek() !== "[")
|
|
248
|
+
c.fail("record list");
|
|
249
|
+
c.pos++;
|
|
250
|
+
const out = [];
|
|
251
|
+
c.skipWs();
|
|
252
|
+
while (c.peek() !== "]") {
|
|
253
|
+
if (c.peek() === "")
|
|
254
|
+
c.fail("record list (unterminated)");
|
|
255
|
+
const head = /^([A-Za-z_][A-Za-z0-9_]*)[ \t\n]+with[ \t\n]+([A-Za-z_][A-Za-z0-9_]*)/.exec(c.src.slice(c.pos));
|
|
256
|
+
if (head === null)
|
|
257
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Malformed record near '${c.src.slice(c.pos, c.pos + 24)}' (expected '<Type> with <Schema>').`);
|
|
258
|
+
c.pos += head[0].length;
|
|
259
|
+
c.skipWs();
|
|
260
|
+
if (mode === "seed") {
|
|
261
|
+
const values = parseLiteralObject(c);
|
|
262
|
+
out.push({ type: head[1], schemaName: head[2], values });
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const rec = { type: head[1], schemaName: head[2] };
|
|
266
|
+
const g = /^equals[ \t]+fixture[ \t]+/.exec(c.src.slice(c.pos));
|
|
267
|
+
if (g) {
|
|
268
|
+
c.pos += g[0].length;
|
|
269
|
+
rec.golden = parseString(c);
|
|
270
|
+
}
|
|
271
|
+
else if (c.peek() === "{") {
|
|
272
|
+
rec.valueBlock = parseValueBlock(c);
|
|
273
|
+
}
|
|
274
|
+
out.push(rec);
|
|
275
|
+
}
|
|
276
|
+
c.skipWs();
|
|
277
|
+
}
|
|
278
|
+
c.pos++;
|
|
279
|
+
return out;
|
|
280
|
+
}
|
|
281
|
+
// ── The parser ────────────────────────────────────────────────────────────────
|
|
282
|
+
const SPEC_TYPES = ["command", "query", "policy", "projection", "saga", "infrastructure", "integration", "scaffold"];
|
|
283
|
+
const STATUSES = ["draft", "agreed", "built", "verified"];
|
|
284
|
+
const CONTRACT_KINDS = ["input", "response", "event", "record", "error"];
|
|
285
|
+
const DELIVER_TYPES = new Set(["projection", "policy", "saga"]);
|
|
286
|
+
function parseFeat(source, ctx) {
|
|
287
|
+
const stmts = scan(source);
|
|
288
|
+
// 1. Version pragma (ADR-0005)
|
|
289
|
+
const first = stmts[0];
|
|
290
|
+
const pragma = first ? /^feat[ \t]+(\d+)\.(\d+)$/.exec(first.text) : null;
|
|
291
|
+
if (!first || !pragma)
|
|
292
|
+
throw new ParseFailure("MISSING_PRAGMA", "The first non-comment line must be a version pragma, e.g. 'feat 1.0'.", first?.line ?? 1, "Add 'feat 1.0' as the first line.");
|
|
293
|
+
if (pragma[1] !== "1")
|
|
294
|
+
throw new ParseFailure("UNSUPPORTED_VERSION", `This toolchain supports feat 1.x; the file declares feat ${pragma[1]}.${pragma[2]}.`, first.line);
|
|
295
|
+
const ir = { featVersion: `${pragma[1]}.${pragma[2]}` };
|
|
296
|
+
const identity = {};
|
|
297
|
+
const construct = [];
|
|
298
|
+
const enforce = [];
|
|
299
|
+
const contract = [];
|
|
300
|
+
const declaredSchemas = new Set();
|
|
301
|
+
const scenarios = [];
|
|
302
|
+
let section = "none";
|
|
303
|
+
let scenario = null;
|
|
304
|
+
let scenarioPhase = "none";
|
|
305
|
+
let exampleHeaders = null;
|
|
306
|
+
const finishScenario = () => {
|
|
307
|
+
if (scenario)
|
|
308
|
+
scenarios.push(scenario);
|
|
309
|
+
scenario = null;
|
|
310
|
+
scenarioPhase = "none";
|
|
311
|
+
exampleHeaders = null;
|
|
312
|
+
};
|
|
313
|
+
for (let i = 1; i < stmts.length; i++) {
|
|
314
|
+
const s = stmts[i];
|
|
315
|
+
const t = s.text;
|
|
316
|
+
let m;
|
|
317
|
+
// ── Header ──
|
|
318
|
+
if ((m = /^spec[ \t]+(\S+)[ \t]+"((?:[^"\\]|\\.)*)"$/.exec(t))) {
|
|
319
|
+
identity.id = m[1];
|
|
320
|
+
identity.name = m[2];
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if ((m = /^context[ \t]+(\S+)$/.exec(t))) {
|
|
324
|
+
identity.context = m[1];
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if ((m = /^aggregate[ \t]+(\S+)$/.exec(t))) {
|
|
328
|
+
identity.aggregate = m[1];
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
if ((m = /^type[ \t]+(\S+)$/.exec(t))) {
|
|
332
|
+
if (!SPEC_TYPES.includes(m[1]))
|
|
333
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unknown spec type '${m[1]}'.`, s.line, `Valid types: ${SPEC_TYPES.join(", ")}`);
|
|
334
|
+
identity.type = m[1];
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
if ((m = /^status[ \t]+(\S+)$/.exec(t))) {
|
|
338
|
+
if (!STATUSES.includes(m[1]))
|
|
339
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unknown status '${m[1]}'.`, s.line, `Valid statuses: ${STATUSES.join(", ")}`);
|
|
340
|
+
identity.status = m[1];
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
// ── Section openers ──
|
|
344
|
+
if (t === "construct:") {
|
|
345
|
+
finishScenario();
|
|
346
|
+
section = "construct";
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
if (t === "enforce:") {
|
|
350
|
+
finishScenario();
|
|
351
|
+
section = "enforce";
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
if (t === "contract:") {
|
|
355
|
+
finishScenario();
|
|
356
|
+
section = "contract";
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if ((m = /^scenario([ \t]+outline)?[ \t]+"((?:[^"\\]|\\.)*)":$/.exec(t))) {
|
|
360
|
+
finishScenario();
|
|
361
|
+
section = "scenario";
|
|
362
|
+
scenario = { name: m[2] };
|
|
363
|
+
scenarioPhase = "none";
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
// ── Section bodies ──
|
|
367
|
+
if (section === "construct") {
|
|
368
|
+
if ((m = /^handler[ \t]+at[ \t]+(\S+)$/.exec(t)))
|
|
369
|
+
construct.push({ kind: "handler", path: m[1] });
|
|
370
|
+
else if ((m = /^imports[ \t]+(\S+)[ \t]+from[ \t]+(\S+)$/.exec(t)))
|
|
371
|
+
construct.push({ kind: "import", symbol: m[1], path: m[2] });
|
|
372
|
+
else if ((m = /^register[ \t]+(\S+)[ \t]+(\S+)[ \t]+in[ \t]+(\S+)$/.exec(t)))
|
|
373
|
+
construct.push({ kind: "register", registrationKind: m[1], name: m[2], path: m[3] });
|
|
374
|
+
else if ((m = /^emit[ \t]+to[ \t]+(\S+)$/.exec(t)))
|
|
375
|
+
construct.push({ kind: "emitsTo", streamPattern: m[1] });
|
|
376
|
+
else if ((m = /^touches[ \t]+(\S+)$/.exec(t)))
|
|
377
|
+
construct.push({ kind: "touches", glob: m[1] });
|
|
378
|
+
else if ((m = /^needs[ \t]+(\S+)$/.exec(t)))
|
|
379
|
+
construct.push({ kind: "needs", specId: m[1] });
|
|
380
|
+
else
|
|
381
|
+
construct.push({ kind: "custom", text: t.replace(/\n/g, " ") });
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (section === "enforce") {
|
|
385
|
+
if ((m = /^rejects[ \t]+([A-Z0-9_]+)[ \t]+when[ \t]+(.+)$/s.exec(t)))
|
|
386
|
+
enforce.push({ kind: "rejects", rejectionId: m[1], text: m[2].replace(/\n/g, " ") });
|
|
387
|
+
else if (/^validate[ \t]/.test(t))
|
|
388
|
+
enforce.push({ kind: "validate", text: t });
|
|
389
|
+
else if (/^load[ \t]/.test(t))
|
|
390
|
+
enforce.push({ kind: "load", text: t });
|
|
391
|
+
else if (/^apply[ \t]/.test(t))
|
|
392
|
+
enforce.push({ kind: "apply", text: t });
|
|
393
|
+
else if (/^on[ \t]+success[ \t]/.test(t))
|
|
394
|
+
enforce.push({ kind: "onSuccess", text: t });
|
|
395
|
+
else if (/^on[ \t]+rejection[ \t]/.test(t))
|
|
396
|
+
enforce.push({ kind: "onRejection", text: t });
|
|
397
|
+
else
|
|
398
|
+
enforce.push({ kind: "constraint", text: t.replace(/\n/g, " ") });
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
if (section === "contract") {
|
|
402
|
+
if ((m = /^(input|response|event|record|error)[ \t]+([A-Za-z_][A-Za-z0-9_]*)(?:[ \t]+from[ \t]+"((?:[^"\\]|\\.)*)")?$/.exec(t))) {
|
|
403
|
+
const entry = { kind: m[1], schemaName: m[2] };
|
|
404
|
+
if (m[3] !== undefined)
|
|
405
|
+
entry.from = m[3];
|
|
406
|
+
contract.push(entry);
|
|
407
|
+
declaredSchemas.add(m[2]);
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
if ((m = /^stream[ \t]+"((?:[^"\\]|\\.)*)"$/.exec(t))) {
|
|
411
|
+
contract.push({ kind: "stream", pattern: m[1] });
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unrecognized contract line: '${t}'.`, s.line, `Contract roles: ${CONTRACT_KINDS.join(", ")}, stream`);
|
|
415
|
+
}
|
|
416
|
+
if (section === "scenario" && scenario) {
|
|
417
|
+
// given:
|
|
418
|
+
if (t === "given:") {
|
|
419
|
+
scenarioPhase = "given";
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
// when [(as actor)]:
|
|
423
|
+
if ((m = /^when(?:[ \t]*\(as[ \t]+([A-Za-z0-9_-]+)\))?:[ \t]+([A-Za-z_][A-Za-z0-9_]*)[ \t]+(\{[\s\S]*\})$/.exec(t))) {
|
|
424
|
+
const when = { command: m[2] };
|
|
425
|
+
if (m[1])
|
|
426
|
+
when.actor = m[1];
|
|
427
|
+
when.payload = parseInlinePayload(m[3]);
|
|
428
|
+
scenario.when = when;
|
|
429
|
+
scenarioPhase = "none";
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
// deliver <Event> { } to <service>
|
|
433
|
+
if ((m = /^deliver[ \t]+([A-Za-z_][A-Za-z0-9_]*)[ \t]+(\{[\s\S]*\})[ \t]+to[ \t]+([A-Za-z_][A-Za-z0-9_]*)$/.exec(t))) {
|
|
434
|
+
const delivers = scenario.delivers ?? [];
|
|
435
|
+
delivers.push({ event: m[1], payload: parseInlinePayload(m[2]), service: m[3] });
|
|
436
|
+
scenario.delivers = delivers;
|
|
437
|
+
scenarioPhase = "none";
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
// predict …:
|
|
441
|
+
if ((m = /^predict[ \t]+(success|rejection|error)(?:[ \t]+([A-Z0-9_]+|<[A-Za-z_][A-Za-z0-9_-]*>))?:$/.exec(t))) {
|
|
442
|
+
const prediction = { type: m[1] };
|
|
443
|
+
if (m[1] === "rejection" && m[2])
|
|
444
|
+
prediction.rejectionId = m[2];
|
|
445
|
+
if (m[1] === "error" && m[2])
|
|
446
|
+
prediction.errorCode = m[2];
|
|
447
|
+
scenario.prediction = prediction;
|
|
448
|
+
scenarioPhase = "predict";
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
if (/^predict[ \t]/.test(t))
|
|
452
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unknown prediction form: '${t}'.`, s.line, "Use 'predict success:', 'predict rejection <ID>:', or 'predict error <CODE>:'");
|
|
453
|
+
// examples:
|
|
454
|
+
if (t === "examples:") {
|
|
455
|
+
scenarioPhase = "examples";
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
if (scenarioPhase === "given") {
|
|
459
|
+
const given = scenario.given ?? {};
|
|
460
|
+
if ((m = /^clock[ \t]+at[ \t]+"((?:[^"\\]|\\.)*)"$/.exec(t))) {
|
|
461
|
+
given.clock = m[1];
|
|
462
|
+
}
|
|
463
|
+
else if ((m = /^execute(?:[ \t]*\(as[ \t]+([A-Za-z0-9_-]+)\))?[ \t]+([A-Za-z_][A-Za-z0-9_]*)[ \t]+(\{[\s\S]*\})$/.exec(t))) {
|
|
464
|
+
const executes = given.executes ?? [];
|
|
465
|
+
const inv = { command: m[2] };
|
|
466
|
+
if (m[1])
|
|
467
|
+
inv.actor = m[1];
|
|
468
|
+
inv.payload = parseInlinePayload(m[3]);
|
|
469
|
+
executes.push(inv);
|
|
470
|
+
given.executes = executes;
|
|
471
|
+
}
|
|
472
|
+
else if ((m = /^seed[ \t]+([A-Za-z_][A-Za-z0-9_]*)[ \t]+from[ \t]+"((?:[^"\\]|\\.)*)"$/.exec(t))) {
|
|
473
|
+
const seeds = given.seeds ?? [];
|
|
474
|
+
seeds.push({ service: m[1], fixture: m[2] });
|
|
475
|
+
given.seeds = seeds;
|
|
476
|
+
}
|
|
477
|
+
else if ((m = /^seed[ \t]+([A-Za-z_][A-Za-z0-9_]*)[ \t]+(\[[\s\S]*\])$/.exec(t))) {
|
|
478
|
+
const seeds = given.seeds ?? [];
|
|
479
|
+
seeds.push({ service: m[1], records: parseRecordList(m[2], "seed") });
|
|
480
|
+
given.seeds = seeds;
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
const context = given.context ?? [];
|
|
484
|
+
context.push(t.replace(/\n/g, " "));
|
|
485
|
+
given.context = context;
|
|
486
|
+
}
|
|
487
|
+
scenario.given = given;
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
if (scenarioPhase === "predict") {
|
|
491
|
+
const prediction = scenario.prediction;
|
|
492
|
+
if ((m = /^response[ \t]+(\S+)[ \t]+([A-Za-z_][A-Za-z0-9_]*)(?:[ \t]+([\s\S]+))?$/.exec(t))) {
|
|
493
|
+
const status = /^\d+$/.test(m[1]) ? Number(m[1]) : m[1];
|
|
494
|
+
const response = { status, schemaName: m[2] };
|
|
495
|
+
if (m[3]) {
|
|
496
|
+
const rest = m[3].trim();
|
|
497
|
+
const g = /^equals[ \t]+fixture[ \t]+"((?:[^"\\]|\\.)*)"$/.exec(rest);
|
|
498
|
+
if (g)
|
|
499
|
+
response.golden = g[1];
|
|
500
|
+
else if (rest.startsWith("{"))
|
|
501
|
+
response.valueBlock = parseValueBlock(new ValueCursor(rest));
|
|
502
|
+
else
|
|
503
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unrecognized response tail: '${rest}'.`, s.line);
|
|
504
|
+
}
|
|
505
|
+
prediction.response = response;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if ((m = /^([A-Za-z_][A-Za-z0-9_]*)[ \t]+(has|contains)[ \t]+(?:(ordered|unordered)[ \t]+)?(\[[\s\S]*\])$/.exec(t))) {
|
|
509
|
+
const services = prediction.services ?? {};
|
|
510
|
+
const entry = services[m[1]] ?? {};
|
|
511
|
+
if (m[3])
|
|
512
|
+
entry.ordering = m[3];
|
|
513
|
+
const records = parseRecordList(m[4], "predict");
|
|
514
|
+
if (m[2] === "has")
|
|
515
|
+
entry.records = records;
|
|
516
|
+
else
|
|
517
|
+
entry.contains = records;
|
|
518
|
+
services[m[1]] = entry;
|
|
519
|
+
prediction.services = services;
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unrecognized prediction line: '${t}'.`, s.line);
|
|
523
|
+
}
|
|
524
|
+
if (scenarioPhase === "examples") {
|
|
525
|
+
if (t.startsWith("|")) {
|
|
526
|
+
const cells = t.split("|").slice(1, -1).map((x) => x.trim());
|
|
527
|
+
if (!exampleHeaders) {
|
|
528
|
+
exampleHeaders = cells;
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
const row = {};
|
|
532
|
+
cells.forEach((cell, idx) => {
|
|
533
|
+
const key = exampleHeaders[idx];
|
|
534
|
+
if (key === undefined)
|
|
535
|
+
return;
|
|
536
|
+
const c = new ValueCursor(cell);
|
|
537
|
+
row[key] = parseLiteralValue(c);
|
|
538
|
+
});
|
|
539
|
+
const examples = scenario.examples ?? [];
|
|
540
|
+
examples.push(row);
|
|
541
|
+
scenario.examples = examples;
|
|
542
|
+
}
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Expected an examples table row, got '${t}'.`, s.line);
|
|
546
|
+
}
|
|
547
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unrecognized scenario line: '${t}'.`, s.line);
|
|
548
|
+
}
|
|
549
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Unrecognized top-level line: '${t}'.`, s.line);
|
|
550
|
+
}
|
|
551
|
+
finishScenario();
|
|
552
|
+
// ── MISSING_MINIMUM (no-escape-hatch) ──
|
|
553
|
+
const headerComplete = ["id", "name", "context", "aggregate", "type", "status"].every((k) => identity[k] !== undefined);
|
|
554
|
+
if (!headerComplete || construct.length === 0 || enforce.length === 0 || contract.length === 0 || scenarios.length === 0)
|
|
555
|
+
throw new ParseFailure("MISSING_MINIMUM", "A spec requires a complete header, one construct directive, one enforce directive, one contract entry, and one scenario.", undefined, "See grammar reference §1.2.");
|
|
556
|
+
// ── DUPLICATE_SCENARIO_NAME (ADR-0010) ──
|
|
557
|
+
const seen = new Set();
|
|
558
|
+
for (const sc of scenarios) {
|
|
559
|
+
const name = sc.name;
|
|
560
|
+
if (seen.has(name))
|
|
561
|
+
throw new ParseFailure("DUPLICATE_SCENARIO_NAME", `Scenario name '${name}' is used more than once.`, undefined, "Scenario names are failure anchors and must be unique per spec.");
|
|
562
|
+
seen.add(name);
|
|
563
|
+
}
|
|
564
|
+
const specType = identity.type;
|
|
565
|
+
for (const sc of scenarios) {
|
|
566
|
+
const hasWhen = sc.when !== undefined;
|
|
567
|
+
const hasDeliver = sc.delivers !== undefined;
|
|
568
|
+
// ── TRIGGER_MISMATCH (ADR-0011) ──
|
|
569
|
+
if (DELIVER_TYPES.has(specType) && hasWhen)
|
|
570
|
+
throw new ParseFailure("TRIGGER_MISMATCH", `type ${specType} scenarios are triggered by 'deliver', not 'when:'.`);
|
|
571
|
+
if (!DELIVER_TYPES.has(specType) && hasDeliver)
|
|
572
|
+
throw new ParseFailure("TRIGGER_MISMATCH", `type ${specType} scenarios are triggered by 'when:', not 'deliver'.`);
|
|
573
|
+
if (!hasWhen && !hasDeliver)
|
|
574
|
+
throw new ParseFailure("MALFORMED_SYNTAX", `Scenario '${sc.name}' has no trigger.`);
|
|
575
|
+
// ── Closed spaces: commands, actors, services, schemas ──
|
|
576
|
+
const invocations = [];
|
|
577
|
+
if (hasWhen)
|
|
578
|
+
invocations.push(sc.when);
|
|
579
|
+
const given = sc.given;
|
|
580
|
+
for (const ex of given?.executes ?? [])
|
|
581
|
+
invocations.push(ex);
|
|
582
|
+
for (const inv of invocations) {
|
|
583
|
+
if (!ctx.commands.includes(inv.command))
|
|
584
|
+
throw new ParseFailure("UNKNOWN_COMMAND", `Command '${inv.command}' is not configured.`, undefined, `Configured commands: ${ctx.commands.join(", ") || "(none)"}`);
|
|
585
|
+
const actor = inv.actor;
|
|
586
|
+
if (actor && actor !== "anonymous" && !ctx.actors.includes(actor))
|
|
587
|
+
throw new ParseFailure("UNKNOWN_ACTOR", `Actor '${actor}' is not configured.`, undefined, `Configured actors: ${ctx.actors.join(", ") || "(none)"}`);
|
|
588
|
+
}
|
|
589
|
+
const serviceRefs = [];
|
|
590
|
+
const prediction = sc.prediction;
|
|
591
|
+
const services = prediction.services;
|
|
592
|
+
for (const key of Object.keys(services ?? {}))
|
|
593
|
+
serviceRefs.push(key);
|
|
594
|
+
for (const seed of given?.seeds ?? [])
|
|
595
|
+
serviceRefs.push(seed.service);
|
|
596
|
+
for (const del of sc.delivers ?? [])
|
|
597
|
+
serviceRefs.push(del.service);
|
|
598
|
+
for (const key of serviceRefs)
|
|
599
|
+
if (!ctx.serviceKeys.includes(key))
|
|
600
|
+
throw new ParseFailure("UNKNOWN_SERVICE_KEY", `Service '${key}' is not configured.`, undefined, `Configured services: ${ctx.serviceKeys.join(", ")}`);
|
|
601
|
+
const schemaRefs = [];
|
|
602
|
+
const response = prediction.response;
|
|
603
|
+
if (response)
|
|
604
|
+
schemaRefs.push(response.schemaName);
|
|
605
|
+
for (const entry of Object.values(services ?? {})) {
|
|
606
|
+
for (const rec of [...(entry.records ?? []), ...(entry.contains ?? [])])
|
|
607
|
+
schemaRefs.push(rec.schemaName);
|
|
608
|
+
}
|
|
609
|
+
for (const seed of given?.seeds ?? [])
|
|
610
|
+
for (const rec of seed.records ?? [])
|
|
611
|
+
if (rec.schemaName)
|
|
612
|
+
schemaRefs.push(rec.schemaName);
|
|
613
|
+
for (const ref of schemaRefs)
|
|
614
|
+
if (!declaredSchemas.has(ref))
|
|
615
|
+
throw new ParseFailure("UNDECLARED_SCHEMA", `Schema '${ref}' is not declared in the contract block.`, undefined, `Declared schemas: ${[...declaredSchemas].join(", ")}`);
|
|
616
|
+
// ── QUERY_SIDE_EFFECT (ADR-0011) ──
|
|
617
|
+
if (specType === "query") {
|
|
618
|
+
for (const [key, entry] of Object.entries(services ?? {})) {
|
|
619
|
+
const records = entry.records ?? [];
|
|
620
|
+
if (records.length > 0)
|
|
621
|
+
throw new ParseFailure("QUERY_SIDE_EFFECT", `type query cannot predict a write on '${key}' — side-effect freedom is a language guarantee.`);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
// ── INCOMPLETE_PREDICTION (INV-6, query-exempt) ──
|
|
625
|
+
if (specType !== "query") {
|
|
626
|
+
for (const key of ctx.serviceKeys) {
|
|
627
|
+
const entry = services?.[key];
|
|
628
|
+
if (!entry || entry.records === undefined)
|
|
629
|
+
throw new ParseFailure("INCOMPLETE_PREDICTION", `Prediction in scenario '${sc.name}' omits configured service '${key}'.`, undefined, "Every configured service must appear; 'has []' is the explicit zero-assertion.");
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
ir.identity = identity;
|
|
634
|
+
ir.construct = construct;
|
|
635
|
+
ir.enforce = enforce;
|
|
636
|
+
ir.contract = contract;
|
|
637
|
+
ir.scenarios = scenarios;
|
|
638
|
+
return ir;
|
|
639
|
+
}
|
|
640
|
+
// ── Handler ───────────────────────────────────────────────────────────────────
|
|
641
|
+
export async function parse(input) {
|
|
642
|
+
const specPath = path.resolve(process.cwd(), input.spec);
|
|
643
|
+
const configPath = path.resolve(process.cwd(), input.config);
|
|
644
|
+
const source = readFileSync(specPath, "utf8");
|
|
645
|
+
const configDoc = JSON.parse(readFileSync(configPath, "utf8"));
|
|
646
|
+
const ctx = {
|
|
647
|
+
serviceKeys: Object.keys(configDoc.services ?? {}),
|
|
648
|
+
commands: Object.keys(configDoc.response?.commands ?? {}),
|
|
649
|
+
actors: Object.keys(configDoc.response?.actors ?? {}).filter((a) => a !== "default"),
|
|
650
|
+
};
|
|
651
|
+
try {
|
|
652
|
+
const ir = parseFeat(source, ctx);
|
|
653
|
+
return { status: "OK", body: ir };
|
|
654
|
+
}
|
|
655
|
+
catch (e) {
|
|
656
|
+
if (e instanceof ParseFailure) {
|
|
657
|
+
const body = { code: e.code, message: e.message };
|
|
658
|
+
if (e.line !== undefined)
|
|
659
|
+
body.line = e.line;
|
|
660
|
+
if (e.hint !== undefined)
|
|
661
|
+
body.hint = e.hint;
|
|
662
|
+
return { status: "ERR", body };
|
|
663
|
+
}
|
|
664
|
+
throw e;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,yEAAy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KAAK,SAAS;gBAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;YAC7C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACjC,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mmmnt/feat-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Feat language core: Langium grammar, parser, AST->BuiltSpec IR, closed-reference-space validation.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@mmmnt/feat-types": "0.1.0",
|
|
20
|
+
"@mmmnt/feat-runtime": "0.1.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"ajv": "^8.17.0",
|
|
24
|
+
"ajv-formats": "^3.0.0",
|
|
25
|
+
"vitest": "^3.2.0"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/mmmnt/feature.git",
|
|
30
|
+
"directory": "packages/feat-core"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/mmmnt/feature#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/mmmnt/feature/issues"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
42
|
+
"test": "vitest run --exclude '**/parse.test.ts'"
|
|
43
|
+
}
|
|
44
|
+
}
|