MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / normalizeSource

Function normalizeSource

source code/utils/plugins/reconciler.ts:251–267  ·  view source on GitHub ↗

* Resolve relative directory/file paths for stable comparison. * Settings declared at project scope may use project-relative paths; * JSON stores absolute paths. * * For git worktrees, resolve against the main checkout (canonical root) * instead of the worktree cwd. Project settings are checked

(
  source: MarketplaceSource,
  projectRoot?: string,
)

Source from the content-addressed store, hash-verified

249 * installLocation. The canonical root is stable across all worktrees.
250 */
251function normalizeSource(
252 source: MarketplaceSource,
253 projectRoot?: string,
254): MarketplaceSource {
255 if (
256 (source.source === 'directory' || source.source === 'file') &&
257 !isAbsolute(source.path)
258 ) {
259 const base = projectRoot ?? getOriginalCwd()
260 const canonicalRoot = findCanonicalGitRoot(base)
261 return {
262 ...source,
263 path: resolve(canonicalRoot ?? base, source.path),
264 }
265 }
266 return source
267}

Callers 2

diffMarketplacesFunction · 0.85
reconcileMarketplacesFunction · 0.85

Calls 2

getOriginalCwdFunction · 0.85
resolveFunction · 0.50

Tested by

no test coverage detected