(id: string, commitMessageOrOptions?: string | MergeWorkspaceOptions)
| 1855 | // worktree 清理失败时记录警告但不阻断删除 |
| 1856 | console.warn( |
| 1857 | `[WorkspaceService] Failed to remove worktree for workspace ${id}: ${err instanceof Error ? err.message : err}` |
| 1858 | ); |
| 1859 | } |
| 1860 | } |
| 1861 | |
| 1862 | // 删除数据库记录(级联删除 sessions/services) |
| 1863 | await this.backgroundService.releaseLogsForWorkspace?.(id); |
| 1864 | await prisma.workspace.delete({ where: { id } }); |
| 1865 | return true; |
| 1866 | } |
| 1867 | |
| 1868 | // ── Diff ───────────────────────────────────────────────────────────────────── |
| 1869 | |
| 1870 | async getDiff(id: string) { |
| 1871 | const workspace = await prisma.workspace.findUnique({ |
| 1872 | where: { id }, |
| 1873 | include: { task: { include: { project: true } } }, |
| 1874 | }); |
| 1875 | |
| 1876 | if (!workspace) { |
| 1877 | throw new NotFoundError('Workspace', id); |
| 1878 | } |
| 1879 | ensureProjectIsMutable(workspace.task.project, 'read workspace diff'); |
| 1880 | this.assertWorktreeWorkspace(workspace); |
no test coverage detected