Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## 2026-03-31 16:20: docs: add Linear task plugin integration design

**What changed:**
- Added a new product/technical design document for Linear task integration as an independent plugin.
- Defined scope for OAuth connection, bidirectional task sync, and connection status management in Settings.
- Documented architecture decisions aligned with current plugin runtime, including required plugin permissions and SDK task wrapper extension.
- Added phased implementation plan, sync/conflict strategy, risks, and acceptance mapping.

**Why:**
- Provide a concrete implementation blueprint before coding the Linear integration.
- Ensure requirements are explicit: plugin install-gated behavior, two-way sync, and visible connection state.

**Files affected:**
- `docs/plans/2026-03-31-linear-task-plugin-integration-design.md`
- `ai/memories/changelogs/202603311620-docs-linear-task-plugin-integration-design.md`
20 changes: 20 additions & 0 deletions ai/memories/changelogs/202603311644-feat-linear-api-key-auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## 2026-03-31 16:44: feat: switch Linear integration auth from OAuth to API key

**What changed:**
- Reworked `plugins/linear` authentication flow from OAuth to API key secret storage (`linear-api-key`).
- Replaced panel connect UX with API key input/save flow, keeping disconnect and manual sync actions.
- Updated plugin manifest tools to `linear_set_api_key` and removed OAuth-specific permissions/tool surface.
- Updated integration design and manual QA docs to align with API key onboarding, validation, and failure paths.
- Rebuilt and installed latest plugin artifact to `~/.peekoo/plugins/linear` for immediate local validation.

**Why:**
- Match product requirement update to use Linear personal/team API keys.
- Simplify desktop setup by avoiding browser callback/OAuth token lifecycle handling.

**Files affected:**
- `plugins/linear/peekoo-plugin.toml`
- `plugins/linear/src/lib.rs`
- `plugins/linear/ui/panel.html`
- `plugins/linear/ui/panel.js`
- `docs/plans/2026-03-31-linear-task-plugin-integration-design.md`
- `docs/plans/2026-03-31-linear-integration-manual-qa.md`
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## 2026-03-31 17:40: feat: add Linear plugin foundation with task sync and settings status

**What changed:**
- Added a new first-party plugin at `plugins/linear` with OAuth connect/disconnect, panel snapshot provider, manual sync trigger, periodic scheduler sync, and two-way task sync scaffolding against Linear GraphQL.
- Added a new `tasks` module in `crates/peekoo-plugin-sdk` and wired raw host function bindings so plugins can create/list/update/delete/toggle/assign Peekoo tasks safely.
- Added a new settings hook and UI section to show Linear integration status in Settings, including install/enable/connected/sync/error surfaces.
- Updated `justfile` to include `linear` in `plugin-build-all`.

**Why:**
- Implement the approved design direction for Linear as an install-gated independent plugin.
- Enable plugin-side background synchronization without coupling Linear logic into core app crates.
- Satisfy acceptance criteria that connection status is visible in Settings.

**Files affected:**
- `plugins/linear/Cargo.toml`
- `plugins/linear/peekoo-plugin.toml`
- `plugins/linear/src/lib.rs`
- `plugins/linear/ui/panel.html`
- `plugins/linear/ui/panel.css`
- `plugins/linear/ui/panel.js`
- `crates/peekoo-plugin-sdk/src/host_fns.rs`
- `crates/peekoo-plugin-sdk/src/tasks.rs`
- `crates/peekoo-plugin-sdk/src/lib.rs`
- `apps/desktop-ui/src/features/settings/useLinearIntegrationStatus.ts`
- `apps/desktop-ui/src/features/settings/SettingsPanel.tsx`
- `justfile`
2 changes: 1 addition & 1 deletion apps/desktop-tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2", features = [] }

