vigiles 30.0.1 → 31.0.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.
@@ -169,7 +169,7 @@ function validateCommandRef(command, basePath) {
169
169
  }
170
170
  return null;
171
171
  }
172
- function validateSymbolRef(file, name, basePath) {
172
+ async function validateSymbolRef(file, name, basePath) {
173
173
  const full = (0, node_path_1.resolve)(basePath, file);
174
174
  if (!(0, node_fs_1.existsSync)(full)) {
175
175
  return {
@@ -178,7 +178,7 @@ function validateSymbolRef(file, name, basePath) {
178
178
  path: file,
179
179
  };
180
180
  }
181
- const support = (0, symbols_js_1.langForFile)(file);
181
+ const support = await (0, symbols_js_1.langForFile)(file);
182
182
  if (support.kind === "unsupported") {
183
183
  return {
184
184
  type: "stale-ref",
@@ -186,16 +186,16 @@ function validateSymbolRef(file, name, basePath) {
186
186
  path: file,
187
187
  };
188
188
  }
189
- if (support.kind === "grammar-missing") {
190
- // The language is parseable by this tool; the optional grammar is absent in THIS install.
189
+ if (support.kind === "grammar-load-failed") {
190
+ // The language is parseable by this tool; its grammar failed to load in THIS process.
191
191
  // Distinct wording on purpose — see the union's docblock in core/symbols.ts.
192
192
  return {
193
193
  type: "stale-ref",
194
- message: `Symbol not checked: the ${support.id} grammar is not installed (npm i -D ${support.pkg})`,
194
+ message: (0, symbols_js_1.notCheckedReason)(support),
195
195
  path: file,
196
196
  };
197
197
  }
198
- if (!(0, symbols_js_1.fileDefinesSymbol)(full, name)) {
198
+ if (!(await (0, symbols_js_1.fileDefinesSymbol)(full, name))) {
199
199
  return {
200
200
  type: "stale-ref",
201
201
  message: `"${name}" is not defined in ${file}`,
@@ -235,18 +235,18 @@ function validateGlobRef(pattern, basePath) {
235
235
  }
236
236
  return null;
237
237
  }
238
- function validateRefs(fragments, basePath) {
238
+ async function validateRefs(fragments, basePath) {
239
239
  const errors = [];
240
240
  for (const fragment of fragments) {
241
241
  if (typeof fragment !== "string") {
242
- errors.push(...validateOneRef(fragment, basePath));
242
+ errors.push(...(await validateOneRef(fragment, basePath)));
243
243
  }
244
244
  }
245
245
  return errors;
246
246
  }
247
247
  const wrap = (e) => (e ? [e] : []);
248
248
  /** Validate a single non-string fragment (a `Ref` or `EffectRegion`). */
249
- function validateOneRef(r, basePath) {
249
+ async function validateOneRef(r, basePath) {
250
250
  switch (r._ref) {
251
251
  case "file":
252
252
  return wrap(validateFileRef(r.path, basePath));
@@ -263,7 +263,7 @@ function validateOneRef(r, basePath) {
263
263
  ]
264
264
  : [];
265
265
  case "symbol":
266
- return wrap(validateSymbolRef(r.file, r.symbol, basePath));
266
+ return wrap(await validateSymbolRef(r.file, r.symbol, basePath));
267
267
  case "dir":
268
268
  return wrap(validateDirRef(r.path, basePath));
269
269
  case "glob":
@@ -448,7 +448,7 @@ const RESERVED_SECTION_KEYS = new Set([
448
448
  "key_files",
449
449
  "rules",
450
450
  ]);
451
- function compileSectionsSection(spec, basePath, maxSectionLines) {
451
+ async function compileSectionsSection(spec, basePath, maxSectionLines) {
452
452
  if (!spec.sections)
453
453
  return { lines: [], errors: [] };
454
454
  const lines = [];
@@ -467,7 +467,7 @@ function compileSectionsSection(spec, basePath, maxSectionLines) {
467
467
  lines.push(`## ${heading}\n\n${content.trim()}`);
468
468
  }
469
469
  else {
470
- errors.push(...validateRefs(content, basePath));
470
+ errors.push(...(await validateRefs(content, basePath)));
471
471
  const rendered = content.map(renderFragment).join("");
472
472
  errors.push(...validateSectionContent(name, rendered, maxSectionLines));
473
473
  lines.push(`## ${heading}\n\n${rendered.trim()}`);
@@ -581,7 +581,7 @@ function compileRulesSection(spec, basePath, options) {
581
581
  // (no frontmatter), so Codex/OpenCode reuse it unchanged — only the h1 target
582
582
  // differs, which already comes from the injected dialect. Nothing here is
583
583
  // CC-only, so there is no per-dialect branch to gate.
584
- function compileClaude(spec, options = {}) {
584
+ async function compileClaude(spec, options = {}) {
585
585
  const targets = spec.target ?? options.dialect?.instructionTargets[0] ?? DEFAULT_TARGET;
586
586
  const target = Array.isArray(targets) ? targets[0] : targets;
587
587
  const basePath = options.basePath ?? process.cwd();
@@ -614,7 +614,7 @@ function compileClaude(spec, options = {}) {
614
614
  }
615
615
  // Per-spec maxSectionLines takes precedence, then compile options
616
616
  const maxSectionLines = spec.maxSectionLines ?? options.maxSectionLines;
617
- const prose = compileSectionsSection(spec, basePath, maxSectionLines);
617
+ const prose = await compileSectionsSection(spec, basePath, maxSectionLines);
618
618
  const keyFiles = compileKeyFilesSection(spec, basePath);
619
619
  const commands = compileCommandsSection(spec, basePath);
620
620
  const rules = compileRulesSection(spec, basePath, options);
@@ -902,7 +902,7 @@ function checkInlineCode(markdown, max) {
902
902
  /**
903
903
  * Compile a SkillSpec into SKILL.md markdown with YAML frontmatter.
904
904
  */
905
- function compileSkill(spec, options = {}) {
905
+ async function compileSkill(spec, options = {}) {
906
906
  // 🔴 NORMALISE FIRST, before anything reads the spec. `compileSkill` accepts a
907
907
  // `SkillSpec` STRUCTURALLY, so a caller can hand us `{ _specType: "skill", …,
908
908
  // result: cmd(…) }` without ever touching `experimental_skill()`. Both readers
@@ -931,7 +931,7 @@ function compileSkill(spec, options = {}) {
931
931
  });
932
932
  }
933
933
  }
934
- errors.push(...validateRefs(collectSkillRefs(spec), basePath));
934
+ errors.push(...(await validateRefs(collectSkillRefs(spec), basePath)));
935
935
  // A typed `output` Result contract is valid ONLY for a forked skill: an inline
936
936
  // skill has no call→return boundary, so a typed outcome there is a category
937
937
  // error (see research/spec-syntax-and-railway-scope.md). Enforce it at compile.
@@ -1063,7 +1063,7 @@ function purityMarker(purity) {
1063
1063
  return `<!-- vigiles:purity:${level} -->`;
1064
1064
  }
1065
1065
  /** Render the subagent's named `##` system-prompt sections (verified like CLAUDE.md). */
1066
- function renderAgentSections(sections, basePath) {
1066
+ async function renderAgentSections(sections, basePath) {
1067
1067
  const lines = [];
1068
1068
  const errors = [];
1069
1069
  for (const [name, content] of Object.entries(sections)) {
@@ -1079,7 +1079,7 @@ function renderAgentSections(sections, basePath) {
1079
1079
  lines.push(`## ${heading}\n\n${content.trim()}`);
1080
1080
  }
1081
1081
  else {
1082
- errors.push(...validateRefs(content, basePath));
1082
+ errors.push(...(await validateRefs(content, basePath)));
1083
1083
  const rendered = content.map(renderFragment).join("");
1084
1084
  errors.push(...validateSectionContent(name, rendered));
1085
1085
  lines.push(`## ${heading}\n\n${rendered.trim()}`);
@@ -1134,7 +1134,7 @@ function renderAgentRules(rules) {
1134
1134
  * Verifies the tool contract and the body's references; the marks the body
1135
1135
  * carries (`vigiles:symbol`, file/cmd refs) are the same ones `lint` re-checks.
1136
1136
  */
1137
- function compileAgent(spec, options) {
1137
+ async function compileAgent(spec, options) {
1138
1138
  const basePath = options.basePath ?? process.cwd();
1139
1139
  const specFile = options.specFile ?? "agent.md.spec.ts";
1140
1140
  const dialect = options.dialect;
@@ -1169,13 +1169,13 @@ function compileAgent(spec, options) {
1169
1169
  }
1170
1170
  }
1171
1171
  if (Array.isArray(spec.body)) {
1172
- errors.push(...validateRefs(spec.body, basePath));
1172
+ errors.push(...(await validateRefs(spec.body, basePath)));
1173
1173
  }
1174
1174
  const sections = [];
1175
1175
  if (spec.body !== undefined)
1176
1176
  sections.push(renderBody(spec.body).trim());
1177
1177
  if (spec.sections) {
1178
- const result = renderAgentSections(spec.sections, basePath);
1178
+ const result = await renderAgentSections(spec.sections, basePath);
1179
1179
  sections.push(...result.lines);
1180
1180
  errors.push(...result.errors);
1181
1181
  }
@@ -1287,7 +1287,7 @@ function checkFileHash(filePath) {
1287
1287
  * Compare a generated file against what the spec would produce.
1288
1288
  * Returns the diff so users can see what was manually changed.
1289
1289
  */
1290
- function adoptDiff(filePath, spec, basePath, dialect) {
1290
+ async function adoptDiff(filePath, spec, basePath, dialect) {
1291
1291
  const fullPath = (0, node_path_1.resolve)(basePath, filePath);
1292
1292
  const currentContent = (0, node_fs_1.existsSync)(fullPath)
1293
1293
  ? (0, node_fs_1.readFileSync)(fullPath, "utf-8")
@@ -1296,7 +1296,7 @@ function adoptDiff(filePath, spec, basePath, dialect) {
1296
1296
  // Compile the spec to get what it WOULD produce
1297
1297
  let compiledContent = null;
1298
1298
  if (spec._specType === "claude") {
1299
- const { markdown } = compileClaude(spec, {
1299
+ const { markdown } = await compileClaude(spec, {
1300
1300
  basePath,
1301
1301
  specFile: filePath,
1302
1302
  dialect,
@@ -1304,11 +1304,14 @@ function adoptDiff(filePath, spec, basePath, dialect) {
1304
1304
  compiledContent = markdown;
1305
1305
  }
1306
1306
  else if (spec._specType === "skill") {
1307
- const { markdown } = compileSkill(spec, { basePath, specFile: filePath });
1307
+ const { markdown } = await compileSkill(spec, {
1308
+ basePath,
1309
+ specFile: filePath,
1310
+ });
1308
1311
  compiledContent = markdown;
1309
1312
  }
1310
1313
  else if (spec._specType === "agent") {
1311
- const { markdown } = compileAgent(spec, {
1314
+ const { markdown } = await compileAgent(spec, {
1312
1315
  basePath,
1313
1316
  specFile: filePath,
1314
1317
  dialect,
@@ -69,20 +69,20 @@ export declare const vigilesConfigSchema: z.ZodObject<{
69
69
  checkboxes: "checkboxes";
70
70
  }>>>;
71
71
  rules: z.ZodPrefault<z.ZodObject<{
72
- "spec-refs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
73
- "orphan-docs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
74
- "duplicate-rules": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
75
- "require-instructions-spec": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
76
- "require-skill-spec": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
77
- integrity: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
78
- coverage: z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
72
+ "spec-refs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
73
+ "orphan-docs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
74
+ "duplicate-rules": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
75
+ "require-instructions-spec": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
76
+ "require-skill-spec": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
77
+ integrity: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
78
+ coverage: z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
79
79
  linterRules: z.ZodOptional<z.ZodNumber>;
80
80
  scripts: z.ZodOptional<z.ZodNumber>;
81
81
  }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
82
82
  linterRules: z.ZodOptional<z.ZodNumber>;
83
83
  scripts: z.ZodOptional<z.ZodNumber>;
84
84
  }, z.core.$strict>], null>]>>;
85
- "untested-skill": z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
85
+ "untested-skill": z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
86
86
  include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
87
87
  exclude: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
88
88
  testExtension: z.ZodOptional<z.ZodString>;
@@ -91,7 +91,7 @@ export declare const vigilesConfigSchema: z.ZodObject<{
91
91
  exclude: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
92
92
  testExtension: z.ZodOptional<z.ZodString>;
93
93
  }, z.core.$strict>], null>]>>;
94
- "untested-subagent": z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
94
+ "untested-subagent": z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
95
95
  include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
96
96
  exclude: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
97
97
  testExtension: z.ZodOptional<z.ZodString>;
@@ -100,7 +100,7 @@ export declare const vigilesConfigSchema: z.ZodObject<{
100
100
  exclude: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
101
101
  testExtension: z.ZodOptional<z.ZodString>;
102
102
  }, z.core.$strict>], null>]>>;
103
- "untested-hook": z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
103
+ "untested-hook": z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
104
104
  include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
105
105
  exclude: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
106
106
  testExtension: z.ZodOptional<z.ZodString>;
@@ -109,28 +109,28 @@ export declare const vigilesConfigSchema: z.ZodObject<{
109
109
  exclude: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
110
110
  testExtension: z.ZodOptional<z.ZodString>;
111
111
  }, z.core.$strict>], null>]>>;
112
- "unmarked-refs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
113
- "subagent-tool-contract": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
114
- "hook-events": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
115
- "subagent-frontmatter": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
116
- "mcp-config": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
117
- "skill-frontmatter": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
118
- "mcp-tool-resolves": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
119
- "hook-script-exists": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
120
- "prefer-compiled-hooks": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
121
- "disallowed-tools-contract": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
122
- "description-overlap": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
123
- "skill-description-budget": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
124
- "frontmatter-valid": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
125
- "mcp-hook-target-resolves": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
126
- "lethal-trifecta": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
127
- "skill-resource-resolves": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
128
- "skill-missing-fence": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
129
- "plugin-dir-layout": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
130
- "delegation-trifecta": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
131
- "hook-block-ineffective": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
132
- "hook-matcher": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
133
- "doc-refs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "off" | "warn" | "error">>>;
112
+ "unmarked-refs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
113
+ "subagent-tool-contract": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
114
+ "hook-events": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
115
+ "subagent-frontmatter": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
116
+ "mcp-config": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
117
+ "skill-frontmatter": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
118
+ "mcp-tool-resolves": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
119
+ "hook-script-exists": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
120
+ "prefer-compiled-hooks": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
121
+ "disallowed-tools-contract": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
122
+ "description-overlap": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
123
+ "skill-description-budget": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
124
+ "frontmatter-valid": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
125
+ "mcp-hook-target-resolves": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
126
+ "lethal-trifecta": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
127
+ "skill-resource-resolves": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
128
+ "skill-missing-fence": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
129
+ "plugin-dir-layout": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
130
+ "delegation-trifecta": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
131
+ "hook-block-ineffective": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
132
+ "hook-matcher": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
133
+ "doc-refs": z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"warn">, z.ZodLiteral<"error">, z.ZodLiteral<false>, z.ZodLiteral<"off">, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<true>]>, z.ZodTransform<false | "warn" | "error", boolean | 0 | 1 | 2 | "warn" | "error" | "off">>>;
134
134
  }, z.core.$strict>>;
135
135
  files: z.ZodDefault<z.ZodArray<z.ZodString>>;
136
136
  maxRules: z.ZodOptional<z.ZodNumber>;
@@ -26,7 +26,7 @@ export declare function symbolRefs(markdown: string): SymbolRef[];
26
26
  * file must exist and define the named symbol. `basePath` is the directory the
27
27
  * paths resolve against (the instruction file's own directory).
28
28
  */
29
- export declare function verifySymbolRefs(markdown: string, basePath: string): SymbolRefError[];
29
+ export declare function verifySymbolRefs(markdown: string, basePath: string): Promise<SymbolRefError[]>;
30
30
  /**
31
31
  * Whether a span is a **linter-rule reference** that ought to be marked
32
32
  * (`enforce()` / inline `<!-- vigiles:enforce -->`) so the lint can verify the
@@ -50,7 +50,7 @@ export declare function unmarkedCodeRefs(markdown: string): Span[];
50
50
  * code-shaped span that ought to be a mark. The shared detector behind both the
51
51
  * `vigiles refs` CLI and the PostToolUse refs-hook.
52
52
  */
53
- export declare function collectRefIssues(markdown: string, basePath: string): string[];
53
+ export declare function collectRefIssues(markdown: string, basePath: string): Promise<string[]>;
54
54
  /** What the refs-hook should do given the issue count and configured severity. */
55
55
  export type RefsHookAction = "ok" | "nudge" | "block";
56
56
  /**
package/dist/core/refs.js CHANGED
@@ -70,11 +70,11 @@ function symbolRefs(markdown) {
70
70
  * file must exist and define the named symbol. `basePath` is the directory the
71
71
  * paths resolve against (the instruction file's own directory).
72
72
  */
73
- function verifySymbolRefs(markdown, basePath) {
73
+ async function verifySymbolRefs(markdown, basePath) {
74
74
  const errors = [];
75
75
  for (const ref of symbolRefs(markdown)) {
76
76
  const full = (0, node_path_1.resolve)(basePath, ref.file);
77
- const support = (0, symbols_js_1.langForFile)(ref.file);
77
+ const support = await (0, symbols_js_1.langForFile)(ref.file);
78
78
  if (!(0, node_fs_1.existsSync)(full)) {
79
79
  errors.push({ ...ref, reason: `File not found: "${ref.file}"` });
80
80
  }
@@ -84,15 +84,12 @@ function verifySymbolRefs(markdown, basePath) {
84
84
  reason: `Unsupported language for symbol check: "${ref.file}"`,
85
85
  });
86
86
  }
87
- else if (support.kind === "grammar-missing") {
88
- // NOT "unsupported": the language is one this tool parses, the optional grammar just is
89
- // not installed here. Saying it the other way would report an un-run check as a verdict.
90
- errors.push({
91
- ...ref,
92
- reason: `Symbol not checked: the ${support.id} grammar is not installed (npm i -D ${support.pkg})`,
93
- });
87
+ else if (support.kind === "grammar-load-failed") {
88
+ // NOT "unsupported" and NOT "not defined": the language is one this tool parses, its
89
+ // grammar failed to load here. Either other wording would report an un-run check as a verdict.
90
+ errors.push({ ...ref, reason: (0, symbols_js_1.notCheckedReason)(support) });
94
91
  }
95
- else if (!(0, symbols_js_1.fileDefinesSymbol)(full, ref.symbol)) {
92
+ else if (!(await (0, symbols_js_1.fileDefinesSymbol)(full, ref.symbol))) {
96
93
  errors.push({
97
94
  ...ref,
98
95
  reason: `"${ref.symbol}" is not defined in ${ref.file}`,
@@ -149,9 +146,9 @@ function unmarkedCodeRefs(markdown) {
149
146
  * code-shaped span that ought to be a mark. The shared detector behind both the
150
147
  * `vigiles refs` CLI and the PostToolUse refs-hook.
151
148
  */
152
- function collectRefIssues(markdown, basePath) {
149
+ async function collectRefIssues(markdown, basePath) {
153
150
  const out = [];
154
- for (const b of verifySymbolRefs(markdown, basePath)) {
151
+ for (const b of await verifySymbolRefs(markdown, basePath)) {
155
152
  out.push(`line ${String(b.line)}: ${b.reason}`);
156
153
  }
157
154
  for (const u of unmarkedCodeRefs(markdown)) {
package/dist/core/spec.js CHANGED
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ // 🔴 PUBLIC ENTRY POINT `vigiles/spec` — every export here is a promise to users. The default for a
3
+ // symbol is INTERNAL. It is exported only if (a) a NAMED external consumer uses it, or (b) it is
4
+ // a deliberate extension point listed in STABILITY.md (the adapter kit is the example). "Might
5
+ // be useful" is neither. Review point: the diff of `api-surface/vigiles-spec.api.md`, which
6
+ // `npm run api:check` fails on.
2
7
  /**
3
8
  * vigiles v2 — Executable specification system.
4
9
  *
@@ -1,30 +1,33 @@
1
1
  import { Lang } from "@ast-grep/napi";
2
- /** Which optional grammars this process actually has. Exported so a report can say so. */
3
- export declare function installedGrammars(): ReadonlySet<string>;
4
- /** A language key accepted by ast-grep's `parse` (core enum or registered id). */
5
- type LangKey = Lang | string;
2
+ import { type WasmLang } from "./tree-sitter-wasm.js";
3
+ /** A language key: an `@ast-grep/napi` built-in, or one of the WASM grammars. */
4
+ type LangKey = Lang | WasmLang;
6
5
  /**
7
6
  * Whether this file's language can be parsed HERE, and if not, which of the two reasons.
8
7
  *
9
- * 🔴 THE THREE CASES ARE SEPARATE MEMBERS BECAUSE THEY ARE SEPARATE FACTS. The previous
10
- * signature was `LangKey | null`, where `null` meant "extension not in the table" and callers
11
- * printed "Unsupported language for symbol check". Making the grammars optional would have
12
- * given that same `null` a second meaning — "the language IS ours, the package is simply not
13
- * installed" — and both callers would have kept printing the first sentence. That is the
14
- * failure this codebase exists to catch: a check that did not run, reported in the words of a
15
- * check that did. A union makes the compiler demand the distinction at every call site.
8
+ * 🔴 THE THREE CASES ARE SEPARATE MEMBERS BECAUSE THEY ARE SEPARATE FACTS. "Extension not in
9
+ * the table" and "the language IS ours but its grammar failed to load in this process" must not
10
+ * share one `null`: both callers would print the first sentence, and a check that did not run
11
+ * would read as a verdict. With WASM grammars shipped as a regular dependency there is no
12
+ * install or platform gap left, so `grammar-load-failed` should not happen — but if the runtime
13
+ * genuinely cannot load, the report carries the loader's own error text, never "not defined"
14
+ * and never an install instruction the user cannot act on.
16
15
  */
17
16
  export type LangSupport = {
18
17
  readonly kind: "ready";
19
18
  readonly lang: LangKey;
20
19
  } | {
21
- readonly kind: "grammar-missing";
22
- readonly id: string;
23
- readonly pkg: string;
20
+ readonly kind: "grammar-load-failed";
21
+ readonly lang: WasmLang;
22
+ readonly error: string;
24
23
  } | {
25
24
  readonly kind: "unsupported";
26
25
  };
27
- export declare function langForFile(file: string): LangSupport;
26
+ export declare function langForFile(file: string): Promise<LangSupport>;
27
+ /** The one sentence both callers print for a symbol reference that could not be checked. */
28
+ export declare function notCheckedReason(support: Extract<LangSupport, {
29
+ kind: "grammar-load-failed";
30
+ }>): string;
28
31
  /** A symbol definition found in a file. */
29
32
  export interface SymbolDef {
30
33
  /** The defined identifier, e.g. "parseConfig". */
@@ -36,10 +39,13 @@ export interface SymbolDef {
36
39
  /** 1-based line of the definition. */
37
40
  readonly line: number;
38
41
  }
39
- /** Extract the symbols defined in a single file's source. */
40
- export declare function definedSymbols(code: string, lang: LangKey): SymbolDef[];
42
+ /**
43
+ * Extract the symbols defined in a single file's source. Async because the Python / Ruby / Rust
44
+ * grammars are WebAssembly, whose instantiation is async; the napi languages resolve at once.
45
+ */
46
+ export declare function definedSymbols(code: string, lang: LangKey): Promise<SymbolDef[]>;
41
47
  /** Defined symbols for a file on disk, or [] if unreadable/unsupported. */
42
- export declare function definedSymbolsInFile(file: string): SymbolDef[];
48
+ export declare function definedSymbolsInFile(file: string): Promise<SymbolDef[]>;
43
49
  /**
44
50
  * Whether `file` defines a top-level (or scoped) symbol named `name`. This is
45
51
  * the whole check for a file-qualified reference (`path#symbol`): we parse the
@@ -47,6 +53,6 @@ export declare function definedSymbolsInFile(file: string): SymbolDef[];
47
53
  * fallback we also consult a co-located declaration file (`.rbi` / `.d.ts`), so
48
54
  * typed dynamic symbols resolve without running Sorbet / the TS compiler.
49
55
  */
50
- export declare function fileDefinesSymbol(file: string, name: string): boolean;
56
+ export declare function fileDefinesSymbol(file: string, name: string): Promise<boolean>;
51
57
  export {};
52
58
  //# sourceMappingURL=symbols.d.ts.map