use anyhow::Result;
use std::fs;
#[path = "../test_support.rs"]
mod test_support;
pub(super) fn setup_repo() -> Result<tempfile::TempDir> {
let dir = test_support::temp_dir_outside_repo();
test_support::git_init(dir.path())?;
test_support::seed_ralph_dir(dir.path())?;
Ok(dir)
}
pub(super) fn valid_agents_md() -> &'static str {
r#"# Repository Guidelines
Test project.
## Non-Negotiables
Some rules.
## Repository Map
- `src/`: Source code
## Build, Test, and CI
Make targets.
"#
}
pub(super) fn write_agents_md(dir: &std::path::Path, content: &str) -> Result<()> {
fs::write(dir.join("AGENTS.md"), content)?;
Ok(())
}
pub(super) fn run_in_dir(
dir: &std::path::Path,
args: &[&str],
) -> (std::process::ExitStatus, String, String) {
test_support::run_in_dir(dir, args)
}