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 / holds-over.ts
22 lines · 832 BRaw
1import type { EventResult } from 'claude-code'
2
3import Ranking from './ranking'
4
5/**
6 * Whether the verdict reached past the user tier holds over the chain's
7 * answer: it is the stricter, and a deny, or an ask a settings rule decided.
8 *
9 * Any rule counts, whoever configured it: a verdict names the rule, never its
10 * source. A deny holds unnamed: it may stand before a rule's ask. The mode's
11 * own ask does not hold, nor a settings hook's.
12 *
13 * @param held what the run past the user tier settled on
14 * @param answer what the whole chain settled on
15 * @returns true when the plugins a person installs may not have loosened it
16 */
17export const holdsOver = (
18 held: EventResult<'tool.check'>,
19 answer: EventResult<'tool.check'>,
20) =>
21 Ranking.isLooser(answer, held) &&
22 (held.decision === 'deny' || held.rule !== undefined)