| name | manage_error_debugging |
| description | Manage Error Debugging Automation |
Manage Error Debugging Automation
Manage the error debugging automation monitoring script (start, stop, status, logs).
Command Usage
/manage_error_debugging [action]
Actions:
start - Start the error debugging watcher in background
stop - Stop the running watcher
status - Check if watcher is running and show status
logs - Show recent logs from the watcher
restart - Stop and start the watcher
- (no action) - Show status (default)
Prerequisites
- Error debugging automation enabled in
foundation-config.yaml
scripts/trigger_error_debug_cli.js exists and is executable
- Node.js installed
Workflow
Action: start
-
Check if already running:
- Check for PID file:
.cursor/error_reports/watcher.pid
- If PID file exists, verify process is still running
- If running, exit with message: "Error debugging watcher is already running (PID: {pid})"
-
Verify configuration:
- Load
foundation-config.yaml
- Check
development.error_debugging.enabled === true
- If disabled, exit with error
-
Create necessary directories:
- Ensure
.cursor/error_reports/ exists
- Ensure log directory exists (if configured)
-
Start watcher in background:
- Run:
node scripts/trigger_error_debug_cli.js --watch > .cursor/error_reports/watcher.log 2>&1 &
- Capture PID of background process
- Write PID to
.cursor/error_reports/watcher.pid
- Output: "Started error debugging watcher (PID: {pid})"
-
Verify start:
- Wait 1 second
- Check if process is still running
- If not running, read log file and show error
Action: stop
-
Check if running:
- Read PID from
.cursor/error_reports/watcher.pid
- If PID file doesn't exist, exit: "Error debugging watcher is not running"
-
Verify process exists:
- Check if process with PID is running
- If not running, remove stale PID file and exit: "Watcher process not found (stale PID file removed)"
-
Stop process:
- Send TERM signal to process
- Wait up to 5 seconds for graceful shutdown
- If still running, send KILL signal
- Remove PID file
- Output: "Stopped error debugging watcher (PID: {pid})"
Action: status
-
Check PID file:
- Read
.cursor/error_reports/watcher.pid
- If not found: "Status: Not running"
-
Check if process is running:
- Verify process with PID exists
- If not: "Status: Not running (stale PID file)"
- Remove stale PID file
-
If running, show:
- PID
- Uptime (how long it's been running)
- Configuration status (enabled/disabled)
- Last log entry (if log file exists)
Action: logs
-
Check log file:
- Read
.cursor/error_reports/watcher.log
- If not found: "No log file found. Watcher may not have started yet."
-
Display logs:
- Show last 50 lines (configurable)
- Or tail logs if
--follow flag provided
Action: restart
- Run stop action (if running)
- Wait 1 second
- Run start action
Implementation Notes
PID File Management:
- Store PID in:
.cursor/error_reports/watcher.pid
- Remove PID file on stop or if process not found
Log File:
- Logs written to:
.cursor/error_reports/watcher.log
- Rotate or truncate on restart (optional)
Process Verification:
if ps -p $PID > /dev/null 2>&1; then
fi
Platform-Specific:
- Use
ps command (available on macOS, Linux)
- On Windows, may need
tasklist or PowerShell Get-Process
Configuration
Configure in foundation-config.yaml:
development:
error_debugging:
enabled: true
automation:
watch_mode: true
cursor_cli:
Examples
/manage_error_debugging
/manage_error_debugging status
/manage_error_debugging start
/manage_error_debugging stop
/manage_error_debugging logs
/manage_error_debugging restart
Related Commands
/report - Report an error (triggers debugging if automation enabled)
/debug - Manually debug pending errors (deprecated: use /debug instead)
Error Handling
- If watcher fails to start, show error from log file
- If PID file exists but process not found, clean up stale PID file
- If configuration disabled, prevent start and show message
- On stop, handle graceful shutdown with timeout fallback to KILL