1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! One-shot OS utility actions: opening URLs and copying text to the clipboard.
//!
//! Both functions are synchronous — they delegate to the OS immediately and
//! return. They must not be called from inside an `async` context on a
//! single-threaded executor; use `tokio::task::spawn_blocking` if needed.
// These functions are wired up by the Phase 4 detail-UI agent via
// `App::handle_action`; the dead_code lint fires because callers live in a
// separate parallel change that is not yet merged.
use ;
/// Open `url` in the system default browser.
///
/// Wraps the [`open`] crate, which dispatches to `open` on macOS,
/// `xdg-open` on Linux, and `start` on Windows.
///
/// Rejects any URL that does not begin with `https://`. GitHub's GraphQL
/// responses are the only source feeding this function today and always
/// return `https://` URLs, but refusing other schemes stops a hypothetical
/// malicious API response (or a future code path) from triggering
/// `file://`, `ssh://`, or custom-scheme handlers that would dispatch
/// native commands on macOS and Linux.
///
/// # Errors
///
/// Returns an error if the URL does not start with `https://`, or if the
/// OS command fails to launch. The returned message is suitable for display
/// in the status bar.
/// Copy `text` to the system clipboard.
///
/// Uses [`arboard::Clipboard`] for cross-platform clipboard access.
///
/// # Errors
///
/// Returns an error if the clipboard is unavailable (e.g. headless Linux
/// without X11/Wayland, SSH without display forwarding) or if writing fails.
/// The error message is suitable for display in the status bar as a fallback.