MCPcopy Create free account
hub / github.com/Noumena-Network/code / getCommandReasons

Function getCommandReasons

src/commands/env/index.js:184–328  ·  view source on GitHub ↗
(
  name,
  cmd,
  {
    availableHere,
    enabled,
    hidden,
    hiddenDescriptor,
  },
  modules,
)

Source from the content-addressed store, hash-verified

182}
183
184async function getCommandReasons(
185 name,
186 cmd,
187 {
188 availableHere,
189 enabled,
190 hidden,
191 hiddenDescriptor,
192 },
193 modules,
194) {
195 const reasons = new Set()
196
197 if (!availableHere && cmd.availability?.length) {
198 reasons.add(`availability requirement not met: ${cmd.availability.join(', ')}`)
199 }
200
201 if (!enabled) {
202 reasons.add('isEnabled() returned false')
203 }
204
205 if (hidden) {
206 if (hiddenDescriptor?.get) {
207 reasons.add('hidden by command-specific runtime gate')
208 } else if (hiddenDescriptor?.value === true) {
209 reasons.add('command sets isHidden=true')
210 }
211 }
212
213 switch (name) {
214 case 'agents-platform':
215 if (!feature('AGENT_TRIGGERS_REMOTE')) {
216 reasons.add('build feature AGENT_TRIGGERS_REMOTE is off')
217 }
218 if (!getFeatureValue_CACHED_MAY_BE_STALE('ncode_surreal_dali', false)) {
219 reasons.add('GrowthBook gate ncode_surreal_dali is off')
220 }
221 if (!isPolicyAllowed('allow_remote_sessions')) {
222 reasons.add('policy allow_remote_sessions is off')
223 }
224 break
225
226 case 'remote-control': {
227 const reason = await modules.bridgeModule.getBridgeDisabledReason()
228 if (reason) reasons.add(reason)
229 break
230 }
231
232 case 'voice':
233 if (!modules.voiceModule.hasVoiceAuth()) {
234 reasons.add('requires a Noumena OAuth token for voice mode')
235 }
236 if (!modules.voiceModule.isVoiceGrowthBookEnabled()) {
237 reasons.add('voice GrowthBook kill-switch disables the command')
238 }
239 break
240
241 case 'web-setup':

Callers 1

Calls 7

isSupportedPlatformMethod · 0.80
isPolicyAllowedFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected