( dir: string, targetPath: string, processedPaths: Set<string>, )
| 1413 | * @returns Array of MemoryFileInfo objects |
| 1414 | */ |
| 1415 | export async function getMemoryFilesForNestedDirectory( |
| 1416 | dir: string, |
| 1417 | targetPath: string, |
| 1418 | processedPaths: Set<string>, |
| 1419 | ): Promise<MemoryFileInfo[]> { |
| 1420 | const result: MemoryFileInfo[] = [] |
| 1421 | |
| 1422 | // Process project instruction files |
| 1423 | if (isSettingSourceEnabled('projectSettings')) { |
| 1424 | for (const projectInstructionFile of getProjectInstructionFilesLowToHigh(dir)) { |
| 1425 | result.push( |
| 1426 | ...(await processMemoryFile( |
| 1427 | projectInstructionFile, |
| 1428 | 'Project', |
| 1429 | processedPaths, |
| 1430 | false, |
| 1431 | )), |
| 1432 | ) |
| 1433 | } |
| 1434 | } |
| 1435 | |
| 1436 | // Process local memory file (CLAUDE.local.md) |
| 1437 | if (isSettingSourceEnabled('localSettings')) { |
| 1438 | const localPath = join(dir, 'CLAUDE.local.md') |
| 1439 | result.push( |
| 1440 | ...(await processMemoryFile(localPath, 'Local', processedPaths, false)), |
| 1441 | ) |
| 1442 | } |
| 1443 | |
| 1444 | const rulesDirs = getProjectInstructionRuleDirsLowToHigh(dir) |
| 1445 | |
| 1446 | // Process project unconditional instruction rule files, which were not eagerly loaded |
| 1447 | // Use a separate processedPaths set to avoid marking conditional rule files as processed |
| 1448 | const unconditionalProcessedPaths = new Set(processedPaths) |
| 1449 | for (const rulesDir of rulesDirs) { |
| 1450 | result.push( |
| 1451 | ...(await processMdRules({ |
| 1452 | rulesDir, |
| 1453 | type: 'Project', |
| 1454 | processedPaths: unconditionalProcessedPaths, |
| 1455 | includeExternal: false, |
| 1456 | conditionalRule: false, |
| 1457 | })), |
| 1458 | ) |
| 1459 | } |
| 1460 | |
| 1461 | // Process project conditional instruction rule files |
| 1462 | for (const rulesDir of rulesDirs) { |
| 1463 | result.push( |
| 1464 | ...(await processConditionedMdRules( |
| 1465 | targetPath, |
| 1466 | rulesDir, |
| 1467 | 'Project', |
| 1468 | processedPaths, |
| 1469 | false, |
| 1470 | )), |
| 1471 | ) |
| 1472 | } |
no test coverage detected