use anyhow::{anyhow, Context, Result};
use gflow::client::Client;
pub async fn resolve_job_id(client: &Client, job_id_str: &str) -> Result<u32> {
let trimmed = job_id_str.trim();
if trimmed.starts_with('@') {
let username = gflow::platform::get_current_username();
client
.resolve_dependency(&username, trimmed)
.await
.with_context(|| format!("Failed to resolve job ID '{}'", trimmed))
} else {
trimmed
.parse::<u32>()
.map_err(|_| anyhow!("Invalid job ID: {}", trimmed))
}
}
#[inline]
pub async fn resolve_dependency(client: &Client, depends_on: &str) -> Result<u32> {
resolve_job_id(client, depends_on).await
}