lash-cli 0.1.0 → 1.0.7
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/bin/lash +5 -9
- package/bin/lash.cmd +7 -56
- package/package.json +21 -8
- package/postinstall.mjs +17 -50
package/bin/lash
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
|
-
if [ -n "$
|
|
5
|
-
resolved="$
|
|
4
|
+
if [ -n "$LASH_BIN_PATH" ]; then
|
|
5
|
+
resolved="$LASH_BIN_PATH"
|
|
6
6
|
else
|
|
7
|
-
# Get the real path of this script
|
|
7
|
+
# Get the real path of this script
|
|
8
8
|
script_path="$0"
|
|
9
9
|
while [ -L "$script_path" ]; do
|
|
10
10
|
link_target="$(readlink "$script_path")"
|
|
@@ -16,7 +16,7 @@ else
|
|
|
16
16
|
script_dir="$(dirname "$script_path")"
|
|
17
17
|
script_dir="$(cd "$script_dir" && pwd)"
|
|
18
18
|
|
|
19
|
-
# Map platform
|
|
19
|
+
# Map platform
|
|
20
20
|
case "$(uname -s)" in
|
|
21
21
|
Darwin) platform="darwin" ;;
|
|
22
22
|
Linux) platform="linux" ;;
|
|
@@ -24,7 +24,7 @@ else
|
|
|
24
24
|
*) platform="$(uname -s | tr '[:upper:]' '[:lower:]')" ;;
|
|
25
25
|
esac
|
|
26
26
|
|
|
27
|
-
# Map
|
|
27
|
+
# Map arch
|
|
28
28
|
case "$(uname -m)" in
|
|
29
29
|
x86_64|amd64) arch="x64" ;;
|
|
30
30
|
aarch64) arch="arm64" ;;
|
|
@@ -36,7 +36,6 @@ else
|
|
|
36
36
|
binary="lash"
|
|
37
37
|
[ "$platform" = "win32" ] && binary="lash.exe"
|
|
38
38
|
|
|
39
|
-
# Search for the binary starting from real script location
|
|
40
39
|
resolved=""
|
|
41
40
|
current_dir="$script_dir"
|
|
42
41
|
while [ "$current_dir" != "/" ]; do
|
|
@@ -54,8 +53,5 @@ else
|
|
|
54
53
|
fi
|
|
55
54
|
fi
|
|
56
55
|
|
|
57
|
-
# Handle SIGINT gracefully
|
|
58
56
|
trap '' INT
|
|
59
|
-
|
|
60
|
-
# Execute the binary with all arguments
|
|
61
57
|
exec "$resolved" "$@"
|
package/bin/lash.cmd
CHANGED
|
@@ -1,56 +1,7 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
rem Get the directory of this script
|
|
10
|
-
set "script_dir=%~dp0"
|
|
11
|
-
set "script_dir=%script_dir:~0,-1%"
|
|
12
|
-
|
|
13
|
-
rem Detect platform and architecture
|
|
14
|
-
set "platform=windows"
|
|
15
|
-
|
|
16
|
-
rem Detect architecture
|
|
17
|
-
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
|
|
18
|
-
set "arch=x64"
|
|
19
|
-
) else if "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
|
|
20
|
-
set "arch=arm64"
|
|
21
|
-
) else if "%PROCESSOR_ARCHITECTURE%"=="x86" (
|
|
22
|
-
set "arch=x86"
|
|
23
|
-
) else (
|
|
24
|
-
set "arch=x64"
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
set "name=opencode-!platform!-!arch!"
|
|
28
|
-
set "binary=opencode.exe"
|
|
29
|
-
|
|
30
|
-
rem Search for the binary starting from script location
|
|
31
|
-
set "resolved="
|
|
32
|
-
set "current_dir=%script_dir%"
|
|
33
|
-
|
|
34
|
-
:search_loop
|
|
35
|
-
set "candidate=%current_dir%\node_modules\%name%\bin\%binary%"
|
|
36
|
-
if exist "%candidate%" (
|
|
37
|
-
set "resolved=%candidate%"
|
|
38
|
-
goto :execute
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
rem Move up one directory
|
|
42
|
-
for %%i in ("%current_dir%") do set "parent_dir=%%~dpi"
|
|
43
|
-
set "parent_dir=%parent_dir:~0,-1%"
|
|
44
|
-
|
|
45
|
-
rem Check if we've reached the root
|
|
46
|
-
if "%current_dir%"=="%parent_dir%" goto :not_found
|
|
47
|
-
set "current_dir=%parent_dir%"
|
|
48
|
-
goto :search_loop
|
|
49
|
-
|
|
50
|
-
:not_found
|
|
51
|
-
echo It seems that your package manager failed to install the right version of the opencode CLI for your platform. You can try manually installing the "%name%" package >&2
|
|
52
|
-
exit /b 1
|
|
53
|
-
|
|
54
|
-
:execute
|
|
55
|
-
rem Execute the binary with all arguments
|
|
56
|
-
"%resolved%" %*
|
|
1
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
2
|
+
"%~dp0\node.exe" "%~dp0\..\node_modules\lash-cli-windows-x64\bin\lash.exe" %*
|
|
3
|
+
) ELSE (
|
|
4
|
+
@SETLOCAL
|
|
5
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
6
|
+
node "%~dp0\..\node_modules\lash-cli-windows-x64\bin\lash.exe" %*
|
|
7
|
+
)
|
package/package.json
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lash-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "The AI coding agent built for the terminal",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "lash - The AI coding agent built for the terminal",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lash": "./bin/lash"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"postinstall": "node ./postinstall.mjs"
|
|
10
10
|
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ai",
|
|
13
|
+
"cli",
|
|
14
|
+
"coding",
|
|
15
|
+
"assistant",
|
|
16
|
+
"terminal",
|
|
17
|
+
"lash"
|
|
18
|
+
],
|
|
11
19
|
"author": "",
|
|
12
20
|
"license": "MIT",
|
|
13
21
|
"repository": {
|
|
14
22
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/lacymorrow/
|
|
23
|
+
"url": "https://github.com/lacymorrow/lash"
|
|
16
24
|
},
|
|
17
25
|
"optionalDependencies": {
|
|
18
|
-
"lash-cli-
|
|
19
|
-
"lash-cli-
|
|
20
|
-
"lash-cli-linux-
|
|
21
|
-
"lash-cli-linux-x64": "
|
|
22
|
-
"lash-cli-
|
|
26
|
+
"lash-cli-windows-x64": "1.0.7",
|
|
27
|
+
"lash-cli-linux-arm64": "1.0.7",
|
|
28
|
+
"lash-cli-linux-x64": "1.0.7",
|
|
29
|
+
"lash-cli-linux-x64-baseline": "1.0.7",
|
|
30
|
+
"lash-cli-darwin-x64": "1.0.7",
|
|
31
|
+
"lash-cli-darwin-x64-baseline": "1.0.7",
|
|
32
|
+
"lash-cli-darwin-arm64": "1.0.7"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18.0.0"
|
|
23
36
|
}
|
|
24
37
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
2
|
import fs from "fs"
|
|
4
3
|
import path from "path"
|
|
5
4
|
import os from "os"
|
|
@@ -10,58 +9,33 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
|
10
9
|
const require = createRequire(import.meta.url)
|
|
11
10
|
|
|
12
11
|
function detectPlatformAndArch() {
|
|
13
|
-
// Map platform names
|
|
14
12
|
let platform
|
|
15
13
|
switch (os.platform()) {
|
|
16
|
-
case "darwin":
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
platform = "linux"
|
|
21
|
-
break
|
|
22
|
-
case "win32":
|
|
23
|
-
platform = "windows"
|
|
24
|
-
break
|
|
25
|
-
default:
|
|
26
|
-
platform = os.platform()
|
|
27
|
-
break
|
|
14
|
+
case "darwin": platform = "darwin"; break;
|
|
15
|
+
case "linux": platform = "linux"; break;
|
|
16
|
+
case "win32": platform = "windows"; break;
|
|
17
|
+
default: platform = os.platform(); break;
|
|
28
18
|
}
|
|
29
|
-
|
|
30
|
-
// Map architecture names
|
|
31
19
|
let arch
|
|
32
20
|
switch (os.arch()) {
|
|
33
|
-
case "x64":
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
arch = "arm64"
|
|
38
|
-
break
|
|
39
|
-
case "arm":
|
|
40
|
-
arch = "arm"
|
|
41
|
-
break
|
|
42
|
-
default:
|
|
43
|
-
arch = os.arch()
|
|
44
|
-
break
|
|
21
|
+
case "x64": arch = "x64"; break;
|
|
22
|
+
case "arm64": arch = "arm64"; break;
|
|
23
|
+
case "arm": arch = "arm"; break;
|
|
24
|
+
default: arch = os.arch(); break;
|
|
45
25
|
}
|
|
46
|
-
|
|
47
26
|
return { platform, arch }
|
|
48
27
|
}
|
|
49
28
|
|
|
50
29
|
function findBinary() {
|
|
51
30
|
const { platform, arch } = detectPlatformAndArch()
|
|
52
|
-
const packageName = `
|
|
53
|
-
const binary = platform === "windows" ? "
|
|
31
|
+
const packageName = `lash-cli-${platform}-${arch}`
|
|
32
|
+
const binary = platform === "windows" ? "lash.exe" : "lash"
|
|
54
33
|
|
|
55
34
|
try {
|
|
56
|
-
// Use require.resolve to find the package
|
|
57
35
|
const packageJsonPath = require.resolve(`${packageName}/package.json`)
|
|
58
36
|
const packageDir = path.dirname(packageJsonPath)
|
|
59
37
|
const binaryPath = path.join(packageDir, "bin", binary)
|
|
60
|
-
|
|
61
|
-
if (!fs.existsSync(binaryPath)) {
|
|
62
|
-
throw new Error(`Binary not found at ${binaryPath}`)
|
|
63
|
-
}
|
|
64
|
-
|
|
38
|
+
if (!fs.existsSync(binaryPath)) throw new Error(`Binary not found`)
|
|
65
39
|
return binaryPath
|
|
66
40
|
} catch (error) {
|
|
67
41
|
throw new Error(`Could not find package ${packageName}: ${error.message}`)
|
|
@@ -71,20 +45,13 @@ function findBinary() {
|
|
|
71
45
|
function main() {
|
|
72
46
|
try {
|
|
73
47
|
const binaryPath = findBinary()
|
|
74
|
-
const binScript = path.join(__dirname, "bin", "
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
fs.unlinkSync(binScript)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Create symlink to the actual binary
|
|
82
|
-
fs.symlinkSync(binaryPath, binScript)
|
|
83
|
-
console.log(`opencode binary symlinked: ${binScript} -> ${binaryPath}`)
|
|
48
|
+
const binScript = path.join(__dirname, "bin", "lash")
|
|
49
|
+
if (fs.existsSync(binScript)) fs.unlinkSync(binScript)
|
|
50
|
+
fs.symlinkSync(binaryPath, binScript, 'file')
|
|
51
|
+
fs.chmodSync(binScript, '755')
|
|
84
52
|
} catch (error) {
|
|
85
|
-
console.error("Failed to create
|
|
86
|
-
|
|
53
|
+
console.error("Failed to create symlink:", error.message)
|
|
54
|
+
// Don't exit 1, let it fail silently as wrapper script exists
|
|
87
55
|
}
|
|
88
56
|
}
|
|
89
|
-
|
|
90
57
|
main()
|