Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

checkpoint: File edit:

rUvd6d721951525
diff --git a/scripts/cleanup-v3.sh b/scripts/cleanup-v3.sh
new file mode 100644
index 0000000000..b567aea2bb
--- /dev/null
+++ b/scripts/cleanup-v3.sh
@@ -0,0 +1,222 @@
+#!/bin/bash
+#
+# V3 Repository Cleanup Script
+# Removes build artifacts, backup files, and cleans up .gitignore
+# Part of claude-flow v3 migration cleanup (Master Plan Section 5)
+#
+
+set -e
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+BLUE='\033[0;34m'
+NC='\033[0m' # No Color
+
+# Track cleanup stats
+TOTAL_SAVED=0
+FILES_REMOVED=0
+
+echo -e "${BLUE}╔════════════════════════════════════════════════════════╗${NC}"
+echo -e "${BLUE}β•‘ Claude Flow V3 Repository Cleanup Script β•‘${NC}"
+echo -e "${BLUE}β•‘ Master Plan Section 5: Repository Cleanup β•‘${NC}"
+echo -e "${BLUE}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${NC}"
+echo ""
+
+# Function to calculate size
+get_size() {
+ if [ -e "$1" ]; then
+ du -sh "$1" 2>/dev/null | awk '{print $1}'
+ else
+ echo "0"
+ fi
+}
+
+# Function to remove tracked files from git
+remove_from_git() {
+ local path="$1"
+ local description="$2"
+
+ echo -e "${YELLOW}Processing: ${description}${NC}"
+
+ if git ls-files --error-unmatch "$path" > /dev/null 2>&1; then
+ local size=$(get_size "$path")
+ echo " Found tracked: $path (Size: $size)"
+
+ if [ "$DRY_RUN" = true ]; then
+ echo " [DRY RUN] Would remove from git: $path"
+ else
+ git rm -r --cached "$path" 2>/dev/null || true
+ echo -e " ${GREEN}βœ“ Removed from git tracking${NC}"
+ FILES_REMOVED=$((FILES_REMOVED + 1))
+ fi
+ else
+ echo " Not tracked in git (will be ignored by .gitignore)"
+ fi
+}
+
+# Function to delete files
+delete_files() {
+ local pattern="$1"
+ local description="$2"
+
+ echo -e "${YELLOW}Deleting: ${description}${NC}"
+
+ local files=$(find . -type f -path "$pattern" ! -path "*/node_modules/*" ! -path "*/.git/*" 2>/dev/null)
+
+ if [ -z "$files" ]; then
+ echo " No files found matching pattern"
+ return
+ fi
+
+ while IFS= read -r file; do
+ if [ -f "$file" ]; then
+ local size=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null || echo "0")
+ TOTAL_SAVED=$((TOTAL_SAVED + size))
+
+ if [ "$DRY_RUN" = true ]; then
+ echo " [DRY RUN] Would delete: $file"
+ else
+ rm -f "$file"
+ echo " ${GREEN}βœ“ Deleted: $file${NC}"
+ FILES_REMOVED=$((FILES_REMOVED + 1))
+ fi
+ fi
+ done <<< "$files"
+}
+
+# Parse arguments
+DRY_RUN=false
+if [ "$1" = "--dry-run" ]; then
+ DRY_RUN=true
+ echo -e "${YELLOW}Running in DRY RUN mode - no changes will be made${NC}"
+ echo ""
+fi
+
+echo -e "${BLUE}Step 1: Remove tracked build artifacts (dist-cjs/)${NC}"
+echo "----------------------------------------"
+if [ -d "v2/dist-cjs" ]; then
+ remove_from_git "v2/dist-cjs" "CommonJS build artifacts (v2/dist-cjs/)"
+
+ if [ "$DRY_RUN" = false ]; then
+ echo " Ensuring dist-cjs is in .gitignore..."
+ if ! grep -q "^dist-cjs/" .gitignore; then
+ echo "dist-cjs/" >> .gitignore
+ echo -e " ${GREEN}βœ“ Added dist-cjs/ to .gitignore${NC}"
+ fi
+ fi
+else
+ echo " No dist-cjs directory found"
+fi
+echo ""
+
+echo -e "${BLUE}Step 2: Delete backup files in bin/${NC}"
+echo "----------------------------------------"
+delete_files "*/bin/*-old.js" "Old JavaScript files (*-old.js)"
+delete_files "*/bin/*.backup.js" "Backup JavaScript files (*.backup.js)"
+delete_files "*/bin/*.bak" "Backup files (*.bak)"
+echo ""
+
+echo -e "${BLUE}Step 3: Delete backup files in docs/reasoningbank/models/${NC}"
+echo "----------------------------------------"
+delete_files "*/docs/reasoningbank/models/*.backup" "Model backup files (*.backup)"
+echo ""
+
+echo -e "${BLUE}Step 4: Delete other backup files${NC}"
+echo "----------------------------------------"
+delete_files "*/src/**/*-old.*" "Old source files (*-old.*)"
+delete_files "*/src/**/*.backup" "Source backup files (*.backup)"
+delete_files "*/dist-cjs/**/*-old.*" "Old build files in dist-cjs"
+echo ""
+
+echo -e "${BLUE}Step 5: Clean up .gitignore duplicates${NC}"
+echo "----------------------------------------"
+if [ "$DRY_RUN" = true ]; then
+ echo "[DRY RUN] Would check for duplicate entries in .gitignore"
+else
+ # Create temporary file with unique entries
+ sort .gitignore | uniq > .gitignore.tmp
+
+ # Count duplicates
+ ORIG_LINES=$(wc -l < .gitignore)
+ NEW_LINES=$(wc -l < .gitignore.tmp)
+ DUPLICATES=$((ORIG_LINES - NEW_LINES))
+
+ if [ $DUPLICATES -gt 0 ]; then
+ mv .gitignore.tmp .gitignore
+ echo -e " ${GREEN}βœ“ Removed $DUPLICATES duplicate entries from .gitignore${NC}"
+ else
+ rm .gitignore.tmp
+ echo " No duplicate entries found in .gitignore"
+ fi
+
+ # Check for specific known duplicates
+ DIST_COUNT=$(grep -c "^dist/$" .gitignore || echo "0")
+ DS_STORE_COUNT=$(grep -c "^\.DS_Store$" .gitignore || echo "0")
+ LOG_COUNT=$(grep -c "^\*\.log$\|^yarn-debug\.log\*$\|^yarn-error\.log\*$\|^lerna-debug\.log\*$" .gitignore | head -1)
+
+ echo " Duplicate pattern check:"
+ echo " - dist/ entries: $DIST_COUNT"
+ echo " - .DS_Store entries: $DS_STORE_COUNT"
+ echo " - Log file patterns: $LOG_COUNT"
+fi
+echo ""
+
+echo -e "${BLUE}Step 6: Verify lock file status${NC}"
+echo "----------------------------------------"
+LOCK_FILES=$(ls -1 package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null | wc -l)
+if [ "$LOCK_FILES" -eq 1 ]; then
+ LOCK_FILE=$(ls -1 package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null)
+ echo -e " ${GREEN}βœ“ Single lock file found: $LOCK_FILE${NC}"
+elif [ "$LOCK_FILES" -gt 1 ]; then
+ echo -e " ${RED}⚠ WARNING: Multiple lock files found:${NC}"
+ ls -1 package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null
+ echo " Recommendation: Choose one package manager and remove other lock files"
+else
+ echo -e " ${RED}⚠ WARNING: No lock file found${NC}"
+fi
+echo ""
+
+# Calculate and display savings
+echo -e "${BLUE}╔════════════════════════════════════════════════════════╗${NC}"
+echo -e "${BLUE}β•‘ Cleanup Summary β•‘${NC}"
+echo -e "${BLUE}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${NC}"
+echo ""
+
+if [ "$DRY_RUN" = true ]; then
+ echo -e "${YELLOW}DRY RUN COMPLETE - No changes were made${NC}"
+ echo ""
+fi
+
+echo "Files processed: $FILES_REMOVED"
+
+# Convert bytes to human readable
+if [ $TOTAL_SAVED -gt 1073741824 ]; then
+ SAVED_GB=$(awk "BEGIN {printf \"%.2f\", $TOTAL_SAVED/1073741824}")
+ echo "Total space saved: ${SAVED_GB} GB"
+elif [ $TOTAL_SAVED -gt 1048576 ]; then
+ SAVED_MB=$(awk "BEGIN {printf \"%.2f\", $TOTAL_SAVED/1048576}")
+ echo "Total space saved: ${SAVED_MB} MB"
+elif [ $TOTAL_SAVED -gt 1024 ]; then
+ SAVED_KB=$(awk "BEGIN {printf \"%.2f\", $TOTAL_SAVED/1024}")
+ echo "Total space saved: ${SAVED_KB} KB"
+else
+ echo "Total space saved: ${TOTAL_SAVED} bytes"
+fi
+
+echo ""
+echo -e "${GREEN}Repository cleanup completed!${NC}"
+echo ""
+
+if [ "$DRY_RUN" = false ]; then
+ echo "Next steps:"
+ echo " 1. Review changes: git status"
+ echo " 2. Commit cleanup: git add .gitignore && git commit -m 'chore: v3 repository cleanup'"
+ echo " 3. Verify build: npm run build (or pnpm/yarn)"
+ echo " 4. Update documentation if needed"
+else
+ echo "To apply these changes, run:"
+ echo " bash scripts/cleanup-v3.sh"
+fi
+echo ""
diff --git a/v3/@claude-flow/cli/src/commands/agent.ts b/v3/@claude-flow/cli/src/commands/agent.ts
index 67ec63bee7..e2131f0843 100644
--- a/v3/@claude-flow/cli/src/commands/agent.ts
+++ b/v3/@claude-flow/cli/src/commands/agent.ts
@@ -190,59 +190,71 @@ const listCommand: Command = {
}
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
- // Simulated agent data
- const agents = [
- { id: 'agent-001', name: 'coder-main', type: 'coder', status: 'active', tasks: 3, uptime: '2h 15m' },
- { id: 'agent-002', name: 'researcher-1', type: 'researcher', status: 'active', tasks: 1, uptime: '45m' },
- { id: 'agent-003', name: 'tester-qa', type: 'tester', status: 'idle', tasks: 0, uptime: '1h 30m' },
- { id: 'agent-004', name: 'reviewer-sec', type: 'reviewer', status: 'active', tasks: 2, uptime: '3h' }
- ];
-
- // Apply filters
- let filtered = agents;
-
- if (ctx.flags.type) {
- filtered = filtered.filter(a => a.type === ctx.flags.type);
- }
-
- if (ctx.flags.status) {
- filtered = filtered.filter(a => a.status === ctx.flags.status);
- }
+ try {
+ // Call MCP tool to list agents
+ const result = await callMCPTool<{
+ agents: Array<{
+ id: string;
+ agentType: string;
+ status: 'active' | 'idle' | 'terminated';
+ createdAt: string;
+ lastActivityAt?: string;
+ }>;
+ total: number;
+ }>('agent/list', {
+ status: ctx.flags.all ? 'all' : ctx.flags.status || undefined,
+ agentType: ctx.flags.type || undefined,
+ limit: 100,
+ });
- if (!ctx.flags.all) {
- filtered = filtered.filter(a => a.status !== 'inactive');
- }
+ if (ctx.flags.format === 'json') {
+ output.printJson(result);
+ return { success: true, data: result };
+ }
- if (ctx.flags.format === 'json') {
- output.printJson(filtered);
- return { success: true, data: filtered };
- }
+ output.writeln();
+ output.writeln(output.bold('Active Agents'));
+ output.writeln();
- output.writeln();
- output.writeln(output.bold('Active Agents'));
- output.writeln();
+ if (result.agents.length === 0) {
+ output.printInfo('No agents found matching criteria');
+ return { success: true, data: result };
+ }
- if (filtered.length === 0) {
- output.printInfo('No agents found matching criteria');
- return { success: true, data: [] };
- }
+ // Format for display
+ const displayAgents = result.agents.map(agent => ({
+ id: agent.id,
+ type: agent.agentType,
+ status: agent.status,
+ created: new Date(agent.createdAt).toLocaleTimeString(),
+ lastActivity: agent.lastActivityAt
+ ? new Date(agent.lastActivityAt).toLocaleTimeString()
+ : 'N/A',
+ }));
- output.printTable({
- columns: [
- { key: 'id', header: 'ID', width: 12 },
- { key: 'name', header: 'Name', width: 15 },
- { key: 'type', header: 'Type', width: 12 },
- { key: 'status', header: 'Status', width: 10, format: formatStatus },
- { key: 'tasks', header: 'Tasks', width: 8, align: 'right' },
- { key: 'uptime', header: 'Uptime', width: 10 }
- ],
- data: filtered
- });
+ output.printTable({
+ columns: [
+ { key: 'id', header: 'ID', width: 20 },
+ { key: 'type', header: 'Type', width: 15 },
+ { key: 'status', header: 'Status', width: 12, format: formatStatus },
+ { key: 'created', header: 'Created', width: 12 },
+ { key: 'lastActivity', header: 'Last Activity', width: 12 }
+ ],
+ data: displayAgents
+ });
- output.writeln();
- output.printInfo(`Total: ${filtered.length} agents`);
+ output.writeln();
+ output.printInfo(`Total: ${result.total} agents`);
- return { success: true, data: filtered };
+ return { success: true, data: result };
+ } catch (error) {
+ if (error instanceof MCPClientError) {
+ output.printError(`Failed to list agents: ${error.message}`);
+ } else {
+ output.printError(`Unexpected error: ${String(error)}`);
+ }
+ return { success: false, exitCode: 1 };
+ }
}
};