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 / hooks / held-verdict / held-kind.ts
GitHub Actions (publish-mods)chore: Update mods/ 5a2676e · 2 days ago History
24 lines · 688 BRaw
1import type { EventResult } from 'claude-code'
2
3import { askKind } from './ask-kind.js'
4
5/**
6 * What kind of thing held over a person's plugin, as the notice calls it:
7 * `deny rule`, `ask rule`, `refusal`, or whose ask it was.
8 *
9 * A deny that names no rule is a refusal even when it names a hook: the hook
10 * may only have asked, and something else refused.
11 *
12 * @param held the verdict that holds
13 * @returns the kind
14 */
15export function heldKind(held: EventResult<'tool.check'>): string {
16 const isRuled = held.rule !== undefined
17 const isRefused = held.decision === 'deny'
18
19 return isRuled
20 ? `${held.decision} rule`
21 : isRefused
22 ? 'refusal'
23 : askKind(held)
24}