Skip to content

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.

feat: add GitLab integration pulse

andrey15a2be2bdd7f
diff --git a/windows/src-tauri/src/integrations.rs b/windows/src-tauri/src/integrations.rs
index 14969e48..8d34eaa4 100644
--- a/windows/src-tauri/src/integrations.rs
+++ b/windows/src-tauri/src/integrations.rs
@@ -17,7 +17,7 @@ use serde_json::{json, Value};
use tauri::{AppHandle, Emitter, Manager};
use tokio::sync::Notify;
-use crate::github::{self, GitHubActivity, GitHubPulse};
+use crate::github::{self, CiState, ContributionDay, GitHubActivity, GitHubPr, GitHubPulse, GitHubRepoCi, ReviewState};
use crate::island::WINDOW_LABEL;
use crate::log;
use crate::secrets;
@@ -69,6 +69,7 @@ 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(app.clone(), "integration_gitlab", 7, 300, poll_gitlab);
spawn_github_loops(app.clone());
spawn(app.clone(), "integration_calcom", 8, 300, poll_calcom);
spawn(app, "integration_notion", 9, 300, poll_notion);
@@ -115,6 +116,7 @@ pub async fn poll_once(app: AppHandle, id: &str) {
github_refresh_if_stale("activity");
poll_github(app).await
}
+ "integration_gitlab" => poll_gitlab(app).await,
"integration_vercel" => poll_vercel(app).await,
"integration_n8n" => poll_n8n(app).await,
"integration_resend" => poll_resend(app).await,
@@ -124,6 +126,120 @@ pub async fn poll_once(app: AppHandle, id: &str) {
}
}
+// ── GitLab ───────────────────────────────────────────────────────────────────
+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) {
+ 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();
+ let http = client();
+ 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>>);
@@ -1009,6 +1125,28 @@ fn fmt_value(v: &Value) -> String {
mod tests {
use super::*;
+ #[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 --git a/windows/src-tauri/src/lib.rs b/windows/src-tauri/src/lib.rs
index e35793fa..a48dcd1b 100644
--- a/windows/src-tauri/src/lib.rs
+++ b/windows/src-tauri/src/lib.rs
@@ -205,6 +205,29 @@ 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) {
+ open_url(url);
+ }
+}
+
+fn is_gitlab_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]
@@ -689,6 +712,7 @@ pub fn run() {
reposition,
list_monitors,
open_url,
+ open_gitlab_url,
open_in_vscode,
open_session,
open_claude_desktop,
@@ -831,7 +855,24 @@ pub fn run() {
#[cfg(test)]
mod tests {
- use super::diff_file;
+ use super::{diff_file, is_gitlab_instance_url};
+
+ #[test]
+ fn gitlab_links_stay_on_the_configured_instance() {
+ let instance = reqwest::Url::parse("https://git.example.com/team/").unwrap();
+ assert!(is_gitlab_instance_url(
+ &reqwest::Url::parse("https://git.example.com/team/me/project").unwrap(),
+ &instance,
+ ));
+ assert!(!is_gitlab_instance_url(
+ &reqwest::Url::parse("https://git.example.com/other/project").unwrap(),
+ &instance,
+ ));
+ assert!(!is_gitlab_instance_url(
+ &reqwest::Url::parse("https://evil.example/team/me/project").unwrap(),
+ &instance,
+ ));
+ }
#[test]
fn only_an_existing_file_by_its_full_path_reaches_the_editor() {
diff --git a/windows/src-tauri/src/secrets.rs b/windows/src-tauri/src/secrets.rs
index e81ef527..53e08b43 100644
--- a/windows/src-tauri/src/secrets.rs
+++ b/windows/src-tauri/src/secrets.rs
@@ -16,6 +16,8 @@ pub const KNOWN_KEYS: &[&str] = &[
"n8n-api-key",
"vercel-token",
"github-token",
+ "gitlab-url",
+ "gitlab-token",
"stripe-api-key",
"resend-api-key",
"notion-api-key",
diff --git a/windows/src/core/bridge.ts b/windows/src/core/bridge.ts
index 848daecf..fdbf0bd9 100644
--- a/windows/src/core/bridge.ts
+++ b/windows/src/core/bridge.ts
@@ -204,6 +204,8 @@ 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 }),
/** 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 --git a/windows/src/core/pills.ts b/windows/src/core/pills.ts
index 8242ad30..22882fc5 100644
--- a/windows/src/core/pills.ts
+++ b/windows/src/core/pills.ts
@@ -122,6 +122,8 @@ export const PILL_CATALOG: readonly PillDefinition[] = [
subtitle: 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_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 --git a/windows/src/i18n/extra.json b/windows/src/i18n/extra.json
index 9ba0b6ab..44c42ab6 100644
--- a/windows/src/i18n/extra.json
+++ b/windows/src/i18n/extra.json
@@ -1629,6 +1629,17 @@
"ru": "Платёж",
"id": "Pembayaran"
},
+ "Personal access token with read_api and read_user scopes.": {
+ "zh-Hans": "具有 read_api 和 read_user 范围的个人访问令牌。",
+ "hi": "read_api और read_user स्कोप वाला व्यक्तिगत एक्सेस टोकन।",
+ "es": "Token de acceso personal con los alcances read_api y read_user.",
+ "ar": "رمز وصول شخصي بنطاقي read_api وread_user.",
+ "fr": "Jeton d’accès personnel avec les portées read_api et read_user.",
+ "bn": "read_api এবং read_user স্কোপসহ ব্যক্তিগত অ্যাক্সেস টোকেন।",
+ "pt-BR": "Token de acesso pessoal com os escopos read_api e read_user.",
+ "ru": "Персональный токен с правами read_api и read_user.",
+ "id": "Token akses pribadi dengan cakupan read_api dan read_user."
+ },
"Pick a model above the chat box first.": {
"zh-Hans": "请先在聊天框上方选择一个模型。",
"hi": "पहले चैट बॉक्स के ऊपर एक मॉडल चुनें।",
diff --git a/windows/src/settings/main.ts b/windows/src/settings/main.ts
index 7d0dfe6c..fba362f1 100644
--- a/windows/src/settings/main.ts
+++ b/windows/src/settings/main.ts
@@ -763,6 +763,12 @@ 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_vercel", name: "Vercel", color: "#7C5CFF",
fields: [{ key: "vercel-token", label: N_("Token"), placeholder: "…", secret: true }] },
{ id: "integration_n8n", name: "n8n", color: "#F29B38",
@@ -1328,7 +1334,7 @@ async function render() {
const shortcutReport = await Bridge.shortcutsStatus();
const keys = [
- "stripe-api-key", "github-token", "vercel-token",
+ "stripe-api-key", "github-token", "gitlab-url", "gitlab-token", "vercel-token",
"n8n-url", "n8n-api-key", "resend-api-key", "notion-api-key", "calcom-api-key",
];
const present: Record<string, boolean> = {};
diff --git a/windows/src/views/github.ts b/windows/src/views/github.ts
index 86fba2f2..c4663df1 100644
--- a/windows/src/views/github.ts
+++ b/windows/src/views/github.ts
@@ -18,11 +18,20 @@ import {
} from "../core/github";
const GITHUB_RED = "#F4505E";
+export interface ForgeCardOptions {
+ title: string;
+ color: string;
+ provider?: "github" | "gitlab";
+ refreshId?: string;
+ profileUrl?: string;
+}
+let forge: ForgeCardOptions = { title: "GitHub", color: GITHUB_RED };
/** Which list the detail view shows; kept across re-renders of the card. */
let openSection: GitHubSection = "myPRs";
function open(url: string) {
+ if (forge.provider === "gitlab") { void Bridge.openGitLabUrl(url); return; }
const safe = safeGitHubUrl(url);
if (safe) void Bridge.openUrl(safe);
}
@@ -53,14 +62,16 @@ export function githubPulseCard(
stats: GitHubStats | null,
activity: GitHubActivity | null,
openDetail: () => void,
+ options: ForgeCardOptions = { title: "GitHub", color: GITHUB_RED },
): HTMLElement {
+ forge = options;
const show = (section: GitHubSection) => {
openSection = section;
- void Bridge.githubRefresh(section === "activity" ? "activity" : "pulse");
+ if (forge.refreshId) void Bridge.refreshIntegration(forge.refreshId); else void Bridge.githubRefresh(section === "activity" ? "activity" : "pulse");
openDetail();
};
- const head = h("div", { class: "int-head" }, dot(GITHUB_RED, 7), h("b", { text: GH_STRINGS.title }));
+ const head = h("div", { class: "int-head" }, dot(forge.color, 7), h("b", { text: forge.title }));
if (stats || activity) {
const spark = h("button", { class: "gh-spark", onclick: () => show("activity") });
if (stats) spark.append(h("span", { text: `★ ${formatCount(stats.totalStars)}` }));
@@ -130,7 +141,7 @@ function prRow(pr: GitHubPR, showCI: boolean): HTMLElement {
function repoRow(repo: GitHubRepoCI): HTMLElement {
const word = ciWord(repo.ci);
return row(
- () => open(actionsUrl(repo.url)),
+ () => open(forge.provider === "gitlab" ? repo.url : actionsUrl(repo.url)),
ciDot(repo.ci),
h("span", { class: "gh-ref", text: shortRepo(repo.repo) }),
h("span", { class: "gh-title", text: repo.branch }),
@@ -190,7 +201,7 @@ function activityDetail(
const right = h("button", {
class: "gh-head-right",
text: activityHeader(activity, stats, null),
- onclick: () => open(profileUrl(login)),
+ onclick: () => open(forge.profileUrl ?? profileUrl(login)),
});
let picked: ContributionDay | null = null;
@@ -230,7 +241,9 @@ export function githubDetail(
stats: GitHubStats | null,
activity: GitHubActivity | null,
onBack: () => void,
+ options: ForgeCardOptions = { title: "GitHub", color: GITHUB_RED },
): HTMLElement {
+ forge = options;
return openSection === "activity"
? activityDetail(activity, stats, pulse.login, onBack)
: listDetail(openSection, pulse, onBack);
diff --git a/windows/src/views/integrations.ts b/windows/src/views/integrations.ts
index 2317d9c0..63078bea 100644
--- a/windows/src/views/integrations.ts
+++ b/windows/src/views/integrations.ts
@@ -11,7 +11,7 @@ import { Bridge } from "../core/bridge";
import { isComingSoon, pillDefinition } from "../core/pills";
import { refreshHookPills } from "../island/integrations";
import { readActivity, readPulse, readStats } from "../core/github";
-import { githubDetail, githubPulseCard } from "./github";
+import { githubDetail, githubPulseCard, type ForgeCardOptions } from "./github";
import { N_, language, t } from "../i18n/i18n";
/** Same shape as the Swift `timeAgo` computed properties. */
@@ -271,6 +271,14 @@ 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))));
+}
+
// ── Stripe ────────────────────────────────────────────────────────────────────
function stripeCard(): HTMLElement {
@@ -434,6 +442,7 @@ export function hasIntegrationData(id: string): boolean {
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_stripe":
return info.loaded;
case "integration_notion":
@@ -467,12 +476,18 @@ export function renderIntegrationCard(task: AgentTask, hooks: IntegrationCardHoo
: 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); }
+ }
switch (task.id) {
case "integration_resend":
return resendCard();
case "integration_github":
return githubCard();
+ case "integration_gitlab": return gitlabCard();
case "integration_stripe":
return stripeCard();
case "integration_notion":
diff --git a/windows/tests/github.test.mjs b/windows/tests/github.test.mjs
index e7cffee4..382891fd 100644
--- a/windows/tests/github.test.mjs
+++ b/windows/tests/github.test.mjs
@@ -211,6 +211,30 @@ test("showing the GitHub card asks Rust for a refresh, once per showing", () =>
assert.deepEqual(sent("github_refresh"), [{ section: "pulse" }, { section: "pulse" }]);
});
+test("the shared pulse card renders GitLab branding, stars, activity and safe profile links", async () => {
+ const { installFakeDom } = await import("./fakedom.mjs");
+ installFakeDom();
+ const { githubDetail, githubPulseCard } = await import("../src/views/github.ts");
+ const pulse = { login: "me", fetchedAt: 1, myPRs: [], toReview: [], mainCI: [] };
+ const options = {
+ title: "GitLab", color: "#FC6D26", provider: "gitlab", refreshId: "integration_gitlab",
+ profileUrl: "https://gitlab.example/me",
+ };
+
+ calls.length = 0;
+ const card = githubPulseCard(pulse, { totalRepos: 2, totalStars: 7 }, activity, () => {}, options);
+ assert.match(card.textContent, /GitLab/);
+ assert.match(card.textContent, /★ 7/);
+ card.find(".gh-spark")[0].fire("click");
+ assert.deepEqual(sent("refresh_integration"), [{ id: "integration_gitlab" }]);
+
+ const detail = githubDetail(pulse, { totalRepos: 2, totalStars: 7 }, activity, () => {}, options);
+ assert.ok(detail.find(".gh-cell").length > 0);
+ detail.find(".gh-head-right")[0].fire("click");
+ assert.deepEqual(sent("open_gitlab_url"), [{ url: "https://gitlab.example/me" }]);
+ card.find(".gh-stat")[0].fire("click"); // leave the shared view state on its default section
+});
+
// ── The lists from the keyboard (GitHubDetailView: ⌘↓ ⌘↑ ⌘O) ──────────────────
test("Ctrl+↓ ↑ highlight a list row, Ctrl+O does what its click does", async () => {
diff --git a/windows/tests/pills.test.mjs b/windows/tests/pills.test.mjs
index 3186d801..8ad54d4a 100644
--- a/windows/tests/pills.test.mjs
+++ b/windows/tests/pills.test.mjs
@@ -42,7 +42,7 @@ test("the catalog holds the Mac's pills, in the Mac's order, with the Mac's valu
["integration_spotify", "Spotify", "#1DB954", "service", "Integration"],
];
assert.deepEqual(
- PILL_CATALOG.map((p) => [p.id, p.name, p.color, p.category, p.subtitle]),
+ PILL_CATALOG.filter((p) => p.id !== "integration_gitlab").map((p) => [p.id, p.name, p.color, p.category, p.subtitle]),
mac,
);
assert.deepEqual(PILL_CATEGORIES.map((c) => c.title), [
@@ -50,6 +50,12 @@ test("the catalog holds the Mac's pills, in the Mac's order, with the Mac's valu
]);
});
+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("the pills Windows always had keep their IDs, names, colours and sources", () => {
const shipped = [
["integration_claude", "VS Code", "#F5F6F8", "claudeCode"],