( runtime: Runtime, workspaceName: string, projectName: string, workspaceId: string )
| 169 | * Checks both the canonical (per-project) path and the legacy (by workspaceId) path. |
| 170 | */ |
| 171 | export async function hasNonEmptyPlanFile( |
| 172 | runtime: Runtime, |
| 173 | workspaceName: string, |
| 174 | projectName: string, |
| 175 | workspaceId: string |
| 176 | ): Promise<boolean> { |
| 177 | // Defensive: missing identifiers means we cannot safely resolve plan paths. |
| 178 | if (!workspaceName || !projectName || !workspaceId) { |
| 179 | return false; |
| 180 | } |
| 181 | |
| 182 | const muxHome = runtime.getMuxHome(); |
| 183 | const planPath = getPlanFilePath(workspaceName, projectName, muxHome); |
| 184 | // Legacy paths only used for non-Docker runtimes. |
| 185 | const legacyPath = getLegacyPlanFilePath(workspaceId); |
| 186 | |
| 187 | for (const candidatePath of [planPath, legacyPath]) { |
| 188 | try { |
| 189 | const stat = await runtime.stat(candidatePath); |
| 190 | if (!stat.isDirectory && stat.size > 0) { |
| 191 | return true; |
| 192 | } |
| 193 | } catch { |
| 194 | // Try next candidate. |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | return false; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Move a plan file from one workspace name to another (e.g., during rename). |
nothing calls this directly
no test coverage detected