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-pinned-variable.ts
14 lines · 551 BRaw
1import type { Settings } from 'claude-code'
2
3/**
4 * Whether managed policy pins an environment variable: its `env` sets the
5 * name, in any case (some systems read `Path` and `PATH` as one variable).
6 *
7 * @param policy the managed settings, as `$.settings.read` answers them
8 * @param name the variable a plugin would set or unset
9 * @returns true when the organization set it
10 */
11export const isPinnedVariable = (policy: Settings, name: string) =>
12 Object.keys(policy.env ?? {}).some(
13 pinned => pinned.toUpperCase() === name.toUpperCase(),
14 )