Files
troupe-standup/wizard-work/spark/README.md
T

190 lines
4.4 KiB
Markdown

# Spark Output: Snippet Summarizer Artifacts
Generated: 2026-10-12T13:03:03 UTC
## Files Produced
1. **snippet-summarizer.py** (3,137 bytes)
- Python utility that scans directories for Python source files
- Extracts metadata: line count, character count, file size
- Outputs structured JSON report
- Usage: `python snippet-summarizer.py <directory> [--output <file>]`
2. **report.json** (16,156 bytes)
- Generated report scanning `/root/.hermes/profiles/spark/`
- 50 Python snippets found
- 11,713 total lines of code
- 430.78 KB total size
- Average 234.26 lines per file
## Verification
The report.json file is valid JSON and contains:
- Complete file listing with paths
- Per-file statistics
- Extension-based grouping
- Aggregate statistics
---
# JSON Validator (New Addition)
A Python CLI tool for validating JSON files with detailed error reporting.
## Files
1. **json_validator.py** - Main validation script
2. **sample_valid.json** - Test file (valid object)
3. **sample_array.json** - Test file (valid array)
4. **sample_scalar.json** - Test file (valid string scalar)
5. **sample_bad.json** - Test file (invalid JSON)
## Usage
```bash
python3 json_validator.py <file.json> [file2.json ...]
```
## Verified Tests
```
✓ VALID: sample_valid.json - Object with 3 keys, 73 bytes
✓ VALID: sample_array.json - Array with 3 elements, 141 bytes
✓ VALID: sample_scalar.json - Scalar value: str, 21 bytes
✗ INVALID: sample_bad.json - Missing quotes error
✗ INVALID: nonexistent.json - File not found error
```
---
# quick_stats.py - File Statistics Utility
A simple file statistics utility that reports line count, word count, byte size, and top 5 most common words.
## Files
- **quick_stats.py** - Main script (1,458 bytes)
## Usage
```bash
python3 quick_stats.py <file1> [file2 ...]
```
## Verified Test
```
$ python3 quick_stats.py test_input.txt
=== test_input.txt ===
Bytes: 118
Lines: 5
Words: 22
Unique: 13
Top words: [('hello', 3), ('world', 2), ('the', 2), ('this', 1), ('is', 1)]
```
## Verification
Check: python3 /root/.hermes/wizard-outputs/spark/quick_stats.py /root/.hermes/wizard-outputs/spark/test_input.txt && echo "PASS"
---
# syshealth.py - System Health Check Utility
A Python utility that collects system metrics: disk usage, memory info, load average, and process count.
## Files
- **syshealth.py** - Main script (1,697 bytes)
- **system-report.json** - Generated report with all metrics
## Usage
```bash
python3 syshealth.py
```
## Verified Test
```
$ python3 /root/.hermes/wizard-outputs/spark/check_syshealth.py
PASS: Valid JSON with all required keys
Process count: 422
```
## Verification
Check: python3 /root/.hermes/wizard-outputs/spark/check_syshealth.py && echo "PASS"
---
# JSON Schema Validator (NEW)
A command-line tool for validating JSON files against JSON Schema.
## Files
1. **json_schema_validator.py** - Main validation script (46 lines)
2. **test_schema.json** - Test schema (requires name: string, age: integer >= 0)
3. **test_data_valid.json** - Valid test data, passes validation
4. **test_data_invalid.json** - Invalid test data (age < 0)
5. **test_data_missing.json** - Missing required field test
## Usage
```bash
python3 json_schema_validator.py <schema_file.json> <data_file.json>
```
## Verified Tests
```
✓ VALID: test_data_valid.json passes against test_schema.json (exit 0)
✗ INVALID: test_data_invalid.json fails with "age: -5 is less than minimum of 0" (exit 1)
✗ INVALID: test_data_missing.json fails with "'age' is required" (exit 1)
```
## Verification
Check: python3 /root/.hermes/wizard-outputs/spark/json_schema_validator.py test_schema.json test_data_valid.json && echo "PASS"
---
# URL Title Extractor
A Python utility to extract HTML page titles from URLs with optional caching.
## Files
- **url_title_extractor.py** - Main script (121 lines)
- **test_url_title_extractor.py** - Test suite
## Usage
```bash
python3 url_title_extractor.py <url1> <url2> ...
```
### Options
- `--no-cache` - Disable caching of results
- `--clear-cache` - Clear the title cache
### Examples
```bash
python3 url_title_extractor.py https://example.com
python3 url_title_extractor.py --no-cache https://example.com
```
## Tested Results
```
PASSED: TitleParser - Correctly extracts title from HTML
PASSED: Cache directory - Verified writable location
```
## Verification
Check: python3 /root/.hermes/wizard-outputs/spark/test_url_title_extractor.py && echo "PASS"