forked from disler/claude-code-is-programmable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclaude_code_is_programmable_5.py
More file actions
35 lines (25 loc) · 1.06 KB
/
claude_code_is_programmable_5.py
File metadata and controls
35 lines (25 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env -S uv run --script
# Two-step automation script that reads all Python files and then adds summaries to them using Claude Code CLI
import subprocess
# First prompt: Read all Python files
read_prompt = """
READ all .PY files in PARALLEL
"""
# Second prompt: Add summaries to all Python files
write_prompt = """
WRITE a small summary at the top of each of those files in parallel
"""
# Function to run Claude command with a given prompt
def run_claude_command(prompt):
command = ["claude", "-p", prompt, "--allowedTools", "Edit", "Bash", "Write", "Read", "MultiEdit", "Batch"]
process = subprocess.run(command, capture_output=True, text=True, check=True)
return process.stdout
# Execute the read prompt
print("Running read prompt...")
read_output = run_claude_command(read_prompt)
print(f"Read operation completed successfully.\n")
# Execute the write prompt
print("Running write prompt...")
write_output = run_claude_command(write_prompt)
print(f"Write operation completed successfully.\n")
print("All operations completed successfully.")