npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

claude-code-automation

v3.0.6

Published

πŸš€ Generic project automation system with anti-compaction protection and recovery capabilities. Automatically detects project type (React, Node.js, Python, Rust, Go, Java) and provides intelligent analysis. Claude Code optimized - run 'welcome' after inst

Readme

Code Automation πŸš€

Universal anti-compaction system with perfect recovery capabilities for Claude Code projects

⚠️ Note: This package is specifically designed for Claude Code AI assistant sessions and will not work with other AI tools (ChatGPT, Copilot, Cursor, etc.).

npm version License: MIT

🌟 Latest Features (v3.0.6)

πŸ› FIXED: Critical Installation Bug (v3.0.6)

  • βœ… Complete File Installation - Fixed missing anti-truncation-guard.js file during installation
  • πŸ› οΈ All NPM Scripts Work - Users can now run all automation commands without module errors
  • 🎯 Immediate Fix - Resolves "Cannot find module" error for automation:guard command

πŸ› FIXED: Installation Issues (v3.0.2)

  • βœ… Reliable Installation - Fixed critical bug where automation files weren't copied
  • πŸ” Enhanced Error Reporting - Clear feedback when installation fails
  • πŸ“Š Detailed Logging - See exactly what's happening during installation
  • ⚑ Fail-Fast Behavior - Installation stops immediately with helpful error messages

πŸ”’ Enterprise Security (v3.0.0)

  • πŸ›‘οΈ SecureProcessManager - Enterprise-grade process security system
  • βš”οΈ Command Injection Prevention - Blocks dangerous shell patterns (;, &&, ||, |, etc.)
  • πŸ“Š Resource Limits - Process count (5 max), memory (512MB), timeout (2min) enforcement
  • πŸ” Process Isolation - Secure project-level process management
  • 🎯 Command Whitelisting - Only allow safe npm, git, node operations
  • πŸ“± Verbose Mode - --verbose flag for detailed operation feedback

🧠 Core Features

  • πŸ›‘οΈ Anti-Truncation Guard - Prevents context truncation in real-time
  • πŸ” Compaction Risk Analyzer - Predicts and prevents compaction events
  • ⚑ Live Preservation Engine - Continuous context monitoring
  • 🎯 Advanced Recovery System - Comprehensive project reconstruction
  • πŸ“Š Development Session Tracker - Maintains session continuity
  • 🧠 Enhanced Context Analysis - Deep project understanding

🎯 The Problem This Solves

Context Loss is the #1 problem when working with Claude Code:

  • ❌ Long sessions lose context due to token limits
  • ❌ Complex projects get "compacted" and lose detail
  • ❌ Recovery is manual and error-prone
  • ❌ Progress gets lost between sessions

βœ… The Solution

Code Automation provides:

  • βœ… Fixed critical installation bug - All automation files now install correctly (v3.0.6)
  • βœ… Fixed installation issues - Reliable file copying and clear error messages (v3.0.2)
  • βœ… Enterprise-grade security - Process isolation, command validation, resource limits
  • βœ… Automatic context preservation every 30 minutes
  • βœ… Advanced project recovery from any state
  • βœ… Real-time compaction protection
  • βœ… Professional user experience with verbose feedback
  • βœ… Zero-configuration setup
  • βœ… Reliable automation

πŸš€ Quick Start

Installation

# Global installation (recommended)
npm install -g claude-code-automation

# ⚠️ IMPORTANT: NPM doesn't show post-install messages for global packages
# Run this command immediately after install:
welcome

# Or get detailed help
code-automation help

# Or local installation
npm install claude-code-automation --save-dev

Setup Your Project

# Navigate to your project
cd your-project

# Install automation system
claude-code-automation install

# Start protection immediately (with verbose feedback)
code-automation --verbose preserve

# Or use npm scripts
npm run automation:preserve

πŸ“‹ Available Commands

CLI Commands (Global)

claude-code-automation install              # Setup in current project
code-automation --verbose preserve  # Preserve current context (with detailed feedback)
code-automation --verbose recover   # Recover from backup (with detailed feedback)
code-automation --verbose analyze   # Analyze project state (with detailed feedback)
preserve                            # Quick preserve (silent)
recover                             # Quick recover (silent)
analyze                             # Quick analyze (silent)
inject                              # Inject into existing project

πŸ”’ Security Options

code-automation --verbose [command]  # Enable detailed security feedback
code-automation --quiet [command]    # Suppress non-essential output

NPM Scripts (Project)

npm run automation:preserve  # Preserve current state
npm run automation:recover   # Recover from latest backup
npm run automation:analyze   # Analyze project health
npm run automation:daily     # Run full automation cycle
npm run automation:guard     # Start anti-truncation guard

πŸ”§ Core Features

πŸ›‘οΈ Anti-Truncation Guard

Prevents context loss before it happens:

npm run automation:guard
  • Monitors token usage in real-time
  • Triggers preservation before limits
  • Maintains conversation continuity

πŸ” Compaction Risk Analyzer

Predicts when compaction will occur:

  • Analyzes conversation patterns
  • Calculates risk scores
  • Proactive preservation triggers

⚑ Live Preservation Engine

Continuous background protection:

  • Auto-saves every 30 minutes
  • Incremental state updates
  • Zero performance impact

🎯 Advanced Recovery System

