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 / ranking / is-looser.ts
20 lines · 699 BRaw
1import type { EventResult } from 'claude-code'
2
3import { LENIENCY } from './leniency'
4
5/**
6 * Whether a link's own verdict is more permissive than the one handed up to
7 * it; with nothing handed up (it never called `next`), than a deny.
8 *
9 * A link that settled on nothing (skipped, rejected) loosened nothing.
10 *
11 * @param own what the link settled on
12 * @param handed what settled beneath it and was handed up, if anything did
13 * @returns true when the link loosened the verdict
14 */
15export const isLooser = (
16 own: EventResult<'tool.check'> | undefined,
17 handed: EventResult<'tool.check'> | undefined,
18) =>
19 own !== undefined &&
20 LENIENCY[own.decision] > LENIENCY[handed?.decision ?? 'deny']