(workspaceId: string)
| 5748 | } |
| 5749 | |
| 5750 | async deleteWorktree(workspaceId: string): Promise<Result<void>> { |
| 5751 | try { |
| 5752 | const allMetadata = await this.config.getAllWorkspaceMetadata(); |
| 5753 | const workspaceMetadata = allMetadata.find((metadata) => metadata.id === workspaceId); |
| 5754 | if (!workspaceMetadata) { |
| 5755 | return Err("Workspace not found"); |
| 5756 | } |
| 5757 | |
| 5758 | if (!isWorkspaceArchived(workspaceMetadata.archivedAt, workspaceMetadata.unarchivedAt)) { |
| 5759 | return Err("Only archived workspaces can delete their managed worktree"); |
| 5760 | } |
| 5761 | |
| 5762 | if (!isWorktreeRuntime(workspaceMetadata.runtimeConfig)) { |
| 5763 | return Err("Deleting a managed worktree is only supported for worktree runtimes"); |
| 5764 | } |
| 5765 | |
| 5766 | const managedPath = workspaceMetadata.namedWorkspacePath; |
| 5767 | await removeManagedGitWorktree(workspaceMetadata.projectPath, managedPath); |
| 5768 | await this.emitCurrentWorkspaceMetadata(workspaceId); |
| 5769 | return Ok(undefined); |
| 5770 | } catch (error) { |
| 5771 | const message = getErrorMessage(error); |
| 5772 | return Err(`Failed to delete managed worktree: ${message}`); |
| 5773 | } |
| 5774 | } |
| 5775 | |
| 5776 | async stopRuntime(workspaceId: string): Promise<Result<void>> { |
| 5777 | const metadataResult = await this.aiService.getWorkspaceMetadata(workspaceId); |
no test coverage detected