MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getModeSelection

Function getModeSelection

src/shared/modes.ts:111–132  ·  view source on GitHub ↗
(mode: string, promptComponent?: PromptComponent, customModes?: ModeConfig[])

Source from the content-addressed store, hash-verified

109 * If neither is found, the default mode is used.
110 */
111export function getModeSelection(mode: string, promptComponent?: PromptComponent, customModes?: ModeConfig[]) {
112 const customMode = findModeBySlug(mode, customModes)
113 const builtInMode = findModeBySlug(mode, modes)
114
115 // If we have a custom mode, use it entirely
116 if (customMode) {
117 return {
118 roleDefinition: customMode.roleDefinition || "",
119 baseInstructions: customMode.customInstructions || "",
120 description: customMode.description || "",
121 }
122 }
123
124 // Otherwise, use built-in mode as base and merge with promptComponent
125 const baseMode = builtInMode || modes[0] // fallback to default mode
126
127 return {
128 roleDefinition: promptComponent?.roleDefinition || baseMode.roleDefinition || "",
129 baseInstructions: promptComponent?.customInstructions || baseMode.customInstructions || "",
130 description: baseMode.description || "",
131 }
132}
133
134// Custom error class for file restrictions
135export class FileRestrictionError extends Error {

Callers 3

generatePromptFunction · 0.90
modes.spec.tsFile · 0.90

Calls 1

findModeBySlugFunction · 0.85

Tested by

no test coverage detected