()
| 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") |
no test coverage detected