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

Function deriveSubProjectRelativePath

src/node/services/systemMessage.ts:430–436  ·  view source on GitHub ↗

* Compute the path of `subProjectPath` relative to `projectPath` for use under * the workspace's own checkout. Returns `null` if the recorded sub-project * path is not actually a descendant of the parent project (stale persisted * state) — callers should treat that as "no sub-project segment" and

(projectPath: string, subProjectPath: string)

Source from the content-addressed store, hash-verified

428 * back to parent-only instructions rather than failing.
429 */
430function deriveSubProjectRelativePath(projectPath: string, subProjectPath: string): string | null {
431 const relative = path.relative(projectPath, subProjectPath);
432 if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) {
433 return null;
434 }
435 return relative;
436}
437
438/**
439 * Read instruction sets from global and context sources as a structured tree.

Callers 1

Calls 2

relativeMethod · 0.80
isAbsoluteMethod · 0.80

Tested by

no test coverage detected