From bb2f5ca02a00d392bf5f662f24295a07bd3b7858 Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Sat, 7 Mar 2026 09:07:15 -0600 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20Improve=20install=20DX=20with?= =?UTF-8?q?=20one-line=20bootstrap=20for=20Claude=20Code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bootstrap script now auto-detects Claude Code and Cursor, running `claude plugin marketplace add` and `claude plugin install` automatically. Users no longer need to manually type slash commands after curl | bash. - Auto-detect claude CLI and run plugin setup non-interactively - Auto-detect Cursor via .cursor dir, PATH, or /Applications/Cursor.app - Proper error handling with fallback instructions on failure - Use subshell for git pull to avoid cd/cd- issues - README: separate code blocks for each slash command (individually copyable) - README: no bash language tag on slash commands Co-Authored-By: Claude Opus 4.6 --- AGENTS.md | 10 +-- README.md | 34 ++++---- scripts/bootstrap.sh | 185 +++++++++++++++++++++++++++---------------- 3 files changed, 141 insertions(+), 88 deletions(-) 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..fb92c67 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,131 @@ 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 [ -d ".cursor" ] || 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 setup already succeeded above, just skip Cursor setup + 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 From c71a87f1e8ec71f5d875e0812d3e5e0919759207 Mon Sep 17 00:00:00 2001 From: Nick Sullivan Date: Sat, 7 Mar 2026 09:11:32 -0600 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20bash=20quoting,=20drop?= =?UTF-8?q?=20fragile=20.cursor=20dir=20detection,=20clarify=20exit=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Quote inner subshell in basename call (handles paths with spaces) - Remove .cursor dir detection (CWD-dependent, causes false positives) Cursor detection now relies on PATH and /Applications/Cursor.app only - Add comment explaining why exit 0 when Claude succeeded but no git repo Co-Authored-By: Claude Opus 4.6 --- scripts/bootstrap.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index fb92c67..faffdaa 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -23,7 +23,7 @@ if command -v claude &> /dev/null; then echo "✓ Found Claude Code" fi -if [ -d ".cursor" ] || command -v cursor &> /dev/null || [ -d "/Applications/Cursor.app" ]; then +if command -v cursor &> /dev/null || [ -d "/Applications/Cursor.app" ]; then HAS_CURSOR=true echo "✓ Found Cursor" fi @@ -71,7 +71,8 @@ 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 setup already succeeded above, just skip Cursor setup + # 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." @@ -84,7 +85,7 @@ if [ "$HAS_CURSOR" = true ] || [ "$HAS_CLAUDE" = false ]; then fi echo "📁 Setting up for Cursor / other AI tools..." - echo "✓ In git repository: $(basename $(git rev-parse --show-toplevel))" + echo "✓ In git repository: $(basename "$(git rev-parse --show-toplevel)")" echo "" # Clone or update ai-coding-config