(absolutePath: string)
| 243 | |
| 244 | // Check if file is the plan file for the current session |
| 245 | function isSessionPlanFile(absolutePath: string): boolean { |
| 246 | // Check if path is a plan file for this session (main or agent-specific) |
| 247 | // Main plan file: {plansDir}/{planSlug}.md |
| 248 | // Agent plan file: {plansDir}/{planSlug}-agent-{agentId}.md |
| 249 | const expectedPrefix = join(getPlansDirectory(), getPlanSlug()) |
| 250 | // SECURITY: Normalize to prevent path traversal bypasses via .. segments |
| 251 | const normalizedPath = normalize(absolutePath) |
| 252 | return ( |
| 253 | normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith('.md') |
| 254 | ) |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Returns the session memory directory path for the current session with trailing separator. |
no test coverage detected