spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / sec-default / tests / fixtures / tools-registered.ts
24 lines · 615 BRaw
1import type { On } from 'claude-code'
2
3import { registeredToolOf } from './registered-tool-of.js'
4
5/**
6 * A session starting, where each tool a plugin asks for is registered and
7 * kept by the name of the plugin that asked.
8 *
9 * @param on the test's `on`
10 * @returns the plugins whose tools were registered, in order
11 */
12export function toolsRegistered(on: On) {
13 const registered: string[] = []
14
15 on('session.start', ($, e) => ({ cwd: e.cwd }))
16
17 on('tool.register', ($, e, next) => {
18 registered.push(next.origin.plugin)
19
20 return registeredToolOf(next.origin.plugin, e.name)
21 })
22
23 return registered
24}