Add Makefile for managing Claude Code config symlinks
- Move commands, scripts, settings to repo root - Add Makefile with install/uninstall/status targets - Symlinks ~/.claude/* to this repo for version control - Update documentation with setup instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
9
scripts/load-forgejo-token.sh
Executable file
9
scripts/load-forgejo-token.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
# Load Forgejo token from macOS Keychain into Claude Code session
|
||||
if [ -n "$CLAUDE_ENV_FILE" ]; then
|
||||
TOKEN=$(security find-generic-password -a "$USER" -s "forgejo-token" -w 2>/dev/null)
|
||||
if [ -n "$TOKEN" ]; then
|
||||
echo "export FORGEJO_TOKEN=\"$TOKEN\"" >> "$CLAUDE_ENV_FILE"
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
50
scripts/pre-commit-checks.sh
Executable file
50
scripts/pre-commit-checks.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# Pre-commit validation script for Claude Code
|
||||
# Validates YAML, checks for secrets, validates K8s manifests
|
||||
|
||||
set -e
|
||||
|
||||
# Get staged files
|
||||
STAGED_FILES=$(git diff --cached --name-only 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$STAGED_FILES" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check for potential secrets in staged files
|
||||
echo "Checking for potential secrets..."
|
||||
SECRET_PATTERN='(password|secret|token|api_key|apikey|private_key).*[=:].{20,}'
|
||||
if echo "$STAGED_FILES" | xargs grep -l -iE "$SECRET_PATTERN" 2>/dev/null | grep -v '.sops.yaml' | grep -v 'secret.*\.enc\.yaml'; then
|
||||
echo "WARNING: Potential secrets detected in staged files (excluding SOPS-encrypted files)"
|
||||
echo "Please verify these are encrypted or not actual secrets."
|
||||
fi
|
||||
|
||||
# Validate YAML syntax
|
||||
echo "Validating YAML syntax..."
|
||||
for file in $(echo "$STAGED_FILES" | grep -E '\.ya?ml$'); do
|
||||
if [ -f "$file" ]; then
|
||||
if ! python3 -c "import yaml; yaml.safe_load(open('$file'))" 2>/dev/null; then
|
||||
echo "ERROR: Invalid YAML syntax: $file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Validate Kubernetes manifests (if kubectl available)
|
||||
if command -v kubectl &>/dev/null; then
|
||||
echo "Validating Kubernetes manifests..."
|
||||
for file in $(echo "$STAGED_FILES" | grep -E '\.ya?ml$'); do
|
||||
if [ -f "$file" ] && grep -q "^kind:" "$file" 2>/dev/null; then
|
||||
# Skip SOPS-encrypted files and kustomization files
|
||||
if echo "$file" | grep -qE '(\.sops\.yaml|\.enc\.yaml|kustomization\.yaml)$'; then
|
||||
continue
|
||||
fi
|
||||
if ! kubectl apply --dry-run=client -f "$file" 2>/dev/null; then
|
||||
echo "WARNING: Kubernetes validation failed: $file (may be expected for partial manifests)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Pre-commit checks passed."
|
||||
exit 0
|
||||
Reference in New Issue
Block a user