vigiles 39.0.0 → 39.2.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.
Files changed (62) hide show
  1. package/action.yml +18 -0
  2. package/dist/adapters/claude-code/dialect.js +5 -0
  3. package/dist/audit-report.d.ts +14 -1
  4. package/dist/audit-report.js +21 -5
  5. package/dist/audit-report.template.html +33 -28
  6. package/dist/audit-score.d.ts +4 -1
  7. package/dist/audit-score.js +3 -1
  8. package/dist/audit-verdict.d.ts +3 -1
  9. package/dist/cli-flag-check.d.ts +1 -1
  10. package/dist/cli-flag-check.js +5 -1
  11. package/dist/cli-flags.d.ts +1 -1
  12. package/dist/cli-main.js +153 -72
  13. package/dist/core/CLAUDE.md.spec.js +2 -2
  14. package/dist/core/adopt.js +32 -8
  15. package/dist/core/apply-rules.d.ts +71 -0
  16. package/dist/core/apply-rules.js +48 -0
  17. package/dist/core/compile.d.ts +1 -1
  18. package/dist/core/compile.js +47 -14
  19. package/dist/core/config-migrations.d.ts +69 -0
  20. package/dist/core/config-migrations.js +145 -0
  21. package/dist/core/config-schema.d.ts +163 -187
  22. package/dist/core/config-schema.js +185 -345
  23. package/dist/core/dialect.d.ts +1 -1
  24. package/dist/core/dialect.js +2 -0
  25. package/dist/core/linter-adapter.d.ts +1 -1
  26. package/dist/core/presets.d.ts +31 -46
  27. package/dist/core/presets.js +25 -51
  28. package/dist/core/rule.d.ts +213 -0
  29. package/dist/core/rule.js +37 -0
  30. package/dist/core/skill-resources.d.ts +85 -15
  31. package/dist/core/skill-resources.js +63 -37
  32. package/dist/core/spec.d.ts +17 -0
  33. package/dist/core/types.d.ts +12 -314
  34. package/dist/core/validate.d.ts +13 -12
  35. package/dist/core/validate.js +29 -28
  36. package/dist/doc-commands.d.ts +2 -2
  37. package/dist/optimize.d.ts +2 -1
  38. package/dist/overrides.d.ts +13 -9
  39. package/dist/overrides.js +1 -1
  40. package/dist/rules/CLAUDE.md.spec.d.ts +3 -0
  41. package/dist/rules/CLAUDE.md.spec.js +22 -0
  42. package/dist/rules/groups.d.ts +32 -0
  43. package/dist/rules/groups.js +27 -0
  44. package/dist/rules/index.d.ts +412 -0
  45. package/dist/{core/rule-meta.js → rules/index.js} +301 -209
  46. package/dist/rules/skill-resource-resolves.d.ts +36 -0
  47. package/dist/rules/skill-resource-resolves.js +51 -0
  48. package/dist/run-hook.d.ts +1 -1
  49. package/dist/scan-core.d.ts +7 -9
  50. package/dist/scan-core.js +7 -10
  51. package/dist/scan-files.js +1 -4
  52. package/dist/scan.d.ts +11 -16
  53. package/dist/scan.js +31 -8
  54. package/dist/score-core.js +3 -9
  55. package/dist/setup-plan.d.ts +6 -26
  56. package/dist/setup-plan.js +27 -60
  57. package/dist/skill-harness.d.ts +3 -1
  58. package/dist/skill-harness.js +5 -2
  59. package/dist/vigilesrc.schema.json +18 -3
  60. package/package.json +2 -2
  61. package/packages/eslint-config/index.mjs +61 -0
  62. package/dist/core/rule-meta.d.ts +0 -94
@@ -17,17 +17,19 @@
17
17
  * happening inside the tool, so the shape is now DECLARED and anything outside
18
18
  * it is named out loud.
19
19
  *
20
- * THE TYPE IS DERIVED FROM THIS, not written beside it: `VigilesConfig` is
21
- * `z.infer<typeof vigilesConfigSchema>` (see `./types.ts`), so a field cannot
22
- * exist in the type and not in the validator, which is how `surfaceRoots` ended
23
- * up documented in `docs/cli.md` for a week after it stopped being read.
20
+ * THE TYPE IS DERIVED FROM THIS, not written beside it: `VigilesConfigOf` is
21
+ * the static keys' `z.output` plus the rule set's own entries (see `./types.ts`),
22
+ * so a field cannot exist in the type and not in the validator, which is how
23
+ * `surfaceRoots` ended up documented in `docs/cli.md` for a week after it
24
+ * stopped being read.
24
25
  *
