frankxai/awesome-hermes-agent-skills / skills/ecc-session-guard
ecc-session-guard
VerifiedUse when a Hermes session is about to edit a linter config or a TypeScript file. Warns on console.log and blocks weakening an existing formatter config. Does not install the ECC marketplace.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.0 KB |
| upstream-hooks/check-console-log.py | script | 2.5 KB |
| upstream-hooks/config-protection.py | script | 4.6 KB |
upstream-hooks/check-console-log.py
View on GitHub#!/usr/bin/env python3
"""
Hermes native hook (ported from ECC's scripts/hooks/check-console-log.js).
post_tool_call observer: after any file edit, WARN (never block) when the
edited file now contains console.log(). Print to stderr only — Hermes shows
hook stderr as a warning line.
Contract (agent/shell_hooks.py):
stdin : JSON payload {"hook_event_name":"post_tool_call","tool_name":"...",
"tool_input":{...},"tool_result":{...}}
exit : 0 (observer, no stdout JSON)
Error handling: fail-open by design (observers must not brick the agent),
but never silent — every swallowed path writes a one-line stderr diagnostic.
"""
import json
import os
import re
import sys
EDIT_TOOLS = {"patch", "write_file", "edit", "write", "apply_patch", "str_replace_editor"}
EXCLUDE = re.compile(r"(\.d\.ts$|/__tests?__/|\.test\.[tj]sx?$|\.spec\.[tj]sx?$|/scripts/|console-safety)")
def _warn(msg: str) -> None:
sys.stderr.write(f"[ecc-check-console-log] {msg}\n")
def main() -> int:
raw = sys.stdin.read()
try:
payload = json.loads(raw) if raw.strip() else {}
if not isinstance(payload, dict):
_warn(f"payload is {type(payload).__name__}, not an object — skipping")
return 0
except ValueError as exc:
_warn(f"unparseable payload ({exc}) — skipping")
return 0
tool = str(payload.get("tool_name") or "")
if tool not in EDIT_TOOLS:
return 0
ti = payload.get("tool_input") or {}
if not isinstance(ti, dict):
_warn("tool_input is not an object — skipping")
return 0
path = None
for key in ("path", "file_path", "filePath", "target"):
v = ti.get(key)
if isinstance(v, str) and v.strip():
path = v.strip()
break
if not path:
_warn(f"no path found in tool_input for tool {tool!r} — skipping")
return 0
if not re.search(r"\.[tj]sx?$", path) or EXCLUDE.search(path):
return 0
if not os.path.isfile(path):
_warn(f"{path} is not a regular file on disk — skipping")
return 0
try:
with open(path, "r", errors="replace") as f:
content = f.read()
except OSError as exc:
_warn(f"could not read {path} ({exc.strerror or exc}) — skipping")
return 0
if "console.log(" in content:
_warn(
f"console.log() present in {path} — remove it before committing "
"(use the project logger instead)."
)
return 0
if __name__ == "__main__":
sys.exit(main())Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |