Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions .claude/hooks/block-secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,41 @@
Prevents Claude from reading or editing sensitive files.
Exit code 2 = block operation and tell Claude why.
"""

import json
import sys
from pathlib import Path

SENSITIVE_FILENAMES = {
'.env', '.env.local', '.env.production', '.env.staging', '.env.development',
'secrets.json', 'secrets.yaml', 'id_rsa', 'id_ed25519',
'.npmrc', '.pypirc', 'credentials.json', 'service-account.json',
'.docker/config.json',
".env",
".env.local",
".env.production",
".env.staging",
".env.development",
"secrets.json",
"secrets.yaml",
"id_rsa",
"id_ed25519",
".npmrc",
".pypirc",
"credentials.json",
"service-account.json",
".docker/config.json",
}

SENSITIVE_PATTERNS = ['aws/credentials', '.ssh/', 'private_key', 'secret_key']
SENSITIVE_PATTERNS = ["aws/credentials", ".ssh/", "private_key", "secret_key"]

try:
data = json.load(sys.stdin)
tool_name = data.get('tool_name', '')
file_path = data.get('tool_input', {}).get('file_path', '')
tool_name = data.get("tool_name", "")
file_path = data.get("tool_input", {}).get("file_path", "")

if not file_path:
sys.exit(0)

path = Path(file_path)

if tool_name == 'Write' and path.name.startswith('.env'):
if tool_name == "Write" and path.name.startswith(".env"):
sys.exit(0)

if path.name in SENSITIVE_FILENAMES:
Expand All @@ -36,7 +47,9 @@

for pattern in SENSITIVE_PATTERNS:
if pattern in str(path):
print(f"BLOCKED: Access to '{file_path}' denied. Path matches sensitive pattern '{pattern}'.", file=sys.stderr)
print(
f"BLOCKED: Access to '{file_path}' denied. Path matches sensitive pattern '{pattern}'.", file=sys.stderr
)
sys.exit(2)

sys.exit(0)
Expand Down
9 changes: 9 additions & 0 deletions calibrate_pro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,40 @@
__version__ = "1.0.0"
__author__ = "Zain Dana Harper"


# Lazy imports to avoid circular dependencies
def __getattr__(name):
if name == "color_math":
from calibrate_pro.core import color_math

return color_math
elif name == "icc_profile":
from calibrate_pro.core import icc_profile

return icc_profile
elif name == "lut_engine":
from calibrate_pro.core import lut_engine

return lut_engine
elif name == "calibration_engine":
from calibrate_pro.core import calibration_engine

return calibration_engine
elif name == "database":
from calibrate_pro.panels import database

return database
elif name == "detection":
from calibrate_pro.panels import detection

return detection
elif name == "neuralux":
from calibrate_pro.sensorless import neuralux

return neuralux
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


__all__ = [
"color_math",
"icc_profile",
Expand Down
5 changes: 0 additions & 5 deletions calibrate_pro/advanced/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
"grade_to_string",
"create_test_measurements",
"print_uniformity_summary",

# Ambient Light Adaptation
"AdaptationMode",
"ProfileType",
Expand All @@ -208,7 +207,6 @@
"condition_to_string",
"create_default_schedule",
"print_adaptation_status",

# Network/Fleet Calibration
"NodeStatus",
"JobStatus",
Expand All @@ -225,7 +223,6 @@
"ProfileSyncManager",
"create_test_nodes",
"print_fleet_status",

# 3D LUT Optimization
"SmoothingMethod",
"GamutMappingMethod",
Expand All @@ -246,7 +243,6 @@
"create_identity_lut",
"create_test_lut",
"print_optimization_summary",

# Automation API
"TaskStatus",
"TaskType",
Expand All @@ -263,7 +259,6 @@
"run_cli",
"create_cli_parser",
"print_workflow_status",

# Convenience Aliases
"Uniformity",
"AmbientLight",
Expand Down
Loading
Loading