Files
orca/src/main/ipc/linear-ipc-args.ts
T
Neil 83117f2860 refactor(integrations): split issue-tracker clients under the max-lines budget (#14704)
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.
2026-08-15 18:17:20 -07:00

50 lines
1.7 KiB
TypeScript

import type { LinearCustomViewModel } from '../../shared/linear/project-types'
import type { LinearWorkspaceSelection } from '../../shared/linear/workspace-types'
export function normalizeWorkspaceId(value: unknown): string | undefined {
return typeof value === 'string' && value.trim() ? value.trim() : undefined
}
export function normalizeWorkspaceSelection(value: unknown): LinearWorkspaceSelection | undefined {
const workspaceId = normalizeWorkspaceId(value)
return workspaceId as LinearWorkspaceSelection | undefined
}
export function normalizeConcreteWorkspaceId(value: unknown): string {
const workspaceId = normalizeWorkspaceId(value)
if (!workspaceId || workspaceId === 'all') {
throw new Error('Concrete Linear workspace ID is required')
}
return workspaceId
}
export function normalizeCustomViewModel(value: unknown): LinearCustomViewModel {
if (value !== 'issue' && value !== 'project') {
throw new Error('Custom view model is required')
}
return value
}
export function normalizeIdList(value: unknown, fieldName: string): string[] | undefined {
if (value === undefined) {
return undefined
}
if (
!Array.isArray(value) ||
!value.every((id): id is string => typeof id === 'string' && Boolean(id.trim()))
) {
throw new Error(`Invalid ${fieldName}`)
}
return value.map((id) => id.trim())
}
export function normalizeOptionalDate(value: unknown, fieldName: string): string | undefined {
if (value === undefined || value === null || value === '') {
return undefined
}
if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(value.trim())) {
throw new Error(`Invalid ${fieldName}`)
}
return value.trim()
}