nexrall-code 0.5.2
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/dist/index.js +24453 -0
- package/install.ps1 +110 -0
- package/install.sh +164 -0
- package/package.json +57 -0
package/install.ps1
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Nexrall Code CLI — Windows Installer
|
|
2
|
+
# Usage: irm https://nexrall.com/install.ps1 | iex
|
|
3
|
+
#
|
|
4
|
+
# What it does:
|
|
5
|
+
# 1. Check Node.js >= 18
|
|
6
|
+
# 2. Download latest nex binary from Nexrall CDN
|
|
7
|
+
# 3. Install to %LOCALAPPDATA%\nexrall-cli\nex.js
|
|
8
|
+
# 4. Add to PATH via User environment variable
|
|
9
|
+
# 5. Create nex.cmd wrapper so "nex" works in CMD + PowerShell
|
|
10
|
+
|
|
11
|
+
$ErrorActionPreference = 'Stop'
|
|
12
|
+
|
|
13
|
+
$API_LATEST = 'https://api.nexrall.com/api/code/cli/latest'
|
|
14
|
+
$INSTALL_DIR = "$env:LOCALAPPDATA\nexrall-cli"
|
|
15
|
+
$BINARY_JS = "$INSTALL_DIR\nex.js"
|
|
16
|
+
$WRAPPER_CMD = "$INSTALL_DIR\nex.cmd"
|
|
17
|
+
|
|
18
|
+
Write-Host ""
|
|
19
|
+
Write-Host " Nexrall Code CLI — Installer" -ForegroundColor Cyan -NoNewline
|
|
20
|
+
Write-Host ""
|
|
21
|
+
Write-Host " ────────────────────────────────────" -ForegroundColor DarkGray
|
|
22
|
+
Write-Host ""
|
|
23
|
+
|
|
24
|
+
# ── Node.js check ─────────────────────────────────────────────────────────────
|
|
25
|
+
try {
|
|
26
|
+
$nodeVersion = (node --version 2>$null)
|
|
27
|
+
if (-not $nodeVersion) { throw "not found" }
|
|
28
|
+
$nodeMajor = [int]($nodeVersion.TrimStart('v').Split('.')[0])
|
|
29
|
+
if ($nodeMajor -lt 18) {
|
|
30
|
+
Write-Host " ✗ Node.js 18+ required. Found: $nodeVersion" -ForegroundColor Red
|
|
31
|
+
Write-Host " Download from: https://nodejs.org" -ForegroundColor DarkGray
|
|
32
|
+
exit 1
|
|
33
|
+
}
|
|
34
|
+
Write-Host " ✓ Node.js $nodeVersion" -ForegroundColor Green
|
|
35
|
+
} catch {
|
|
36
|
+
Write-Host " ✗ Node.js not found. Please install Node.js 18+ from https://nodejs.org" -ForegroundColor Red
|
|
37
|
+
exit 1
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# ── Fetch latest version ───────────────────────────────────────────────────────
|
|
41
|
+
Write-Host " → Checking latest version…" -ForegroundColor DarkGray
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
$meta = Invoke-RestMethod -Uri $API_LATEST -UseBasicParsing
|
|
45
|
+
$version = $meta.version
|
|
46
|
+
$binaryUrl = $meta.url
|
|
47
|
+
} catch {
|
|
48
|
+
# Fallback
|
|
49
|
+
$version = "latest"
|
|
50
|
+
$binaryUrl = "https://media.nexrall.com/cli/nex"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Write-Host " → Version: $version" -ForegroundColor DarkGray
|
|
54
|
+
Write-Host " → Download: $binaryUrl" -ForegroundColor DarkGray
|
|
55
|
+
|
|
56
|
+
# ── Download binary ───────────────────────────────────────────────────────────
|
|
57
|
+
Write-Host " → Downloading…" -ForegroundColor DarkGray
|
|
58
|
+
|
|
59
|
+
New-Item -ItemType Directory -Force -Path $INSTALL_DIR | Out-Null
|
|
60
|
+
$TMP = "$env:TEMP\nex_tmp.js"
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
Invoke-WebRequest -Uri $binaryUrl -OutFile $TMP -UseBasicParsing
|
|
64
|
+
} catch {
|
|
65
|
+
Write-Host " ✗ Download failed: $_" -ForegroundColor Red
|
|
66
|
+
exit 1
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Sanity check
|
|
70
|
+
$checkOutput = node $TMP --version 2>&1
|
|
71
|
+
if ($LASTEXITCODE -ne 0) {
|
|
72
|
+
Remove-Item $TMP -Force
|
|
73
|
+
Write-Host " ✗ Downloaded binary failed sanity check." -ForegroundColor Red
|
|
74
|
+
exit 1
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# ── Install ───────────────────────────────────────────────────────────────────
|
|
78
|
+
Move-Item $TMP $BINARY_JS -Force
|
|
79
|
+
|
|
80
|
+
# Create nex.cmd wrapper so CMD/PowerShell can run "nex" directly
|
|
81
|
+
$wrapperContent = "@echo off`r`nnode `"%~dp0nex.js`" %*"
|
|
82
|
+
Set-Content -Path $WRAPPER_CMD -Value $wrapperContent -Encoding ASCII
|
|
83
|
+
|
|
84
|
+
Write-Host " ✓ Installed to $INSTALL_DIR" -ForegroundColor Green
|
|
85
|
+
|
|
86
|
+
# ── Add to PATH ───────────────────────────────────────────────────────────────
|
|
87
|
+
$userPath = [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
88
|
+
if ($userPath -notlike "*$INSTALL_DIR*") {
|
|
89
|
+
[System.Environment]::SetEnvironmentVariable(
|
|
90
|
+
'PATH',
|
|
91
|
+
"$INSTALL_DIR;$userPath",
|
|
92
|
+
'User'
|
|
93
|
+
)
|
|
94
|
+
Write-Host " ✓ Added to PATH (restart your terminal to apply)" -ForegroundColor Green
|
|
95
|
+
} else {
|
|
96
|
+
Write-Host " ✓ Already in PATH" -ForegroundColor Green
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# ── Done ──────────────────────────────────────────────────────────────────────
|
|
100
|
+
Write-Host ""
|
|
101
|
+
Write-Host " Nexrall Code CLI installed successfully!" -ForegroundColor Green
|
|
102
|
+
Write-Host ""
|
|
103
|
+
Write-Host " Next steps (open a new terminal window):" -ForegroundColor DarkGray
|
|
104
|
+
Write-Host " nex auth " -ForegroundColor Cyan -NoNewline
|
|
105
|
+
Write-Host "# Login to your Nexrall account" -ForegroundColor DarkGray
|
|
106
|
+
Write-Host " nex " -ForegroundColor Cyan -NoNewline
|
|
107
|
+
Write-Host "# Start chatting with AI" -ForegroundColor DarkGray
|
|
108
|
+
Write-Host " nex `"fix this`" " -ForegroundColor Cyan -NoNewline
|
|
109
|
+
Write-Host "# One-shot prompt" -ForegroundColor DarkGray
|
|
110
|
+
Write-Host ""
|
package/install.sh
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# Nexrall Code CLI — installer
|
|
3
|
+
# Usage: curl -fsSL https://nexrall.com/install.sh | sh
|
|
4
|
+
#
|
|
5
|
+
# What it does:
|
|
6
|
+
# 1. Detect OS / arch
|
|
7
|
+
# 2. Check Node.js >= 18
|
|
8
|
+
# 3. Download the latest nex binary from Nexrall CDN
|
|
9
|
+
# 4. Install to /usr/local/bin/nex (or ~/bin/nex if no write permission)
|
|
10
|
+
# 5. Print next steps
|
|
11
|
+
|
|
12
|
+
set -e
|
|
13
|
+
|
|
14
|
+
BINARY_NAME="nex"
|
|
15
|
+
CDN_BASE="https://cli.nexrall.com"
|
|
16
|
+
API_LATEST="https://api.nexrall.com/api/code/cli/latest"
|
|
17
|
+
INSTALL_DIR="/usr/local/bin"
|
|
18
|
+
|
|
19
|
+
# ── Colors ────────────────────────────────────────────────────────────────────
|
|
20
|
+
bold=""
|
|
21
|
+
dim=""
|
|
22
|
+
green=""
|
|
23
|
+
red=""
|
|
24
|
+
cyan=""
|
|
25
|
+
reset=""
|
|
26
|
+
if [ -t 1 ]; then
|
|
27
|
+
bold="\033[1m"
|
|
28
|
+
dim="\033[2m"
|
|
29
|
+
green="\033[32m"
|
|
30
|
+
red="\033[31m"
|
|
31
|
+
cyan="\033[36m"
|
|
32
|
+
reset="\033[0m"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
info() { printf "${cyan} →${reset} %s\n" "$*"; }
|
|
36
|
+
success() { printf "${green} ✓${reset} %s\n" "$*"; }
|
|
37
|
+
error() { printf "${red} ✗${reset} %s\n" "$*" >&2; }
|
|
38
|
+
fatal() { error "$*"; exit 1; }
|
|
39
|
+
|
|
40
|
+
# ── Banner ────────────────────────────────────────────────────────────────────
|
|
41
|
+
printf "\n"
|
|
42
|
+
printf "${bold} Nexrall Code CLI — Installer${reset}\n"
|
|
43
|
+
printf "${dim} ────────────────────────────────────${reset}\n\n"
|
|
44
|
+
|
|
45
|
+
# ── OS detection ──────────────────────────────────────────────────────────────
|
|
46
|
+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
47
|
+
ARCH=$(uname -m)
|
|
48
|
+
|
|
49
|
+
case "$OS" in
|
|
50
|
+
darwin) PLATFORM="macos" ;;
|
|
51
|
+
linux) PLATFORM="linux" ;;
|
|
52
|
+
*) fatal "Unsupported OS: $OS. Please install manually." ;;
|
|
53
|
+
esac
|
|
54
|
+
|
|
55
|
+
case "$ARCH" in
|
|
56
|
+
x86_64|amd64) ARCH_TAG="x64" ;;
|
|
57
|
+
arm64|aarch64) ARCH_TAG="arm64" ;;
|
|
58
|
+
*) ARCH_TAG="x64" ;; # fallback
|
|
59
|
+
esac
|
|
60
|
+
|
|
61
|
+
info "Detected: ${PLATFORM} / ${ARCH_TAG}"
|
|
62
|
+
|
|
63
|
+
# ── Node.js check ─────────────────────────────────────────────────────────────
|
|
64
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
65
|
+
printf "\n"
|
|
66
|
+
error "Node.js not found. Nexrall CLI requires Node.js 18+."
|
|
67
|
+
printf "\n"
|
|
68
|
+
printf " Install Node.js from: ${cyan}https://nodejs.org${reset}\n"
|
|
69
|
+
printf " Or with nvm: ${dim}curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash${reset}\n"
|
|
70
|
+
printf " Then re-run this installer.\n\n"
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
NODE_MAJOR=$(node -e "process.stdout.write(process.versions.node.split('.')[0])")
|
|
75
|
+
if [ "$NODE_MAJOR" -lt 18 ]; then
|
|
76
|
+
fatal "Node.js 18+ required. Found: $(node --version). Please upgrade."
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
success "Node.js $(node --version)"
|
|
80
|
+
|
|
81
|
+
# ── Fetch latest version ───────────────────────────────────────────────────────
|
|
82
|
+
info "Checking latest version…"
|
|
83
|
+
|
|
84
|
+
if command -v curl >/dev/null 2>&1; then
|
|
85
|
+
LATEST_JSON=$(curl -fsSL "$API_LATEST" 2>/dev/null || echo '{}')
|
|
86
|
+
elif command -v wget >/dev/null 2>&1; then
|
|
87
|
+
LATEST_JSON=$(wget -qO- "$API_LATEST" 2>/dev/null || echo '{}')
|
|
88
|
+
else
|
|
89
|
+
fatal "curl or wget is required to download the installer."
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# Parse version from JSON (simple sed, no jq dependency)
|
|
93
|
+
VERSION=$(echo "$LATEST_JSON" | sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)
|
|
94
|
+
BINARY_URL=$(echo "$LATEST_JSON" | sed -n 's/.*"url"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)
|
|
95
|
+
|
|
96
|
+
if [ -z "$VERSION" ] || [ -z "$BINARY_URL" ]; then
|
|
97
|
+
# Fallback: construct URL directly (single universal Node.js binary)
|
|
98
|
+
VERSION="latest"
|
|
99
|
+
BINARY_URL="${CDN_BASE}/nex"
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
info "Version: ${VERSION}"
|
|
103
|
+
info "Download: ${BINARY_URL}"
|
|
104
|
+
|
|
105
|
+
# ── Download binary ───────────────────────────────────────────────────────────
|
|
106
|
+
TMP_FILE=$(mktemp /tmp/nex_XXXXXX)
|
|
107
|
+
|
|
108
|
+
info "Downloading…"
|
|
109
|
+
if command -v curl >/dev/null 2>&1; then
|
|
110
|
+
curl -fsSL --progress-bar "$BINARY_URL" -o "$TMP_FILE"
|
|
111
|
+
elif command -v wget >/dev/null 2>&1; then
|
|
112
|
+
wget -q --show-progress "$BINARY_URL" -O "$TMP_FILE"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
chmod +x "$TMP_FILE"
|
|
116
|
+
|
|
117
|
+
# Quick sanity check
|
|
118
|
+
if ! node "$TMP_FILE" --version >/dev/null 2>&1; then
|
|
119
|
+
rm -f "$TMP_FILE"
|
|
120
|
+
fatal "Downloaded binary failed sanity check. Please try again."
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# ── Install ───────────────────────────────────────────────────────────────────
|
|
124
|
+
TARGET="${INSTALL_DIR}/${BINARY_NAME}"
|
|
125
|
+
|
|
126
|
+
if [ -w "$INSTALL_DIR" ]; then
|
|
127
|
+
mv "$TMP_FILE" "$TARGET"
|
|
128
|
+
success "Installed to ${TARGET}"
|
|
129
|
+
else
|
|
130
|
+
# Try sudo
|
|
131
|
+
if command -v sudo >/dev/null 2>&1; then
|
|
132
|
+
info "Need sudo to write to ${INSTALL_DIR}…"
|
|
133
|
+
sudo mv "$TMP_FILE" "$TARGET"
|
|
134
|
+
sudo chmod +x "$TARGET"
|
|
135
|
+
success "Installed to ${TARGET} (via sudo)"
|
|
136
|
+
else
|
|
137
|
+
# Fallback: ~/bin
|
|
138
|
+
FALLBACK_DIR="$HOME/.local/bin"
|
|
139
|
+
mkdir -p "$FALLBACK_DIR"
|
|
140
|
+
mv "$TMP_FILE" "${FALLBACK_DIR}/${BINARY_NAME}"
|
|
141
|
+
chmod +x "${FALLBACK_DIR}/${BINARY_NAME}"
|
|
142
|
+
TARGET="${FALLBACK_DIR}/${BINARY_NAME}"
|
|
143
|
+
success "Installed to ${TARGET}"
|
|
144
|
+
|
|
145
|
+
# Check if fallback dir is on PATH
|
|
146
|
+
case ":$PATH:" in
|
|
147
|
+
*":${FALLBACK_DIR}:"*) ;;
|
|
148
|
+
*)
|
|
149
|
+
printf "\n"
|
|
150
|
+
printf " ${dim}Add this to your shell profile (~/.zshrc or ~/.bashrc):${reset}\n"
|
|
151
|
+
printf " ${cyan}export PATH=\"\$HOME/.local/bin:\$PATH\"${reset}\n"
|
|
152
|
+
;;
|
|
153
|
+
esac
|
|
154
|
+
fi
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
# ── Done ──────────────────────────────────────────────────────────────────────
|
|
158
|
+
printf "\n"
|
|
159
|
+
printf "${bold}${green} Nexrall Code CLI installed successfully!${reset}\n\n"
|
|
160
|
+
printf " ${dim}Next steps:${reset}\n"
|
|
161
|
+
printf " ${cyan}nex auth${reset} ${dim}# Login to your Nexrall account${reset}\n"
|
|
162
|
+
printf " ${cyan}nex${reset} ${dim}# Start chatting with AI${reset}\n"
|
|
163
|
+
printf " ${cyan}nex \"fix this\"${reset} ${dim}# One-shot prompt${reset}\n"
|
|
164
|
+
printf "\n"
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nexrall-code",
|
|
3
|
+
"version": "0.5.2",
|
|
4
|
+
"description": "Nexrall Code — AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"cli",
|
|
8
|
+
"coding-agent",
|
|
9
|
+
"nexrall",
|
|
10
|
+
"claude",
|
|
11
|
+
"automation",
|
|
12
|
+
"ci"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://nexrall.com",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/nexrall/nexrall-code.git",
|
|
18
|
+
"directory": "packages/cli"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bin": {
|
|
22
|
+
"nex": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"main": "dist/index.js",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"install.sh",
|
|
28
|
+
"install.ps1"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"chalk": "^5.3.0",
|
|
35
|
+
"commander": "^12.0.0",
|
|
36
|
+
"diff": "^5.2.0",
|
|
37
|
+
"ora": "^8.0.1",
|
|
38
|
+
"prompts": "^2.4.2",
|
|
39
|
+
"readline": "^1.3.0",
|
|
40
|
+
"@nexrall/code-core": "1.4.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@aws-sdk/client-s3": "^3.600.0",
|
|
44
|
+
"@types/diff": "^5.2.1",
|
|
45
|
+
"@types/node": "^20.0.0",
|
|
46
|
+
"@types/prompts": "^2.4.9",
|
|
47
|
+
"esbuild": "^0.20.0",
|
|
48
|
+
"tsx": "^4.7.0",
|
|
49
|
+
"typescript": "^6.0.3"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "node build.js",
|
|
53
|
+
"dev": "tsx src/index.ts",
|
|
54
|
+
"start": "node dist/index.js",
|
|
55
|
+
"release": "node build.js && node scripts/upload-release.js"
|
|
56
|
+
}
|
|
57
|
+
}
|