MCPcopy Create free account
hub / github.com/arctic-cli/interface / trigger

Function trigger

packages/arctic/src/plugin/index.ts:66–81  ·  view source on GitHub ↗
(name: Name, input: Input, output: Output)

Source from the content-addressed store, hash-verified

64 })
65
66 export async function trigger<
67 Name extends Exclude<keyof Required<Hooks>, "auth" | "event" | "tool">,
68 Input = Parameters<Required<Hooks>[Name]>[0],
69 Output = Parameters<Required<Hooks>[Name]>[1],
70 >(name: Name, input: Input, output: Output): Promise<Output> {
71 if (!name) return output
72 for (const hook of await state().then((x) => x.hooks)) {
73 const fn = hook[name]
74 if (!fn) continue
75 // @ts-expect-error if you feel adventurous, please fix the typing, make sure to bump the try-counter if you
76 // give up.
77 // try-counter: 2
78 await fn(input, output)
79 }
80 return output
81 }
82
83 export async function list() {
84 return state().then((x) => x.hooks)

Callers

nothing calls this directly

Calls 2

stateFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected