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 / verdicts / is-rule-deny.ts
18 lines · 642 BRaw
1import type { EventResult } from 'claude-code'
2
3import type { RuleDeny } from './types'
4
5/**
6 * Whether a `tool.check` verdict is a deny that a settings rule decided: the
7 * one verdict the plugins a person installs may not loosen.
8 *
9 * Any deny rule counts, whatever settings file it came from: a verdict
10 * carries the rule as written and never where it was read from.
11 *
12 * @param verdict what a run of the chain settled on
13 * @returns true for a deny that names the rule behind it
14 */
15export const isRuleDeny = (
16 verdict: EventResult<'tool.check'>,
17): verdict is RuleDeny =>
18 verdict.decision === 'deny' && verdict.rule !== undefined