vigthoria-cli 1.9.2 → 1.9.8

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.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,14 +1,29 @@
1
1
  {
2
2
  "name": "vigthoria-cli",
3
- "version": "1.9.2",
3
+ "version": "1.9.8",
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
  ],
15
+ "publishConfig": {
16
+ "files": [
17
+ "dist/",
18
+ "scripts/release/",
19
+ "README.md",
20
+ "SECURITY_HARDENING.md",
21
+ "CLI_DIRECT_API_ARCHITECTURE.md",
22
+ "install.sh",
23
+ "install.ps1",
24
+ "package.json"
25
+ ]
26
+ },
12
27
  "bin": {
13
28
  "vigthoria": "dist/index.js",
14
29
  "vig": "dist/index.js",
@@ -44,7 +59,7 @@
44
59
  "test:game:live": "npm run build && node scripts/test-live-game-push.js",
45
60
  "proof:agent": "npm run build && node scripts/proof-agent-mode.js",
46
61
  "test:fresh-install": "node scripts/test-fresh-install.js",
47
- "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",
48
63
  "precheck:services": "node scripts/precheck-local-services.js",
49
64
  "test:model:governance": "npm run build && node scripts/test-model-governance-no-agent.js",
50
65
  "validate:no-go": "bash scripts/release/validate-no-go-gates.sh",
@@ -0,0 +1,159 @@
1
+ # Vigthoria CLI Local Machine Verification Checklist
2
+
3
+ Use this checklist on real user machines before and after rollout. The goal is to verify install, auth, routing, update, and core command reliability in the same environment users run.
4
+
5
+ ## 1. Preflight
6
+
7
+ - [ ] Node.js `>=18` available
8
+ - [ ] `npm` available
9
+ - [ ] No stale shell aliases shadowing `vigthoria`
10
+ - [ ] Network access to:
11
+ - `https://coder.vigthoria.io`
12
+ - `https://api.vigthoria.io`
13
+ - [ ] If running browser runtime proofs: Chrome available for Puppeteer
14
+
15
+ Commands:
16
+
17
+ ```bash
18
+ node -v
19
+ npm -v
20
+ which vigthoria || where.exe vigthoria
21
+ ```
22
+
23
+ ## 2. Install and Version Integrity
24
+
25
+ - [ ] Install succeeds
26
+ - [ ] Reported version matches release target
27
+ - [ ] Binary resolves to expected package
28
+
29
+ Commands:
30
+
31
+ ```bash
32
+ npm install -g vigthoria-cli@latest
33
+ vigthoria --version
34
+ vigthoria doctor
35
+ ```
36
+
37
+ Expected:
38
+ - `vigthoria --version` shows current release version
39
+ - `doctor` returns diagnostics without crash
40
+
41
+ ## 3. Auth Reliability
42
+
43
+ - [ ] Login works
44
+ - [ ] Status shows account, plan, health lines
45
+ - [ ] Invalid token is rejected with gateway-auth message
46
+
47
+ Commands:
48
+
49
+ ```bash
50
+ vigthoria login
51
+ vigthoria status
52
+ VIGTHORIA_AUTH_TOKEN=invalid-token-for-preflight vigthoria chat --no-agent --model balanced-4b --prompt "ok" --json
53
+ ```
54
+
55
+ Expected:
56
+ - `status` includes `Account Status`, `Plan`, `Overall`, `Coder API`, `Models API`
57
+ - Invalid-token command returns JSON with `success: false` and gateway-auth failure message
58
+
59
+ ## 4. Model and Routing Checks
60
+
61
+ - [ ] Balanced path resolves to balanced model
62
+ - [ ] Governance fallback maps blocked no-agent models to `vigthoria-v3-code-35b`
63
+ - [ ] Agent direct mode prints command/tool flow (non-JSON mode)
64
+
65
+ Commands:
66
+
67
+ ```bash
68
+ vigthoria chat --no-agent --model balanced-4b --prompt "reply exactly: ok" --json
69
+ vigthoria chat --no-agent --model creative --prompt "say ok" --json
70
+ vigthoria agent --prompt "Read one file and summarize it" --auto-approve
71
+ ```
72
+
73
+ Expected:
74
+ - balanced output model: `vigthoria-balanced-4b`
75
+ - creative output model: `vigthoria-v3-code-35b`
76
+ - agent run shows direct prompt execution and tool activity
77
+
78
+ ## 5. Command Surface Smoke Tests
79
+
80
+ - [ ] Aliases work
81
+ - [ ] Bridge status prints valid section and hidden internal endpoints
82
+ - [ ] Operator JSON command succeeds
83
+
84
+ Commands:
85
+
86
+ ```bash
87
+ vigthoria hyper-loop status
88
+ vigthoria devtools connect
89
+ vigthoria bridge status
90
+ vigthoria operator --prompt "status check" --json
91
+ ```
92
+
93
+ Expected:
94
+ - No crashes
95
+ - `bridge status` shows `DevTools Bridge` and either `Reachable` or `Not running`
96
+ - Operator JSON has `success: true`
97
+
98
+ ## 6. Update Path
99
+
100
+ - [ ] Update check works
101
+ - [ ] Upgrade path works from npm/manifest
102
+
103
+ Commands:
104
+
105
+ ```bash
106
+ vigthoria update --check
107
+ vigthoria update
108
+ ```
109
+
110
+ Expected:
111
+ - No script errors
112
+ - Clear success/fallback guidance if update source fails
113
+
114
+ ## 7. Release Gate (Local Build Validation)
115
+
116
+ Run this on release candidate machines when validating local package changes.
117
+
118
+ ```bash
119
+ npm run build
120
+ npm run validate:no-go
121
+ ```
122
+
123
+ Expected:
124
+ - `ALL NO-GO GATES PASSED`
125
+
126
+ ## 8. Environment-Specific Prerequisites
127
+
128
+ These are external dependencies, not CLI code regressions:
129
+
130
+ - Workflow E2E requires reachable VigFlow backend
131
+ - Live repo/game/platform E2E requires:
132
+ - `VIGTHORIA_COMMUNITY_EMAIL`
133
+ - `VIGTHORIA_COMMUNITY_PASSWORD`
134
+ - Browser proof requires Chrome installed for Puppeteer runtime
135
+
136
+ ## 9. Rollback Readiness
137
+
138
+ - [ ] Previous known-good CLI version pinned
139
+ - [ ] One-command rollback documented
140
+ - [ ] Support note prepared for users
141
+
142
+ Example rollback:
143
+
144
+ ```bash
145
+ npm install -g vigthoria-cli@<known-good-version>
146
+ ```
147
+
148
+ ## 10. Signoff Template
149
+
150
+ - Machine/OS:
151
+ - Node/NPM versions:
152
+ - CLI version validated:
153
+ - Auth check: PASS/FAIL
154
+ - Model routing check: PASS/FAIL
155
+ - Command smoke check: PASS/FAIL
156
+ - Update check: PASS/FAIL
157
+ - No-go gate: PASS/FAIL
158
+ - Approved by:
159
+ - Timestamp:
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Publish Vigthoria CLI release artifact + manifest entry.
5
+ # Usage:
6
+ # HOST_DOWNLOADS_DIR=/path/to/downloads \
7
+ # HOST_MANIFEST_FILE=/path/to/releases/manifest.json \
8
+ # ./scripts/release/publish-cli-release.sh 1.9.0
9
+
10
+ VERSION="${1:-}"
11
+ if [[ -z "$VERSION" ]]; then
12
+ echo "Usage: $0 <version>"
13
+ exit 1
14
+ fi
15
+
16
+ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
17
+ PKG_FILE="$REPO_ROOT/vigthoria-cli-${VERSION}.tgz"
18
+ HOST_DOWNLOADS_DIR="${HOST_DOWNLOADS_DIR:-}"
19
+ HOST_MANIFEST_FILE="${HOST_MANIFEST_FILE:-}"
20
+ PUBLIC_BASE_URL="${PUBLIC_BASE_URL:-https://cli.vigthoria.io/downloads}"
21
+ CHANNEL="${CHANNEL:-stable}"
22
+
23
+ if [[ ! -f "$PKG_FILE" ]]; then
24
+ echo "Artifact not found: $PKG_FILE"
25
+ echo "Run: npm pack"
26
+ exit 1
27
+ fi
28
+
29
+ if [[ -z "$HOST_DOWNLOADS_DIR" || -z "$HOST_MANIFEST_FILE" ]]; then
30
+ echo "Set HOST_DOWNLOADS_DIR and HOST_MANIFEST_FILE before running."
31
+ exit 1
32
+ fi
33
+
34
+ SHA256="$(sha256sum "$PKG_FILE" | awk '{print $1}')"
35
+ URL="$PUBLIC_BASE_URL/vigthoria-cli-${VERSION}.tgz"
36
+
37
+ echo "Publishing vigthoria-cli v${VERSION}"
38
+ echo "Artifact: $PKG_FILE"
39
+ echo "SHA256: $SHA256"
40
+ echo "URL: $URL"
41
+
42
+ install -d "$HOST_DOWNLOADS_DIR"
43
+ cp -f "$PKG_FILE" "$HOST_DOWNLOADS_DIR/"
44
+
45
+ echo "Copied artifact to $HOST_DOWNLOADS_DIR"
46
+
47
+ if [[ ! -f "$HOST_MANIFEST_FILE" ]]; then
48
+ echo "Manifest does not exist at: $HOST_MANIFEST_FILE"
49
+ echo "Create it first with {\"channels\":{\"stable\":{}}}"
50
+ exit 1
51
+ fi
52
+
53
+ python3 - << PYEOF
54
+ import json, pathlib
55
+ manifest_path = pathlib.Path(r"$HOST_MANIFEST_FILE")
56
+ data = json.loads(manifest_path.read_text())
57
+ data.setdefault("channels", {})
58
+ data["channels"].setdefault("$CHANNEL", {})
59
+ data["channels"]["$CHANNEL"].update({
60
+ "version": "$VERSION",
61
+ "url": "$URL",
62
+ "sha256": "$SHA256",
63
+ "notes": "Automated publish via scripts/release/publish-cli-release.sh"
64
+ })
65
+ manifest_path.write_text(json.dumps(data, indent=2) + "\n")
66
+ print("Manifest updated:", manifest_path)
67
+ PYEOF
68
+
69
+ echo "Publish complete."
70
+ echo "Verification commands:"
71
+ echo " curl -I $URL"
72
+ echo " curl -fsSL https://coder.vigthoria.io/releases/manifest.json | head -40"
73
+ echo " node dist/index.js update --check --manifest https://coder.vigthoria.io/releases/manifest.json --channel $CHANNEL"