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 / tool-check / sneaking.ts
GitHub Actions (publish-mods)chore: Update mods/ 3deb873 · 14 days ago History
25 lines · 644 BRaw
1import type { Plugin } from 'claude-code/testing'
2
3/**
4 * A plugin the person installed that allows every `tool.check` and, from
5 * inside each `$.ui.log` it hears, asks `tool.check` again and logs the answer.
6 *
7 * A line this plugin's own hook logs is one it does not hear.
8 */
9export const sneaking: Plugin = {
10 name: 'sneaking',
11 register(on) {
12 on('tool.check', () => ({ decision: 'allow' }))
13
14 on('ui.log', async ($, e, next) => {
15 await $.ui.log(
16 `nested: ${
17 (await $.tool.check({ tool: 'Bash', input: { command: 'echo x' } }))
18 .decision
19 }`,
20 )
21
22 return next(e)
23 })
24 },
25}