vigthoria-cli 1.9.5 → 1.9.9
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/dist/commands/auth.js +87 -8
- package/dist/commands/bridge.js +3 -8
- package/dist/commands/chat.js +31 -19
- package/dist/commands/legion.js +20 -11
- package/dist/commands/security.d.ts +20 -0
- package/dist/commands/security.js +98 -0
- package/dist/index.js +41 -15
- package/dist/utils/api.d.ts +6 -5
- package/dist/utils/api.js +166 -48
- package/dist/utils/config.js +1 -1
- package/dist/utils/tools.js +29 -5
- package/install.ps1 +322 -0
- package/install.sh +314 -0
- package/package.json +12 -3
- package/scripts/release/LOCAL_MACHINE_USER_VERIFICATION.md +159 -0
- package/scripts/release/publish-cli-release.sh +73 -0
- package/scripts/release/validate-no-go-gates.sh +129 -0
- package/scripts/release/verify-runtime-consistency.mjs +64 -0
package/install.ps1
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Vigthoria CLI Installer for Windows
|
|
2
|
+
# Usage: irm https://cli.vigthoria.io/install.ps1 | iex
|
|
3
|
+
# Alternative: PowerShell -ExecutionPolicy Bypass -File install.ps1
|
|
4
|
+
|
|
5
|
+
$ErrorActionPreference = "Stop"
|
|
6
|
+
|
|
7
|
+
# Configuration
|
|
8
|
+
$CLI_VERSION = "1.9.1"
|
|
9
|
+
$INSTALL_DIR = "$env:USERPROFILE\.vigthoria"
|
|
10
|
+
$NPM_PACKAGE = "vigthoria-cli"
|
|
11
|
+
$GIT_PACKAGE_URL = "git+https://market.vigthoria.io/vigthoria/vigthoria-cli.git"
|
|
12
|
+
$HOSTED_TARBALL_URL = "https://coder.vigthoria.io/releases/vigthoria-cli-$CLI_VERSION.tgz"
|
|
13
|
+
|
|
14
|
+
function Write-Banner {
|
|
15
|
+
Write-Host ""
|
|
16
|
+
Write-Host " ╔═══════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
|
|
17
|
+
Write-Host " ║ ║" -ForegroundColor Cyan
|
|
18
|
+
Write-Host " ║ VIGTHORIA CLI INSTALLER v$CLI_VERSION ║" -ForegroundColor Cyan
|
|
19
|
+
Write-Host " ║ AI-Powered Terminal Coding Assistant ║" -ForegroundColor Cyan
|
|
20
|
+
Write-Host " ║ ║" -ForegroundColor Cyan
|
|
21
|
+
Write-Host " ╚═══════════════════════════════════════════════════════════╝" -ForegroundColor Cyan
|
|
22
|
+
Write-Host ""
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function Test-NetworkConnectivity {
|
|
26
|
+
Write-Host "🔍 Checking network connectivity..." -ForegroundColor Yellow
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
$response = Invoke-WebRequest -Uri $HOSTED_TARBALL_URL -Method Head -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop
|
|
30
|
+
Write-Host "✓ hosted CLI package is reachable" -ForegroundColor Green
|
|
31
|
+
return $true
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
Write-Host "⚠ Hosted package unavailable, checking npm registry..." -ForegroundColor Yellow
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
$response = Invoke-WebRequest -Uri "https://registry.npmjs.org/vigthoria-cli" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop
|
|
39
|
+
Write-Host "✓ npm registry is reachable" -ForegroundColor Green
|
|
40
|
+
return $true
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
Write-Host "✗ Cannot reach hosted package or npm registry" -ForegroundColor Red
|
|
44
|
+
return $false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function Test-Prerequisites {
|
|
49
|
+
Write-Host "🔍 Checking prerequisites..." -ForegroundColor Yellow
|
|
50
|
+
|
|
51
|
+
# Check Node.js
|
|
52
|
+
try {
|
|
53
|
+
$nodeVersion = node -v 2>$null
|
|
54
|
+
if ($nodeVersion) {
|
|
55
|
+
$major = [int]($nodeVersion -replace 'v(\d+)\..*', '$1')
|
|
56
|
+
if ($major -ge 18) {
|
|
57
|
+
Write-Host "✓ Node.js $nodeVersion" -ForegroundColor Green
|
|
58
|
+
} else {
|
|
59
|
+
Write-Host "✗ Node.js 18+ required (found $nodeVersion)" -ForegroundColor Red
|
|
60
|
+
Write-Host " Download from: https://nodejs.org/" -ForegroundColor Yellow
|
|
61
|
+
return $false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
Write-Host "✗ Node.js is not installed" -ForegroundColor Red
|
|
67
|
+
Write-Host ""
|
|
68
|
+
Write-Host "Please install Node.js first:" -ForegroundColor Yellow
|
|
69
|
+
Write-Host " Option 1: winget install OpenJS.NodeJS" -ForegroundColor White
|
|
70
|
+
Write-Host " Option 2: Download from https://nodejs.org/" -ForegroundColor White
|
|
71
|
+
Write-Host ""
|
|
72
|
+
return $false
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
# Check npm
|
|
76
|
+
try {
|
|
77
|
+
$npmVersion = npm -v 2>$null
|
|
78
|
+
if ($npmVersion) {
|
|
79
|
+
Write-Host "✓ npm v$npmVersion" -ForegroundColor Green
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
Write-Host "✗ npm is not installed" -ForegroundColor Red
|
|
84
|
+
return $false
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return $true
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function Install-VigthoriaCLI-NPM {
|
|
91
|
+
Write-Host ""
|
|
92
|
+
Write-Host "📦 Installing Vigthoria CLI..." -ForegroundColor Cyan
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
npm install -g $HOSTED_TARBALL_URL
|
|
96
|
+
Write-Host "✓ Vigthoria CLI installed successfully!" -ForegroundColor Green
|
|
97
|
+
return $true
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
Write-Host "⚠ Hosted package install failed, trying npm registry..." -ForegroundColor Yellow
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
npm install -g vigthoria-cli
|
|
105
|
+
Write-Host "✓ Vigthoria CLI installed successfully!" -ForegroundColor Green
|
|
106
|
+
return $true
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
Write-Host "⚠ npm registry install failed, trying git package..." -ForegroundColor Yellow
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
npm install -g $GIT_PACKAGE_URL
|
|
114
|
+
Write-Host "✓ Vigthoria CLI installed successfully from git package!" -ForegroundColor Green
|
|
115
|
+
return $true
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
Write-Host "✗ install failed (hosted package + npm registry + git package): $_" -ForegroundColor Red
|
|
119
|
+
return $false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function Install-VigthoriaCLI-Direct {
|
|
124
|
+
Write-Host ""
|
|
125
|
+
Write-Host "📦 Installing Vigthoria CLI (Direct Download)..." -ForegroundColor Cyan
|
|
126
|
+
|
|
127
|
+
# Create install directory
|
|
128
|
+
if (-not (Test-Path $INSTALL_DIR)) {
|
|
129
|
+
New-Item -ItemType Directory -Path $INSTALL_DIR -Force | Out-Null
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
$tarballUrl = $HOSTED_TARBALL_URL
|
|
133
|
+
$tarballPath = "$INSTALL_DIR\vigthoria-cli.tgz"
|
|
134
|
+
$extractPath = "$INSTALL_DIR\cli"
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
# Download tarball
|
|
138
|
+
Write-Host " Downloading from $tarballUrl..." -ForegroundColor Gray
|
|
139
|
+
Invoke-WebRequest -Uri $tarballUrl -OutFile $tarballPath -UseBasicParsing
|
|
140
|
+
|
|
141
|
+
# Extract
|
|
142
|
+
Write-Host " Extracting..." -ForegroundColor Gray
|
|
143
|
+
if (Test-Path $extractPath) {
|
|
144
|
+
Remove-Item -Recurse -Force $extractPath
|
|
145
|
+
}
|
|
146
|
+
New-Item -ItemType Directory -Path $extractPath -Force | Out-Null
|
|
147
|
+
|
|
148
|
+
# Use tar to extract (available in Windows 10+)
|
|
149
|
+
tar -xzf $tarballPath -C $extractPath
|
|
150
|
+
|
|
151
|
+
# The tarball extracts to a 'package' folder
|
|
152
|
+
$packagePath = "$extractPath\package"
|
|
153
|
+
|
|
154
|
+
# Install dependencies
|
|
155
|
+
Write-Host " Installing dependencies..." -ForegroundColor Gray
|
|
156
|
+
Push-Location $packagePath
|
|
157
|
+
npm install --production
|
|
158
|
+
Pop-Location
|
|
159
|
+
|
|
160
|
+
# Create batch file wrapper
|
|
161
|
+
$batContent = @"
|
|
162
|
+
@echo off
|
|
163
|
+
node "$packagePath\dist\index.js" %*
|
|
164
|
+
"@
|
|
165
|
+
Set-Content -Path "$INSTALL_DIR\vigthoria.bat" -Value $batContent
|
|
166
|
+
Set-Content -Path "$INSTALL_DIR\vig.bat" -Value $batContent
|
|
167
|
+
|
|
168
|
+
# Add to PATH if not already there
|
|
169
|
+
$userPath = [Environment]::GetEnvironmentVariable("PATH", "User")
|
|
170
|
+
if ($userPath -notlike "*$INSTALL_DIR*") {
|
|
171
|
+
[Environment]::SetEnvironmentVariable("PATH", "$userPath;$INSTALL_DIR", "User")
|
|
172
|
+
Write-Host " Added $INSTALL_DIR to PATH" -ForegroundColor Gray
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
# Cleanup
|
|
176
|
+
Remove-Item $tarballPath -Force
|
|
177
|
+
|
|
178
|
+
Write-Host "✓ Vigthoria CLI installed successfully!" -ForegroundColor Green
|
|
179
|
+
return $true
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
Write-Host "✗ Direct install failed: $_" -ForegroundColor Red
|
|
183
|
+
return $false
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function Install-VigthoriaCLI-GitHub {
|
|
188
|
+
Write-Host ""
|
|
189
|
+
Write-Host "📦 Installing Vigthoria CLI (from Vigthoria Market)..." -ForegroundColor Cyan
|
|
190
|
+
|
|
191
|
+
# Create install directory
|
|
192
|
+
if (-not (Test-Path $INSTALL_DIR)) {
|
|
193
|
+
New-Item -ItemType Directory -Path $INSTALL_DIR -Force | Out-Null
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
$clonePath = "$INSTALL_DIR\cli"
|
|
197
|
+
|
|
198
|
+
try {
|
|
199
|
+
# Check if git is available
|
|
200
|
+
$gitVersion = git --version 2>$null
|
|
201
|
+
if (-not $gitVersion) {
|
|
202
|
+
Write-Host "✗ Git is not installed" -ForegroundColor Red
|
|
203
|
+
return $false
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
# Clone repository
|
|
207
|
+
if (Test-Path $clonePath) {
|
|
208
|
+
Remove-Item -Recurse -Force $clonePath
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
Write-Host " Cloning from Vigthoria Market..." -ForegroundColor Gray
|
|
212
|
+
git clone --depth 1 https://market.vigthoria.io/vigthoria/vigthoria-cli.git $clonePath
|
|
213
|
+
|
|
214
|
+
# Install and build
|
|
215
|
+
Push-Location $clonePath
|
|
216
|
+
Write-Host " Installing dependencies..." -ForegroundColor Gray
|
|
217
|
+
npm install
|
|
218
|
+
Write-Host " Building..." -ForegroundColor Gray
|
|
219
|
+
npm run build
|
|
220
|
+
Write-Host " Linking globally..." -ForegroundColor Gray
|
|
221
|
+
npm link
|
|
222
|
+
Pop-Location
|
|
223
|
+
|
|
224
|
+
Write-Host "✓ Vigthoria CLI installed successfully!" -ForegroundColor Green
|
|
225
|
+
return $true
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
Write-Host "✗ GitHub install failed: $_" -ForegroundColor Red
|
|
229
|
+
return $false
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function Show-NetworkTroubleshooting {
|
|
234
|
+
Write-Host ""
|
|
235
|
+
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Yellow
|
|
236
|
+
Write-Host " NETWORK TROUBLESHOOTING" -ForegroundColor Yellow
|
|
237
|
+
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Yellow
|
|
238
|
+
Write-Host ""
|
|
239
|
+
Write-Host "The hosted package and npm registry could not be reached. Try these solutions:" -ForegroundColor White
|
|
240
|
+
Write-Host ""
|
|
241
|
+
Write-Host "1. Check your internet connection" -ForegroundColor Cyan
|
|
242
|
+
Write-Host " ping registry.npmjs.org" -ForegroundColor Gray
|
|
243
|
+
Write-Host ""
|
|
244
|
+
Write-Host "2. If behind a corporate proxy, configure npm:" -ForegroundColor Cyan
|
|
245
|
+
Write-Host " npm config set proxy http://proxy.company.com:8080" -ForegroundColor Gray
|
|
246
|
+
Write-Host " npm config set https-proxy http://proxy.company.com:8080" -ForegroundColor Gray
|
|
247
|
+
Write-Host ""
|
|
248
|
+
Write-Host "3. Try a different npm registry:" -ForegroundColor Cyan
|
|
249
|
+
Write-Host " npm config set registry https://registry.npmmirror.com" -ForegroundColor Gray
|
|
250
|
+
Write-Host ""
|
|
251
|
+
Write-Host "4. Check Windows Firewall/Antivirus settings" -ForegroundColor Cyan
|
|
252
|
+
Write-Host ""
|
|
253
|
+
Write-Host "5. Try using a VPN" -ForegroundColor Cyan
|
|
254
|
+
Write-Host ""
|
|
255
|
+
Write-Host "6. Manual download alternatives:" -ForegroundColor Cyan
|
|
256
|
+
Write-Host " Hosted package: $HOSTED_TARBALL_URL" -ForegroundColor Gray
|
|
257
|
+
Write-Host " npm package: https://www.npmjs.com/package/vigthoria-cli" -ForegroundColor Gray
|
|
258
|
+
Write-Host " git package: $GIT_PACKAGE_URL" -ForegroundColor Gray
|
|
259
|
+
Write-Host ""
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function Show-Success {
|
|
263
|
+
Write-Host ""
|
|
264
|
+
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Green
|
|
265
|
+
Write-Host " INSTALLATION COMPLETE!" -ForegroundColor Green
|
|
266
|
+
Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Green
|
|
267
|
+
Write-Host ""
|
|
268
|
+
Write-Host " Get started:" -ForegroundColor White
|
|
269
|
+
Write-Host " 1. Open a new terminal" -ForegroundColor Gray
|
|
270
|
+
Write-Host " 2. Login: vigthoria login" -ForegroundColor Gray
|
|
271
|
+
Write-Host " 3. Start: vigthoria chat" -ForegroundColor Gray
|
|
272
|
+
Write-Host " Or local project start: npx vigthoria-chat" -ForegroundColor Gray
|
|
273
|
+
Write-Host ""
|
|
274
|
+
Write-Host " Commands:" -ForegroundColor White
|
|
275
|
+
Write-Host " vigthoria chat - Start AI chat" -ForegroundColor Gray
|
|
276
|
+
Write-Host " vigthoria-chat - Start chat directly" -ForegroundColor Gray
|
|
277
|
+
Write-Host " vigthoria edit - Edit files with AI" -ForegroundColor Gray
|
|
278
|
+
Write-Host " vigthoria repo - Manage cloud repos" -ForegroundColor Gray
|
|
279
|
+
Write-Host " vig --help - Show all commands" -ForegroundColor Gray
|
|
280
|
+
Write-Host ""
|
|
281
|
+
Write-Host " Documentation: https://docs.vigthoria.io/cli" -ForegroundColor Cyan
|
|
282
|
+
Write-Host ""
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
# Main installation flow
|
|
286
|
+
Write-Banner
|
|
287
|
+
|
|
288
|
+
if (-not (Test-Prerequisites)) {
|
|
289
|
+
exit 1
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
$networkOk = Test-NetworkConnectivity
|
|
293
|
+
|
|
294
|
+
if ($networkOk) {
|
|
295
|
+
# Try npm install first
|
|
296
|
+
if (Install-VigthoriaCLI-NPM) {
|
|
297
|
+
Show-Success
|
|
298
|
+
exit 0
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
# Network failed or npm install failed
|
|
303
|
+
Show-NetworkTroubleshooting
|
|
304
|
+
|
|
305
|
+
Write-Host "Would you like to try alternative installation methods?" -ForegroundColor Yellow
|
|
306
|
+
$choice = Read-Host "Enter 'y' to try direct download, 'g' for git clone, or 'n' to exit"
|
|
307
|
+
|
|
308
|
+
switch ($choice.ToLower()) {
|
|
309
|
+
'y' {
|
|
310
|
+
if (Install-VigthoriaCLI-Direct) {
|
|
311
|
+
Show-Success
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
'g' {
|
|
315
|
+
if (Install-VigthoriaCLI-GitHub) {
|
|
316
|
+
Show-Success
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
default {
|
|
320
|
+
Write-Host "Installation cancelled." -ForegroundColor Gray
|
|
321
|
+
}
|
|
322
|
+
}
|
package/install.sh
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Vigthoria CLI Installer
|
|
4
|
+
# Usage: curl -fsSL https://cli.vigthoria.io/install.sh | bash
|
|
5
|
+
#
|
|
6
|
+
# Supports: Linux, macOS (Intel and Apple Silicon)
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
set -e
|
|
10
|
+
|
|
11
|
+
# Colors (with fallback for non-color terminals)
|
|
12
|
+
if [ -t 1 ] && [ "$(tput colors 2>/dev/null || echo 0)" -ge 8 ]; then
|
|
13
|
+
RED='\033[0;31m'
|
|
14
|
+
GREEN='\033[0;32m'
|
|
15
|
+
YELLOW='\033[1;33m'
|
|
16
|
+
CYAN='\033[0;36m'
|
|
17
|
+
WHITE='\033[1;37m'
|
|
18
|
+
NC='\033[0m' # No Color
|
|
19
|
+
else
|
|
20
|
+
RED=''
|
|
21
|
+
GREEN=''
|
|
22
|
+
YELLOW=''
|
|
23
|
+
CYAN=''
|
|
24
|
+
WHITE=''
|
|
25
|
+
NC=''
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Configuration
|
|
29
|
+
CLI_VERSION="1.9.1"
|
|
30
|
+
INSTALL_DIR="$HOME/.vigthoria"
|
|
31
|
+
REPO_URL="https://market.vigthoria.io/vigthoria/vigthoria-cli"
|
|
32
|
+
GIT_PACKAGE_URL="git+https://market.vigthoria.io/vigthoria/vigthoria-cli.git"
|
|
33
|
+
HOSTED_TARBALL_URL="https://coder.vigthoria.io/releases/vigthoria-cli-${CLI_VERSION}.tgz"
|
|
34
|
+
|
|
35
|
+
# Detect platform and set appropriate bin directory
|
|
36
|
+
detect_platform() {
|
|
37
|
+
OS="$(uname -s)"
|
|
38
|
+
ARCH="$(uname -m)"
|
|
39
|
+
|
|
40
|
+
case "$OS" in
|
|
41
|
+
Darwin)
|
|
42
|
+
PLATFORM="macos"
|
|
43
|
+
# macOS: Check if /usr/local/bin is writable, otherwise use ~/.local/bin
|
|
44
|
+
if [ -w "/usr/local/bin" ]; then
|
|
45
|
+
BIN_DIR="/usr/local/bin"
|
|
46
|
+
else
|
|
47
|
+
BIN_DIR="$HOME/.local/bin"
|
|
48
|
+
mkdir -p "$BIN_DIR"
|
|
49
|
+
fi
|
|
50
|
+
;;
|
|
51
|
+
Linux)
|
|
52
|
+
PLATFORM="linux"
|
|
53
|
+
# Linux: Prefer ~/.local/bin for user installs
|
|
54
|
+
if [ -w "/usr/local/bin" ]; then
|
|
55
|
+
BIN_DIR="/usr/local/bin"
|
|
56
|
+
else
|
|
57
|
+
BIN_DIR="$HOME/.local/bin"
|
|
58
|
+
mkdir -p "$BIN_DIR"
|
|
59
|
+
fi
|
|
60
|
+
;;
|
|
61
|
+
*)
|
|
62
|
+
echo -e "${RED}Unsupported operating system: $OS${NC}"
|
|
63
|
+
echo "Please use the npm install method: npm install -g vigthoria-cli"
|
|
64
|
+
exit 1
|
|
65
|
+
;;
|
|
66
|
+
esac
|
|
67
|
+
|
|
68
|
+
echo -e "${CYAN}Detected: $PLATFORM ($ARCH)${NC}"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
echo -e "${CYAN}"
|
|
72
|
+
echo "╔═══════════════════════════════════════════════════════════╗"
|
|
73
|
+
echo "║ ║"
|
|
74
|
+
echo "║ VIGTHORIA CLI INSTALLER v${CLI_VERSION} ║"
|
|
75
|
+
echo "║ AI-Powered Terminal Coding Assistant ║"
|
|
76
|
+
echo "║ ║"
|
|
77
|
+
echo "╚═══════════════════════════════════════════════════════════╝"
|
|
78
|
+
echo -e "${NC}"
|
|
79
|
+
|
|
80
|
+
# Check requirements
|
|
81
|
+
check_requirements() {
|
|
82
|
+
echo -e "${CYAN}Checking requirements...${NC}"
|
|
83
|
+
|
|
84
|
+
detect_platform
|
|
85
|
+
|
|
86
|
+
# Check Node.js
|
|
87
|
+
if ! command -v node &> /dev/null; then
|
|
88
|
+
echo -e "${RED}✗ Node.js is not installed${NC}"
|
|
89
|
+
echo ""
|
|
90
|
+
echo " Please install Node.js 18 or later:"
|
|
91
|
+
if [ "$PLATFORM" = "macos" ]; then
|
|
92
|
+
echo " brew install node"
|
|
93
|
+
echo " or download from: https://nodejs.org/"
|
|
94
|
+
else
|
|
95
|
+
echo " # Ubuntu/Debian:"
|
|
96
|
+
echo " curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -"
|
|
97
|
+
echo " sudo apt-get install -y nodejs"
|
|
98
|
+
echo ""
|
|
99
|
+
echo " # Or download from: https://nodejs.org/"
|
|
100
|
+
fi
|
|
101
|
+
exit 1
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
|
105
|
+
if [ "$NODE_VERSION" -lt 18 ]; then
|
|
106
|
+
echo -e "${RED}✗ Node.js version must be 18 or higher (found: v$NODE_VERSION)${NC}"
|
|
107
|
+
exit 1
|
|
108
|
+
fi
|
|
109
|
+
echo -e "${GREEN}✓ Node.js v$(node -v | cut -d'v' -f2)${NC}"
|
|
110
|
+
|
|
111
|
+
# Check npm
|
|
112
|
+
if ! command -v npm &> /dev/null; then
|
|
113
|
+
echo -e "${RED}✗ npm is not installed${NC}"
|
|
114
|
+
exit 1
|
|
115
|
+
fi
|
|
116
|
+
echo -e "${GREEN}✓ npm v$(npm -v)${NC}"
|
|
117
|
+
|
|
118
|
+
# Check git (optional)
|
|
119
|
+
if command -v git &> /dev/null; then
|
|
120
|
+
echo -e "${GREEN}✓ git v$(git --version | cut -d' ' -f3)${NC}"
|
|
121
|
+
else
|
|
122
|
+
echo -e "${YELLOW}⚠ git not found (optional, for project context)${NC}"
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
echo ""
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
# Install CLI
|
|
129
|
+
install_cli() {
|
|
130
|
+
echo -e "${CYAN}Installing Vigthoria CLI...${NC}"
|
|
131
|
+
|
|
132
|
+
# Create install directory
|
|
133
|
+
mkdir -p "$INSTALL_DIR"
|
|
134
|
+
|
|
135
|
+
# Option 1: Install the hosted release package.
|
|
136
|
+
if curl -fsI "$HOSTED_TARBALL_URL" > /dev/null 2>&1; then
|
|
137
|
+
echo "Installing hosted release package..."
|
|
138
|
+
npm install -g --force "$HOSTED_TARBALL_URL"
|
|
139
|
+
elif npm view vigthoria-cli version &> /dev/null; then
|
|
140
|
+
echo "Installing from npm registry..."
|
|
141
|
+
npm install -g --force vigthoria-cli
|
|
142
|
+
elif npm install -g --force "$GIT_PACKAGE_URL"; then
|
|
143
|
+
echo "Installed from git package fallback."
|
|
144
|
+
else
|
|
145
|
+
# Option 2: Install from local or git
|
|
146
|
+
echo "Installing from source..."
|
|
147
|
+
|
|
148
|
+
# Check if we're in the CLI directory
|
|
149
|
+
if [ -f "package.json" ] && grep -q '"name": "vigthoria-cli"' package.json; then
|
|
150
|
+
echo "Installing from current directory..."
|
|
151
|
+
npm install
|
|
152
|
+
npm run build
|
|
153
|
+
npm link
|
|
154
|
+
else
|
|
155
|
+
# Clone from repo
|
|
156
|
+
echo "Cloning from repository..."
|
|
157
|
+
git clone "$REPO_URL" "$INSTALL_DIR/cli" 2>/dev/null || {
|
|
158
|
+
echo -e "${YELLOW}Repository not available, using local install${NC}"
|
|
159
|
+
# Copy local files for development
|
|
160
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
161
|
+
if [ -d "$SCRIPT_DIR/../src" ]; then
|
|
162
|
+
cp -r "$SCRIPT_DIR/.." "$INSTALL_DIR/cli"
|
|
163
|
+
fi
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if [ -d "$INSTALL_DIR/cli" ]; then
|
|
167
|
+
cd "$INSTALL_DIR/cli"
|
|
168
|
+
npm install
|
|
169
|
+
npm run build
|
|
170
|
+
npm link
|
|
171
|
+
fi
|
|
172
|
+
fi
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
echo -e "${GREEN}✓ Installation complete${NC}"
|
|
176
|
+
echo ""
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
# Create symlinks
|
|
180
|
+
create_symlinks() {
|
|
181
|
+
echo -e "${CYAN}Creating command shortcuts...${NC}"
|
|
182
|
+
|
|
183
|
+
# Check if vigthoria command exists
|
|
184
|
+
if command -v vigthoria &> /dev/null; then
|
|
185
|
+
echo -e "${GREEN}✓ 'vigthoria' command available${NC}"
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
# Create 'vig' alias if not exists
|
|
189
|
+
if ! command -v vig &> /dev/null; then
|
|
190
|
+
if [ -w "$BIN_DIR" ]; then
|
|
191
|
+
ln -sf "$(which vigthoria)" "$BIN_DIR/vig" 2>/dev/null || true
|
|
192
|
+
fi
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
if command -v vig &> /dev/null; then
|
|
196
|
+
echo -e "${GREEN}✓ 'vig' shortcut available${NC}"
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
echo ""
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
# Setup shell completion
|
|
203
|
+
setup_completion() {
|
|
204
|
+
echo -e "${CYAN}Setting up shell completion...${NC}"
|
|
205
|
+
|
|
206
|
+
# Detect shell
|
|
207
|
+
SHELL_NAME=$(basename "$SHELL")
|
|
208
|
+
|
|
209
|
+
case "$SHELL_NAME" in
|
|
210
|
+
bash)
|
|
211
|
+
COMPLETION_FILE="$HOME/.bash_completion.d/vigthoria"
|
|
212
|
+
mkdir -p "$HOME/.bash_completion.d"
|
|
213
|
+
cat > "$COMPLETION_FILE" << 'EOF'
|
|
214
|
+
_vigthoria_completions() {
|
|
215
|
+
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
216
|
+
local commands="chat edit generate explain fix review login logout status config init"
|
|
217
|
+
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
|
|
218
|
+
}
|
|
219
|
+
complete -F _vigthoria_completions vigthoria
|
|
220
|
+
complete -F _vigthoria_completions vig
|
|
221
|
+
EOF
|
|
222
|
+
echo -e "${GREEN}✓ Bash completion installed${NC}"
|
|
223
|
+
echo " Run: source ~/.bash_completion.d/vigthoria"
|
|
224
|
+
;;
|
|
225
|
+
zsh)
|
|
226
|
+
COMPLETION_FILE="$HOME/.zsh/completion/_vigthoria"
|
|
227
|
+
mkdir -p "$HOME/.zsh/completion"
|
|
228
|
+
cat > "$COMPLETION_FILE" << 'EOF'
|
|
229
|
+
#compdef vigthoria vig
|
|
230
|
+
|
|
231
|
+
_vigthoria() {
|
|
232
|
+
local -a commands
|
|
233
|
+
commands=(
|
|
234
|
+
'chat:Start interactive chat with AI'
|
|
235
|
+
'edit:Edit a file with AI assistance'
|
|
236
|
+
'generate:Generate code from description'
|
|
237
|
+
'explain:Explain code in a file'
|
|
238
|
+
'fix:Fix issues in a file'
|
|
239
|
+
'review:Review code quality'
|
|
240
|
+
'login:Login to Vigthoria'
|
|
241
|
+
'logout:Logout from Vigthoria'
|
|
242
|
+
'status:Show account status'
|
|
243
|
+
'config:Configure settings'
|
|
244
|
+
'init:Initialize project'
|
|
245
|
+
)
|
|
246
|
+
_describe 'command' commands
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
_vigthoria "$@"
|
|
250
|
+
EOF
|
|
251
|
+
echo -e "${GREEN}✓ Zsh completion installed${NC}"
|
|
252
|
+
echo " Add to ~/.zshrc: fpath=(~/.zsh/completion \$fpath)"
|
|
253
|
+
;;
|
|
254
|
+
*)
|
|
255
|
+
echo -e "${YELLOW}⚠ Shell completion not available for $SHELL_NAME${NC}"
|
|
256
|
+
;;
|
|
257
|
+
esac
|
|
258
|
+
|
|
259
|
+
echo ""
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
# Print success message
|
|
263
|
+
print_success() {
|
|
264
|
+
echo -e "${GREEN}"
|
|
265
|
+
echo "╔═══════════════════════════════════════════════════════════╗"
|
|
266
|
+
echo "║ ║"
|
|
267
|
+
echo "║ ✓ VIGTHORIA CLI INSTALLED SUCCESSFULLY! ║"
|
|
268
|
+
echo "║ ║"
|
|
269
|
+
echo "╚═══════════════════════════════════════════════════════════╝"
|
|
270
|
+
echo -e "${NC}"
|
|
271
|
+
|
|
272
|
+
echo -e "${CYAN}Quick Start:${NC}"
|
|
273
|
+
echo ""
|
|
274
|
+
echo " 1. Login to your account:"
|
|
275
|
+
echo -e " ${WHITE}vigthoria login${NC}"
|
|
276
|
+
echo ""
|
|
277
|
+
echo " 2. Start coding with AI:"
|
|
278
|
+
echo -e " ${WHITE}vigthoria chat${NC}"
|
|
279
|
+
echo ""
|
|
280
|
+
echo " 3. Edit a file:"
|
|
281
|
+
echo -e " ${WHITE}vigthoria edit myfile.ts${NC}"
|
|
282
|
+
echo ""
|
|
283
|
+
echo " 4. Generate code:"
|
|
284
|
+
echo -e " ${WHITE}vigthoria generate \"REST API endpoint\"${NC}"
|
|
285
|
+
echo ""
|
|
286
|
+
echo -e "${CYAN}Commands:${NC}"
|
|
287
|
+
echo " vigthoria chat - Interactive AI chat"
|
|
288
|
+
echo " vigthoria edit - Edit files with AI"
|
|
289
|
+
echo " vigthoria generate - Generate code"
|
|
290
|
+
echo " vigthoria explain - Explain code"
|
|
291
|
+
echo " vigthoria fix - Fix code issues"
|
|
292
|
+
echo " vigthoria review - Code review"
|
|
293
|
+
echo " vigthoria --help - Show all commands"
|
|
294
|
+
echo ""
|
|
295
|
+
echo -e "${CYAN}Shortcuts:${NC}"
|
|
296
|
+
echo " vig c = vigthoria chat"
|
|
297
|
+
echo " vig e = vigthoria edit"
|
|
298
|
+
echo " vig g = vigthoria generate"
|
|
299
|
+
echo ""
|
|
300
|
+
echo -e "Documentation: ${CYAN}https://docs.vigthoria.io/cli${NC}"
|
|
301
|
+
echo ""
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
# Main installation flow
|
|
305
|
+
main() {
|
|
306
|
+
check_requirements
|
|
307
|
+
install_cli
|
|
308
|
+
create_symlinks
|
|
309
|
+
setup_completion
|
|
310
|
+
print_success
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
# Run main
|
|
314
|
+
main "$@"
|
package/package.json
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vigthoria-cli",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.9",
|
|
4
4
|
"description": "Vigthoria Coder CLI - AI-powered terminal coding assistant",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
|
+
"scripts/release",
|
|
8
9
|
"README.md",
|
|
9
10
|
"SECURITY_HARDENING.md",
|
|
10
|
-
"CLI_DIRECT_API_ARCHITECTURE.md"
|
|
11
|
+
"CLI_DIRECT_API_ARCHITECTURE.md",
|
|
12
|
+
"install.sh",
|
|
13
|
+
"install.ps1"
|
|
11
14
|
],
|
|
12
15
|
"publishConfig": {
|
|
13
16
|
"files": [
|
|
14
17
|
"dist/",
|
|
18
|
+
"scripts/release/",
|
|
19
|
+
"README.md",
|
|
20
|
+
"SECURITY_HARDENING.md",
|
|
21
|
+
"CLI_DIRECT_API_ARCHITECTURE.md",
|
|
22
|
+
"install.sh",
|
|
23
|
+
"install.ps1",
|
|
15
24
|
"package.json"
|
|
16
25
|
]
|
|
17
26
|
},
|
|
@@ -50,7 +59,7 @@
|
|
|
50
59
|
"test:game:live": "npm run build && node scripts/test-live-game-push.js",
|
|
51
60
|
"proof:agent": "npm run build && node scripts/proof-agent-mode.js",
|
|
52
61
|
"test:fresh-install": "node scripts/test-fresh-install.js",
|
|
53
|
-
"prepublishOnly": "npm run build && node scripts/verify-package-hygiene.js && node scripts/test-fresh-install.js",
|
|
62
|
+
"prepublishOnly": "npm run build && npm run validate:no-go && node scripts/verify-package-hygiene.js && node scripts/test-fresh-install.js",
|
|
54
63
|
"precheck:services": "node scripts/precheck-local-services.js",
|
|
55
64
|
"test:model:governance": "npm run build && node scripts/test-model-governance-no-agent.js",
|
|
56
65
|
"validate:no-go": "bash scripts/release/validate-no-go-gates.sh",
|