fix: Remove require() from ES module to fix swarm monitor error

- Fixed 'require is not defined' error in swarm.js
- Replaced require('fs') with proper ES module import
- Already imported readFileSync at top of file
- Fixes issue reported by users with global installation
- Version bump to 2.0.0-alpha.112
This commit is contained in:
rUv committed 2025-09-19 15:50:08 +00:00
1 parent 9766ec184a
commit 49812db144
6 files changed
+2394 -10

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
{
"startTime": 1758291080329,
"startTime": 1758297007212,
"totalTasks": 1,
"successfulTasks": 1,
"failedTasks": 0,
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -1,10 +1,10 @@
[
{
"id": "cmd-hooks-1758291080432",
"id": "cmd-hooks-1758297007320",
"type": "hooks",
"success": true,
"duration": 10.392590000000041,
"timestamp": 1758291080442,
"duration": 9.737476000000015,
"timestamp": 1758297007329,
"metadata": {}
}
]
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
VERSION="2.0.0-alpha.110"
VERSION="2.0.0-alpha.111"
# Determine the correct path based on how the script is invoked
if [ -L "$0" ]; then
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
"version": "2.0.0-alpha.111",
"version": "2.0.0-alpha.112",
"description": "Enterprise-grade AI agent orchestration with ruv-swarm integration (Alpha Release)",
"mcpName": "io.github.ruvnet/claude-flow",
"main": "cli.mjs",
+12 -4
View File
@@ -4,7 +4,7 @@
import { args, mkdirAsync, writeTextFile, exit, cwd } from '../node-compat.js';
import { spawn, execSync } from 'child_process';
import { existsSync, chmodSync, statSync } from 'fs';
import { existsSync, chmodSync, statSync, readFileSync } from 'fs';
import { open } from 'fs/promises';
import process from 'process';
import path from 'path';
@@ -29,9 +29,17 @@ function isHeadlessEnvironment() {
const isCI = ciEnvironments.some(env => process.env[env]);
// Check if running in Docker
const isDocker = existsSync('/.dockerenv') ||
(existsSync('/proc/1/cgroup') &&
require('fs').readFileSync('/proc/1/cgroup', 'utf8').includes('docker'));
let isDocker = existsSync('/.dockerenv');
// Additional Docker check for cgroup
if (!isDocker && existsSync('/proc/1/cgroup')) {
try {
const cgroupContent = readFileSync('/proc/1/cgroup', 'utf8');
isDocker = cgroupContent.includes('docker');
} catch {
// Ignore read errors
}
}
// Check TTY availability
const hasTTY = process.stdin.isTTY && process.stdout.isTTY;