vigiles 2.5.0 → 3.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.
Files changed (209) hide show
  1. package/.claude-plugin/plugin.json +9 -0
  2. package/README.md +73 -434
  3. package/action.yml +143 -7
  4. package/dist/action-gate.d.ts +1 -1
  5. package/dist/action-gate.js +1 -1
  6. package/dist/adapter-conformance.d.ts +30 -0
  7. package/dist/adapter-conformance.js +153 -0
  8. package/dist/adapter-registry.d.ts +42 -0
  9. package/dist/adapter-registry.js +55 -0
  10. package/dist/adapter.d.ts +26 -0
  11. package/dist/adapter.js +16 -0
  12. package/dist/adapters/claude-code/adapter.d.ts +3 -0
  13. package/dist/adapters/claude-code/adapter.js +46 -0
  14. package/dist/{agent-result.d.ts → adapters/claude-code/agent-result.d.ts} +1 -1
  15. package/dist/adapters/claude-code/dialect.d.ts +13 -0
  16. package/dist/adapters/claude-code/dialect.js +51 -0
  17. package/dist/adapters/claude-code/egress-entry.d.ts +2 -0
  18. package/dist/adapters/claude-code/egress-entry.js +115 -0
  19. package/dist/adapters/claude-code/egress-proxy.d.ts +2 -0
  20. package/dist/adapters/claude-code/egress-proxy.js +60 -0
  21. package/dist/adapters/claude-code/egress.d.ts +114 -0
  22. package/dist/adapters/claude-code/egress.js +276 -0
  23. package/dist/adapters/claude-code/eval-baseline.d.ts +68 -0
  24. package/dist/adapters/claude-code/eval-baseline.js +173 -0
  25. package/dist/{eval-cache.d.ts → adapters/claude-code/eval-cache.d.ts} +1 -1
  26. package/dist/{eval-cache.js → adapters/claude-code/eval-cache.js} +1 -1
  27. package/dist/{eval.d.ts → adapters/claude-code/eval.d.ts} +28 -4
  28. package/dist/{eval.js → adapters/claude-code/eval.js} +61 -25
  29. package/dist/{harness-test.d.ts → adapters/claude-code/harness-test.d.ts} +33 -37
  30. package/dist/{harness-test.js → adapters/claude-code/harness-test.js} +124 -43
  31. package/dist/adapters/claude-code/hook-protocol.d.ts +10 -0
  32. package/dist/adapters/claude-code/hook-protocol.js +10 -0
  33. package/dist/adapters/claude-code/layout.d.ts +8 -0
  34. package/dist/adapters/claude-code/layout.js +18 -0
  35. package/dist/{mock-model.d.ts → adapters/claude-code/mock-model.d.ts} +2 -24
  36. package/dist/adapters/claude-code/model-mock.d.ts +11 -0
  37. package/dist/adapters/claude-code/model-mock.js +10 -0
  38. package/dist/adapters/claude-code/plugin-loader.d.ts +25 -0
  39. package/dist/adapters/claude-code/plugin-loader.js +19 -0
  40. package/dist/adapters/claude-code/run-hook.d.ts +204 -0
  41. package/dist/adapters/claude-code/run-hook.js +418 -0
  42. package/dist/adapters/claude-code/run-scripts.d.ts +52 -0
  43. package/dist/adapters/claude-code/run-scripts.js +150 -0
  44. package/dist/adapters/claude-code/runtime.d.ts +16 -0
  45. package/dist/adapters/claude-code/runtime.js +39 -0
  46. package/dist/{sandbox.d.ts → adapters/claude-code/sandbox.d.ts} +45 -4
  47. package/dist/{sandbox.js → adapters/claude-code/sandbox.js} +76 -8
  48. package/dist/{skill-driver.d.ts → adapters/claude-code/skill-driver.d.ts} +1 -1
  49. package/dist/adapters/codex/adapter.d.ts +3 -0
  50. package/dist/adapters/codex/adapter.js +49 -0
  51. package/dist/adapters/codex/dialect.d.ts +10 -0
  52. package/dist/adapters/codex/dialect.js +30 -0
  53. package/dist/adapters/codex/driver.d.ts +20 -0
  54. package/dist/adapters/codex/driver.js +89 -0
  55. package/dist/adapters/codex/hook-protocol.d.ts +10 -0
  56. package/dist/adapters/codex/hook-protocol.js +18 -0
  57. package/dist/adapters/codex/layout.d.ts +16 -0
  58. package/dist/adapters/codex/layout.js +18 -0
  59. package/dist/adapters/codex/mock-model.d.ts +52 -0
  60. package/dist/adapters/codex/mock-model.js +210 -0
  61. package/dist/adapters/codex/model-mock.d.ts +11 -0
  62. package/dist/adapters/codex/model-mock.js +10 -0
  63. package/dist/adapters/codex/runtime.d.ts +38 -0
  64. package/dist/adapters/codex/runtime.js +62 -0
  65. package/dist/adapters/opencode/adapter.d.ts +3 -0
  66. package/dist/adapters/opencode/adapter.js +48 -0
  67. package/dist/adapters/opencode/dialect.d.ts +10 -0
  68. package/dist/adapters/opencode/dialect.js +36 -0
  69. package/dist/adapters/opencode/layout.d.ts +9 -0
  70. package/dist/adapters/opencode/layout.js +25 -0
  71. package/dist/adapters/opencode/model-mock.d.ts +10 -0
  72. package/dist/adapters/opencode/model-mock.js +10 -0
  73. package/dist/adapters/opencode/runtime.d.ts +9 -0
  74. package/dist/adapters/opencode/runtime.js +21 -0
  75. package/dist/claude-code.d.ts +16 -0
  76. package/dist/claude-code.js +32 -0
  77. package/dist/cli-flags.d.ts +22 -0
  78. package/dist/cli-flags.js +38 -0
  79. package/dist/cli.js +406 -206
  80. package/dist/codex.d.ts +20 -0
  81. package/dist/codex.js +36 -0
  82. package/dist/community-skills.d.ts +1 -1
  83. package/dist/community-skills.js +2 -2
  84. package/dist/core/adapter.d.ts +88 -0
  85. package/dist/core/adapter.js +3 -0
  86. package/dist/{compile.d.ts → core/compile.d.ts} +11 -2
  87. package/dist/{compile.js → core/compile.js} +68 -53
  88. package/dist/core/compose.d.ts +79 -0
  89. package/dist/core/compose.js +145 -0
  90. package/dist/core/dialect.d.ts +51 -0
  91. package/dist/core/dialect.js +3 -0
  92. package/dist/core/harness-driver.d.ts +134 -0
  93. package/dist/core/harness-driver.js +3 -0
  94. package/dist/core/hook-protocol.d.ts +28 -0
  95. package/dist/core/hook-protocol.js +3 -0
  96. package/dist/core/layout.d.ts +43 -0
  97. package/dist/core/layout.js +3 -0
  98. package/dist/core/model-mock.d.ts +27 -0
  99. package/dist/core/model-mock.js +3 -0
  100. package/dist/core/refs.d.ts +62 -0
  101. package/dist/{refs.js → core/refs.js} +49 -23
  102. package/dist/core/runtime.d.ts +38 -0
  103. package/dist/core/runtime.js +3 -0
  104. package/dist/{types.d.ts → core/types.d.ts} +29 -0
  105. package/dist/{validate.d.ts → core/validate.d.ts} +1 -1
  106. package/dist/{validate.js → core/validate.js} +41 -4
  107. package/dist/e2e.d.ts +19 -0
  108. package/dist/e2e.js +39 -0
  109. package/dist/harness-assert.d.ts +60 -11
  110. package/dist/harness-assert.js +111 -9
  111. package/dist/integration.d.ts +16 -0
  112. package/dist/integration.js +32 -0
  113. package/dist/leaderboard.d.ts +33 -0
  114. package/dist/leaderboard.js +107 -0
  115. package/dist/linting.d.ts +9 -0
  116. package/dist/linting.js +25 -0
  117. package/dist/plugin-loader.d.ts +6 -3
  118. package/dist/plugin-loader.js +101 -49
  119. package/dist/scan.d.ts +49 -0
  120. package/dist/scan.js +177 -0
  121. package/dist/setup-plan.d.ts +51 -0
  122. package/dist/setup-plan.js +85 -0
  123. package/dist/skill-test.d.ts +1 -1
  124. package/dist/skill-test.js +1 -1
  125. package/dist/test-coverage.d.ts +71 -0
  126. package/dist/test-coverage.js +228 -0
  127. package/dist/testing.d.ts +12 -0
  128. package/dist/testing.js +28 -0
  129. package/dist/unit.d.ts +17 -0
  130. package/dist/unit.js +36 -0
  131. package/hooks/refs-nudge.sh +24 -0
  132. package/package.json +35 -16
  133. package/skills/audit-feedback-loop/SKILL.md +76 -0
  134. package/skills/edit-spec/SKILL.md +131 -0
  135. package/skills/enforce-rules-format/SKILL.md +71 -0
  136. package/skills/generate-logo/SKILL.md +103 -0
  137. package/skills/generate-rule/SKILL.md +64 -0
  138. package/skills/linter-docs/clippy.md +241 -0
  139. package/skills/linter-docs/eslint.md +384 -0
  140. package/skills/linter-docs/pylint.md +288 -0
  141. package/skills/linter-docs/rubocop.md +277 -0
  142. package/skills/linter-docs/ruff.md +187 -0
  143. package/skills/linter-docs/stylelint.md +247 -0
  144. package/skills/migrate-to-spec/SKILL.md +126 -0
  145. package/skills/pr-to-lint-rule/SKILL.md +97 -0
  146. package/skills/strengthen/SKILL.md +168 -0
  147. package/skills/test-harness/SKILL.md +157 -0
  148. package/dist/action.d.ts +0 -7
  149. package/dist/action.js +0 -180
  150. package/dist/refs.d.ts +0 -44
  151. package/dist/run-hook.d.ts +0 -77
  152. package/dist/run-hook.js +0 -80
  153. package/dist/run-scripts.d.ts +0 -20
  154. package/dist/run-scripts.js +0 -70
  155. /package/dist/{agent-result.js → adapters/claude-code/agent-result.js} +0 -0
  156. /package/dist/{agent-runtime.d.ts → adapters/claude-code/agent-runtime.d.ts} +0 -0
  157. /package/dist/{agent-runtime.js → adapters/claude-code/agent-runtime.js} +0 -0
  158. /package/dist/{judge.d.ts → adapters/claude-code/judge.d.ts} +0 -0
  159. /package/dist/{judge.js → adapters/claude-code/judge.js} +0 -0
  160. /package/dist/{mock-entry.d.ts → adapters/claude-code/mock-entry.d.ts} +0 -0
  161. /package/dist/{mock-entry.js → adapters/claude-code/mock-entry.js} +0 -0
  162. /package/dist/{mock-model.js → adapters/claude-code/mock-model.js} +0 -0
  163. /package/dist/{skill-driver.js → adapters/claude-code/skill-driver.js} +0 -0
  164. /package/dist/{skill-runtime.d.ts → adapters/claude-code/skill-runtime.d.ts} +0 -0
  165. /package/dist/{skill-runtime.js → adapters/claude-code/skill-runtime.js} +0 -0
  166. /package/dist/{stats.d.ts → adapters/claude-code/stats.d.ts} +0 -0
  167. /package/dist/{stats.js → adapters/claude-code/stats.js} +0 -0
  168. /package/dist/{compile-generator.d.ts → core/compile-generator.d.ts} +0 -0
  169. /package/dist/{compile-generator.js → core/compile-generator.js} +0 -0
  170. /package/dist/{coverage.d.ts → core/coverage.d.ts} +0 -0
  171. /package/dist/{coverage.js → core/coverage.js} +0 -0
  172. /package/dist/{doc-refs.d.ts → core/doc-refs.d.ts} +0 -0
  173. /package/dist/{doc-refs.js → core/doc-refs.js} +0 -0
  174. /package/dist/{evolve.d.ts → core/evolve.d.ts} +0 -0
  175. /package/dist/{evolve.js → core/evolve.js} +0 -0
  176. /package/dist/{frontmatter.d.ts → core/frontmatter.d.ts} +0 -0
  177. /package/dist/{frontmatter.js → core/frontmatter.js} +0 -0
  178. /package/dist/{generate-schema.d.ts → core/generate-schema.d.ts} +0 -0
  179. /package/dist/{generate-schema.js → core/generate-schema.js} +0 -0
  180. /package/dist/{generate-types.d.ts → core/generate-types.d.ts} +0 -0
  181. /package/dist/{generate-types.js → core/generate-types.js} +0 -0
  182. /package/dist/{hash.d.ts → core/hash.d.ts} +0 -0
  183. /package/dist/{hash.js → core/hash.js} +0 -0
  184. /package/dist/{inline.d.ts → core/inline.d.ts} +0 -0
  185. /package/dist/{inline.js → core/inline.js} +0 -0
  186. /package/dist/{integrity.d.ts → core/integrity.d.ts} +0 -0
  187. /package/dist/{integrity.js → core/integrity.js} +0 -0
  188. /package/dist/{linters.d.ts → core/linters.d.ts} +0 -0
  189. /package/dist/{linters.js → core/linters.js} +0 -0
  190. /package/dist/{mcp.d.ts → core/mcp.d.ts} +0 -0
  191. /package/dist/{mcp.js → core/mcp.js} +0 -0
  192. /package/dist/{orphans.d.ts → core/orphans.d.ts} +0 -0
  193. /package/dist/{orphans.js → core/orphans.js} +0 -0
  194. /package/dist/{proofs.d.ts → core/proofs.d.ts} +0 -0
  195. /package/dist/{proofs.js → core/proofs.js} +0 -0
  196. /package/dist/{session.d.ts → core/session.d.ts} +0 -0
  197. /package/dist/{session.js → core/session.js} +0 -0
  198. /package/dist/{sidecar.d.ts → core/sidecar.d.ts} +0 -0
  199. /package/dist/{sidecar.js → core/sidecar.js} +0 -0
  200. /package/dist/{spec.d.ts → core/spec.d.ts} +0 -0
  201. /package/dist/{spec.js → core/spec.js} +0 -0
  202. /package/dist/{symbols.d.ts → core/symbols.d.ts} +0 -0
  203. /package/dist/{symbols.js → core/symbols.js} +0 -0
  204. /package/dist/{test-utils.d.ts → core/test-utils.d.ts} +0 -0
  205. /package/dist/{test-utils.js → core/test-utils.js} +0 -0
  206. /package/dist/{types.js → core/types.js} +0 -0
  207. /package/{.claude-plugin/hooks → hooks}/post-edit.sh +0 -0
  208. /package/{.claude-plugin/hooks → hooks}/pre-edit.sh +0 -0
  209. /package/{.claude-plugin/hooks → hooks}/session-start.sh +0 -0
