UNPKG

@puberty-labs/refuctor

Version:

AI-powered, snark-fueled technical debt cleansing suite with automatic snarky language detection that turns code cleanup into a darkly humorous financial metaphor.

624 lines (413 loc) โ€ข 19.2 kB
# Refuctor - The Debt Cleansing Syndicate <img src="https://raw.githubusercontent.com/Jason-Vaughan/puberty-labs-assets/refs/heads/main/refuctor-logo.png" alt="Refuctor Logo" width="150" style="max-width: 100%;"> > *"Because even your code deserves a fresh financial start."* **Tagline**: "Refactor or Be Repossessed." --- ## ๐ŸŽฏ What is Refuctor? **Refuctor** is an AI-powered, snark-fueled technical debt cleansing suite that turns code cleanup into a darkly humorous financial metaphor. It's the world's first debt management system that actually makes developers *want* to clean up their code. **๐ŸŽฏ Optimized for Cursor IDE** - Native integration with AI-powered workflows, plus dedicated extension available for enhanced functionality. ### ๐Ÿ”ฅ Origin Story Born from the meta-irony of a debt tracker that caught its own creator making 36 markdown warnings while building the debt detection system. We used the system to fix itself in real-time - proving that recursive debt management actually works. ### โœจ Core Philosophy - **P1 Critical**: *"This is fucking embarrassing. Fix it NOW."* - **P2 High**: *"We're taking back the repo. Clean this today."* - **P3 Medium**: *"A bit crusty. Handle it this sprint."* - **P4 Low**: *"Minor blemish. But you'll pay laterโ€ฆ"* --- ## ๐Ÿ“ฆ Installation ### **Global Installation (Recommended)** ```bash # Install globally for CLI access npm install -g @puberty-labs/refuctor # Verify installation refuctor --version ```text ### **Local Installation** ```bash # Install locally in your project npm install --save-dev @puberty-labs/refuctor # Use with npx npx refuctor scan ```text ### **Cursor Extension** ```bash # Install the dedicated Cursor extension for enhanced IDE integration # Available through Cursor's extension marketplace # Search for "Refuctor - The Debt Collector" in Extensions ```text --- ## ๐Ÿš€ Features ### โœ… **Professional CLI Suite** - **๐Ÿš€ Comprehensive Setup Wizard**: Enhanced `refuctor init` with 6-step automated project setup - **๐ŸŒ Real-time Web Dashboard**: Professional-grade debt monitoring at `http://localhost:1947` - **๐Ÿ“Š Debt Detection Engine**: Markdown linting, spell checking, security audits with MAFIA/Guido escalation levels - **๐ŸŽฏ Interactive Controls**: SCAN DEBT, FIX DEBT, and NUCLEAR OPTION buttons with real-time progress updates - **๐Ÿ’ฐ Financial Metaphors**: P1-P4 debt levels with loan shark takeover warnings when debt reaches critical mass ### ๐ŸŽฏ **Cursor IDE Integration** - **๐Ÿค– Native AI Assistant Integration**: Seamless integration with Cursor's AI workflows via MCP (Model Context Protocol) - **๐Ÿ”Œ Dedicated Extension**: Custom Cursor extension for enhanced IDE experience with real-time debt indicators - **โšก AI-Powered Commands**: Natural language debt scanning - just ask "scan this project for technical debt" - **๐ŸŽฏ Optimized Workflows**: Built specifically for Cursor's AI-first development approach - **๐Ÿ“Š Status Bar Integration**: Live debt count and credit score display in IDE ### โœ… **Advanced Features** - **โšก Real-time WebSocket**: Live debt updates, progress tracking, critical alerts, and automated monitoring - **๐Ÿ”ฅ Advanced Heat Maps**: File-level debt visualization with interactive hotspot analysis and temperature indicators - **๐Ÿ“ˆ Trend Analysis**: Historical debt tracking, velocity calculations, and predictive insights with real trend data - **๐Ÿง  AI-Powered Suggestions**: Smart fix recommendations with confidence scoring and priority-based filtering - **๐Ÿ“ฑ Mobile-Responsive Design**: Touch-friendly interface with comprehensive breakpoints and landscape support - **๐Ÿ”ง API Integration**: Full REST API with `/api/debt/*` endpoints for external integrations - **๐Ÿ“‹ TECHDEBT.md Tracking**: Automated session-based debt logging with comprehensive reporting - **๐ŸŽจ Professional Branding**: Custom logo, debt-cleansing personality, responsive design - **๐Ÿ” Session Wrap Integration**: 9-step comprehensive debt scanning protocol - **๐Ÿ“ Spell Check Management**: Extensible dictionary for project-specific terms - **๐Ÿณ Cook the Books**: Export VS Code problems to markdown when Refuctor scan misses issues - **๐Ÿง  Project Intelligence**: Automatic framework detection (React, Vue, Angular, Node.js) - **โš™๏ธ Smart Configuration**: Context-aware cspell.json and .debtignore generation ### ๐ŸŽฏ **Dashboard Features (Production Ready)** **The Refuctor dashboard at `http://localhost:1947` provides comprehensive debt management:** - **๐Ÿ”ฅ Advanced Debt Visualization**: File-level breakdown with sorting, filtering, and pagination - **๐Ÿ“ˆ Historical Trend Analysis**: Interactive charts showing debt velocity, priority distribution, and key insights - **๐Ÿง  Auto-Fix Integration**: Clickable debt items that trigger automated fixes via API endpoints - **โšก Real-time Updates**: Live debt scanning with WebSocket communication and progress tracking - **๐Ÿ“ฑ Mobile-Responsive Design**: Touch-friendly interface optimized for all device sizes - **๐ŸŽฏ Performance Optimized**: Debounced search, memoized components, and efficient data handling **Dashboard Features:** - **File Debt Breakdown**: Interactive component showing files with debt counts, categories, and severity - **Trend Analysis**: Historical debt visualization with tabbed interface and SVG charts - **Search & Filter**: Debounced search with severity filtering and pagination - **Auto-Fix Controls**: File-specific, category-specific, and global debt fixing capabilities ### ๐ŸŽฏ **Specialized Goons (Advanced Features)** - **๐Ÿ”ง Markdown Fixer**: Automated markdown linting cleanup - **๐Ÿ“ฆ Import Cleaner**: Unused import elimination - **๐Ÿ’€ Comment Killer**: Remove outdated comments and dead code - **๐Ÿ’ฐ Accountant**: Credit rating system (300-850 score) with financial metaphors - **๐Ÿ”ง General Fixer**: Multi-purpose debt cleanup tool --- ## ๐Ÿ› ๏ธ Quick Start ### **1. Initialize Your Project** ```bash # Navigate to your project directory cd your-project # Run the comprehensive setup wizard refuctor init # The setup wizard will: # ๐Ÿ” Analyze your project (detect React, Vue, Angular, Node.js) # ๐Ÿ“ Generate project-specific cspell.json dictionary # ๐Ÿšซ Create .debtignore file with framework-specific patterns # ๐Ÿ“Š Set up context-aware TECHDEBT.md with monitoring recommendations # ๐Ÿ’ป Configure IDE integration (Cursor workspace optimization) # ๐ŸŽฏ Provide actionable next steps for debt management ```text ### **2. Scan for Debt** ```bash # Comprehensive debt scan refuctor scan # Verbose output with detailed breakdown refuctor scan --verbose # Check project information refuctor info ```text ### **3. Launch Dashboard (Optional)** ```bash # Start real-time dashboard (opens automatically in browser) refuctor serve # Start without opening browser refuctor serve --no-browser # Dashboard URL: http://localhost:1947 # Shows YOUR project's debt data, trends, and hotspots ``` **Dashboard displays:** - ๐Ÿ“Š **Live debt breakdown** for your project files - ๐Ÿ”ฅ **Top hotspots** with file-specific debt counts - ๐Ÿ“ˆ **Trend analysis** and debt history tracking - ๐ŸŽฏ **Interactive fixes** and priority management ### **4. Fix Issues** ```bash # See what can be auto-fixed refuctor fix --dry-run # Apply automatic fixes refuctor fix # Use specialized goons refuctor goon fix-markdown refuctor goon clean-imports refuctor goon comment-killer ```text ### **5. ๐Ÿณ Cook the Books (When Refuctor Misses Issues)** When VS Code shows problems that Refuctor scan doesn't detect: ```bash # Export VS Code problems to markdown report refuctor cook # Custom output file refuctor cook --output my-debt-report.md # Different formats refuctor cook --format json refuctor cook --format csv ```text **What "Cook the Books" does:** - ๐Ÿณ Runs markdownlint with JSON output (catches markdown issues) - ๐Ÿ“ Runs cspell for spelling issues (with detailed reporting) - ๐Ÿ’ป Runs TypeScript checks if applicable - ๐Ÿ“Š Exports everything to readable markdown with file breakdown - ๐ŸŽฏ Shows top problem files and recommended actions ### **๐Ÿ” Un-Cook the Books (`refuctor uncook`)** The opposite of "cooking" - reveals what's really hiding in ignored files: ```bash # Process ignored files in manageable chunks refuctor uncook # Customize processing refuctor uncook --chunks 5 --max-chunks 10 --max-files 25 ``` **Processing Modes:** - **๐Ÿ“ฆ Chunked Processing**: Fixed batch sizes (default 10 files/batch) - **๐Ÿค Interactive Processing**: User controls each batch with continue/pause/stop - **๐Ÿง  Smart Prioritization**: AI picks most interesting files (READMEs โ†’ package.json โ†’ docs) **What Un-Cook Does:** - ๐Ÿ” Discovers ignored files in node_modules, build/, dist/, .cache/ - ๐Ÿ“Š Processes files in performance-safe chunks with timeout protection - ๐ŸŽฏ Finds hidden debt in typically ignored locations - ๐Ÿ“‹ Provides manageable reporting without overwhelming output - โšก Prevents buffer overflow issues with massive file processing **Perfect for auditing what's really in your project beyond the main source files.** ### **๐ŸŽฏ Snarky Intelligence (`refuctor snarky-*`)** Advanced spelling analysis that distinguishes between actual typos and intentional snarky language: ```bash # Analyze spelling issues with AI intelligence refuctor snarky-scan # Add legitimate snarky terms to project dictionary refuctor snarky-add "refuctor" "puberty-labs" "bitchuation" # Fix real typos while preserving snarky language refuctor snarky-fix ``` **What Snarky Intelligence Does:** - ๐Ÿง  AI-powered analysis distinguishes typos from intentional terminology - ๐Ÿ“ Automatically adds project-specific terms to dictionary - ๐ŸŽฏ Fixes genuine mistakes while preserving brand language - ๐Ÿ’ก Learns from your project's terminology patterns ### **โš™๏ธ Mode Management (`refuctor mode`)** Configure debt classification to match your project type and team culture: ```bash # Show current mode and available options refuctor mode # Switch to startup mode (high tolerance, fast development) refuctor mode startup # Switch to enterprise mode (strict standards) refuctor mode enterprise # Auto-detect best mode for your project refuctor mode auto-detect ``` **Available Modes:** - **๐Ÿš€ STARTUP**: High tolerance, move fast and break things - **๐Ÿ‘ฅ DEV_CREW**: Balanced approach for development teams - **๐Ÿข ENTERPRISE**: Strict standards and comprehensive documentation - **๐ŸŽ“ LEARNING**: Educational feedback for skill development ### **๐ŸŽฎ Gamification System (`refuctor gamification`)** Track your debt-elimination progress with achievements and streaks: ```bash # View current progress and achievements refuctor gamification # Detailed achievement breakdown refuctor gamification --detailed # Team leaderboard (if available) refuctor gamification --leaderboard ``` ### **๐Ÿ“ฆ Dependency Management (`refuctor dependencies`)** Check for missing dependencies and get installation suggestions: ```bash # Check for missing dependencies refuctor dependencies # Get specific installation commands for your project refuctor dependencies --install ``` ### **๐Ÿšซ Ignore Management (`refuctor ignore`)** Manage `.debtignore` patterns for files you want excluded from debt tracking: ```bash # List current ignore patterns refuctor ignore list # Add new ignore pattern refuctor ignore add "*.generated.js" # Remove ignore pattern refuctor ignore remove "old-pattern" # Initialize .debtignore with common patterns refuctor ignore init ``` --- ## ๐Ÿ“‹ Available Commands ### **Core Commands** ```bash refuctor init # Initialize project with setup wizard refuctor scan # Scan for technical debt refuctor fix # Auto-fix common issues refuctor serve # Launch real-time dashboard refuctor info # Show project analysis refuctor status # Show current debt status and trends refuctor wrap # Session wrap protocol refuctor cook # Export VS Code problems refuctor uncook # Un-cook the books: audit ignored files ``` ### **Advanced Commands** ```bash refuctor snarky-scan # Analyze spelling with snarky intelligence refuctor snarky-add # Add snarky terms to dictionary refuctor snarky-fix # Fix typos while preserving snarky language refuctor mode # Manage debt classification mode refuctor ignore # Manage .debtignore patterns refuctor dependencies # Check missing dependencies refuctor mcp-server # Start MCP server for AI integration ``` ### **Goon Commands (Specialized Tools)** ```bash refuctor goon # Deploy all specialized goons refuctor accountant # Developer credit rating (300-850) refuctor comment-killer # Remove dead comments and TODOs refuctor import-cleaner # Eliminate unused imports refuctor exterminate # AGGRESSIVE: Deploy all goons simultaneously refuctor gamification # Track achievements and progress ``` ### **Fun Commands** ```bash refuctor shame # Generate humorous debt report refuctor guido # Demonstrate MAFIA โ†’ Guido escalation refuctor bailmeout # Emergency motivation quotes ``` --- ## ๐Ÿงช Proven Results ### **Real-World Testing** The complete system has successfully eliminated: - **173 markdown warnings** across documentation files - **15 spell check issues** with preserved snarky terminology - **34 additional warnings** caught during system self-testing - **310+ VS Code problems** exported and addressed via "Cook the Books" feature - **Total**: 532+ warnings eliminated with zero false positives ### **Advanced Dashboard Performance** The professional-grade dashboard provides: - **Real-time heat maps** showing debt temperature analysis - **Historical trend tracking** with persistent storage - **Live WebSocket monitoring** with <1 second response time - **Mobile-responsive design** tested across 5 breakpoint ranges ### **Meta Validation** The debt tracker caught its own creator making debt while building it, then used itself to clean up the mess AND created a professional dashboard to visualize the cleanup process in real-time. This recursive validation proves the concept works in practice. --- ## ๐ŸŽจ Branding & Personality ### **Financial Metaphors** - **Debt Levels**: P1 Foreclosure โ†’ P4 Interest Accruing - **Commands**: Refinance debt, file for bankruptcy, sell to collection agency - **Messaging**: "Your code called. It wants a debt consolidation loan." ### **Snarky Humor** - **CLI Personality**: `refuctor shame` for motivational debt shaming with financial metaphors - **Taglines**: "Debt Never Sleeps. Neither Should You." | "Refactor or Be Repossessed." - **Self-Aware**: "Built by someone who created 36 warnings while building a debt warning system." ### **Professional Edge** - **Enterprise-Ready**: Team analytics, custom integrations, priority support - **Educational Value**: Teaching clean coding practices through gamification - **Developer-Friendly**: Actually makes debt cleanup enjoyable --- ## ๐Ÿ”ง Configuration ### **Project Configuration Files** Refuctor automatically creates and manages: - **`.debtignore`** - Patterns to ignore during debt scanning - **`cspell.json`** - Spell check configuration with project-specific dictionary - **`TECHDEBT.md`** - Debt tracking file with session logs - **`.refuctor/`** - Directory for debt history and persistent data ### **Framework Detection** Refuctor automatically detects and configures for: - **React** - JSX-aware scanning and configuration - **Vue** - Vue-specific patterns and templates - **Angular** - TypeScript and Angular-specific rules - **Node.js** - Server-side JavaScript patterns - **General JavaScript/TypeScript** - Universal patterns --- ## ๐Ÿ“Š MCP Integration Refuctor includes a Model Context Protocol (MCP) server for AI assistant integration: ```bash # Start MCP server refuctor mcp-server # Available MCP tools: # - scan_debt: Scan project for technical debt # - fix_debt: Auto-fix common issues # - get_shame_report: Generate humorous debt report # - broadcast_debt_status: Share debt status across workspaces # - manage_debt_ignore: Manage .debtignore patterns # - get_debt_status: Get current debt status and trends ```text --- ## ๐Ÿš€ Getting Started ### **For Individual Developers** 1. **Install globally**: `npm install -g @puberty-labs/refuctor` 2. **Initialize project**: `refuctor init` 3. **Scan for debt**: `refuctor scan` 4. **Launch dashboard**: `refuctor serve` 5. **Fix issues**: `refuctor fix` ### **For Teams** 1. **Install in project**: `npm install --save-dev @puberty-labs/refuctor` 2. **Add to package.json scripts**: `"debt-scan": "refuctor scan"` 3. **Set up CI integration**: Run `refuctor scan` in build pipeline 4. **Use dashboard for monitoring**: `refuctor serve` for real-time tracking --- ## ๐Ÿค Contributing ### **Development Philosophy** - **No Bloat**: Every line of code must justify its existence - **Immediate Debt**: Address technical debt the moment it's identified - **Snarky but Functional**: Maintain irreverent personality without sacrificing performance - **Meta Awareness**: The system must be able to manage its own technical debt ### **Issues & Support** - **Bug Reports**: [GitHub Issues](https://github.com/puberty-labs/refuctor/issues) - **Feature Requests**: [GitHub Discussions](https://github.com/puberty-labs/refuctor/discussions) - **Documentation**: [GitHub Wiki](https://github.com/puberty-labs/refuctor/wiki) --- ## ๐Ÿ“‹ Current Status ### โœ… **Production Ready (CLI)** - **Complete CLI suite** with 8+ commands - fully functional and tested - **Debt detection engine** - professional-grade scanning and analysis - **MCP integration** for AI assistants - stable and working - **5 specialized goons** for targeted cleanup - automated fixes - **Comprehensive documentation** - ready for end users ### ๐Ÿšง **In Development (Web UI)** - **Real-time dashboard** - basic functionality working, UI polish needed - **WebSocket communication** - functional but needs optimization - **Dashboard controls** - SCAN DEBT works, FIX DEBT and NUCLEAR OPTION in progress ### ๐ŸŽฏ **Future Development** - Gamification system with achievements - Advanced AI-powered suggestions - Team collaboration features - IDE extensions (Cursor, VS Code) **Recommendation**: Use the CLI commands for production work, dashboard for monitoring only. --- ## ๐ŸŽฌ Conclusion **Refuctor transforms technical debt management from reactive cleanup to proactive prevention.** By combining professional-grade tooling with irreverent humor and financial metaphors, we've created a tool that developers actually want to use. The foundation is proven, the results are measurable, and the personality is unforgettable. **Ready to eliminate technical debt with a sense of humor?** --- *"Built by someone who created 36 warnings while building a debt warning system. Self-own level: legendary."* **Let's turn technical debt into a solved problem.** ๐Ÿš€๐Ÿ’ช