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 / policy / deny-rules-hold.ts
GitHub Actions (publish-mods)chore: Update mods/ 3deb873 · 15 days ago History
19 lines · 815 BRaw
1import type { Settings } from 'claude-code'
2
3import { isPersonWritable } from './is-person-writable.js'
4import { ownOption } from './own-option'
5
6/**
7 * Whether deny rules hold over the plugins a person installs: they do unless
8 * an administrator's policy sets `allowModsToOverrideDenyRules` to `true`.
9 *
10 * Ask rules and classic hooks' answers hold or not with them. A value mistyped
11 * (`"true"`, `1`) loosens nothing, and neither does the option in a policy the
12 * person could have written (isPersonWritable).
13 *
14 * @param policy the managed settings, as `$.settings.read` answers them
15 * @returns false only when the organization let a person's plugins override
16 */
17export const denyRulesHold = (policy: Settings) =>
18 isPersonWritable(policy) ||
19 ownOption(policy, 'allowModsToOverrideDenyRules') !== true