From 3f13a5160aedbc5d997fad8335dfefe41708767e Mon Sep 17 00:00:00 2001 From: Claude Code Bot Date: Fri, 2 Oct 2026 12:57:31 -0700 Subject: [PATCH] chore: ignore .claude/ by default Untrack files under .claude/ that the new rule ignores: they are the generated scaffold or machine-local settings. The files stay on disk. Advances smartwatermelon/dev-env#178 --- .claude/README.md | 165 ---------------------------------- .claude/config.sh.template | 175 ------------------------------------- .gitignore | 3 + 3 files changed, 3 insertions(+), 340 deletions(-) delete mode 100644 .claude/README.md delete mode 100644 .claude/config.sh.template create mode 100644 .gitignore diff --git a/.claude/README.md b/.claude/README.md deleted file mode 100644 index beadc3e..0000000 --- a/.claude/README.md +++ /dev/null @@ -1,165 +0,0 @@ -# Claude Code Infrastructure - Project-Specific - -This directory was automatically created by Git template when you initialized or cloned this repository. - -## What is this? - -The `.claude/` directory provides project-specific configuration for Claude Code CLI (CCCLI) collaboration. It integrates with global infrastructure at `~/.claude/` to provide: - -- Project-specific configuration (Node version, required tools, deployment secrets) -- Project-local documentation and patterns - -## Directory Structure - -```text -.claude/ -├── README.md # This file -└── config.sh.template # Template for project configuration -``` - -## Quick Start - -### Option 1: No Additional Configuration Needed - -If your project doesn't need special validation, required secrets, or version constraints, **you're done**! Your project already benefits from global infrastructure: - -- Global git hooks (pre-commit, pre-push) -- Code review automation -- Branch protection -- Standard workflows - -### Option 2: Add Project Configuration - -If you need project-specific settings: - -1. Copy the template: - - ```bash - cp .claude/config.sh.template .claude/config.sh - ``` - -2. Edit `.claude/config.sh` to define: - - Required Node version - - Required tools (EAS, Maestro, jq, etc.) - - Deployment secrets - - Custom pre/post build hooks - -3. Update your build/deploy scripts to source the config: - - ```bash - # In build scripts - source "${HOME}/.claude/lib/build-commons.sh" - [[ -f ".claude/config.sh" ]] && source ".claude/config.sh" - run_preflight_checks - - # In deploy scripts - source "${HOME}/.claude/lib/deploy-commons.sh" - source ".claude/config.sh" - verify_cloudflare_secrets "${DEPLOYMENT_REQUIRED_SECRETS[@]}" - ``` - -### Option 3: Add Custom Hook Extensions - -Project-specific git hook extensions do **not** live in `.claude/`. They live in -`.project-hooks/` at the repository root: - -- `.project-hooks/pre-commit` — runs after the global lint pass, before the AI review -- `.project-hooks/pre-push` — same seam for push-time checks - -Both must be executable (`chmod +x`). The trust model is the same as any build -tooling: if you cloned the repo and are committing to it, you trust its scripts. - -```bash -touch .project-hooks/pre-commit -chmod +x .project-hooks/pre-commit -``` - -The contract is exit 0 to allow the git operation, exit 1 to block it. - -## Common Patterns - -### Node.js Project with Version Requirement - -```bash -# .claude/config.sh -export REQUIRED_NODE_VERSION="20" -``` - -### Project with Deployment Secrets - -```bash -# .claude/config.sh -export DEPLOYMENT_REQUIRED_SECRETS=( - "API_KEY" - "DATABASE_URL" - "JWT_SECRET" -) -``` - -### Custom Security Check - -```bash -# .project-hooks/pre-commit -#!/usr/bin/env bash - -# Block commits with hardcoded API keys -if git diff --cached | grep -iE 'API_KEY.*=.*"[A-Za-z0-9]{32}"'; then - echo "ERROR: Hardcoded API key detected" - exit 1 -fi - -exit 0 -``` - -## Integration with Global Infrastructure - -Global hooks at `~/.config/git/hooks/` run the project-local extensions in -`.project-hooks/`. Nothing executes files inside `.claude/` — that directory is -configuration and documentation only. - -**Global Infrastructure Documentation**: `~/.claude/docs/INFRASTRUCTURE.md` - -## Files Included - -### config.sh.template - -Template for project configuration. Copy to `config.sh` and customize with your project's requirements. - -## Next Steps - -1. **Review your needs**: Do you need project-specific configuration or validation? -2. **If yes**: Follow Quick Start Option 2 or 3 above -3. **If no**: You're done! Just start working - -## Documentation - -- **Global Infrastructure**: `~/.claude/docs/INFRASTRUCTURE.md` -- **Build Patterns**: `~/.claude/docs/BUILD_PATTERNS.md` (if exists) -- **Deployment Patterns**: `~/.claude/docs/DEPLOYMENT_PATTERNS.md` (if exists) -- **Hook System**: `~/.claude/docs/HOOKS.md` (if exists) - -## Troubleshooting - -### Extensions not running? - -```bash -# Check the extension exists at the right path and is executable -ls -la .project-hooks/ - -# Make executable if needed -chmod +x .project-hooks/pre-commit .project-hooks/pre-push -``` - -### Config not being used? - -```bash -# Verify config exists and is sourced -ls -la .claude/config.sh - -# Check your build/deploy scripts source it -grep -r "source.*config.sh" scripts/ -``` - -### Need help? - -See global infrastructure documentation at `~/.claude/docs/INFRASTRUCTURE.md` for complete reference. diff --git a/.claude/config.sh.template b/.claude/config.sh.template deleted file mode 100644 index 9a65a0d..0000000 --- a/.claude/config.sh.template +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env bash -# Project Configuration Template -# Copy to .claude/config.sh and customize for your project -# -# This file is sourced by: -# - Build scripts (when using build-commons.sh) -# - Deploy scripts (when using deploy-commons.sh) -# - Any other scripts that need project-specific configuration - -# ============================================ -# NODE.JS PROJECTS -# ============================================ - -# Required Node version (used by build-commons.sh) -# Uncomment and set to your required major version -# export REQUIRED_NODE_VERSION="20" - -# Additional required tools beyond standard development tools -# build-commons.sh will verify these are installed -export PROJECT_REQUIRED_TOOLS=( - # "eas" # Expo Application Services (React Native) - # "maestro" # Mobile E2E testing framework - # "jq" # JSON parsing (for CI/CD scripts) - # "wrangler" # Cloudflare Workers CLI -) - -# ============================================ -# DEPLOYMENT CONFIGURATION -# ============================================ - -# Required secrets for deployment (hard-blocks deployment if missing) -# Example: Cloudflare Workers secrets -export DEPLOYMENT_REQUIRED_SECRETS=( - # "API_KEY" - # "DATABASE_URL" - # "JWT_SECRET" -) - -# Optional secrets (warns if missing, doesn't block) -export DEPLOYMENT_OPTIONAL_SECRETS=( - # "SENTRY_DSN" - # "ANALYTICS_KEY" - # "FEATURE_FLAG_KEY" -) - -# Deployment smoke test endpoints (relative to base URL) -# Used by deploy-commons.sh run_endpoint_smoke_tests() -export DEPLOYMENT_SMOKE_TEST_ENDPOINTS=( - # "/health" - # "/api/v1/status" - # "/.well-known/health" -) - -# ============================================ -# BUILD CONFIGURATION -# ============================================ - -# Skip certain checks if needed (use sparingly) -# export SKIP_NODE_VERSION_CHECK=1 -# export SKIP_DEPENDENCY_CHECK=1 - -# Custom npm/yarn/pnpm commands -# export NPM_CLIENT="pnpm" # Default: npm -# export TEST_COMMAND="npm test" -# export BUILD_COMMAND="npm run build" - -# ============================================ -# CUSTOM HOOKS -# ============================================ - -# Pre-build validation (called by build-commons.sh if this function exists) -# Return 0 for success, 1 for failure -pre_build_validation() { - # Add your project-specific validation here - - # Example: Check for uncommitted config changes - # if ! git diff-index --quiet HEAD -- config.json; then - # echo "WARNING: Uncommitted changes in config.json" - # read -p "Continue anyway? (y/N): " -n 1 -r - # echo - # [[ ! ${REPLY} =~ ^[Yy]$ ]] && return 1 - # fi - - # Example: Verify environment variables - # if [[ -z "${REQUIRED_ENV_VAR}" ]]; then - # echo "ERROR: REQUIRED_ENV_VAR not set" - # return 1 - # fi - - return 0 -} - -# Post-build validation (called by build-commons.sh if this function exists) -# Return 0 for success, 1 for failure -post_build_validation() { - # Add your project-specific validation here - - # Example: Check build output - # if [[ ! -f "dist/index.js" ]]; then - # echo "ERROR: Build did not produce expected output" - # return 1 - # fi - - # Example: Run bundle size check - # local bundle_size=$(stat -f%z dist/bundle.js) - # local max_size=$((500 * 1024)) # 500KB - # if [[ ${bundle_size} -gt ${max_size} ]]; then - # echo "WARNING: Bundle size ${bundle_size} bytes exceeds ${max_size} bytes" - # return 1 - # fi - - return 0 -} - -# Pre-deploy validation (called by deploy-commons.sh if this function exists) -# Return 0 for success, 1 for failure -pre_deploy_validation() { - # Add your project-specific validation here - - # Example: Check git status - # if ! git diff-index --quiet HEAD --; then - # echo "ERROR: Uncommitted changes detected" - # echo "Deploy from clean working directory only" - # return 1 - # fi - - # Example: Verify on correct branch - # local current_branch=$(git branch --show-current) - # if [[ "${current_branch}" != "main" ]]; then - # echo "WARNING: Deploying from branch '${current_branch}', not 'main'" - # read -p "Continue? (y/N): " -n 1 -r - # echo - # [[ ! ${REPLY} =~ ^[Yy]$ ]] && return 1 - # fi - - return 0 -} - -# Post-deploy validation (called by deploy-commons.sh if this function exists) -# Return 0 for success, 1 for failure -post_deploy_validation() { - # Add your project-specific validation here - - # Example: Tag deployment - # local version=$(jq -r .version package.json) - # git tag -a "deploy-${version}-$(date +%Y%m%d-%H%M%S)" -m "Deployed version ${version}" - - return 0 -} - -# ============================================ -# PROJECT-SPECIFIC VARIABLES -# ============================================ - -# Add any other project-specific configuration here -# export PROJECT_NAME="my-app" -# export PROJECT_ENV="production" -# export API_BASE_URL="https://api.example.com" - -# ============================================ -# USAGE EXAMPLES -# ============================================ - -# In build scripts: -# source "${HOME}/.claude/lib/build-commons.sh" -# [[ -f ".claude/config.sh" ]] && source ".claude/config.sh" -# run_preflight_checks -# # Your build commands here - -# In deploy scripts: -# source "${HOME}/.claude/lib/deploy-commons.sh" -# source ".claude/config.sh" -# verify_cloudflare_secrets "${DEPLOYMENT_REQUIRED_SECRETS[@]}" -# # Your deploy commands here -# run_endpoint_smoke_tests "${BASE_URL}" "${DEPLOYMENT_SMOKE_TEST_ENDPOINTS[@]}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b23881b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Claude Code local state and the generated .claude/ scaffold. +# Share a file by negating it: .claude/* then !.claude/ +.claude/