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 / pinned-names.ts
GitHub Actions (publish-mods)chore: Update mods/ bf2323b · 10 days ago History
26 lines · 969 BRaw
1import type { Settings } from 'claude-code'
2
3import { CODE_LOADING_VARIABLES } from './code-loading-variables.js'
4import { POLICY_SOURCE_VARIABLES } from './policy-source-variables.js'
5import { PROCESS_WRAPPER_VARIABLE } from './process-wrapper-variable.js'
6
7/**
8 * The environment variables managed policy sets: every name of its `env`,
9 * and the launcher's variable where it names one with `processWrapper`.
10 *
11 * Always among them: the variables that say where policy is read from,
12 * and the ones that can load code into a child the engine starts.
13 *
14 * @param policy the managed settings, as `$.settings.read` answers them
15 * @returns the names, as the policy spells them
16 */
17export function pinnedNames(policy: Settings): string[] {
18 const isWrapped = policy.processWrapper !== undefined
19
20 return [
21 ...Object.keys(policy.env ?? {}),
22 ...(isWrapped ? [PROCESS_WRAPPER_VARIABLE] : []),
23 ...POLICY_SOURCE_VARIABLES,
24 ...CODE_LOADING_VARIABLES,
25 ]
26}