(workspaceId: string)
| 81 | } |
| 82 | |
| 83 | getWorkspace(workspaceId: string): Workspace { |
| 84 | const workspace = this.workspaces.get(workspaceId); |
| 85 | if (workspace) { |
| 86 | this.store?.touchSession(workspaceId); |
| 87 | return workspace; |
| 88 | } |
| 89 | |
| 90 | const session = this.store?.getSession(workspaceId); |
| 91 | if (!session) { |
| 92 | throw new Error(`Unknown workspaceId: ${workspaceId}. Call open_workspace first.`); |
| 93 | } |
| 94 | |
| 95 | const root = this.assertWorkspaceRootAllowed(session.root, session.mode, session.sourceRoot); |
| 96 | const restoredWorkspace: Workspace = { |
| 97 | id: session.id, |
| 98 | root, |
| 99 | mode: session.mode, |
| 100 | sourceRoot: session.sourceRoot, |
| 101 | worktree: |
| 102 | session.mode === "worktree" |
| 103 | ? { |
| 104 | path: root, |
| 105 | baseRef: session.baseRef ?? "HEAD", |
| 106 | baseSha: session.baseSha ?? "", |
| 107 | dirtySource: false, |
| 108 | detached: true, |
| 109 | managed: session.managed, |
| 110 | } |
| 111 | : undefined, |
| 112 | ...this.loadSkillsForWorkspace(root), |
| 113 | activatedSkillDirs: new Set(), |
| 114 | }; |
| 115 | this.store?.touchSession(workspaceId); |
| 116 | this.workspaces.set(restoredWorkspace.id, restoredWorkspace); |
| 117 | |
| 118 | return restoredWorkspace; |
| 119 | } |
| 120 | |
| 121 | resolvePath(workspace: Workspace, inputPath: string): string { |
| 122 | const absolutePath = resolveAllowedPath(inputPath, workspace.root, [workspace.root]); |
no test coverage detected