refactor: wave 1 - extract leaf modules, rename catch-all files, split index.ts hooks
- Split 25+ index.ts files into hook.ts + extracted modules - Rename all catch-all utils.ts/helpers.ts to domain-specific names - Split src/tools/lsp/ into ~15 focused modules - Split src/tools/delegate-task/ into ~18 focused modules - Separate shared types from implementation - 155 files changed, 60+ new files created - All typecheck clean, 61 tests pass
This commit is contained in:
+11
-6
@@ -16,6 +16,11 @@ export * from "./claude-config-dir"
|
||||
export * from "./jsonc-parser"
|
||||
export * from "./migration"
|
||||
export * from "./opencode-config-dir"
|
||||
export type {
|
||||
OpenCodeBinaryType,
|
||||
OpenCodeConfigDirOptions,
|
||||
OpenCodeConfigPaths,
|
||||
} from "./opencode-config-dir-types"
|
||||
export * from "./opencode-version"
|
||||
export * from "./permission-compat"
|
||||
export * from "./external-plugin-detector"
|
||||
@@ -28,12 +33,12 @@ export * from "./system-directive"
|
||||
export * from "./agent-tool-restrictions"
|
||||
export * from "./model-requirements"
|
||||
export * from "./model-resolver"
|
||||
export {
|
||||
resolveModelPipeline,
|
||||
type ModelResolutionRequest,
|
||||
type ModelResolutionResult as ModelResolutionPipelineResult,
|
||||
type ModelResolutionProvenance,
|
||||
} from "./model-resolution-pipeline"
|
||||
export { resolveModelPipeline } from "./model-resolution-pipeline"
|
||||
export type {
|
||||
ModelResolutionRequest,
|
||||
ModelResolutionProvenance,
|
||||
ModelResolutionResult as ModelResolutionPipelineResult,
|
||||
} from "./model-resolution-types"
|
||||
export * from "./model-availability"
|
||||
export * from "./connected-providers-cache"
|
||||
export * from "./session-utils"
|
||||
|
||||
@@ -1,36 +1,16 @@
|
||||
import { log } from "./logger"
|
||||
import { readConnectedProvidersCache } from "./connected-providers-cache"
|
||||
import { fuzzyMatchModel } from "./model-availability"
|
||||
import type { FallbackEntry } from "./model-requirements"
|
||||
import type {
|
||||
ModelResolutionRequest,
|
||||
ModelResolutionResult,
|
||||
} from "./model-resolution-types"
|
||||
|
||||
export type ModelResolutionRequest = {
|
||||
intent?: {
|
||||
uiSelectedModel?: string
|
||||
userModel?: string
|
||||
categoryDefaultModel?: string
|
||||
}
|
||||
constraints: {
|
||||
availableModels: Set<string>
|
||||
}
|
||||
policy?: {
|
||||
fallbackChain?: FallbackEntry[]
|
||||
systemDefaultModel?: string
|
||||
}
|
||||
}
|
||||
|
||||
export type ModelResolutionProvenance =
|
||||
| "override"
|
||||
| "category-default"
|
||||
| "provider-fallback"
|
||||
| "system-default"
|
||||
|
||||
export type ModelResolutionResult = {
|
||||
model: string
|
||||
provenance: ModelResolutionProvenance
|
||||
variant?: string
|
||||
attempted?: string[]
|
||||
reason?: string
|
||||
}
|
||||
export type {
|
||||
ModelResolutionProvenance,
|
||||
ModelResolutionRequest,
|
||||
ModelResolutionResult,
|
||||
} from "./model-resolution-types"
|
||||
|
||||
function normalizeModel(model?: string): string | undefined {
|
||||
const trimmed = model?.trim()
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { FallbackEntry } from "./model-requirements"
|
||||
|
||||
export type ModelResolutionRequest = {
|
||||
intent?: {
|
||||
uiSelectedModel?: string
|
||||
userModel?: string
|
||||
categoryDefaultModel?: string
|
||||
}
|
||||
constraints: {
|
||||
availableModels: Set<string>
|
||||
}
|
||||
policy?: {
|
||||
fallbackChain?: FallbackEntry[]
|
||||
systemDefaultModel?: string
|
||||
}
|
||||
}
|
||||
|
||||
export type ModelResolutionProvenance =
|
||||
| "override"
|
||||
| "category-default"
|
||||
| "provider-fallback"
|
||||
| "system-default"
|
||||
|
||||
export type ModelResolutionResult = {
|
||||
model: string
|
||||
provenance: ModelResolutionProvenance
|
||||
variant?: string
|
||||
attempted?: string[]
|
||||
reason?: string
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
export type OpenCodeBinaryType = "opencode" | "opencode-desktop"
|
||||
|
||||
export type OpenCodeConfigDirOptions = {
|
||||
binary: OpenCodeBinaryType
|
||||
version?: string | null
|
||||
checkExisting?: boolean
|
||||
}
|
||||
|
||||
export type OpenCodeConfigPaths = {
|
||||
configDir: string
|
||||
configJson: string
|
||||
configJsonc: string
|
||||
packageJson: string
|
||||
omoConfig: string
|
||||
}
|
||||
@@ -2,21 +2,17 @@ import { existsSync } from "node:fs"
|
||||
import { homedir } from "node:os"
|
||||
import { join, resolve } from "node:path"
|
||||
|
||||
export type OpenCodeBinaryType = "opencode" | "opencode-desktop"
|
||||
import type {
|
||||
OpenCodeBinaryType,
|
||||
OpenCodeConfigDirOptions,
|
||||
OpenCodeConfigPaths,
|
||||
} from "./opencode-config-dir-types"
|
||||
|
||||
export interface OpenCodeConfigDirOptions {
|
||||
binary: OpenCodeBinaryType
|
||||
version?: string | null
|
||||
checkExisting?: boolean
|
||||
}
|
||||
|
||||
export interface OpenCodeConfigPaths {
|
||||
configDir: string
|
||||
configJson: string
|
||||
configJsonc: string
|
||||
packageJson: string
|
||||
omoConfig: string
|
||||
}
|
||||
export type {
|
||||
OpenCodeBinaryType,
|
||||
OpenCodeConfigDirOptions,
|
||||
OpenCodeConfigPaths,
|
||||
} from "./opencode-config-dir-types"
|
||||
|
||||
export const TAURI_APP_IDENTIFIER = "ai.opencode.desktop"
|
||||
export const TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { spawn } from "bun"
|
||||
import type { TmuxConfig, TmuxLayout } from "../../config/schema"
|
||||
import type { SpawnPaneResult } from "./types"
|
||||
import { getTmuxPath } from "../../tools/interactive-bash/utils"
|
||||
import { getTmuxPath } from "../../tools/interactive-bash/tmux-path-resolver"
|
||||
|
||||
let serverAvailable: boolean | null = null
|
||||
let serverCheckUrl: string | null = null
|
||||
|
||||
Reference in New Issue
Block a user