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 / own-option / own-option.ts
17 lines · 674 BRaw
1import type { Settings } from 'claude-code'
2
3import { memberOf } from './member-of'
4import { OWN_OPTIONS_PATH } from './own-options-path'
5
6/**
7 * One option an administrator set for this plugin in managed settings: its
8 * value under the plugin's own `pluginConfigs` entry, as written.
9 *
10 * Hand it the policy source alone, so a person's settings never reach it.
11 *
12 * @param policy the managed settings, as `$.settings.read` answers them
13 * @param name the option's name
14 * @returns the value, or undefined when the option is not set
15 */
16export const ownOption = (policy: Settings, name: string): unknown =>
17 [...OWN_OPTIONS_PATH, name].reduce<unknown>(memberOf, policy)