25
- * DEFAULTS LIVE HERE TOO, and that is what makes the derivation exact. Every key
26
+ * THE RULES ARE A PARAMETER. The `rules` object, its defaults and the presets
27
+ * `extends` accepts are BUILT from the rule set a composition root hands to
28
+ * {@link configFor} — each rule declares its id, default and options schema in
29
+ * its own module (`src/rules/`), and this file names none of them. Every key
26
30
  * the loaded config is guaranteed to carry (`rules`, `files`, `ruleMarkers`)
27
- * carries a Zod `.default(...)`, and Zod's inferred OUTPUT type for a defaulted
28
- * field is non-optional — so `z.infer` reproduces the old
29
- * `rules: Required<RulesConfig>` exactly, rather than approximating it. Parsing
30
- * `{}` yields byte-for-byte the old `DEFAULT_CONFIG`.
31
+ * carries a Zod `.default(...)`, so parsing `{}` yields every rule at its
32
+ * shipped default (`src/rules/index.test.ts` pins that snapshot).
31
33
  *
32
34
  * ⚠️ ZOD COSTS ~45 ms TO IMPORT (measured, Zod 4.6.5), AND IT IS IMPORTED
33
35
  * NORMALLY — `src/core/validate.ts` has a top-level `import`, not a deferred
@@ -42,12 +44,23 @@
42
44
  * requires, against which 45 ms is ~13%.
43
45
  */
44
46
  import { z } from "zod";
47
+ import { type RuleGroups, type RuleSpec } from "./rule.js";
48
+ import type { RuleSeverity, RuleWithOptions } from "./types.js";
45
49
  /** The config file; the directory holding it is a project root. */
46
50
  export declare const PROJECT_CONFIG_FILE = ".vigilesrc.json";
47
- /** The rule names, for the "did you mean" on an unknown one. */
48
- export declare const RULE_NAMES: readonly string[];
49
51
  /**
50
- * ONE harness's entry in {@link vigilesConfigSchema}'s `harnesses`.
52
+ * A string, or a string ARRAY — coerced to an array.
53
+ *
54
+ * The bare-string case is the natural first-value mistake and it used to spread
55
+ * a string's CHARACTERS as globs: `"exclude": "bench"` became
56
+ * `["b","e","n","c","h"]`, which is a no-op at best and garbage `orphan` matches
57
+ * (`.`, `/`, `README.md`) at worst. Accepting it as a one-element array is what
58
+ * `asStringArray` did; the difference is that anything that is neither is now a
59
+ * schema error instead of a `console.warn` nobody reads.
60
+ */
61
+ export declare const stringList: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>;
62
+ /**
63
+ * ONE harness's entry in the config's `harnesses`.
51
64
  *
52
65
  * `.strict()` is load-bearing here specifically: the whole reason this key
53
66
  * exists is that a declaration which reaches nothing used to be silent, and
@@ -58,98 +71,21 @@ declare const harnessDeclarationSchema: z.ZodObject<{
58
71
  }, z.core.$strict>;
59
72
  /** The harness keys' value shape, exported so `types.ts` can derive the type. */
60
73
  export type HarnessDeclarationShape = z.infer<typeof harnessDeclarationSchema>;
74
+ /** What counts as a rule in markdown, by default: both constructs. */
75
+ export declare const DEFAULT_RULE_MARKERS: readonly ["headings", "checkboxes"];
61
76
  /**
62
- * The whole of `.vigilesrc.json`.
63
- *
64
- * `.strict()` at the top level is the check that did not exist: an unrecognized
65
- * key is now a named error with a suggestion, where it used to be spread into
66
- * the config object and never read.
77
+ * The keys of `.vigilesrc.json` that do not depend on the rule set, in the
78
+ * order the "Known: …" list prints them (it is capped, so the keys people
79
+ * misspell most come first). `rules`, `overrides` and `extends` are built from
80
+ * the rule set by {@link configFor} and slotted in around these.
67
81
  */
