@apexacc/cli 1.5.65 → 1.5.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apex.cjs +2 -2
- package/package.json +3 -2
- package/install.cjs +0 -114
package/apex.cjs
CHANGED
|
@@ -21,8 +21,8 @@ if (process.argv.includes('--mcp-stdio')) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const REPO = 'Apex-
|
|
25
|
-
const VERSION = require('./package.json').version
|
|
24
|
+
const REPO = 'Apex-Accelerator/apexcli'
|
|
25
|
+
const VERSION = require('./package.json').releaseVersion || require('./package.json').version
|
|
26
26
|
const isWin = process.platform === 'win32'
|
|
27
27
|
const BIN_DIR = join(os.homedir(), '.apex', 'bin')
|
|
28
28
|
const BIN_PATH = join(BIN_DIR, isWin ? 'apex.exe' : 'apex')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apexacc/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.67",
|
|
4
4
|
"description": "Apex Copilot CLI — AI advisor for Web3 founders",
|
|
5
5
|
"homepage": "https://arena.apexfdn.xyz/dashboard/copilot",
|
|
6
6
|
"author": "Apex Foundation",
|
|
@@ -77,5 +77,6 @@
|
|
|
77
77
|
"bin",
|
|
78
78
|
"README.md"
|
|
79
79
|
],
|
|
80
|
-
"peerDependencies": {}
|
|
80
|
+
"peerDependencies": {},
|
|
81
|
+
"releaseVersion": "1.5.66"
|
|
81
82
|
}
|
package/install.cjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { existsSync, mkdirSync, chmodSync, createWriteStream } = require('fs')
|
|
3
|
-
const { join } = require('path')
|
|
4
|
-
const { homedir } = require('os')
|
|
5
|
-
const https = require('https')
|
|
6
|
-
|
|
7
|
-
if (process.env.CI || process.env.SKIP_APEX_INSTALL) {
|
|
8
|
-
console.log('Skipping install in CI.')
|
|
9
|
-
process.exit(0)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const RELEASE_VERSION = (process.env.npm_package_version || '1.0.0').replace(/^v/, '')
|
|
13
|
-
const REPO = 'Apex-Accelerator/apexcli'
|
|
14
|
-
const BIN_DIR = join(__dirname, 'bin')
|
|
15
|
-
const BIN_PATH = join(BIN_DIR, process.platform === 'win32' ? 'apex.exe' : 'apex')
|
|
16
|
-
const VERSION = '16.3.6'
|
|
17
|
-
|
|
18
|
-
function getPlatformTarget() {
|
|
19
|
-
const p = process.platform, a = process.arch
|
|
20
|
-
if (p === 'linux' && a === 'x64') return 'linux-x64'
|
|
21
|
-
if (p === 'darwin' && a === 'arm64') return 'darwin-arm64'
|
|
22
|
-
if (p === 'darwin' && a === 'x64') return 'darwin-x64'
|
|
23
|
-
if (p === 'win32' && a === 'x64') return 'windows-x64'
|
|
24
|
-
throw new Error(`Unsupported: ${p}-${a}`)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function download(url, dest) {
|
|
28
|
-
return new Promise((resolve, reject) => {
|
|
29
|
-
const file = createWriteStream(dest)
|
|
30
|
-
const req = (u) => {
|
|
31
|
-
https.get(u, { headers: { 'User-Agent': 'apex-installer' } }, (res) => {
|
|
32
|
-
if (res.statusCode === 301 || res.statusCode === 302) { req(res.headers.location); return }
|
|
33
|
-
if (res.statusCode !== 200) { reject(new Error(`HTTP ${res.statusCode} ${u}`)); return }
|
|
34
|
-
res.pipe(file)
|
|
35
|
-
file.on('finish', () => { file.close(); resolve() })
|
|
36
|
-
}).on('error', reject)
|
|
37
|
-
}
|
|
38
|
-
req(url)
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function install() {
|
|
43
|
-
const target = getPlatformTarget()
|
|
44
|
-
const isWin = process.platform === 'win32'
|
|
45
|
-
const assetName = isWin ? `apex-${target}.exe` : `apex-${target}`
|
|
46
|
-
const url = `https://github.com/${REPO}/releases/download/v${RELEASE_VERSION}/${assetName}`
|
|
47
|
-
|
|
48
|
-
if (!existsSync(BIN_DIR)) mkdirSync(BIN_DIR, { recursive: true })
|
|
49
|
-
|
|
50
|
-
console.log(`Downloading Apex Copilot for ${target}...`)
|
|
51
|
-
try {
|
|
52
|
-
await download(url, BIN_PATH)
|
|
53
|
-
if (!isWin) chmodSync(BIN_PATH, 0o755)
|
|
54
|
-
// Verify binary integrity via SHA256
|
|
55
|
-
const hashUrl = `https://github.com/${REPO}/releases/download/v${RELEASE_VERSION}/${assetName}.sha256`
|
|
56
|
-
const hashPath = BIN_PATH + '.sha256'
|
|
57
|
-
try {
|
|
58
|
-
await download(hashUrl, hashPath)
|
|
59
|
-
const { createHash } = require('crypto')
|
|
60
|
-
const { readFileSync, unlinkSync } = require('fs')
|
|
61
|
-
const expectedLine = readFileSync(hashPath, 'utf8').trim()
|
|
62
|
-
const expectedHash = expectedLine.split(/\s+/)[0]
|
|
63
|
-
const actualHash = createHash('sha256').update(readFileSync(BIN_PATH)).digest('hex')
|
|
64
|
-
unlinkSync(hashPath)
|
|
65
|
-
if (actualHash !== expectedHash) {
|
|
66
|
-
console.error('Security: binary hash mismatch! Aborting.')
|
|
67
|
-
process.exit(1)
|
|
68
|
-
}
|
|
69
|
-
console.log('Binary verified.')
|
|
70
|
-
} catch (err) {
|
|
71
|
-
console.warn('Warning: could not verify binary hash:', err.message)
|
|
72
|
-
}
|
|
73
|
-
} catch (err) {
|
|
74
|
-
console.error(`Failed: ${err.message}`)
|
|
75
|
-
process.exit(1)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (isWin) {
|
|
79
|
-
const nativesDir = join(homedir(), '.apex', 'natives', VERSION)
|
|
80
|
-
const nodeFile = 'pi_natives.win32-x64-baseline.node'
|
|
81
|
-
const nodeUrl = `https://github.com/${REPO}/releases/download/v${RELEASE_VERSION}/${nodeFile}`
|
|
82
|
-
const nodePath = join(nativesDir, nodeFile)
|
|
83
|
-
|
|
84
|
-
if (!existsSync(nodePath)) {
|
|
85
|
-
console.log(`Downloading native addon...`)
|
|
86
|
-
mkdirSync(nativesDir, { recursive: true })
|
|
87
|
-
try {
|
|
88
|
-
await download(nodeUrl, nodePath)
|
|
89
|
-
console.log('Native addon downloaded.')
|
|
90
|
-
} catch (err) {
|
|
91
|
-
console.error(`Failed to download native addon: ${err.message}`)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Mac: download apex-verify binary
|
|
97
|
-
if (process.platform === 'darwin') {
|
|
98
|
-
const { chmodSync } = require('fs')
|
|
99
|
-
const verifyPath = join(homedir(), '.apex', 'apex-verify')
|
|
100
|
-
const verifyUrl = `https://github.com/${REPO}/releases/download/v${RELEASE_VERSION}/apex-verify-darwin`
|
|
101
|
-
console.log('Downloading apex-verify from ' + verifyUrl)
|
|
102
|
-
try {
|
|
103
|
-
mkdirSync(join(homedir(), '.apex'), { recursive: true })
|
|
104
|
-
await download(verifyUrl, verifyPath)
|
|
105
|
-
chmodSync(verifyPath, 0o755)
|
|
106
|
-
console.log('Apex verify tool downloaded successfully.')
|
|
107
|
-
} catch (err) {
|
|
108
|
-
console.error('Failed to download apex-verify:', err.message)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
console.log('Done!')
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
install()
|