spark: add hermes debug helper script hediff.sh
This commit is contained in:
1 parent
d9e4a66561
commit
803595a7ab
2 files changed
+154
No files matched your search
@@ -0,0 +1,40 @@
|
||||
# hediff.sh - Verification Artifact
|
||||
# Created: 2025-01-21
|
||||
|
||||
## Summary
|
||||
Created `/root/.hermes/wizard-outputs/spark/hediff.sh` - A Hermes Environment Debug Helper script that:
|
||||
- Creates test files in temp directories
|
||||
- Verifies file operations work correctly
|
||||
- Checks directory structure exists
|
||||
- Tests tool access (Python, hermes_tools)
|
||||
|
||||
## Test Results
|
||||
```
|
||||
=== Hermes Environment Debug Helper ===
|
||||
|
||||
Testing file operations...
|
||||
✓ File created successfully: /tmp/hediff_test_1748592/test_result.txt
|
||||
File size: 247 bytes
|
||||
Line count: 7 lines
|
||||
|
||||
Checking directory structure...
|
||||
✓ Directory exists: /root/.hermes/profiles/spark
|
||||
✓ Directory exists: /root/.hermes/wizard-outputs/spark
|
||||
✓ Directory exists: /tmp/hediff_test_1748592
|
||||
|
||||
Testing tool access...
|
||||
✓ Python3 available: Python 3.14.9
|
||||
○ hermes_tools module not in current Python environment
|
||||
|
||||
Cleaned up test directory: /tmp/hediff_test_1748592
|
||||
|
||||
Debug check complete.
|
||||
```
|
||||
|
||||
## Exit Code
|
||||
Script exit code: 0 (success)
|
||||
|
||||
## Verification
|
||||
- Script is executable: yes
|
||||
- File operations verified: yes
|
||||
- Directory structure verified: yes
|
||||
Executable
+114
@@ -0,0 +1,114 @@
|
||||
#!/bin/bash
|
||||
# hediff.sh - Hermes Environment Debug Helper
|
||||
# Quick utility to verify common debugging scenarios
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Color codes for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Create test directory and file
|
||||
TEST_DIR="/tmp/hediff_test_$$"
|
||||
TEST_FILE="$TEST_DIR/test_result.txt"
|
||||
|
||||
create_test_environment() {
|
||||
mkdir -p "$TEST_DIR"
|
||||
|
||||
{
|
||||
echo "=== Test Environment Diagnostic ==="
|
||||
echo "Process ID: $$"
|
||||
echo "Timestamp: $(date -Iseconds)"
|
||||
echo "User: $(whoami)"
|
||||
echo "Working Directory: $(pwd)"
|
||||
echo "Temp Directory: ${TMPDIR:-/tmp}"
|
||||
echo "Hermes Scratch: /root/.hermes/profiles/spark/cache/scratch"
|
||||
} > "$TEST_FILE"
|
||||
}
|
||||
|
||||
verify_file_operation() {
|
||||
local filepath="$1"
|
||||
|
||||
if [[ -f "$filepath" ]] && [[ -s "$filepath" ]]; then
|
||||
echo -e "${GREEN}✓ File created successfully: $filepath${NC}"
|
||||
echo "File size: $(wc -c < "$filepath") bytes"
|
||||
echo "Line count: $(wc -l < "$filepath") lines"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ File creation failed: $filepath${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
verify_directory_structure() {
|
||||
local basedir="$1"
|
||||
|
||||
local required_dirs=(
|
||||
"/root/.hermes/profiles/spark"
|
||||
"/root/.hermes/wizard-outputs/spark"
|
||||
"$basedir"
|
||||
)
|
||||
|
||||
for dir in "${required_dirs[@]}"; do
|
||||
if [[ -d "$dir" ]]; then
|
||||
echo -e "${GREEN}✓ Directory exists: $dir${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}✗ Directory missing: $dir${NC}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
verify_tool_access() {
|
||||
echo "Testing tool access..."
|
||||
|
||||
# Test Python availability
|
||||
if command -v python3 &> /dev/null; then
|
||||
echo -e "${GREEN}✓ Python3 available: $(python3 --version)${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Python3 not found${NC}"
|
||||
fi
|
||||
|
||||
# Test hermes-tools import (if available)
|
||||
if python3 -c "import hermes_tools" 2>/dev/null; then
|
||||
echo -e "${GREEN}✓ hermes_tools module accessible${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}○ hermes_tools module not in current Python environment${NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
if [[ -d "$TEST_DIR" ]]; then
|
||||
rm -rf "$TEST_DIR"
|
||||
echo "Cleaned up test directory: $TEST_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main execution
|
||||
main() {
|
||||
echo "=== Hermes Environment Debug Helper ==="
|
||||
echo ""
|
||||
|
||||
echo "Testing file operations..."
|
||||
create_test_environment
|
||||
verify_file_operation "$TEST_FILE"
|
||||
echo ""
|
||||
|
||||
if [[ "${1:-}" != "--no-dirs" ]]; then
|
||||
echo "Checking directory structure..."
|
||||
verify_directory_structure "$TEST_DIR"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
verify_tool_access
|
||||
echo ""
|
||||
|
||||
cleanup
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}Debug check complete.${NC}"
|
||||
}
|
||||
|
||||
# Run with any arguments passed to main
|
||||
main "$@"
|
||||
Reference in new issue
Block a user