68
- export declare const vigilesConfigSchema: z.ZodObject<{
82
+ declare const configKeys: {
83
+ /** Which markdown constructs count as a rule — headings, checkboxes, or both. */
69
84
  ruleMarkers: z.ZodDefault<z.ZodArray<z.ZodEnum<{
70
85
  headings: "headings";
71
86
  checkboxes: "checkboxes";
72
87
  }>>>;
73
- rules: z.ZodPrefault<z.ZodObject<{
74
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
75
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
76
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
77
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
78
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
79
- 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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
80
- 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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
81
- linterRules: z.ZodOptional<z.ZodNumber>;
82
- scripts: z.ZodOptional<z.ZodNumber>;
83
- }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
84
- linterRules: z.ZodOptional<z.ZodNumber>;
85
- scripts: z.ZodOptional<z.ZodNumber>;
86
- }, z.core.$strict>], null>]>>;
87
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
88
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
89
- testExtension: z.ZodOptional<z.ZodString>;
90
- }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
91
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
92
- testExtension: z.ZodOptional<z.ZodString>;
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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
95
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
96
- testExtension: z.ZodOptional<z.ZodString>;
97
- }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
98
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
99
- testExtension: z.ZodOptional<z.ZodString>;
100
- }, z.core.$strict>], null>]>>;
101
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
102
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
103
- testExtension: z.ZodOptional<z.ZodString>;
104
- }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
105
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
106
- testExtension: z.ZodOptional<z.ZodString>;
107
- }, z.core.$strict>], null>]>>;
108
- "untested-output-style": 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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
109
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
110
- testExtension: z.ZodOptional<z.ZodString>;
111
- }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
112
- include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
113
- testExtension: z.ZodOptional<z.ZodString>;
114
- }, z.core.$strict>], null>]>>;
115
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
116
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
117
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
118
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
119
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
120
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
121
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
122
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
123
- "hand-written-hook": 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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
124
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
125
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
126
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
127
- "compile-budget": 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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
128
- maxEntryChars: z.ZodOptional<z.ZodNumber>;
129
- maxSectionChars: z.ZodOptional<z.ZodNumber>;
130
- maxRulesChars: z.ZodOptional<z.ZodNumber>;
131
- }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
132
- maxEntryChars: z.ZodOptional<z.ZodNumber>;
133
- maxSectionChars: z.ZodOptional<z.ZodNumber>;
134
- maxRulesChars: z.ZodOptional<z.ZodNumber>;
135
- }, z.core.$strict>], null>]>>;
136
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
137
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
138
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
139
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
140
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
141
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
142
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
143
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
144
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
145
- "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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
146
- "instruction-weight": 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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>, z.ZodTuple<[z.ZodLiteral<"warn">, z.ZodObject<{
147
- max: z.ZodOptional<z.ZodNumber>;
148
- }, z.core.$strict>], null>, z.ZodTuple<[z.ZodLiteral<"error">, z.ZodObject<{
149
- max: z.ZodOptional<z.ZodNumber>;
150
- }, z.core.$strict>], null>]>>;
151
- "deprecated-key-files": 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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
152
- }, z.core.$strict>>;
88
+ /** The instruction files to validate. */
153
89
  files: z.ZodDefault<z.ZodArray<z.ZodString>>;
154
90
  maxRules: z.ZodOptional<z.ZodNumber>;
155
91
  maxTokens: z.ZodOptional<z.ZodNumber>;
@@ -166,12 +102,9 @@ export declare const vigilesConfigSchema: z.ZodObject<{
166
102
  include: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
167
103
  }, z.core.$strict>>;
168
104
  exclude: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
