|
|
8 luni în urmă | |
|---|---|---|
| .. | ||
| .claude-plugin | 95380b3cd5 Add caffeinate plugin to prevent blocking sleep commands | 8 luni în urmă |
| hooks | 95380b3cd5 Add caffeinate plugin to prevent blocking sleep commands | 8 luni în urmă |
| README.md | 95380b3cd5 Add caffeinate plugin to prevent blocking sleep commands | 8 luni în urmă |
A Claude Code plugin that blocks sleep commands and reminds Claude to use background tasks instead.
When Claude uses sleep commands in Bash, it blocks the session unnecessarily. This plugin intercepts these commands and suggests using proper async patterns like:
run_in_background: true parameter for long-running commands# From the plugin directory
claude --plugin-dir /path/to/caffeinate
Or copy to your project's .claude-plugin/ directory.
| Command | Blocked? | Reason |
|---|---|---|
sleep 5 |
Yes | Direct sleep command |
sleep $TIMEOUT |
Yes | Sleep with variable |
echo "test" && sleep 5 |
Yes | Sleep after separator, outside quotes |
cmd; sleep 10 |
Yes | Sleep after semicolon |
echo "sleep 8 hours" |
No | Sleep is inside quotes (not a command) |
echo "foo && sleep 5" |
No | Entire sleep pattern is in a string |
The plugin uses a PreToolUse hook on the Bash tool to:
sleepsleep after command separators (&&, ||, ;, |)sleep appears inside stringsInstead of:
sleep 5 && check_status
Use background execution:
# Run in background with run_in_background: true
long_running_command
Or poll for conditions:
# Poll for a file to exist
while [ ! -f /tmp/ready ]; do :; done