Comprehensive project restoration:

recover
# Attempts to restore project state
  • Reconstructs complete project state
  • Restores all decisions and context
  • Maintains development history

πŸ”’ Enterprise Security (v3.0.0)

πŸ›‘οΈ SecureProcessManager

  • Process Isolation: Each project runs in isolated context
  • Resource Limits: Max 5 processes, 512MB memory, 2-minute timeouts
  • Command Whitelisting: Only npm, yarn, pnpm, node, git allowed
  • Input Sanitization: Blocks dangerous patterns: ;, &&, ||, |, \``, $, >, <, &`

βš”οΈ Security Features

# Secure command execution with validation
code-automation --verbose preserve  # Shows security decisions

# Process resource monitoring
code-automation analyze             # Displays security status

# Safe automation without global process hijacking
npm run automation:daily           # Uses secure process management

πŸ” What's Protected

  • βœ… Command Injection Prevention - All user input validated
  • βœ… Process Resource Limits - Prevents system overload
  • βœ… Path Traversal Protection - Secure file operations only
  • βœ… Process Cleanup - Automatic resource cleanup on exit
  • βœ… Timeout Enforcement - No runaway processes

🚨 Breaking Changes in v3.0.0

  • All process execution now goes through SecureProcessManager
  • Stricter command validation may block some edge cases
  • Process limits enforced (upgrade from unlimited processes)
  • More restrictive input validation for enhanced security

πŸ“Š Usage Examples

Basic Project Setup

# Install globally
npm install -g claude-code-automation

# Setup new project
mkdir my-claude-project
cd my-claude-project
claude-code-automation install

# Start development with protection
npm run automation:preserve

Recovering Lost Context

# If you lose context during development
recover

# Or use NPM script
npm run automation:recover

# Verify recovery
npm run automation:analyze

Continuous Protection

# Start anti-truncation guard
npm run automation:guard

# Run daily maintenance
npm run automation:daily

# Check project health
npm run automation:analyze

πŸ—οΈ Architecture

Core Components

  • Context Preservation Engine - State capture and storage
  • Auto Recovery System - Intelligent project reconstruction
  • Live Preservation Engine - Real-time monitoring
  • Anti-Truncation Guard - Proactive protection
  • Compaction Risk Analyzer - Predictive analysis
  • Development Session Tracker - Session continuity

File Structure

your-project/
β”œβ”€β”€ scripts/automation/           # Automation scripts
β”œβ”€β”€ docs/automation/             # Generated documentation
β”œβ”€β”€ docs/state/                  # Project state snapshots
β”œβ”€β”€ docs/recovery/               # Recovery instructions
└── package.json                 # Updated with scripts

βš™οΈ Configuration

Configuration is automatic, but can be customized:

{
  "version": "1.0.0",
  "enabled": true,
  "features": {
    "contextPreservation": true,
    "antiTruncation": true,
    "livePreservation": true,
    "perfectRecovery": true,
    "riskAnalysis": true,
    "sessionTracking": true
  },
  "settings": {
    "preservationInterval": 1800000,
    "maxBackups": 50,
    "compressionEnabled": true,
    "verboseLogging": false
  }
}

πŸ§ͺ Testing

# Test installation
npm test

# Verify integrity
npm run verify

# Test recovery system
code-automation recover --verify

πŸ“ˆ Benefits

For Developers

  • βœ… Never lose progress again
  • βœ… Seamless session continuity
  • βœ… Instant project recovery
  • βœ… Zero maintenance required

For Teams

  • βœ… Consistent project state
  • βœ… Reliable handoffs
  • βœ… Automated documentation
  • βœ… Reduced onboarding time

πŸ”„ Upgrading

# Upgrade globally
npm install -g claude-code-automation@latest

# Update existing projects
cd your-project
claude-code-automation install

Latest features are automatically enabled!

πŸ› Troubleshooting

Common Issues

Installation fails (Fixed in v3.0.6):

# v3.0.6+ ensures all automation files are copied during installation
# v3.0.2+ provides clear error messages if installation fails
claude-code-automation install

# If you see "Failed to copy automation files":
# 1. Check npm permissions
# 2. Try reinstalling the package
npm uninstall -g claude-code-automation
npm install -g claude-code-automation

# Alternative: Use npx
npx claude-claude-code-automation install

Files not copied to .automation/ directory:

# v3.0.2+ shows detailed logging during installation
# Look for these messages:
# βœ… Copied: context-preservation.js
# βœ… All 4 automation files copied successfully

# If files are missing, check:
ls -la .automation/
# Should contain: context-preservation.js, auto-recovery.js, etc.

Recovery doesn't work:

# Verify backup exists
ls docs/state/

# Force recovery
recover --force

# Check integrity
npm run verify

Context still lost:

# Enable verbose logging
npm run automation:preserve -- --verbose

# Check risk analysis
npm run automation:analyze

πŸ“š Advanced Usage

Custom Preservation Intervals

// In your project
const preservation = require('claude-code-automation');
preservation.setInterval(15 * 60 * 1000); // 15 minutes

Integration with CI/CD

# .github/workflows/preserve.yml
name: Context Preservation
on: [push, pull_request]
jobs:
  preserve:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm install -g claude-code-automation
      - run: preserve

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

πŸ“„ License

MIT License - see LICENSE