A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
feat: combine GitLab and Gitea integration pulses
andreyf3baef7a1c5f
diff --cc windows/src-tauri/src/integrations.rsindex f7b15bfa,217d43c4..e41e2265--- a/windows/src-tauri/src/integrations.rs+++ b/windows/src-tauri/src/integrations.rs@@@ -69,8 -69,8 +69,9 @@@ pub fn start(app: AppHandle)spawn(app.clone(), "integration_stripe", 6, 30, poll_stripe);spawn(app.clone(), "integration_resend", 6, 60, poll_resend);spawn(app.clone(), "integration_github", 7, 300, poll_github);- spawn_github_loops(app.clone());+ spawn(app.clone(), "integration_gitlab", 7, 300, poll_gitlab);+ spawn(app.clone(), "integration_gitea", 7, 300, poll_gitea);+ spawn_github_loops(app.clone());spawn(app.clone(), "integration_calcom", 8, 300, poll_calcom);spawn(app, "integration_notion", 9, 300, poll_notion);}@@@ -116,7 -116,7 +117,8 @@@ pub async fn poll_once(app: AppHandle,github_refresh_if_stale("activity");poll_github(app).await}+ "integration_gitlab" => poll_gitlab(app).await,+ "integration_gitea" => poll_gitea(app).await,"integration_vercel" => poll_vercel(app).await,"integration_n8n" => poll_n8n(app).await,"integration_resend" => poll_resend(app).await,@@@ -126,123 -126,145 +128,249 @@@}}-// ── Gitea ────────────────────────────────────────────────────────────────────-// Gitea deliberately has its own REST poller: self-hosted instances need an-// address, and unlike GitHub there is no GraphQL endpoint shared by all of them.+// ── GitLab ───────────────────────────────────────────────────────────────────+ fn gitea_api_base() -> Option<String> {+ let url = secrets::get("gitea-url")?;+ let parsed = reqwest::Url::parse(url.trim()).ok()?;+ if !matches!(parsed.scheme(), "http" | "https") || parsed.host_str().is_none() {+ return None;+ }+ Some(format!("{}/api/v1", parsed.as_str().trim_end_matches('/')))+ }++ async fn poll_gitea(app: AppHandle) {+ if PAUSED.load(Ordering::Relaxed) || !enabled(&app, "integration_gitea") { return; }+ let (Some(token), Some(base)) = (secrets::get("gitea-token"), gitea_api_base()) else { return };+ let Ok(http) = reqwest::Client::builder().timeout(TIMEOUT)+ .redirect(reqwest::redirect::Policy::none()).build() else { return };+ let user = http.get(format!("{base}/user")).header("Authorization", format!("token {token}")).send().await;+ let Ok(response) = user else { return };+ if !response.status().is_success() {+ emit(&app, IntegrationUpdate { id: "integration_gitea", data: json!({}),+ error: Some(status_error(response.status().as_u16(), &crate::i18n::t("Token lacks the needed scope"))), event: None });+ return;+ }+ let user: Value = response.json().await.unwrap_or(json!({}));+ let repos_response = http.get(format!("{base}/user/repos?limit=100&sort=updated"))+ .header("Authorization", format!("token {token}")).send().await;+ let repos: Vec<Value> = match repos_response {+ Ok(r) if r.status().is_success() => r.json().await.unwrap_or_default(),+ _ => Vec::new(),+ };+ let stars: i64 = repos.iter().filter_map(|r| r.get("stars_count").and_then(Value::as_i64)).sum();+ let open_prs: i64 = repos.iter().filter_map(|r| r.get("open_pr_counter").and_then(Value::as_i64)).sum();+ let profile_url = user.get("html_url").and_then(Value::as_str).unwrap_or("");+ // Gitea's heatmap API is the equivalent of GitHub's contribution calendar.- // Keep just the latest week for the compact card: the endpoint is optional++ // The full year supplies the compact card and detail grid. This is optional+ // on older/self-hosted instances, so a missing one never hides the stats.+ let login = user.get("login").and_then(Value::as_str).unwrap_or("");+ let heatmap: Vec<Value> = if login.is_empty() {+ Vec::new()+ } else {+ match http.get(format!("{base}/users/{login}/heatmap"))+ .header("Authorization", format!("token {token}")).send().await {+ Ok(r) if r.status().is_success() => r.json().await.unwrap_or_default(),+ _ => Vec::new(),+ }+ };+ let activity = gitea_activity(&heatmap, now_ms());+ let my_raw = gitea_get(&http, &token, format!("{base}/repos/issues/search?state=open&type=pulls&created=true&limit=20")).await;+ let review_raw = gitea_get(&http, &token, format!("{base}/repos/issues/search?state=open&type=pulls&review_requested=true&limit=20")).await;+ let my_prs = gitea_prs(&my_raw);+ let to_review = gitea_prs(&review_raw);+ let main_ci = gitea_main_ci(&http, &token, &base, &repos).await;+ let pulse = GitHubPulse { login: login.to_string(), my_prs, to_review, main_ci, fetched_at: now_ms() };+ emit(&app, IntegrationUpdate { id: "integration_gitea", data: json!({+ "totalRepos": repos.len(), "totalStars": stars, "openPRs": open_prs,+ "profileUrl": profile_url, "pulse": pulse, "activity": activity,+ }), error: None, event: None });+ }++ async fn gitea_get(http: &reqwest::Client, token: &str, url: String) -> Vec<Value> {+ match http.get(url).header("Authorization", format!("token {token}")).send().await {+ Ok(r) if r.status().is_success() => r.json().await.unwrap_or_default(),+ _ => Vec::new(),+ }+ }++ fn gitea_prs(raw: &[Value]) -> Vec<GitHubPr> {+ raw.iter().filter_map(|pr| {+ let repo = pr.get("repository")?.get("full_name")?.as_str()?.to_string();+ let number = pr.get("number")?.as_i64()?;+ Some(GitHubPr { id: format!("{repo}#{number}"), title: pr.get("title").and_then(Value::as_str).unwrap_or("").to_string(),+ url: pr.get("html_url").and_then(Value::as_str).unwrap_or("").to_string(), repo, number,+ is_draft: pr.get("is_draft").and_then(Value::as_bool).unwrap_or(false), ci: CiState::Unknown,+ review: ReviewState::Unknown, head_sha: None })+ }).collect()+ }++ fn gitea_ci(state: Option<&str>) -> CiState {+ match state.map(str::to_ascii_lowercase).as_deref() {+ Some("success") => CiState::Success,+ Some("pending") => CiState::Pending,+ Some("failure") | Some("error") => CiState::Failure,+ _ => CiState::Unknown,+ }+ }++ async fn gitea_main_ci(http: &reqwest::Client, token: &str, base: &str, repos: &[Value]) -> Vec<GitHubRepoCi> {+ let mut out = Vec::new();+ for repo in repos.iter().take(20) {+ let Some(name) = repo.get("full_name").and_then(Value::as_str) else { continue };+ let branch = repo.get("default_branch").and_then(Value::as_str).unwrap_or("main");+ let statuses = gitea_get(http, token, format!("{base}/repos/{name}/commits/{branch}/statuses?limit=1&sort=recentupdate")).await;+ out.push(GitHubRepoCi { repo: name.to_string(), url: repo.get("html_url").and_then(Value::as_str).unwrap_or("").to_string(),+ branch: branch.to_string(), ci: gitea_ci(statuses.first().and_then(|s| s.get("state")).and_then(Value::as_str)), head_sha: None });+ }+ out+ }+-fn civil_day(day: i64) -> (i32, u32, u32, u8) {- // Days since Unix epoch → Gregorian date and Sunday-based weekday.- let z = day + 719_468; let era = if z >= 0 { z } else { z - 146_096 } / 146_097;- let doe = z - era * 146_097; let yoe = (doe - doe / 1_460 + doe / 36_524 - doe / 146_096) / 365;- let y = yoe + era * 400; let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);- let mp = (5 * doy + 2) / 153; let d = doy - (153 * mp + 2) / 5 + 1;- let m = mp + if mp < 10 { 3 } else { -9 }; let year = y + if m <= 2 { 1 } else { 0 };- (year as i32, m as u32, d as u32, ((day + 4).rem_euclid(7)) as u8)-}-+ fn gitea_activity(heatmap: &[Value], fetched_at: u64) -> GitHubActivity {+ let today = (fetched_at / 86_400_000) as i64;+ let mut start = today - 364;+ start -= i64::from(civil_day(start).3);+ let mut weeks: Vec<Vec<ContributionDay>> = Vec::new();+ for day in start..=today {+ let (y, m, d, weekday) = civil_day(day);+ if weekday == 0 || weeks.is_empty() { weeks.push(Vec::new()); }+ let count = heatmap.iter().find_map(|entry| {+ let ts = entry.get("timestamp")?.as_i64()?;+ let entry_day = if ts > 10_000_000_000 { ts / 86_400_000 } else { ts / 86_400 };+ (entry_day == day).then(|| entry.get("contributions").and_then(Value::as_i64).unwrap_or(0).max(0))+ }).unwrap_or(0);+ weeks.last_mut().unwrap().push(ContributionDay {+ date: format!("{y:04}-{m:02}-{d:02}"), count, weekday,+ level: if count == 0 { 0 } else if count == 1 { 1 } else if count < 4 { 2 } else if count < 8 { 3 } else { 4 },+ });+ }+ let total = weeks.iter().flatten().map(|d| d.count).sum(); GitHubActivity { total, weeks, fetched_at }+ }++ /// A Gitea address or token changed: old totals belong to the previous account+ /// and must not remain on the card while the new credentials are checked.+ pub fn gitea_credentials_changed(app: &AppHandle) {+ emit(app, IntegrationUpdate { id: "integration_gitea", data: json!({}), error: None, event: None });+ if !PAUSED.load(Ordering::Relaxed) && enabled(app, "integration_gitea") {+ tauri::async_runtime::spawn(poll_gitea(app.clone()));+ }+ }++fn gitlab_ci(raw: Option<&str>) -> CiState {+ match raw {+ Some("success") => CiState::Success,+ Some("failed") | Some("canceled") | Some("skipped") => CiState::Failure,+ Some("running") | Some("pending") | Some("created") | Some("preparing") | Some("waiting_for_resource") => CiState::Pending,+ _ => CiState::Unknown,+ }+}++/// Gregorian date and Sunday-based weekday for a day counted from 1970-01-01.+fn civil_day(day: i64) -> (i32, u32, u32, u8) {+ let z = day + 719_468;+ let era = if z >= 0 { z } else { z - 146_096 } / 146_097;+ let doe = z - era * 146_097;+ let yoe = (doe - doe / 1_460 + doe / 36_524 - doe / 146_096) / 365;+ let y = yoe + era * 400;+ let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);+ let mp = (5 * doy + 2) / 153;+ let d = doy - (153 * mp + 2) / 5 + 1;+ let m = mp + if mp < 10 { 3 } else { -9 };+ let year = y + i64::from(m <= 2);+ (year as i32, m as u32, d as u32, (day + 4).rem_euclid(7) as u8)+}++fn gitlab_activity(events: &[Value], fetched_at: u64) -> GitHubActivity {+ let mut counts: std::collections::HashMap<String, i64> = std::collections::HashMap::new();+ for event in events {+ if let Some(date) = event.get("created_at").and_then(Value::as_str).and_then(|s| s.get(..10)) {+ *counts.entry(date.to_string()).or_default() += 1;+ }+ }+ let today = (fetched_at / 86_400_000) as i64;+ let mut start = today - 364;+ start -= i64::from(civil_day(start).3); // start the first column on Sunday+ let mut weeks: Vec<Vec<ContributionDay>> = Vec::new();+ for day in start..=today {+ let (year, month, date, weekday) = civil_day(day);+ if weekday == 0 || weeks.is_empty() { weeks.push(Vec::new()); }+ let key = format!("{year:04}-{month:02}-{date:02}");+ let count = counts.get(&key).copied().unwrap_or(0);+ let level = if count == 0 { 0 } else if count == 1 { 1 } else if count <= 3 { 2 } else if count <= 7 { 3 } else { 4 };+ weeks.last_mut().unwrap().push(ContributionDay { date: key, count, level, weekday });+ }+ let total = weeks.iter().flatten().map(|day| day.count).sum();+ GitHubActivity { total, weeks, fetched_at }+}++async fn poll_gitlab(app: AppHandle) {+ if PAUSED.load(Ordering::Relaxed) || !enabled(&app, "integration_gitlab") { return; }+ let Some(token) = secrets::get("gitlab-token") else { return };+ let instance = secrets::get("gitlab-url").unwrap_or_else(|| "https://gitlab.com".into());+ let Ok(instance) = reqwest::Url::parse(instance.trim()) else { return };+ if !matches!(instance.scheme(), "http" | "https") || instance.host_str().is_none() { return; }+ let base = instance.as_str().trim_end_matches('/').to_string();+ // PRIVATE-TOKEN must never follow an instance redirect to another server.+ let Ok(http) = reqwest::Client::builder().timeout(TIMEOUT)+ .redirect(reqwest::redirect::Policy::none()).build() else { return };+ let headers = |request: reqwest::RequestBuilder| request.header("PRIVATE-TOKEN", &token);+ let user = headers(http.get(format!("{base}/api/v4/user"))).send().await;+ let Ok(user) = user else { return };+ if !user.status().is_success() {+ emit(&app, IntegrationUpdate { id: "integration_gitlab", data: json!({}), error: Some(status_error(user.status().as_u16(), &crate::i18n::t("Token lacks the needed scope"))), event: None }); return;+ }+ let user: Value = user.json().await.unwrap_or(json!({}));+ let login = user.get("username").and_then(Value::as_str).unwrap_or("GitLab").to_string();+ let profile_url = user.get("web_url").and_then(Value::as_str).map(str::to_string);++ // GitHub's overview counts repositories owned by the user, so GitLab does+ // the same. Walk the pages for accurate repository and star totals; the+ // first ten (ordered by recent activity) also drive default-branch CI.+ let mut projects = Vec::new();+ for page in 1..=10 {+ let response = headers(http.get(format!("{base}/api/v4/projects")).query(&[+ ("owned", "true"),+ ("simple", "true"),+ ("order_by", "last_activity_at"),+ ("per_page", "100"),+ ("page", &page.to_string()),+ ])).send().await;+ let batch: Vec<Value> = match response {+ Ok(r) if r.status().is_success() => r.json().await.unwrap_or_default(),+ _ => Vec::new(),+ };+ let done = batch.len() < 100;+ projects.extend(batch);+ if done { break; }+ }+ let list = |url: String| async { match headers(http.get(url)).send().await { Ok(v) if v.status().is_success() => v.json::<Vec<Value>>().await.unwrap_or_default(), _ => Vec::new() } };+ let mine = list(format!("{base}/api/v4/merge_requests?scope=created_by_me&state=opened&per_page=20")).await;+ let review = list(format!("{base}/api/v4/merge_requests?scope=reviews_for_me&state=opened&per_page=20")).await;+ let mut events = Vec::new();+ let today = (now_ms() / 86_400_000) as i64;+ let (year, month, day, _) = civil_day(today - 364);+ let after = format!("{year:04}-{month:02}-{day:02}");+ for page in 1..=10 {+ let batch = list(format!("{base}/api/v4/events?scope=all&after={after}&per_page=100&page={page}")).await;+ let done = batch.len() < 100;+ events.extend(batch);+ if done { break; }+ }+ let to_pr = |v: &Value| -> Option<GitHubPr> { let repo = v.get("references")?.get("full")?.as_str()?.split('!').next()?.to_string(); let n = v.get("iid")?.as_i64()?; Some(GitHubPr { id: format!("{repo}#{n}"), title: v.get("title")?.as_str()?.to_string(), url: v.get("web_url")?.as_str()?.to_string(), repo, number: n, is_draft: v.get("draft").and_then(Value::as_bool).unwrap_or(false), ci: gitlab_ci(v.get("head_pipeline").and_then(|p| p.get("status")).and_then(Value::as_str)), review: ReviewState::Unknown, head_sha: v.get("sha").and_then(Value::as_str).map(str::to_string) }) };+ let mut main_ci = Vec::new();+ for project in projects.iter().take(10) {+ let (Some(id), Some(repo), Some(url)) = (project.get("id").and_then(Value::as_i64), project.get("path_with_namespace").and_then(Value::as_str), project.get("web_url").and_then(Value::as_str)) else { continue };+ let branch = project.get("default_branch").and_then(Value::as_str).unwrap_or("main");+ let pipelines: Vec<Value> = match http.get(format!("{base}/api/v4/projects/{id}/pipelines")).query(&[("ref", branch), ("per_page", "1")]).header("PRIVATE-TOKEN", &token).send().await { Ok(r) if r.status().is_success() => r.json().await.unwrap_or_default(), _ => Vec::new() };+ let ci = gitlab_ci(pipelines.first().and_then(|p| p.get("status")).and_then(Value::as_str));+ main_ci.push(GitHubRepoCi { repo: repo.into(), url: url.into(), branch: branch.into(), ci, head_sha: None });+ }+ let fetched_at = now_ms();+ let pulse = GitHubPulse { login, my_prs: mine.iter().filter_map(to_pr).collect(), to_review: review.iter().filter_map(to_pr).collect(), main_ci, fetched_at };+ let activity = gitlab_activity(&events, fetched_at);+ let stars: i64 = projects.iter().filter_map(|p| p.get("star_count").and_then(Value::as_i64)).sum();+ emit(&app, IntegrationUpdate { id: "integration_gitlab", data: json!({ "projects": projects.len(), "totalRepos": projects.len(), "totalStars": stars, "profileUrl": profile_url, "pulse": pulse, "activity": activity }), error: None, event: None });+}+/// Remembers the newest id per integration so an event fires once, not on every poll.struct Seen(Mutex<std::collections::HashMap<&'static str, String>>);@@@ -1128,28 -1150,26 +1256,50 @@@ fn fmt_value(v: &Value) -> Stringmod tests {use super::*;+ #[test]+ fn gitea_calendar_keeps_full_weeks_and_yearly_totals() {+ let today = 20_000_i64;+ let activity = gitea_activity(&[+ json!({ "timestamp": (today - 300) * 86_400, "contributions": 5 }),+ json!({ "timestamp": today * 86_400_000, "contributions": 2 }),+ ], today as u64 * 86_400_000);+ assert_eq!(activity.total, 7);+ assert!(activity.weeks.iter().flatten().count() >= 365);+ for week in &activity.weeks {+ assert_eq!(week[0].weekday, 0);+ for (index, day) in week.iter().enumerate() {+ assert_eq!(day.weekday as usize, index);+ }+ }+ let last = activity.weeks.last().unwrap().last().unwrap();+ assert_eq!(last.count, 2);+ }+++++++ #[test]+ fn gitlab_activity_builds_a_full_calendar_and_counts_events() {+ let events = vec![+ json!({ "created_at": "1970-01-01T12:00:00Z" }),+ json!({ "created_at": "1970-01-01T18:00:00Z" }),+ ];+ let activity = gitlab_activity(&events, 0);+ let days: Vec<_> = activity.weeks.iter().flatten().collect();+ assert!(days.len() >= 365);+ let first_day = days.iter().find(|day| day.date == "1970-01-01").unwrap();+ assert_eq!((first_day.count, first_day.level, first_day.weekday), (2, 2, 4));+ assert_eq!(activity.total, 2);+ }++ #[test]+ fn gitlab_ci_maps_pipeline_states() {+ assert_eq!(gitlab_ci(Some("success")), CiState::Success);+ assert_eq!(gitlab_ci(Some("running")), CiState::Pending);+ assert_eq!(gitlab_ci(Some("failed")), CiState::Failure);+ assert_eq!(gitlab_ci(None), CiState::Unknown);+ }+#[test]fn github_card_data_sends_only_what_is_known() {let mut cache = GitHubCache::default();diff --cc windows/src-tauri/src/lib.rsindex 1f07c657,4fd0ef0e..45984450--- a/windows/src-tauri/src/lib.rs+++ b/windows/src-tauri/src/lib.rs@@@ -230,29 -230,36 +230,47 @@@ fn open_url(url: String)platform::open_url(&url);}+/// Opens a GitLab link only when it belongs to the configured instance. This+/// also covers self-hosted installations without exposing their token.+#[tauri::command]+fn open_gitlab_url(url: String) {+ let base = secrets::get("gitlab-url").unwrap_or_else(|| "https://gitlab.com".into());+ let (Ok(target), Ok(instance)) = (reqwest::Url::parse(&url), reqwest::Url::parse(base.trim())) else { return };- if is_gitlab_instance_url(&target, &instance) {++ if is_forge_instance_url(&target, &instance) {+ open_url(url);+ }+}+- fn is_gitlab_instance_url(target: &reqwest::Url, instance: &reqwest::Url) -> bool {++fn is_forge_instance_url(target: &reqwest::Url, instance: &reqwest::Url) -> bool {+ if !matches!(target.scheme(), "http" | "https")+ || target.scheme() != instance.scheme()+ || target.host_str() != instance.host_str()+ || target.port_or_known_default() != instance.port_or_known_default()+ {+ return false;+ }+ let base = instance.path().trim_end_matches('/');+ base.is_empty() || target.path() == base || target.path().starts_with(&format!("{base}/"))+}++ /// The configured Gitea address is a credential-store value, so the island+ /// asks Rust to open it instead of ever receiving it.+ #[tauri::command]+ fn open_gitea() {+ if let Some(url) = secrets::get("gitea-url") {+ open_url(url);+ }+ }++ #[tauri::command]+ fn open_gitea_url(url: String) {+ let (Ok(target), Some(base)) = (reqwest::Url::parse(&url), secrets::get("gitea-url")) else { return };+ let Ok(instance) = reqwest::Url::parse(&base) else { return };- if is_gitea_instance_url(&target, &instance) {++ if is_forge_instance_url(&target, &instance) {+ open_url(url);+ }+ }+-fn is_gitea_instance_url(target: &reqwest::Url, instance: &reqwest::Url) -> bool {- if !matches!(target.scheme(), "http" | "https")- || target.scheme() != instance.scheme()- || target.host_str() != instance.host_str()- || target.port_or_known_default() != instance.port_or_known_default()- {- return false;- }- let base = instance.path().trim_end_matches('/');- base.is_empty() || target.path() == base || target.path().starts_with(&format!("{base}/"))-}-/// "Open terminal" opens the working folder in VS Code when `code` is on PATH,/// and falls back to the file manager otherwise.#[tauri::command]@@@ -791,7 -804,8 +815,9 @@@ pub fn run()hub_shown,list_monitors,open_url,+ open_gitlab_url,+ open_gitea,+ open_gitea_url,open_in_vscode,open_session,open_claude_desktop,@@@ -991,20 -1005,20 +1017,20 @@@#[cfg(test)]mod tests {- use super::{diff_file, is_gitlab_instance_url};- use super::{diff_file, is_gitea_instance_url};++ use super::{diff_file, is_forge_instance_url};#[test]- fn gitlab_links_stay_on_the_configured_instance() {- fn gitea_links_stay_on_the_configured_instance() {++ fn forge_links_stay_on_the_configured_instance() {let instance = reqwest::Url::parse("https://git.example.com/team/").unwrap();- assert!(is_gitlab_instance_url(- assert!(is_gitea_instance_url(++ assert!(is_forge_instance_url(&reqwest::Url::parse("https://git.example.com/team/me/project").unwrap(),&instance,));- assert!(!is_gitlab_instance_url(- assert!(!is_gitea_instance_url(++ assert!(!is_forge_instance_url(&reqwest::Url::parse("https://git.example.com/other/project").unwrap(),&instance,));- assert!(!is_gitlab_instance_url(- assert!(!is_gitea_instance_url(++ assert!(!is_forge_instance_url(&reqwest::Url::parse("https://evil.example/team/me/project").unwrap(),&instance,));diff --cc windows/src-tauri/src/secrets.rsindex f135faf5,5cb2b653..9f23b35d--- a/windows/src-tauri/src/secrets.rs+++ b/windows/src-tauri/src/secrets.rs@@@ -16,8 -16,8 +16,10 @@@ pub const KNOWN_KEYS: &[&str] = &"n8n-api-key","vercel-token","github-token",+ "gitlab-url",+ "gitlab-token",+ "gitea-url",+ "gitea-token","stripe-api-key","resend-api-key","notion-api-key",diff --cc windows/src/core/bridge.tsindex 6e28d21a,aff36f09..82ce5283--- a/windows/src/core/bridge.ts+++ b/windows/src/core/bridge.ts@@@ -206,8 -206,10 +206,12 @@@ export const Bridge =listMonitors: () => call<{ key: string; label: string }[]>("list_monitors"),openUrl: (url: string) => call<void>("open_url", { url }),+ /** Opens a GitLab link only when it belongs to the configured instance. */+ openGitLabUrl: (url: string) => call<void>("open_gitlab_url", { url }),+ /** Opens the configured Gitea instance without exposing its URL to the page. */+ openGitea: () => call<void>("open_gitea"),+ /** Opens a Gitea link only if it belongs to the configured instance. */+ openGiteaUrl: (url: string) => call<void>("open_gitea_url", { url }),/** Which of these sounds have a file of the user's own in the sounds folder. */customSounds: (names: readonly string[]) => call<string[]>("custom_sounds", { names }),diff --cc windows/src/core/pills.tsindex c78be4d4,cc521371..c00a608c--- a/windows/src/core/pills.ts+++ b/windows/src/core/pills.ts@@@ -122,8 -122,8 +122,10 @@@ export const PILL_CATALOG: readonly Pilsubtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("vercel-token") },{ id: "integration_github", name: "GitHub", color: "#F4505E", category: "service",subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("github-token") },+ { id: "integration_gitlab", name: "GitLab", color: "#FC6D26", category: "service",+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("gitlab-token") },+ { id: "integration_gitea", name: "Gitea", color: "#609926", category: "service",+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("gitea-token") },{ id: "integration_notion", name: "Notion", color: "#8C8C8C", category: "service",subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("notion-api-key") },{ id: "integration_calcom", name: "Cal.com", color: "#C9956A", category: "service",diff --cc windows/src/settings/main.tsindex 0167d2aa,df629742..19434f34--- a/windows/src/settings/main.ts+++ b/windows/src/settings/main.ts@@@ -771,12 -771,11 +771,17 @@@ const INTEGRATIONS: IntegrationDef[] ={ id: "integration_github", name: "GitHub", color: "#F4505E",fields: [{ key: "github-token", label: N_("Token"), placeholder: "ghp_…", secret: true }],hint: N_("Classic token with the repo scope, or fine-grained with read access to Pull requests, Commit statuses and Actions.") },+ { id: "integration_gitlab", name: "GitLab", color: "#FC6D26",+ fields: [+ { key: "gitlab-url", label: N_("Instance URL"), placeholder: "https://gitlab.com", secret: false },+ { key: "gitlab-token", label: N_("Token"), placeholder: "glpat-…", secret: true },+ ],+ hint: N_("Personal access token with read_api and read_user scopes.") },+ { id: "integration_gitea", name: "Gitea", color: "#609926",+ fields: [+ { key: "gitea-url", label: N_("Instance URL"), placeholder: "https://gitea.example.com", secret: false },+ { key: "gitea-token", label: N_("Token"), placeholder: "…", secret: true },+ ] },{ id: "integration_vercel", name: "Vercel", color: "#7C5CFF",fields: [{ key: "vercel-token", label: N_("Token"), placeholder: "…", secret: true }] },{ id: "integration_n8n", name: "n8n", color: "#F29B38",@@@ -1337,7 -1336,7 +1342,7 @@@ async function render()const shortcutReport = await Bridge.shortcutsStatus();const keys = [- "stripe-api-key", "github-token", "gitlab-url", "gitlab-token", "vercel-token",- "stripe-api-key", "github-token", "gitea-url", "gitea-token", "vercel-token",++ "stripe-api-key", "github-token", "gitlab-url", "gitlab-token", "gitea-url", "gitea-token", "vercel-token","n8n-url", "n8n-api-key", "resend-api-key", "notion-api-key", "calcom-api-key",];const present: Record<string, boolean> = {};diff --cc windows/src/views/github.tsindex be58ff5e,34cba118..11f00652--- a/windows/src/views/github.ts+++ b/windows/src/views/github.ts@@@ -21,7 -21,7 +21,7 @@@ const GITHUB_RED = "#F4505E"export interface ForgeCardOptions {title: string;color: string;- provider?: "github" | "gitlab";- provider?: "github" | "gitea";++ provider?: "github" | "gitlab" | "gitea";refreshId?: string;profileUrl?: string;}@@@ -29,7 -29,7 +29,8 @@@const openSections = new Map<string, GitHubSection>();function open(url: string, forge: ForgeCardOptions) {+ if (forge.provider === "gitlab") { void Bridge.openGitLabUrl(url); return; }+ if (forge.provider === "gitea") { void Bridge.openGiteaUrl(url); return; }const safe = safeGitHubUrl(url);if (safe) void Bridge.openUrl(safe);}@@@ -139,7 -139,7 +140,7 @@@ function prRow(pr: GitHubPR, showCI: bofunction repoRow(repo: GitHubRepoCI, forge: ForgeCardOptions): HTMLElement {const word = ciWord(repo.ci);return row(- () => open(forge.provider === "gitlab" ? repo.url : actionsUrl(repo.url), forge),- () => open(forge.provider === "gitea" ? repo.url : actionsUrl(repo.url), forge),++ () => open(forge.provider && forge.provider !== "github" ? repo.url : actionsUrl(repo.url), forge),ciDot(repo.ci),h("span", { class: "gh-ref", text: shortRepo(repo.repo) }),h("span", { class: "gh-title", text: repo.branch }),diff --cc windows/src/views/integrations.tsindex 1a757231,ea6a5981..4932b601--- a/windows/src/views/integrations.ts+++ b/windows/src/views/integrations.ts@@@ -271,14 -271,13 +271,21 @@@ function githubCard(): HTMLElement);}+function gitlabCard(): HTMLElement {+ const d = get("integration_gitlab");+ return h("div", { class: "int-card" }, header("#FC6D26", "GitLab", t("Overview")), h("div", { class: "int-stats" },+ statRow(ICONS.stack, "#6B7079", t("Projects"), String(d.projects ?? 0)),+ statRow(ICONS.pull, "#FC6D26", t("My PRs"), String(d.myMergeRequests ?? 0)),+ statRow(ICONS.eye, "#8AB4F8", t("To review"), String(d.reviewRequests ?? 0))));+}++ function giteaCard(): HTMLElement {+ const d = get("integration_gitea");+ return h("div", { class: "int-card" }, header("#609926", "Gitea", t("Overview")),+ h("div", { class: "int-stats" }, statRow(ICONS.star, "#F5A524", t("Total stars"), String(d.totalStars ?? 0)),+ statRow(ICONS.stack, "#6B7079", t("Repositories"), String(d.totalRepos ?? 0))));+ }+// ── Stripe ────────────────────────────────────────────────────────────────────function stripeCard(): HTMLElement {@@@ -442,7 -441,8 +449,9 @@@ export function hasIntegrationData(id:return arr(id, "emails").length > 0;case "integration_github":return get(id).totalRepos != null || readPulse(get(id)) != null;+ case "integration_gitlab": return get(id).projects != null;+ case "integration_gitea":+ return get(id).totalRepos != null;case "integration_stripe":return info.loaded;case "integration_notion":@@@ -476,18 -476,21 +485,27 @@@ export function renderIntegrationCard(t: githubPulseCard(pulse, readStats(d), readActivity(d), hooks.openDetail);}}+ if (task.id === "integration_gitlab") {+ const d = get(task.id); const pulse = readPulse(d);+ if (pulse) { const options: ForgeCardOptions = { title: "GitLab", color: "#FC6D26", provider: "gitlab", refreshId: "integration_gitlab", profileUrl: typeof d.profileUrl === "string" ? d.profileUrl : undefined };+ return hooks.detailOpen ? githubDetail(pulse, readStats(d), readActivity(d), hooks.closeDetail, options) : githubPulseCard(pulse, readStats(d), readActivity(d), hooks.openDetail, options); }+ }+ if (task.id === "integration_gitea") {+ const d = get(task.id); const pulse = readPulse(d);+ if (pulse) {+ const options: ForgeCardOptions = { title: "Gitea", color: "#609926", provider: "gitea", refreshId: "integration_gitea", profileUrl: typeof d.profileUrl === "string" ? d.profileUrl : undefined };+ return hooks.detailOpen ? githubDetail(pulse, readStats(d), readActivity(d), hooks.closeDetail, options) : githubPulseCard(pulse, readStats(d), readActivity(d), hooks.openDetail, options);+ }+ }switch (task.id) {case "integration_resend":return resendCard();case "integration_github":return githubCard();+ case "integration_gitlab": return gitlabCard();+ case "integration_gitea":+ return giteaCard();case "integration_stripe":return stripeCard();case "integration_notion":diff --cc windows/tests/github.test.mjsindex 71d04536,ee037b10..624473f4--- a/windows/tests/github.test.mjs+++ b/windows/tests/github.test.mjs@@@ -274,23 -250,23 +274,78 @@@ test("Ctrl+↓ ↑ highlight a list rowtest("forge callbacks and selected sections survive rendering a different provider", async () => {+ const { installFakeDom } = await import("./fakedom.mjs");+ installFakeDom();+ const { githubDetail, githubPulseCard, listRows, openRow } = await import("../src/views/github.ts");+ const pulse = { login: "me", fetchedAt: 1, myPRs: [pr("me/app#1", "success")], toReview: [], mainCI: [] };+ const options = { title: "GitLab", color: "#FC6D26", provider: "gitlab", refreshId: "integration_gitlab" };+ const card = githubPulseCard(pulse, null, null, () => {}, options);+ githubPulseCard(pulse, null, null, () => {});+ calls.length = 0;+ card.find(".gh-stat")[0].fire("click");+ assert.deepEqual(sent("refresh_integration"), [{ id: "integration_gitlab" }]);+ assert.deepEqual(sent("github_refresh"), []);+ const rows = listRows(githubDetail(pulse, null, null, () => {}, options));+ const githubCard = githubPulseCard(pulse, { totalRepos: 1, totalStars: 0 }, activity, () => {});+ githubCard.find(".gh-spark")[0].fire("click");+ githubDetail(pulse, null, activity, () => {});+ openRow(rows[0]);+ assert.deepEqual(sent("open_gitlab_url"), [{ url: pulse.myPRs[0].url }]);+ assert.equal(listRows(githubDetail(pulse, null, null, () => {}, options)).length, 1);+ githubCard.find(".gh-stat")[0].fire("click");+});++++test("Gitea callbacks and selected sections survive rendering a different provider", async () => {+ const { installFakeDom } = await import("./fakedom.mjs");+ installFakeDom();+ const { githubDetail, githubPulseCard, listRows, openRow } = await import("../src/views/github.ts");+ const pulse = { login: "me", fetchedAt: 1, myPRs: [pr("me/app#1", "success")], toReview: [], mainCI: [] };+ const options = { title: "Gitea", color: "#609926", provider: "gitea", refreshId: "integration_gitea" };+ const card = githubPulseCard(pulse, null, null, () => {}, options);+ githubPulseCard(pulse, null, null, () => {});+ calls.length = 0;+ card.find(".gh-stat")[0].fire("click");+ assert.deepEqual(sent("refresh_integration"), [{ id: "integration_gitea" }]);+ assert.deepEqual(sent("github_refresh"), []);+ const rows = listRows(githubDetail(pulse, null, null, () => {}, options));+ const githubCard = githubPulseCard(pulse, { totalRepos: 1, totalStars: 0 }, activity, () => {});+ githubCard.find(".gh-spark")[0].fire("click");+ githubDetail(pulse, null, activity, () => {});+ openRow(rows[0]);+ assert.deepEqual(sent("open_gitea_url"), [{ url: pulse.myPRs[0].url }]);+ assert.equal(listRows(githubDetail(pulse, null, null, () => {}, options)).length, 1);+ githubCard.find(".gh-stat")[0].fire("click");+ });++++++test("GitHub, GitLab and Gitea cards coexist and keep their own navigation", async () => {++ const { installFakeDom } = await import("./fakedom.mjs");++ installFakeDom();++ const { renderIntegrationCard } = await import("../src/views/integrations.ts");++ const { listRows, openRow } = await import("../src/views/github.ts");++ const providers = ["github", "gitlab", "gitea"];++ const oldIntegrations = State.integrations;++ State.integrations = {};++ try {++ const hooks = { detailOpen: false, openDetail: () => {}, closeDetail: () => {}, openSettings: () => {} };++ for (const provider of providers) {++ const id = `integration_${provider}`;++ const pulse = { login: "me", fetchedAt: 1, myPRs: [{ ...pr("me/app#1", "success"), url: `https://${provider}.com/me/app/pull/1` }], toReview: [], mainCI: [] };++ State.integrations[id] = { configured: true, loaded: true, error: null, data: { projects: 1, totalRepos: 1, totalStars: 2, pulse } };++ }++ const cards = providers.map((provider) => renderIntegrationCard({ id: `integration_${provider}` }, hooks));++ calls.length = 0;++ const details = cards.map((card, index) => {++ card.find(".gh-stat")[0].fire("click");++ return renderIntegrationCard({ id: `integration_${providers[index]}` }, { ...hooks, detailOpen: true });++ });++ assert.deepEqual(sent("github_refresh"), [{ section: "pulse" }]);++ assert.deepEqual(sent("refresh_integration"), [{ id: "integration_gitlab" }, { id: "integration_gitea" }]);++ for (const detail of details) openRow(listRows(detail)[0]);++ assert.deepEqual(sent("open_url"), [{ url: "https://github.com/me/app/pull/1" }]);++ assert.deepEqual(sent("open_gitlab_url"), [{ url: "https://gitlab.com/me/app/pull/1" }]);++ assert.deepEqual(sent("open_gitea_url"), [{ url: "https://gitea.com/me/app/pull/1" }]);++ } finally {++ State.integrations = oldIntegrations;++ }++});diff --cc windows/tests/pills.test.mjsindex e2883ac4,eed95209..232556ab--- a/windows/tests/pills.test.mjs+++ b/windows/tests/pills.test.mjs@@@ -47,7 -47,8 +47,8 @@@ test("the catalog holds the Mac's pill["integration_spotify", "Spotify", "#1DB954", "service", "Integration"],];assert.deepEqual(- PILL_CATALOG.filter((p) => p.id !== "integration_gitlab").map((p) => [p.id, p.name, p.color, p.category, p.subtitle]),- PILL_CATALOG.filter((p) => p.id !== "integration_gitea")++ PILL_CATALOG.filter((p) => !["integration_gitlab", "integration_gitea"].includes(p.id))+ .map((p) => [p.id, p.name, p.color, p.category, p.subtitle]),mac,);assert.deepEqual(PILL_CATEGORIES.map((c) => c.title), [@@@ -55,12 -56,14 +56,20 @@@]);});+test("GitLab is a supported service integration", () => {+ const def = pillDefinition("integration_gitlab");+ assert.deepEqual([def.name, def.color, def.category, def.support], ["GitLab", "#FC6D26", "service", "yes"]);+ assert.ok(!isComingSoon("integration_gitlab"));+});++ test("Gitea is an available service pill", () => {+ assert.deepEqual(+ pillDefinition("integration_gitea"),+ { id: "integration_gitea", name: "Gitea", color: "#609926", category: "service",+ subtitle: "Integration", source: "n8n", support: "yes", connect: { kind: "key", key: "gitea-token" } },+ );+ });+test("the shipped pills keep their IDs, colours and sources with current display names", () => {const shipped = [["integration_claude", "Claude Code", "#F5F6F8", "claudeCode"],