update
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Process one pending JSON file into the docs/ structure using Claude.
|
||||
Process pending JSON files into the docs/ structure using Claude.
|
||||
|
||||
Usage:
|
||||
venv/bin/python python/process.py
|
||||
venv/bin/python python/process.py # Process 1 file (default)
|
||||
venv/bin/python python/process.py -n 5 # Process 5 files
|
||||
venv/bin/python python/process.py -n 9999 # Process all files
|
||||
|
||||
Run multiple times in parallel to process faster.
|
||||
Run multiple instances in parallel to process faster.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
import re
|
||||
@@ -133,20 +136,41 @@ def process_file(json_file: str) -> bool:
|
||||
|
||||
|
||||
def main():
|
||||
json_file = claim_pending_file()
|
||||
parser = argparse.ArgumentParser(description="Process pending JSON files into docs/")
|
||||
parser.add_argument(
|
||||
"-n", "--count",
|
||||
type=int,
|
||||
default=1,
|
||||
help="Number of files to process (default: 1)"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if not json_file:
|
||||
print("No pending files to process")
|
||||
return
|
||||
processed = 0
|
||||
failed = 0
|
||||
|
||||
print(f"Processing: {json_file}")
|
||||
for i in range(args.count):
|
||||
json_file = claim_pending_file()
|
||||
|
||||
if process_file(json_file):
|
||||
mark_completed(json_file)
|
||||
print(f"Completed: {json_file}")
|
||||
else:
|
||||
mark_failed(json_file)
|
||||
print(f"Failed: {json_file}", file=sys.stderr)
|
||||
if not json_file:
|
||||
if processed == 0:
|
||||
print("No pending files to process")
|
||||
break
|
||||
|
||||
print(f"[{i + 1}/{args.count}] Processing: {json_file}")
|
||||
|
||||
if process_file(json_file):
|
||||
mark_completed(json_file)
|
||||
print(f"Completed: {json_file}")
|
||||
processed += 1
|
||||
else:
|
||||
mark_failed(json_file)
|
||||
print(f"Failed: {json_file}", file=sys.stderr)
|
||||
failed += 1
|
||||
|
||||
if processed > 0 or failed > 0:
|
||||
print(f"\nDone! Processed: {processed}, Failed: {failed}")
|
||||
|
||||
if failed > 0:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user