MCPcopy
hub / github.com/coder/mux / getWorkspacePathHintForProject

Function getWorkspacePathHintForProject

src/node/services/workspaceProjectRepos.ts:141–173  ·  view source on GitHub ↗
(
  params: WorkspaceProjectRepoParams,
  targetProjectPath: string
)

Source from the content-addressed store, hash-verified

139}
140
141export function getWorkspacePathHintForProject(
142 params: WorkspaceProjectRepoParams,
143 targetProjectPath: string
144): string | undefined {
145 if (!isSSHRuntime(params.runtimeConfig)) {
146 return undefined;
147 }
148
149 const currentProjectRoot = path.posix.dirname(path.posix.normalize(params.workspacePath));
150 const primaryLegacyLayout = buildLegacyRemoteProjectLayout(
151 params.runtimeConfig.srcBaseDir,
152 params.projectPath
153 );
154 if (currentProjectRoot === primaryLegacyLayout.projectRoot) {
155 return getRemoteWorkspacePath(
156 buildLegacyRemoteProjectLayout(params.runtimeConfig.srcBaseDir, targetProjectPath),
157 params.workspaceName
158 );
159 }
160
161 const primaryPreferredLayout = buildRemoteProjectLayout(
162 params.runtimeConfig.srcBaseDir,
163 params.projectPath
164 );
165 if (currentProjectRoot === primaryPreferredLayout.projectRoot) {
166 return getRemoteWorkspacePath(
167 buildRemoteProjectLayout(params.runtimeConfig.srcBaseDir, targetProjectPath),
168 params.workspaceName
169 );
170 }
171
172 return undefined;
173}
174
175export function getWorkspaceProjectRepos(
176 params: WorkspaceProjectRepoParams

Callers 7

removeMethod · 0.90
renameMethod · 0.90
executeBashMethod · 0.90
streamMessageMethod · 0.90
getWorkspaceProjectReposFunction · 0.85

Calls 4

isSSHRuntimeFunction · 0.90
getRemoteWorkspacePathFunction · 0.90
buildRemoteProjectLayoutFunction · 0.90

Tested by

no test coverage detected