@vaubaan/harness 2.1.0 → 2.3.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/README.md +537 -67
- package/dist/cli/index.js +582 -83
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/doc-audit.cmd.md +1 -1
- package/dist/commands/intent.cmd.md +33 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +343 -63
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +340 -60
- package/dist/init.js.map +1 -1
- package/dist/linters/index.js +536 -62
- package/dist/linters/index.js.map +1 -1
- package/dist/parser/index.d.ts +143 -1
- package/dist/parser/index.js +235 -4
- package/dist/parser/index.js.map +1 -1
- package/dist/{render-C-FWmUfX.d.ts → render-CTx7VNOK.d.ts} +3 -1
- package/dist/render.d.ts +1 -1
- package/dist/render.js +98 -14
- package/dist/render.js.map +1 -1
- package/dist/skills/doc-audit.skill.md +35 -4
- package/dist/skills/drift-detector.skill.md +36 -5
- package/dist/skills/handbook-writer.skill.md +3 -0
- package/dist/skills/intent-writer.skill.md +174 -0
- package/dist/templates/e2e-tests.md.tmpl +1 -1
- package/dist/templates/integration-tests.md.tmpl +1 -1
- package/dist/templates/intent.md.tmpl +46 -0
- package/package.json +3 -7
package/dist/parser/index.d.ts
CHANGED
|
@@ -31,28 +31,36 @@ declare const CmdArgSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
31
31
|
type: z.ZodLiteral<"enum">;
|
|
32
32
|
values: z.ZodArray<z.ZodString, "many">;
|
|
33
33
|
default: z.ZodOptional<z.ZodString>;
|
|
34
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
35
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
34
36
|
}, "strict", z.ZodTypeAny, {
|
|
35
37
|
values: string[];
|
|
36
38
|
type: "enum";
|
|
37
39
|
name: string;
|
|
38
40
|
default?: string | undefined;
|
|
41
|
+
required?: boolean | undefined;
|
|
39
42
|
}, {
|
|
40
43
|
values: string[];
|
|
41
44
|
type: "enum";
|
|
42
45
|
name: string;
|
|
43
46
|
default?: string | undefined;
|
|
47
|
+
required?: boolean | undefined;
|
|
44
48
|
}>, z.ZodObject<{
|
|
45
49
|
name: z.ZodString;
|
|
46
50
|
type: z.ZodLiteral<"string">;
|
|
47
51
|
default: z.ZodOptional<z.ZodString>;
|
|
52
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
53
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
48
54
|
}, "strict", z.ZodTypeAny, {
|
|
49
55
|
type: "string";
|
|
50
56
|
name: string;
|
|
51
57
|
default?: string | undefined;
|
|
58
|
+
required?: boolean | undefined;
|
|
52
59
|
}, {
|
|
53
60
|
type: "string";
|
|
54
61
|
name: string;
|
|
55
62
|
default?: string | undefined;
|
|
63
|
+
required?: boolean | undefined;
|
|
56
64
|
}>]>;
|
|
57
65
|
type CmdArg = z.infer<typeof CmdArgSchema>;
|
|
58
66
|
declare const CmdFrontmatterSchema: z.ZodObject<{
|
|
@@ -64,28 +72,36 @@ declare const CmdFrontmatterSchema: z.ZodObject<{
|
|
|
64
72
|
type: z.ZodLiteral<"enum">;
|
|
65
73
|
values: z.ZodArray<z.ZodString, "many">;
|
|
66
74
|
default: z.ZodOptional<z.ZodString>;
|
|
75
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
76
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
67
77
|
}, "strict", z.ZodTypeAny, {
|
|
68
78
|
values: string[];
|
|
69
79
|
type: "enum";
|
|
70
80
|
name: string;
|
|
71
81
|
default?: string | undefined;
|
|
82
|
+
required?: boolean | undefined;
|
|
72
83
|
}, {
|
|
73
84
|
values: string[];
|
|
74
85
|
type: "enum";
|
|
75
86
|
name: string;
|
|
76
87
|
default?: string | undefined;
|
|
88
|
+
required?: boolean | undefined;
|
|
77
89
|
}>, z.ZodObject<{
|
|
78
90
|
name: z.ZodString;
|
|
79
91
|
type: z.ZodLiteral<"string">;
|
|
80
92
|
default: z.ZodOptional<z.ZodString>;
|
|
93
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
94
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
81
95
|
}, "strict", z.ZodTypeAny, {
|
|
82
96
|
type: "string";
|
|
83
97
|
name: string;
|
|
84
98
|
default?: string | undefined;
|
|
99
|
+
required?: boolean | undefined;
|
|
85
100
|
}, {
|
|
86
101
|
type: "string";
|
|
87
102
|
name: string;
|
|
88
103
|
default?: string | undefined;
|
|
104
|
+
required?: boolean | undefined;
|
|
89
105
|
}>]>, "many">>;
|
|
90
106
|
description: z.ZodString;
|
|
91
107
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -98,10 +114,12 @@ declare const CmdFrontmatterSchema: z.ZodObject<{
|
|
|
98
114
|
type: "enum";
|
|
99
115
|
name: string;
|
|
100
116
|
default?: string | undefined;
|
|
117
|
+
required?: boolean | undefined;
|
|
101
118
|
} | {
|
|
102
119
|
type: "string";
|
|
103
120
|
name: string;
|
|
104
121
|
default?: string | undefined;
|
|
122
|
+
required?: boolean | undefined;
|
|
105
123
|
})[] | undefined;
|
|
106
124
|
}, {
|
|
107
125
|
id: string;
|
|
@@ -113,13 +131,37 @@ declare const CmdFrontmatterSchema: z.ZodObject<{
|
|
|
113
131
|
type: "enum";
|
|
114
132
|
name: string;
|
|
115
133
|
default?: string | undefined;
|
|
134
|
+
required?: boolean | undefined;
|
|
116
135
|
} | {
|
|
117
136
|
type: "string";
|
|
118
137
|
name: string;
|
|
119
138
|
default?: string | undefined;
|
|
139
|
+
required?: boolean | undefined;
|
|
120
140
|
})[] | undefined;
|
|
121
141
|
}>;
|
|
122
142
|
type CmdFrontmatter = z.infer<typeof CmdFrontmatterSchema>;
|
|
143
|
+
declare const INTENT_STATUSES: readonly ["proposed", "implemented", "deprecated"];
|
|
144
|
+
type IntentStatus = (typeof INTENT_STATUSES)[number];
|
|
145
|
+
declare const IntentFrontmatterSchema: z.ZodObject<{
|
|
146
|
+
title: z.ZodString;
|
|
147
|
+
status: z.ZodEnum<["proposed", "implemented", "deprecated"]>;
|
|
148
|
+
actors: z.ZodArray<z.ZodString, "many">;
|
|
149
|
+
spec: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
150
|
+
last_reviewed: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
151
|
+
}, "strict", z.ZodTypeAny, {
|
|
152
|
+
status: "proposed" | "implemented" | "deprecated";
|
|
153
|
+
title: string;
|
|
154
|
+
actors: string[];
|
|
155
|
+
spec: string | string[];
|
|
156
|
+
last_reviewed: string | Date;
|
|
157
|
+
}, {
|
|
158
|
+
status: "proposed" | "implemented" | "deprecated";
|
|
159
|
+
title: string;
|
|
160
|
+
actors: string[];
|
|
161
|
+
spec: string | string[];
|
|
162
|
+
last_reviewed: string | Date;
|
|
163
|
+
}>;
|
|
164
|
+
type IntentFrontmatter = z.infer<typeof IntentFrontmatterSchema>;
|
|
123
165
|
declare const Schemas: {
|
|
124
166
|
readonly Skill: z.ZodObject<{
|
|
125
167
|
id: z.ZodString;
|
|
@@ -149,28 +191,36 @@ declare const Schemas: {
|
|
|
149
191
|
type: z.ZodLiteral<"enum">;
|
|
150
192
|
values: z.ZodArray<z.ZodString, "many">;
|
|
151
193
|
default: z.ZodOptional<z.ZodString>;
|
|
194
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
195
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
152
196
|
}, "strict", z.ZodTypeAny, {
|
|
153
197
|
values: string[];
|
|
154
198
|
type: "enum";
|
|
155
199
|
name: string;
|
|
156
200
|
default?: string | undefined;
|
|
201
|
+
required?: boolean | undefined;
|
|
157
202
|
}, {
|
|
158
203
|
values: string[];
|
|
159
204
|
type: "enum";
|
|
160
205
|
name: string;
|
|
161
206
|
default?: string | undefined;
|
|
207
|
+
required?: boolean | undefined;
|
|
162
208
|
}>, z.ZodObject<{
|
|
163
209
|
name: z.ZodString;
|
|
164
210
|
type: z.ZodLiteral<"string">;
|
|
165
211
|
default: z.ZodOptional<z.ZodString>;
|
|
212
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
213
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
166
214
|
}, "strict", z.ZodTypeAny, {
|
|
167
215
|
type: "string";
|
|
168
216
|
name: string;
|
|
169
217
|
default?: string | undefined;
|
|
218
|
+
required?: boolean | undefined;
|
|
170
219
|
}, {
|
|
171
220
|
type: "string";
|
|
172
221
|
name: string;
|
|
173
222
|
default?: string | undefined;
|
|
223
|
+
required?: boolean | undefined;
|
|
174
224
|
}>]>, "many">>;
|
|
175
225
|
description: z.ZodString;
|
|
176
226
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -183,10 +233,12 @@ declare const Schemas: {
|
|
|
183
233
|
type: "enum";
|
|
184
234
|
name: string;
|
|
185
235
|
default?: string | undefined;
|
|
236
|
+
required?: boolean | undefined;
|
|
186
237
|
} | {
|
|
187
238
|
type: "string";
|
|
188
239
|
name: string;
|
|
189
240
|
default?: string | undefined;
|
|
241
|
+
required?: boolean | undefined;
|
|
190
242
|
})[] | undefined;
|
|
191
243
|
}, {
|
|
192
244
|
id: string;
|
|
@@ -198,12 +250,33 @@ declare const Schemas: {
|
|
|
198
250
|
type: "enum";
|
|
199
251
|
name: string;
|
|
200
252
|
default?: string | undefined;
|
|
253
|
+
required?: boolean | undefined;
|
|
201
254
|
} | {
|
|
202
255
|
type: "string";
|
|
203
256
|
name: string;
|
|
204
257
|
default?: string | undefined;
|
|
258
|
+
required?: boolean | undefined;
|
|
205
259
|
})[] | undefined;
|
|
206
260
|
}>;
|
|
261
|
+
readonly Intent: z.ZodObject<{
|
|
262
|
+
title: z.ZodString;
|
|
263
|
+
status: z.ZodEnum<["proposed", "implemented", "deprecated"]>;
|
|
264
|
+
actors: z.ZodArray<z.ZodString, "many">;
|
|
265
|
+
spec: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
266
|
+
last_reviewed: z.ZodUnion<[z.ZodDate, z.ZodString]>;
|
|
267
|
+
}, "strict", z.ZodTypeAny, {
|
|
268
|
+
status: "proposed" | "implemented" | "deprecated";
|
|
269
|
+
title: string;
|
|
270
|
+
actors: string[];
|
|
271
|
+
spec: string | string[];
|
|
272
|
+
last_reviewed: string | Date;
|
|
273
|
+
}, {
|
|
274
|
+
status: "proposed" | "implemented" | "deprecated";
|
|
275
|
+
title: string;
|
|
276
|
+
actors: string[];
|
|
277
|
+
spec: string | string[];
|
|
278
|
+
last_reviewed: string | Date;
|
|
279
|
+
}>;
|
|
207
280
|
};
|
|
208
281
|
declare class ParseError extends Error {
|
|
209
282
|
readonly file: string;
|
|
@@ -215,8 +288,77 @@ type Cmd = ParsedFile<CmdFrontmatter>;
|
|
|
215
288
|
declare function parseCmd(filePath: string, source: string): Cmd;
|
|
216
289
|
declare function parseCmdFile(filePath: string): Cmd;
|
|
217
290
|
|
|
291
|
+
/** The optional intents pillar (docs/spec/coding-agent-harness.md §9.1.3). */
|
|
292
|
+
declare const INTENTS_DIR = "docs/intents";
|
|
293
|
+
/** The generated index of the pillar; never an intent file. */
|
|
294
|
+
declare const INTENTS_INDEX_PATH = "docs/intents/README.md";
|
|
295
|
+
declare const NODE_FIELDS: readonly ["status", "spec", "anchors", "acceptance", "requires", "creates"];
|
|
296
|
+
type NodeField = (typeof NODE_FIELDS)[number];
|
|
297
|
+
/** Fields only a terminal intent (a node with no sub-intent) may carry. */
|
|
298
|
+
declare const TERMINAL_FIELDS: ReadonlyArray<NodeField>;
|
|
299
|
+
interface IntentError {
|
|
300
|
+
line?: number;
|
|
301
|
+
message: string;
|
|
302
|
+
}
|
|
303
|
+
interface IntentNode {
|
|
304
|
+
title: string;
|
|
305
|
+
/** Heading depth minus one: `##` is level 1. */
|
|
306
|
+
level: number;
|
|
307
|
+
/** 1-based line of the heading in the file. */
|
|
308
|
+
line: number;
|
|
309
|
+
/** Index of the parent node in `nodes`, absent for a level-1 node. */
|
|
310
|
+
parent?: number;
|
|
311
|
+
/** True when the node has no sub-intent: a terminal intent. */
|
|
312
|
+
isTerminal: boolean;
|
|
313
|
+
/** Line of each known field the node declares. */
|
|
314
|
+
fieldLines: Partial<Record<NodeField, number>>;
|
|
315
|
+
status?: IntentStatus;
|
|
316
|
+
spec?: string;
|
|
317
|
+
anchors: string[];
|
|
318
|
+
acceptance: string[];
|
|
319
|
+
requires: string[];
|
|
320
|
+
creates: string[];
|
|
321
|
+
unknownFields: Array<{
|
|
322
|
+
key: string;
|
|
323
|
+
line: number;
|
|
324
|
+
}>;
|
|
325
|
+
/** Nearest `status:` up the tree, else the file status. */
|
|
326
|
+
effectiveStatus?: IntentStatus;
|
|
327
|
+
}
|
|
328
|
+
interface IntentFile {
|
|
329
|
+
meta?: IntentFrontmatter;
|
|
330
|
+
title: string;
|
|
331
|
+
statement?: string;
|
|
332
|
+
nodes: IntentNode[];
|
|
333
|
+
errors: IntentError[];
|
|
334
|
+
}
|
|
335
|
+
interface ParsedIntentFile extends IntentFile {
|
|
336
|
+
/** Path from the repo root, e.g. `docs/intents/harness-a-project.md`. */
|
|
337
|
+
path: string;
|
|
338
|
+
/** File name, e.g. `harness-a-project.md`. */
|
|
339
|
+
file: string;
|
|
340
|
+
}
|
|
341
|
+
/** Replaces every line of fenced code (fences included), keeping line numbers. */
|
|
342
|
+
declare function maskFencedCode(lines: ReadonlyArray<string>): string[];
|
|
343
|
+
/**
|
|
344
|
+
* Parses one intent file (docs/spec/coding-agent-harness.md §9.1.3). Never
|
|
345
|
+
* throws: frontmatter and node problems are collected in `errors` and the
|
|
346
|
+
* nodes are parsed regardless, so a linter reports everything at once.
|
|
347
|
+
*/
|
|
348
|
+
declare function parseIntentFile(relPath: string, text: string): IntentFile;
|
|
349
|
+
/** Intent files: `docs/intents/*.md` minus the generated index, sorted by file name. */
|
|
350
|
+
declare function listIntentFiles(targetDir: string): string[];
|
|
351
|
+
/** Parses every intent file without throwing; linters read their `errors`. */
|
|
352
|
+
declare function readIntentFiles(targetDir: string): ParsedIntentFile[];
|
|
353
|
+
/**
|
|
354
|
+
* The intent files the render needs. One that does not parse fails the
|
|
355
|
+
* render, like an invalid project skill: `init`, `update` and
|
|
356
|
+
* `lint:generated-fresh` report it.
|
|
357
|
+
*/
|
|
358
|
+
declare function loadIntentFiles(targetDir: string): ParsedIntentFile[];
|
|
359
|
+
|
|
218
360
|
type Skill = ParsedFile<SkillFrontmatter>;
|
|
219
361
|
declare function parseSkill(filePath: string, source: string): Skill;
|
|
220
362
|
declare function parseSkillFile(filePath: string): Skill;
|
|
221
363
|
|
|
222
|
-
export { type Cmd, type CmdArg, type CmdFrontmatter, ParseError, type ParsedFile, Schemas, type Skill, type SkillFrontmatter, parseCmd, parseCmdFile, parseSkill, parseSkillFile };
|
|
364
|
+
export { type Cmd, type CmdArg, type CmdFrontmatter, INTENTS_DIR, INTENTS_INDEX_PATH, INTENT_STATUSES, type IntentError, type IntentFile, type IntentFrontmatter, type IntentNode, type IntentStatus, NODE_FIELDS, type NodeField, ParseError, type ParsedFile, type ParsedIntentFile, Schemas, type Skill, type SkillFrontmatter, TERMINAL_FIELDS, listIntentFiles, loadIntentFiles, maskFencedCode, parseCmd, parseCmdFile, parseIntentFile, parseSkill, parseSkillFile, readIntentFiles };
|
package/dist/parser/index.js
CHANGED
|
@@ -22,12 +22,16 @@ var CmdArgEnumSchema = z.object({
|
|
|
22
22
|
name: z.string().min(1),
|
|
23
23
|
type: z.literal("enum"),
|
|
24
24
|
values: z.array(z.string()).min(1),
|
|
25
|
-
default: z.string().optional()
|
|
25
|
+
default: z.string().optional(),
|
|
26
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
27
|
+
required: z.boolean().optional()
|
|
26
28
|
}).strict();
|
|
27
29
|
var CmdArgStringSchema = z.object({
|
|
28
30
|
name: z.string().min(1),
|
|
29
31
|
type: z.literal("string"),
|
|
30
|
-
default: z.string().optional()
|
|
32
|
+
default: z.string().optional(),
|
|
33
|
+
/** False when the command runs without the argument. Defaults to true. */
|
|
34
|
+
required: z.boolean().optional()
|
|
31
35
|
}).strict();
|
|
32
36
|
var CmdArgSchema = z.discriminatedUnion("type", [CmdArgEnumSchema, CmdArgStringSchema]);
|
|
33
37
|
var CmdFrontmatterSchema = z.object({
|
|
@@ -37,9 +41,18 @@ var CmdFrontmatterSchema = z.object({
|
|
|
37
41
|
args: z.array(CmdArgSchema).optional(),
|
|
38
42
|
description: z.string().min(1)
|
|
39
43
|
}).strict();
|
|
44
|
+
var INTENT_STATUSES = ["proposed", "implemented", "deprecated"];
|
|
45
|
+
var IntentFrontmatterSchema = z.object({
|
|
46
|
+
title: z.string().min(1),
|
|
47
|
+
status: z.enum(INTENT_STATUSES),
|
|
48
|
+
actors: z.array(z.string().min(1)).min(1),
|
|
49
|
+
spec: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),
|
|
50
|
+
last_reviewed: z.union([z.date(), z.string().min(1)])
|
|
51
|
+
}).strict();
|
|
40
52
|
var Schemas = {
|
|
41
53
|
Skill: SkillFrontmatterSchema,
|
|
42
|
-
Cmd: CmdFrontmatterSchema
|
|
54
|
+
Cmd: CmdFrontmatterSchema,
|
|
55
|
+
Intent: IntentFrontmatterSchema
|
|
43
56
|
};
|
|
44
57
|
var ParseError = class extends Error {
|
|
45
58
|
constructor(file, issues) {
|
|
@@ -87,12 +100,230 @@ function parseSkill(filePath, source) {
|
|
|
87
100
|
function parseSkillFile(filePath) {
|
|
88
101
|
return parseFileWithSchema(filePath, Schemas.Skill);
|
|
89
102
|
}
|
|
103
|
+
|
|
104
|
+
// src/parser/intent.ts
|
|
105
|
+
import { existsSync, readFileSync as readFileSync2, readdirSync, statSync } from "fs";
|
|
106
|
+
import { basename, join } from "path";
|
|
107
|
+
import matter2 from "gray-matter";
|
|
108
|
+
var INTENTS_DIR = "docs/intents";
|
|
109
|
+
var INTENTS_INDEX_PATH = `${INTENTS_DIR}/README.md`;
|
|
110
|
+
var NODE_FIELDS = [
|
|
111
|
+
"status",
|
|
112
|
+
"spec",
|
|
113
|
+
"anchors",
|
|
114
|
+
"acceptance",
|
|
115
|
+
"requires",
|
|
116
|
+
"creates"
|
|
117
|
+
];
|
|
118
|
+
var TERMINAL_FIELDS = [
|
|
119
|
+
"anchors",
|
|
120
|
+
"acceptance",
|
|
121
|
+
"requires",
|
|
122
|
+
"creates"
|
|
123
|
+
];
|
|
124
|
+
var MASKED_LINE = "\0";
|
|
125
|
+
var FENCE_RE = /^ {0,3}(`{3,}|~{3,})/;
|
|
126
|
+
var HEADING_RE = /^(#{1,6})[ \t]+(.+?)(?:[ \t]+#+)?[ \t]*$/;
|
|
127
|
+
var FIELD_RE = /^([a-z][a-z-]*):\s*(.*)$/;
|
|
128
|
+
var LIST_ITEM_RE = /^\s*-\s+(.*)$/;
|
|
129
|
+
function maskFencedCode(lines) {
|
|
130
|
+
let fence;
|
|
131
|
+
return lines.map((line) => {
|
|
132
|
+
const m = FENCE_RE.exec(line);
|
|
133
|
+
if (fence !== void 0) {
|
|
134
|
+
if (m?.[1] && m[1][0] === fence[0] && m[1].length >= fence.length) fence = void 0;
|
|
135
|
+
return MASKED_LINE;
|
|
136
|
+
}
|
|
137
|
+
if (m?.[1]) {
|
|
138
|
+
fence = m[1];
|
|
139
|
+
return MASKED_LINE;
|
|
140
|
+
}
|
|
141
|
+
return line;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function parseHeading(line) {
|
|
145
|
+
const m = HEADING_RE.exec(line);
|
|
146
|
+
if (!m?.[1] || !m[2]) return void 0;
|
|
147
|
+
return { depth: m[1].length, title: m[2] };
|
|
148
|
+
}
|
|
149
|
+
function splitList(value) {
|
|
150
|
+
return value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
151
|
+
}
|
|
152
|
+
function bodyStart(lines) {
|
|
153
|
+
if (lines[0]?.trim() !== "---") return 0;
|
|
154
|
+
for (let i = 1; i < lines.length; i++) {
|
|
155
|
+
const l = lines[i]?.trim();
|
|
156
|
+
if (l === "---" || l === "...") return i + 1;
|
|
157
|
+
}
|
|
158
|
+
return lines.length;
|
|
159
|
+
}
|
|
160
|
+
function parseFrontmatter(text, errors) {
|
|
161
|
+
let data;
|
|
162
|
+
try {
|
|
163
|
+
data = matter2(text).data;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
const reason = error instanceof Error ? error.message.split("\n")[0] : String(error);
|
|
166
|
+
errors.push({ line: 1, message: `invalid frontmatter YAML: ${reason}` });
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
const result = Schemas.Intent.safeParse(data);
|
|
170
|
+
if (result.success) return result.data;
|
|
171
|
+
for (const issue of result.error.issues) {
|
|
172
|
+
const where = issue.path.length ? ` \`${issue.path.join(".")}\`` : "";
|
|
173
|
+
errors.push({ line: 1, message: `frontmatter${where}: ${issue.message}` });
|
|
174
|
+
}
|
|
175
|
+
return void 0;
|
|
176
|
+
}
|
|
177
|
+
function newNode(title, level, line) {
|
|
178
|
+
return {
|
|
179
|
+
title,
|
|
180
|
+
level,
|
|
181
|
+
line,
|
|
182
|
+
isTerminal: true,
|
|
183
|
+
fieldLines: {},
|
|
184
|
+
anchors: [],
|
|
185
|
+
acceptance: [],
|
|
186
|
+
requires: [],
|
|
187
|
+
creates: [],
|
|
188
|
+
unknownFields: []
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function parseFields(node, lines, from, to, errors) {
|
|
192
|
+
let lastKey;
|
|
193
|
+
for (let i = from; i < to; i++) {
|
|
194
|
+
const line = lines[i] ?? "";
|
|
195
|
+
if (line.trim() === "") continue;
|
|
196
|
+
const lineNo = i + 1;
|
|
197
|
+
const field = FIELD_RE.exec(line.trimEnd());
|
|
198
|
+
if (field?.[1] !== void 0) {
|
|
199
|
+
const key = field[1];
|
|
200
|
+
const value = (field[2] ?? "").trim();
|
|
201
|
+
lastKey = key;
|
|
202
|
+
if (!NODE_FIELDS.includes(key)) {
|
|
203
|
+
node.unknownFields.push({ key, line: lineNo });
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const known = key;
|
|
207
|
+
node.fieldLines[known] = lineNo;
|
|
208
|
+
if (known === "status") {
|
|
209
|
+
if (INTENT_STATUSES.includes(value)) {
|
|
210
|
+
node.status = value;
|
|
211
|
+
} else {
|
|
212
|
+
errors.push({
|
|
213
|
+
line: lineNo,
|
|
214
|
+
message: `invalid status \`${value}\` (expected ${INTENT_STATUSES.join(" | ")})`
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
} else if (known === "spec") {
|
|
218
|
+
node.spec = value;
|
|
219
|
+
} else if (known === "acceptance") {
|
|
220
|
+
if (value) node.acceptance.push(value);
|
|
221
|
+
} else {
|
|
222
|
+
node[known] = splitList(value);
|
|
223
|
+
}
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const item = LIST_ITEM_RE.exec(line);
|
|
227
|
+
if (lastKey === "acceptance" && item) {
|
|
228
|
+
const text = (item[1] ?? "").trim();
|
|
229
|
+
if (text) node.acceptance.push(text);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function parseIntentFile(relPath, text) {
|
|
236
|
+
const errors = [];
|
|
237
|
+
const meta = parseFrontmatter(text, errors);
|
|
238
|
+
const lines = maskFencedCode(text.split(/\r?\n/));
|
|
239
|
+
const start = bodyStart(lines);
|
|
240
|
+
const headings = [];
|
|
241
|
+
for (let i = start; i < lines.length; i++) {
|
|
242
|
+
const h = parseHeading(lines[i] ?? "");
|
|
243
|
+
if (h) headings.push({ index: i, ...h });
|
|
244
|
+
}
|
|
245
|
+
const h1 = headings.find((h) => h.depth === 1);
|
|
246
|
+
let statement;
|
|
247
|
+
if (h1) {
|
|
248
|
+
const paragraph = [];
|
|
249
|
+
for (let i = h1.index + 1; i < lines.length; i++) {
|
|
250
|
+
const line = lines[i] ?? "";
|
|
251
|
+
if (line.trim() === "") {
|
|
252
|
+
if (paragraph.length) break;
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (line === MASKED_LINE || parseHeading(line)) break;
|
|
256
|
+
paragraph.push(line.trim());
|
|
257
|
+
}
|
|
258
|
+
if (paragraph.length) statement = paragraph.join(" ");
|
|
259
|
+
}
|
|
260
|
+
const nodes = [];
|
|
261
|
+
const stack = [];
|
|
262
|
+
for (const [k, h] of headings.entries()) {
|
|
263
|
+
if (h.depth < 2) continue;
|
|
264
|
+
const node = newNode(h.title, h.depth - 1, h.index + 1);
|
|
265
|
+
while (stack.length) {
|
|
266
|
+
const top = nodes[stack[stack.length - 1]];
|
|
267
|
+
if (top && top.level < node.level) break;
|
|
268
|
+
stack.pop();
|
|
269
|
+
}
|
|
270
|
+
const parentIndex = stack[stack.length - 1];
|
|
271
|
+
if (parentIndex !== void 0) {
|
|
272
|
+
node.parent = parentIndex;
|
|
273
|
+
const parent = nodes[parentIndex];
|
|
274
|
+
if (parent) parent.isTerminal = false;
|
|
275
|
+
}
|
|
276
|
+
const next = headings[k + 1];
|
|
277
|
+
parseFields(node, lines, h.index + 1, next ? next.index : lines.length, errors);
|
|
278
|
+
const inherited = parentIndex !== void 0 ? nodes[parentIndex]?.effectiveStatus : meta?.status;
|
|
279
|
+
node.effectiveStatus = node.status ?? inherited;
|
|
280
|
+
stack.push(nodes.length);
|
|
281
|
+
nodes.push(node);
|
|
282
|
+
}
|
|
283
|
+
const title = meta?.title ?? h1?.title ?? basename(relPath, ".md");
|
|
284
|
+
return { ...meta ? { meta } : {}, title, ...statement ? { statement } : {}, nodes, errors };
|
|
285
|
+
}
|
|
286
|
+
function listIntentFiles(targetDir) {
|
|
287
|
+
const dir = join(targetDir, INTENTS_DIR);
|
|
288
|
+
if (!existsSync(dir) || !statSync(dir).isDirectory()) return [];
|
|
289
|
+
return readdirSync(dir).filter((f) => f.endsWith(".md") && f !== "README.md").filter((f) => statSync(join(dir, f)).isFile()).sort();
|
|
290
|
+
}
|
|
291
|
+
function readIntentFiles(targetDir) {
|
|
292
|
+
return listIntentFiles(targetDir).map((file) => {
|
|
293
|
+
const path = `${INTENTS_DIR}/${file}`;
|
|
294
|
+
const text = readFileSync2(join(targetDir, path), "utf8");
|
|
295
|
+
return { path, file, ...parseIntentFile(path, text) };
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function loadIntentFiles(targetDir) {
|
|
299
|
+
const intentFiles = readIntentFiles(targetDir);
|
|
300
|
+
const problems = intentFiles.flatMap(
|
|
301
|
+
(j) => j.errors.map((e) => ` - ${j.path}${e.line !== void 0 ? `:${e.line}` : ""}: ${e.message}`)
|
|
302
|
+
);
|
|
303
|
+
if (problems.length) {
|
|
304
|
+
throw new Error(
|
|
305
|
+
`invalid intents (run \`npx @vaubaan/harness lint --pillar intents\`):
|
|
306
|
+
${problems.join("\n")}`
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
return intentFiles;
|
|
310
|
+
}
|
|
90
311
|
export {
|
|
312
|
+
INTENTS_DIR,
|
|
313
|
+
INTENTS_INDEX_PATH,
|
|
314
|
+
INTENT_STATUSES,
|
|
315
|
+
NODE_FIELDS,
|
|
91
316
|
ParseError,
|
|
92
317
|
Schemas,
|
|
318
|
+
TERMINAL_FIELDS,
|
|
319
|
+
listIntentFiles,
|
|
320
|
+
loadIntentFiles,
|
|
321
|
+
maskFencedCode,
|
|
93
322
|
parseCmd,
|
|
94
323
|
parseCmdFile,
|
|
324
|
+
parseIntentFile,
|
|
95
325
|
parseSkill,
|
|
96
|
-
parseSkillFile
|
|
326
|
+
parseSkillFile,
|
|
327
|
+
readIntentFiles
|
|
97
328
|
};
|
|
98
329
|
//# sourceMappingURL=index.js.map
|
package/dist/parser/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/parser/common.ts","../../src/parser/schemas.ts","../../src/types.ts","../../src/parser/cmd.ts","../../src/parser/skill.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport matter from \"gray-matter\";\nimport type { z } from \"zod\";\nimport { ParseError } from \"./schemas.js\";\n\nexport interface ParsedFile<T> {\n meta: T;\n body: string;\n sourcePath: string;\n}\n\nexport function parseWithSchema<T extends z.ZodTypeAny>(\n filePath: string,\n source: string,\n schema: T,\n): ParsedFile<z.infer<T>> {\n const parsed = matter(source);\n const result = schema.safeParse(parsed.data);\n if (!result.success) {\n throw new ParseError(filePath, result.error.issues);\n }\n return {\n meta: result.data,\n body: parsed.content.trim(),\n sourcePath: filePath,\n };\n}\n\nexport function parseFileWithSchema<T extends z.ZodTypeAny>(\n filePath: string,\n schema: T,\n): ParsedFile<z.infer<T>> {\n const source = readFileSync(filePath, \"utf8\");\n return parseWithSchema(filePath, source, schema);\n}\n","import { z } from \"zod\";\nimport { CAPABILITIES, ENGINES } from \"../types.js\";\n\nconst IdSchema = z\n .string()\n .min(1)\n .regex(/^[a-z][a-z0-9-]*$/, \"id must be kebab-case (lowercase + digits + hyphens)\");\n\nconst SkillFrontmatterSchema = z\n .object({\n id: IdSchema,\n description: z.string().min(1),\n engines: z.array(z.enum(ENGINES)).min(1).optional(),\n requires: z.array(z.enum(CAPABILITIES)).optional(),\n tags: z.array(z.string()).optional(),\n })\n .strict();\n\nexport type SkillFrontmatter = z.infer<typeof SkillFrontmatterSchema>;\n\nconst CmdArgEnumSchema = z\n .object({\n name: z.string().min(1),\n type: z.literal(\"enum\"),\n values: z.array(z.string()).min(1),\n default: z.string().optional(),\n })\n .strict();\n\nconst CmdArgStringSchema = z\n .object({\n name: z.string().min(1),\n type: z.literal(\"string\"),\n default: z.string().optional(),\n })\n .strict();\n\nconst CmdArgSchema = z.discriminatedUnion(\"type\", [CmdArgEnumSchema, CmdArgStringSchema]);\n\nexport type CmdArg = z.infer<typeof CmdArgSchema>;\n\nconst CmdFrontmatterSchema = z\n .object({\n id: IdSchema,\n trigger: z.string().regex(/^\\/[a-z][a-z0-9-]*$/, \"trigger must be /kebab-case\"),\n invokes_skill: IdSchema,\n args: z.array(CmdArgSchema).optional(),\n description: z.string().min(1),\n })\n .strict();\n\nexport type CmdFrontmatter = z.infer<typeof CmdFrontmatterSchema>;\n\nexport const Schemas = {\n Skill: SkillFrontmatterSchema,\n Cmd: CmdFrontmatterSchema,\n} as const;\n\nexport class ParseError extends Error {\n constructor(\n public readonly file: string,\n public readonly issues: z.ZodIssue[],\n ) {\n const messages = issues\n .map((i) => ` - ${i.path.join(\".\") || \"<root>\"}: ${i.message}`)\n .join(\"\\n\");\n super(`Frontmatter validation failed for ${file}:\\n${messages}`);\n this.name = \"ParseError\";\n }\n}\n","export const ENGINES = [\"claude-code\", \"codex-cli\", \"opencode\"] as const;\nexport type Engine = (typeof ENGINES)[number];\n\nexport const ENGINE_ROOT_DIR: Record<Engine, string> = {\n \"claude-code\": \".claude\",\n \"codex-cli\": \".codex\",\n opencode: \".opencode\",\n};\n\nexport const CAPABILITIES = [\"multi-step\", \"slash-command\", \"inline-exec\"] as const;\nexport type Capability = (typeof CAPABILITIES)[number];\n\nexport interface RenderedFile {\n path: string;\n content: string;\n}\n\nexport interface CapabilitiesMatrix {\n [engine: string]: ReadonlyArray<Capability>;\n}\n\nexport const CAPABILITIES_MATRIX: Record<Engine, ReadonlyArray<Capability>> = {\n \"claude-code\": [\"multi-step\", \"slash-command\", \"inline-exec\"],\n \"codex-cli\": [\"multi-step\", \"slash-command\", \"inline-exec\"],\n opencode: [\"multi-step\", \"slash-command\", \"inline-exec\"],\n};\n\nexport const DEGRADED_CAPABILITIES: Partial<Record<Engine, ReadonlyArray<Capability>>> = {\n \"codex-cli\": [\"multi-step\"],\n};\n\nexport function engineSupports(engine: Engine, capability: Capability): boolean {\n return CAPABILITIES_MATRIX[engine].includes(capability);\n}\n","import { parseFileWithSchema, parseWithSchema } from \"./common.js\";\nimport type { ParsedFile } from \"./common.js\";\nimport { type CmdFrontmatter, Schemas } from \"./schemas.js\";\n\nexport type Cmd = ParsedFile<CmdFrontmatter>;\n\nexport function parseCmd(filePath: string, source: string): Cmd {\n return parseWithSchema(filePath, source, Schemas.Cmd);\n}\n\nexport function parseCmdFile(filePath: string): Cmd {\n return parseFileWithSchema(filePath, Schemas.Cmd);\n}\n","import { parseFileWithSchema, parseWithSchema } from \"./common.js\";\nimport type { ParsedFile } from \"./common.js\";\nimport { Schemas, type SkillFrontmatter } from \"./schemas.js\";\n\nexport type Skill = ParsedFile<SkillFrontmatter>;\n\nexport function parseSkill(filePath: string, source: string): Skill {\n return parseWithSchema(filePath, source, Schemas.Skill);\n}\n\nexport function parseSkillFile(filePath: string): Skill {\n return parseFileWithSchema(filePath, Schemas.Skill);\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,OAAO,YAAY;;;ACDnB,SAAS,SAAS;;;ACAX,IAAM,UAAU,CAAC,eAAe,aAAa,UAAU;AASvD,IAAM,eAAe,CAAC,cAAc,iBAAiB,aAAa;;;ADNzE,IAAM,WAAW,EACd,OAAO,EACP,IAAI,CAAC,EACL,MAAM,qBAAqB,sDAAsD;AAEpF,IAAM,yBAAyB,EAC5B,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC7B,SAAS,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EAClD,UAAU,EAAE,MAAM,EAAE,KAAK,YAAY,CAAC,EAAE,SAAS;AAAA,EACjD,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AACrC,CAAC,EACA,OAAO;AAIV,IAAM,mBAAmB,EACtB,OAAO;AAAA,EACN,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC;AAAA,EACjC,SAAS,EAAE,OAAO,EAAE,SAAS;AAC/B,CAAC,EACA,OAAO;AAEV,IAAM,qBAAqB,EACxB,OA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B,UAAU,QAAQ,MAAM;AACjD;;;AG5BO,SAAS,SAAS,UAAkB,QAAqB;AAC9D,SAAO,gBAAgB,UAAU,QAAQ,QAAQ,GAAG;AACtD;AAEO,SAAS,aAAa,UAAuB;AAClD,SAAO,oBAAoB,UAAU,QAAQ,GAAG;AAClD;;;ACNO,SAAS,WAAW,UAAkB,QAAuB;AAClE,SAAO,gBAAgB,UAAU,QAAQ,QAAQ,KAAK;AACxD;AAEO,SAAS,eAAe,UAAyB;AACtD,SAAO,oBAAoB,UAAU,QAAQ,KAAK;AACpD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/parser/common.ts","../../src/parser/schemas.ts","../../src/types.ts","../../src/parser/cmd.ts","../../src/parser/skill.ts","../../src/parser/intent.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport matter from \"gray-matter\";\nimport type { z } from \"zod\";\nimport { ParseError } from \"./schemas.js\";\n\nexport interface ParsedFile<T> {\n meta: T;\n body: string;\n sourcePath: string;\n}\n\nexport function parseWithSchema<T extends z.ZodTypeAny>(\n filePath: string,\n source: string,\n schema: T,\n): ParsedFile<z.infer<T>> {\n const parsed = matter(source);\n const result = schema.safeParse(parsed.data);\n if (!result.success) {\n throw new ParseError(filePath, result.error.issues);\n }\n return {\n meta: result.data,\n body: parsed.content.trim(),\n sourcePath: filePath,\n };\n}\n\nexport function parseFileWithSchema<T extends z.ZodTypeAny>(\n filePath: string,\n schema: T,\n): ParsedFile<z.infer<T>> {\n const source = readFileSync(filePath, \"utf8\");\n return parseWithSchema(filePath, source, schema);\n}\n","import { z } from \"zod\";\nimport { CAPABILITIES, ENGINES } from \"../types.js\";\n\nconst IdSchema = z\n .string()\n .min(1)\n .regex(/^[a-z][a-z0-9-]*$/, \"id must be kebab-case (lowercase + digits + hyphens)\");\n\nconst SkillFrontmatterSchema = z\n .object({\n id: IdSchema,\n description: z.string().min(1),\n engines: z.array(z.enum(ENGINES)).min(1).optional(),\n requires: z.array(z.enum(CAPABILITIES)).optional(),\n tags: z.array(z.string()).optional(),\n })\n .strict();\n\nexport type SkillFrontmatter = z.infer<typeof SkillFrontmatterSchema>;\n\nconst CmdArgEnumSchema = z\n .object({\n name: z.string().min(1),\n type: z.literal(\"enum\"),\n values: z.array(z.string()).min(1),\n default: z.string().optional(),\n /** False when the command runs without the argument. Defaults to true. */\n required: z.boolean().optional(),\n })\n .strict();\n\nconst CmdArgStringSchema = z\n .object({\n name: z.string().min(1),\n type: z.literal(\"string\"),\n default: z.string().optional(),\n /** False when the command runs without the argument. Defaults to true. */\n required: z.boolean().optional(),\n })\n .strict();\n\nconst CmdArgSchema = z.discriminatedUnion(\"type\", [CmdArgEnumSchema, CmdArgStringSchema]);\n\nexport type CmdArg = z.infer<typeof CmdArgSchema>;\n\nconst CmdFrontmatterSchema = z\n .object({\n id: IdSchema,\n trigger: z.string().regex(/^\\/[a-z][a-z0-9-]*$/, \"trigger must be /kebab-case\"),\n invokes_skill: IdSchema,\n args: z.array(CmdArgSchema).optional(),\n description: z.string().min(1),\n })\n .strict();\n\nexport type CmdFrontmatter = z.infer<typeof CmdFrontmatterSchema>;\n\nexport const INTENT_STATUSES = [\"proposed\", \"implemented\", \"deprecated\"] as const;\nexport type IntentStatus = (typeof INTENT_STATUSES)[number];\n\n// gray-matter parses a bare YAML date (`2026-11-09`) into a Date object.\nconst IntentFrontmatterSchema = z\n .object({\n title: z.string().min(1),\n status: z.enum(INTENT_STATUSES),\n actors: z.array(z.string().min(1)).min(1),\n spec: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),\n last_reviewed: z.union([z.date(), z.string().min(1)]),\n })\n .strict();\n\nexport type IntentFrontmatter = z.infer<typeof IntentFrontmatterSchema>;\n\nexport const Schemas = {\n Skill: SkillFrontmatterSchema,\n Cmd: CmdFrontmatterSchema,\n Intent: IntentFrontmatterSchema,\n} as const;\n\nexport class ParseError extends Error {\n constructor(\n public readonly file: string,\n public readonly issues: z.ZodIssue[],\n ) {\n const messages = issues\n .map((i) => ` - ${i.path.join(\".\") || \"<root>\"}: ${i.message}`)\n .join(\"\\n\");\n super(`Frontmatter validation failed for ${file}:\\n${messages}`);\n this.name = \"ParseError\";\n }\n}\n","export const ENGINES = [\"claude-code\", \"codex-cli\", \"opencode\"] as const;\nexport type Engine = (typeof ENGINES)[number];\n\nexport const ENGINE_ROOT_DIR: Record<Engine, string> = {\n \"claude-code\": \".claude\",\n \"codex-cli\": \".codex\",\n opencode: \".opencode\",\n};\n\nexport const CAPABILITIES = [\"multi-step\", \"slash-command\", \"inline-exec\"] as const;\nexport type Capability = (typeof CAPABILITIES)[number];\n\nexport interface RenderedFile {\n path: string;\n content: string;\n}\n\nexport interface CapabilitiesMatrix {\n [engine: string]: ReadonlyArray<Capability>;\n}\n\nexport const CAPABILITIES_MATRIX: Record<Engine, ReadonlyArray<Capability>> = {\n \"claude-code\": [\"multi-step\", \"slash-command\", \"inline-exec\"],\n \"codex-cli\": [\"multi-step\", \"slash-command\", \"inline-exec\"],\n opencode: [\"multi-step\", \"slash-command\", \"inline-exec\"],\n};\n\nexport const DEGRADED_CAPABILITIES: Partial<Record<Engine, ReadonlyArray<Capability>>> = {\n \"codex-cli\": [\"multi-step\"],\n};\n\nexport function engineSupports(engine: Engine, capability: Capability): boolean {\n return CAPABILITIES_MATRIX[engine].includes(capability);\n}\n","import { parseFileWithSchema, parseWithSchema } from \"./common.js\";\nimport type { ParsedFile } from \"./common.js\";\nimport { type CmdFrontmatter, Schemas } from \"./schemas.js\";\n\nexport type Cmd = ParsedFile<CmdFrontmatter>;\n\nexport function parseCmd(filePath: string, source: string): Cmd {\n return parseWithSchema(filePath, source, Schemas.Cmd);\n}\n\nexport function parseCmdFile(filePath: string): Cmd {\n return parseFileWithSchema(filePath, Schemas.Cmd);\n}\n","import { parseFileWithSchema, parseWithSchema } from \"./common.js\";\nimport type { ParsedFile } from \"./common.js\";\nimport { Schemas, type SkillFrontmatter } from \"./schemas.js\";\n\nexport type Skill = ParsedFile<SkillFrontmatter>;\n\nexport function parseSkill(filePath: string, source: string): Skill {\n return parseWithSchema(filePath, source, Schemas.Skill);\n}\n\nexport function parseSkillFile(filePath: string): Skill {\n return parseFileWithSchema(filePath, Schemas.Skill);\n}\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport matter from \"gray-matter\";\nimport { INTENT_STATUSES, type IntentFrontmatter, type IntentStatus, Schemas } from \"./schemas.js\";\n\n/** The optional intents pillar (docs/spec/coding-agent-harness.md §9.1.3). */\nexport const INTENTS_DIR = \"docs/intents\";\n/** The generated index of the pillar; never an intent file. */\nexport const INTENTS_INDEX_PATH = `${INTENTS_DIR}/README.md`;\n\nexport const NODE_FIELDS = [\n \"status\",\n \"spec\",\n \"anchors\",\n \"acceptance\",\n \"requires\",\n \"creates\",\n] as const;\nexport type NodeField = (typeof NODE_FIELDS)[number];\n/** Fields only a terminal intent (a node with no sub-intent) may carry. */\nexport const TERMINAL_FIELDS: ReadonlyArray<NodeField> = [\n \"anchors\",\n \"acceptance\",\n \"requires\",\n \"creates\",\n];\n\nexport interface IntentError {\n line?: number;\n message: string;\n}\n\nexport interface IntentNode {\n title: string;\n /** Heading depth minus one: `##` is level 1. */\n level: number;\n /** 1-based line of the heading in the file. */\n line: number;\n /** Index of the parent node in `nodes`, absent for a level-1 node. */\n parent?: number;\n /** True when the node has no sub-intent: a terminal intent. */\n isTerminal: boolean;\n /** Line of each known field the node declares. */\n fieldLines: Partial<Record<NodeField, number>>;\n status?: IntentStatus;\n spec?: string;\n anchors: string[];\n acceptance: string[];\n requires: string[];\n creates: string[];\n unknownFields: Array<{ key: string; line: number }>;\n /** Nearest `status:` up the tree, else the file status. */\n effectiveStatus?: IntentStatus;\n}\n\nexport interface IntentFile {\n meta?: IntentFrontmatter;\n title: string;\n statement?: string;\n nodes: IntentNode[];\n errors: IntentError[];\n}\n\nexport interface ParsedIntentFile extends IntentFile {\n /** Path from the repo root, e.g. `docs/intents/harness-a-project.md`. */\n path: string;\n /** File name, e.g. `harness-a-project.md`. */\n file: string;\n}\n\n/** Stands for a line of fenced code: not blank, not a field, not a heading. */\nconst MASKED_LINE = \"\\u0000\";\nconst FENCE_RE = /^ {0,3}(`{3,}|~{3,})/;\nconst HEADING_RE = /^(#{1,6})[ \\t]+(.+?)(?:[ \\t]+#+)?[ \\t]*$/;\nconst FIELD_RE = /^([a-z][a-z-]*):\\s*(.*)$/;\nconst LIST_ITEM_RE = /^\\s*-\\s+(.*)$/;\n\n/** Replaces every line of fenced code (fences included), keeping line numbers. */\nexport function maskFencedCode(lines: ReadonlyArray<string>): string[] {\n let fence: string | undefined;\n return lines.map((line) => {\n const m = FENCE_RE.exec(line);\n if (fence !== undefined) {\n if (m?.[1] && m[1][0] === fence[0] && m[1].length >= fence.length) fence = undefined;\n return MASKED_LINE;\n }\n if (m?.[1]) {\n fence = m[1];\n return MASKED_LINE;\n }\n return line;\n });\n}\n\nexport function parseHeading(line: string): { depth: number; title: string } | undefined {\n const m = HEADING_RE.exec(line);\n if (!m?.[1] || !m[2]) return undefined;\n return { depth: m[1].length, title: m[2] };\n}\n\nfunction splitList(value: string): string[] {\n return value\n .split(\",\")\n .map((v) => v.trim())\n .filter(Boolean);\n}\n\n/** Index of the first body line, after the frontmatter block when there is one. */\nfunction bodyStart(lines: ReadonlyArray<string>): number {\n if (lines[0]?.trim() !== \"---\") return 0;\n for (let i = 1; i < lines.length; i++) {\n const l = lines[i]?.trim();\n if (l === \"---\" || l === \"...\") return i + 1;\n }\n return lines.length;\n}\n\nfunction parseFrontmatter(text: string, errors: IntentError[]): IntentFrontmatter | undefined {\n let data: Record<string, unknown>;\n try {\n data = matter(text).data;\n } catch (error) {\n const reason = error instanceof Error ? error.message.split(\"\\n\")[0] : String(error);\n errors.push({ line: 1, message: `invalid frontmatter YAML: ${reason}` });\n return undefined;\n }\n const result = Schemas.Intent.safeParse(data);\n if (result.success) return result.data;\n for (const issue of result.error.issues) {\n const where = issue.path.length ? ` \\`${issue.path.join(\".\")}\\`` : \"\";\n errors.push({ line: 1, message: `frontmatter${where}: ${issue.message}` });\n }\n return undefined;\n}\n\nfunction newNode(title: string, level: number, line: number): IntentNode {\n return {\n title,\n level,\n line,\n isTerminal: true,\n fieldLines: {},\n anchors: [],\n acceptance: [],\n requires: [],\n creates: [],\n unknownFields: [],\n };\n}\n\n/** Reads the field block directly under a heading, up to its first non-field line. */\nfunction parseFields(\n node: IntentNode,\n lines: ReadonlyArray<string>,\n from: number,\n to: number,\n errors: IntentError[],\n): void {\n let lastKey: string | undefined;\n for (let i = from; i < to; i++) {\n const line = lines[i] ?? \"\";\n if (line.trim() === \"\") continue;\n const lineNo = i + 1;\n const field = FIELD_RE.exec(line.trimEnd());\n if (field?.[1] !== undefined) {\n const key = field[1];\n const value = (field[2] ?? \"\").trim();\n lastKey = key;\n if (!(NODE_FIELDS as ReadonlyArray<string>).includes(key)) {\n node.unknownFields.push({ key, line: lineNo });\n continue;\n }\n const known = key as NodeField;\n node.fieldLines[known] = lineNo;\n if (known === \"status\") {\n if ((INTENT_STATUSES as ReadonlyArray<string>).includes(value)) {\n node.status = value as IntentStatus;\n } else {\n errors.push({\n line: lineNo,\n message: `invalid status \\`${value}\\` (expected ${INTENT_STATUSES.join(\" | \")})`,\n });\n }\n } else if (known === \"spec\") {\n node.spec = value;\n } else if (known === \"acceptance\") {\n if (value) node.acceptance.push(value);\n } else {\n node[known] = splitList(value);\n }\n continue;\n }\n const item = LIST_ITEM_RE.exec(line);\n if (lastKey === \"acceptance\" && item) {\n const text = (item[1] ?? \"\").trim();\n if (text) node.acceptance.push(text);\n continue;\n }\n return;\n }\n}\n\n/**\n * Parses one intent file (docs/spec/coding-agent-harness.md §9.1.3). Never\n * throws: frontmatter and node problems are collected in `errors` and the\n * nodes are parsed regardless, so a linter reports everything at once.\n */\nexport function parseIntentFile(relPath: string, text: string): IntentFile {\n const errors: IntentError[] = [];\n const meta = parseFrontmatter(text, errors);\n const lines = maskFencedCode(text.split(/\\r?\\n/));\n const start = bodyStart(lines);\n\n const headings: Array<{ index: number; depth: number; title: string }> = [];\n for (let i = start; i < lines.length; i++) {\n const h = parseHeading(lines[i] ?? \"\");\n if (h) headings.push({ index: i, ...h });\n }\n\n const h1 = headings.find((h) => h.depth === 1);\n let statement: string | undefined;\n if (h1) {\n const paragraph: string[] = [];\n for (let i = h1.index + 1; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n if (line.trim() === \"\") {\n if (paragraph.length) break;\n continue;\n }\n if (line === MASKED_LINE || parseHeading(line)) break;\n paragraph.push(line.trim());\n }\n if (paragraph.length) statement = paragraph.join(\" \");\n }\n\n const nodes: IntentNode[] = [];\n const stack: number[] = [];\n for (const [k, h] of headings.entries()) {\n if (h.depth < 2) continue;\n const node = newNode(h.title, h.depth - 1, h.index + 1);\n while (stack.length) {\n const top = nodes[stack[stack.length - 1] as number];\n if (top && top.level < node.level) break;\n stack.pop();\n }\n const parentIndex = stack[stack.length - 1];\n if (parentIndex !== undefined) {\n node.parent = parentIndex;\n const parent = nodes[parentIndex];\n if (parent) parent.isTerminal = false;\n }\n const next = headings[k + 1];\n parseFields(node, lines, h.index + 1, next ? next.index : lines.length, errors);\n const inherited =\n parentIndex !== undefined ? nodes[parentIndex]?.effectiveStatus : meta?.status;\n node.effectiveStatus = node.status ?? inherited;\n stack.push(nodes.length);\n nodes.push(node);\n }\n\n const title = meta?.title ?? h1?.title ?? basename(relPath, \".md\");\n return { ...(meta ? { meta } : {}), title, ...(statement ? { statement } : {}), nodes, errors };\n}\n\n/** Intent files: `docs/intents/*.md` minus the generated index, sorted by file name. */\nexport function listIntentFiles(targetDir: string): string[] {\n const dir = join(targetDir, INTENTS_DIR);\n if (!existsSync(dir) || !statSync(dir).isDirectory()) return [];\n return readdirSync(dir)\n .filter((f) => f.endsWith(\".md\") && f !== \"README.md\")\n .filter((f) => statSync(join(dir, f)).isFile())\n .sort();\n}\n\n/** Parses every intent file without throwing; linters read their `errors`. */\nexport function readIntentFiles(targetDir: string): ParsedIntentFile[] {\n return listIntentFiles(targetDir).map((file) => {\n const path = `${INTENTS_DIR}/${file}`;\n const text = readFileSync(join(targetDir, path), \"utf8\");\n return { path, file, ...parseIntentFile(path, text) };\n });\n}\n\n/**\n * The intent files the render needs. One that does not parse fails the\n * render, like an invalid project skill: `init`, `update` and\n * `lint:generated-fresh` report it.\n */\nexport function loadIntentFiles(targetDir: string): ParsedIntentFile[] {\n const intentFiles = readIntentFiles(targetDir);\n const problems = intentFiles.flatMap((j) =>\n j.errors.map((e) => ` - ${j.path}${e.line !== undefined ? `:${e.line}` : \"\"}: ${e.message}`),\n );\n if (problems.length) {\n throw new Error(\n `invalid intents (run \\`npx @vaubaan/harness lint --pillar intents\\`):\\n${problems.join(\"\\n\")}`,\n );\n }\n return intentFiles;\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,OAAO,YAAY;;;ACDnB,SAAS,SAAS;;;ACAX,IAAM,UAAU,CAAC,eAAe,aAAa,UAAU;AASvD,IAAM,eAAe,CAAC,cAAc,iBAAiB,aAAa;;;ADNzE,IAAM,WAAW,EACd,OAAO,EACP,IAAI,CAAC,EACL,MAAM,qBAAqB,sDAAsD;AAEpF,IAAM,yBAAyB,EAC5B,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC7B,SAAS,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EAClD,UAAU,EAAE,MAAM,EAAE,KAAK,YAAY,CAAC,EAAE,SAAS;AAAA,EACjD,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AACrC,CAAC,EACA,OAAO;AAIV,IAAM,mBAAmB,EACtB,OAAO;AAAA,EACN,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE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skill, Cmd, ParsedIntentFile } from './parser/index.js';
|
|
2
2
|
|
|
3
3
|
declare const ENGINES: readonly ["claude-code", "codex-cli", "opencode"];
|
|
4
4
|
type Engine = (typeof ENGINES)[number];
|
|
@@ -22,6 +22,8 @@ interface RenderInput {
|
|
|
22
22
|
projectSkills?: ReadonlyArray<Skill>;
|
|
23
23
|
/** True when the target project ships `docs/quality/code-quality.md` (optional pillar). */
|
|
24
24
|
hasQualityDoc?: boolean;
|
|
25
|
+
/** The project's parsed `docs/intents/*.md` (optional pillar); renders their index. */
|
|
26
|
+
intentFiles?: ReadonlyArray<ParsedIntentFile>;
|
|
25
27
|
}
|
|
26
28
|
interface RenderOutput {
|
|
27
29
|
files: RenderedFile[];
|
package/dist/render.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './parser/index.js';
|
|
2
|
-
export { H as Harness, a as HarnessOverrides, R as RenderError, b as RenderInput, c as RenderOutput, e as applyOverrides, r as render } from './render-
|
|
2
|
+
export { H as Harness, a as HarnessOverrides, R as RenderError, b as RenderInput, c as RenderOutput, e as applyOverrides, r as render } from './render-CTx7VNOK.js';
|
|
3
3
|
import 'zod';
|