Skip to content

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.

TypeScript
815 B
Raw Blame
import type { Settings } from 'claude-code'

import { isPersonWritable } from './is-person-writable.js'
import { ownOption } from './own-option'

/**
 * Whether deny rules hold over the plugins a person installs: they do unless
 * an administrator's policy sets `allowModsToOverrideDenyRules` to `true`.
 *
 * Ask rules and classic hooks' answers hold or not with them. A value mistyped
 * (`"true"`, `1`) loosens nothing, and neither does the option in a policy the
 * person could have written (isPersonWritable).
 *
 * @param policy the managed settings, as `$.settings.read` answers them
 * @returns false only when the organization let a person's plugins override
 */
export const denyRulesHold = (policy: Settings) =>
  isPersonWritable(policy) ||
  ownOption(policy, 'allowModsToOverrideDenyRules') !== true