MCPcopy Create free account
hub / github.com/Noumena-Network/code / installIDEExtension

Function installIDEExtension

src/utils/ide.ts:938–970  ·  view source on GitHub ↗
(ideType: IdeType)

Source from the content-addressed store, hash-verified

936}
937
938async function installIDEExtension(ideType: IdeType): Promise<string | null> {
939 if (isVSCodeIde(ideType)) {
940 const command = await getVSCodeIDECommand(ideType)
941
942 if (command) {
943 if (isInternalBuild()) {
944 return await installFromArtifactory(command)
945 }
946 let version = await getInstalledVSCodeExtensionVersion(command)
947 // If it's not installed or the version is older than the one we have bundled,
948 if (!version || lt(version, getClaudeCodeVersion())) {
949 // `code` may crash when invoked too quickly in succession
950 await sleep(500)
951 const result = await execFileNoThrowWithCwd(
952 command,
953 ['--force', '--install-extension', 'anthropic.claude-code'],
954 {
955 env: getInstallationEnv(),
956 },
957 )
958 if (result.code !== 0) {
959 throw new Error(`${result.code}: ${result.error} ${result.stderr}`)
960 }
961 version = getClaudeCodeVersion()
962 }
963 return version
964 }
965 }
966 // No automatic installation for JetBrains IDEs as it is not supported in native
967 // builds. We show a prominent notice for them to download from the marketplace
968 // instead.
969 return null
970}
971
972function getInstallationEnv(): NodeJS.ProcessEnv | undefined {
973 // Cursor on Linux may incorrectly implement

Callers 1

maybeInstallIDEExtensionFunction · 0.85

Calls 10

isVSCodeIdeFunction · 0.85
getVSCodeIDECommandFunction · 0.85
isInternalBuildFunction · 0.85
installFromArtifactoryFunction · 0.85
ltFunction · 0.85
getClaudeCodeVersionFunction · 0.85
execFileNoThrowWithCwdFunction · 0.85
getInstallationEnvFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected