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 / ask-kind.ts
GitHub Actions (publish-mods)chore: Update mods/ bf2323b · 10 days ago History
26 lines · 802 BRaw
1import type { EventResult } from 'claude-code'
2
3/**
4 * Names who asked, where no rule decided a verdict that holds: the classic
5 * hook first, then the setting whose check asked, then the host it goes to.
6 *
7 * An ask that names none of the three holds by the ceiling an organization
8 * set on the tool.
9 *
10 * @param held the ask in question
11 * @returns `<event> hook's ask`, `<key> setting's ask`, `host's ask`, or
12 * `ask cap`
13 */
14export function askKind(held: EventResult<'tool.check'>) {
15 const isHooked = held.hook !== undefined
16 const isSet = held.setting !== undefined
17 const isHosted = held.decider !== undefined
18
19 return isHooked
20 ? `${held.hook} hook's ask`
21 : isSet
22 ? `${held.setting} setting's ask`
23 : isHosted
24 ? `${held.decider}'s ask`
25 : 'ask cap'
26}