Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Consiliency_treesitter-chunker /.claude /hooks /post_tool_use.py
| #!/usr / bin / env -S uv run --script | |
| # /// script | |
| # requires = { python = ">=3.8" } | |
| # /// | |
| import json | |
| import sys | |
| from utils.constants import ensure_session_log_dir | |
| def main(): | |
| try: | |
| # Read JSON input from stdin | |
| input_data = json.load(sys.stdin) | |
| # Extract session_id | |
| session_id = input_data.get("session_id", "unknown") | |
| # Ensure session log directory exists | |
| log_dir = ensure_session_log_dir(session_id) | |
| log_path = log_dir / "post_tool_use.json" | |
| # Read existing log data or initialize empty list | |
| if log_path.exists(): | |
| with open(log_path) as f: | |
| try: | |
| log_data = json.load(f) | |
| except (json.JSONDecodeError, ValueError): | |
| log_data = [] | |
| else: | |
| log_data = [] | |
| # Append new data | |
| log_data.append(input_data) | |
| # Write back to file with formatting | |
| with open(log_path, "w") as f: | |
| json.dump(log_data, f, indent=2) | |
| sys.exit(0) | |
| except json.JSONDecodeError: | |
| # Handle JSON decode errors gracefully | |
| sys.exit(0) | |
| except Exception: | |
| # Exit cleanly on any other error | |
| sys.exit(0) | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 1.27 kB
- Xet hash:
- c21283ab7412899c7e5f7989f61ca3eee3867981d52b603c26e1eaca8db6fd56
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.