MCPcopy
hub / github.com/Waishnav/devspace / createWorkspaceContext

Method createWorkspaceContext

src/workspaces.ts:190–220  ·  view source on GitHub ↗
(input: {
    root: string;
    mode: WorkspaceMode;
    sourceRoot?: string;
    worktree?: WorkspaceWorktree;
  })

Source from the content-addressed store, hash-verified

188 }
189
190 private async createWorkspaceContext(input: {
191 root: string;
192 mode: WorkspaceMode;
193 sourceRoot?: string;
194 worktree?: WorkspaceWorktree;
195 }): Promise<WorkspaceContext> {
196 const workspace: Workspace = {
197 id: `ws_${randomUUID()}`,
198 root: input.root,
199 mode: input.mode,
200 sourceRoot: input.sourceRoot,
201 worktree: input.worktree,
202 ...this.loadSkillsForWorkspace(input.root),
203 activatedSkillDirs: new Set(),
204 };
205
206 this.store?.createSession({
207 id: workspace.id,
208 root: workspace.root,
209 mode: workspace.mode,
210 sourceRoot: workspace.sourceRoot,
211 baseRef: workspace.worktree?.baseRef,
212 baseSha: workspace.worktree?.baseSha,
213 managed: workspace.worktree?.managed,
214 });
215 this.workspaces.set(workspace.id, workspace);
216 const agentsFiles = this.loadInitialAgentsFiles(workspace.root);
217 const availableAgentsFiles = await this.findAvailableAgentsFiles(workspace.root, agentsFiles);
218
219 return { workspace, agentsFiles, availableAgentsFiles };
220 }
221
222 private loadSkillsForWorkspace(root: string): Pick<Workspace, "skills" | "skillDiagnostics"> {
223 const result = loadWorkspaceSkills(this.config, root);

Callers 2

openCheckoutWorkspaceMethod · 0.95
openWorktreeWorkspaceMethod · 0.95

Calls 4

createSessionMethod · 0.65

Tested by

no test coverage detected