:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
use anyhow::Result;
use crate::{invocation_context::context, utils::web_url::WebUrl};
use super::{fetch_endpoint, OpenArgs};
pub fn open_endpoint(args: &OpenArgs) -> Result<()> {
context().capture_command_invoked("endpoints_open");
let endpoint = fetch_endpoint(&args.name, args.debug)?;
let ui_url = endpoint
.ui_url
.ok_or_else(|| anyhow::anyhow!("Endpoint has no UI URL"))?;
let ui_url = WebUrl::try_from(ui_url)?;
crate::safe_println!("Opening {ui_url}...");
ui_url.open_in_browser()?;
Ok(())
}