(filename: string, customPath?: string | null)
| 182 | * Returns null if the file doesn't exist or on read error. |
| 183 | */ |
| 184 | export function readArchivedPlan(filename: string, customPath?: string | null): string | null { |
| 185 | const planDir = getPlanDir(customPath); |
| 186 | const filePath = resolve(planDir, filename); |
| 187 | // Guard against path traversal (resolve + trailing separator, matching reference-handlers.ts) |
| 188 | if (!filePath.startsWith(planDir + sep)) return null; |
| 189 | try { |
| 190 | return readFileSync(filePath, "utf-8"); |
| 191 | } catch { |
| 192 | return null; |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | // --- Version History --- |
| 197 |
no test coverage detected