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

Function call

src/commands/workflows/workflows.ts:94–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94export const call: LocalCommandCall = async args => {
95 const definitions = await getWorkflowDefinitions(getCwd())
96 const workflows = definitions.filter(
97 (
98 definition,
99 ): definition is WorkflowDefinition & { command: WorkflowPromptCommand } =>
100 definition.command.type === 'prompt',
101 )
102
103 if (workflows.length === 0) {
104 return { type: 'text', value: formatNoWorkflowsMessage() }
105 }
106
107 const query = normalizeWorkflowQuery(args)
108 if (!query) {
109 return { type: 'text', value: formatWorkflowList(workflows) }
110 }
111
112 const match = workflows.find(
113 ({ command }) =>
114 command.name === query || getCommandName(command) === query,
115 )
116
117 if (!match) {
118 return {
119 type: 'text',
120 value: [
121 `Workflow not found: ${query}`,
122 '',
123 formatWorkflowList(workflows),
124 ].join('\n'),
125 }
126 }
127
128 return { type: 'text', value: formatWorkflowDetail(match) }
129}

Callers

nothing calls this directly

Calls 7

getWorkflowDefinitionsFunction · 0.85
getCwdFunction · 0.85
formatNoWorkflowsMessageFunction · 0.85
normalizeWorkflowQueryFunction · 0.85
formatWorkflowListFunction · 0.85
formatWorkflowDetailFunction · 0.85
getCommandNameFunction · 0.50

Tested by

no test coverage detected