mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-07 01:33:31 +08:00
fix: add event type enum to hooks schema and avoid shared RegExp state
- hooks.schema.json: add enum constraint for hook event types (PreToolUse, PostToolUse, PreCompact, SessionStart, SessionEnd, Stop, Notification, SubagentStop) — enables IDE autocompletion and compile-time validation - utils.js countInFile: always create fresh RegExp to avoid shared lastIndex state when reusing global regex instances - README: update AgentShield stats (751 tests, 73 rules)
This commit is contained in:
@@ -374,7 +374,7 @@ Both options create:
|
|||||||
|
|
||||||
### AgentShield — Security Auditor
|
### AgentShield — Security Auditor
|
||||||
|
|
||||||
> Built at the Claude Code Hackathon (Cerebral Valley x Anthropic, Feb 2026). 697 tests, 98% coverage, 63 static analysis rules.
|
> Built at the Claude Code Hackathon (Cerebral Valley x Anthropic, Feb 2026). 751 tests, 98% coverage, 73 static analysis rules.
|
||||||
|
|
||||||
Scan your Claude Code configuration for vulnerabilities, misconfigurations, and injection risks.
|
Scan your Claude Code configuration for vulnerabilities, misconfigurations, and injection risks.
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,18 @@
|
|||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"PreToolUse",
|
||||||
|
"PostToolUse",
|
||||||
|
"PreCompact",
|
||||||
|
"SessionStart",
|
||||||
|
"SessionEnd",
|
||||||
|
"Stop",
|
||||||
|
"Notification",
|
||||||
|
"SubagentStop"
|
||||||
|
],
|
||||||
|
"description": "Hook event type that triggers this hook"
|
||||||
},
|
},
|
||||||
"command": {
|
"command": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
|
|||||||
@@ -418,8 +418,8 @@ function countInFile(filePath, pattern) {
|
|||||||
let regex;
|
let regex;
|
||||||
try {
|
try {
|
||||||
if (pattern instanceof RegExp) {
|
if (pattern instanceof RegExp) {
|
||||||
// Ensure global flag is set for correct counting
|
// Always create new RegExp to avoid shared lastIndex state; ensure global flag
|
||||||
regex = pattern.global ? pattern : new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g');
|
regex = new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g');
|
||||||
} else if (typeof pattern === 'string') {
|
} else if (typeof pattern === 'string') {
|
||||||
regex = new RegExp(pattern, 'g');
|
regex = new RegExp(pattern, 'g');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user