MCPcopy
hub / github.com/claude-code-best/claude-code / getManagedAndUserConditionalRules

Function getManagedAndUserConditionalRules

src/utils/claudemd.ts:1204–1237  ·  view source on GitHub ↗
(
  targetPath: string,
  processedPaths: Set<string>,
)

Source from the content-addressed store, hash-verified

1202 * @returns Array of MemoryFileInfo objects for matching conditional rules
1203 */
1204export async function getManagedAndUserConditionalRules(
1205 targetPath: string,
1206 processedPaths: Set<string>,
1207): Promise<MemoryFileInfo[]> {
1208 const result: MemoryFileInfo[] = []
1209
1210 // Process Managed conditional .claude/rules/*.md files
1211 const managedClaudeRulesDir = getManagedClaudeRulesDir()
1212 result.push(
1213 ...(await processConditionedMdRules(
1214 targetPath,
1215 managedClaudeRulesDir,
1216 'Managed',
1217 processedPaths,
1218 false,
1219 )),
1220 )
1221
1222 if (isSettingSourceEnabled('userSettings')) {
1223 // Process User conditional .claude/rules/*.md files
1224 const userClaudeRulesDir = getUserClaudeRulesDir()
1225 result.push(
1226 ...(await processConditionedMdRules(
1227 targetPath,
1228 userClaudeRulesDir,
1229 'User',
1230 processedPaths,
1231 true,
1232 )),
1233 )
1234 }
1235
1236 return result
1237}
1238
1239/**
1240 * Gets memory files for a single nested directory (between CWD and target).

Callers 1

Calls 5

getManagedClaudeRulesDirFunction · 0.85
isSettingSourceEnabledFunction · 0.85
getUserClaudeRulesDirFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected