mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
fix: auto-regenerate statusline on older installs, show real version
- session-start hook detects old statusline (Math.floor(sizeKB/2) or Maturity fallback) and auto-regenerates from current generator - Statusline header now shows real package version (e.g. "RuFlo v3.5.63") instead of hardcoded "RuFlo V3" — reads from @claude-flow/cli package.json - Deployed statusline.cjs updated for this repo - Older installs auto-fix on next session start via MCP hook Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
1 parent
f6ab545901
commit
a0ef36cbbd
6 files changed
+56
-6
No files matched your search
@@ -26,6 +26,21 @@ const CONFIG = {
|
||||
|
||||
const CWD = process.cwd();
|
||||
|
||||
// Read package version once at startup
|
||||
let pkgVersion = '3.5';
|
||||
try {
|
||||
const pkgPaths = [
|
||||
path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'package.json'),
|
||||
path.join(CWD, 'v3', '@claude-flow', 'cli', 'package.json'),
|
||||
];
|
||||
for (const p of pkgPaths) {
|
||||
if (fs.existsSync(p)) {
|
||||
const pkg = JSON.parse(fs.readFileSync(p, 'utf-8'));
|
||||
if (pkg.version) { pkgVersion = pkg.version; break; }
|
||||
}
|
||||
}
|
||||
} catch { /* use default */ }
|
||||
|
||||
// ANSI colors
|
||||
const c = {
|
||||
reset: '\x1b[0m',
|
||||
@@ -601,7 +616,7 @@ function generateStatusline() {
|
||||
const parts = [];
|
||||
|
||||
// Branding
|
||||
parts.push(`${c.bold}${c.brightPurple}\u258A RuFlo V3${c.reset}`);
|
||||
parts.push(`${c.bold}${c.brightPurple}\u258A RuFlo v${pkgVersion || '3.5'}${c.reset}`);
|
||||
|
||||
// User + swarm indicator
|
||||
const dot = swarm.coordinationActive ? `${c.brightGreen}\u25CF${c.reset}` : `${c.brightCyan}\u25CF${c.reset}`;
|
||||
@@ -668,7 +683,7 @@ function generateDashboard() {
|
||||
const lines = [];
|
||||
|
||||
// Header
|
||||
let header = `${c.bold}${c.brightPurple}\u258A RuFlo V3 ${c.reset}`;
|
||||
let header = `${c.bold}${c.brightPurple}\u258A RuFlo v${pkgVersion} ${c.reset}`;
|
||||
header += `${swarm.coordinationActive ? c.brightCyan : c.dim}\u25CF ${c.brightCyan}${git.name}${c.reset}`;
|
||||
if (git.gitBranch) {
|
||||
header += ` ${c.dim}\u2502${c.reset} ${c.brightBlue}\u23C7 ${git.gitBranch}${c.reset}`;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-flow",
|
||||
"version": "3.5.60",
|
||||
"version": "3.5.63",
|
||||
"description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ruflo",
|
||||
"version": "3.5.59",
|
||||
"version": "3.5.63",
|
||||
"description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
|
||||
"main": "bin/ruflo.js",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@claude-flow/cli",
|
||||
"version": "3.5.60",
|
||||
"version": "3.5.63",
|
||||
"type": "module",
|
||||
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
||||
"main": "dist/src/index.js",
|
||||
|
||||
@@ -642,7 +642,23 @@ function generateStatusline() {
|
||||
const lines = [];
|
||||
|
||||
// Header
|
||||
let header = c.bold + c.brightPurple + '\\u258A RuFlo V3.5 ' + c.reset;
|
||||
// Read version from package.json
|
||||
let pkgVersion = '3.5';
|
||||
try {
|
||||
const pkgPath = path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'package.json');
|
||||
if (fs.existsSync(pkgPath)) {
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
||||
if (pkg.version) pkgVersion = pkg.version;
|
||||
} else {
|
||||
// Try npx-installed location
|
||||
const npxPkg = path.join(CWD, 'v3', '@claude-flow', 'cli', 'package.json');
|
||||
if (fs.existsSync(npxPkg)) {
|
||||
const pkg = JSON.parse(fs.readFileSync(npxPkg, 'utf-8'));
|
||||
if (pkg.version) pkgVersion = pkg.version;
|
||||
}
|
||||
}
|
||||
} catch { /* use default */ }
|
||||
let header = c.bold + c.brightPurple + '\\u258A RuFlo V' + pkgVersion + ' ' + c.reset;
|
||||
header += (swarm.coordinationActive ? c.brightCyan : c.dim) + '\\u25CF ' + c.brightCyan + git.name + c.reset;
|
||||
if (git.gitBranch) {
|
||||
header += ' ' + c.dim + '\\u2502' + c.reset + ' ' + c.brightBlue + '\\u23C7 ' + git.gitBranch + c.reset;
|
||||
|
||||
@@ -1716,6 +1716,25 @@ export const hooksSessionStart: MCPTool = {
|
||||
const restoreLatest = params.restoreLatest as boolean;
|
||||
const shouldStartDaemon = params.startDaemon === true;
|
||||
|
||||
// Auto-regenerate statusline if outdated (fixes older installs)
|
||||
// Checks for the old fake heuristic: "Math.floor(sizeKB / 2)"
|
||||
try {
|
||||
const statuslinePath = join(getProjectCwd(), '.claude', 'helpers', 'statusline.cjs');
|
||||
if (existsSync(statuslinePath)) {
|
||||
const content = readFileSync(statuslinePath, 'utf-8');
|
||||
if (content.includes('Math.floor(sizeKB / 2)') || content.includes('Maturity fallback')) {
|
||||
// Old version detected — regenerate from current generator
|
||||
const { generateStatuslineScript } = await import('../init/statusline-generator.js');
|
||||
const newContent = generateStatuslineScript({
|
||||
runtime: { maxAgents: 15, topology: 'hierarchical', strategy: 'specialized' },
|
||||
} as any);
|
||||
writeFileSync(statuslinePath, newContent, 'utf-8');
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Non-critical — old statusline continues to work, just with stale heuristics
|
||||
}
|
||||
|
||||
// Auto-start daemon if enabled
|
||||
let daemonStatus: { started: boolean; pid?: number; error?: string } = { started: false };
|
||||
if (shouldStartDaemon) {
|
||||
|
||||
Reference in new issue
Block a user