Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: add event type enum to hooks schema and avoid shared RegExp state

Affaan Mustafa7ec5fc3a52d0
diff --git a/README.md b/README.md
index 2fe72eaab..0e75d30b0 100644
--- a/README.md
+++ b/README.md
@@ -374,7 +374,7 @@ Both options create:
### 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.
diff --git a/schemas/hooks.schema.json b/schemas/hooks.schema.json
index ceb2bd9bb..cd58cfb19 100644
--- a/schemas/hooks.schema.json
+++ b/schemas/hooks.schema.json
@@ -11,7 +11,18 @@
],
"properties": {
"type": {
- "type": "string"
+ "type": "string",
+ "enum": [
+ "PreToolUse",
+ "PostToolUse",
+ "PreCompact",
+ "SessionStart",
+ "SessionEnd",
+ "Stop",
+ "Notification",
+ "SubagentStop"
+ ],
+ "description": "Hook event type that triggers this hook"
},
"command": {
"oneOf": [
diff --git a/scripts/lib/utils.js b/scripts/lib/utils.js
index b675a08bd..a0b548c9d 100644
--- a/scripts/lib/utils.js
+++ b/scripts/lib/utils.js
@@ -418,8 +418,8 @@ function countInFile(filePath, pattern) {
let regex;
try {
if (pattern instanceof RegExp) {
- // Ensure global flag is set for correct counting
- regex = pattern.global ? pattern : new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g');
+ // Always create new RegExp to avoid shared lastIndex state; ensure global flag
+ regex = new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g');
} else if (typeof pattern === 'string') {
regex = new RegExp(pattern, 'g');
} else {