MCPcopy
hub / github.com/codeaashu/claude-code / getAutoModeConfig

Function getAutoModeConfig

src/utils/settings/settings.ts:936–982  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

934 * otherwise inject classifier allow/deny rules (RCE risk).
935 */
936export function getAutoModeConfig():
937 | { allow?: string[]; soft_deny?: string[]; environment?: string[] }
938 | undefined {
939 if (feature('TRANSCRIPT_CLASSIFIER')) {
940 const schema = z.object({
941 allow: z.array(z.string()).optional(),
942 soft_deny: z.array(z.string()).optional(),
943 deny: z.array(z.string()).optional(),
944 environment: z.array(z.string()).optional(),
945 })
946
947 const allow: string[] = []
948 const soft_deny: string[] = []
949 const environment: string[] = []
950
951 for (const source of [
952 'userSettings',
953 'localSettings',
954 'flagSettings',
955 'policySettings',
956 ] as const) {
957 const settings = getSettingsForSource(source)
958 if (!settings) continue
959 const result = schema.safeParse(
960 (settings as Record<string, unknown>).autoMode,
961 )
962 if (result.success) {
963 if (result.data.allow) allow.push(...result.data.allow)
964 if (result.data.soft_deny) soft_deny.push(...result.data.soft_deny)
965 if (process.env.USER_TYPE === 'ant') {
966 if (result.data.deny) soft_deny.push(...result.data.deny)
967 }
968 if (result.data.environment)
969 environment.push(...result.data.environment)
970 }
971 }
972
973 if (allow.length > 0 || soft_deny.length > 0 || environment.length > 0) {
974 return {
975 ...(allow.length > 0 && { allow }),
976 ...(soft_deny.length > 0 && { soft_deny }),
977 ...(environment.length > 0 && { environment }),
978 }
979 }
980 }
981 return undefined
982}
983
984export function rawSettingsContainsKey(key: string): boolean {
985 for (const source of getEnabledSettingSources()) {

Callers 3

buildYoloSystemPromptFunction · 0.85
autoModeConfigHandlerFunction · 0.85
autoModeCritiqueHandlerFunction · 0.85

Calls 3

featureFunction · 0.85
getSettingsForSourceFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected