mirror of
https://github.com/stablyai/orca.git
synced 2026-09-25 08:02:31 +00:00
The four agent hook services, the main hooks module, and the two relay modules each carried a file-level `eslint-disable max-lines` and ran 365-628 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 seven suppressions and prunes their entries (341 -> 334). Pure move, no behavior change. Each hook service splits into its managed script source, its config/bundle serialization, and its remote-install path, keeping the per-agent integrations independent: copilot, amp, antigravity and hermes each retain their own getManagedScript rather than sharing one, because each emits a different script body for a different agent. Merging them by name would have been a behavior change, not a refactor. For antigravity the suppression's stated rationale -- that local install, Windows wrapper generation, status cleanup, and SSH remote install must share one event list and managed-command matcher so stale-hook cleanup cannot drift by platform -- is now enforced structurally instead: both install paths call buildInstalledConfig + createAntigravityManagedCommandMatcher over the single ANTIGRAVITY_EVENTS catalog, with the graph a strict DAG. Also registers the six new antigravity/ and copilot/ modules in config/tsconfig.cli.json. That project uses a curated `include` list rather than a glob, so an unlisted module fails `tsc -p config/tsconfig.tc.cli.json` with TS6307 even though the entire unit suite passes. Verified: oxlint clean, ratchet passes, typecheck clean, full unit suite green (remaining failures are pre-existing load flakes in untouched files, green when re-run serially), no new runtime import cycles, and no lint suppression added.
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { parseWslPath, toLinuxPath } from './wsl'
|
|
import type { ProjectExecutionRuntimeResolution } from '../shared/project-execution-runtime'
|
|
|
|
export type HookRuntimeTarget = {
|
|
wslDistro?: string | null
|
|
}
|
|
|
|
export function getHookRuntimeTarget(
|
|
projectRuntime?: ProjectExecutionRuntimeResolution | HookRuntimeTarget
|
|
): HookRuntimeTarget | undefined {
|
|
if (!projectRuntime) {
|
|
return undefined
|
|
}
|
|
|
|
if ('status' in projectRuntime) {
|
|
if (projectRuntime.status === 'repair-required') {
|
|
return projectRuntime.repair.preferredRuntime.kind === 'wsl'
|
|
? { wslDistro: projectRuntime.repair.preferredRuntime.distro }
|
|
: undefined
|
|
}
|
|
return projectRuntime.runtime.kind === 'wsl'
|
|
? { wslDistro: projectRuntime.runtime.distro }
|
|
: undefined
|
|
}
|
|
|
|
return projectRuntime.wslDistro ? { wslDistro: projectRuntime.wslDistro } : undefined
|
|
}
|
|
|
|
export function getHookWslContext(
|
|
cwd: string,
|
|
runtimeTarget?: HookRuntimeTarget
|
|
): { distro: string | null; linuxPath: string } | null {
|
|
const pathInfo = parseWslPath(cwd)
|
|
if (pathInfo) {
|
|
return pathInfo
|
|
}
|
|
|
|
const wslDistro = runtimeTarget?.wslDistro?.trim()
|
|
if (!wslDistro) {
|
|
return null
|
|
}
|
|
|
|
// Why: project runtime can route a Windows checkout through WSL, so hooks need the Linux view of the path.
|
|
return {
|
|
distro: wslDistro,
|
|
linuxPath: toLinuxPath(cwd)
|
|
}
|
|
}
|