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/audit-score.js +1 -1
- package/dist/cli-commands.d.ts +1 -1
- package/dist/cli-commands.js +1 -1
- package/dist/cli-main.d.ts +146 -0
- package/dist/cli-main.js +6811 -0
- package/dist/cli.d.ts +42 -126
- package/dist/cli.js +76 -7278
- package/dist/core/bash-effects.js +44 -29
- package/dist/core/compile.d.ts +0 -6
- package/dist/core/compile.js +16 -6
- package/dist/core/hook-program.d.ts +0 -6
- package/dist/core/hook-program.js +48 -7
- package/dist/core/linters.d.ts +11 -2
- package/dist/core/linters.js +12 -3
- package/dist/core/types.d.ts +4 -2
- package/dist/coverage-evidence.d.ts +1 -1
- package/dist/coverage-evidence.js +2 -2
- package/dist/exclude.js +8 -72
- package/dist/hook-install.js +8 -2
- package/dist/hook-runtime.d.ts +63 -0
- package/dist/hook-runtime.js +540 -0
- package/dist/hook.d.ts +1 -1
- package/dist/hook.js +2 -3
- package/dist/test-coverage.d.ts +3 -3
- package/dist/test-coverage.js +7 -7
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -1,136 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* vigiles
|
|
3
|
+
* The `vigiles` bin — a DISPATCHER SHIM, and deliberately almost empty.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
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
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
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
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* and
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
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
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
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
|