(root: string, stateFile?: string)
| 135 | } |
| 136 | |
| 137 | export async function loadState(root: string, stateFile?: string): Promise<string | null> { |
| 138 | const target = stateFile ?? 'STATE.md'; |
| 139 | try { |
| 140 | assertSafeSegment(target, 'stateFile'); |
| 141 | } catch { |
| 142 | return null; |
| 143 | } |
| 144 | if (!(STATE_FILE_CANDIDATES as readonly string[]).includes(target)) return null; |
| 145 | return readFileIfExists(path.join(root, target)); |
| 146 | } |
| 147 | |
| 148 | export async function listStateFiles(root: string): Promise<string[]> { |
| 149 | const found: string[] = []; |
no test coverage detected