- /diff command to compare config with backups - Shows added/removed/changed files - JSON-aware comparison for config files - List available backups - /template command for session templates - Built-in templates: daily-standup, code-review, troubleshoot, deploy - Each template includes checklist, initial commands, prompt - Create custom templates interactively or non-interactively - Updated shell completions with 21 aliases total - Test suite now covers 29 tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
197 lines
5.7 KiB
Bash
197 lines
5.7 KiB
Bash
#!/bin/zsh
|
|
# Zsh completions for Claude Code automation scripts
|
|
# Source this file: source ~/.claude/automation/completions.zsh
|
|
|
|
# Memory add completion
|
|
_memory_add() {
|
|
local -a categories
|
|
categories=('preference:Save as preference' 'decision:Save as decision' 'project:Save as project context' 'fact:Save as fact' 'auto:Auto-categorize')
|
|
|
|
_arguments \
|
|
'1:category:->category' \
|
|
'*:content:' && return 0
|
|
|
|
case $state in
|
|
category)
|
|
_describe 'category' categories
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Memory list completion
|
|
_memory_list() {
|
|
local -a categories
|
|
categories=('preferences' 'decisions' 'projects' 'facts')
|
|
|
|
_arguments \
|
|
'1:category:->category' \
|
|
'--all[Include deprecated items]' && return 0
|
|
|
|
case $state in
|
|
category)
|
|
_describe 'category' categories
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Restore completion
|
|
_claude_restore() {
|
|
local backup_dir="${HOME}/.claude/backups"
|
|
|
|
if [[ -d "${backup_dir}" ]]; then
|
|
_files -g "${backup_dir}/*.tar.gz"
|
|
fi
|
|
}
|
|
|
|
# Search completion
|
|
_claude_search() {
|
|
_arguments \
|
|
'--memory[Search only memory]' \
|
|
'--history[Search only history]' \
|
|
'--config[Search only config]' \
|
|
'--recent[Show recent items]:days:' \
|
|
'*:query:'
|
|
}
|
|
|
|
# History browser completion
|
|
_claude_history() {
|
|
_arguments \
|
|
'--list[List recent sessions]' \
|
|
'--all[Show all sessions]' \
|
|
'--show[Show session details]:session_id:' \
|
|
'--stats[Show statistics]' \
|
|
'--unsummarized[List unsummarized sessions]' \
|
|
'--limit[Limit results]:count:'
|
|
}
|
|
|
|
# Log viewer completion
|
|
_claude_log() {
|
|
_arguments \
|
|
'--list[List log files]' \
|
|
'--tail[Number of lines]:count:' \
|
|
'--grep[Filter pattern]:pattern:' \
|
|
'--since[Since date]:date:' \
|
|
'--type[Log type]:type:' \
|
|
'*:file:'
|
|
}
|
|
|
|
# Debug completion
|
|
_claude_debug() {
|
|
_arguments \
|
|
'--full[Full debug report]' \
|
|
'--json[JSON output]' \
|
|
'--paths[Show paths only]'
|
|
}
|
|
|
|
# Export completion
|
|
_claude_export() {
|
|
_arguments \
|
|
'--list[List sessions]' \
|
|
'--format[Output format]:format:(json markdown md)' \
|
|
'--output[Output file]:file:_files' \
|
|
'*:session_id:'
|
|
}
|
|
|
|
# MCP status completion
|
|
_claude_mcp_status() {
|
|
_arguments \
|
|
'--json[JSON output]'
|
|
}
|
|
|
|
# Upgrade completion
|
|
_claude_upgrade() {
|
|
_arguments \
|
|
'--check[Check for upgrades]' \
|
|
'--backup[Create backup]' \
|
|
'--apply[Apply migrations]:version:' \
|
|
'--help[Show help]'
|
|
}
|
|
|
|
# Workflow completion
|
|
_claude_workflow() {
|
|
_arguments \
|
|
'--category[Filter by category]:category:(health deploy incidents sysadmin)' \
|
|
'--list[List all workflows]' \
|
|
'*:name:'
|
|
}
|
|
|
|
# Skill info completion
|
|
_claude_skill_info() {
|
|
_arguments \
|
|
'--scripts[Show scripts in listing]' \
|
|
'--list[List all skills]' \
|
|
'*:name:'
|
|
}
|
|
|
|
# Agent info completion
|
|
_claude_agent_info() {
|
|
_arguments \
|
|
'--tree[Show hierarchy tree]' \
|
|
'--list[List all agents]' \
|
|
'*:name:'
|
|
}
|
|
|
|
# Config diff completion
|
|
_claude_diff() {
|
|
_arguments \
|
|
'--backup[Backup file]:file:_files' \
|
|
'--list[List backups]' \
|
|
'--json[JSON output]'
|
|
}
|
|
|
|
# Template completion
|
|
_claude_template() {
|
|
_arguments \
|
|
'--list[List templates]' \
|
|
'--create[Create template]:name:' \
|
|
'--use[Use template]:name:' \
|
|
'--delete[Delete template]:name:' \
|
|
'--non-interactive[Non-interactive mode]'
|
|
}
|
|
|
|
# Register completions
|
|
compdef _memory_add memory-add.py
|
|
compdef _memory_list memory-list.py
|
|
compdef _claude_restore restore.sh
|
|
compdef _claude_search search.py
|
|
compdef _claude_history history-browser.py
|
|
compdef _claude_log log-viewer.py
|
|
compdef _claude_debug debug.sh
|
|
compdef _claude_export session-export.py
|
|
compdef _claude_mcp_status mcp-status.sh
|
|
compdef _claude_upgrade upgrade.sh
|
|
compdef _claude_workflow workflow-info.py
|
|
compdef _claude_skill_info skill-info.py
|
|
compdef _claude_agent_info agent-info.py
|
|
compdef _claude_diff config-diff.py
|
|
compdef _claude_template session-template.py
|
|
|
|
# Aliases
|
|
alias claude-validate='~/.claude/automation/validate-setup.sh'
|
|
alias claude-status='~/.claude/automation/quick-status.sh'
|
|
alias claude-backup='~/.claude/automation/backup.sh'
|
|
alias claude-restore='~/.claude/automation/restore.sh'
|
|
alias claude-clean='~/.claude/automation/clean.sh'
|
|
alias claude-memory-add='python3 ~/.claude/automation/memory-add.py'
|
|
alias claude-memory-list='python3 ~/.claude/automation/memory-list.py'
|
|
alias claude-search='python3 ~/.claude/automation/search.py'
|
|
alias claude-history='python3 ~/.claude/automation/history-browser.py'
|
|
alias claude-install='~/.claude/automation/install.sh'
|
|
alias claude-test='~/.claude/automation/test-scripts.sh'
|
|
alias claude-maintenance='~/.claude/automation/daily-maintenance.sh'
|
|
alias claude-log='python3 ~/.claude/automation/log-viewer.py'
|
|
alias claude-debug='~/.claude/automation/debug.sh'
|
|
alias claude-export='python3 ~/.claude/automation/session-export.py'
|
|
alias claude-mcp='~/.claude/automation/mcp-status.sh'
|
|
alias claude-upgrade='~/.claude/automation/upgrade.sh'
|
|
alias claude-workflow='python3 ~/.claude/automation/workflow-info.py'
|
|
alias claude-skill='python3 ~/.claude/automation/skill-info.py'
|
|
alias claude-agent='python3 ~/.claude/automation/agent-info.py'
|
|
alias claude-diff='python3 ~/.claude/automation/config-diff.py'
|
|
alias claude-template='python3 ~/.claude/automation/session-template.py'
|
|
|
|
echo "Claude Code completions loaded (zsh)"
|
|
echo " Aliases: claude-{validate,status,backup,restore,clean,memory-add,memory-list,search}"
|
|
echo " claude-{history,install,test,maintenance,log,debug,export,mcp,upgrade}"
|
|
echo " claude-{workflow,skill,agent,diff,template}"
|