con un clic
bash
This skill should be used when the user asks to 'write a bash script', 'create a shell command', 'work with bash', or 'debug shell commands'. Provides bash patterns and best practices specific to this plugin's command system.
Menú
This skill should be used when the user asks to 'write a bash script', 'create a shell command', 'work with bash', or 'debug shell commands'. Provides bash patterns and best practices specific to this plugin's command system.
| name | bash |
| description | This skill should be used when the user asks to 'write a bash script', 'create a shell command', 'work with bash', or 'debug shell commands'. Provides bash patterns and best practices specific to this plugin's command system. |
| version | 1.0.0 |
| metadata | {"internal":false} |
Bash patterns for ATM command development, focusing on command availability checks, clipboard integration, and report generation.
gh, jira, git)~/Documents/technical-analysis/Always check for external tools before use:
# Check if gh CLI is available
if ! command -v gh &> /dev/null; then
echo "Error: GitHub CLI (gh) is required but not installed."
echo "Install: brew install gh"
exit 1
fi
# Check authentication status
if ! gh auth status &> /dev/null; then
echo "Error: GitHub CLI not authenticated."
echo "Run: gh auth login"
exit 1
fi
Common tools to check:
gh - GitHub CLIjira - JIRA CLIgit - Version controlpbcopy / xclip - Clipboard toolsCross-platform clipboard handling:
# macOS (primary target)
echo "content" | pbcopy
# Linux fallback
if command -v xclip &> /dev/null; then
echo "content" | xclip -selection clipboard
elif command -v xsel &> /dev/null; then
echo "content" | xsel --clipboard --input
else
echo "Warning: No clipboard tool found (install xclip or xsel)"
fi
Standardized report output:
# Use environment variable with fallback
REPORT_BASE="${REPORT_BASE:-$HOME/Documents/technical-analysis}"
# Create directory structure
REPORT_DIR="$REPORT_BASE/audits"
mkdir -p "$REPORT_DIR"
# Generate timestamped filename
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
REPORT_FILE="$REPORT_DIR/angular-style-audit_${TIMESTAMP}.md"
# Write report
cat > "$REPORT_FILE" <<EOF
# Angular Style Audit
Date: $(date +%Y-%m-%d)
## Findings
...
EOF
echo "Report saved: $REPORT_FILE"
Extract ticket IDs from branch names:
# Get current branch
BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Extract JIRA ticket (e.g., PRO-1234, BUG-567)
TICKET=$(echo "$BRANCH" | grep -oE '[A-Z]+-[0-9]+' | head -1)
if [ -z "$TICKET" ]; then
echo "No JIRA ticket found in branch name"
read -p "Enter ticket ID manually (or press enter to skip): " TICKET
fi
Analyze staged changes for commit messages:
# Get staged diff
STAGED_DIFF=$(git diff --cached)
if [ -z "$STAGED_DIFF" ]; then
echo "No staged changes found."
echo "Run: git add <files>"
exit 1
fi
# Get staged file list
STAGED_FILES=$(git diff --cached --name-only)
# Get diff with context
git diff --cached --unified=3
Support --branch or -b flags for auditing only changed files:
# Parse arguments
BRANCH_MODE=false
for arg in "$@"; do
if [[ "$arg" == "--branch" ]] || [[ "$arg" == "-b" ]]; then
BRANCH_MODE=true
fi
done
# Get files to audit
if [ "$BRANCH_MODE" = true ]; then
# Only changed files
FILES=$(git diff --name-only main...HEAD | grep '\.ts$')
else
# All files
FILES=$(find src -name '*.ts')
fi
Graceful failures with informative messages:
# Exit on undefined variables
set -u
# Function with error handling
fetch_pr_details() {
local pr_number=$1
if ! PR_DATA=$(gh pr view "$pr_number" --json title,body,headRefName 2>&1); then
echo "Error: Failed to fetch PR #$pr_number"
echo "$PR_DATA"
return 1
fi
echo "$PR_DATA"
}
Support for related repositories:
# Check for frontend repo
EDU_CLIENTS_PATH="${EDU_CLIENTS_PATH:-../edu-clients}"
if [ -d "$EDU_CLIENTS_PATH/.git" ]; then
echo "Found frontend repo at $EDU_CLIENTS_PATH"
# Search both repos
grep -r "pattern" src/ "$EDU_CLIENTS_PATH/src/"
else
echo "Frontend repo not found (searched: $EDU_CLIENTS_PATH)"
echo "Set EDU_CLIENTS_PATH to override"
fi
REPORT_BASE, EDU_CLIENTS_PATH)mkdir -p)"$VAR" not $VARcd $PATH breaks with spaces → cd "$PATH"gh exists → check with command -v/Users/aaron/... → use $HOME or env varsgh pr view fails silently → capture stderr and check exit codepbcopy fails on Linux → provide fallbackpbcopy (macOS) or xclip/xsel (Linux)jira init)gh auth login)~/Documents/technical-analysis/ is writablefeature/PRO-1234-description