diff --git a/AGENTS.md b/AGENTS.md index 485709a..40f4350 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,12 +32,12 @@ Core project rules that apply to all tasks: **Setup and Installation:** -- `/plugin marketplace add https://github.com/TechNickAI/ai-coding-config` - Add this - marketplace -- `/plugin install ` - Install specific plugin -- `/ai-coding-config` - Interactive setup for projects - `curl -fsSL https://raw.githubusercontent.com/TechNickAI/ai-coding-config/main/scripts/bootstrap.sh | bash` - - Bootstrap for Cursor + One-line install (auto-detects Claude Code, Cursor, etc.) +- `/ai-coding-config` - Interactive setup for projects +- `/plugin marketplace add https://github.com/TechNickAI/ai-coding-config` - Manual + marketplace add +- `/plugin install ai-coding-config` - Manual plugin install ## Code Conventions diff --git a/README.md b/README.md index 3c7d8b6..fd63db3 100644 --- a/README.md +++ b/README.md @@ -19,31 +19,37 @@ patterns. ## Quick Start -**Claude Code:** +### One-line install -```bash -/plugin marketplace add https://github.com/TechNickAI/ai-coding-config -/plugin install ai-coding-config skills -``` - -**Cursor, Windsurf, Cline, or others:** +Run this in your terminal — it auto-detects your tools (Claude Code, Cursor, etc.) and +sets everything up: ```bash curl -fsSL https://raw.githubusercontent.com/TechNickAI/ai-coding-config/main/scripts/bootstrap.sh | bash ``` -Then run the interactive setup: +Then configure for your project: ``` /ai-coding-config ``` -This detects your stack and installs relevant configurations. +### Manual install (Claude Code) + +If you prefer to install manually, run these in Claude Code: + +``` +/plugin marketplace add https://github.com/TechNickAI/ai-coding-config +``` + +``` +/plugin install ai-coding-config +``` ## Todo Persistence Across Compaction -**The problem**: Claude Code's context compaction summarizes conversation history to stay -within token limits. When this happens, your todo list vanishes - you lose track of +**The problem**: Claude Code's context compaction summarizes conversation history to +stay within token limits. When this happens, your todo list vanishes - you lose track of what you were working on. **The solution**: This plugin automatically saves todos to disk via hooks. After @@ -157,9 +163,9 @@ installs relevant rules. ### Debugging -| Agent | Purpose | -| --------------- | ---------------------------------------------------- | -| **debugger** | Root cause analysis through systematic investigation | +| Agent | Purpose | +| ------------ | ---------------------------------------------------- | +| **debugger** | Root cause analysis through systematic investigation | ### Code Review - Correctness diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 8119985..faffdaa 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -4,17 +4,6 @@ set -e echo "🚀 AI Coding Configuration Bootstrap" echo "" -# Check if we're in a git repository -if ! git rev-parse --git-dir > /dev/null 2>&1; then - echo "❌ Error: You're not in a git repository." - echo "" - echo "Move into a project directory first:" - echo " cd ~/your-project" - echo "" - echo "Then run this script again." - exit 1 -fi - # Check OS OS="$(uname -s)" if [[ "$OS" != "Darwin" && "$OS" != "Linux" ]]; then @@ -24,73 +13,132 @@ if [[ "$OS" != "Darwin" && "$OS" != "Linux" ]]; then fi echo "✓ Detected $OS" -echo "✓ In git repository: $(basename $(git rev-parse --show-toplevel))" -echo "" -# Clone or update ai-coding-config -if [ ! -d "$HOME/.ai_coding_config" ]; then - echo "đŸ“Ĩ Cloning ai-coding-config to ~/.ai_coding_config..." - git clone https://github.com/TechNickAI/ai-coding-config.git ~/.ai_coding_config - echo "✓ Cloned successfully" -else - echo "đŸ“Ĩ Updating ~/.ai_coding_config..." - echo " Running: git pull" - cd ~/.ai_coding_config - git pull - cd - > /dev/null - echo "✓ Updated to latest version" -fi +# Detect available AI coding tools +HAS_CLAUDE=false +HAS_CURSOR=false -echo "" +if command -v claude &> /dev/null; then + HAS_CLAUDE=true + echo "✓ Found Claude Code" +fi -# Copy the ai-coding-config command to current repo -echo "📋 Setting up /ai-coding-config command in this project..." +if command -v cursor &> /dev/null || [ -d "/Applications/Cursor.app" ]; then + HAS_CURSOR=true + echo "✓ Found Cursor" +fi -mkdir -p .claude/commands -cp ~/.ai_coding_config/.claude/commands/ai-coding-config.md .claude/commands/ +if [ "$HAS_CLAUDE" = false ] && [ "$HAS_CURSOR" = false ]; then + echo "â„šī¸ No AI coding tools detected on PATH." + echo " Proceeding with file-based setup that works with any tool." +fi -echo "✓ Copied ai-coding-config command" echo "" -# Set up Cursor directory structure -echo "📁 Setting up Cursor directory structure..." - -# Create .cursor directory structure -mkdir -p .cursor/commands - -# For fresh installs without existing rules, create .cursor/rules -if [ ! -d ".cursor/rules" ]; then - mkdir -p .cursor/rules - echo "✓ Created .cursor/rules/" -elif [ -d ".cursor/rules" ] && [ ! -L ".cursor/rules" ]; then - echo "✓ .cursor/rules/ already exists" -elif [ -L ".cursor/rules" ]; then - # Legacy v2 architecture with rules/ at root - suggest migration - echo "âš ī¸ Detected legacy v2 architecture (rules/ symlink)" - echo " Run /ai-coding-config update to migrate to standard architecture" -fi +# ─── Claude Code Setup ─────────────────────────────────────────────── +if [ "$HAS_CLAUDE" = true ]; then + echo "đŸ“Ļ Setting up Claude Code plugin..." + + # Add marketplace (claude plugin commands use terminal UI that suppresses output) + echo " Adding marketplace..." + if ! claude plugin marketplace add https://github.com/TechNickAI/ai-coding-config > /dev/null 2>&1; then + echo "âš ī¸ Marketplace add may have failed. If /ai-coding-config doesn't work, run manually:" + echo " /plugin marketplace add https://github.com/TechNickAI/ai-coding-config" + else + echo "✓ Marketplace configured" + fi + + # Install the plugin + echo " Installing plugin..." + if ! claude plugin install ai-coding-config > /dev/null 2>&1; then + echo "âš ī¸ Plugin install may have failed. Try manually in Claude Code:" + echo " /plugin install ai-coding-config" + else + echo "✓ Plugin installed" + fi -# Check for legacy rules/ directory -if [ -d "rules" ] && [ ! -L "rules" ]; then - echo "âš ī¸ Found legacy rules/ directory" - echo " Run /ai-coding-config update to migrate to .cursor/rules/" + echo "" + echo "✨ Claude Code setup complete!" + echo "" + echo "Next step — run this in Claude Code:" + echo " /ai-coding-config" + echo "" fi -echo "" +# ─── Cursor / Other Tools Setup ────────────────────────────────────── +if [ "$HAS_CURSOR" = true ] || [ "$HAS_CLAUDE" = false ]; then + + # Check if we're in a git repository (needed for file-copy approach) + if ! git rev-parse --git-dir > /dev/null 2>&1; then + if [ "$HAS_CLAUDE" = true ]; then + # Claude plugin setup succeeded above. Cursor file-copy setup requires a git + # repo, but we don't need it — exit cleanly rather than erroring. + exit 0 + fi + echo "❌ Error: You're not in a git repository." + echo "" + echo "Move into a project directory first:" + echo " cd ~/your-project" + echo "" + echo "Then run this script again." + exit 1 + fi + + echo "📁 Setting up for Cursor / other AI tools..." + echo "✓ In git repository: $(basename "$(git rev-parse --show-toplevel)")" + echo "" -echo "✨ Bootstrap complete!" -echo "" -echo "Next steps:" -echo "" -echo "From Claude Code:" -echo " /ai-coding-config" -echo "" -echo "From Cursor:" -echo " @ai-coding-config set up this project" -echo "" -echo "The command will guide you through:" -echo "- Choosing an AI personality" -echo "- Selecting relevant rules for your project" -echo "- Copying configurations" -echo "" + # Clone or update ai-coding-config + if [ ! -d "$HOME/.ai_coding_config" ]; then + echo "đŸ“Ĩ Cloning ai-coding-config to ~/.ai_coding_config..." + if ! git clone https://github.com/TechNickAI/ai-coding-config.git ~/.ai_coding_config; then + echo "❌ Failed to clone. Check your internet connection and try again." + exit 1 + fi + echo "✓ Cloned successfully" + else + echo "đŸ“Ĩ Updating ~/.ai_coding_config..." + (cd ~/.ai_coding_config && git pull) || echo "âš ī¸ Update failed. Continuing with existing version." + echo "✓ Updated to latest version" + fi + + echo "" + # Copy the ai-coding-config command to current repo + echo "📋 Setting up /ai-coding-config command..." + mkdir -p .claude/commands + cp ~/.ai_coding_config/.claude/commands/ai-coding-config.md .claude/commands/ + echo "✓ Copied ai-coding-config command" + + # Set up Cursor directory structure + mkdir -p .cursor/commands + + if [ ! -d ".cursor/rules" ]; then + mkdir -p .cursor/rules + echo "✓ Created .cursor/rules/" + elif [ -L ".cursor/rules" ]; then + echo "âš ī¸ Detected legacy v2 architecture (rules/ symlink)" + echo " Run /ai-coding-config update to migrate to standard architecture" + else + echo "✓ .cursor/rules/ already exists" + fi + + if [ -d "rules" ] && [ ! -L "rules" ]; then + echo "âš ī¸ Found legacy rules/ directory" + echo " Run /ai-coding-config update to migrate to .cursor/rules/" + fi + + echo "" + echo "✨ Setup complete!" + echo "" + echo "Next steps:" + echo "" + echo " Claude Code: /ai-coding-config" + echo " Cursor: @ai-coding-config set up this project" + echo "" + echo "The command will guide you through:" + echo " - Choosing an AI personality" + echo " - Selecting relevant rules for your project" + echo " - Copying configurations" + echo "" +fi