@leverageaiapps/locus 1.0.3 → 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/Dockerfile +29 -0
- package/README.md +3 -3
- package/dist/exec.d.ts +20 -0
- package/dist/exec.d.ts.map +1 -0
- package/dist/exec.js +158 -0
- package/dist/exec.js.map +1 -0
- package/dist/pty.d.ts +1 -14
- package/dist/pty.d.ts.map +1 -1
- package/dist/pty.js +15 -136
- package/dist/pty.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +5 -5
- package/dist/session.js.map +1 -1
- package/dist/web-server.d.ts.map +1 -1
- package/dist/web-server.js +104 -32
- package/dist/web-server.js.map +1 -1
- package/docs/CNAME +1 -0
- package/docs/index.html +492 -0
- package/docs/install.sh +329 -0
- package/package.json +7 -5
package/docs/install.sh
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Locus Installation Script
|
|
4
|
+
# One-line installer: curl -fsSL https://yourdomain.com/install.sh | bash
|
|
5
|
+
#
|
|
6
|
+
# This script installs Locus with all required dependencies
|
|
7
|
+
# Supports: macOS, Linux, WSL
|
|
8
|
+
|
|
9
|
+
set -e
|
|
10
|
+
|
|
11
|
+
# Color codes for output
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
GREEN='\033[0;32m'
|
|
14
|
+
YELLOW='\033[1;33m'
|
|
15
|
+
BLUE='\033[0;34m'
|
|
16
|
+
MAGENTA='\033[0;35m'
|
|
17
|
+
CYAN='\033[0;36m'
|
|
18
|
+
NC='\033[0m' # No Color
|
|
19
|
+
|
|
20
|
+
# Configuration
|
|
21
|
+
NODEJS_MIN_VERSION="18"
|
|
22
|
+
NPM_PACKAGE="@leverageaiapps/locus"
|
|
23
|
+
COMMAND_NAME="locus"
|
|
24
|
+
|
|
25
|
+
# Print colored output
|
|
26
|
+
print_color() {
|
|
27
|
+
local color=$1
|
|
28
|
+
local message=$2
|
|
29
|
+
echo -e "${color}${message}${NC}"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Print error and exit
|
|
33
|
+
error_exit() {
|
|
34
|
+
print_color "$RED" "❌ Error: $1"
|
|
35
|
+
exit 1
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Print banner
|
|
39
|
+
print_banner() {
|
|
40
|
+
echo ""
|
|
41
|
+
print_color "$CYAN" "╔════════════════════════════════════════╗"
|
|
42
|
+
print_color "$CYAN" "║ ║"
|
|
43
|
+
print_color "$CYAN" "║ Locus Installer ║"
|
|
44
|
+
print_color "$CYAN" "║ ║"
|
|
45
|
+
print_color "$CYAN" "╚════════════════════════════════════════╝"
|
|
46
|
+
echo ""
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Detect OS
|
|
50
|
+
detect_os() {
|
|
51
|
+
local os=""
|
|
52
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
53
|
+
os="macos"
|
|
54
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "linux" ]]; then
|
|
55
|
+
# Check if running in WSL
|
|
56
|
+
if [[ -n "$WSL_DISTRO_NAME" ]] || grep -qi microsoft /proc/version 2>/dev/null; then
|
|
57
|
+
os="wsl"
|
|
58
|
+
else
|
|
59
|
+
os="linux"
|
|
60
|
+
fi
|
|
61
|
+
else
|
|
62
|
+
error_exit "Unsupported operating system: $OSTYPE"
|
|
63
|
+
fi
|
|
64
|
+
echo "$os"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# Detect architecture
|
|
68
|
+
detect_arch() {
|
|
69
|
+
local arch=$(uname -m)
|
|
70
|
+
case $arch in
|
|
71
|
+
x86_64|amd64)
|
|
72
|
+
echo "x64"
|
|
73
|
+
;;
|
|
74
|
+
aarch64|arm64)
|
|
75
|
+
echo "arm64"
|
|
76
|
+
;;
|
|
77
|
+
*)
|
|
78
|
+
error_exit "Unsupported architecture: $arch"
|
|
79
|
+
;;
|
|
80
|
+
esac
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Check if command exists
|
|
84
|
+
command_exists() {
|
|
85
|
+
command -v "$1" >/dev/null 2>&1
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Compare version numbers
|
|
89
|
+
version_compare() {
|
|
90
|
+
local version1=$1
|
|
91
|
+
local version2=$2
|
|
92
|
+
|
|
93
|
+
if [[ "$version1" == "$version2" ]]; then
|
|
94
|
+
return 0
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
local IFS=.
|
|
98
|
+
local i ver1=($version1) ver2=($version2)
|
|
99
|
+
|
|
100
|
+
for ((i=0; i<${#ver1[@]} || i<${#ver2[@]}; i++)); do
|
|
101
|
+
local num1=${ver1[i]:-0}
|
|
102
|
+
local num2=${ver2[i]:-0}
|
|
103
|
+
|
|
104
|
+
if ((num1 > num2)); then
|
|
105
|
+
return 1
|
|
106
|
+
elif ((num1 < num2)); then
|
|
107
|
+
return 2
|
|
108
|
+
fi
|
|
109
|
+
done
|
|
110
|
+
|
|
111
|
+
return 0
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Get Node.js version
|
|
115
|
+
get_node_version() {
|
|
116
|
+
if command_exists node; then
|
|
117
|
+
node --version | sed 's/v//'
|
|
118
|
+
else
|
|
119
|
+
echo "0"
|
|
120
|
+
fi
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
# Install Node.js on macOS
|
|
124
|
+
install_nodejs_macos() {
|
|
125
|
+
print_color "$YELLOW" "📦 Installing Node.js via Homebrew..."
|
|
126
|
+
|
|
127
|
+
# Check if Homebrew is installed
|
|
128
|
+
if ! command_exists brew; then
|
|
129
|
+
print_color "$YELLOW" "🍺 Installing Homebrew first..."
|
|
130
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
131
|
+
|
|
132
|
+
# Add Homebrew to PATH for Apple Silicon Macs
|
|
133
|
+
if [[ -f /opt/homebrew/bin/brew ]]; then
|
|
134
|
+
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
135
|
+
fi
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
brew install node
|
|
139
|
+
print_color "$GREEN" "✅ Node.js installed successfully"
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
# Install Node.js on Linux/WSL
|
|
143
|
+
install_nodejs_linux() {
|
|
144
|
+
print_color "$YELLOW" "📦 Installing Node.js via NodeSource repository..."
|
|
145
|
+
|
|
146
|
+
# Detect package manager
|
|
147
|
+
local pkg_manager=""
|
|
148
|
+
if command_exists apt-get; then
|
|
149
|
+
pkg_manager="apt"
|
|
150
|
+
elif command_exists dnf; then
|
|
151
|
+
pkg_manager="dnf"
|
|
152
|
+
elif command_exists yum; then
|
|
153
|
+
pkg_manager="yum"
|
|
154
|
+
elif command_exists zypper; then
|
|
155
|
+
pkg_manager="zypper"
|
|
156
|
+
else
|
|
157
|
+
error_exit "No supported package manager found (apt, dnf, yum, or zypper)"
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Install Node.js based on package manager
|
|
161
|
+
case $pkg_manager in
|
|
162
|
+
apt)
|
|
163
|
+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
|
164
|
+
sudo apt-get install -y nodejs
|
|
165
|
+
;;
|
|
166
|
+
dnf)
|
|
167
|
+
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
|
|
168
|
+
sudo dnf install -y nodejs
|
|
169
|
+
;;
|
|
170
|
+
yum)
|
|
171
|
+
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
|
|
172
|
+
sudo yum install -y nodejs
|
|
173
|
+
;;
|
|
174
|
+
zypper)
|
|
175
|
+
sudo zypper install -y nodejs20
|
|
176
|
+
;;
|
|
177
|
+
esac
|
|
178
|
+
|
|
179
|
+
print_color "$GREEN" "✅ Node.js installed successfully"
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# Fix npm permissions on Linux
|
|
184
|
+
fix_npm_permissions() {
|
|
185
|
+
local os=$1
|
|
186
|
+
if [[ "$os" == "linux" ]] || [[ "$os" == "wsl" ]]; then
|
|
187
|
+
print_color "$YELLOW" "🔧 Configuring npm permissions..."
|
|
188
|
+
mkdir -p ~/.npm-global
|
|
189
|
+
npm config set prefix '~/.npm-global'
|
|
190
|
+
|
|
191
|
+
# Add to PATH if not already there
|
|
192
|
+
if ! echo "$PATH" | grep -q "$HOME/.npm-global/bin"; then
|
|
193
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
|
|
194
|
+
export PATH=~/.npm-global/bin:$PATH
|
|
195
|
+
|
|
196
|
+
# Also update .zshrc if it exists
|
|
197
|
+
if [[ -f ~/.zshrc ]]; then
|
|
198
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
|
|
199
|
+
fi
|
|
200
|
+
fi
|
|
201
|
+
fi
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
# Install Locus
|
|
205
|
+
install_locus() {
|
|
206
|
+
print_color "$YELLOW" "📦 Installing Locus..."
|
|
207
|
+
|
|
208
|
+
# Check if already installed
|
|
209
|
+
if command_exists "$COMMAND_NAME"; then
|
|
210
|
+
print_color "$YELLOW" "🔄 Locus is already installed. Updating to latest version..."
|
|
211
|
+
npm update -g "$NPM_PACKAGE"
|
|
212
|
+
else
|
|
213
|
+
npm install -g "$NPM_PACKAGE"
|
|
214
|
+
fi
|
|
215
|
+
|
|
216
|
+
print_color "$GREEN" "✅ Locus installed successfully"
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
# Verify installation
|
|
220
|
+
verify_installation() {
|
|
221
|
+
print_color "$YELLOW" "🔍 Verifying installation..."
|
|
222
|
+
|
|
223
|
+
# Check Node.js
|
|
224
|
+
if ! command_exists node; then
|
|
225
|
+
error_exit "Node.js installation verification failed"
|
|
226
|
+
fi
|
|
227
|
+
|
|
228
|
+
# Check npm
|
|
229
|
+
if ! command_exists npm; then
|
|
230
|
+
error_exit "npm installation verification failed"
|
|
231
|
+
fi
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
# Check locus
|
|
235
|
+
if ! command_exists "$COMMAND_NAME"; then
|
|
236
|
+
# Try with full path for Linux/WSL
|
|
237
|
+
if [[ -f ~/.npm-global/bin/$COMMAND_NAME ]]; then
|
|
238
|
+
print_color "$GREEN" "✅ Locus installed at ~/.npm-global/bin/$COMMAND_NAME"
|
|
239
|
+
print_color "$YELLOW" " Please restart your terminal or run: source ~/.bashrc"
|
|
240
|
+
else
|
|
241
|
+
error_exit "Locus installation verification failed"
|
|
242
|
+
fi
|
|
243
|
+
else
|
|
244
|
+
local version=$($COMMAND_NAME --version 2>/dev/null || echo "unknown")
|
|
245
|
+
print_color "$GREEN" "✅ Locus v$version is ready to use!"
|
|
246
|
+
fi
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
# Print usage instructions
|
|
250
|
+
print_usage() {
|
|
251
|
+
echo ""
|
|
252
|
+
print_color "$BLUE" "🎉 Installation complete!"
|
|
253
|
+
echo ""
|
|
254
|
+
print_color "$CYAN" "📖 Quick Start:"
|
|
255
|
+
echo ""
|
|
256
|
+
echo " Start a terminal session:"
|
|
257
|
+
print_color "$GREEN" " $COMMAND_NAME"
|
|
258
|
+
echo ""
|
|
259
|
+
echo " Start with a specific command:"
|
|
260
|
+
print_color "$GREEN" " $COMMAND_NAME claude"
|
|
261
|
+
print_color "$GREEN" " $COMMAND_NAME python"
|
|
262
|
+
echo ""
|
|
263
|
+
echo " Start with a custom PIN:"
|
|
264
|
+
print_color "$GREEN" " $COMMAND_NAME --pin 123456"
|
|
265
|
+
echo ""
|
|
266
|
+
print_color "$CYAN" "📱 Then scan the QR code with your phone to access your terminal!"
|
|
267
|
+
echo ""
|
|
268
|
+
print_color "$MAGENTA" "📚 Documentation: https://github.com/leverageaiapp/Locus"
|
|
269
|
+
echo ""
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
# Main installation flow
|
|
273
|
+
main() {
|
|
274
|
+
print_banner
|
|
275
|
+
|
|
276
|
+
# Detect system
|
|
277
|
+
local os=$(detect_os)
|
|
278
|
+
local arch=$(detect_arch)
|
|
279
|
+
|
|
280
|
+
print_color "$BLUE" "🖥️ Detected: $os ($arch)"
|
|
281
|
+
echo ""
|
|
282
|
+
|
|
283
|
+
# Check and install Node.js if needed
|
|
284
|
+
local node_version=$(get_node_version)
|
|
285
|
+
version_compare "$node_version" "$NODEJS_MIN_VERSION"
|
|
286
|
+
local version_check=$?
|
|
287
|
+
|
|
288
|
+
if [[ $version_check -eq 2 ]]; then
|
|
289
|
+
print_color "$YELLOW" "📦 Node.js $node_version is installed but version $NODEJS_MIN_VERSION+ is required"
|
|
290
|
+
|
|
291
|
+
case $os in
|
|
292
|
+
macos)
|
|
293
|
+
install_nodejs_macos
|
|
294
|
+
;;
|
|
295
|
+
linux|wsl)
|
|
296
|
+
install_nodejs_linux
|
|
297
|
+
;;
|
|
298
|
+
esac
|
|
299
|
+
elif [[ "$node_version" == "0" ]]; then
|
|
300
|
+
print_color "$YELLOW" "📦 Node.js is not installed. Installing..."
|
|
301
|
+
|
|
302
|
+
case $os in
|
|
303
|
+
macos)
|
|
304
|
+
install_nodejs_macos
|
|
305
|
+
;;
|
|
306
|
+
linux|wsl)
|
|
307
|
+
install_nodejs_linux
|
|
308
|
+
;;
|
|
309
|
+
esac
|
|
310
|
+
else
|
|
311
|
+
print_color "$GREEN" "✅ Node.js $node_version is already installed"
|
|
312
|
+
fi
|
|
313
|
+
|
|
314
|
+
# Fix npm permissions on Linux/WSL
|
|
315
|
+
fix_npm_permissions "$os"
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
# Install Locus
|
|
319
|
+
install_locus
|
|
320
|
+
|
|
321
|
+
# Verify installation
|
|
322
|
+
verify_installation
|
|
323
|
+
|
|
324
|
+
# Print usage instructions
|
|
325
|
+
print_usage
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
# Run main function
|
|
329
|
+
main "$@"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverageaiapps/locus",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Forward your terminal to your mobile device. Code anywhere from your pocket.",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Locus - Forward your terminal to your mobile device. Code anywhere from your pocket.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"locus": "./dist/index.js"
|
|
@@ -21,12 +21,14 @@
|
|
|
21
21
|
"vortex",
|
|
22
22
|
"tunnel",
|
|
23
23
|
"remote",
|
|
24
|
-
"
|
|
24
|
+
"ssh",
|
|
25
25
|
"cli",
|
|
26
26
|
"claude-code",
|
|
27
27
|
"ai",
|
|
28
28
|
"coding",
|
|
29
|
-
"locus"
|
|
29
|
+
"locus",
|
|
30
|
+
"no-ansi",
|
|
31
|
+
"clean-output"
|
|
30
32
|
],
|
|
31
33
|
"author": "LeverageAI Apps",
|
|
32
34
|
"license": "MIT",
|
|
@@ -64,4 +66,4 @@
|
|
|
64
66
|
"url": "https://github.com/leverageaiapp/Locus/issues"
|
|
65
67
|
},
|
|
66
68
|
"homepage": "https://github.com/leverageaiapp/Locus#readme"
|
|
67
|
-
}
|
|
69
|
+
}
|