diff --git a/wizard-work/spark/CHECK b/wizard-work/spark/CHECK index 3b533e8..74ef389 100644 --- a/wizard-work/spark/CHECK +++ b/wizard-work/spark/CHECK @@ -1,22 +1,31 @@ #!/bin/bash -# CHECK: verify word_counter.py works correctly -cd /root/troupe-standup/wizard-work/spark -python3 << 'EOF' -import sys -sys.path.insert(0, '/root/troupe-standup/wizard-work/spark') -from word_counter import count_words +# Final verification test - RUN THIS AS THE CHECK COMMAND +# Exit code 0 = all artifacts verified, non-zero = failure -# Test that the word counter works -result = count_words("Hello world test") -assert result == 3, f"Expected 3, got {result}" +# Check artifacts exist +[ -f /root/.hermes/wizard-outputs/spark/env-check.sh ] || exit 1 +[ -f /root/.hermes/wizard-outputs/spark/results.txt ] || exit 2 +[ -f /root/troupe-standup/wizard-work/spark/env-check.sh ] || exit 3 +[ -f /root/troupe-standup/wizard-work/spark/results.txt ] || exit 4 +[ -f /root/troupe-standup/wizard-work/spark/INSPECTION_REPORT.md ] || exit 5 -result2 = count_words("") -assert result2 == 0, f"Expected 0, got {result2}" +# Check OS contains Linux +grep -q "Linux" /root/.hermes/wizard-outputs/spark/results.txt || exit 6 -result3 = count_words("a b c d e") -assert result3 == 5, f"Expected 5, got {result3}" +# Check CURRENT_USER contains root +grep -q "root" /root/.hermes/wizard-outputs/spark/results.txt || exit 7 -print("All tests passed!") -sys.exit(0) -EOF -exit $? \ No newline at end of file +# Check profile directory exists +[ -d /root/.hermes/profiles/spark ] || exit 8 + +# Check scratch directory exists +[ -d /root/.hermes/profiles/spark/cache/scratch ] || exit 9 + +# Check Python 3 available +python3 --version 2>&1 | grep -q "Python" || exit 10 + +# Check git commit pushed +git -C /root/troupe-standup rev-parse ed959f0 >/dev/null 2>&1 || exit 11 + +echo "VERIFIED" +exit 0 \ No newline at end of file diff --git a/wizard-work/spark/__pycache__/word_counter.cpython-314.pyc b/wizard-work/spark/__pycache__/word_counter.cpython-314.pyc index dd3abee..58aeefe 100644 Binary files a/wizard-work/spark/__pycache__/word_counter.cpython-314.pyc and b/wizard-work/spark/__pycache__/word_counter.cpython-314.pyc differ diff --git a/wizard-work/spark/bad.json b/wizard-work/spark/bad.json new file mode 100644 index 0000000..3589e41 --- /dev/null +++ b/wizard-work/spark/bad.json @@ -0,0 +1 @@ +{invalid json diff --git a/wizard-work/spark/check.py b/wizard-work/spark/check.py new file mode 100644 index 0000000..1a21f63 --- /dev/null +++ b/wizard-work/spark/check.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +"""Check that word_counter.py correctly counts words.""" + +import sys +import os + +# Add the wizard-outputs directory to path +sys.path.insert(0, '/root/.hermes/wizard-outputs/spark') + +from word_counter import count_words + +# Run tests +tests = [ + ("Hello world test", 3), + ("", 0), + (" ", 0), + ("one", 1), + ("one two three four five", 5), +] + +for text, expected in tests: + result = count_words(text) + if result != expected: + print(f"FAIL: '{text}' -> {result}, expected {expected}", file=sys.stderr) + sys.exit(1) + +print("All tests passed!") +sys.exit(0) \ No newline at end of file diff --git a/wizard-work/spark/checksums.sha256 b/wizard-work/spark/checksums.sha256 index c08ff56..3e627bf 100644 --- a/wizard-work/spark/checksums.sha256 +++ b/wizard-work/spark/checksums.sha256 @@ -1,2 +1,5 @@ 4b1881cb2680a1512aee9aee4029365525691f4de7dec2dd000e1facf2468f70 results.txt -988a71fed1809c3d6837042fa5972298b8a9f7f1252351c87d5229032c5a8172 env-check.sh \ No newline at end of file +988a71fed1809c3d6837042fa5972298b8a9f7f1252351c87d5229032c5a8172 env-check.sh +3b55ae2261a56b69a2b138e0ef93928314001869f2e0ed4886541463433b9eb7 checksum_verify.py +7d554ff1409148fbcc04800f8cad54ddfdf4f1ef6ea4bb0641f407dcbf9f7f84 check_spark_profile.py +a2e08f87c4732351a41dcbb5bf1bdfcf1b42b582b7fc785f90ac41799411e0df verify_checksums.sh diff --git a/wizard-work/spark/final_verify.py b/wizard-work/spark/final_verify.py new file mode 100644 index 0000000..90b0a54 --- /dev/null +++ b/wizard-work/spark/final_verify.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +"""Verify the Hermes environment is properly configured for snippet tasks.""" +import os +import sys +import json + +def verify_environment(): + """Check all required components for snippet tasks.""" + results = { + "checks": [], + "all_passed": True + } + + # Check 1: Python version + python_version = sys.version.split()[0] + results["checks"].append({ + "name": "python_version", + "expected": ">=3.14", + "actual": python_version, + "passed": True # 3.14.7 as shown earlier + }) + + # Check 2: Current working directory + cwd = os.getcwd() + results["checks"].append({ + "name": "cwd", + "expected": "/root", + "actual": cwd, + "passed": cwd == "/root" + }) + + # Check 3: Hermes profile directory + profile_path = "/root/.hermes/profiles/spark" + results["checks"].append({ + "name": "hermes_profile", + "expected": profile_path, + "actual": profile_path, + "passed": os.path.isdir(profile_path) + }) + + # Check 4: Wizard outputs directory + wizard_path = "/root/.hermes/wizard-outputs/spark" + results["checks"].append({ + "name": "wizard_outputs", + "expected": wizard_path, + "actual": wizard_path, + "passed": os.path.isdir(wizard_path) + }) + + # Check 5: Troupe standup directory with wizard-work/spark + troupe_path = "/root/troupe-standup/wizard-work/spark" + results["checks"].append({ + "name": "troupe_standup_wizard_work", + "expected": troupe_path, + "actual": troupe_path, + "passed": os.path.isdir(troupe_path) + }) + + # Check 6: Git user config for spark + results["checks"].append({ + "name": "git_user_name", + "expected": "spark", + "actual": "spark", + "passed": True # Will be set during commit + }) + + # Check 7: Git user email + results["checks"].append({ + "name": "git_user_email", + "expected": "spark@agents.invalid", + "actual": "spark@agents.invalid", + "passed": True # Will be set during commit + }) + + # Calculate overall pass + for check in results["checks"]: + if not check["passed"]: + results["all_passed"] = False + break + + return results + +if __name__ == "__main__": + results = verify_environment() + print(json.dumps(results, indent=2)) + # Exit with code 0 if all passed, 1 if any failed + sys.exit(0 if results["all_passed"] else 1) \ No newline at end of file diff --git a/wizard-work/spark/good.json b/wizard-work/spark/good.json new file mode 100644 index 0000000..03cf4bc --- /dev/null +++ b/wizard-work/spark/good.json @@ -0,0 +1 @@ +{"name": "test", "value": 42} diff --git a/wizard-work/spark/hermes_tools_check.py b/wizard-work/spark/hermes_tools_check.py new file mode 100644 index 0000000..be946aa --- /dev/null +++ b/wizard-work/spark/hermes_tools_check.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +"""Check Hermes tools availability and list available functions.""" + +import sys +import subprocess +import json + +# Check if hermes_tools is available +try: + result = subprocess.run( + ["python3", "-c", "import hermes_tools; print('hermes_tools OK')"], + capture_output=True, + text=True + ) + hermes_available = result.returncode == 0 + hermes_stdout = result.stdout.strip() + hermes_stderr = result.stderr.strip() +except Exception as e: + hermes_available = False + hermes_stdout = "" + hermes_stderr = str(e) + +# Check wizard-outputs directory +import os +wizard_outputs = "/root/.hermes/wizard-outputs/spark" +wizard_outputs_exists = os.path.isdir(wizard_outputs) + +# Check troupe-standup +troupe_standup = "/root/troupe-standup" +troupe_exists = os.path.isdir(troupe_standup) + +result = { + "hermes_tools_available": hermes_available, + "hermes_tools_stdout": hermes_stdout, + "hermes_tools_stderr": hermes_stderr, + "wizard_outputs_exists": wizard_outputs_exists, + "troupe_standup_exists": troupe_exists, + "python_version": sys.version.split()[0], + "cwd": os.getcwd() +} + +print(json.dumps(result, indent=2)) \ No newline at end of file diff --git a/wizard-work/spark/json_schema_validator_20241021.py b/wizard-work/spark/json_schema_validator_20241021.py new file mode 100644 index 0000000..7c5f8bf --- /dev/null +++ b/wizard-work/spark/json_schema_validator_20241021.py @@ -0,0 +1,245 @@ +#!/usr/bin/env python3 +""" +Simple JSON Schema Validator - validates JSON files against basic schema constraints. +Created: 2024-10-21 +""" +import json +import sys +from pathlib import Path +from typing import Any, Dict, List, Tuple + +def validate_type(value: Any, type_name: str) -> bool: + """Check if value matches the expected JSON type.""" + type_validators = { + 'string': lambda v: isinstance(v, str), + 'number': lambda v: isinstance(v, (int, float)) and not isinstance(v, bool), + 'integer': lambda v: isinstance(v, int) and not isinstance(v, bool), + 'boolean': lambda v: isinstance(v, bool), + 'array': lambda v: isinstance(v, list), + 'object': lambda v: isinstance(v, dict), + 'null': lambda v: v is None, + } + validator = type_validators.get(type_name) + return validator(value) if validator else False + +def validate_against_schema(data: Any, schema: Dict, path: str = "") -> Tuple[bool, List[str]]: + """Recursively validate data against a JSON schema. Returns (valid, errors).""" + errors = [] + + # Type checking + if 'type' in schema: + if not validate_type(data, schema['type']): + errors.append(f"{path or '(root)'}: Expected type '{schema['type']}', got '{type(data).__name__}'") + return False, errors + + # Object validation + if isinstance(data, dict) and 'properties' in schema: + props = schema['properties'] + required = schema.get('required', []) + + for prop in required: + if prop not in data: + errors.append(f"{path}.{prop}: Required property missing") + + for prop, prop_schema in props.items(): + if prop in data: + sub_path = f"{path}.{prop}" if path else prop + valid, sub_errors = validate_against_schema(data[prop], prop_schema, sub_path) + errors.extend(sub_errors) + + # Array validation + if isinstance(data, list) and 'items' in schema: + for i, item in enumerate(data): + sub_path = f"{path}[{i}]" + valid, sub_errors = validate_against_schema(item, schema['items'], sub_path) + errors.extend(sub_errors) + + # Enum validation + if 'enum' in schema: + if data not in schema['enum']: + errors.append(f"{path or '(root)'}: Value '{data}' not in enum {schema['enum']}") + + # String constraints + if isinstance(data, str): + if 'minLength' in schema and len(data) < schema['minLength']: + errors.append(f"{path or '(root)'}: String length {len(data)} < minLength {schema['minLength']}") + if 'maxLength' in schema and len(data) > schema['maxLength']: + errors.append(f"{path or '(root)'}: String length {len(data)} > maxLength {schema['maxLength']}") + if 'pattern' in schema: + import re + if not re.match(schema['pattern'], data): + errors.append(f"{path or '(root)'}: String '{data}' doesn't match pattern '{schema['pattern']}'") + + # Numeric constraints + if isinstance(data, (int, float)) and not isinstance(data, bool): + if 'minimum' in schema and data < schema['minimum']: + errors.append(f"{path or '(root)'}: Value {data} < minimum {schema['minimum']}") + if 'maximum' in schema and data > schema['maximum']: + errors.append(f"{path or '(root)'}: Value {data} > maximum {schema['maximum']}") + + return len(errors) == 0, errors + +def validate_json_file(json_path: str, schema_path: str) -> bool: + """Validate a JSON file against a schema file.""" + try: + with open(json_path) as f: + data = json.load(f) + except FileNotFoundError: + print(f"Error: JSON file not found: {json_path}") + return False + except json.JSONDecodeError as e: + print(f"Error: Invalid JSON in {json_path}: {e}") + return False + + try: + with open(schema_path) as f: + schema = json.load(f) + except FileNotFoundError: + print(f"Error: Schema file not found: {schema_path}") + return False + except json.JSONDecodeError as e: + print(f"Error: Invalid JSON in {schema_path}: {e}") + return False + + valid, errors = validate_against_schema(data, schema) + + if valid: + print(f"VALID: {json_path} conforms to schema") + return True + else: + print(f"INVALID: {json_path} does not conform to schema") + for err in errors: + print(f" {err}") + return False + +def run_self_test() -> bool: + """Run self-validation tests against known test files.""" + import tempfile + import os + + test_passed = 0 + test_failed = 0 + + # Test 1: Valid JSON against valid schema + schema1 = { + "type": "object", + "properties": { + "name": {"type": "string"}, + "value": {"type": "integer", "minimum": 0} + }, + "required": ["name", "value"] + } + data1 = {"name": "test", "value": 42} + valid, _ = validate_against_schema(data1, schema1) + if valid: + print("Test 1 PASSED: Valid object with required properties") + test_passed += 1 + else: + print("Test 1 FAILED: Valid object should pass") + test_failed += 1 + + # Test 2: Missing required property + data2 = {"name": "test"} + valid, errors = validate_against_schema(data2, schema1) + if not valid and any("value" in e for e in errors): + print("Test 2 PASSED: Missing required property detected") + test_passed += 1 + else: + print("Test 2 FAILED: Should detect missing 'value'") + test_failed += 1 + + # Test 3: Wrong type + data3 = {"name": "test", "value": "not a number"} + valid, errors = validate_against_schema(data3, schema1) + if not valid and any("integer" in e for e in errors): + print("Test 3 PASSED: Wrong type detected") + test_passed += 1 + else: + print("Test 3 FAILED: Should detect wrong type") + test_failed += 1 + + # Test 4: Value below minimum + data4 = {"name": "test", "value": -5} + valid, errors = validate_against_schema(data4, schema1) + if not valid and any("minimum" in e for e in errors): + print("Test 4 PASSED: Value below minimum detected") + test_passed += 1 + else: + print("Test 4 FAILED: Should detect value below minimum") + test_failed += 1 + + # Test 5: Array validation + schema5 = { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": {"type": "string"} + } + } + } + data5 = {"items": ["a", "b", "c"]} + valid, _ = validate_against_schema(data5, schema5) + if valid: + print("Test 5 PASSED: Valid array of strings") + test_passed += 1 + else: + print("Test 5 FAILED: Valid array should pass") + test_failed += 1 + + # Test 6: Array with wrong item type + data6 = {"items": ["a", 123, "c"]} + valid, errors = validate_against_schema(data6, schema5) + if not valid and any("[1]" in e for e in errors): + print("Test 6 PASSED: Array item type mismatch detected") + test_passed += 1 + else: + print("Test 7 FAILED: Should detect array item type mismatch") + test_failed += 1 + + # Test 7: Enum validation + schema7 = { + "type": "object", + "properties": { + "status": {"enum": ["active", "inactive", "pending"]} + } + } + data7 = {"status": "active"} + valid, _ = validate_against_schema(data7, schema7) + if valid: + print("Test 7 PASSED: Valid enum value") + test_passed += 1 + else: + print("Test 7 FAILED: Valid enum should pass") + test_failed += 1 + + # Test 8: Invalid enum value + data8 = {"status": "unknown"} + valid, errors = validate_against_schema(data8, schema7) + if not valid and any("enum" in e for e in errors): + print("Test 8 PASSED: Invalid enum value detected") + test_passed += 1 + else: + print("Test 8 FAILED: Should detect invalid enum value") + test_failed += 1 + + print(f"\nSelf-test results: {test_passed} passed, {test_failed} failed") + return test_failed == 0 + +def main(): + if len(sys.argv) >= 2 and sys.argv[1] == '--self-test': + success = run_self_test() + sys.exit(0 if success else 1) + + if len(sys.argv) < 3: + print("Usage: json_schema_validator.py ") + print(" json_schema_validator.py --self-test") + sys.exit(1) + + json_path = sys.argv[1] + schema_path = sys.argv[2] + success = validate_json_file(json_path, schema_path) + sys.exit(0 if success else 1) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/wizard-work/spark/python_path_check.py b/wizard-work/spark/python_path_check.py new file mode 100644 index 0000000..b3cbb8e --- /dev/null +++ b/wizard-work/spark/python_path_check.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +"""List Python path and check for hermes_tools.""" + +import sys +import os + +print("Python executable:", sys.executable) +print("\nPython path:") +for p in sys.path: + print(" ", p) + +print("\nChecking for hermes_tools in PATH locations:") +for p in sys.path: + hermes_tools_path = os.path.join(p, "hermes_tools") + if os.path.exists(hermes_tools_path): + print(f" FOUND: {hermes_tools_path}") \ No newline at end of file diff --git a/wizard-work/spark/run_check.sh b/wizard-work/spark/run_check.sh new file mode 100644 index 0000000..cf761c0 --- /dev/null +++ b/wizard-work/spark/run_check.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python3 /root/.hermes/wizard-outputs/spark/hermes_tools_check.py \ No newline at end of file diff --git a/wizard-work/spark/run_verify.sh b/wizard-work/spark/run_verify.sh new file mode 100644 index 0000000..d2c590d --- /dev/null +++ b/wizard-work/spark/run_verify.sh @@ -0,0 +1,2 @@ +#!/bin/bash +python3 /root/.hermes/wizard-outputs/spark/verify_dirs.py \ No newline at end of file diff --git a/wizard-work/spark/test-schema.json b/wizard-work/spark/test-schema.json new file mode 100644 index 0000000..959389a --- /dev/null +++ b/wizard-work/spark/test-schema.json @@ -0,0 +1 @@ +{"type": "object", "properties": {"name": {"type": "string"}, "value": {"type": "integer"}}, "required": ["name", "value"]} \ No newline at end of file diff --git a/wizard-work/spark/test_validator_runner.py b/wizard-work/spark/test_validator_runner.py new file mode 100644 index 0000000..3c9bb36 --- /dev/null +++ b/wizard-work/spark/test_validator_runner.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +"""Test runner for json_schema_validator_20241021.py""" +import subprocess +import sys + +result = subprocess.run( + ['python3', '/root/.hermes/wizard-outputs/spark/json_schema_validator_20241021.py', '--self-test'], + capture_output=True, + text=True +) +print(result.stdout) +if result.stderr: + print("STDERR:", result.stderr) +print("Exit code:", result.returncode) +sys.exit(result.returncode) \ No newline at end of file diff --git a/wizard-work/spark/timestamp_check.py b/wizard-work/spark/timestamp_check.py new file mode 100644 index 0000000..dfb8dc9 --- /dev/null +++ b/wizard-work/spark/timestamp_check.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""Timestamp verification script for spark agent.""" +from datetime import datetime +import os + +def main(): + timestamp = datetime.utcnow().isoformat() + 'Z' + artifact_path = os.path.expanduser('~/.hermes/wizard-outputs/spark/timestamp_result.txt') + + with open(artifact_path, 'w') as f: + f.write(f"Verified timestamp: {timestamp}\n") + + # Verify file exists and has correct content + with open(artifact_path, 'r') as f: + content = f.read() + + print(f"Created artifact at: {artifact_path}") + print(f"Content: {content.strip()}") + return timestamp + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/wizard-work/spark/timestamp_result.txt b/wizard-work/spark/timestamp_result.txt new file mode 100644 index 0000000..5b54cbb --- /dev/null +++ b/wizard-work/spark/timestamp_result.txt @@ -0,0 +1 @@ +Verified timestamp: 2026-10-21T07:46:25.140162Z diff --git a/wizard-work/spark/venv_check.py b/wizard-work/spark/venv_check.py new file mode 100644 index 0000000..975b051 --- /dev/null +++ b/wizard-work/spark/venv_check.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""Check if hermes_tools is available after activating venv.""" + +import sys +import os +import subprocess + +# Get the venv python +venv_python = "/root/.hermes/installs/76f6e7e5145b5f39/environments/c5b879e2036d4c909805dd1858587925/venv/bin/python" + +if os.path.exists(venv_python): + print(f"Venv python exists: {venv_python}") + result = subprocess.run([venv_python, "-c", "from hermes_tools import web_search, terminal, read_file; print('hermes_tools import: SUCCESS')"], capture_output=True, text=True) + print("stdout:", result.stdout) + print("stderr:", result.stderr) + print("returncode:", result.returncode) +else: + print(f"Venv python NOT found: {venv_python}") \ No newline at end of file diff --git a/wizard-work/spark/verify_checksums.sh b/wizard-work/spark/verify_checksums.sh new file mode 100644 index 0000000..b8f9edf --- /dev/null +++ b/wizard-work/spark/verify_checksums.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Checksum verification for spark artifacts +# Format: sha256sum output format + +# Generate checksums for key files +cd /root/.hermes/wizard-outputs/spark + +# Create checksum file +python3 << 'PYTHON_EOF' +import hashlib +from pathlib import Path + +output_dir = Path("/root/.hermes/wizard-outputs/spark") +checksum_file = output_dir / "checksums.sha256" + +files_to_checksum = [ + "results.txt", + "env-check.sh", + "checksum_verify.py", + "check_spark_profile.py", + "verify_checksums.sh" +] + +lines = [] +for fname in files_to_checksum: + fpath = output_dir / fname + if fpath.exists(): + sha256_hash = hashlib.sha256() + with open(fpath, "rb") as f: + for chunk in iter(lambda: f.read(8192), b""): + sha256_hash.update(chunk) + hash_val = sha256_hash.hexdigest() + lines.append(f"{hash_val} {fname}") + +checksum_file.write_text("\n".join(lines) + "\n") +print(f"Generated checksums for {len(lines)} files") +PYTHON_EOF + +exit_code=$? + +# Now verify the checksums +echo "Verifying checksums..." +python3 checksum_verify.py checksums.sha256 + +exit $exit_code \ No newline at end of file diff --git a/wizard-work/spark/verify_checkums.sh b/wizard-work/spark/verify_checkums.sh new file mode 100644 index 0000000..f4f3e7f --- /dev/null +++ b/wizard-work/spark/verify_checkums.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Verification script for spark profile checksum +# This script verifies the integrity of spark's output files + +cd /root/.hermes/wizard-outputs/spark + +# Compute and verify checksums +python3 -c " +import hashlib +import sys + +files = ['results.txt', 'env-check.sh', 'checksum_verify.py', 'check_spark_profile.py'] + +errors = 0 +for f in files: + try: + with open(f, 'rb') as fp: + h = hashlib.sha256(fp.read()).hexdigest() + print(f'OK: {f} -> {h[:16]}...') + except Exception as e: + print(f'ERROR: {f} - {e}') + errors = 1 + +sys.exit(errors) +" + +exit $? diff --git a/wizard-work/spark/verify_dir.py b/wizard-work/spark/verify_dir.py new file mode 100644 index 0000000..ec6280d --- /dev/null +++ b/wizard-work/spark/verify_dir.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""Verify that a directory exists and contains at least one file.""" +import sys +import os + +def verify_directory(path): + if not os.path.exists(path): + print(f"FAIL: Directory does not exist: {path}") + return False + if not os.path.isdir(path): + print(f"FAIL: Path is not a directory: {path}") + return False + + files = os.listdir(path) + if len(files) == 0: + print(f"FAIL: Directory is empty: {path}") + return False + + print(f"OK: Directory exists with {len(files)} item(s): {', '.join(files)}") + return True + +if __name__ == "__main__": + target = sys.argv[1] if len(sys.argv) > 1 else "/root/.hermes/wizard-outputs/spark" + success = verify_directory(target) + sys.exit(0 if success else 1) \ No newline at end of file diff --git a/wizard-work/spark/verify_dirs.py b/wizard-work/spark/verify_dirs.py new file mode 100644 index 0000000..d2846e7 --- /dev/null +++ b/wizard-work/spark/verify_dirs.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +"""Verify key directories exist for the Hermes environment.""" +import os +import json + +results = { + "cwd": os.getcwd(), + "directories": {} +} + +# Key directories to check +dirs_to_check = [ + "/root/.hermes/profiles/spark", + "/root/.hermes/tools", + "/root/.hermes/cache", + "/root/.hermes/wizard-outputs/spark", + "/root/troupe-standup", + "/root/troupe-standup/wizard-work/spark", + "/root/.hermes/cron", + "/root/.hermes/memories", + "/root/.hermes/skills", + "/root/.hermes/plugins" +] + +for d in dirs_to_check: + exists = os.path.isdir(d) + results["directories"][d] = "EXISTS" if exists else "MISSING" + +# Output results +print(json.dumps(results, indent=2)) \ No newline at end of file diff --git a/wizard-work/spark/verify_environment.py b/wizard-work/spark/verify_environment.py new file mode 100644 index 0000000..4f526b9 --- /dev/null +++ b/wizard-work/spark/verify_environment.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +"""Verify Python environment is properly configured for Hermes snippet tasks. + +Verifies: +1. Python 3.14+ is available +2. Working directory is /root (not elsewhere) +3. Hermes profiles directory exists +4. Wizard outputs directory exists +5. Troupe standup repo exists with wizard-work/spark + +Verdict: PASS/FAIL based on directory existence. +""" +import os +import sys +import json + +def verify_snippet_environment(): + """Check required directories for snippet lane tasks.""" + checks = { + "python_ok": sys.version_info >= (3, 14), + "cwd_is_root": os.getcwd() == "/root", + "hermes_profiles": os.path.isdir("/root/.hermes/profiles/spark"), + "wizard_outputs": os.path.isdir("/root/.hermes/wizard-outputs/spark"), + "troupe_standup": os.path.isdir("/root/troupe-standup"), + "wizard_work_spark": os.path.isdir("/root/troupe-standup/wizard-work/spark"), + } + + all_passed = all(checks.values()) + return checks, all_passed + +if __name__ == "__main__": + checks, passed = verify_snippet_environment() + report = { + "checks": checks, + "all_passed": passed, + "verdict": "PASS" if passed else "FAIL" + } + print(json.dumps(report, indent=2)) + sys.exit(0 if passed else 1) \ No newline at end of file