📦 deps(thirdparty): update snapshots

This commit is contained in:
ci[bot]
2026-05-29 08:33:53 +00:00
parent fdb52f1e96
commit 06e0d13d57
1615 changed files with 232858 additions and 0 deletions
@@ -0,0 +1,243 @@
#!/usr/bin/env bash
# scaffold-command.sh - Generate new Claude Code slash command from template
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Help text
show_help() {
cat << EOF
Usage: $(basename "$0") <command-name> [options]
Generate a new Claude Code slash command with proper structure.
Arguments:
command-name Name of the command (kebab-case, no .md extension)
Options:
-d, --description Command description (default: prompts interactively)
-t, --type Template type: simple, args, bash, files (default: simple)
-o, --output Output directory (default: .claude/commands)
-p, --personal Create in personal commands (~/.claude/commands)
-n, --namespace Namespace directory (e.g., git, test, deploy)
-h, --help Show this help
Examples:
# Simple command in project
$(basename "$0") review
# Command with arguments
$(basename "$0") deploy -t args -d "Deploy to environment"
# Personal command with namespace
$(basename "$0") check-security -p -n security
# Command with bash execution
$(basename "$0") git-status -t bash -n git
EOF
}
# Parse arguments
COMMAND_NAME=""
DESCRIPTION=""
TEMPLATE_TYPE="simple"
OUTPUT_DIR=".claude/commands"
NAMESPACE=""
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
show_help
exit 0
;;
-d|--description)
DESCRIPTION="$2"
shift 2
;;
-t|--type)
TEMPLATE_TYPE="$2"
shift 2
;;
-o|--output)
OUTPUT_DIR="$2"
shift 2
;;
-p|--personal)
OUTPUT_DIR="$HOME/.claude/commands"
shift
;;
-n|--namespace)
NAMESPACE="$2"
shift 2
;;
-*)
echo -e "${RED}Error: Unknown option $1${NC}"
show_help
exit 1
;;
*)
COMMAND_NAME="$1"
shift
;;
esac
done
# Validate command name
if [[ -z "$COMMAND_NAME" ]]; then
echo -e "${RED}Error: Command name required${NC}"
show_help
exit 1
fi
# Validate command name format (kebab-case)
if [[ ! "$COMMAND_NAME" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
echo -e "${RED}Error: Command name must be kebab-case (e.g., my-command)${NC}"
exit 1
fi
# Prompt for description if not provided
if [[ -z "$DESCRIPTION" ]]; then
echo -e "${BLUE}Enter command description:${NC}"
read -r DESCRIPTION
if [[ -z "$DESCRIPTION" ]]; then
echo -e "${YELLOW}Warning: No description provided${NC}"
fi
fi
# Determine output path
if [[ -n "$NAMESPACE" ]]; then
OUTPUT_PATH="$OUTPUT_DIR/$NAMESPACE"
else
OUTPUT_PATH="$OUTPUT_DIR"
fi
FILE_PATH="$OUTPUT_PATH/$COMMAND_NAME.md"
# Create directory if needed
mkdir -p "$OUTPUT_PATH"
# Check if file already exists
if [[ -f "$FILE_PATH" ]]; then
echo -e "${YELLOW}Warning: File already exists: $FILE_PATH${NC}"
echo -e "${BLUE}Overwrite? (y/N):${NC}"
read -r CONFIRM
if [[ ! "$CONFIRM" =~ ^[Yy]$ ]]; then
echo "Aborted"
exit 0
fi
fi
# Generate command based on template type
case "$TEMPLATE_TYPE" in
simple)
cat > "$FILE_PATH" << EOF
---
description: ${DESCRIPTION:-Brief description of what this command does}
---
# ${COMMAND_NAME}
Your command instructions go here.
This is where you define what Claude should do when the user runs /${COMMAND_NAME}.
EOF
;;
args)
cat > "$FILE_PATH" << EOF
---
description: ${DESCRIPTION:-Command with arguments}
argument-hint: <arg1> [arg2]
---
# ${COMMAND_NAME}
Argument 1: \$1
Argument 2: \$2 (optional)
Your command instructions using the arguments above.
For example:
- Process \$1 with configuration from \$2
- Use default if \$2 is not provided
EOF
;;
bash)
cat > "$FILE_PATH" << EOF
---
description: ${DESCRIPTION:-Command with bash execution}
allowed-tools: Bash(*)
---
# ${COMMAND_NAME}
## Context
Current directory: !\`pwd\`
Git branch: !\`git branch --show-current 2>/dev/null || echo "Not a git repo"\`
## Task
Based on the context above, your command instructions go here.
The bash commands will execute before this prompt is processed.
EOF
;;
files)
cat > "$FILE_PATH" << EOF
---
description: ${DESCRIPTION:-Command with file references}
argument-hint: <file-path>
allowed-tools: Read
---
# ${COMMAND_NAME}
File to process: \$1
## File Contents
@\$1
## Task
Based on the file contents above, your command instructions go here.
For example:
- Analyze the file structure
- Explain the code
- Suggest improvements
EOF
;;
*)
echo -e "${RED}Error: Unknown template type: $TEMPLATE_TYPE${NC}"
echo "Valid types: simple, args, bash, files"
exit 1
;;
esac
# Success message
echo -e "${GREEN}✓ Created command: $FILE_PATH${NC}"
echo
echo -e "${BLUE}Usage:${NC} /${COMMAND_NAME}"
if [[ -n "$NAMESPACE" ]]; then
echo -e "${BLUE}Namespaced:${NC} /${NAMESPACE}/${COMMAND_NAME}"
fi
echo
echo -e "${BLUE}Test with:${NC}"
echo " /help | grep $COMMAND_NAME"
echo " /$COMMAND_NAME"
echo
echo -e "${BLUE}Next steps:${NC}"
echo " 1. Edit $FILE_PATH"
echo " 2. Update frontmatter as needed"
echo " 3. Test the command"
echo " 4. Commit to repository"
@@ -0,0 +1,320 @@
#!/usr/bin/env bash
# validate-command.sh - Validate Claude Code slash command structure
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Counters
ERRORS=0
WARNINGS=0
# Help text
show_help() {
cat << EOF
Usage: $(basename "$0") <command-file> [options]
Validate Claude Code slash command structure and frontmatter.
Arguments:
command-file Path to command .md file
Options:
-s, --strict Strict mode (warnings become errors)
-q, --quiet Only show errors and warnings
-h, --help Show this help
Examples:
# Validate single command
$(basename "$0") .claude/commands/deploy.md
# Validate all commands in directory
find .claude/commands -name "*.md" -exec $(basename "$0") {} \;
# Strict validation
$(basename "$0") my-command.md --strict
EOF
}
# Error reporting
error() {
((ERRORS++))
echo -e "${RED}✗ Error:${NC} $1"
}
warning() {
((WARNINGS++))
echo -e "${YELLOW}⚠ Warning:${NC} $1"
}
info() {
if [[ "$QUIET" == "false" ]]; then
echo -e "${BLUE} Info:${NC} $1"
fi
}
success() {
if [[ "$QUIET" == "false" ]]; then
echo -e "${GREEN}$1${NC}"
fi
}
# Parse arguments
COMMAND_FILE=""
STRICT=false
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
show_help
exit 0
;;
-s|--strict)
STRICT=true
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-*)
echo -e "${RED}Error: Unknown option $1${NC}"
show_help
exit 1
;;
*)
COMMAND_FILE="$1"
shift
;;
esac
done
# Validate file argument
if [[ -z "$COMMAND_FILE" ]]; then
echo -e "${RED}Error: Command file required${NC}"
show_help
exit 1
fi
if [[ ! -f "$COMMAND_FILE" ]]; then
error "File not found: $COMMAND_FILE"
exit 1
fi
# Start validation
if [[ "$QUIET" == "false" ]]; then
echo -e "${BLUE}Validating: $COMMAND_FILE${NC}"
echo
fi
# 1. Check filename
FILENAME=$(basename "$COMMAND_FILE")
if [[ ! "$FILENAME" =~ \.md$ ]]; then
error "File must have .md extension"
fi
COMMAND_NAME="${FILENAME%.md}"
if [[ ! "$COMMAND_NAME" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
warning "Command name should be kebab-case: $COMMAND_NAME"
fi
# 2. Check file is not empty
if [[ ! -s "$COMMAND_FILE" ]]; then
error "File is empty"
exit 1
fi
# 3. Extract frontmatter if present
HAS_FRONTMATTER=false
FRONTMATTER=""
IN_FRONTMATTER=false
LINE_NUM=0
CONTENT_START=0
while IFS= read -r line; do
((LINE_NUM++))
if [[ $LINE_NUM -eq 1 && "$line" == "---" ]]; then
HAS_FRONTMATTER=true
IN_FRONTMATTER=true
continue
fi
if [[ "$IN_FRONTMATTER" == "true" ]]; then
if [[ "$line" == "---" ]]; then
IN_FRONTMATTER=false
CONTENT_START=$LINE_NUM
break
fi
FRONTMATTER+="$line"$'\n'
fi
done < "$COMMAND_FILE"
# 4. Validate frontmatter if present
if [[ "$HAS_FRONTMATTER" == "true" ]]; then
success "Frontmatter found"
# Check for unclosed frontmatter
if [[ "$IN_FRONTMATTER" == "true" ]]; then
error "Frontmatter not properly closed (missing closing ---)"
fi
# Validate YAML syntax (basic check)
if ! echo "$FRONTMATTER" | grep -qE '^[a-z-]+:'; then
warning "Frontmatter might have invalid YAML syntax"
fi
# Check for common fields
if echo "$FRONTMATTER" | grep -q '^description:'; then
DESCRIPTION=$(echo "$FRONTMATTER" | grep '^description:' | sed 's/^description: *//')
if [[ -n "$DESCRIPTION" ]]; then
success "Description: $DESCRIPTION"
# Check description length
DESC_LENGTH=${#DESCRIPTION}
if [[ $DESC_LENGTH -gt 100 ]]; then
warning "Description is long ($DESC_LENGTH chars). Consider keeping under 80 chars."
fi
else
warning "Description field is empty"
fi
else
warning "No description field (will use first line of content)"
fi
# Check argument-hint
if echo "$FRONTMATTER" | grep -q '^argument-hint:'; then
ARG_HINT=$(echo "$FRONTMATTER" | grep '^argument-hint:' | sed 's/^argument-hint: *//')
info "Argument hint: $ARG_HINT"
fi
# Check allowed-tools
if echo "$FRONTMATTER" | grep -q '^allowed-tools:'; then
TOOLS=$(echo "$FRONTMATTER" | grep '^allowed-tools:' | sed 's/^allowed-tools: *//')
info "Allowed tools: $TOOLS"
# Validate tool names - check for names starting with lowercase
# Claude tools are PascalCase (Read, Write, BashOutput)
for tool in $(echo "$TOOLS" | tr ',' ' '); do
tool=$(echo "$tool" | xargs) # trim whitespace
if [[ -n "$tool" && "$tool" =~ ^[a-z] ]]; then
warning "Tool name '$tool' starts with lowercase (Claude tools are PascalCase, e.g., 'Read')"
fi
done
fi
# Check model
if echo "$FRONTMATTER" | grep -q '^model:'; then
MODEL=$(echo "$FRONTMATTER" | grep '^model:' | sed 's/^model: *//')
info "Model: $MODEL"
fi
# Check for tabs (YAML doesn't allow tabs)
if echo "$FRONTMATTER" | grep -q $'\t'; then
error "Frontmatter contains tabs (YAML requires spaces)"
fi
else
info "No frontmatter (optional, but recommended)"
fi
# 5. Check content
CONTENT=$(tail -n +"$((CONTENT_START + 1))" "$COMMAND_FILE")
if [[ -z "$CONTENT" ]]; then
error "No content after frontmatter"
else
success "Content present"
# Check content length
CONTENT_LENGTH=${#CONTENT}
if [[ $CONTENT_LENGTH -lt 20 ]]; then
warning "Content is very short ($CONTENT_LENGTH chars)"
fi
# Check for argument usage
if echo "$CONTENT" | grep -qE '\$[0-9]|\$ARGUMENTS'; then
ARG_USAGE=$(echo "$CONTENT" | grep -oE '\$[0-9]|\$ARGUMENTS' | sort -u | tr '\n' ' ')
info "Uses arguments: $ARG_USAGE"
# Check if argument-hint is present
if [[ "$HAS_FRONTMATTER" == "true" ]]; then
if ! echo "$FRONTMATTER" | grep -q '^argument-hint:'; then
warning "Command uses arguments but has no argument-hint in frontmatter"
fi
fi
fi
# Check for bash execution
if echo "$CONTENT" | grep -qE '!\`[^`]+\`'; then
BASH_COUNT=$(echo "$CONTENT" | grep -oE '!\`[^`]+\`' | wc -l | xargs)
info "Uses bash execution ($BASH_COUNT commands)"
# Check if Bash tool is allowed
if [[ "$HAS_FRONTMATTER" == "true" ]]; then
if echo "$FRONTMATTER" | grep -q '^allowed-tools:'; then
if ! echo "$FRONTMATTER" | grep 'allowed-tools:' | grep -q 'Bash'; then
warning "Command uses bash execution but Bash not in allowed-tools"
fi
fi
fi
fi
# Check for file references
if echo "$CONTENT" | grep -qE '@[a-zA-Z0-9$/_.-]+'; then
FILE_REFS=$(echo "$CONTENT" | grep -oE '@[a-zA-Z0-9$/_.-]+' | wc -l | xargs)
info "Uses file references ($FILE_REFS references)"
# Check if Read tool is allowed
if [[ "$HAS_FRONTMATTER" == "true" ]]; then
if echo "$FRONTMATTER" | grep -q '^allowed-tools:'; then
if ! echo "$FRONTMATTER" | grep 'allowed-tools:' | grep -q 'Read'; then
warning "Command uses file references but Read not in allowed-tools"
fi
fi
fi
fi
fi
# 6. Check for common issues
# Unclosed code blocks (odd number of ``` markers indicates unclosed block)
FENCE_COUNT=$(echo "$CONTENT" | grep -c '^```' || true)
if [[ $FENCE_COUNT -gt 0 && $((FENCE_COUNT % 2)) -ne 0 ]]; then
warning "Possibly unclosed code block (odd number of \`\`\` markers)"
fi
# Very long lines
while IFS= read -r line; do
if [[ ${#line} -gt 200 ]]; then
warning "Line longer than 200 characters (consider breaking up)"
break
fi
done < "$COMMAND_FILE"
# Convert warnings to errors in strict mode
if [[ "$STRICT" == "true" && $WARNINGS -gt 0 ]]; then
ERRORS=$((ERRORS + WARNINGS))
WARNINGS=0
fi
# Summary
echo
if [[ $ERRORS -eq 0 && $WARNINGS -eq 0 ]]; then
echo -e "${GREEN}✓ Validation passed!${NC}"
exit 0
elif [[ $ERRORS -eq 0 ]]; then
echo -e "${YELLOW}⚠ Validation passed with $WARNINGS warning(s)${NC}"
exit 0
else
echo -e "${RED}✗ Validation failed with $ERRORS error(s)${NC}"
if [[ $WARNINGS -gt 0 ]]; then
echo -e "${YELLOW} and $WARNINGS warning(s)${NC}"
fi
exit 1
fi