Skip to content

Commit 20d9cae

Browse files
committed
progress
1 parent d14958c commit 20d9cae

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pretty-print:
3838
# Run the autonomous pretty print implementation generator with --forever flag (sleeps on rate limits)
3939
pretty-print-forever:
4040
unset ANTHROPIC_API_KEY && claude --dangerously-skip-permissions -p "Please run cargo check and fix any issues. It is okay to remove things that are not fully implemented yet."
41-
cargo xtask agentic -- --forever
41+
cargo xtask agentic --forever
4242

4343
# Creates a new lint rule in the given path, with the given name. Name has to be camel case. Group should be lowercase.
4444
new-lintrule group rulename severity="error":

xtask/agentic/src/claude_session.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ impl ClaudeSession {
122122
eprintln!("Hit Claude API rate limit. Sleeping for 5 hours 30 minutes...");
123123
thread::sleep(Duration::from_secs(5 * 3600 + 30 * 60)); // 5h 30m
124124
eprintln!("Resuming after rate limit sleep");
125+
// Retry the call after sleeping
126+
return self.call_claude(prompt, new_conversation);
125127
}
126128
}
127129

xtask/src/agentic.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ use xshell::{cmd, Shell};
33

44
use crate::flags::Agentic;
55

6-
pub fn run(_cmd: Agentic, sh: &Shell) -> Result<()> {
6+
pub fn run(cmd: Agentic, sh: &Shell) -> Result<()> {
77
println!("Running autonomous pretty print implementation generator...");
8-
cmd!(sh, "cargo run -p xtask_agentic").run()?;
8+
if cmd.forever {
9+
cmd!(sh, "cargo run -p xtask_agentic -- --forever").run()?;
10+
} else {
11+
cmd!(sh, "cargo run -p xtask_agentic").run()?;
12+
}
913
Ok(())
1014
}

xtask/src/flags.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ xflags::xflags! {
2020
}
2121

2222
/// Run autonomous pretty print implementation generator using Claude.
23-
cmd agentic {}
23+
cmd agentic {
24+
/// Run continuously, retrying after rate limits.
25+
optional --forever
26+
}
2427
}
2528
}
2629

@@ -46,7 +49,9 @@ pub struct Install {
4649
}
4750

4851
#[derive(Debug)]
49-
pub struct Agentic;
52+
pub struct Agentic {
53+
pub forever: bool,
54+
}
5055

5156
impl Xtask {
5257
#[allow(dead_code)]

0 commit comments

Comments
 (0)