package/dist/run-hook.js DELETED
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseHookOutput = parseHookOutput;
4
- exports.decideHook = decideHook;
5
- exports.runHook = runHook;
6
- /**
7
- * vigiles — the *unit* tier for Claude Code hooks.
8
- *
9
- * A hook is just a process: Claude Code pipes a JSON event to its stdin and
10
- * reads back an exit code (0 ok, 2 = block) and, optionally, a JSON decision on
11
- * stdout. `runHook` exercises exactly that contract directly — no `claude`
12
- * binary, no model, no sandbox — so a hook's logic can be unit-tested in
13
- * milliseconds:
14
- *
15
- * const r = runHook('"$GUARD" ', {
16
- * hook_event_name: "PreToolUse",
17
- * tool_name: "Bash",
18
- * tool_input: { command: "git commit --no-verify" },
19
- * }, { env: { GUARD: guardPath } });
20
- * assert.ok(r.blocked); // exit 2 / decision:block / permission:deny
21
- *
22
- * Why this exists alongside `runHarnessTest`:
23
- * - It is the cheap base of the pyramid — no CLI dependency, runs anywhere.
24
- * - It reaches every event. The deterministic `runHarnessTest` mock can drive
25
- * SessionStart/Stop/UserPromptSubmit/Bash PreToolUse|PostToolUse, but NOT
26
- * Edit/Write tool events (headless-gated), PreCompact, Notification,
27
- * SessionEnd, or SubagentStop. At this tier you hand the hook the event
28
- * JSON yourself, so all of them are testable.
29
- *
30
- * It does NOT prove the hook is *wired* into the harness (that the settings
31
- * point at it, that `${CLAUDE_PLUGIN_ROOT}` resolves) — that is what the
32
- * `plugin:` loader + `runHarnessTest` cover. Use both: unit-test the hook's
33
- * logic here, then assert it fires in the assembled machine there.
34
- */
35
- const node_child_process_1 = require("node:child_process");
36
- /** Parse stdout as a hook JSON decision (pure, testable without a process). */
37
- function parseHookOutput(stdout) {
38
- const s = stdout.trim();
39
- if (!s.startsWith("{"))
40
- return null;
41
- try {
42
- return JSON.parse(s);
43
- }
44
- catch {
45
- return null;
46
- }
47
- }
48
- /**
49
- * Decide whether a hook result blocked, and the normalized decision. Pure, so
50
- * the policy is unit-testable independent of spawning anything.
51
- */
52
- function decideHook(exitCode, json) {
53
- const permission = json?.hookSpecificOutput?.permissionDecision;
54
- const decision = permission ?? json?.decision;
55
- const blocked = exitCode === 2 || decision === "block" || decision === "deny";
56
- return { blocked, decision };
57
- }
58
- /**
59
- * Run a hook command, piping `input` as JSON to its stdin, and report the exit
60
- * code + parsed decision. Synchronous (so it can be used inside an eval's
61
- * `measure` too). `command` is run through a shell, so the same command string a
62
- * plugin ships (with args / env refs) works verbatim.
63
- */
64
- function runHook(command, input, opts = {}) {
65
- const res = (0, node_child_process_1.spawnSync)(command, {
66
- shell: true,
67
- cwd: opts.cwd,
68
- env: { ...process.env, ...opts.env },
69
- input: JSON.stringify(input),
70
- encoding: "utf-8",
71
- timeout: opts.timeoutMs ?? 10000,
72
- });
73
- const exitCode = res.status ?? (res.signal ? 1 : 0);
74
- const stdout = res.stdout ?? "";
75
- const stderr = res.stderr ?? "";
76
- const json = parseHookOutput(stdout);
77
- const { blocked, decision } = decideHook(exitCode, json);
78
- return { exitCode, stdout, stderr, json, blocked, decision };
79
- }
80
- //# sourceMappingURL=run-hook.js.map
@@ -1,20 +0,0 @@
1
- export interface ScriptRunResult {
2
- readonly file: string;
3
- readonly code: number;
4
- }
5
- /**
6
- * Expand the given path/glob patterns into concrete script files. A pattern
7
- * that is an existing file passes through unchanged; anything else is treated
8
- * as a glob. Falls back to `defaultGlob` when no patterns are given. Results
9
- * are deduped and sorted; `node_modules` and `dist` are always ignored.
10
- */
11
- export declare function discoverScripts(patterns: readonly string[], defaultGlob: string, cwd: string): string[];
12
- /**
13
- * Run each script as `node <file>`, inheriting stdio so the script's own report
14
- * streams to the console. `env` is merged over `process.env` for every child
15
- * (e.g. `VIGILES_TRIALS`). Returns the per-file exit codes.
16
- */
17
- export declare function runScripts(files: readonly string[], cwd: string, env?: NodeJS.ProcessEnv): ScriptRunResult[];
18
- /** Format a one-line-per-file run summary with a pass/fail tally. */
19
- export declare function formatScriptSummary(results: readonly ScriptRunResult[]): string;
20
- //# sourceMappingURL=run-scripts.d.ts.map
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.discoverScripts = discoverScripts;
4
- exports.runScripts = runScripts;
5
- exports.formatScriptSummary = formatScriptSummary;
6
- /**
7
- * vigiles — run harness-test / eval script files via the CLI.
8
- *
9
- * `vigiles test` and `vigiles eval` discover `*.harness.mjs` / `*.eval.mjs`
10
- * scripts and run each as a child `node` process, so the two-tier
11
- * harness-testing API (`src/harness-test.ts`, `src/eval.ts`) works as a CI
12
- * command, not just `node x.mjs`. The scripts stay plain Node modules (they
13
- * import from the built `dist/`), so they also run standalone — the CLI just
14
- * discovers, runs, and aggregates exit codes.
15
- */
16
- const node_child_process_1 = require("node:child_process");
17
- const node_path_1 = require("node:path");
18
- const node_fs_1 = require("node:fs");
19
- const glob_1 = require("glob");
20
- /**
21
- * Expand the given path/glob patterns into concrete script files. A pattern
22
- * that is an existing file passes through unchanged; anything else is treated
23
- * as a glob. Falls back to `defaultGlob` when no patterns are given. Results
24
- * are deduped and sorted; `node_modules` and `dist` are always ignored.
25
- */
26
- function discoverScripts(patterns, defaultGlob, cwd) {
27
- const globs = patterns.length > 0 ? patterns : [defaultGlob];
28
- const found = new Set();
29
- for (const p of globs) {
30
- if ((0, node_fs_1.existsSync)((0, node_path_1.resolve)(cwd, p))) {
31
- found.add(p);
32
- continue;
33
- }
34
- for (const m of (0, glob_1.globSync)(p, {
35
- cwd,
36
- ignore: ["node_modules/**", "dist/**"],
37
- })) {
38
- found.add(m);
39
- }
40
- }
41
- return [...found].sort();
42
- }
43
- /**
44
- * Run each script as `node <file>`, inheriting stdio so the script's own report
45
- * streams to the console. `env` is merged over `process.env` for every child
46
- * (e.g. `VIGILES_TRIALS`). Returns the per-file exit codes.
47
- */
48
- function runScripts(files, cwd, env = {}) {
49
- const results = [];
50
- for (const file of files) {
51
- const res = (0, node_child_process_1.spawnSync)("node", [file], {
52
- cwd,
53
- stdio: "inherit",
54
- env: { ...process.env, ...env },
55
- });
56
- results.push({ file, code: res.status ?? 1 });
57
- }
58
- return results;
59
- }
60
- /** Format a one-line-per-file run summary with a pass/fail tally. */
61
- function formatScriptSummary(results) {
62
- const lines = results.map((r) => ` ${r.code === 0 ? "✓" : "✗"} ${r.file}` +
63
- (r.code === 0 ? "" : ` (exit ${String(r.code)})`));
64
- const failed = results.filter((r) => r.code !== 0).length;
65
- lines.push(failed === 0
66
- ? `\n${String(results.length)} passed.`
67
- : `\n${String(failed)}/${String(results.length)} failed.`);
68
- return lines.join("\n");
69
- }
70
- //# sourceMappingURL=run-scripts.js.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes