refactor: add domain-grouped re-exports for preferences module (#996)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
TÂCHES 2026-03-17 17:05:54 -06:00 committed by GitHub
parent 4cb5f8dbca
commit 8877e01083
4 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,10 @@
/**
* Focused re-export: hook-related preferences.
*
* Consumers that only need hook resolution can import from this module
* instead of the monolithic preferences.ts, reducing coupling surface.
*/
export {
resolvePostUnitHooks,
resolvePreDispatchHooks,
} from "./preferences.js";

View file

@ -0,0 +1,22 @@
/**
* Focused re-export: model-related preferences.
*
* Consumers that only need model resolution can import from this module
* instead of the monolithic preferences.ts, reducing coupling surface.
*/
export {
// Types
type GSDPhaseModelConfig,
type GSDModelConfig,
type GSDModelConfigV2,
type ResolvedModelConfig,
// Functions
resolveModelForUnit,
resolveModelWithFallbacksForUnit,
resolveDynamicRoutingConfig,
getNextFallbackModel,
isTransientNetworkError,
validateModelId,
updatePreferencesModels,
} from "./preferences.js";

View file

@ -0,0 +1,18 @@
/**
* Focused re-export: skill-related preferences.
*
* Consumers that only need skill resolution can import from this module
* instead of the monolithic preferences.ts, reducing coupling surface.
*/
export {
// Types
type GSDSkillRule,
type SkillDiscoveryMode,
type SkillResolution,
type SkillResolutionReport,
// Functions
resolveAllSkillReferences,
resolveSkillDiscoveryMode,
resolveSkillStalenessDays,
} from "./preferences.js";

View file

@ -261,6 +261,7 @@ export function loadEffectiveGSDPreferences(): LoadedGSDPreferences | null {
}
// ─── Skill Reference Resolution ───────────────────────────────────────────────
// Focused re-exports available via ./preferences-skills.js
export interface SkillResolution {
/** The original reference from preferences (bare name or path). */
@ -547,6 +548,9 @@ export function getIsolationMode(): "none" | "worktree" | "branch" {
return "worktree"; // default
}
// ─── Model Resolution ─────────────────────────────────────────────────────────
// Focused re-exports available via ./preferences-models.js
/**
* Resolve which model ID to use for a given auto-mode unit type.
* Returns undefined if no model preference is set for this unit type.
@ -1389,6 +1393,9 @@ function mergePostUnitHooks(
return merged.length > 0 ? merged : undefined;
}
// ─── Hook Resolution ──────────────────────────────────────────────────────────
// Focused re-exports available via ./preferences-hooks.js
/**
* Resolve enabled post-unit hooks from effective preferences.
* Returns an empty array when no hooks are configured.