aegiscode 5.2.32 → 6.0.0

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.
@@ -1,155 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * postinstall script — downloads the prebuilt aegis-cli binary for the current platform.
4
- * The binary is saved to <package>/bin/ and then spawned by bin/cli.js.
5
- *
6
- * Requires zero external dependencies (uses only Node.js built-ins).
7
- *
8
- * Binary source: GitHub releases
9
- * https://github.com/aegisinfo/aegiscode/releases/latest/download/aegis-cli-{platform}-{arch}
10
- */
11
-
12
- import { createWriteStream, existsSync, chmodSync, mkdirSync } from 'fs';
13
- import { get } from 'https';
14
- import { join, dirname } from 'path';
15
- import { fileURLToPath } from 'url';
16
-
17
- const __dirname = dirname(fileURLToPath(import.meta.url));
18
- const PACKAGE_ROOT = join(__dirname, '..');
19
- const BIN_DIR = join(PACKAGE_ROOT, 'bin');
20
-
21
- const BASE_URL =
22
- 'https://github.com/aegisinfo/aegiscode/releases/latest/download';
23
-
24
- // Maps Node.js process.platform + process.arch → GitHub release asset name
25
- const PLATFORM_MAP = {
26
- 'linux-x64': 'aegis-cli-linux-x64',
27
- 'linux-arm64': 'aegis-cli-linux-arm64',
28
- 'darwin-x64': 'aegis-cli-darwin-x64',
29
- 'darwin-arm64': 'aegis-cli-darwin-arm64',
30
- 'win32-x64': 'aegis-cli-win-x64.exe',
31
- };
32
-
33
- // Fallback URLs for platforms that don't have a dedicated binary yet
34
- const FALLBACK_MAP = {
35
- 'linux-arm': 'aegis-cli-linux-arm64',
36
- 'darwin': 'aegis-cli-darwin-x64',
37
- };
38
-
39
- // ---------------------------------------------------------------------------
40
- // Helpers
41
- // ---------------------------------------------------------------------------
42
-
43
- function detectBinaryName() {
44
- const os = process.platform;
45
- const arch = process.arch;
46
- const key = `${os}-${arch}`;
47
-
48
- if (PLATFORM_MAP[key]) return PLATFORM_MAP[key];
49
-
50
- // Try fallback (e.g. linux-arm → linux-arm64 binary if close enough)
51
- for (const [pattern, fallback] of Object.entries(FALLBACK_MAP)) {
52
- if (key.startsWith(pattern)) return fallback;
53
- }
54
-
55
- throw new Error(
56
- `Unsupported platform: ${key}\n` +
57
- ` Supported: ${Object.keys(PLATFORM_MAP).join(', ')}\n` +
58
- ` You can build from source: git clone https://github.com/aegisinfo/aegiscode && cd aegiscode && npm install && npm run build`
59
- );
60
- }
61
-
62
- function downloadFile(url, dest) {
63
- return new Promise((resolve, reject) => {
64
- const file = createWriteStream(dest);
65
- const req = get(url, (res) => {
66
- // Follow redirect (GitHub releases redirect to S3)
67
- if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
68
- file.close();
69
- // Avoid file-exists check on redirect target — let the stream overwrite
70
- downloadFile(res.headers.location, dest).then(resolve).catch(reject);
71
- return;
72
- }
73
-
74
- if (res.statusCode !== 200) {
75
- file.close();
76
- // Try to collect error body
77
- let body = '';
78
- res.on('data', (chunk) => (body += chunk.toString()));
79
- res.on('end', () => {
80
- const detail = body.trim().slice(0, 200);
81
- reject(
82
- new Error(`HTTP ${res.statusCode} — ${detail || 'no body'}`)
83
- );
84
- });
85
- return;
86
- }
87
-
88
- res.pipe(file);
89
- file.on('finish', () => {
90
- file.close();
91
- resolve();
92
- });
93
- });
94
-
95
- req.on('error', (err) => {
96
- file.close();
97
- // Attempt cleanup
98
- try { file.close(); } catch { /* ignore */ }
99
- reject(err);
100
- });
101
-
102
- req.setTimeout(60_000, () => {
103
- req.destroy();
104
- reject(new Error('Download timed out after 60s'));
105
- });
106
- });
107
- }
108
-
109
- // ---------------------------------------------------------------------------
110
- // Main
111
- // ---------------------------------------------------------------------------
112
-
113
- async function main() {
114
- const binaryName = detectBinaryName();
115
- const url = `${BASE_URL}/${binaryName}`;
116
- const dest = join(BIN_DIR, binaryName);
117
-
118
- // Check if binary already exists (reinstall / postinstall after prepublish)
119
- if (existsSync(dest)) {
120
- console.log(`✓ aegis-cli already installed at ${dest}`);
121
- chmodSync(dest, 0o755);
122
- return;
123
- }
124
-
125
- console.log(`⬡ Downloading aegis-cli for ${process.platform}-${process.arch}...`);
126
-
127
- mkdirSync(BIN_DIR, { recursive: true });
128
-
129
- try {
130
- await downloadFile(url, dest);
131
- chmodSync(dest, 0o755);
132
- console.log(`✓ aegis-cli installed to ${dest}`);
133
- } catch (err) {
134
- console.error('');
135
- console.error(`⚠ Failed to download aegis-cli binary: ${err.message}`);
136
- console.error('');
137
- console.error(' Possible causes:');
138
- console.error(' • No binary release for your platform yet');
139
- console.error(' • No internet connectivity');
140
- console.error(' • GitHub releases are unavailable');
141
- console.error('');
142
- console.error(' Options:');
143
- console.error(' 1. Download manually from: https://github.com/aegisinfo/aegiscode/releases');
144
- console.error(' and place the binary in: ' + BIN_DIR);
145
- console.error(' 2. Build from source:');
146
- console.error(' git clone https://github.com/aegisinfo/aegiscode');
147
- console.error(' cd aegiscode && npm install && npm run build');
148
- console.error(' 3. Install via installer script:');
149
- console.error(' curl -fsSL https://dl.aegiscloud.org/install.sh | bash');
150
- console.error('');
151
- process.exit(1);
152
- }
153
- }
154
-
155
- main();
@@ -1 +0,0 @@
1
- export default {};
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Preinstall hook — checks Node >= 22 and guides toward automatic upgrade.
4
- * Full auto-install: curl -fsSL https://raw.githubusercontent.com/aegisinfo/aegiscode/main/scripts/install.sh | sh
5
- */
6
-
7
- const MIN_MAJOR = 18;
8
- const currentMajor = parseInt(process.version.slice(1), 10);
9
-
10
- if (currentMajor >= MIN_MAJOR) {
11
- process.exit(0);
12
- }
13
-
14
- console.error(`
15
- ╔══════════════════════════════════════════════════════════╗
16
- ║ ⚠️ Node.js ${process.version} detected — AEGIS CLI needs Node >= ${MIN_MAJOR} ║
17
- ╠══════════════════════════════════════════════════════════╣
18
- ║ Auto-install (recommended): ║
19
- ║ curl -fsSL https://aegiscode.dev/install.sh | sh ║
20
- ║ ║
21
- ║ Manual upgrade (Linux): ║
22
- ║ curl -fsSL https://deb.nodesource.com/setup_22.x | ║
23
- ║ sudo -E bash - ║
24
- ║ sudo apt-get install -y nodejs ║
25
- ╚══════════════════════════════════════════════════════════╝
26
- `);
27
- process.exit(1);
@@ -1,149 +0,0 @@
1
- <#
2
- .SYNOPSIS
3
- Install Alacritty terminal and create a desktop shortcut for AEGIS CLI.
4
- .DESCRIPTION
5
- Installs Alacritty via winget (preferred) or Chocolatey, then creates a
6
- desktop shortcut that launches Alacritty with aegis-cli.
7
- #>
8
-
9
- $ErrorActionPreference = "Stop"
10
- $Host.UI.RawUI.WindowTitle = "AEGIS CLI Installer"
11
-
12
- function Write-Step { Write-Host "→ $($args[0])" -ForegroundColor Cyan }
13
- function Write-OK { Write-Host "✓ $($args[0])" -ForegroundColor Green }
14
- function Write-Warn { Write-Host "⚠ $($args[0])" -ForegroundColor Yellow }
15
- function Write-Err { Write-Host "✗ $($args[0])" -ForegroundColor Red; exit 1 }
16
-
17
- # ── Admin check ───────────────────────────────────────
18
- $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
19
-
20
- # ── Install Alacritty ─────────────────────────────────
21
- function Install-Alacritty {
22
- if (Get-Command alacritty -ErrorAction SilentlyContinue) {
23
- $ver = & alacritty --version 2>$null
24
- Write-OK "Alacritty already installed ($ver)"
25
- return
26
- }
27
-
28
- Write-Step "Installing Alacritty..."
29
-
30
- # Try winget first
31
- if (Get-Command winget -ErrorAction SilentlyContinue) {
32
- Write-Step "Using winget..."
33
- try {
34
- & winget install --id Alacritty.Alacritty --silent --accept-package-agreements --accept-source-agreements 2>&1 | Out-Null
35
- refreshenv 2>$null
36
- if (Get-Command alacritty -ErrorAction SilentlyContinue) {
37
- Write-OK "Alacritty installed via winget"
38
- return
39
- }
40
- } catch {
41
- Write-Warn "winget failed, trying Chocolatey..."
42
- }
43
- }
44
-
45
- # Fallback: Chocolatey
46
- if (Get-Command choco -ErrorAction SilentlyContinue) {
47
- Write-Step "Using Chocolatey..."
48
- & choco install alacritty -y 2>&1 | Out-Null
49
- refreshenv 2>$null
50
- if (Get-Command alacritty -ErrorAction SilentlyContinue) {
51
- Write-OK "Alacritty installed via Chocolatey"
52
- return
53
- }
54
- }
55
-
56
- # Last resort: scoop
57
- if (Get-Command scoop -ErrorAction SilentlyContinue) {
58
- Write-Step "Using Scoop..."
59
- & scoop install alacritty 2>&1 | Out-Null
60
- if (Get-Command alacritty -ErrorAction SilentlyContinue) {
61
- Write-OK "Alacritty installed via Scoop"
62
- return
63
- }
64
- }
65
-
66
- if (!$isAdmin) {
67
- Write-Warn "Not running as admin. Prompting for elevation..."
68
- Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
69
- exit
70
- }
71
-
72
- Write-Err "Could not install Alacritty. Install manually: winget install --id Alacritty.Alacritty"
73
- }
74
-
75
- # ── Find AEGIS CLI binary ────────────────────────────
76
- function Find-AegisBin {
77
- $paths = @(
78
- "$env:APPDATA\npm\aegis.cmd",
79
- "$env:APPDATA\npm\aegis-cli.cmd",
80
- "$env:LOCALAPPDATA\npm\aegis.cmd",
81
- "$env:LOCALAPPDATA\npm\aegis-cli.cmd",
82
- "$env:USERPROFILE\.npm-global\aegis.cmd"
83
- )
84
-
85
- foreach ($p in $paths) {
86
- if (Test-Path $p) { return $p }
87
- }
88
-
89
- # Try PATH
90
- $onPath = Get-Command aegis -ErrorAction SilentlyContinue
91
- if ($onPath) { return $onPath.Source }
92
-
93
- $onPath = Get-Command aegis-cli -ErrorAction SilentlyContinue
94
- if ($onPath) { return $onPath.Source }
95
-
96
- return $null
97
- }
98
-
99
- # ── Create desktop shortcut ──────────────────────────
100
- function Create-DesktopShortcut {
101
- param([string]$Target)
102
-
103
- $WScriptShell = New-Object -ComObject WScript.Shell
104
- $desktop = [Environment]::GetFolderPath("Desktop")
105
- $shortcutPath = Join-Path $desktop "AEGIS CLI.lnk"
106
- $shortcut = $WScriptShell.CreateShortcut($shortcutPath)
107
-
108
- # Alacritty binary path
109
- $alacrittyPath = "$env:LOCALAPPDATA\alacritty\Alacritty.exe"
110
- if (!(Test-Path $alacrittyPath)) {
111
- $alacrittyPath = "C:\Program Files\Alacritty\Alacritty.exe"
112
- }
113
- if (!(Test-Path $alacrittyPath)) {
114
- $alacrittyPath = (Get-Command alacritty -ErrorAction SilentlyContinue).Source
115
- }
116
-
117
- $shortcut.TargetPath = $alacrittyPath
118
- $shortcut.Arguments = "-e `"$Target`""
119
- $shortcut.Description = "Launch Alacritty with ÆGIS Code CLI"
120
- $shortcut.IconLocation = "$env:SystemRoot\System32\shell32.dll,6"
121
- $shortcut.WorkingDirectory = $env:USERPROFILE
122
- $shortcut.Save()
123
-
124
- Write-OK "Desktop shortcut created: $shortcutPath"
125
- }
126
-
127
- # ── Main ──────────────────────────────────────────────
128
- Write-Host ""
129
- Write-Host " ━━━ AEGIS CLI — Alacritty Installer ━━━" -ForegroundColor Cyan
130
- Write-Host ""
131
-
132
- Install-Alacritty
133
-
134
- $aegisBin = Find-AegisBin
135
- if (-not $aegisBin) {
136
- Write-Warn "AEGIS CLI not found on PATH. Installing via npm..."
137
- npm install -g aegiscode 2>&1 | Out-Null
138
- $aegisBin = Find-AegisBin
139
- if (-not $aegisBin) {
140
- Write-Err "Could not find AEGIS CLI. Run: npm install -g aegiscode"
141
- }
142
- }
143
-
144
- Create-DesktopShortcut -Target $aegisBin
145
-
146
- Write-Host ""
147
- Write-OK "Done! Double-click the 'AEGIS CLI' shortcut on your desktop."
148
- Write-Host " (If Alacritty was just installed, you may need to log out/in first.)"
149
- Write-Host ""
@@ -1,164 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # ── Colors ──────────────────────────────────────────────
5
- RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'
6
- YELLOW='\033[1;33m'; NC='\033[0m'
7
- log() { echo -e "${CYAN}→${NC} $1"; }
8
- ok() { echo -e "${GREEN}✓${NC} $1"; }
9
- warn() { echo -e "${YELLOW}⚠${NC} $1"; }
10
- err() { echo -e "${RED}✗${NC} $1"; exit 1; }
11
-
12
- # ── Detect platform ──────────────────────────────────────
13
- OS="$(uname -s)"
14
- ARCH="$(uname -m)"
15
-
16
- install_alacritty_linux() {
17
- if command -v alacritty &>/dev/null; then
18
- ok "Alacritty already installed ($(alacritty --version))"
19
- return 0
20
- fi
21
-
22
- log "Installing Alacritty..."
23
-
24
- # Detect package manager
25
- if command -v apt-get &>/dev/null; then
26
- sudo apt-get update -qq && sudo apt-get install -y -qq alacritty
27
- elif command -v pacman &>/dev/null; then
28
- sudo pacman -S --noconfirm alacritty
29
- elif command -v dnf &>/dev/null; then
30
- sudo dnf install -y alacritty
31
- elif command -v zypper &>/dev/null; then
32
- sudo zypper install -y alacritty
33
- elif command -v guix &>/dev/null; then
34
- guix install alacritty
35
- elif command -v snap &>/dev/null; then
36
- sudo snap install alacritty --classic
37
- else
38
- warn "No known package manager. Trying cargo..."
39
- if command -v cargo &>/dev/null; then
40
- cargo install alacritty
41
- else
42
- err "Could not install Alacritty. Install manually: https://alacritty.org"
43
- fi
44
- fi
45
-
46
- if command -v alacritty &>/dev/null; then
47
- ok "Alacritty installed ($(alacritty --version))"
48
- else
49
- warn "Alacritty installed but not on PATH — you may need to log out/in"
50
- fi
51
- }
52
-
53
- install_alacritty_macos() {
54
- if command -v alacritty &>/dev/null; then
55
- ok "Alacritty already installed ($(alacritty --version))"
56
- return 0
57
- fi
58
-
59
- if ! command -v brew &>/dev/null; then
60
- log "Installing Homebrew first..."
61
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
62
- fi
63
-
64
- log "Installing Alacritty via Homebrew..."
65
- brew install --cask alacritty
66
- ok "Alacritty installed"
67
- }
68
-
69
- # ── Create desktop launcher ──────────────────────────────────
70
- create_launcher_linux() {
71
- local launcher_dir="$HOME/.local/share/applications"
72
- local desktop_path="$HOME/Desktop/aegis-cli.desktop"
73
- mkdir -p "$launcher_dir"
74
-
75
- # Find the aegis binary
76
- local aegis_bin
77
- aegis_bin="$(command -v aegis || command -v aegis-cli || echo "$HOME/.npm-global/bin/aegis")"
78
-
79
- cat > /tmp/aegis-cli.desktop << DESKTOP_EOF
80
- [Desktop Entry]
81
- Version=1.0
82
- Name=ÆGIS CLI Terminal
83
- Comment=Launch Alacritty with ÆGIS Code CLI
84
- Exec=alacritty -e $aegis_bin
85
- Icon=utilities-terminal
86
- Terminal=false
87
- Type=Application
88
- Categories=Development;Utility;
89
- StartupWMClass=Alacritty
90
- DESKTOP_EOF
91
-
92
- cp /tmp/aegis-cli.desktop "$launcher_dir/aegis-cli.desktop"
93
- chmod +x "$launcher_dir/aegis-cli.desktop"
94
-
95
- # Also put on Desktop if it exists
96
- if [ -d "$HOME/Desktop" ]; then
97
- cp /tmp/aegis-cli.desktop "$desktop_path"
98
- chmod +x "$desktop_path"
99
- ok "Launcher placed on Desktop: $desktop_path"
100
- fi
101
-
102
- # Update desktop database so it shows in app menus
103
- if command -v update-desktop-database &>/dev/null; then
104
- update-desktop-database "$launcher_dir" 2>/dev/null || true
105
- fi
106
-
107
- ok "Desktop launcher created: ÆGIS CLI Terminal"
108
- }
109
-
110
- create_launcher_macos() {
111
- local app_dir="$HOME/Desktop/AEGIS CLI.app"
112
- local aegis_bin
113
- aegis_bin="$(command -v aegis || command -v aegis-cli || echo "/opt/homebrew/bin/aegis")"
114
- local alacritty_bin="/Applications/Alacritty.app/Contents/MacOS/alacritty"
115
-
116
- # Create macOS .app bundle on desktop
117
- mkdir -p "$app_dir/Contents/MacOS"
118
- cat > "$app_dir/Contents/Info.plist" << PLIST_EOF
119
- <?xml version="1.0" encoding="UTF-8"?>
120
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
121
- <plist version="1.0">
122
- <dict>
123
- <key>CFBundleExecutable</key>
124
- <string>aegis-launcher</string>
125
- <key>CFBundleName</key>
126
- <string>ÆGIS CLI</string>
127
- <key>CFBundleIdentifier</key>
128
- <string>org.aegiscli.launcher</string>
129
- <key>CFBundlePackageType</key>
130
- <string>APPL</string>
131
- </dict>
132
- </plist>
133
- PLIST_EOF
134
-
135
- cat > "$app_dir/Contents/MacOS/aegis-launcher" << LAUNCHER_SH
136
- #!/bin/bash
137
- exec "$alacritty_bin" -e "$aegis_bin"
138
- LAUNCHER_SH
139
- chmod +x "$app_dir/Contents/MacOS/aegis-launcher"
140
- ok "macOS app created: $app_dir"
141
- }
142
-
143
- # ── Main ──────────────────────────────────────────────
144
- echo ""
145
- echo " ${CYAN}━━━ AEGIS CLI — Alacritty Installer ━━━${NC}"
146
- echo ""
147
-
148
- case "$OS" in
149
- Linux)
150
- install_alacritty_linux
151
- create_launcher_linux
152
- ;;
153
- Darwin)
154
- install_alacritty_macos
155
- create_launcher_macos
156
- ;;
157
- *)
158
- err "Unsupported OS: $OS"
159
- ;;
160
- esac
161
-
162
- echo ""
163
- ok "Done! Double-click the desktop icon to launch Alacritty + AEGIS CLI."
164
- echo ""
@@ -1,121 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- REPO="aegisinfo/aegiscode"
5
- PACKAGE="aegiscode"
6
- MIN_NODE_MAJOR=22
7
-
8
- # ── Colors ──────────────────────────────────────────────
9
- RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'
10
- YELLOW='\033[1;33m'; NC='\033[0m'
11
-
12
- log() { echo -e "${CYAN}→${NC} $1"; }
13
- ok() { echo -e "${GREEN}✓${NC} $1"; }
14
- warn() { echo -e "${YELLOW}⚠${NC} $1"; }
15
- err() { echo -e "${RED}✗${NC} $1"; exit 1; }
16
-
17
- # ── Detect Node.js ──────────────────────────────────────
18
- detect_node() {
19
- if command -v node &>/dev/null; then
20
- NODE_VERSION=$(node -v | sed 's/^v//')
21
- NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1)
22
- log "Node.js ${NODE_VERSION} detected"
23
- return 0
24
- fi
25
- return 1
26
- }
27
-
28
- # ── Install Node.js 22 ──────────────────────────────────
29
- install_node() {
30
- warn "Node.js >= ${MIN_NODE_MAJOR} required (found ${NODE_VERSION:-none})"
31
- log "Installing Node.js ${MIN_NODE_MAJOR}..."
32
-
33
- # Strategy: nvm
34
- if [ -n "${NVM_DIR:-}" ] || [ -f "$HOME/.nvm/nvm.sh" ]; then
35
- NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
36
- log "Using nvm..."
37
- \. "$NVM_DIR/nvm.sh"
38
- nvm install "$MIN_NODE_MAJOR"
39
- nvm alias default "$MIN_NODE_MAJOR"
40
- ok "Node.js $(node -v) installed via nvm"
41
- return 0
42
- fi
43
-
44
- # Strategy: fnm
45
- if command -v fnm &>/dev/null; then
46
- log "Using fnm..."
47
- fnm install "$MIN_NODE_MAJOR"
48
- fnm default "$MIN_NODE_MAJOR"
49
- eval "$(fnm env)"
50
- ok "Node.js $(node -v) installed via fnm"
51
- return 0
52
- fi
53
-
54
- # Strategy: nodesource (Linux)
55
- if [ "$(uname -s)" = "Linux" ]; then
56
- log "Using nodesource..."
57
- curl -fsSL "https://deb.nodesource.com/setup_${MIN_NODE_MAJOR}.x" | sudo -E bash -
58
- sudo apt-get install -y nodejs
59
- ok "Node.js $(node -v) installed via nodesource"
60
- return 0
61
- fi
62
-
63
- # Strategy: brew (macOS)
64
- if command -v brew &>/dev/null; then
65
- log "Using Homebrew..."
66
- brew install node@${MIN_NODE_MAJOR}
67
- brew link --overwrite node@${MIN_NODE_MAJOR}
68
- ok "Node.js $(node -v) installed via Homebrew"
69
- return 0
70
- fi
71
-
72
- err "Could not auto-install Node.js. Install manually:\n curl -fsSL https://deb.nodesource.com/setup_${MIN_NODE_MAJOR}.x | sudo -E bash -\n sudo apt-get install -y nodejs"
73
- }
74
-
75
- # ── Fix npm prefix (avoid EACCES) ───────────────────────
76
- fix_npm_prefix() {
77
- if [ "$(npm config get prefix)" = "/usr/local" ]; then
78
- if [ ! -w "/usr/local/lib/node_modules" ]; then
79
- warn "No write permission for /usr/local/lib/node_modules"
80
- log "Configuring npm to use ~/.npm-global..."
81
- mkdir -p "$HOME/.npm-global"
82
- npm config set prefix "$HOME/.npm-global"
83
- # Add to PATH if not already there
84
- case ":$PATH:" in
85
- *:"$HOME/.npm-global/bin":*) ;;
86
- *)
87
- echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> "$HOME/.bashrc"
88
- echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> "$HOME/.profile"
89
- export PATH="$HOME/.npm-global/bin:$PATH"
90
- ;;
91
- esac
92
- ok "npm prefix set to ~/.npm-global"
93
- fi
94
- fi
95
- }
96
-
97
- # ── Main ────────────────────────────────────────────────
98
- echo
99
- echo " ${CYAN}━━━ AEGIS CLI Installer ━━━${NC}"
100
- echo
101
-
102
- detect_node || NODE_MAJOR=0
103
-
104
- if [ "$NODE_MAJOR" -lt "$MIN_NODE_MAJOR" ]; then
105
- install_node
106
- # Re-source PATH in case nvm/fnm added node
107
- export PATH="$HOME/.npm-global/bin:$PATH"
108
- fi
109
-
110
- fix_npm_prefix
111
-
112
- log "Installing ${PACKAGE}..."
113
- npm install -g "${PACKAGE}@latest" 2>/dev/null || npm install -g "${PACKAGE}@latest" --no-optional
114
-
115
- echo
116
- if command -v aegis &>/dev/null; then
117
- ok "AEGIS CLI installed! Run: aegis --help"
118
- else
119
- warn "Add ~/.npm-global/bin to your PATH, then run: aegis --help"
120
- fi
121
- echo
@@ -1,17 +0,0 @@
1
- /**
2
- * make-bin.mjs — copies the built dist/main.js to bin/cli.js as-is (no obfuscation).
3
- */
4
-
5
- import { readFileSync, writeFileSync, mkdirSync, chmodSync } from 'node:fs';
6
- import { dirname, join } from 'node:path';
7
- import { fileURLToPath } from 'node:url';
8
-
9
- const __dirname = dirname(fileURLToPath(import.meta.url));
10
- const src = join(__dirname, '..', 'dist', 'main.js');
11
- const dest = join(__dirname, '..', 'bin', 'cli.js');
12
-
13
- mkdirSync(join(__dirname, '..', 'bin'), { recursive: true });
14
- writeFileSync(dest, readFileSync(src, 'utf-8'), 'utf-8');
15
- chmodSync(dest, 0o755);
16
-
17
- console.log(`✓ bin/cli.js written (unobfuscated)`);