@ampcode/cli 0.0.1790553713-gdc78d4 → 0.0.1790582746-g4cde8a
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/install.cjs +28 -2
- package/package.json +6 -6
package/install.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { spawnSync } = require('node:child_process')
|
|
3
|
-
const { copyFileSync, linkSync, unlinkSync, chmodSync, statSync, readFileSync, writeFileSync } = require('node:fs')
|
|
3
|
+
const { copyFileSync, linkSync, unlinkSync, chmodSync, statSync, readFileSync, writeFileSync, symlinkSync, renameSync } = require('node:fs')
|
|
4
4
|
const { arch } = require('node:os')
|
|
5
5
|
const path = require('node:path')
|
|
6
6
|
|
|
@@ -71,6 +71,27 @@ function placeBinary(src, dest) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
// The package.json bin entry must stay bin/amp.exe so npm's Windows shim runs the binary directly.
|
|
75
|
+
// On macOS and Linux, store the binary as bin/amp and make bin/amp.exe a symlink to it. macOS
|
|
76
|
+
// Activity Monitor names a process after its resolved executable, so it shows "amp", not "amp.exe".
|
|
77
|
+
function placeUnixBinary(src, binDir) {
|
|
78
|
+
const entryPath = path.join(binDir, 'amp.exe')
|
|
79
|
+
const tempLinkPath = entryPath + '.tmp'
|
|
80
|
+
placeBinary(src, path.join(binDir, 'amp'))
|
|
81
|
+
try {
|
|
82
|
+
try {
|
|
83
|
+
unlinkSync(tempLinkPath)
|
|
84
|
+
} catch {}
|
|
85
|
+
symlinkSync('amp', tempLinkPath)
|
|
86
|
+
renameSync(tempLinkPath, entryPath)
|
|
87
|
+
} catch {
|
|
88
|
+
try {
|
|
89
|
+
unlinkSync(tempLinkPath)
|
|
90
|
+
} catch {}
|
|
91
|
+
placeBinary(src, entryPath)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
74
95
|
function main() {
|
|
75
96
|
const platformKey = getPlatformKey()
|
|
76
97
|
const info = PLATFORMS[platformKey]
|
|
@@ -94,7 +115,12 @@ function main() {
|
|
|
94
115
|
}
|
|
95
116
|
|
|
96
117
|
try {
|
|
97
|
-
|
|
118
|
+
const binDir = path.join(__dirname, 'bin')
|
|
119
|
+
if (process.platform === 'win32') {
|
|
120
|
+
placeBinary(src, path.join(binDir, 'amp.exe'))
|
|
121
|
+
} else {
|
|
122
|
+
placeUnixBinary(src, binDir)
|
|
123
|
+
}
|
|
98
124
|
} catch (error) {
|
|
99
125
|
console.error(`[${WRAPPER_NAME} postinstall] Failed to place binary: ${error.message}`)
|
|
100
126
|
console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ampcode/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1790582746-g4cde8a",
|
|
4
4
|
"description": "CLI for Amp, the frontier agent and development environment.",
|
|
5
5
|
"homepage": "https://ampcode.com/",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"postinstall": "node install.cjs"
|
|
13
13
|
},
|
|
14
14
|
"optionalDependencies": {
|
|
15
|
-
"@ampcode/cli-darwin-arm64": "0.0.
|
|
16
|
-
"@ampcode/cli-darwin-x64": "0.0.
|
|
17
|
-
"@ampcode/cli-linux-arm64": "0.0.
|
|
18
|
-
"@ampcode/cli-linux-x64": "0.0.
|
|
19
|
-
"@ampcode/cli-win32-x64": "0.0.
|
|
15
|
+
"@ampcode/cli-darwin-arm64": "0.0.1790582746-g4cde8a",
|
|
16
|
+
"@ampcode/cli-darwin-x64": "0.0.1790582746-g4cde8a",
|
|
17
|
+
"@ampcode/cli-linux-arm64": "0.0.1790582746-g4cde8a",
|
|
18
|
+
"@ampcode/cli-linux-x64": "0.0.1790582746-g4cde8a",
|
|
19
|
+
"@ampcode/cli-win32-x64": "0.0.1790582746-g4cde8a"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"bin/amp.exe",
|