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 / registering.ts
25 lines · 600 BRaw
1import type { Plugin } from 'claude-code/testing'
2
3/**
4 * A plugin that registers a tool when the session starts, in the tier
5 * given: the person's own by default.
6 *
7 * @param name the plugin's name
8 * @param tier the tier it loads in
9 * @returns the plugin
10 */
11export const registering = (name: string, tier?: Plugin['tier']): Plugin => ({
12 name,
13 tier,
14 register(on) {
15 on('session.start', async ($, e, next) => {
16 await $.tool.register({
17 name: 'greet',
18 description: 'Says hello.',
19 inputSchema: { type: 'object' },
20 })
21
22 return next(e)
23 })
24 },
25})