use super::command::git_stdout;
use super::remote::parse_https_remote;
pub(super) async fn load_repo_context(cwd: Option<&str>) -> Option<(String, String, String)> {
let repo_root = git_stdout(cwd, ["rev-parse", "--show-toplevel"]).await?;
let workspace_id = git_stdout(
Some(repo_root.as_str()),
["config", "--local", "--get", "codetether.workspaceId"],
)
.await?;
let remote_url = git_stdout(Some(repo_root.as_str()), ["remote", "get-url", "origin"]).await?;
let (host, path) = parse_https_remote(&remote_url)?;
(host == "github.com").then_some((workspace_id, host, path))
}