MCPcopy Index your code
hub / github.com/codeaashu/claude-code / normalizeSource

Function normalizeSource

src/utils/plugins/reconciler.ts:249–265  ·  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

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

Callers 2

diffMarketplacesFunction · 0.85
reconcileMarketplacesFunction · 0.85

Calls 2

getOriginalCwdFunction · 0.85
resolveFunction · 0.50

Tested by

no test coverage detected