Add NPM distribution support with hybrid installation approach
Major changes: - Add package.json with NPM packaging configuration - Create Node.js CLI interface (bin/claude-hooks.js) with full command set - Convert bash scripts to Python for better npm integration - Add npm postinstall/preuninstall hooks for automatic setup - Update bootstrap prompt to recommend NPM method with git fallback - Enhance README with NPM-first documentation - Maintain backward compatibility with existing git installation Features: - npm install -g claude-hooks for easy distribution - claude-hooks init/status/test/backup/uninstall commands - Automatic Python dependency installation - Conflict detection and prevention - Hybrid approach supporting both npm and git workflows This resolves installation complexity while maintaining developer flexibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1e169a5d45
commit
9445e09c48
13 changed files with 1055 additions and 107 deletions
33
scripts/npm-preuninstall.js
Normal file
33
scripts/npm-preuninstall.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
|
||||
console.log('🗑️ Claude Hooks pre-uninstall cleanup...');
|
||||
|
||||
// Check if hooks are configured
|
||||
const hooksConfig = path.join(os.homedir(), '.config', 'claude', 'hooks.json');
|
||||
|
||||
if (fs.existsSync(hooksConfig)) {
|
||||
console.log('⚠️ Claude Hooks configuration detected');
|
||||
console.log('');
|
||||
console.log('IMPORTANT: This will remove the NPM package but leave hooks active!');
|
||||
console.log('');
|
||||
console.log('To properly uninstall:');
|
||||
console.log('1. Run: claude-hooks uninstall');
|
||||
console.log('2. Then run: npm uninstall -g claude-hooks');
|
||||
console.log('');
|
||||
console.log('Or to force removal of hooks configuration:');
|
||||
console.log(`rm -f "${hooksConfig}"`);
|
||||
console.log('');
|
||||
|
||||
// Give user a moment to see the message
|
||||
setTimeout(() => {
|
||||
console.log('Continuing with NPM package removal...');
|
||||
}, 2000);
|
||||
} else {
|
||||
console.log('✓ No active hooks configuration found');
|
||||
}
|
||||
|
||||
console.log('✓ Pre-uninstall check complete');
|
||||
Loading…
Add table
Add a link
Reference in a new issue