@zgeoff/skill-gate 0.2.9 → 0.2.12
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/README.md +25 -89
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -13133
- package/package.json +7 -13
- package/dist/bash-snapshot-schema.d.ts +0 -9
- package/dist/build-bash-change-output.d.ts +0 -6
- package/dist/build-bash-check-failure-output.d.ts +0 -2
- package/dist/build-bash-skill-gate-output.d.ts +0 -6
- package/dist/build-edit-output.d.ts +0 -3
- package/dist/build-patch-gate-output.d.ts +0 -2
- package/dist/build-skill-gate-output.d.ts +0 -2
- package/dist/build-tool-gate-output.d.ts +0 -2
- package/dist/classify-command-reads.d.ts +0 -5
- package/dist/collect-bash-candidates.d.ts +0 -2
- package/dist/collect-changed-paths.d.ts +0 -2
- package/dist/collect-command-reads.d.ts +0 -1
- package/dist/collect-gate-skills.d.ts +0 -2
- package/dist/collect-prompt-skills.d.ts +0 -1
- package/dist/collect-rule-warnings.d.ts +0 -2
- package/dist/collect-session-loads.d.ts +0 -2
- package/dist/collect-written-paths.d.ts +0 -2
- package/dist/format-skill-list.d.ts +0 -1
- package/dist/format-unknown-key-warning.d.ts +0 -1
- package/dist/harness.d.ts +0 -1
- package/dist/load-ledger.d.ts +0 -6
- package/dist/parse-hook-input.d.ts +0 -3
- package/dist/parse-patch-paths.d.ts +0 -1
- package/dist/parse-shell-commands.d.ts +0 -4
- package/dist/parse-skill-gate-rules.d.ts +0 -2
- package/dist/pick-commit-range.d.ts +0 -2
- package/dist/pick-comparison-step.d.ts +0 -2
- package/dist/pick-harness-wording.d.ts +0 -3
- package/dist/pick-record-step.d.ts +0 -2
- package/dist/plan-bash-skill-gate.d.ts +0 -2
- package/dist/plan-skill-gate.d.ts +0 -2
- package/dist/plan-tool-gate.d.ts +0 -2
- package/dist/read-available-references.d.ts +0 -2
- package/dist/read-available-skills.d.ts +0 -1
- package/dist/read-commit-hashes.d.ts +0 -3
- package/dist/read-committed-paths.d.ts +0 -2
- package/dist/read-file-content.d.ts +0 -1
- package/dist/read-file-hashes.d.ts +0 -2
- package/dist/read-project-dir.d.ts +0 -1
- package/dist/read-session-loads.d.ts +0 -2
- package/dist/read-session-transcript.d.ts +0 -2
- package/dist/read-work-tree.d.ts +0 -3
- package/dist/record-codex-loads.d.ts +0 -3
- package/dist/resolve-state-dir.d.ts +0 -3
- package/dist/run-skill-gate.d.ts +0 -2
- package/dist/to-content-hash.d.ts +0 -1
- package/dist/types.d.ts +0 -209
- package/dist/with-ledger-lock.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,100 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@zgeoff/skill-gate</h1>
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
it blocks when the command changed a gated file that the session lacks the skills for. The package
|
|
8
|
-
holds no rules: each repo keeps its own in `.claude/skill-gate.json`, and a repo without that file
|
|
9
|
-
has no gate.
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@zgeoff/skill-gate"><img src="https://img.shields.io/npm/v/@zgeoff/skill-gate" alt="npm version"></a>
|
|
6
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
|
|
7
|
+
</p>
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
<p>
|
|
10
|
+
<a href="../../docs/README.md">Documentation</a> •
|
|
11
|
+
<a href="../agent-hooks/README.md">@zgeoff/agent-hooks</a>
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
A package that forwards to `@zgeoff/agent-hooks`, which holds the skill gate.
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
`runSkillGate` runs the hooks of [`@zgeoff/agent-hooks`](../agent-hooks/README.md), whose first
|
|
18
|
+
handler is the skill gate, so an entry point that calls it keeps working. A gate denial exits 2 with
|
|
19
|
+
the reason on stderr, which Claude Code and Codex both take as a block.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
`.claude/hooks/skill-gate/skill-gate.ts`. The `hook-skill-gate` entry of repo-sync delivers this
|
|
23
|
-
file from zgeoff/tools. `runSkillGate` reads the hook payload from stdin, prints the hook output,
|
|
24
|
-
and exits the process.
|
|
25
|
-
|
|
26
|
-
Register the entry point in `.claude/settings.json`, before a Bash command and after it. The command
|
|
27
|
-
runs Bun with `--no-install`, so the hook never fetches the package from npm: in a checkout with no
|
|
28
|
-
`node_modules`, the hook blocks each gated edit until `bun install` runs. The `PreToolUse` matcher
|
|
29
|
-
names each tool that a tool gate names, since the hook never sees a call that the matcher skips.
|
|
30
|
-
This example gates `mcp__tracker__update_ticket`:
|
|
31
|
-
|
|
32
|
-
```json
|
|
33
|
-
{
|
|
34
|
-
"hooks": {
|
|
35
|
-
"PreToolUse": [
|
|
36
|
-
{
|
|
37
|
-
"matcher": "Edit|Write|MultiEdit|Bash|mcp__tracker__update_ticket",
|
|
38
|
-
"hooks": [
|
|
39
|
-
{
|
|
40
|
-
"type": "command",
|
|
41
|
-
"command": "bun --no-install \"$CLAUDE_PROJECT_DIR/.claude/hooks/skill-gate/skill-gate.ts\""
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
"PostToolUse": [
|
|
47
|
-
{
|
|
48
|
-
"matcher": "Bash",
|
|
49
|
-
"hooks": [
|
|
50
|
-
{
|
|
51
|
-
"type": "command",
|
|
52
|
-
"command": "bun --no-install \"$CLAUDE_PROJECT_DIR/.claude/hooks/skill-gate/skill-gate.ts\""
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
"PostToolUseFailure": [
|
|
58
|
-
{
|
|
59
|
-
"matcher": "Bash",
|
|
60
|
-
"hooks": [
|
|
61
|
-
{
|
|
62
|
-
"type": "command",
|
|
63
|
-
"command": "bun --no-install \"$CLAUDE_PROJECT_DIR/.claude/hooks/skill-gate/skill-gate.ts\""
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Codex
|
|
73
|
-
|
|
74
|
-
The same entry point runs as a Codex hook when its command passes `--harness codex`, and it gates
|
|
75
|
-
`apply_patch` edits, gated tools and Bash commands as it does under Claude Code. Codex has no Skill
|
|
76
|
-
tool, so the gate keeps a ledger of what each session loaded.
|
|
77
|
-
[Gating Codex edits](../../docs/guides/skill-gate-codex.md) holds the `.codex/hooks.json` example,
|
|
78
|
-
the trust step and the ledger rules.
|
|
79
|
-
|
|
80
|
-
## Rules
|
|
21
|
+
## Install
|
|
81
22
|
|
|
82
|
-
|
|
83
|
-
|
|
23
|
+
Install `@zgeoff/agent-hooks` instead, and run its start-up stub, as its README describes. First
|
|
24
|
+
take the `hook-start` entry of repo-sync and merge its pull request, so that the repo holds the stub
|
|
25
|
+
at `.claude/hooks/start.ts`. `agent-hooks init` refuses to run without the stub, and it replaces the
|
|
26
|
+
skill gate's older hook entries. Then run these commands at the repo root:
|
|
84
27
|
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"tools": [{ "tool": "mcp__tracker__update_ticket", "skills": ["ticket-review"] }]
|
|
90
|
-
}
|
|
28
|
+
```sh
|
|
29
|
+
bun remove @zgeoff/skill-gate
|
|
30
|
+
bun add -d @zgeoff/agent-hooks
|
|
31
|
+
bunx agent-hooks init
|
|
91
32
|
```
|
|
92
33
|
|
|
93
|
-
[Writing skill-gate rules](../../docs/guides/skill-gate-rules.md) covers each key, the glob shapes
|
|
94
|
-
to avoid, and how the gate treats a mistake in the rules file.
|
|
95
|
-
|
|
96
34
|
## Documentation
|
|
97
35
|
|
|
98
|
-
[The skill gate architecture](../../docs/architecture/skill-gate.md) describes
|
|
99
|
-
fails closed, which skill loads and reference reads the gate counts, and how it checks what a Bash
|
|
100
|
-
command changed.
|
|
36
|
+
[The skill gate architecture](../../docs/architecture/skill-gate.md) describes what the gate denies.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export type { Harness } from '
|
|
1
|
+
import type { Harness } from '@zgeoff/agent-hooks';
|
|
2
|
+
export type { Harness } from '@zgeoff/agent-hooks';
|
|
3
|
+
export declare function runSkillGate(harness?: Harness): Promise<never>;
|