fluxy-bot 0.2.16 → 0.2.18
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/bin/cli.js +3 -1
- package/install.ps1 +91 -0
- package/install.sh +109 -0
- package/package.json +4 -2
- package/scripts/postinstall.js +73 -11
- package/supervisor/fluxy-agent.ts +1 -1
package/bin/cli.js
CHANGED
|
@@ -8,8 +8,10 @@ import { fileURLToPath } from 'url';
|
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
12
12
|
const DATA_DIR = path.join(os.homedir(), '.fluxy');
|
|
13
|
+
const IS_DEV = fs.existsSync(path.join(REPO_ROOT, '.git'));
|
|
14
|
+
const ROOT = IS_DEV ? REPO_ROOT : DATA_DIR;
|
|
13
15
|
const CONFIG_PATH = path.join(DATA_DIR, 'config.json');
|
|
14
16
|
const BIN_DIR = path.join(DATA_DIR, 'bin');
|
|
15
17
|
const CF_PATH = path.join(BIN_DIR, 'cloudflared');
|
package/install.ps1
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# ── Fluxy Installer for Windows ──
|
|
2
|
+
# Downloads the latest fluxy-bot from npm and installs to ~/.fluxy/
|
|
3
|
+
|
|
4
|
+
$ErrorActionPreference = "Stop"
|
|
5
|
+
|
|
6
|
+
$FLUXY_HOME = Join-Path $env:USERPROFILE ".fluxy"
|
|
7
|
+
|
|
8
|
+
function Write-Info($msg) { Write-Host " ▸ $msg" -ForegroundColor Cyan }
|
|
9
|
+
function Write-Ok($msg) { Write-Host " ✔ $msg" -ForegroundColor Green }
|
|
10
|
+
function Write-Err($msg) { Write-Host " ✘ $msg" -ForegroundColor Red }
|
|
11
|
+
|
|
12
|
+
Write-Host ""
|
|
13
|
+
Write-Host " Fluxy Installer" -ForegroundColor Cyan
|
|
14
|
+
Write-Host ""
|
|
15
|
+
|
|
16
|
+
# ── Check dependencies ──
|
|
17
|
+
foreach ($cmd in @("node", "npm")) {
|
|
18
|
+
if (-not (Get-Command $cmd -ErrorAction SilentlyContinue)) {
|
|
19
|
+
Write-Err "$cmd is required but not installed."
|
|
20
|
+
exit 1
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# ── Get tarball URL ──
|
|
25
|
+
Write-Info "Fetching latest version..."
|
|
26
|
+
$TARBALL_URL = (npm view fluxy-bot dist.tarball 2>$null).Trim()
|
|
27
|
+
if (-not $TARBALL_URL) {
|
|
28
|
+
Write-Err "Failed to fetch tarball URL from npm."
|
|
29
|
+
exit 1
|
|
30
|
+
}
|
|
31
|
+
$VERSION = (npm view fluxy-bot version 2>$null).Trim()
|
|
32
|
+
Write-Ok "Found fluxy-bot@$VERSION"
|
|
33
|
+
|
|
34
|
+
# ── Download and extract ──
|
|
35
|
+
$TMPDIR = Join-Path ([System.IO.Path]::GetTempPath()) ("fluxy-install-" + [guid]::NewGuid().ToString("N").Substring(0,8))
|
|
36
|
+
New-Item -ItemType Directory -Path $TMPDIR -Force | Out-Null
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
Write-Info "Downloading..."
|
|
40
|
+
$tarball = Join-Path $TMPDIR "fluxy.tgz"
|
|
41
|
+
Invoke-WebRequest -Uri $TARBALL_URL -OutFile $tarball -UseBasicParsing
|
|
42
|
+
Write-Ok "Downloaded"
|
|
43
|
+
|
|
44
|
+
Write-Info "Extracting..."
|
|
45
|
+
tar xzf $tarball -C $TMPDIR
|
|
46
|
+
Write-Ok "Extracted"
|
|
47
|
+
|
|
48
|
+
$EXTRACTED = Join-Path $TMPDIR "package"
|
|
49
|
+
if (-not (Test-Path $EXTRACTED)) {
|
|
50
|
+
Write-Err "Unexpected tarball structure."
|
|
51
|
+
exit 1
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# ── Copy to ~/.fluxy/ ──
|
|
55
|
+
Write-Info "Installing to $FLUXY_HOME..."
|
|
56
|
+
New-Item -ItemType Directory -Path $FLUXY_HOME -Force | Out-Null
|
|
57
|
+
|
|
58
|
+
# Copy-Item -Recurse -Force overwrites existing files but does NOT delete extras
|
|
59
|
+
Get-ChildItem -Path $EXTRACTED -Force | ForEach-Object {
|
|
60
|
+
Copy-Item -Path $_.FullName -Destination $FLUXY_HOME -Recurse -Force
|
|
61
|
+
}
|
|
62
|
+
Write-Ok "Files copied"
|
|
63
|
+
|
|
64
|
+
# ── Install dependencies ──
|
|
65
|
+
Write-Info "Installing dependencies (this may take a moment)..."
|
|
66
|
+
Push-Location $FLUXY_HOME
|
|
67
|
+
npm install --omit=dev --ignore-scripts 2>$null
|
|
68
|
+
Pop-Location
|
|
69
|
+
Write-Ok "Dependencies installed"
|
|
70
|
+
|
|
71
|
+
# ── Add to PATH ──
|
|
72
|
+
Write-Info "Configuring PATH..."
|
|
73
|
+
$binDir = Join-Path $FLUXY_HOME "bin"
|
|
74
|
+
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
75
|
+
if ($userPath -notlike "*$binDir*") {
|
|
76
|
+
[Environment]::SetEnvironmentVariable("Path", "$binDir;$userPath", "User")
|
|
77
|
+
$env:Path = "$binDir;$env:Path"
|
|
78
|
+
Write-Ok "Added $binDir to user PATH"
|
|
79
|
+
} else {
|
|
80
|
+
Write-Ok "PATH already configured"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Write-Host ""
|
|
84
|
+
Write-Host " Fluxy v$VERSION installed successfully!" -ForegroundColor Green
|
|
85
|
+
Write-Host " Run 'fluxy' to start your bot." -ForegroundColor DarkGray
|
|
86
|
+
Write-Host ""
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
# Clean up temp directory
|
|
90
|
+
Remove-Item -Path $TMPDIR -Recurse -Force -ErrorAction SilentlyContinue
|
|
91
|
+
}
|
package/install.sh
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# ── Fluxy Installer ──
|
|
5
|
+
# Downloads the latest fluxy-bot from npm and installs to ~/.fluxy/
|
|
6
|
+
|
|
7
|
+
FLUXY_HOME="$HOME/.fluxy"
|
|
8
|
+
|
|
9
|
+
c_reset='\033[0m'
|
|
10
|
+
c_cyan='\033[36m'
|
|
11
|
+
c_green='\033[32m'
|
|
12
|
+
c_red='\033[31m'
|
|
13
|
+
c_dim='\033[2m'
|
|
14
|
+
c_bold='\033[1m'
|
|
15
|
+
|
|
16
|
+
info() { echo -e " ${c_cyan}▸${c_reset} $1"; }
|
|
17
|
+
ok() { echo -e " ${c_green}✔${c_reset} $1"; }
|
|
18
|
+
err() { echo -e " ${c_red}✘${c_reset} $1" >&2; }
|
|
19
|
+
|
|
20
|
+
echo -e "\n ${c_cyan}${c_bold}Fluxy Installer${c_reset}\n"
|
|
21
|
+
|
|
22
|
+
# ── Check dependencies ──
|
|
23
|
+
for cmd in node npm curl tar; do
|
|
24
|
+
if ! command -v "$cmd" &>/dev/null; then
|
|
25
|
+
err "$cmd is required but not installed."
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
# ── Get tarball URL ──
|
|
31
|
+
info "Fetching latest version..."
|
|
32
|
+
TARBALL_URL=$(npm view fluxy-bot dist.tarball 2>/dev/null)
|
|
33
|
+
if [ -z "$TARBALL_URL" ]; then
|
|
34
|
+
err "Failed to fetch tarball URL from npm."
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
VERSION=$(npm view fluxy-bot version 2>/dev/null)
|
|
38
|
+
ok "Found fluxy-bot@${VERSION}"
|
|
39
|
+
|
|
40
|
+
# ── Download and extract ──
|
|
41
|
+
TMPDIR=$(mktemp -d)
|
|
42
|
+
trap 'rm -rf "$TMPDIR"' EXIT
|
|
43
|
+
|
|
44
|
+
info "Downloading..."
|
|
45
|
+
curl -fsSL "$TARBALL_URL" -o "$TMPDIR/fluxy.tgz"
|
|
46
|
+
ok "Downloaded"
|
|
47
|
+
|
|
48
|
+
info "Extracting..."
|
|
49
|
+
tar xzf "$TMPDIR/fluxy.tgz" -C "$TMPDIR"
|
|
50
|
+
ok "Extracted"
|
|
51
|
+
|
|
52
|
+
# npm pack tarballs extract into a 'package/' directory
|
|
53
|
+
EXTRACTED="$TMPDIR/package"
|
|
54
|
+
if [ ! -d "$EXTRACTED" ]; then
|
|
55
|
+
err "Unexpected tarball structure."
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# ── Copy to ~/.fluxy/ ──
|
|
60
|
+
info "Installing to $FLUXY_HOME..."
|
|
61
|
+
mkdir -p "$FLUXY_HOME"
|
|
62
|
+
|
|
63
|
+
# cp -r overwrites existing files but does NOT delete extras (config.json, memory.db, etc.)
|
|
64
|
+
cp -r "$EXTRACTED"/* "$FLUXY_HOME"/
|
|
65
|
+
# Also copy hidden files if any
|
|
66
|
+
cp -r "$EXTRACTED"/.[!.]* "$FLUXY_HOME"/ 2>/dev/null || true
|
|
67
|
+
ok "Files copied"
|
|
68
|
+
|
|
69
|
+
# ── Install dependencies ──
|
|
70
|
+
info "Installing dependencies (this may take a moment)..."
|
|
71
|
+
cd "$FLUXY_HOME"
|
|
72
|
+
npm install --omit=dev --ignore-scripts 2>/dev/null
|
|
73
|
+
ok "Dependencies installed"
|
|
74
|
+
|
|
75
|
+
# ── Create symlink ──
|
|
76
|
+
info "Creating fluxy command..."
|
|
77
|
+
chmod +x "$FLUXY_HOME/bin/cli.js"
|
|
78
|
+
|
|
79
|
+
SYMLINK_TARGET="$FLUXY_HOME/bin/cli.js"
|
|
80
|
+
SYMLINK_CREATED=false
|
|
81
|
+
|
|
82
|
+
# Try /usr/local/bin first
|
|
83
|
+
if [ -d "/usr/local/bin" ] && [ -w "/usr/local/bin" ]; then
|
|
84
|
+
ln -sf "$SYMLINK_TARGET" /usr/local/bin/fluxy
|
|
85
|
+
SYMLINK_CREATED=true
|
|
86
|
+
ok "Created /usr/local/bin/fluxy"
|
|
87
|
+
elif [ -d "/usr/local/bin" ]; then
|
|
88
|
+
# Try with sudo
|
|
89
|
+
if sudo ln -sf "$SYMLINK_TARGET" /usr/local/bin/fluxy 2>/dev/null; then
|
|
90
|
+
SYMLINK_CREATED=true
|
|
91
|
+
ok "Created /usr/local/bin/fluxy (sudo)"
|
|
92
|
+
fi
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
# Fallback to ~/.local/bin
|
|
96
|
+
if [ "$SYMLINK_CREATED" = false ]; then
|
|
97
|
+
mkdir -p "$HOME/.local/bin"
|
|
98
|
+
ln -sf "$SYMLINK_TARGET" "$HOME/.local/bin/fluxy"
|
|
99
|
+
ok "Created ~/.local/bin/fluxy"
|
|
100
|
+
|
|
101
|
+
# Check if ~/.local/bin is in PATH
|
|
102
|
+
if ! echo "$PATH" | tr ':' '\n' | grep -q "$HOME/.local/bin"; then
|
|
103
|
+
echo -e "\n ${c_dim}Add ~/.local/bin to your PATH:${c_reset}"
|
|
104
|
+
echo -e " ${c_dim} export PATH=\"\$HOME/.local/bin:\$PATH\"${c_reset}"
|
|
105
|
+
fi
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
echo -e "\n ${c_green}${c_bold}Fluxy v${VERSION} installed successfully!${c_reset}"
|
|
109
|
+
echo -e " ${c_dim}Run 'fluxy' to start your bot.${c_reset}\n"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fluxy-bot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"description": "Self-hosted AI bot — run your own AI assistant from anywhere",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"vite.fluxy.config.ts",
|
|
21
21
|
"tsconfig.json",
|
|
22
22
|
"postcss.config.js",
|
|
23
|
-
"components.json"
|
|
23
|
+
"components.json",
|
|
24
|
+
"install.sh",
|
|
25
|
+
"install.ps1"
|
|
24
26
|
],
|
|
25
27
|
"keywords": [
|
|
26
28
|
"ai",
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,30 +1,92 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
// Copies source files to ~/.fluxy/ so everything lives in one
|
|
4
|
+
// predictable location. Backward compat for `npm install -g fluxy-bot`.
|
|
5
5
|
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import os from 'os';
|
|
9
|
+
import { execSync } from 'child_process';
|
|
9
10
|
import { fileURLToPath } from 'url';
|
|
10
11
|
|
|
11
12
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
13
|
const PKG_ROOT = path.resolve(__dirname, '..');
|
|
13
14
|
const FLUXY_HOME = path.join(os.homedir(), '.fluxy');
|
|
14
|
-
const APP_DIR = path.join(FLUXY_HOME, 'app');
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
|
|
16
|
+
// Loop guard: if we're already running inside ~/.fluxy/, exit
|
|
17
|
+
// (prevents infinite loop when npm install triggers postinstall again)
|
|
18
|
+
if (path.resolve(PKG_ROOT) === path.resolve(FLUXY_HOME)) {
|
|
18
19
|
process.exit(0);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
//
|
|
22
|
+
// Dev guard: don't interfere with development
|
|
23
|
+
if (fs.existsSync(path.join(PKG_ROOT, '.git'))) {
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// ── Copy source files to ~/.fluxy/ ──
|
|
28
|
+
|
|
22
29
|
fs.mkdirSync(FLUXY_HOME, { recursive: true });
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
const DIRS_TO_COPY = [
|
|
32
|
+
'bin', 'supervisor', 'worker', 'shared', 'client',
|
|
33
|
+
'dist', 'dist-fluxy', 'scripts',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const FILES_TO_COPY = [
|
|
37
|
+
'package.json', 'vite.config.ts', 'vite.fluxy.config.ts',
|
|
38
|
+
'tsconfig.json', 'postcss.config.js', 'components.json',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
for (const dir of DIRS_TO_COPY) {
|
|
42
|
+
const src = path.join(PKG_ROOT, dir);
|
|
43
|
+
if (!fs.existsSync(src)) continue;
|
|
44
|
+
const dst = path.join(FLUXY_HOME, dir);
|
|
45
|
+
fs.cpSync(src, dst, { recursive: true, force: true });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (const file of FILES_TO_COPY) {
|
|
49
|
+
const src = path.join(PKG_ROOT, file);
|
|
50
|
+
if (!fs.existsSync(src)) continue;
|
|
51
|
+
fs.copyFileSync(src, path.join(FLUXY_HOME, file));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ── Install dependencies in ~/.fluxy/ ──
|
|
55
|
+
|
|
25
56
|
try {
|
|
26
|
-
|
|
27
|
-
|
|
57
|
+
execSync('npm install --omit=dev --ignore-scripts', {
|
|
58
|
+
cwd: FLUXY_HOME,
|
|
59
|
+
stdio: 'ignore',
|
|
60
|
+
});
|
|
61
|
+
} catch {
|
|
62
|
+
// Non-fatal: deps may already exist from a previous install
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ── Create fluxy symlink ──
|
|
28
66
|
|
|
29
|
-
|
|
30
|
-
fs.
|
|
67
|
+
const cliPath = path.join(FLUXY_HOME, 'bin', 'cli.js');
|
|
68
|
+
fs.chmodSync(cliPath, 0o755);
|
|
69
|
+
|
|
70
|
+
if (process.platform === 'win32') {
|
|
71
|
+
// On Windows, npm handles the bin linking via package.json "bin" field
|
|
72
|
+
// Just ensure the files are in place
|
|
73
|
+
} else {
|
|
74
|
+
const targets = ['/usr/local/bin/fluxy', path.join(os.homedir(), '.local', 'bin', 'fluxy')];
|
|
75
|
+
let linked = false;
|
|
76
|
+
|
|
77
|
+
for (const target of targets) {
|
|
78
|
+
try {
|
|
79
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
80
|
+
try { fs.unlinkSync(target); } catch {}
|
|
81
|
+
fs.symlinkSync(cliPath, target);
|
|
82
|
+
linked = true;
|
|
83
|
+
break;
|
|
84
|
+
} catch {
|
|
85
|
+
// No permission, try next
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!linked) {
|
|
90
|
+
console.log(`Note: Could not create fluxy symlink. You can run it directly: node ${cliPath}`);
|
|
91
|
+
}
|
|
92
|
+
}
|