vigiles 26.2.0 → 27.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.
package/dist/cli.d.ts CHANGED
@@ -1,136 +1,52 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * vigiles CLI — verify your agent harness is real, and prove it works.
3
+ * The `vigiles` bin — a DISPATCHER SHIM, and deliberately almost empty.
4
4
  *
5
- * The verbs and their one-liners live in ONE place, `COMMAND_HELP` + `HELP_GROUPS`
6
- * near the bottom of this file, and `--help` prints from that table. A second list
7
- * here would be a copy that rots — this docblock WAS that copy: it named four
8
- * commands and omitted `audit`, `test`, `eval` and `eject`, four of the eight, and
9
- * `self-command-refs.test.ts` did not catch it because it guards against refs to
10
- * REMOVED commands, not against a list that merely stops growing.
11
- */
12
- import { type ExcludeSet } from "./exclude.js";
13
- import type { RuleSeverity } from "./core/types.js";
14
- /** Reason the most recent `loadSpec()` returned null, or null if it succeeded. */
15
- export declare function specLoadFailureReason(): string | null;
16
- /**
17
- * Structured lint report used by --json, --summary, and exit-code logic.
18
- */
19
- interface LintReport {
20
- hashErrors: number;
21
- validationErrors: number;
22
- inlineErrors: number;
23
- inlineRules: number;
24
- frontmatterErrors: number;
25
- frontmatterRules: number;
26
- specRefIssues: number;
27
- specRefErrors: number;
28
- duplicatePairs: number;
29
- /** Severity of `duplicate-instructions` — carried so the exit code can tier it. */
30
- duplicateSeverity: RuleSeverity;
31
- coverageEnabled: number;
32
- coverageDocumented: number;
33
- strengthenSuggestions: number;
34
- integrityErrors: number;
35
- coverageErrors: number;
36
- orphanCount: number;
37
- /** Severity of `orphan-docs` — carried so the exit code can tier it (#181). */
38
- orphanSeverity: RuleSeverity;
39
- untestedSurfaces: number;
40
- untestedErrors: number;
41
- toolContractIssues: number;
42
- toolContractErrors: number;
43
- hookEventIssues: number;
44
- hookEventErrors: number;
45
- frontmatterSchemaIssues: number;
46
- frontmatterSchemaErrors: number;
47
- mcpConfigIssues: number;
48
- mcpConfigErrors: number;
49
- skillFrontmatterIssues: number;
50
- skillFrontmatterErrors: number;
51
- mcpToolIssues: number;
52
- mcpToolErrors: number;
53
- hookScriptIssues: number;
54
- hookScriptErrors: number;
55
- disallowedToolIssues: number;
56
- disallowedToolErrors: number;
57
- descriptionOverlapIssues: number;
58
- descriptionOverlapErrors: number;
59
- descriptionBudgetIssues: number;
60
- descriptionBudgetErrors: number;
61
- frontmatterValidIssues: number;
62
- frontmatterValidErrors: number;
63
- mcpHookIssues: number;
64
- mcpHookErrors: number;
65
- preferCompiledHookIssues: number;
66
- preferCompiledHookErrors: number;
67
- lethalTrifectaIssues: number;
68
- lethalTrifectaErrors: number;
69
- skillResourceIssues: number;
70
- skillResourceErrors: number;
71
- skillFenceIssues: number;
72
- skillFenceErrors: number;
73
- pluginLayoutIssues: number;
74
- pluginLayoutErrors: number;
75
- delegationTrifectaIssues: number;
76
- delegationTrifectaErrors: number;
77
- hookBlockIssues: number;
78
- hookBlockErrors: number;
79
- hookMatcherIssues: number;
80
- hookMatcherErrors: number;
81
- docRefErrors: number;
82
- symbolRefErrors: number;
83
- mcpRefErrors: number;
84
- files: string[];
85
- /**
86
- * Findings / errors / warnings for the whole run — the same numbers the
87
- * human-readable summary line prints, so a consumer never has to reconstruct
88
- * them by counting output lines (#183, and the generic-consumer half of #181).
89
- */
90
- totals?: {
91
- findings: number;
92
- errors: number;
93
- warnings: number;
94
- };
95
- }
96
- /** Exit codes: 0 clean, 1 warnings only, 2 hard errors. */
97
- /**
98
- * The run's totals, derived from the report itself.
5
+ * ## Why this file has no imports
99
6
  *
100
- * 🔴 ONE SOURCE, because the two numbers disagreeing IS the bug (#183). The
101
- * human-readable log had no total, and counting its `⚠` lines gave a different
102
- * number from the JSON — 21 against 88 on a real repo — because some checks print
103
- * one line per finding and others one line carrying a count. Both numbers were
104
- * right and nothing said why they differed, so "vigiles reports 21 warnings" and
105
- * "88 warnings" were equally defensible readings of one run.
7
+ * `dist/cli.js` is the `bin`, so it is also what the harness spawns for
8
+ * `vigiles hook-runtime run-program <file>` — a compiled hook's decision, which
9
+ * runs on EVERY matching tool call. The output is CommonJS, where a top-level
10
+ * `import` becomes a top-level `require` that resolves BEFORE argv is read. The
11
+ * verb barrel (`./cli-main.js`) has ~85 of them: the report template loader, the
12
+ * linter catalogs, the adapter registry, `audit`, `eval`, `init`. A hook calls
13
+ * none of it.
106
14
  *
107
- * Counted GENERICALLY off the `*Issues` / `*Errors` / count keys rather than a
108
- * hand-maintained list, so a rule added later is included by existing, not by
109
- * somebody remembering. `orphanCount` and `duplicatePairs` are named explicitly
110
- * only because they predate the `*Issues` convention (#181).
111
- */
112
- export declare function lintTotals(report: LintReport): {
113
- findings: number;
114
- errors: number;
115
- warnings: number;
116
- };
117
- /**
118
- * Nested plugin bundles under a lint root — a directory that is itself a harness
119
- * (its own `.claude-plugin/plugin.json`, or its own skills dir) and is NOT the
120
- * root being linted.
15
+ * MEASURED 2026-09-08, Node 22.22.2, median of 20 spawns
16
+ * (`node tools/measure-hook-startup.mjs` — run it, do not trust these):
17
+ *
18
+ * ```
19
+ * bare `node -e ''` 42 ms
20
+ * require dist/core/hook-program.js 170 ms
21
+ * require dist/cli.js ← what a hook used to load 623 ms
22
+ * a real run-program spawn 610-661 ms
23
+ * ```
24
+ *
25
+ * A shell hook doing the same job costs ~12 ms and a python one ~35 ms, so the
26
+ * gap was the reason to keep the shell hook. Issue #216.
27
+ *
28
+ * ## The rule this file exists to hold
29
+ *
30
+ * 🔴 NO TOP-LEVEL IMPORT MAY BE ADDED HERE. Every `require` in this file is paid
31
+ * by every gated tool call before anything decides anything. Both branches below
32
+ * load their module lazily, inside the branch. `src/hook-runtime-graph.test.ts`
33
+ * fails the day a top-level import puts the CLI barrel back into a hook
34
+ * decision's module graph — it asserts the GRAPH, not a duration, because a
35
+ * timing threshold on a shared CI runner is flaky and would be quarantined first.
36
+ *
37
+ * ## What must not change
121
38
  *
122
- * 🔴 WHY THIS EXISTS. Every per-surface check reads ONE root, so in a monorepo
123
- * holding `skills/` plus `plugins/ * /skills/` the nested skills were never scored
124
- * and nothing said so. Measured on a fixture: 4 skills over the description
125
- * budget, `lint .` reported 2, exit 0 — a repo reads that as green-with-2 while
126
- * the other 2 carry the same defect (#185). The failure is silent, which is the
127
- * shape this repo treats as worse than a loud one.
39
+ * The emitted command `npx vigiles hook-runtime run-program <file>` is byte-for-byte
40
+ * what `vigiles compile` has already written into users' `.claude/settings.json`
41
+ * and `.codex/config.toml`, and it is covered by the SHA stamp beside each hook.
42
+ * Renaming it — or moving the bin off `dist/cli.js` — breaks a contract that
43
+ * lives in other people's repositories. It is a fast path THROUGH the same
44
+ * command, never a new one.
128
45
  *
129
- * Deliberately shallow (one level under a container dir): deep recursion would
130
- * sweep vendored corpora — this repo's own `test/dogfood/` holds real pinned
131
- * third-party plugins — and scoring someone else's vendored plugin as if it were
132
- * yours is the false-positive that gets a gate switched off.
46
+ * Harness-neutral: `run-program` dispatches on the hook's own role, and the gate
47
+ * protocol (deny → exit 2) is identical on Claude Code and Codex, so one path
48
+ * serves both. The single harness-specific fact (which events accept injected
49
+ * context) is read from the resolved adapter inside the runtime.
133
50
  */
134
- export declare function discoverNestedBundles(root: string, excludes: ExcludeSet): string[];
135
51
  export {};
136
52
  //# sourceMappingURL=cli.d.ts.map