Add /log and /debug commands for troubleshooting

- /log command to view and analyze automation logs
  - Filter by pattern, date, or log type
  - List available log files
- /debug command generates comprehensive debug report
  - Version, core files, state, memory, scripts status
  - Environment info (Python, kubectl)
  - Disk usage by directory
  - JSON output mode for scripting
- Updated shell completions with 13 aliases total
- Test suite now covers 21 tests

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OpenCode Test
2026-01-01 18:44:40 -08:00
parent 125bb4904b
commit c1a3c1812c
9 changed files with 596 additions and 6 deletions

View File

@@ -15,6 +15,8 @@ Slash commands for quick actions. User-invoked (type `/command` to trigger).
| `/remember` | `/save`, `/note` | Quick save to memory |
| `/config` | `/settings`, `/prefs` | View/manage configuration |
| `/search` | `/find`, `/lookup` | Search memory, history, config |
| `/log` | `/logs`, `/logview` | View and analyze logs |
| `/debug` | `/diag`, `/diagnose` | Debug and troubleshoot config |
| `/maintain` | `/maintenance`, `/admin` | Configuration maintenance |
| `/programmer` | | Code development tasks |
| `/gcal` | `/calendar`, `/cal` | Google Calendar access |

48
commands/debug.md Normal file
View File

@@ -0,0 +1,48 @@
---
name: debug
description: Debug and troubleshoot Claude Code configuration
aliases: [diag, diagnose]
invokes: skill:debug
---
# Debug Command
Generate a debug report for troubleshooting.
## Usage
```
/debug # Full debug report
/debug --paths # Show configuration paths
/debug --json # Output as JSON
```
## Implementation
Run the debug script:
```bash
~/.claude/automation/debug.sh [options]
```
## Report Sections
| Section | Contents |
|---------|----------|
| Version | Current configuration version |
| Core Files | Status of essential files |
| State Files | PA preferences, session context, autonomy |
| Memory Files | Preferences, decisions, projects, facts |
| Key Scripts | Executable status of automation scripts |
| Skills | List of available skills |
| Commands | Count of slash commands |
| Agents | Count of agent files |
| Environment | Shell, Python, kubectl status |
| Disk Usage | Space used by each directory |
## JSON Output
Use `--json` for machine-readable output, useful for:
- Automated health checks
- Monitoring integration
- Scripting

39
commands/log.md Normal file
View File

@@ -0,0 +1,39 @@
---
name: log
description: View and analyze Claude Code logs
aliases: [logs, logview]
invokes: skill:log-viewer
---
# Log Command
View and analyze automation logs.
## Usage
```
/log # Show most recent log
/log --list # List all log files
/log <filename> # View specific log
/log --tail 100 # Show last 100 lines
/log --grep "error" # Filter by pattern
/log --since 1d # Show entries from last day
```
## Implementation
Run the log viewer script:
```bash
python3 ~/.claude/automation/log-viewer.py [options]
```
## Options
| Option | Description |
|--------|-------------|
| `--list` | List available log files |
| `--tail N` | Number of lines to show (default: 50) |
| `--grep PATTERN` | Filter by regex pattern |
| `--since DATE` | Filter by date (YYYY-MM-DD or 1d/7d/1h) |
| `--type TYPE` | Filter log files by type |