169
- overrides: z.ZodOptional<z.ZodArray<z.ZodObject<{
170
- files: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>;
171
- rules: z.ZodObject<{
172
- [x: string]: z.ZodOptional<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 | "error" | "warn", boolean | 0 | 1 | 2 | "error" | "warn" | "off">>>;
173
- }, z.core.$strict>;
174
- }, z.core.$strict>>>;
105
+ };
106
+ /** The keys after `overrides`; `extends` and `$schema` close the shape. */
107
+ declare const configTailKeys: {
175
108
  sharedDirs: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
176
109
  harnesses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
177
110
  roots: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<readonly string[], string | string[]>>>;
@@ -183,106 +116,149 @@ export declare const vigilesConfigSchema: z.ZodObject<{
183
116
  apiVersion: z.ZodOptional<z.ZodNumber>;
184
117
  }, z.core.$strict>>;
185
118
  nudge: z.ZodOptional<z.ZodLiteral<"dismissed">>;
186
- extends: z.ZodOptional<z.ZodEnum<{
187
- "vigiles:recommended": "vigiles:recommended";
188
- }>>;
189
- $schema: z.ZodOptional<z.ZodString>;
190
- }, z.core.$strict>;
119
+ };
191
120
  /**
192
- * Parse a raw `.vigilesrc.json` value — THE one entry point every reader uses.
121
+ * The editor's pointer at the published JSON Schema. Accepted, never read.
193
122
  *
194
- * 🔴 THE PRESET IS MERGED INTO THE RAW INPUT, BEFORE THE SCHEMA, for one reason:
195
- * after parsing, every rule carries a value (the schema fills each default), so
196
- * "the user wrote `hook-events: warn`" and "nobody wrote it" are the same
197
- * output, and an explicit downgrade could not win over the preset. Before
198
- * parsing, the user's own `rules` keys are exactly what they wrote. So the
199
- * preset's severities go UNDER them, and the schema then normalizes and
200
- * validates the result as if the user had typed both.
123
+ * 🔴 IT IS DECLARED HERE RATHER THAN EXCUSED IN THE UNKNOWN-KEY WALKER, and
124
+ * the reason is that the walker is only half the surface. `dist/vigilesrc.
125
+ * schema.json` is generated FROM this schema by
126
+ * `scripts/build-config-schema.mjs`, with `additionalProperties: false`, so
127
+ * a key missing here is refused TWICE: once by the CLI, and once by the
128
+ * editor being pointed at the schema. Measured before this key existed, on
129
+ * `{"$schema": <the schema's own $id>, "harnesses": {"claude-code": {}}}`:
201
130
  *
202
- * Only a recognized preset with an object (or absent) `rules` is expanded;
203
- * anything else is passed through untouched for the schema to refuse with its
204
- * own message, so a typo in `extends` is reported, never silently ignored.
131
+ * ```
132
+ * $ vigiles audit . --no-interactive
133
+ * ✗ .vigilesrc.json: unknown key "$schema" in (top level). Known: …
134
+ * (exit 2)
135
+ * $ # and the same document against dist/vigilesrc.schema.json:
136
+ * additionalProperties: should NOT have additional properties ($schema)
137
+ * ```
138
+ *
139
+ * It is LAST in the shape on purpose: `knownKeysAt` reads the schema to build
140
+ * the "Known: …" candidate list, which is capped, so a key nobody misspells
141
+ * belongs past the cap rather than at the head of the suggestion.
205
142
  */
206
- export declare function parseVigilesConfig(raw: unknown): Readonly<ReturnType<typeof vigilesConfigSchema.safeParse>>;
143
+ declare const schemaPointer: z.ZodOptional<z.ZodString>;
144
+ /** The keys that do not depend on the rule set, as one object type. */
145
+ type StaticConfig = z.output<z.ZodObject<typeof configKeys & typeof configTailKeys & {
146
+ readonly $schema: typeof schemaPointer;
147
+ }>>;
148
+ /** One rule's entry in `rules`: a severity, or `[severity, options]`. */
149
+ export type RuleEntry = RuleWithOptions<unknown>;
150
+ /** The `rules` of a config, keyed by rule id. */
151
+ export type RulesConfig<Id extends string = string> = {
152
+ readonly [K in Id]: RuleEntry;
153
+ };
154
+ /** The config entry a rule takes: with its options' type when it has options. */
155
+ type EntryOf<S> = S extends {
156
+ readonly options: infer O extends z.ZodType;
157
+ } ? RuleWithOptions<z.output<O>> : RuleSeverity;
207
158
  /**
208
- * A `.vigilesrc.json` that cannot be honoured as written.
209
- *
210
- * 🔴 IT HAS ITS OWN CLASS BECAUSE THE READER CATCHES EVERYTHING ELSE. A missing
211
- * file, an unreadable one and malformed JSON all mean "use the defaults", which
212
- * is right — and a file that IS readable and says something we refuse must not
213
- * join them, or the user's declaration vanishes into the defaults and the run
214
- * looks clean. A distinct class is what lets the CLI print it as a config error
215
- * and a hook rail downgrade it to a warning, from one throw site.
159
+ * The PRECISE `rules` of a rule set — each id with its own options type. The
160
+ * composition root instantiates it over `RULES`; generic code takes
161
+ * {@link RulesConfig} and never names an id (the `local/no-rule-ids` fence).
216
162
  */
