-
Notifications
You must be signed in to change notification settings - Fork 4
Improve install DX with one-line bootstrap #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
|
Comment on lines
+53
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| 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" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Success message prints even when git pull failsLow Severity When |
||
| 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 | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing stdin redirect breaks curl-pipe execution
Medium Severity
The
claude plugin marketplace addandclaude plugin installcommands redirect stdout/stderr but not stdin. The primary install method iscurl | bash, where bash reads the script from stdin (the pipe). Theseclaudecommands inherit that stdin, and if they attempt to read from it (the comment on line 42 notes they "use terminal UI"), they'd consume bytes from the pipe, corrupting the rest of the script execution. Adding< /dev/nullto both invocations prevents this.Additional Locations (1)
scripts/bootstrap.sh#L52-L53