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 / is-managed-mods-only.ts
19 lines · 648 BRaw
1import type { Settings } from 'claude-code'
2
3import { ownOption } from './own-option'
4
5/**
6 * Whether managed policy limits mods to the organization's: this plugin's
7 * own option `allowManagedModsOnly` in managed settings.
8 *
9 * On unless absent or `false`: a value mistyped (`"true"`, `1`) still
10 * locks, as the CLI's own managed locks read.
11 *
12 * @param policy the managed settings, as `$.settings.read` answers them
13 * @returns true when the person's own mods are not to load
14 */
15export function isManagedModsOnly(policy: Settings) {
16 const value = ownOption(policy, 'allowManagedModsOnly')
17
18 return value !== undefined && value !== false
19}