217
- export declare class VigilesConfigError extends Error {
218
- readonly name = "VigilesConfigError";
219
- }
163
+ export type RulesConfigOf<R extends readonly RuleSpec[]> = {
164
+ readonly [S in R[number] as S["id"]]: EntryOf<S>;
165
+ };
220
166
  /**
221
- * The whole config, AS THE SCHEMA DEFINES IT — `VigilesConfig` is this.
222
- *
223
- * Exported from here and re-exported (type-only, so no runtime cycle) by
224
- * `./types.ts`, which every consumer already imports. The derivation is the
225
- * point: a key cannot be in the type and absent from the validator.
167
+ * The whole parsed config: the static keys as the schema defines them, plus
168
+ * the rule set's `rules` and `overrides`. Exported from here and re-exported
169
+ * (type-only) by `./types.ts`; a key cannot be in the type and absent from the
170
+ * validator.
226
171
  */
227
- export type VigilesConfigShape = z.infer<typeof vigilesConfigSchema>;
172
+ export type VigilesConfigOf<Rules> = StaticConfig & {
173
+ rules: Rules;
174
+ overrides?: readonly {
175
+ readonly files: readonly string[];
176
+ readonly rules: {
177
+ readonly [K in keyof Rules]?: RuleSeverity;
178
+ };
179
+ }[];
180
+ extends?: string | readonly string[];
181
+ };
182
+ /** A parse of a raw config: the config, or the issues that refused it. */
183
+ export type ConfigParse<C> = {
184
+ readonly success: true;
185
+ readonly data: C;
186
+ } | {
187
+ readonly success: false;
188
+ readonly error: {
189
+ readonly issues: readonly ConfigIssue[];
190
+ };
191
+ };
228
192
  /**
229
- * The two keys `harnesses` replaced, and the sentence each one gets (#240).
230
- *
231
- * They are listed here rather than left to `.strict()`'s "Unrecognized key"
232
- * because the reader of that message is someone whose config USED to work: they
233
- * need the new spelling, not the news that the old one is unknown. `.strict()`
234
- * would tell them the truth in the least useful possible way.
193
+ * `.vigilesrc.json` for one rule set — the schema, its presets and its
194
+ * defaults, BUILT from the rules a composition root hands in. `C` is the parsed
195
+ * config's type: precise (`VigilesConfigOf<RulesConfigOf<typeof RULES>>`) at
196
+ * the root, string-keyed in generic code.
235
197
  */
236
- export declare const REPLACED_KEYS: ReadonlyArray<{
237
- readonly key: string;
238
- readonly was: string;
239
- readonly now: string;
240
- }>;
198
+ export interface ConfigSet<C> {
199
+ /** The whole schema — for the JSON Schema build and the error messages. */
200
+ readonly schema: z.ZodType;
201
+ /** Every rule id the schema accepts, in the set's order. */
202
+ readonly ruleNames: readonly string[];
203
+ /** The preset names `extends` and `--preset=` accept, from the groups. */
204
+ readonly presetNames: readonly string[];
205
+ /**
206
+ * Parse a raw `.vigilesrc.json` value — THE one entry point every reader uses.
207
+ *
208
+ * 🔴 THE PRESET IS MERGED INTO THE RAW INPUT, BEFORE THE SCHEMA: after
209
+ * parsing, every rule carries a value (the schema fills each default), so
210
+ * "the user wrote `hook-events: warn`" and "nobody wrote it" are the same
211
+ * output, and an explicit downgrade could not win over the preset. Before
212
+ * parsing, the user's own `rules` keys are exactly what they wrote, so the
213
+ * preset's severities go UNDER them. Only a recognized preset with an object
214
+ * (or absent) `rules` is expanded; anything else is passed through for the
215
+ * schema to refuse with its own message.
216
+ *
217
+ * `extraPresets` — `audit`/`lint --preset=<name>` for one run — go after the
218
+ * file's own presets (so they win over them) and never over its explicit
219
+ * `rules`. They are not written into the parsed `extends`: that key stays
220
+ * what the FILE says.
221
+ */
222
+ parse(raw: unknown, extraPresets?: readonly string[]): ConfigParse<C>;
223
+ }
241
224
  /**
242
- * The message a config written in the replaced shape gets.
243
- *
244
- * `names` are the harnesses the user's OWN config named under the removed
245
- * `harness` key, so the worked example below shows THEIR migration.
225
+ * Build `.vigilesrc.json` for a rule set: each rule's key with its default and,
226
+ * for a rule with `options`, the `[severity, options]` form; `overrides` over
227
+ * the same ids; `extends` over the groups' preset names.
246
228
  *
247
- * 🔴 IT USED TO BE A FIXED EXAMPLE — `{ "harnesses": { "claude-code": …,
248
- * "codex": {} } }`, two names typed into the core. Its own comment called that
249
- * debt and predicted the failure: "with a third adapter this sample goes
250
- * stale". Reading the names from the config being migrated is better than
251
- * reading them from the registry would have been, and it is available here:
252
- * it shows the reader their own keys instead of somebody else's.
229
+ * The one place Zod cannot carry the type: an object built from
230
+ * `Object.fromEntries` has string keys, so the parse result is narrowed to the
231
+ * set's precise type by `complete`, which checks at run time that every id is
232
+ * present — never by an assertion.
253
233
  */