[dependencies]
tauri = { version = "2", features = ["tray-icon"] }
tauri = { version = "2", features = ["macos-private-api", "tray-icon"] }
tauri-plugin-dialog = "2"
tauri-plugin-log = { version = "2", features = ["tracing"] }
tauri-plugin-notification = "2"
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop-ui/src/components/sprite/SpriteActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export function SpriteActionMenu({
}: SpriteActionMenuProps) {
const [pluginsPopupOpen, setPluginsPopupOpen] = useState(false);
const enabledPlugins = installedPlugins.filter((plugin) => {
if (plugin.pluginKey === "linear") {
return false;
}

if (!plugin.enabled) {
return false;
}
Expand Down
52 changes: 51 additions & 1 deletion apps/desktop-ui/src/features/settings/SettingsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useGlobalSettings } from "./useGlobalSettings";
import { useLinearIntegrationStatus } from "./useLinearIntegrationStatus";
import { SpriteSelector } from "./SpriteSelector";
import { Button } from "@/components/ui/button";
import { Sun, Moon, Monitor } from "lucide-react";
Expand All @@ -13,6 +14,12 @@ export function SettingsPanel() {
setActiveSpriteId,
setThemeMode
} = useGlobalSettings();
const {
status: linearStatus,
isLoading: linearLoading,
error: linearError,
refresh: refreshLinearStatus,
} = useLinearIntegrationStatus();

if (loading) {
return (
Expand All @@ -36,6 +43,17 @@ export function SettingsPanel() {
{ id: "system", label: "System", icon: Monitor },
];

const linearStatusLabels: Record<string, string> = {
uninstalled: "Not Installed",
disabled: "Installed (Disabled)",
disconnected: "Disconnected",
connecting: "Connecting",
connected: "Connected",
syncing: "Syncing",
error: "Error",
unknown: "Unknown",
};

return (
<div className="space-y-8">
<section className="space-y-3">
Expand Down Expand Up @@ -72,7 +90,39 @@ export function SettingsPanel() {
onSelect={setActiveSpriteId}
/>
</section>

<section className="space-y-3">
<h3 className="text-sm font-medium text-text-secondary uppercase tracking-wider">Integrations</h3>
<div className="rounded-2xl border border-glass-border bg-glass/30 px-4 py-3 space-y-2">
<div className="flex items-center justify-between gap-3">
<p className="text-sm font-medium text-text-primary">Linear</p>
<Button size="sm" variant="ghost" onClick={() => void refreshLinearStatus()}>
Refresh
</Button>
</div>
<p className="text-xs text-text-muted">
Status: {linearLoading ? "Loading..." : linearStatusLabels[linearStatus.uiStatus] ?? "Unknown"}
</p>
{linearStatus.workspaceName ? (
<p className="text-xs text-text-muted">Workspace: {linearStatus.workspaceName}</p>
) : null}
{linearStatus.userEmail ? (
<p className="text-xs text-text-muted">
Account: {linearStatus.userName ? `${linearStatus.userName} · ` : ""}
{linearStatus.userEmail}
</p>
) : null}
{linearStatus.lastSyncAt ? (
<p className="text-xs text-text-muted">Last Sync: {linearStatus.lastSyncAt}</p>
) : null}
{linearStatus.lastError ? (
<p className="text-xs text-danger">Error: {linearStatus.lastError}</p>
) : null}
{linearError ? (
<p className="text-xs text-danger">Failed to fetch integration status: {linearError}</p>
) : null}
</div>
</section>
</div>
);
}

148 changes: 148 additions & 0 deletions apps/desktop-ui/src/features/settings/useLinearIntegrationStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import { useCallback, useEffect, useState } from "react";
import { invoke } from "@tauri-apps/api/core";

const POLL_INTERVAL_MS = 15000;

type UiStatus =
| "uninstalled"
| "disabled"
| "disconnected"
| "connecting"
| "connected"
| "syncing"
| "error"
| "unknown";

interface PluginSummary {
pluginKey: string;
enabled: boolean;
}

interface PluginConnectionStatus {
connected?: boolean;
status?: string;
workspaceName?: string | null;
userName?: string | null;
userEmail?: string | null;
lastSyncAt?: string | null;
lastError?: string | null;
}

export interface LinearIntegrationStatus {
uiStatus: UiStatus;
installed: boolean;
enabled: boolean;
connected: boolean;
workspaceName: string | null;
userName: string | null;
userEmail: string | null;
lastSyncAt: string | null;
lastError: string | null;
}

const DEFAULT_STATUS: LinearIntegrationStatus = {
uiStatus: "uninstalled",
installed: false,
enabled: false,
connected: false,
workspaceName: null,
userName: null,
userEmail: null,
lastSyncAt: null,
lastError: null,
};

function mapPluginStatus(status: string | undefined, connected: boolean): UiStatus {
switch (status) {
case "connected":
return connected ? "connected" : "disconnected";
case "connecting":
return "connecting";
case "syncing":
return "syncing";
case "error":
return "error";
case "disconnected":
return "disconnected";
default:
return connected ? "connected" : "unknown";
}
}

export function useLinearIntegrationStatus() {
const [status, setStatus] = useState<LinearIntegrationStatus>(DEFAULT_STATUS);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);

const refresh = useCallback(async () => {
try {
setError(null);

const plugins = await invoke<PluginSummary[]>("plugins_list");
const linear = plugins.find((plugin) => plugin.pluginKey === "linear");

if (!linear) {
setStatus(DEFAULT_STATUS);
setIsLoading(false);
return;
}

if (!linear.enabled) {
setStatus({
...DEFAULT_STATUS,
uiStatus: "disabled",
installed: true,
enabled: false,
});
setIsLoading(false);
return;
}

const raw = await invoke<string>("plugin_query_data", {
pluginKey: "linear",
providerName: "connection_status",
});

const parsed = JSON.parse(raw) as PluginConnectionStatus;
const connected = Boolean(parsed.connected);

setStatus({
uiStatus: mapPluginStatus(parsed.status, connected),
installed: true,
enabled: true,
connected,
workspaceName: parsed.workspaceName ?? null,
userName: parsed.userName ?? null,
userEmail: parsed.userEmail ?? null,
lastSyncAt: parsed.lastSyncAt ?? null,
lastError: parsed.lastError ?? null,
});
} catch (err) {
setError(String(err));
setStatus((prev) => ({
...prev,
uiStatus: prev.installed ? "error" : "unknown",
}));
} finally {
setIsLoading(false);
}
}, []);

useEffect(() => {
void refresh();
const interval = window.setInterval(() => {
void refresh();
}, POLL_INTERVAL_MS);

return () => {
window.clearInterval(interval);
};
}, [refresh]);

return {
status,
isLoading,
error,
refresh,
};
}
31 changes: 30 additions & 1 deletion apps/desktop-ui/src/features/tasks/TasksPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from "react";
import { ScrollArea } from "@/components/ui/scroll-area";
import { CheckCircle2, RefreshCw } from "lucide-react";
import { CheckCircle2, Link2, RefreshCw } from "lucide-react";
import type { TaskTab } from "@/types/task";
import { useTasks } from "./hooks/use-tasks";
import { TaskList } from "./components/TaskList";
Expand All @@ -10,6 +10,9 @@ import { TaskDetailView } from "./components/TaskDetailView";
import { NotificationToast } from "./components/ErrorToast";
import { LoadingSpinner } from "./components/LoadingSpinner";
import { formatSyncStatus } from "./utils/task-sync";
import { usePlugins } from "@/hooks/use-plugins";
import { openPanelWindow } from "@/hooks/use-panel-windows";
import type { PanelLabel } from "@/types/window";

const TAB_CONFIG: { value: TaskTab; label: string; emoji: string }[] = [
{ value: "today", label: "Today", emoji: "📅" },
Expand Down Expand Up @@ -46,6 +49,7 @@ function EmptyState({ tab }: { tab: TaskTab }) {
type MainTab = "tasks" | "activity";

export function TasksPanel() {
const { plugins, panels: pluginPanels } = usePlugins();
const {
tasks,
activityEvents,
Expand All @@ -71,6 +75,10 @@ export function TasksPanel() {
} = useTasks();

const [mainTab, setMainTab] = useState<MainTab>("tasks");
const linearPlugin = plugins.find((plugin) => plugin.pluginKey === "linear");
const linearPanel = pluginPanels.find((panel) => panel.pluginKey === "linear");
const showLinearButton = Boolean(linearPlugin && linearPanel);
const canOpenLinearPanel = Boolean(linearPanel);

// Show loading state
if (isLoading) {
Expand Down Expand Up @@ -113,6 +121,27 @@ export function TasksPanel() {
</span>
</div>

{showLinearButton ? (
<div className="flex items-center justify-between gap-2 rounded-lg border border-glass-border/50 bg-glass/60 px-2 py-1.5">
<span className="text-[10px] uppercase tracking-wider text-text-muted">Sources</span>
<button
type="button"
onClick={() => {
if (!linearPanel) {
return;
}
void openPanelWindow(linearPanel.label as PanelLabel, pluginPanels);
}}
disabled={!canOpenLinearPanel}
className="h-8 px-3 rounded-full shrink-0 flex items-center gap-1.5 text-xs font-medium text-text-primary bg-glass border border-glass-border hover:bg-space-overlay/40 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
title={canOpenLinearPanel ? "Open Linear panel" : "Enable Linear plugin to open panel"}
>
<Link2 size={13} />
<span>Linear</span>
</button>
</div>
) : null}

{/* Main Tabs */}
<div className="flex gap-1 bg-glass backdrop-blur-xl rounded-lg p-1 border border-glass-border/50 mb-3">
<button
Expand Down
Loading
Loading