MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / installFromGitHub

Function installFromGitHub

src/utils/plugins/pluginLoader.ts:663–679  ·  view source on GitHub ↗

* Install a plugin from GitHub

(
  repo: string,
  targetPath: string,
  ref?: string,
  sha?: string,
)

Source from the content-addressed store, hash-verified

661 * Install a plugin from GitHub
662 */
663async function installFromGitHub(
664 repo: string,
665 targetPath: string,
666 ref?: string,
667 sha?: string,
668): Promise<void> {
669 if (!/^[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/.test(repo)) {
670 throw new Error(
671 `Invalid GitHub repository format: ${repo}. Expected format: owner/repo`,
672 )
673 }
674 // Use HTTPS for CCR (no SSH keys), SSH for normal CLI
675 const gitUrl = isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)
676 ? `https://github.com/${repo}.git`
677 : `git@github.com:${repo}.git`
678 return installFromGit(gitUrl, targetPath, ref, sha)
679}
680
681/**
682 * Resolve a git-subdir `url` field to a clonable git URL.

Callers 1

cachePluginFunction · 0.85

Calls 2

installFromGitFunction · 0.85
isEnvTruthyFunction · 0.50

Tested by

no test coverage detected