254
- export declare function replacedKeyMessage(present: ReadonlyArray<(typeof REPLACED_KEYS)[number]>, names: readonly string[]): string;
234
+ export declare function configFor<const R extends readonly RuleSpec[]>(rules: R, groups: RuleGroups): ConfigSet<VigilesConfigOf<RulesConfigOf<R>>>;
255
235
  /**
256
- * The per-rule `exclude` options that became `overrides`, and the rules an
257
- * equivalent override turns off. `untested-*` shared ONE merged option set, so
258
- * an `exclude` on any of them skipped those paths for all four.
236
+ * Parse the values of `--preset=` (each may be a comma list) into preset
237
+ * names, through the SAME enum `extends` validates with, so the config file
238
+ * and the command line refuse an unknown name with the same message. The
239
+ * `vigiles:` prefix is optional on the command line: `--preset=experimental`
240
+ * and `--preset=vigiles:experimental` are the same preset.
259
241
  */
260
- export declare const MOVED_TO_OVERRIDES: ReadonlyArray<{
261
- /** Where the option sat: a rule name, or the `orphans` block. */
262
- readonly owner: string;
263
- /** The rules the equivalent override turns off. */
264
- readonly rules: readonly string[];
265
- }>;
242
+ export declare function parsePresetFlags(known: readonly string[], values: readonly string[]): {
243
+ readonly ok: true;
244
+ readonly presets: readonly string[];
245
+ } | {
246
+ readonly ok: false;
247
+ readonly message: string;
248
+ };
266
249
  /**
267
- * The message an old config with a per-rule `exclude` gets — the user's OWN
268
- * globs, written as the `overrides` entry that does what the option did.
250
+ * A `.vigilesrc.json` that cannot be honoured as written.
269
251
  *
270
- * Read BEFORE the schema, like {@link REPLACED_KEYS}: the reader's config used
271
- * to work, so "unknown key exclude" would be true and useless.
272
- */
273
- export declare function movedToOverridesMessages(raw: unknown): readonly string[];
274
- /** Rules whose findings another rule now reports, and what changed. */
275
- export declare const FOLDED_RULES: ReadonlyArray<{
276
- readonly rule: string;
277
- readonly into: string;
278
- readonly what: string;
279
- }>;
280
- /**
281
- * The message a config naming a folded rule gets — in `rules` or in an
282
- * `overrides` entry. Read BEFORE the schema, like {@link REPLACED_KEYS}: the
283
- * reader's config used to work, so "unknown key" would be true and useless.
252
+ * 🔴 IT HAS ITS OWN CLASS BECAUSE THE READER CATCHES EVERYTHING ELSE. A missing
253
+ * file, an unreadable one and malformed JSON all mean "use the defaults", which
254
+ * is right — and a file that IS readable and says something we refuse must not
255
+ * join them, or the user's declaration vanishes into the defaults and the run
256
+ * looks clean. A distinct class is what lets the CLI print it as a config error
257
+ * and a hook rail downgrade it to a warning, from one throw site.
284
258
  */
285
- export declare function foldedRuleMessages(raw: unknown): readonly string[];
259
+ export declare class VigilesConfigError extends Error {
260
+ readonly name = "VigilesConfigError";
261
+ }
286
262
  /**
287
263
  * Turn a Zod failure into the lines a human acts on — ONE per real problem.
288
264
  *
@@ -307,7 +283,7 @@ export declare function foldedRuleMessages(raw: unknown): readonly string[];
307
283
  * the key accepts, and an unknown key carries the candidate list plus a
308
284
  * distance-bounded "did you mean".
309
285
  */
310
- export declare function formatConfigIssues(issues: readonly ConfigIssue[]): string[];
286
+ export declare function formatConfigIssues(schema: Readonly<z.ZodType>, issues: readonly ConfigIssue[]): string[];
311
287
  /**
312
288
  * The shape of a Zod issue this formatter reads — structural, not imported.
313
289
  *