* Processes paths that need nested memory attachments and checks for nested * NCODE.md / legacy CLAUDE.md files * Uses nestedMemoryAttachmentTriggers field from ToolUseContext
( toolUseContext: ToolUseContext, )
| 2172 | * Uses nestedMemoryAttachmentTriggers field from ToolUseContext |
| 2173 | */ |
| 2174 | async function getNestedMemoryAttachments( |
| 2175 | toolUseContext: ToolUseContext, |
| 2176 | ): Promise<Attachment[]> { |
| 2177 | // Check triggers first — getAppState() waits for a React render cycle, |
| 2178 | // and the common case is an empty trigger set. |
| 2179 | if ( |
| 2180 | !toolUseContext.nestedMemoryAttachmentTriggers || |
| 2181 | toolUseContext.nestedMemoryAttachmentTriggers.size === 0 |
| 2182 | ) { |
| 2183 | return [] |
| 2184 | } |
| 2185 | |
| 2186 | const appState = toolUseContext.getAppState() |
| 2187 | const attachments: Attachment[] = [] |
| 2188 | |
| 2189 | for (const filePath of toolUseContext.nestedMemoryAttachmentTriggers) { |
| 2190 | const nestedAttachments = await getNestedMemoryAttachmentsForFile( |
| 2191 | filePath, |
| 2192 | toolUseContext, |
| 2193 | appState, |
| 2194 | ) |
| 2195 | attachments.push(...nestedAttachments) |
| 2196 | } |
| 2197 | |
| 2198 | toolUseContext.nestedMemoryAttachmentTriggers.clear() |
| 2199 | |
| 2200 | return attachments |
| 2201 | } |
| 2202 | |
| 2203 | async function getRelevantMemoryAttachments( |
| 2204 | input: string, |
no test coverage detected