( dir: string, targetPath: string, processedPaths: Set<string>, )
| 1246 | * @returns Array of MemoryFileInfo objects |
| 1247 | */ |
| 1248 | export async function getMemoryFilesForNestedDirectory( |
| 1249 | dir: string, |
| 1250 | targetPath: string, |
| 1251 | processedPaths: Set<string>, |
| 1252 | ): Promise<MemoryFileInfo[]> { |
| 1253 | const result: MemoryFileInfo[] = [] |
| 1254 | |
| 1255 | // Process project memory files (CLAUDE.md and .claude/CLAUDE.md) |
| 1256 | if (isSettingSourceEnabled('projectSettings')) { |
| 1257 | const projectPath = join(dir, 'CLAUDE.md') |
| 1258 | result.push( |
| 1259 | ...(await processMemoryFile( |
| 1260 | projectPath, |
| 1261 | 'Project', |
| 1262 | processedPaths, |
| 1263 | false, |
| 1264 | )), |
| 1265 | ) |
| 1266 | const dotClaudePath = join(dir, '.claude', 'CLAUDE.md') |
| 1267 | result.push( |
| 1268 | ...(await processMemoryFile( |
| 1269 | dotClaudePath, |
| 1270 | 'Project', |
| 1271 | processedPaths, |
| 1272 | false, |
| 1273 | )), |
| 1274 | ) |
| 1275 | } |
| 1276 | |
| 1277 | // Process local memory file (CLAUDE.local.md) |
| 1278 | if (isSettingSourceEnabled('localSettings')) { |
| 1279 | const localPath = join(dir, 'CLAUDE.local.md') |
| 1280 | result.push( |
| 1281 | ...(await processMemoryFile(localPath, 'Local', processedPaths, false)), |
| 1282 | ) |
| 1283 | } |
| 1284 | |
| 1285 | const rulesDir = join(dir, '.claude', 'rules') |
| 1286 | |
| 1287 | // Process project unconditional .claude/rules/*.md files, which were not eagerly loaded |
| 1288 | // Use a separate processedPaths set to avoid marking conditional rule files as processed |
| 1289 | const unconditionalProcessedPaths = new Set(processedPaths) |
| 1290 | result.push( |
| 1291 | ...(await processMdRules({ |
| 1292 | rulesDir, |
| 1293 | type: 'Project', |
| 1294 | processedPaths: unconditionalProcessedPaths, |
| 1295 | includeExternal: false, |
| 1296 | conditionalRule: false, |
| 1297 | })), |
| 1298 | ) |
| 1299 | |
| 1300 | // Process project conditional .claude/rules/*.md files |
| 1301 | result.push( |
| 1302 | ...(await processConditionedMdRules( |
| 1303 | targetPath, |
| 1304 | rulesDir, |
| 1305 | 'Project', |
no test coverage detected