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

Function getCurrentMode

src/core/webview/webviewMessageHandler.ts:128–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126 }
127
128 const getCurrentMode = async (): Promise<string> => {
129 const currentTask = provider.getCurrentTask()
130
131 if (currentTask) {
132 try {
133 return await currentTask.getTaskMode()
134 } catch (error) {
135 provider.log(
136 `Error resolving current task mode for command discovery: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
137 )
138 }
139 }
140
141 try {
142 const state = await provider.getState()
143 if (typeof state.mode === "string" && state.mode.length > 0) {
144 return state.mode
145 }
146 } catch (error) {
147 provider.log(
148 `Error resolving global mode for command discovery: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
149 )
150 }
151
152 return defaultModeSlug
153 }
154
155 const getDiscoveredCommands = async (): Promise<SlashCommand[]> => {
156 const { getCommands } = await import("../../services/command/commands")

Callers 2

getDiscoveredCommandsFunction · 0.85
ModesViewFunction · 0.85

Calls 4

getTaskModeMethod · 0.80
getCurrentTaskMethod · 0.65
logMethod · 0.65
getStateMethod · 0.65

Tested by

no test coverage detected