mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 08:03:12 +00:00
The GitLab, GitHub, Jira and Linear integration modules, their two IPC registrars, and the shared GitHub project types each carried a file-level `eslint-disable max-lines` and ran 351-614 counted lines against a 300-line budget. AGENTS.md calls for splitting rather than suppressing, and config/max-lines-baseline.txt is a shrink-only ratchet, so this removes all eight suppressions and prunes their entries (341 -> 333). Pure move, no behavior change. Each client is cut along the seam it already had: per-operation modules for the issue APIs (create / update / comment / field options), and for Jira the request queue, site credential store, authenticated request, and site identity. The two IPC registrars keep their own handlers and delegate the rest to per-domain sub-registrars, so they remain real entry points rather than re-export shims. The IPC surface is proved intact rather than assumed: comparing (method, channel) multisets between HEAD and the split gives 52 registrations across 52 distinct channels on both sides. Provider-neutrality is preserved -- GitLab and GitHub keep separate, parallel module layouts rather than being merged behind a shared abstraction. Verified: oxlint clean, ratchet passes, typecheck clean, full unit suite green (the one remaining failure is a pre-existing load flake in an untouched file, green when re-run serially), no new runtime import cycles among 744 modules, and no lint suppression added anywhere.
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
import { ipcMain } from 'electron'
|
|
import { connect, disconnect, getStatus, selectWorkspace, testConnection } from '../linear/client'
|
|
import { _resetPreflightCache } from './preflight'
|
|
import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './linear-ipc-args'
|
|
import { registerLinearIssueHandlers } from './linear-issue-handlers'
|
|
import { registerLinearProjectHandlers } from './linear-project-handlers'
|
|
import { registerLinearCustomViewHandlers } from './linear-custom-view-handlers'
|
|
import { registerLinearTeamHandlers } from './linear-team-handlers'
|
|
|
|
export function registerLinearHandlers(): void {
|
|
ipcMain.handle('linear:connect', async (_event, args: { apiKey: string }) => {
|
|
if (typeof args?.apiKey !== 'string' || !args.apiKey.trim()) {
|
|
return { ok: false, error: 'Invalid API key' }
|
|
}
|
|
const result = await connect(args.apiKey.trim())
|
|
if (result.ok) {
|
|
_resetPreflightCache()
|
|
}
|
|
return result
|
|
})
|
|
|
|
ipcMain.handle('linear:disconnect', async (_event, args?: { workspaceId?: string }) => {
|
|
disconnect(normalizeWorkspaceId(args?.workspaceId))
|
|
_resetPreflightCache()
|
|
})
|
|
|
|
ipcMain.handle('linear:selectWorkspace', async (_event, args: { workspaceId: string }) => {
|
|
const workspaceId = normalizeWorkspaceSelection(args?.workspaceId)
|
|
if (!workspaceId) {
|
|
return getStatus()
|
|
}
|
|
return selectWorkspace(workspaceId)
|
|
})
|
|
|
|
ipcMain.handle('linear:status', async () => {
|
|
return getStatus()
|
|
})
|
|
|
|
ipcMain.handle('linear:testConnection', async (_event, args?: { workspaceId?: string }) => {
|
|
return testConnection(normalizeWorkspaceId(args?.workspaceId))
|
|
})
|
|
|
|
registerLinearIssueHandlers()
|
|
registerLinearProjectHandlers()
|
|
registerLinearCustomViewHandlers()
|
|
registerLinearTeamHandlers()
|
|
}
|