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
| 1 | import type { EventResult } from 'claude-code' |
| 2 | |
| 3 | import { heldKind } from './held-kind.js' |
| 4 | |
| 5 | /** |
| 6 | * What a person reads, once for each plugin and kind in a session, when a |
| 7 | * plugin they installed rewrote a verdict that holds over it. |
| 8 | * |
| 9 | * It names the option an administrator sets to let such plugins override. |
| 10 | * |
| 11 | * @param plugin the plugin's name, or its batch's, as the trace names it |
| 12 | * @param tool the tool the call named |
| 13 | * @param held the verdict that holds, naming the rule behind it if one is |
| 14 | * @param attempt what the plugin did: answered looser, or the same reworded |
| 15 | * @returns the line |
| 16 | */ |
| 17 | export function heldNotice( |
| 18 | plugin: string, |
| 19 | tool: string, |
| 20 | held: EventResult<'tool.check'>, |
| 21 | attempt: 'lift' | 'reword', |
| 22 | ): string { |
| 23 | const kind = heldKind(held) |
| 24 | const article = kind.startsWith('a') ? 'an' : 'a' |
| 25 | const changed = |
| 26 | held.rule === undefined |
| 27 | ? `${article} ${kind} from a ${tool} call` |
| 28 | : `${article} ${kind} in your settings from a ${tool} call (${held.rule})` |
| 29 | |
| 30 | return ( |
| 31 | `${plugin} tried to ${attempt} ${changed}; the ${kind} holds over the ` + |
| 32 | 'plugins you install (allowModsToOverrideDenyRules)' |
| 33 | ) |
| 34 | } |