MCPcopy Create free account
hub / github.com/anomalyco/opencode / add

Function add

packages/cli/src/framework/runtime.ts:45–52  ·  view source on GitHub ↗
(node: Spec.Any, value: RuntimeHandlers)

Source from the content-addressed store, hash-verified

43 const result: LazyHandler[] = []
44
45 function add(node: Spec.Any, value: RuntimeHandlers) {
46 if (typeof value === "function") {
47 result.push({ spec: node.spec, load: value as () => Promise<{ default: RuntimeHandler }> })
48 return
49 }
50 if (value.$) result.push({ spec: node.spec, load: value.$ as () => Promise<{ default: RuntimeHandler }> })
51 for (const [name, child] of Object.entries(node.commands)) add(child, value[name] as RuntimeHandlers)
52 }
53
54 add(root, handlers as RuntimeHandlers)
55 return result

Callers 1

handlersFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected