use std::hint::black_box;
use std::path::PathBuf;
use std::time::{Duration, Instant};
use github_mcp::data::store::{open_store, resolve_store_path};
use github_mcp::tools::search_tool::search_operations;
fn main() -> anyhow::Result<()> {
let ready_file = std::env::args_os()
.nth(1)
.map(PathBuf::from)
.ok_or_else(|| anyhow::anyhow!("usage: profile_search <ready-file> [seconds]"))?;
let seconds = std::env::args()
.nth(2)
.and_then(|value| value.parse::<u64>().ok())
.unwrap_or(20);
let connection = open_store(&resolve_store_path("gh-2026-03-10")?)?;
black_box(search_operations(
&connection,
"find an operation for the current user",
5,
)?);
std::fs::write(&ready_file, std::process::id().to_string())?;
let deadline = Instant::now() + Duration::from_secs(seconds);
let queries = [
"find an operation for the current user",
"create or update a resource",
"list recently changed records",
"delete an existing resource",
];
let mut index = 0usize;
while Instant::now() < deadline {
black_box(search_operations(
&connection,
queries[index % queries.len()],
5,
)?);
index += 1;
}
Ok(())
}