@zgeoff/skill-gate 0.2.7 → 0.2.8
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 +15 -7
- package/dist/build-bash-change-output.d.ts +2 -0
- package/dist/build-bash-skill-gate-output.d.ts +2 -0
- package/dist/build-edit-output.d.ts +3 -0
- package/dist/build-patch-gate-output.d.ts +2 -0
- package/dist/classify-command-reads.d.ts +5 -0
- package/dist/collect-command-reads.d.ts +1 -0
- package/dist/collect-prompt-skills.d.ts +1 -0
- package/dist/collect-rule-warnings.d.ts +2 -0
- package/dist/harness.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +689 -222
- package/dist/load-ledger.d.ts +6 -0
- package/dist/parse-hook-input.d.ts +3 -0
- package/dist/parse-patch-paths.d.ts +1 -0
- package/dist/parse-shell-commands.d.ts +3 -1
- package/dist/pick-harness-wording.d.ts +3 -0
- package/dist/read-available-skills.d.ts +1 -0
- package/dist/read-project-dir.d.ts +1 -0
- package/dist/read-session-loads.d.ts +2 -0
- package/dist/read-session-transcript.d.ts +2 -0
- package/dist/record-codex-loads.d.ts +3 -0
- package/dist/resolve-state-dir.d.ts +3 -0
- package/dist/run-skill-gate.d.ts +2 -1
- package/dist/types.d.ts +41 -0
- package/dist/with-ledger-lock.d.ts +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @zgeoff/skill-gate
|
|
2
2
|
|
|
3
|
-
The skill gate is a Claude Code hook that denies an edit until the session has loaded
|
|
4
|
-
the path needs, and names the missing skills. It denies a call to a gated tool, such as
|
|
5
|
-
the same way until the session has loaded the skills and read the reference files the
|
|
6
|
-
After a Bash command, it compares `git status` with the status before the command, and
|
|
7
|
-
when the command changed a gated file that the session lacks the skills for. The package
|
|
8
|
-
rules: each repo keeps its own in `.claude/skill-gate.json`, and a repo without that file
|
|
9
|
-
gate.
|
|
3
|
+
The skill gate is a Claude Code and Codex CLI hook that denies an edit until the session has loaded
|
|
4
|
+
every skill the path needs, and names the missing skills. It denies a call to a gated tool, such as
|
|
5
|
+
an MCP tool, the same way until the session has loaded the skills and read the reference files the
|
|
6
|
+
tool needs. After a Bash command, it compares `git status` with the status before the command, and
|
|
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.
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
@@ -67,6 +67,14 @@ the matcher skips. This example gates `mcp__tracker__update_ticket`:
|
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
## Codex
|
|
71
|
+
|
|
72
|
+
The same entry point runs as a Codex hook when its command passes `--harness codex`, and it gates
|
|
73
|
+
`apply_patch` edits, gated tools and Bash commands as it does under Claude Code. Codex has no Skill
|
|
74
|
+
tool, so the gate keeps a ledger of what each session loaded.
|
|
75
|
+
[Gating Codex edits](../../docs/guides/skill-gate-codex.md) holds the `.codex/hooks.json` example,
|
|
76
|
+
the trust step and the ledger rules.
|
|
77
|
+
|
|
70
78
|
## Rules
|
|
71
79
|
|
|
72
80
|
`.claude/skill-gate.json` maps path globs to the skills each path needs, and the optional `tools`
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Harness } from './harness.ts';
|
|
1
2
|
import type { BashChangeHookOutput, PostToolEvent } from './types.ts';
|
|
2
3
|
export declare function buildBashChangeOutput(event: PostToolEvent, changedPaths: readonly string[], missing: readonly string[], context?: {
|
|
3
4
|
readonly compacted?: boolean;
|
|
5
|
+
readonly harness?: Harness;
|
|
4
6
|
}): BashChangeHookOutput | null;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Harness } from './harness.ts';
|
|
1
2
|
import type { SkillGateHookOutput } from './types.ts';
|
|
2
3
|
export declare function buildBashSkillGateOutput(gatedPaths: readonly string[], missing: readonly string[], context?: {
|
|
3
4
|
readonly compacted?: boolean;
|
|
5
|
+
readonly harness?: Harness;
|
|
4
6
|
}): SkillGateHookOutput | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Harness } from './harness.ts';
|
|
2
|
+
import type { EditEntry, SkillGateHookOutput, SkillGateOutputContext } from './types.ts';
|
|
3
|
+
export declare function buildEditOutput(harness: Harness, entries: readonly EditEntry[], context: SkillGateOutputContext): SkillGateHookOutput | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function collectCommandReads(command: string, cwd: string): readonly string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function collectPromptSkills(prompt: string): readonly string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Harness = 'claude-code' | 'codex';
|
package/dist/index.d.ts
CHANGED