forked from DrewKestell/BloogBot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun-loop.ps1
More file actions
53 lines (43 loc) · 2.01 KB
/
run-loop.ps1
File metadata and controls
53 lines (43 loc) · 2.01 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Usage:
# .\run-loop.ps1 -MaxIterations 30
# .\run-loop.ps1 -MaxIterations 10 -InitialPrompt "Focus on Tests/BotRunner.Tests/TASKS.md"
param(
[int]$MaxIterations = 20,
[string]$InitialPrompt = "Read docs/TASKS.md plus relevant directory TASKS.md files and continue the highest-priority incomplete task. Do not ask for approval. Update TASKS.md files before ending the session."
)
$ErrorActionPreference = "Stop"
$ProjectRoot = $PSScriptRoot
$MasterTasksFile = Join-Path $ProjectRoot "docs/TASKS.md"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Codex Session Loop" -ForegroundColor Cyan
Write-Host " Max Iterations: $MaxIterations" -ForegroundColor Cyan
Write-Host " Project Root: $ProjectRoot" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
for ($i = 1; $i -le $MaxIterations; $i++) {
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "--- Iteration $i of $MaxIterations [$timestamp] ---" -ForegroundColor Green
if (-not (Test-Path $MasterTasksFile)) {
Write-Host " [ERROR] Missing docs/TASKS.md. Stopping loop." -ForegroundColor Red
break
}
$prompt = $InitialPrompt
Write-Host " Prompt source: docs/TASKS.md + directory TASKS.md files" -ForegroundColor Cyan
Write-Host " Prompt preview: $($prompt.Substring(0, [Math]::Min(140, $prompt.Length)))..." -ForegroundColor DarkGray
Write-Host ""
try {
claude --dangerously-skip-permissions -p $prompt
}
catch {
Write-Host " [ERROR] Claude exited with an error: $_" -ForegroundColor Red
}
Write-Host ""
if ($i -lt $MaxIterations) {
Write-Host " Sleeping 5 seconds before next iteration..." -ForegroundColor DarkGray
Start-Sleep -Seconds 5
}
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Loop finished" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan