()
| 157 | } |
| 158 | |
| 159 | function cacheSourceRoots() { |
| 160 | const roots = []; |
| 161 | const explicitSource = process.env.SIMDECK_CACHE_SOURCE; |
| 162 | if (explicitSource) { |
| 163 | roots.push(resolve(explicitSource)); |
| 164 | } |
| 165 | |
| 166 | const commonRoot = mainCheckoutRoot(); |
| 167 | if (commonRoot) { |
| 168 | roots.push(commonRoot); |
| 169 | } |
| 170 | |
| 171 | const codexWorktrees = join(homedir(), ".codex", "worktrees"); |
| 172 | if (existsSync(codexWorktrees)) { |
| 173 | for (const id of readdirSync(codexWorktrees)) { |
| 174 | const candidate = join(codexWorktrees, id, PROJECT_NAME); |
| 175 | if (candidate !== ROOT && existsSync(candidate)) { |
| 176 | roots.push(candidate); |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | return [...new Set(roots)] |
| 182 | .filter((root) => root !== ROOT && existsSync(root)) |
| 183 | .sort((left, right) => mtimeMs(right) - mtimeMs(left)); |
| 184 | } |
| 185 | |
| 186 | function locksMatch(candidateRoot, lockFiles) { |
| 187 | for (const lockFile of lockFiles) { |
no test coverage detected