MCPcopy
hub / github.com/codeaashu/claude-code / installFromArtifactory

Function installFromArtifactory

src/utils/ide.ts:1392–1494  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

1390)
1391
1392async function installFromArtifactory(command: string): Promise<string> {
1393 // Read auth token from ~/.npmrc
1394 const npmrcPath = join(os.homedir(), '.npmrc')
1395 let authToken: string | null = null
1396 const fs = getFsImplementation()
1397
1398 try {
1399 const npmrcContent = await fs.readFile(npmrcPath, {
1400 encoding: 'utf8',
1401 })
1402 const lines = npmrcContent.split('\n')
1403 for (const line of lines) {
1404 // Look for the artifactory auth token line
1405 const match = line.match(
1406 /\/\/artifactory\.infra\.ant\.dev\/artifactory\/api\/npm\/npm-all\/:_authToken=(.+)/,
1407 )
1408 if (match && match[1]) {
1409 authToken = match[1].trim()
1410 break
1411 }
1412 }
1413 } catch (error) {
1414 logError(error as Error)
1415 throw new Error(`Failed to read npm authentication: ${error}`)
1416 }
1417
1418 if (!authToken) {
1419 throw new Error('No artifactory auth token found in ~/.npmrc')
1420 }
1421
1422 // Fetch the version from artifactory
1423 const versionUrl =
1424 'https://artifactory.infra.ant.dev/artifactory/armorcode-claude-code-internal/claude-vscode-releases/stable'
1425
1426 try {
1427 const versionResponse = await axios.get(versionUrl, {
1428 headers: {
1429 Authorization: `Bearer ${authToken}`,
1430 },
1431 })
1432
1433 const version = versionResponse.data.trim()
1434 if (!version) {
1435 throw new Error('No version found in artifactory response')
1436 }
1437
1438 // Download the .vsix file from artifactory
1439 const vsixUrl = `https://artifactory.infra.ant.dev/artifactory/armorcode-claude-code-internal/claude-vscode-releases/${version}/claude-code.vsix`
1440 const tempVsixPath = join(
1441 os.tmpdir(),
1442 `claude-code-${version}-${Date.now()}.vsix`,
1443 )
1444
1445 try {
1446 const vsixResponse = await axios.get(vsixUrl, {
1447 headers: {
1448 Authorization: `Bearer ${authToken}`,
1449 },

Callers 1

installIDEExtensionFunction · 0.85

Calls 8

getFsImplementationFunction · 0.85
execFileNoThrowWithCwdFunction · 0.85
getInstallationEnvFunction · 0.85
readFileMethod · 0.80
onMethod · 0.80
logErrorFunction · 0.70
sleepFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected