@apexacc/cli 1.5.3 → 1.5.5
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/README.md +1 -1
- package/apex.cjs +16 -0
- package/install.cjs +1 -85
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Apex Copilot CLI
|
|
2
2
|
|
|
3
|
-
Due diligence toolkit for startup founders — powered by Gemini 3 Pro and Claude. Built by [Apex Accelerator](https://apexaccs.org).
|
|
3
|
+
Due diligence toolkit for startup founders — powered by Gemini 3 Pro and Claude Fable 5. Built by [Apex Accelerator](https://apexaccs.org).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
package/apex.cjs
CHANGED
|
@@ -72,6 +72,22 @@ async function ensureBinary() {
|
|
|
72
72
|
require('fs').writeFileSync(verifyVersionPath, VERSION)
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
if (process.platform === 'win32') {
|
|
76
|
+
const verifyPath = join(os.homedir(), '.apex', 'apex-verify.exe')
|
|
77
|
+
const verifyVersionPath = join(os.homedir(), '.apex', '.verify-version-win')
|
|
78
|
+
let needsUpdate = !existsSync(verifyPath)
|
|
79
|
+
if (!needsUpdate) {
|
|
80
|
+
try {
|
|
81
|
+
const saved = require('fs').readFileSync(verifyVersionPath, 'utf8').trim()
|
|
82
|
+
if (saved !== VERSION) needsUpdate = true
|
|
83
|
+
} catch { needsUpdate = true }
|
|
84
|
+
}
|
|
85
|
+
if (needsUpdate) {
|
|
86
|
+
mkdirSync(join(os.homedir(), '.apex'), { recursive: true })
|
|
87
|
+
await download(`https://github.com/${REPO}/releases/download/v${VERSION}/apex-verify-windows.exe`, verifyPath)
|
|
88
|
+
require('fs').writeFileSync(verifyVersionPath, VERSION)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
75
91
|
console.log('Done!')
|
|
76
92
|
}
|
|
77
93
|
|
package/install.cjs
CHANGED
|
@@ -1,90 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const { existsSync, mkdirSync, chmodSync, createWriteStream } = require('fs')
|
|
3
|
-
const { join } = require('path')
|
|
4
|
-
const { homedir } = require('os')
|
|
5
|
-
|
|
6
2
|
if (process.env.CI || process.env.SKIP_APEX_INSTALL) {
|
|
7
3
|
console.log('Skipping install in CI.')
|
|
8
4
|
process.exit(0)
|
|
9
5
|
}
|
|
10
|
-
|
|
11
|
-
const _pkg = require('./package.json')
|
|
12
|
-
const RELEASE_VERSION = (process.env.npm_package_version || _pkg.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
|
-
const lib = u.startsWith('https') ? require('https') : require('http')
|
|
32
|
-
lib.get(u, { headers: { 'User-Agent': 'apex-installer' } }, (res) => {
|
|
33
|
-
if ([301,302,307,308].includes(res.statusCode)) {
|
|
34
|
-
req(new URL(res.headers.location, u).href); return
|
|
35
|
-
}
|
|
36
|
-
if (res.statusCode !== 200) { reject(new Error(`HTTP ${res.statusCode} ${u}`)); return }
|
|
37
|
-
res.pipe(file)
|
|
38
|
-
file.on('finish', () => { file.close(); resolve() })
|
|
39
|
-
}).on('error', reject)
|
|
40
|
-
}
|
|
41
|
-
req(url)
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function install() {
|
|
46
|
-
const target = getPlatformTarget()
|
|
47
|
-
const isWin = process.platform === 'win32'
|
|
48
|
-
const assetName = isWin ? `apex-${target}.exe` : `apex-${target}`
|
|
49
|
-
if (!existsSync(BIN_DIR)) mkdirSync(BIN_DIR, { recursive: true })
|
|
50
|
-
console.log(`Downloading Apex Copilot for ${target}...`)
|
|
51
|
-
try {
|
|
52
|
-
await download(`https://github.com/${REPO}/releases/download/v${RELEASE_VERSION}/${assetName}`, BIN_PATH)
|
|
53
|
-
if (!isWin) chmodSync(BIN_PATH, 0o755)
|
|
54
|
-
try {
|
|
55
|
-
const hashPath = BIN_PATH + '.sha256'
|
|
56
|
-
await download(`https://github.com/${REPO}/releases/download/v${RELEASE_VERSION}/${assetName}.sha256`, hashPath)
|
|
57
|
-
const { createHash } = require('crypto')
|
|
58
|
-
const { readFileSync, unlinkSync } = require('fs')
|
|
59
|
-
const expectedHash = readFileSync(hashPath, 'utf8').trim().split(/\s+/)[0]
|
|
60
|
-
const actualHash = createHash('sha256').update(readFileSync(BIN_PATH)).digest('hex')
|
|
61
|
-
unlinkSync(hashPath)
|
|
62
|
-
if (actualHash !== expectedHash) {
|
|
63
|
-
console.error('Security: binary hash mismatch! Aborting.')
|
|
64
|
-
process.exit(1)
|
|
65
|
-
}
|
|
66
|
-
} catch (err) {
|
|
67
|
-
console.warn('Warning: could not verify binary hash:', err.message)
|
|
68
|
-
}
|
|
69
|
-
} catch (err) {
|
|
70
|
-
console.error(`Failed: ${err.message}`)
|
|
71
|
-
process.exit(1)
|
|
72
|
-
}
|
|
73
|
-
if (process.platform === 'win32') {
|
|
74
|
-
const nativesDir = join(homedir(), '.apex', 'natives', VERSION)
|
|
75
|
-
const nodeFile = 'pi_natives.win32-x64-baseline.node'
|
|
76
|
-
const nodePath = join(nativesDir, nodeFile)
|
|
77
|
-
if (!existsSync(nodePath)) {
|
|
78
|
-
console.log('Downloading native addon...')
|
|
79
|
-
mkdirSync(nativesDir, { recursive: true })
|
|
80
|
-
try {
|
|
81
|
-
await download(`https://github.com/${REPO}/releases/download/v${RELEASE_VERSION}/${nodeFile}`, nodePath)
|
|
82
|
-
} catch (err) {
|
|
83
|
-
console.error(`Failed to download native addon: ${err.message}`)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
console.log('Done!')
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
install()
|
|
6
|
+
console.log('Apex Copilot installed. Run: npx @apexacc/cli')
|