@zgeoff/skill-gate 0.1.0 → 0.2.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/README.md +3 -2
- package/package.json +2 -2
- package/src/run-skill-gate.ts +3 -3
package/README.md
CHANGED
|
@@ -25,8 +25,9 @@ import { runSkillGate } from '@zgeoff/skill-gate';
|
|
|
25
25
|
await runSkillGate();
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
`
|
|
29
|
-
Register the entry point
|
|
28
|
+
The `hook-skill-gate` entry of repo-sync delivers this file from zgeoff/tools. `runSkillGate` reads
|
|
29
|
+
the hook payload from stdin, prints the hook output, and exits the process. Register the entry point
|
|
30
|
+
in `.claude/settings.json`:
|
|
30
31
|
|
|
31
32
|
```json
|
|
32
33
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgeoff/skill-gate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A Claude Code PreToolUse hook that denies an edit until the session loads the skills the path needs, and warns on a Bash command that writes a gated path",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typecheck": "tsc"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@zgeoff/std": "0.
|
|
38
|
+
"@zgeoff/std": "0.2.0",
|
|
39
39
|
"ts-pattern": "5.9.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
package/src/run-skill-gate.ts
CHANGED
|
@@ -55,7 +55,7 @@ export async function runSkillGate(): Promise<never> {
|
|
|
55
55
|
process.exit(0);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const availableSkills = await
|
|
58
|
+
const availableSkills = await readAvailableSkills(path.join(projectDir, '.claude', 'skills'));
|
|
59
59
|
const transcript = await readTranscript(resolveSessionTranscriptPath(input));
|
|
60
60
|
|
|
61
61
|
const loaded = collectLoadedSkills(transcript);
|
|
@@ -142,7 +142,7 @@ async function checkBashCommand(check: BashCheck): Promise<void> {
|
|
|
142
142
|
process.exit(0);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
const skills = await
|
|
145
|
+
const skills = await readAvailableSkills(path.join(check.projectDir, '.claude', 'skills'));
|
|
146
146
|
const sessionTranscript = await readTranscript(resolveSessionTranscriptPath(check.hookInput));
|
|
147
147
|
|
|
148
148
|
const sessionLoads = collectLoadedSkills(sessionTranscript);
|
|
@@ -183,7 +183,7 @@ function toProjectPath(projectDir: string, absolute: string): string {
|
|
|
183
183
|
return path.relative(projectDir, absolute).split(path.sep).join('/');
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
async function
|
|
186
|
+
async function readAvailableSkills(skillsDir: string): Promise<readonly string[]> {
|
|
187
187
|
const skills: string[] = [];
|
|
188
188
|
|
|
189
189
|
const scan = new Bun.Glob('*/SKILL.md').scan({ cwd: skillsDir, followSymlinks: true });
|