tractatus/.claude/hooks/all-command-detector.js
TheFlow 35348e3a8e feat(governance): third wave enforcement - 22% improvement (46% → 56%)
Implements 4 additional architectural enforcement mechanisms:

 All Command Detection (inst_040) - .claude/hooks/all-command-detector.js
 Deployment Structure Validation (inst_025) - scripts/verify-deployment-structure.js
 File Permissions Check (inst_020_CONSOLIDATED) - scripts/check-file-permissions.js
 Environment Variable Standards (inst_026) - scripts/check-env-var-standards.js

📊 Progress: 22/39 enforced (56%), +4 from wave 2, 17 gaps remaining

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 13:38:18 +13:00

46 lines
1.2 KiB
JavaScript
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
/**
* "All" Command Detector - Enforces inst_040
* Reminds Claude to comprehensively verify when user says "all"
*/
const input = process.argv[2];
if (!input) {
process.exit(0);
}
let data;
try {
data = JSON.parse(input);
} catch (e) {
process.exit(0);
}
const text = data.text || '';
// Detect "all" commands
const allPatterns = [
/\ball\s+(pages?|files?|instances?|occurrences?|matches?|items?|entries?|documents?|components?)/i,
/update\s+all/i,
/fix\s+all/i,
/check\s+all/i,
/delete\s+all/i,
/remove\s+all/i,
/modify\s+all/i,
/change\s+all/i
];
const hasAllCommand = allPatterns.some(pattern => pattern.test(text));
if (hasAllCommand) {
console.log('\n⚠ "ALL" COMMAND DETECTED (inst_040)\n');
console.log('User request contains "all" - comprehensive verification required:\n');
console.log('1. Use Glob/Grep to find ALL matches (not just examples)');
console.log('2. List EVERY item found with file:line references');
console.log('3. Confirm with user before proceeding');
console.log('4. Track completion of EACH item individually\n');
console.log('NEVER assume "all" means "a few examples" - find EVERYTHING.\n');
}
process.exit(0);